Tweak behaviour of crop link buttons (#2034).
authorCarl Hetherington <cth@carlh.net>
Sun, 30 May 2021 22:44:24 +0000 (00:44 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 30 May 2021 22:44:57 +0000 (00:44 +0200)
Now if you change left and click "link" the right will follow it,
and vice versa.

hacks/gl/modern [new file with mode: 0755]
src/wx/video_panel.cc
src/wx/video_panel.h

diff --git a/hacks/gl/modern b/hacks/gl/modern
new file mode 100755 (executable)
index 0000000..1ecb3ff
Binary files /dev/null and b/hacks/gl/modern differ
index ef111f7ecfe8c6a930ad4ad56697fbd9ba849f80..f1b6a006b4e3ea4670f2be6dbcd8506decfb562f 100644 (file)
@@ -712,20 +712,29 @@ VideoPanel::scale_custom_edit_clicked ()
 void
 VideoPanel::left_right_link_clicked ()
 {
-       right_crop_changed ();
+       if (_left_changed_last) {
+               left_crop_changed ();
+       } else {
+               right_crop_changed ();
+       }
 }
 
 
 void
 VideoPanel::top_bottom_link_clicked ()
 {
-       bottom_crop_changed ();
+       if (_top_changed_last) {
+               top_crop_changed ();
+       } else {
+               bottom_crop_changed ();
+       }
 }
 
 
 void
 VideoPanel::left_crop_changed ()
 {
+       _left_changed_last = true;
        if (_left_right_link->GetValue()) {
                for (auto i: _parent->selected_video()) {
                        i->video->set_right_crop (i->video->left_crop());
@@ -737,6 +746,7 @@ VideoPanel::left_crop_changed ()
 void
 VideoPanel::right_crop_changed ()
 {
+       _left_changed_last = false;
        if (_left_right_link->GetValue()) {
                for (auto i: _parent->selected_video()) {
                        i->video->set_left_crop (i->video->right_crop());
@@ -748,6 +758,7 @@ VideoPanel::right_crop_changed ()
 void
 VideoPanel::top_crop_changed ()
 {
+       _top_changed_last = true;
        if (_top_bottom_link->GetValue()) {
                for (auto i: _parent->selected_video()) {
                        i->video->set_bottom_crop (i->video->top_crop());
@@ -759,6 +770,7 @@ VideoPanel::top_crop_changed ()
 void
 VideoPanel::bottom_crop_changed ()
 {
+       _top_changed_last = false;
        if (_top_bottom_link->GetValue()) {
                for (auto i: _parent->selected_video()) {
                        i->video->set_top_crop (i->video->bottom_crop());
index 2304e5e0b7f3bb3041b22b03757283613a36317b..2e394e4fc7af4b68aab25e7d97cad7b1c3894d22 100644 (file)
@@ -95,4 +95,7 @@ private:
        wxButton* _edit_colour_conversion_button;
        wxStaticText* _range_label;
        wxChoice* _range;
+
+       bool _left_changed_last = true;
+       bool _top_changed_last = true;
 };