From 65bd479a3008fb269925e1ce92e547c863ede73d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 7 May 2021 22:14:33 +0200 Subject: [PATCH] Add DCPOMATIC_SPIN_CTRL_WIDTH and use it in a few places. --- src/wx/custom_scale_dialog.cc | 10 ++-------- src/wx/dcp_panel.cc | 12 +++--------- src/wx/text_panel.cc | 16 +++++----------- src/wx/wx_util.h | 5 +++++ 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/wx/custom_scale_dialog.cc b/src/wx/custom_scale_dialog.cc index 8a5f9e128..48f476a9f 100644 --- a/src/wx/custom_scale_dialog.cc +++ b/src/wx/custom_scale_dialog.cc @@ -49,19 +49,13 @@ CustomScaleDialog::CustomScaleDialog (wxWindow* parent, dcp::Size initial, dcp:: _size_from_ratio = new wxStaticText (this, wxID_ANY, wxT("")); add (_size_from_ratio, 1, wxALIGN_CENTER_VERTICAL); -#ifdef __WXGTK3__ - int const spin_width = 118; -#else - int const spin_width = 64; -#endif - _size = new wxRadioButton (this, wxID_ANY, _("Set size")); add (_size); s = new wxBoxSizer (wxHORIZONTAL); - _width = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1), wxSP_ARROW_KEYS, 1, film_container.width); + _width = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DCPOMATIC_SPIN_CTRL_WIDTH, -1), wxSP_ARROW_KEYS, 1, film_container.width); s->Add (_width, 1, wxRIGHT, 4); add_label_to_sizer (s, this, wxT("x"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL); - _height = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1), wxSP_ARROW_KEYS, 1, film_container.height); + _height = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DCPOMATIC_SPIN_CTRL_WIDTH, -1), wxSP_ARROW_KEYS, 1, film_container.height); s->Add (_height, 1, wxRIGHT, 4); add (s); _ratio_from_size = new wxStaticText (this, wxID_ANY, wxT("")); diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 4421b81b2..03d08beed 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -107,7 +107,7 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr film, weak_ptr v _reel_type = new wxChoice (_panel, wxID_ANY); _reel_length_label = create_label (_panel, _("Reel length"), true); - _reel_length = new wxSpinCtrl (_panel, wxID_ANY); + _reel_length = new SpinCtrl (_panel, DCPOMATIC_SPIN_CTRL_WIDTH); _reel_length_gb_label = create_label (_panel, _("GB"), false); _standard_label = create_label (_panel, _("Standard"), true); @@ -746,22 +746,16 @@ DCPPanel::make_video_panel () _resolution_label = create_label (panel, _("Resolution"), true); _resolution = new wxChoice (panel, wxID_ANY); -#ifdef __WXGTK3__ - int const spin_width = 118; -#else - int const spin_width = 56; -#endif - _frame_rate_label = create_label (panel, _("Frame Rate"), true); _frame_rate_choice = new wxChoice (panel, wxID_ANY); - _frame_rate_spin = new SpinCtrl (panel, spin_width); + _frame_rate_spin = new SpinCtrl (panel, DCPOMATIC_SPIN_CTRL_WIDTH); setup_frame_rate_widget (); _best_frame_rate = new Button (panel, _("Use best")); _three_d = new CheckBox (panel, _("3D")); _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true); - _j2k_bandwidth = new SpinCtrl (panel, spin_width); + _j2k_bandwidth = new SpinCtrl (panel, DCPOMATIC_SPIN_CTRL_WIDTH); _mbits_label = create_label (panel, _("Mbit/s"), false); _reencode_j2k = new CheckBox (panel, _("Re-encode JPEG2000 data from input")); diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 8e6d5cd68..ebeb518dd 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -82,30 +82,24 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) _burn = new CheckBox (this, _("Burn subtitles into image")); -#ifdef __WXGTK3__ - int const spin_width = 118; -#else - int const spin_width = 56; -#endif - _offset_label = create_label (this, _("Offset"), true); _x_offset_label = create_label (this, _("X"), true); - _x_offset = new SpinCtrl (this, spin_width); + _x_offset = new SpinCtrl (this, DCPOMATIC_SPIN_CTRL_WIDTH); _x_offset_pc_label = new StaticText (this, _("%")); _y_offset_label = create_label (this, _("Y"), true); - _y_offset = new SpinCtrl (this, spin_width); + _y_offset = new SpinCtrl (this, DCPOMATIC_SPIN_CTRL_WIDTH); _y_offset_pc_label = new StaticText (this, _("%")); _scale_label = create_label (this, _("Scale"), true); _x_scale_label = create_label (this, _("X"), true); - _x_scale = new SpinCtrl (this, spin_width); + _x_scale = new SpinCtrl (this, DCPOMATIC_SPIN_CTRL_WIDTH); _x_scale_pc_label = new StaticText (this, _("%")); _y_scale_label = create_label (this, S_("Coord|Y"), true); - _y_scale = new SpinCtrl (this, spin_width); + _y_scale = new SpinCtrl (this, DCPOMATIC_SPIN_CTRL_WIDTH); _y_scale_pc_label = new StaticText (this, _("%")); _line_spacing_label = create_label (this, _("Line spacing"), true); - _line_spacing = new SpinCtrl (this, spin_width); + _line_spacing = new SpinCtrl (this, DCPOMATIC_SPIN_CTRL_WIDTH); _line_spacing_pc_label = new StaticText (this, _("%")); _stream_label = create_label (this, _("Stream"), true); diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 1c459595e..0c2eabce0 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -51,6 +51,11 @@ class PasswordEntry; #define DCPOMATIC_SIZER_Y_GAP 8 #define DCPOMATIC_SIZER_GAP 8 #define DCPOMATIC_DIALOG_BORDER 12 +#ifdef __WXGTK3__ +#define DCPOMATIC_SPIN_CTRL_WIDTH 118 +#else +#define DCPOMATIC_SPIN_CTRL_WIDTH 56 +#endif /** Spacing to use between buttons in a vertical/horizontal line */ #if defined(DCPOMATIC_OSX) || defined(__WXGTK3__) -- 2.30.2