preset edit button, intl fix, drag window tweak, empty keyframe edit fix
[goodguy/history.git] / cinelerra-5.1 / cinelerra / trackcanvas.C
index feff8a858d5df154b48f02d64a89c4ee68c0e56d..960598c36350b82aaf63d65178802d10be4e9b97 100644 (file)
@@ -1596,7 +1596,7 @@ void TrackCanvas::draw_plugins()
        char string[BCTEXTLEN];
        int current_on = 0;
        int current_show = 0;
-
+       int current_preset = 0;
 
 //     if(!mwindow->edl->session->show_assets) goto done;
 
@@ -1604,6 +1604,8 @@ void TrackCanvas::draw_plugins()
                plugin_on_toggles.values[i]->in_use = 0;
        for(int i = 0; i < plugin_show_toggles.total; i++)
                plugin_show_toggles.values[i]->in_use = 0;
+       for(int i = 0; i < preset_edit_buttons.total; i++)
+               plugin_show_toggles.values[i]->in_use = 0;
 
 
        for(Track *track = mwindow->edl->tracks->first;
@@ -1711,9 +1713,21 @@ void TrackCanvas::draw_plugins()
                                                                }
                                                                current_show++;
                                                        }
-
-
-
+                                                       toggle_x -= PluginPresetEdit::calculate_w(mwindow) + 10;
+                                                       if(toggle_x > min_x)
+                                                       {
+                                                               if(current_preset >= preset_edit_buttons.total)
+                                                               {
+                                                                       PluginPresetEdit *preset_edit = new PluginPresetEdit(mwindow, toggle_x, toggle_y, plugin);
+                                                                       add_subwindow(preset_edit);
+                                                                       preset_edit_buttons.append(preset_edit);
+                                                               }
+                                                               else
+                                                               {
+                                                                       preset_edit_buttons.values[current_preset]->update(toggle_x, toggle_y, plugin);
+                                                               }
+                                                               current_preset++;
+                                                       }
                                                }
                                        }
                                }
@@ -1723,6 +1737,10 @@ void TrackCanvas::draw_plugins()
 
 // Remove unused toggles
 
+       while(current_preset < preset_edit_buttons.total)
+       {
+               preset_edit_buttons.remove_object_number(current_preset);
+       }
        while(current_show < plugin_show_toggles.total)
        {
                plugin_show_toggles.remove_object_number(current_show);
@@ -1732,7 +1750,6 @@ void TrackCanvas::draw_plugins()
        {
                plugin_on_toggles.remove_object_number(current_on);
        }
-
 }
 
 void TrackCanvas::refresh_plugintoggles()
@@ -1747,6 +1764,11 @@ void TrackCanvas::refresh_plugintoggles()
                PluginShow *show = plugin_show_toggles.values[i];
                show->reposition_window(show->get_x(), show->get_y());
        }
+       for(int i = 0; i < preset_edit_buttons.total; i++)
+       {
+               PluginPresetEdit *preset_edit = preset_edit_buttons.values[i];
+               preset_edit->reposition_window(preset_edit->get_x(), preset_edit->get_y());
+       }
 }
 
 void TrackCanvas::draw_inout_points()
@@ -4507,10 +4529,12 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
                                                        mwindow->edl->local_session->zoom_sample /
                                                        mwindow->edl->session->sample_rate;
 
+                                               int cx, cy;
+                                               get_abs_cursor(cx, cy);
+                                               cx -= mwindow->theme->get_image("clip_icon")->get_w() / 2,
+                                               cy -= mwindow->theme->get_image("clip_icon")->get_h() / 2;
                                                gui->drag_popup = new BC_DragWindow(gui,
-                                                       mwindow->theme->get_image("clip_icon") /*,
-                                                       get_abs_cursor_x(0) - mwindow->theme->get_image("clip_icon")->get_w() / 2,
-                                                       get_abs_cursor_y(0) - mwindow->theme->get_image("clip_icon")->get_h() / 2 */);
+                                                       mwindow->theme->get_image("clip_icon"), cx, cy);
 
                                                result = 1;
                                        }
@@ -4619,19 +4643,22 @@ int TrackCanvas::do_plugins(int cursor_x, int cursor_y, int drag_start,
                                                        frame = mwindow->theme->get_image("veffect_icon");
                                                }
                                        }
-
-                                       gui->drag_popup = new BC_DragWindow(gui, frame /*,
-                                               get_abs_cursor_x(0) - frame->get_w() / 2,
-                                               get_abs_cursor_y(0) - frame->get_h() / 2 */);
+                                       int cx, cy;
+                                       get_abs_cursor(cx, cy);
+                                       cx -= frame->get_w() / 2;
+                                       cy -= frame->get_h() / 2;
+                                       gui->drag_popup = new BC_DragWindow(gui, frame, cx, cy);
                                                break; }
 
                                case PLUGIN_SHAREDPLUGIN:
-                               case PLUGIN_SHAREDMODULE:
-                                       gui->drag_popup = new BC_DragWindow(gui,
-                                               mwindow->theme->get_image("clip_icon") /*,
-                                               get_abs_cursor_x(0) - mwindow->theme->get_image("clip_icon")->get_w() / 2,
-                                               get_abs_cursor_y(0) - mwindow->theme->get_image("clip_icon")->get_h() / 2 */);
-                                       break;
+                               case PLUGIN_SHAREDMODULE: {
+                                       VFrame *frame = mwindow->theme->get_image("clip_icon");
+                                       int cx, cy;
+                                       get_abs_cursor(cx, cy);
+                                       cx -= frame->get_w() / 2;
+                                       cy -= frame->get_h() / 2;
+                                       gui->drag_popup = new BC_DragWindow(gui, frame, cx, cy);
+                                       break; }
                                }
 
                                result = 1;