Make the crop controls more like those on the v2.15.x branch
authorCarl Hetherington <cth@carlh.net>
Mon, 26 Oct 2020 11:01:32 +0000 (12:01 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 26 Oct 2020 11:01:32 +0000 (12:01 +0100)
for GTK3 so that they are at least vaguely usable.

src/wx/video_panel.cc
src/wx/video_panel.h

index 713ef9d2c25ad9ed3cc3ca237742e2d4a907688d..9a495702daa87d071ce58e4ddb3ba8c0d7d26453 100644 (file)
@@ -102,40 +102,48 @@ VideoPanel::VideoPanel (ContentPanel* p)
                &caster<VideoFrameType, int>
                );
 
-       _left_crop_label = create_label (this, _("Left crop"), true);
+       _crop_label = create_label (this, _("Crop"), true);
+
+#ifdef __WXGTK3__
+       int const crop_width = 128;
+#else
+       int const crop_width = 56;
+#endif
+
+       _left_crop_label = create_label (this, _("Left"), true);
        _left_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::left_crop),
                boost::mem_fn (&VideoContent::set_left_crop)
                );
 
-       _right_crop_label = create_label (this, _("Right crop"), true);
+       _right_crop_label = create_label (this, _("Right"), true);
        _right_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::right_crop),
                boost::mem_fn (&VideoContent::set_right_crop)
                );
 
-       _top_crop_label = create_label (this, _("Top crop"), true);
+       _top_crop_label = create_label (this, _("Top"), true);
        _top_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::top_crop),
                boost::mem_fn (&VideoContent::set_top_crop)
                );
 
-       _bottom_crop_label = create_label (this, _("Bottom crop"), true);
+       _bottom_crop_label = create_label (this, _("Bottom"), true);
        _bottom_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::bottom_crop),
@@ -239,15 +247,28 @@ VideoPanel::add_to_grid ()
        wxGridBagSizer* crop = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        add_label_to_sizer (crop, _left_crop_label, true, wxGBPosition (cr, 0));
        _left_crop->add (crop, wxGBPosition (cr, 1));
+#ifdef __WXGTK3__
+       ++cr;
+       add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 0));
+       _right_crop->add (crop, wxGBPosition (cr, 1));
+#else
        add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 2));
        _right_crop->add (crop, wxGBPosition (cr, 3));
+#endif
        ++cr;
        add_label_to_sizer (crop, _top_crop_label, true, wxGBPosition (cr, 0));
        _top_crop->add (crop, wxGBPosition (cr, 1));
+#ifdef __WXGTK3__
+       ++cr;
+       add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 0));
+       _bottom_crop->add (crop, wxGBPosition (cr, 1));
+#else
        add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 2));
        _bottom_crop->add (crop, wxGBPosition (cr, 3));
-       _grid->Add (crop, wxGBPosition (r, 0), wxGBSpan (2, 4));
-       r += 2;
+#endif
+       add_label_to_sizer (_grid, _crop_label, true, wxGBPosition(r, 0));
+       _grid->Add (crop, wxGBPosition(r, 1));
+       ++r;
 
        _scale_to_label->Show (full);
        _scale->show (full);
index 795a52a78f2cfa33c5227a3dcb93efaf84a23ed6..7d0f1f7d251c2931d66e28f7eb0e8097dd3594aa 100644 (file)
@@ -61,6 +61,7 @@ private:
        wxStaticText* _reference_note;
        wxStaticText* _type_label;
        ContentChoice<VideoContent, VideoFrameType>* _frame_type;
+       wxStaticText* _crop_label;
        wxStaticText* _left_crop_label;
        ContentSpinCtrl<VideoContent>* _left_crop;
        wxStaticText* _right_crop_label;