repair default keyframe load, tweak init default histogram threshold
[goodguy/history.git] / cinelerra-5.1 / cinelerra / menuattachtransition.C
index 143bcdb9a79655cae094ca34d4af376d39b993c8..13307fb9fc695f522a9176fa99d33788c3a24d87 100644 (file)
@@ -129,6 +129,45 @@ TransitionDialog::TransitionDialog(MWindow *mwindow,
        this->thread = thread;
 }
 
+TransitionSetDefault::TransitionSetDefault(TransitionDialog *window, int x, int y)
+ : BC_GenericButton(x, y, _("Set Default Transition"))
+{
+       this->window = window;
+}
+
+TransitionSetDefault::~TransitionSetDefault()
+{
+}
+
+int TransitionSetDefault::handle_event()
+{
+       TransitionDialogThread *thread = (TransitionDialogThread *)window->thread;
+       const char *transition_title = thread->transition_title;
+       EDL *edl = window->mwindow->edl;
+       switch( thread->data_type ) {
+       case TRACK_AUDIO:
+               strcpy(edl->session->default_atransition, transition_title);
+               break;
+       case TRACK_VIDEO:
+               strcpy(edl->session->default_vtransition, transition_title);
+               break;
+       }
+       window->set_default_text->update(transition_title);
+       return 1;
+}
+
+TransitionDefaultText::TransitionDefaultText(TransitionDialog *window,
+       int x, int y, int w, const char * text)
+ : BC_TextBox(x, y, w, 1, text)
+{
+       this->window = window;
+}
+
+TransitionDefaultText::~TransitionDefaultText()
+{
+}
+
+
 void TransitionDialog::create_objects()
 {
        int x = 10;
@@ -142,7 +181,22 @@ void TransitionDialog::create_objects()
                x,
                y,
                get_w() - x - x,
-               get_h() - y - BC_OKButton::calculate_h() - 10));
+               get_h() - y - BC_OKButton::calculate_h() - 100));
+       y += name_list->get_h() + 20;
+       add_subwindow(set_default = new TransitionSetDefault(this, x, y));
+       y += set_default->get_h() + 10;
+       const char *default_transition = "";
+       EDL *edl = mwindow->edl;
+       switch( thread->data_type ) {
+       case TRACK_AUDIO:
+               default_transition = edl->session->default_atransition;
+               break;
+       case TRACK_VIDEO:
+               default_transition = edl->session->default_vtransition;
+               break;
+       }
+       add_subwindow(set_default_text = new TransitionDefaultText(this, x, y,
+                       get_w()-x-20, default_transition));
        if( thread->number >= 0 ) {
                name_list->update_selection(&thread->transition_names, thread->number, 0);
                name_list->draw_items(0);
@@ -161,11 +215,12 @@ int TransitionDialog::resize_event(int w, int h)
 
        name_title->reposition_window(x, y);
        y += name_title->get_h() + 5;
-       name_list->reposition_window(x,
-               y,
-               w - x - x,
-               h - y - BC_OKButton::calculate_h() - 10);
-
+       name_list->reposition_window(x, y,
+               w - x - x, h - y - BC_OKButton::calculate_h() - 100);
+       y += name_list->get_h() + 20;
+       set_default->reposition_window(x, y);
+       y += set_default->get_h() + 10;
+       set_default_text->reposition_window(x, y, get_w()-x-20);
        return 1;
 }