reload plugin btn in prefs, speed gang fader tweaks
authorGood Guy <good1.2guy@gmail.com>
Fri, 12 Oct 2018 22:42:15 +0000 (16:42 -0600)
committerGood Guy <good1.2guy@gmail.com>
Fri, 12 Oct 2018 22:42:15 +0000 (16:42 -0600)
cinelerra-5.1/cinelerra/interfaceprefs.C
cinelerra-5.1/cinelerra/interfaceprefs.h
cinelerra-5.1/cinelerra/interfaceprefs.inc
cinelerra-5.1/cinelerra/keyframepopup.C
cinelerra-5.1/cinelerra/mainundo.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/preferencesthread.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/trackcanvas.h

index 9c0b51dd2e5bed868856c75a71f07766172323ea..60241a77972e2723fc5d17d124ec062090560bb2 100644 (file)
@@ -125,9 +125,10 @@ void InterfacePrefs::create_objects()
        y += 5;
        add_subwindow(new BC_Title(x, y, _("Operation:"), LARGEFONT,
                resources->text_default));
-       y += 35;
 
        int y1 = y;
+       y += 15;
+
        AndroidRemote *android_remote = new AndroidRemote(pwindow, x2, y);
        add_subwindow(android_remote);
        y += android_remote->get_h() + 10;
@@ -139,11 +140,14 @@ void InterfacePrefs::create_objects()
        add_subwindow(title = new BC_Title(x2, y, _("PIN:")));
        AndroidPIN *android_pin = new AndroidPIN(pwindow, x3, y);
        add_subwindow(android_pin);
-       y += title->get_h() + 30;
+       y += title->get_h() + 20;
 
        ShBtnPrefs *shbtn_prefs = new ShBtnPrefs(pwindow, this, x2, y);
        add_subwindow(shbtn_prefs);
-       y += shbtn_prefs->get_h() + 30;
+       y += shbtn_prefs->get_h() + 20;
+
+       add_subwindow(reload_plugins = new PrefsReloadPlugins(pwindow, this, x2, y));
+       y += reload_plugins->get_h() + 10;
 
        add_subwindow(title = new BC_Title(x2, y, _("Default LV2_PATH:")));
        y += title->get_h() + 10;
@@ -152,7 +156,7 @@ void InterfacePrefs::create_objects()
        y += 30;
 
        y2 = y;
-       x = x0;  y = y1;
+       x = x0;  y = y1 + 35;
        add_subwindow(file_probes = new PrefsFileProbes(pwindow, this, x, y));
        y += 30;
 
@@ -647,6 +651,22 @@ int PrefsAutostartLV2UI::handle_event()
        return 1;
 }
 
+PrefsReloadPlugins::PrefsReloadPlugins(PreferencesWindow *pwindow,
+       InterfacePrefs *iface_prefs, int x, int y)
+ : BC_GenericButton(x, y, _("Reload plugin index"))
+{
+       this->pwindow = pwindow;
+       this->iface_prefs = iface_prefs;
+}
+
+int PrefsReloadPlugins::handle_event()
+{
+       pwindow->thread->reload_plugins = 1;
+       text_color(get_resources()->button_highlighted);
+       draw_face(1);
+       return 1;
+}
+
 PrefsLV2PathText::PrefsLV2PathText(PreferencesWindow *pwindow,
        InterfacePrefs *subwindow, int x, int y, int w)
  : BC_TextBox(x, y, w, 1, pwindow->thread->preferences->lv2_path)
index 1d1844c1e38fefda744460553cb3b991475f94ab..0a6f761a1bcd538b0589a512b2195e4c07ad4a01 100644 (file)
@@ -64,6 +64,7 @@ public:
        PrefsTrapSigSEGV *trap_segv;
        PrefsTrapSigINTR *trap_intr;
        SnapshotPathText *snapshot_path;
+       PrefsReloadPlugins *reload_plugins;
 };
 
 
@@ -307,5 +308,15 @@ public:
        InterfacePrefs *subwindow;
 };
 
+class PrefsReloadPlugins : public BC_GenericButton
+{
+public:
+       PreferencesWindow *pwindow;
+       InterfacePrefs *iface_prefs;
+
+       int handle_event();
+       PrefsReloadPlugins(PreferencesWindow *pwindow,
+               InterfacePrefs *iface_prefs, int x, int y);
+};
 
 #endif
index 7fe7f91e2ab520fa733a25e9addeef81c2c6738e..5ce8cb5bfc7b33df745b5f0f4bb1b839178e1965 100644 (file)
@@ -45,5 +45,8 @@ class PrefsTrapSigINTR;
 class PrefsFileProbes;
 class PrefsYUV420P_DVDlace;
 class SnapshotPathText;
+class PrefsAutostartLV2UI;
+class PrefsLV2PathText;
+class PrefsReloadPlugins;
 
 #endif
index 362e51e804031be158d68f80661aea4ba2a413e0..7624da1631574fc7a8d16471c9a4f70110ec8f5c 100644 (file)
@@ -49,6 +49,7 @@
 #include "theme.h"
 #include "timelinepane.h"
 #include "track.h"
+#include "trackcanvas.h"
 #include "vtrack.h"
 
 KeyframePopup::KeyframePopup(MWindow *mwindow, MWindowGUI *gui)
@@ -651,12 +652,20 @@ void KeySpeedPatch::update_speed(float v)
 {
        patch->change_source = 1;
        double position = mwindow->edl->local_session->get_selectionstart(1);
-       Autos *speed_autos = patch->track->automation->autos[AUTOMATION_SPEED];
+       Track *track = patch->track;
+       Autos *speed_autos = track->automation->autos[AUTOMATION_SPEED];
        int need_undo = !speed_autos->auto_exists_for_editing(position);
 
        mwindow->undo->update_undo_before(_("speed"), need_undo ? 0 : this);
        FloatAuto *current = (FloatAuto*)speed_autos->get_auto_for_editing(position);
+       float change = v - current->get_value();
        current->set_value(v);
+       if( track->gang && track->record ) {
+               TrackCanvas *track_canvas = patch->patchbay->pane->canvas;
+               track_canvas->fill_ganged_autos(1, change, track, current);
+               track_canvas->update_ganged_autos(0, track, current);
+               track_canvas->clear_ganged_autos();
+       }
        mwindow->undo->update_undo_after(_("speed"), LOAD_AUTOMATION+LOAD_EDITS);
        patch->change_source = 0;
 
index 3a7d92ca440619b72fc6af67a7a5d2f3fc3ae975..0c149cd40acc445d8626a060b7f7cae831ce0e00 100644 (file)
@@ -255,6 +255,9 @@ int MainUndo::redo()
 // Here the master EDL loads
 int MainUndo::load_from_undo(FileXML *file, uint32_t load_flags)
 {
+       delete mwindow->gui->keyvalue_popup;
+       mwindow->gui->keyvalue_popup = 0;
+
        if( load_flags & LOAD_SESSION ) {
                mwindow->gui->unlock_window();
                mwindow->close_mixers();
index 8a33473c81a999c167953800ef8f569ebf9a427d..7d871c9652126768e7e3d1612aaaaaa23fcde9ec 100644 (file)
@@ -3473,9 +3473,10 @@ void MWindow::update_project(int load_mode)
 
        if(debug) PRINT_TRACE
 
-       if(load_mode == LOADMODE_REPLACE ||
-               load_mode == LOADMODE_REPLACE_CONCATENATE)
-       {
+       if( load_mode == LOADMODE_REPLACE ||
+           load_mode == LOADMODE_REPLACE_CONCATENATE ) {
+               delete gui->keyvalue_popup;
+               gui->keyvalue_popup = 0;
                gui->load_panes();
        }
 
index 87a90096bb72b317f49daecbd00ee68ff510991b..af64fed165775894bd6c9908a9dfcc946b0e3601 100644 (file)
@@ -235,7 +235,9 @@ int PreferencesThread::apply_settings()
                mwindow->restart_status = -1; // reload, need new bcresources
        if( strcmp(preferences->plugin_icons, mwindow->preferences->plugin_icons) != 0 )
                mwindow->restart_status = -1;
-       if( strcmp(preferences->lv2_path, mwindow->preferences->lv2_path) != 0 ) {
+       if( strcmp(preferences->lv2_path, mwindow->preferences->lv2_path) != 0 )
+               reload_plugins = 1;
+       if( reload_plugins ) {
                MWindow::remove_plugin_index();
                File::setenv_path("LV2_PATH", preferences->lv2_path, 1);
                mwindow->restart_status = -1;
index 5b283ff6eca69caabc5cc83683b183663c1efef3..fdd3112bb6b2fb62f315fc7c2f3fb70de94bf9ba 100644 (file)
@@ -2095,10 +2095,8 @@ int TrackCanvas::do_keyframes(int cursor_x,
                                                if (buttonpress != 3)
                                                {
                                                        if(i == AUTOMATION_FADE || i == AUTOMATION_SPEED)
-                                                               synchronize_autos(0,
-                                                                       track,
-                                                                       (FloatAuto*)mwindow->session->drag_auto,
-                                                                       1);
+                                                               fill_ganged_autos(get_double_click(), 0, track,
+                                                                       (FloatAuto*)mwindow->session->drag_auto);
                                                        mwindow->session->current_operation = pre_auto_operations[i];
                                                        update_drag_caption();
                                                        rerender = 1;
@@ -2723,69 +2721,68 @@ int TrackCanvas::test_floatline(int center_pixel,
 }
 
 
-void TrackCanvas::synchronize_autos(float change,
-               Track *skip, FloatAuto *fauto, int fill_gangs)
+void TrackCanvas::fill_ganged_autos(int all, float change, Track *skip, FloatAuto *fauto)
 {
+       if( !skip->gang ) return;
 // Handles the special case of modifying a fadeauto
 // when there are ganged faders on several tracks
-// (skip and fauto may be NULL if fill_gangs==-1)
-
-       if( fill_gangs > 0 && skip->gang ) {
-               double position = skip->from_units(fauto->position);
-               int autoidx = fauto->autos->autoidx;
-
-               for(Track *current = mwindow->edl->tracks->first; current; current = NEXT) {
-                       if( (current->data_type == skip->data_type || get_double_click()) &&
-                           current->gang && current->record && current != skip ) {
-                               int64_t current_position = current->to_units(position, 1);
-                               FloatAutos *fade_autos = (FloatAutos*)current->automation->autos[autoidx];
-                               float auto_min = mwindow->edl->local_session->automation_mins[fade_autos->autogrouptype];
-                               float auto_max = mwindow->edl->local_session->automation_maxs[fade_autos->autogrouptype];
-                               FloatAuto *previous = 0, *next = 0;
-                               FloatAuto *keyframe = (FloatAuto*)fade_autos->get_auto_at_position(current_position);
-                               if( !keyframe ) {
-// create keyframe on neighbouring track at the point in time given by fauto
-                                       float init_value = fade_autos->get_value(current_position, PLAY_FORWARD, previous, next);
-                                       float new_value = init_value + change;
-                                       CLAMP(new_value, auto_min, auto_max);
-                                       keyframe = (FloatAuto*)fade_autos->insert_auto(current_position);
-                                       keyframe->set_value(new_value);
-                               }
-                               else {
+       double position = skip->from_units(fauto->position);
+       int autoidx = fauto->autos->autoidx;
+
+       for(Track *current = mwindow->edl->tracks->first; current; current = NEXT) {
+               if( (all || current->data_type == skip->data_type) &&
+                   current->gang && current->record && current != skip ) {
+                       FloatAutos *fade_autos = (FloatAutos*)current->automation->autos[autoidx];
+                       float auto_min = mwindow->edl->local_session->automation_mins[fade_autos->autogrouptype];
+                       float auto_max = mwindow->edl->local_session->automation_maxs[fade_autos->autogrouptype];
+                       int64_t current_position = current->to_units(position, 1);
+                       FloatAuto *keyframe = (FloatAuto*)fade_autos->get_auto_at_position(position);
+                       if( keyframe ) {
 // keyframe exists, just change it
-                                       float new_value = keyframe->get_value() + change;
-                                       CLAMP(new_value, auto_min, auto_max);
-                                       keyframe->adjust_to_new_coordinates(current_position, new_value);
-// need to (re)set the position, as the existing node could be on a "equivalent" position (within half a frame)
-                               }
-
-                               mwindow->session->drag_auto_gang->append((Auto *)keyframe);
+                               float value = keyframe->get_value();
+                               float new_value = value + change;
+                               CLAMP(new_value, auto_min, auto_max);
+                               keyframe->adjust_to_new_coordinates(current_position, new_value);
                        }
+                       else if( mwindow->edl->session->auto_keyframes ) {
+// create keyframe on neighbouring track at the point in time given by fauto
+                               FloatAuto *previous = 0, *next = 0;
+                               float value = fade_autos->get_value(current_position, PLAY_FORWARD, previous, next);
+                               float new_value = value + change;
+                               CLAMP(new_value, auto_min, auto_max);
+                               keyframe = (FloatAuto*)fade_autos->insert_auto(current_position);
+                               keyframe->set_value(new_value);
+                       }
+                       else
+                               continue;
+                       mwindow->session->drag_auto_gang->append((Auto *)keyframe);
                }
        }
-       else if( !fill_gangs ) {
-               double position = skip->from_units(fauto->position);
-// Move the gangs
-               for (int i = 0; i < mwindow->session->drag_auto_gang->total; i++) {
-                       FloatAuto *keyframe = (FloatAuto *)mwindow->session->drag_auto_gang->values[i];
-                       int64_t keyframe_position = keyframe->autos->track->to_units(position, 1);
-                       float new_value = keyframe->get_value() + change;
-                       CLAMP(new_value,
-                             mwindow->edl->local_session->automation_mins[keyframe->autos->autogrouptype],
-                             mwindow->edl->local_session->automation_maxs[keyframe->autos->autogrouptype]);
-                       keyframe->adjust_to_new_coordinates(keyframe_position, new_value);
-               }
+}
 
+void TrackCanvas::update_ganged_autos(float change, Track *skip, FloatAuto *fauto)
+{
+       double position = skip->from_units(fauto->position);
+// Move the gangs
+       for (int i = 0; i < mwindow->session->drag_auto_gang->total; i++) {
+               FloatAuto *keyframe = (FloatAuto *)mwindow->session->drag_auto_gang->values[i];
+               int64_t keyframe_position = keyframe->autos->track->to_units(position, 1);
+               float new_value = keyframe->get_value() + change;
+               CLAMP(new_value,
+                     mwindow->edl->local_session->automation_mins[keyframe->autos->autogrouptype],
+                     mwindow->edl->local_session->automation_maxs[keyframe->autos->autogrouptype]);
+               keyframe->adjust_to_new_coordinates(keyframe_position, new_value);
        }
-       else {
+}
+
+void TrackCanvas::clear_ganged_autos()
+{
 // remove the gangs
-               for (int i = 0; i < mwindow->session->drag_auto_gang->total; i++) {
-                       FloatAuto *keyframe = (FloatAuto *)mwindow->session->drag_auto_gang->values[i];
-                       keyframe->autos->remove_nonsequential(
-                                       keyframe);
-               }
-               mwindow->session->drag_auto_gang->remove_all();
+       for (int i = 0; i < mwindow->session->drag_auto_gang->total; i++) {
+               FloatAuto *keyframe = (FloatAuto *)mwindow->session->drag_auto_gang->values[i];
+               keyframe->autos->remove_nonsequential(keyframe);
        }
+       mwindow->session->drag_auto_gang->remove_all();
 }
 
 
@@ -3848,7 +3845,7 @@ int TrackCanvas::update_drag_floatauto(int cursor_x, int cursor_y)
                        result = 1;
                        float change = value - old_value;
                        current->adjust_to_new_coordinates(position, value);
-                       synchronize_autos(change, current->autos->track, current, 0);
+                       update_ganged_autos(change, current->autos->track, current);
                        show_message(current, 1,", %.2f", current->get_value());
                }
                break;
@@ -3867,7 +3864,7 @@ int TrackCanvas::update_drag_floatauto(int cursor_x, int cursor_y)
                        current->set_control_in_value(
                                value * levered_position(position - current->position,
                                                         current->get_control_in_position()));
-                       synchronize_autos(0, current->autos->track, current, 0);
+                       update_ganged_autos(0, current->autos->track, current);
                        show_message(current, 1,", %.2f", current->get_control_in_value());
                }
                break; }
@@ -3881,7 +3878,7 @@ int TrackCanvas::update_drag_floatauto(int cursor_x, int cursor_y)
                        current->set_control_out_value(
                                value * levered_position(position - current->position,
                                                         current->get_control_out_position()));
-                       synchronize_autos(0, current->autos->track, current, 0);
+                       update_ganged_autos(0, current->autos->track, current);
                        show_message(current, 1,", %.2f", current->get_control_out_value());
                }
                break; }
@@ -4408,7 +4405,7 @@ int TrackCanvas::button_release_event()
                        load_flags |= LOAD_EDITS;
                case DRAG_FADE:
 // delete the drag_auto_gang first and remove out of order keys
-                       synchronize_autos(0, 0, 0, -1);
+                       clear_ganged_autos();
                case DRAG_CZOOM:
                case DRAG_PZOOM:
                case DRAG_PLAY:
index bb261ad7eeea4207928fe6db53b3a7b848c1f6e0..b42660c57bb1a29c26bb0a586bfbd5376b3b3b2f 100644 (file)
@@ -258,8 +258,10 @@ public:
                double zoom_units,
                double yscale,
                int autogrouptype);
-       void synchronize_autos(float change, Track *skip, FloatAuto *fauto, int fill_gangs);
 
+       void fill_ganged_autos(int all, float change, Track *skip, FloatAuto *fauto);
+       void update_ganged_autos(float change, Track *skip, FloatAuto *fauto);
+       void clear_ganged_autos();
 
        void draw_brender_range();
        void draw_loop_points();