fix awdw solo vicon crash, fix nested clip for binfolders, open edit edl
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / keyframegui.C
index 49c9022900ce2e35620e8d0fdc00346af5c8f46c..61a0b052aa3cdf34f74eebedfa76984b61dd4a2d 100644 (file)
@@ -46,7 +46,7 @@ KeyFrameThread::KeyFrameThread(MWindow *mwindow)
  : BC_DialogThread()
 {
        this->mwindow = mwindow;
-       plugin = 0;
+       plugin_id = -1;
        keyframe = 0;
        keyframe_data = new ArrayList<BC_ListBoxItem*>[KEYFRAME_COLUMNS];
        plugin_title[0] = 0;
@@ -74,6 +74,7 @@ KeyFrameThread::~KeyFrameThread()
 
 
 #ifdef EDIT_KEYFRAME
+
 void KeyFrameThread::update_values()
 {
 // Get the current selection before deleting the tables
@@ -91,7 +92,8 @@ void KeyFrameThread::update_values()
 
 // Must lock main window to read keyframe
        mwindow->gui->lock_window("KeyFrameThread::update_values");
-       if( !plugin || !mwindow->edl->tracks->plugin_exists(plugin) ) {
+       Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id);
+       if( !plugin ) {
                mwindow->gui->unlock_window();
                return;
        }
@@ -139,16 +141,16 @@ void KeyFrameThread::update_values()
        }
        mwindow->gui->unlock_window();
 }
-#endif
 
+#endif
 
 void KeyFrameThread::start_window(Plugin *plugin, KeyFrame *keyframe)
 {
 
        if( !BC_DialogThread::is_running() ) {
-               if( !mwindow->edl->tracks->plugin_exists(plugin) ) return;
+               if( !mwindow->edl->tracks->plugin_exists(plugin->orig_id) ) return;
                this->keyframe = keyframe;
-               this->plugin = plugin;
+               this->plugin_id = plugin->orig_id;
                this->preset_text[0] = 0;
                plugin->calculate_title(plugin_title, 0);
                sprintf(window_title, _("%s: %s Keyframe"), _(PROGRAM_NAME), plugin_title);
@@ -206,13 +208,15 @@ void KeyFrameThread::handle_done_event(int result)
 {
 // Apply the preset
        if( !result ) {
+               get_gui()->lock_window("KeyFrameThread::handle_done_event");
                apply_preset(preset_text, is_factory);
+               get_gui()->unlock_window();
        }
 }
 
 void KeyFrameThread::handle_close_event(int result)
 {
-       plugin = 0;
+       plugin_id = -1;
        keyframe = 0;
 }
 
@@ -291,7 +295,8 @@ void KeyFrameThread::save_preset(const char *title, int is_factory)
        mwindow->gui->lock_window("KeyFrameThread::save_preset");
        
 // Test EDL for plugin existence
-       if( !mwindow->edl->tracks->plugin_exists(plugin) ) {
+       Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id);
+       if( !plugin ) {
                mwindow->gui->unlock_window();
                get_gui()->lock_window("KeyFrameThread::save_preset 2");
                return;
@@ -322,7 +327,8 @@ void KeyFrameThread::delete_preset(const char *title, int is_factory)
        mwindow->gui->lock_window("KeyFrameThread::save_preset");
        
 // Test EDL for plugin existence
-       if( !mwindow->edl->tracks->plugin_exists(plugin) ) {
+       Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id);
+       if( !plugin ) {
                mwindow->gui->unlock_window();
                get_gui()->lock_window("KeyFrameThread::delete_preset 1");
                return;
@@ -347,7 +353,8 @@ void KeyFrameThread::apply_preset(const char *title, int is_factory)
                mwindow->gui->lock_window("KeyFrameThread::apply_preset");
 
 // Test EDL for plugin existence
-               if( !mwindow->edl->tracks->plugin_exists(plugin) ) {
+               Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id);
+               if( !plugin ) {
                        mwindow->gui->unlock_window();
                        get_gui()->lock_window("KeyFrameThread::apply_preset 1");
                        return;
@@ -378,6 +385,7 @@ void KeyFrameThread::apply_preset(const char *title, int is_factory)
 }
 
 #ifdef EDIT_KEYFRAME
+
 void KeyFrameThread::apply_value()
 {
        const char *text = 0, *data = 0;
@@ -400,7 +408,8 @@ void KeyFrameThread::apply_value()
 
        get_gui()->unlock_window();
        mwindow->gui->lock_window("KeyFrameThread::apply_value");
-       if( plugin && mwindow->edl->tracks->plugin_exists(plugin) ) {
+       Plugin *plugin = mwindow->edl->tracks->plugin_exists(plugin_id);
+       if( plugin ) {
                mwindow->undo->update_undo_before();
                if( mwindow->session->keyframedialog_all ) {
 // Search for all keyframes in selection but don't create a new one.
@@ -446,25 +455,16 @@ printf("KeyFrameThread::apply_value %d: plugin doesn't exist\n", __LINE__);
        get_gui()->lock_window("KeyFrameThread::apply_value");
        delete hash;
 }
-#endif
 
+#endif
 
 
-KeyFrameWindow::KeyFrameWindow(MWindow *mwindow,
-       KeyFrameThread *thread,
-       int x,
-       int y,
-       char *title_string)
- : BC_Window(title_string, 
-       x,
-       y,
-       mwindow->session->keyframedialog_w, 
-       mwindow->session->keyframedialog_h, 
-       320, 
-       240,
-       1,
-       0,
-       1)
+KeyFrameWindow::KeyFrameWindow(MWindow *mwindow, KeyFrameThread *thread,
+               int x, int y, char *title_string)
+ : BC_Window(title_string, x, y,
+               mwindow->session->keyframedialog_w, 
+               mwindow->session->keyframedialog_h, 
+               xS(320), yS(240), 1, 0, 1)
 {
        this->mwindow = mwindow;
        this->thread = thread;
@@ -481,42 +481,40 @@ void KeyFrameWindow::create_objects()
 
 #ifdef EDIT_KEYFRAME
 
-
-       add_subwindow(title1 = new BC_Title(theme->keyframe_list_x,
-               theme->keyframe_list_y - BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) - 
-                       theme->widget_border, _("Keyframe parameters:"), LARGEFONT));
-       add_subwindow(keyframe_list = new KeyFrameList(thread,
-               this,
-               theme->keyframe_list_x,
-               theme->keyframe_list_y,
-               theme->keyframe_list_w, 
-               theme->keyframe_list_h));
+       int ky = theme->keyframe_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       add_subwindow(title1 = new BC_Title(theme->keyframe_list_x, ky,
+                       _("Keyframe parameters:"), LARGEFONT));
+       add_subwindow(keyframe_list = new KeyFrameList(thread, this,
+               theme->keyframe_list_x, theme->keyframe_list_y,
+               theme->keyframe_list_w, theme->keyframe_list_h));
 //     add_subwindow(title2 = new BC_Title(theme->keyframe_text_x,
-//             theme->keyframe_text_y - BC_Title::calculate_h(this, "P") - theme->widget_border,
-//             _("Global Text:")));
-//     add_subwindow(keyframe_text = new KeyFrameText(thread,
-//             this,
-//             theme->keyframe_text_x,
-//             theme->keyframe_text_y,
+//             theme->keyframe_text_y - theme->widget_border -
+//                     BC_Title::calculate_h(this, "P"), _("Global Text:")));
+//     add_subwindow(keyframe_text = new KeyFrameText(thread, this,
+//             theme->keyframe_text_x, theme->keyframe_text_y,
 //             theme->keyframe_text_w));
-       add_subwindow(title3 = new BC_Title(theme->keyframe_value_x,
-               theme->keyframe_value_y - BC_Title::calculate_h(this, (char*)"P") -
-                       theme->widget_border, _("Edit value:")));
+       int ey = theme->keyframe_value_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "P");
+       add_subwindow(title3 = new BC_Title(theme->keyframe_value_x, ey,
+                       _("Edit value:")));
        add_subwindow(value_text = new KeyFrameValue(thread, this,
                theme->keyframe_value_x, theme->keyframe_value_y, theme->keyframe_value_w));
        add_subwindow(all_toggle = new KeyFrameAll(thread, this, 
                theme->keyframe_all_x, theme->keyframe_all_y));
 
 #endif
-       add_subwindow(title4 = new BC_Title(theme->presets_list_x, theme->presets_list_y - 
-                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT) - 
-                       theme->widget_border, _("Presets:"), LARGEFONT));
+       int ty = theme->presets_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       add_subwindow(title4 = new BC_Title(theme->presets_list_x, ty,
+                       _("Presets:"), LARGEFONT));
        add_subwindow(preset_list = new KeyFramePresetsList(thread, this,
                theme->presets_list_x, theme->presets_list_y,
                theme->presets_list_w, theme->presets_list_h));
-       add_subwindow(title5 = new BC_Title(theme->presets_text_x,
-               theme->presets_text_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border,
-               _("Preset title:")));
+       int py = theme->presets_text_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "Py");
+       add_subwindow(title5 = new BC_Title(theme->presets_text_x, py,
+                       _("Preset title:")));
        add_subwindow(preset_text = new KeyFramePresetsText(thread, this,
                theme->presets_text_x, theme->presets_text_y, theme->presets_text_w));
        add_subwindow(delete_preset = new KeyFramePresetsDelete(thread, this,
@@ -546,8 +544,6 @@ void KeyFrameWindow::update_editing()
        }
 }
 
-
-
 int KeyFrameWindow::resize_event(int w, int h)
 {
        Theme *theme = mwindow->theme;
@@ -556,35 +552,33 @@ int KeyFrameWindow::resize_event(int w, int h)
        theme->get_keyframedialog_sizes(this);
 
 #ifdef EDIT_KEYFRAME
-
-       title1->reposition_window(theme->keyframe_list_x,
-               theme->keyframe_list_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
+       int ky = theme->keyframe_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       title1->reposition_window(theme->keyframe_list_x, ky);
 //     title2->reposition_window(theme->keyframe_text_x,
-//             theme->keyframe_text_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
-       title3->reposition_window(theme->keyframe_value_x,
-               theme->keyframe_value_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
-       keyframe_list->reposition_window(theme->keyframe_list_x,
-               theme->keyframe_list_y,
-               theme->keyframe_list_w, 
-               theme->keyframe_list_h);
-//     text->reposition_window(theme->keyframe_text_x,
-//             theme->keyframe_text_y,
-//             theme->keyframe_text_w);
+//             theme->keyframe_text_y - theme->widget_border -;
+//                     BC_Title::calculate_h(this, (char*)"P"));
+       int ey = theme->keyframe_value_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "P");
+       title3->reposition_window(theme->keyframe_value_x, ey);
+       keyframe_list->reposition_window(theme->keyframe_list_x, theme->keyframe_list_y,
+                       theme->keyframe_list_w, theme->keyframe_list_h);
+//     text->reposition_window(theme->keyframe_text_x, theme->keyframe_text_y,
+//                     theme->keyframe_text_w);
        value_text->reposition_window(theme->keyframe_value_x,
                theme->keyframe_value_y,
                theme->keyframe_value_w);
        all_toggle->reposition_window(theme->keyframe_all_x,
                theme->keyframe_all_y);
 
-#endif // EDIT_KEYFRAME
-
-
-
+       int ty = theme->presets_list_y - theme->widget_border -
+                       BC_Title::calculate_h(this, (char*)"Py", LARGEFONT);
+       title4->reposition_window(theme->presets_list_x, ty);
+       int py = theme->presets_text_y - theme->widget_border -
+                       BC_Title::calculate_h(this, "Py");
+       title5->reposition_window(theme->presets_text_x, py);
+#endif
 
-       title4->reposition_window(theme->presets_list_x,
-               theme->presets_list_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
-       title5->reposition_window(theme->presets_text_x,
-               theme->presets_text_y - BC_Title::calculate_h(this, (char*)"P") - theme->widget_border);
        preset_list->reposition_window(theme->presets_list_x,
                theme->presets_list_y,
                theme->presets_list_w, 
@@ -607,7 +601,6 @@ int KeyFrameWindow::resize_event(int w, int h)
 
 #ifdef EDIT_KEYFRAME
 
-
 KeyFrameList::KeyFrameList(KeyFrameThread *thread,
        KeyFrameWindow *window, int x, int y, int w, int h)
  : BC_ListBox(x, y, w, h, LISTBOX_TEXT, thread->keyframe_data,
@@ -639,8 +632,6 @@ int KeyFrameList::column_resize_event()
 }
 
 
-
-
 // KeyFrameText::KeyFrameText(KeyFrameThread *thread,
 //     KeyFrameWindow *window,
 //     int x,
@@ -661,8 +652,6 @@ int KeyFrameList::column_resize_event()
 //     return 0;
 // }
 
-
-
 KeyFrameValue::KeyFrameValue(KeyFrameThread *thread,
        KeyFrameWindow *window,
        int x,
@@ -684,16 +673,9 @@ int KeyFrameValue::handle_event()
        return 0;
 }
 
-
-
-
-
 KeyFrameAll::KeyFrameAll(KeyFrameThread *thread,
-       KeyFrameWindow *window,
-       int x,
-       int y)
- : BC_CheckBox(x, 
-       y, 
+               KeyFrameWindow *window, int x, int y)
+ : BC_CheckBox(x, y, 
        thread->mwindow->session->keyframedialog_all, 
        _("Apply to all selected keyframes"))
 {
@@ -710,26 +692,9 @@ int KeyFrameAll::handle_event()
 #endif // EDIT_KEYFRAME
 
 
-
-
-
-
-
-
-
-
 KeyFramePresetsList::KeyFramePresetsList(KeyFrameThread *thread,
-       KeyFrameWindow *window,
-       int x,
-       int y,
-       int w, 
-       int h)
- : BC_ListBox(x, 
-               y, 
-               w, 
-               h,
-               LISTBOX_TEXT,
-               thread->presets_data)
+       KeyFrameWindow *window, int x, int y, int w, int h)
+ : BC_ListBox(x, y, w, h, LISTBOX_TEXT, thread->presets_data)
 {
        this->thread = thread;
        this->window = window;
@@ -815,12 +780,6 @@ int KeyFramePresetsSave::handle_event()
 }
 
 
-
-
-
-
-
-
 KeyFramePresetsApply::KeyFramePresetsApply(KeyFrameThread *thread,
        KeyFrameWindow *window,
        int x,