From: Carl Hetherington Date: Sun, 25 Oct 2020 19:21:23 +0000 (+0100) Subject: Allow building and running with wxWidgets 3.1.x as well as 3.0.x. X-Git-Tag: v2.14.41~9 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=8a743225a7e34bbadba63795076204204aac551a;p=dcpomatic.git Allow building and running with wxWidgets 3.1.x as well as 3.0.x. --- diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 3495c78d4..2b5cfa0b0 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -130,6 +130,7 @@ public: , _history_separator (0) , _view_full_screen (0) , _view_dual_screen (0) + , _main_sizer (new wxBoxSizer(wxVERTICAL)) { dcpomatic_log.reset (new NullLog()); @@ -245,13 +246,15 @@ public: void setup_main_sizer (Config::PlayerMode mode) { - wxSizer* main_sizer = new wxBoxSizer (wxVERTICAL); + _main_sizer->Detach (_viewer->panel()); + _main_sizer->Detach (_controls); + _main_sizer->Detach (_info); if (mode != Config::PLAYER_MODE_DUAL) { - main_sizer->Add (_viewer->panel(), 1, wxEXPAND | wxALIGN_CENTER_VERTICAL); + _main_sizer->Add (_viewer->panel(), 1, wxEXPAND); } - main_sizer->Add (_controls, mode == Config::PLAYER_MODE_DUAL ? 1 : 0, wxEXPAND | wxALL, 6); - main_sizer->Add (_info, 0, wxEXPAND | wxALL, 6); - _overall_panel->SetSizer (main_sizer); + _main_sizer->Add (_controls, mode == Config::PLAYER_MODE_DUAL ? 1 : 0, wxEXPAND | wxALL, 6); + _main_sizer->Add (_info, 0, wxEXPAND | wxALL, 6); + _overall_panel->SetSizer (_main_sizer); _overall_panel->Layout (); } @@ -719,10 +722,10 @@ private: switch (Config::instance()->image_display()) { case 0: _dual_screen->Move (0, 0); - Move (wxDisplay(0).GetClientArea().GetWidth(), 0); + Move (wxDisplay(0U).GetClientArea().GetWidth(), 0); break; case 1: - _dual_screen->Move (wxDisplay(0).GetClientArea().GetWidth(), 0); + _dual_screen->Move (wxDisplay(0U).GetClientArea().GetWidth(), 0); // (0, 0) doesn't seem to work for some strange reason Move (8, 8); break; @@ -935,6 +938,7 @@ private: wxMenuItem* _tools_verify; wxMenuItem* _view_full_screen; wxMenuItem* _view_dual_screen; + wxSizer* _main_sizer; }; static const wxCmdLineEntryDesc command_line_description[] = { diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index 212ab6244..28a5acf79 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -214,7 +214,7 @@ AboutDialog::AboutDialog (wxWindow* parent) tested_by.Add (wxT ("Wolfgang Woehl")); add_section (_("Tested by"), tested_by); - sizer->Add (_notebook, wxSizerFlags().Centre().Border(wxALL, 16).Expand()); + sizer->Add (_notebook, wxSizerFlags().Centre().Border(wxALL, 16)); overall_sizer->Add (sizer); @@ -251,7 +251,7 @@ AboutDialog::add_section (wxString name, wxArrayString credits) int c = 0; for (size_t i = 0; i < credits.Count(); ++i) { - add_label_to_sizer (sizers[c], panel, credits[i], false); + add_label_to_vertical_sizer (sizers[c], panel, credits[i], false); ++c; if (c == N) { c = 0; diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index a7d43ece8..6e0d5b9b6 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -99,7 +99,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptrSetFont (subheading_font); - right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 16); + right->Add (m, 1, wxTOP | wxBOTTOM, 16); } for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) { @@ -114,7 +114,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptrSetFont (subheading_font); - right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16); + right->Add (m, 1, wxTOP, 16); } wxString const types[] = { @@ -131,7 +131,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptrSetFont (subheading_font); - right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16); + right->Add (m, 1, wxTOP, 16); } _smoothing = new wxSlider (this, wxID_ANY, AudioPlot::max_smoothing / 2, 1, AudioPlot::max_smoothing); diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 9f868f9f4..5d0756b3e 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -735,8 +735,6 @@ DCPPanel::setup_frame_rate_widget () _frame_rate_choice->Show (); _frame_rate_spin->Hide (); } - - _frame_rate_sizer->Layout (); } wxPanel * @@ -757,13 +755,9 @@ DCPPanel::make_video_panel () _frame_rate_label = create_label (panel, _("Frame Rate"), true); _frame_rate_choice = new wxChoice (panel, wxID_ANY); - _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL); - _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL); _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY); - _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL); setup_frame_rate_widget (); _best_frame_rate = new Button (panel, _("Use best")); - _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL); _three_d = new CheckBox (panel, _("3D")); diff --git a/src/wx/job_view.cc b/src/wx/job_view.cc index b61da04f8..77f6af6fb 100644 --- a/src/wx/job_view.cc +++ b/src/wx/job_view.cc @@ -61,7 +61,7 @@ JobView::setup () _gauge->SetMinSize (wxSize (0, -1)); _gauge_message->Add (_gauge, 0, wxEXPAND | wxLEFT | wxRIGHT); _message = new StaticText (_container, wxT(" \n "), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_MIDDLE); - _gauge_message->Add (_message, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6); + _gauge_message->Add (_message, 1, wxEXPAND | wxALL, 6); _table->Insert (n, _gauge_message, 1, wxEXPAND | wxLEFT | wxRIGHT); ++n; diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 6d3b7355a..adea6feba 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -74,7 +74,7 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) /* Sub-heading: Screens */ wxStaticText* h = new StaticText (this, _("Screens")); h->SetFont (subheading_font); - left->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); + left->Add (h, 0, wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); _screens = new ScreensPanel (this); left->Add (_screens, 1, wxEXPAND | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); @@ -82,14 +82,14 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) /// TRANSLATORS: translate the word "Timing" here; do not include the "KDM|" prefix h = new StaticText (this, S_("KDM|Timing")); h->SetFont (subheading_font); - right->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2); + right->Add (h, 0, 0, DCPOMATIC_SIZER_Y_GAP * 2); _timing = new KDMTimingPanel (this); right->Add (_timing); /* Sub-heading: CPL */ h = new StaticText (this, _("CPL")); h->SetFont (subheading_font); - right->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2); + right->Add (h, 0, 0, DCPOMATIC_SIZER_Y_GAP * 2); vector cpls; BOOST_FOREACH (CPLSummary const & i, film->cpls()) { @@ -104,7 +104,7 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) /* Sub-heading: Output */ h = new StaticText (this, _("Output")); h->SetFont (subheading_font); - right->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); + right->Add (h, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); _output = new KDMOutputPanel (this, film->interop ()); right->Add (_output, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP); diff --git a/src/wx/time_picker.cc b/src/wx/time_picker.cc index 295bbd52d..efd5e20ed 100644 --- a/src/wx/time_picker.cc +++ b/src/wx/time_picker.cc @@ -44,10 +44,10 @@ TimePicker::TimePicker (wxWindow* parent, wxDateTime time) wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL); _hours = new wxSpinCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size); - sizer->Add (_hours, 1, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); + sizer->Add (_hours, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP); sizer->Add (new StaticText (this, wxT (":")), 0, wxALIGN_CENTER_VERTICAL); _minutes = new wxSpinCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size); - sizer->Add (_minutes, 1, wxEXPAND | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); + sizer->Add (_minutes, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP); SetSizerAndFit (sizer); diff --git a/src/wx/wscript b/src/wx/wscript index 99720c109..2c2820e33 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -194,8 +194,12 @@ def configure(conf): conf.in_msg = 1 wx_version = conf.check_cfg(package='wxwidgets', path=wx_config, args='--version').strip() conf.im_msg = 0 - if not wx_version.startswith('3.0.'): - conf.fatal('wxwidgets version 3.0.x is required; %s found' % wx_version) + if not wx_version.startswith('3.'): + conf.fatal('wxwidgets version 3.x.y is required; %s found' % wx_version) + + config = conf.check_cfg(package='wxwidgets', path=wx_config, args='--selected-config').strip() + if config.find('gtk2') != -1: + conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='GTK', mandatory=True) try: conf.check_cfg(msg='Checking for RtAudio using pkg-config', diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 747d1df04..bb343b470 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -80,6 +80,22 @@ add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop, in return m; } + +/* Hack: this is the same but has different default flags */ +wxStaticText * +add_label_to_vertical_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop, int flags) +{ +#ifdef __WXOSX__ + if (left) { + flags |= wxALIGN_RIGHT; + } +#endif + wxStaticText* m = create_label (p, t, left); + s->Add (m, prop, flags, 6); + return m; +} + + wxStaticText * #ifdef __WXOSX__ add_label_to_sizer (wxSizer* s, wxStaticText* t, bool left, int prop, int flags) diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 8dcbc7f17..dc32ad9c8 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -72,6 +72,7 @@ extern void message_dialog (wxWindow *, wxString); extern bool confirm_dialog (wxWindow *, wxString); extern wxStaticText* create_label (wxWindow* p, wxString t, bool left); extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, wxString, bool left, int prop = 0, int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT); +extern wxStaticText* add_label_to_vertical_sizer (wxSizer *, wxWindow *, wxString, bool left, int prop = 0, int flags = wxLEFT | wxRIGHT); extern wxStaticText* add_label_to_sizer (wxSizer *, wxStaticText *, bool left, int prop = 0, int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT); extern wxStaticText* add_label_to_sizer (wxGridBagSizer *, wxWindow *, wxString, bool, wxGBPosition, wxGBSpan span = wxDefaultSpan); extern wxStaticText* add_label_to_sizer (wxGridBagSizer *, wxStaticText *, bool, wxGBPosition, wxGBSpan span = wxDefaultSpan); diff --git a/wscript b/wscript index 23b06e7ef..82d8baea6 100644 --- a/wscript +++ b/wscript @@ -178,8 +178,6 @@ def configure(conf): conf.env.append_value('CXXFLAGS', '-DLINUX_SHARE_PREFIX="%s/share/dcpomatic2"' % conf.env['INSTALL_PREFIX']) conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_LINUX') conf.env.append_value('CXXFLAGS', ['-Wlogical-op', '-Wno-deprecated-copy']) - if not conf.env.DISABLE_GUI: - conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='GTK', mandatory=True) # OSX if conf.env.TARGET_OSX: