Build fixes for Boost >= 1.73
[dcpomatic.git] / src / wx / config_dialog.cc
index 272d2e8ee0fbab334492445d97b6c10fb548b0d7..7a4bb92c9e16e1589785d8aac07377e6ebd2e102 100644 (file)
@@ -36,6 +36,9 @@ using boost::bind;
 using boost::optional;
 using boost::shared_ptr;
 using boost::function;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 
 static
 bool
@@ -53,6 +56,14 @@ Page::Page (wxSize panel_size, int border)
        _config_connection = Config::instance()->Changed.connect (bind (&Page::config_changed_wrapper, this));
 }
 
+
+wxWindow*
+Page::CreateWindow (wxWindow* parent)
+{
+       return create_window (parent);
+}
+
+
 wxWindow*
 Page::create_window (wxWindow* parent)
 {
@@ -84,37 +95,20 @@ Page::window_destroyed ()
 }
 
 
-StockPage::StockPage (Kind kind, wxSize panel_size, int border)
-       : wxStockPreferencesPage (kind)
-       , Page (panel_size, border)
-{
-
-}
-
-wxWindow*
-StockPage::CreateWindow (wxWindow* parent)
-{
-       return create_window (parent);
-}
-
-StandardPage::StandardPage (wxSize panel_size, int border)
+GeneralPage::GeneralPage (wxSize panel_size, int border)
        : Page (panel_size, border)
 {
 
 }
 
-wxWindow*
-StandardPage::CreateWindow (wxWindow* parent)
-{
-       return create_window (parent);
-}
 
-GeneralPage::GeneralPage (wxSize panel_size, int border)
-       : StockPage (Kind_General, panel_size, border)
+wxString
+GeneralPage::GetName () const
 {
-
+       return _("General");
 }
 
+
 void
 GeneralPage::add_language_controls (wxGridBagSizer* table, int& r)
 {
@@ -262,19 +256,10 @@ CertificateChainEditor::CertificateChainEditor (
        , _get (get)
        , _nag_alter (nag_alter)
 {
-       wxFont subheading_font (*wxNORMAL_FONT);
-       subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
-
        _sizer = new wxBoxSizer (wxVERTICAL);
 
-       {
-               wxStaticText* m = new StaticText (this, title);
-               m->SetFont (subheading_font);
-               _sizer->Add (m, 0, wxALL, border);
-       }
-
        wxBoxSizer* certificates_sizer = new wxBoxSizer (wxHORIZONTAL);
-       _sizer->Add (certificates_sizer, 0, wxLEFT | wxRIGHT, border);
+       _sizer->Add (certificates_sizer, 0, wxALL, border);
 
        _certificates = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize (440, 150), wxLC_REPORT | wxLC_SINGLE_SEL);
 
@@ -690,14 +675,18 @@ KeysPage::setup ()
                sizer->Add (m, 0, wxALL, _border);
        }
 
+       wxSizer* buttons = new wxBoxSizer (wxVERTICAL);
+
        wxButton* export_decryption_certificate = new Button (_panel, _("Export KDM decryption certificate..."));
-       sizer->Add (export_decryption_certificate, 0, wxLEFT, _border);
+       buttons->Add (export_decryption_certificate, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
        wxButton* export_settings = new Button (_panel, _("Export all KDM decryption settings..."));
-       sizer->Add (export_settings, 0, wxLEFT, _border);
+       buttons->Add (export_settings, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
        wxButton* import_settings = new Button (_panel, _("Import all KDM decryption settings..."));
-       sizer->Add (import_settings, 0, wxLEFT, _border);
+       buttons->Add (import_settings, 0, wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
        wxButton* decryption_advanced = new Button (_panel, _("Advanced..."));
-       sizer->Add (decryption_advanced, 0, wxALL, _border);
+       buttons->Add (decryption_advanced, 0);
+
+       sizer->Add (buttons, 0, wxLEFT, _border);
 
        export_decryption_certificate->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_certificate, this));
        export_settings->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_chain_and_key, this));
@@ -711,7 +700,7 @@ KeysPage::setup ()
        }
 
        wxButton* signing_advanced = new Button (_panel, _("Advanced..."));
-       sizer->Add (signing_advanced, 0, wxLEFT, _border);
+       sizer->Add (signing_advanced, 0, wxLEFT | wxBOTTOM, _border);
        signing_advanced->Bind (wxEVT_BUTTON, bind (&KeysPage::signing_advanced, this));
 }
 
@@ -892,9 +881,17 @@ SoundPage::setup ()
 
        RtAudio audio (DCPOMATIC_RTAUDIO_API);
        for (unsigned int i = 0; i < audio.getDeviceCount(); ++i) {
-               RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
-               if (dev.probed && dev.outputChannels > 0) {
-                       _sound_output->Append (std_to_wx (dev.name));
+               try {
+                       RtAudio::DeviceInfo dev = audio.getDeviceInfo (i);
+                       if (dev.probed && dev.outputChannels > 0) {
+                               _sound_output->Append (std_to_wx (dev.name));
+                       }
+#ifdef DCPOMATIC_USE_RTERROR
+               } catch (RtError&) {
+#else
+               } catch (RtAudioError&) {
+#endif
+                       /* Something went wrong so let's just ignore that device */
                }
        }
 
@@ -927,7 +924,13 @@ SoundPage::sound_output_changed ()
 {
        RtAudio audio (DCPOMATIC_RTAUDIO_API);
        optional<string> const so = get_sound_output();
-       if (!so || *so == audio.getDeviceInfo(audio.getDefaultOutputDevice()).name) {
+       string default_device;
+       try {
+               default_device = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name;
+       } catch (RtAudioError&) {
+               /* Never mind */
+       }
+       if (!so || *so == default_device) {
                Config::instance()->unset_sound_output ();
        } else {
                Config::instance()->set_sound_output (*so);
@@ -1032,7 +1035,7 @@ SoundPage::get_sound_output ()
 
 
 LocationsPage::LocationsPage (wxSize panel_size, int border)
-       : StandardPage (panel_size, border)
+       : Page (panel_size, border)
 {
 
 }
@@ -1054,7 +1057,6 @@ LocationsPage::GetLargeIcon () const
 void
 LocationsPage::setup ()
 {
-
        int r = 0;
 
        wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);