BOOST_FOREACH.
[dcpomatic.git] / src / wx / dcp_panel.cc
index 4e023db325972c0c21fc486dd681e76c99708c13..5d941301bcb75865b8c2b545aa5bd46d20d22d4c 100644 (file)
@@ -47,7 +47,6 @@
 #include <wx/gbsizer.h>
 #include <wx/spinctrl.h>
 #include <boost/lexical_cast.hpp>
-#include <boost/foreach.hpp>
 #include <iostream>
 
 using std::cout;
@@ -58,8 +57,8 @@ using std::pair;
 using std::max;
 using std::make_pair;
 using boost::lexical_cast;
-using boost::shared_ptr;
-using boost::weak_ptr;
+using std::shared_ptr;
+using std::weak_ptr;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
@@ -137,7 +136,7 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
        _markers->Bind               (wxEVT_BUTTON,   boost::bind (&DCPPanel::markers_clicked, this));
        _metadata->Bind              (wxEVT_BUTTON,   boost::bind (&DCPPanel::metadata_clicked, this));
 
-       BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) {
+       for (auto i: DCPContentType::all()) {
                _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
        }
 
@@ -159,8 +158,6 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v
 void
 DCPPanel::add_to_grid ()
 {
-       Config::Interface interface = Config::instance()->interface_complexity ();
-
        int r = 0;
 
        add_label_to_sizer (_grid, _name_label, true, wxGBPosition (r, 0));
@@ -172,22 +169,14 @@ DCPPanel::add_to_grid ()
        flags |= wxALIGN_RIGHT;
 #endif
 
-       bool const full = interface == Config::INTERFACE_FULL;
-
-       _use_isdcf_name->Show (full);
-       _edit_isdcf_button->Show (full);
-       _copy_isdcf_name_button->Show (full);
-
-       if (full) {
-               _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
-               {
-                       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-                       s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
-                       s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
-                       _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
-               }
-               ++r;
+       _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
+       {
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+               s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
+               _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
        }
+       ++r;
 
        _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
        ++r;
@@ -199,43 +188,28 @@ DCPPanel::add_to_grid ()
        _grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
        ++r;
 
+       add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
+       _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       ++r;
 
-       _reels_label->Show (full);
-       _reel_type->Show (full);
-       _reel_length_label->Show (full);
-       _reel_length->Show (full);
-       _reel_length_gb_label->Show (full);
-       _standard_label->Show (full);
-       _standard->Show (full);
-       _markers->Show (full);
-       _metadata->Show (full);
-       _reencode_j2k->Show (full);
-       _encrypted->Show (full);
-
-       if (full) {
-               add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
-               _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
-               ++r;
-
-               add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
-               {
-                       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-                       s->Add (_reel_length);
-                       add_label_to_sizer (s, _reel_length_gb_label, false);
-                       _grid->Add (s, wxGBPosition (r, 1));
-               }
-               ++r;
+       add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
+       {
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               s->Add (_reel_length);
+               add_label_to_sizer (s, _reel_length_gb_label, false);
+               _grid->Add (s, wxGBPosition (r, 1));
+       }
+       ++r;
 
-               add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
-               _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
-               ++r;
+       add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
+       _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       ++r;
 
-               wxBoxSizer* extra = new wxBoxSizer (wxHORIZONTAL);
-               extra->Add (_markers, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
-               extra->Add (_metadata, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
-               _grid->Add (extra, wxGBPosition(r, 0), wxGBSpan(1, 2));
-               ++r;
-       }
+       wxBoxSizer* extra = new wxBoxSizer (wxHORIZONTAL);
+       extra->Add (_markers, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+       extra->Add (_metadata, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+       _grid->Add (extra, wxGBPosition(r, 0), wxGBSpan(1, 2));
+       ++r;
 }
 
 void
@@ -405,6 +379,7 @@ DCPPanel::film_changed (int p)
                break;
        }
        case Film::ISDCF_METADATA:
+       case Film::SUBTITLE_LANGUAGES:
                setup_dcp_name ();
                break;
        case Film::VIDEO_FRAME_RATE:
@@ -708,20 +683,7 @@ DCPPanel::config_changed (Config::Property p)
        _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
        setup_frame_rate_widget ();
 
-       if (p == Config::INTERFACE_COMPLEXITY) {
-               _grid->Clear ();
-               add_to_grid ();
-               _sizer->Layout ();
-               _grid->Layout ();
-
-               _video_grid->Clear ();
-               add_video_panel_to_grid ();
-               _video_grid->Layout ();
-
-               _audio_grid->Clear ();
-               add_audio_panel_to_grid ();
-               _audio_grid->Layout ();
-       } else if (p == Config::SHOW_EXPERIMENTAL_AUDIO_PROCESSORS) {
+       if (p == Config::SHOW_EXPERIMENTAL_AUDIO_PROCESSORS) {
                _audio_processor->Clear ();
                add_audio_processors ();
                if (_film) {
@@ -783,11 +745,11 @@ DCPPanel::make_video_panel ()
        _three_d->Bind           (wxEVT_CHECKBOX, boost::bind(&DCPPanel::three_d_changed, this));
        _reencode_j2k->Bind      (wxEVT_CHECKBOX, boost::bind(&DCPPanel::reencode_j2k_changed, this));
 
-       BOOST_FOREACH (Ratio const * i, Ratio::containers()) {
+       for (auto i: Ratio::containers()) {
                _container->Append (std_to_wx(i->container_nickname()));
        }
 
-       BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) {
+       for (auto i: Config::instance()->allowed_dcp_frame_rates()) {
                _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
        }
 
@@ -805,8 +767,6 @@ DCPPanel::make_video_panel ()
 void
 DCPPanel::add_video_panel_to_grid ()
 {
-       bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
-
        int r = 0;
 
        add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
@@ -835,19 +795,13 @@ DCPPanel::add_video_panel_to_grid ()
        _video_grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
        ++r;
 
-       _j2k_bandwidth_label->Show (full);
-       _j2k_bandwidth->Show (full);
-       _mbits_label->Show (full);
-
-       if (full) {
-               add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
-               wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               s->Add (_j2k_bandwidth, 1);
-               add_label_to_sizer (s, _mbits_label, false);
-               _video_grid->Add (s, wxGBPosition (r, 1));
-               ++r;
-               _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
-       }
+       add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
+       wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+       s->Add (_j2k_bandwidth, 0, wxALIGN_CENTER_VERTICAL);
+       add_label_to_sizer (s, _mbits_label, false, 0, wxALIGN_CENTER_VERTICAL);
+       _video_grid->Add (s, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
+       ++r;
+       _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
 }
 
 int
@@ -896,27 +850,15 @@ DCPPanel::make_audio_panel ()
 void
 DCPPanel::add_audio_panel_to_grid ()
 {
-       bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
-
        int r = 0;
 
-       _channels_label->Show (full);
-       _audio_channels->Show (full);
-
-       if (full) {
-               add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
-               _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
-               ++r;
-       }
-
-       _processor_label->Show (full);
-       _audio_processor->Show (full);
+       add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
+       _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
+       ++r;
 
-       if (full) {
-               add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
-               _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
-               ++r;
-       }
+       add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
+       _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
+       ++r;
 
        _audio_grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
        ++r;
@@ -980,7 +922,7 @@ void
 DCPPanel::add_audio_processors ()
 {
        _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
-       BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::visible()) {
+       for (auto ap: AudioProcessor::visible()) {
                _audio_processor->Append (std_to_wx(ap->name()), new wxStringClientData(std_to_wx(ap->id())));
        }
        _audio_panel_sizer->Layout();