preset edit button, intl fix, drag window tweak, empty keyframe edit fix
[goodguy/history.git] / cinelerra-5.1 / cinelerra / trackcanvas.C
index 0e3ebc03068b327d0c92080e9f1d3e27ccbf6a1e..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()
@@ -4508,7 +4530,7 @@ int TrackCanvas::do_edits(int cursor_x, int cursor_y, int button_press, int drag
                                                        mwindow->edl->session->sample_rate;
 
                                                int cx, cy;
-                                               get_abs_cursor_xy(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,
@@ -4622,7 +4644,7 @@ int TrackCanvas::do_plugins(int cursor_x, int cursor_y, int drag_start,
                                                }
                                        }
                                        int cx, cy;
-                                       get_abs_cursor_xy(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);
@@ -4632,7 +4654,7 @@ int TrackCanvas::do_plugins(int cursor_x, int cursor_y, int drag_start,
                                case PLUGIN_SHAREDMODULE: {
                                        VFrame *frame = mwindow->theme->get_image("clip_icon");
                                        int cx, cy;
-                                       get_abs_cursor_xy(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);