diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-16 19:40:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-16 19:40:43 +0100 |
| commit | 20eea989f452ea1a6af0af6b5c5b504d3b19480c (patch) | |
| tree | 51c922df42151747efc5f4db90bf79b53d6b4bac /src/wx | |
| parent | d71b3fffa09263a2116b3f91981c1999b4ae873c (diff) | |
Modify previous commit to move restriction code into the UI.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/dcp_panel.cc | 21 | ||||
| -rw-r--r-- | src/wx/dcp_panel.h | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 0759694f8..2829d88fa 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -43,6 +43,7 @@ using std::list; using std::string; using std::vector; using std::pair; +using std::max; using std::make_pair; using boost::lexical_cast; using boost::shared_ptr; @@ -349,8 +350,12 @@ DCPPanel::film_changed (int p) break; } case Film::AUDIO_CHANNELS: - checked_set (_audio_channels, dcp::raw_convert<string> (_film->audio_channels ())); - setup_dcp_name (); + if (_film->audio_channels () < minimum_allowed_audio_channels ()) { + _film->set_audio_channels (minimum_allowed_audio_channels ()); + } else { + checked_set (_audio_channels, dcp::raw_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ()))); + setup_dcp_name (); + } break; case Film::THREE_D: checked_set (_three_d, _film->three_d ()); @@ -653,8 +658,8 @@ DCPPanel::make_video_panel () return panel; } -void -DCPPanel::setup_audio_channels_choice () +int +DCPPanel::minimum_allowed_audio_channels () const { int min = 2; if (_film && _film->audio_processor ()) { @@ -665,8 +670,14 @@ DCPPanel::setup_audio_channels_choice () ++min; } + return min; +} + +void +DCPPanel::setup_audio_channels_choice () +{ vector<pair<string, string> > items; - for (int i = min; i <= 12; i += 2) { + for (int i = minimum_allowed_audio_channels(); i <= 12; i += 2) { items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i))); } diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index ab4e7f1d3..ac6792ddd 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -78,6 +78,8 @@ private: void setup_dcp_name (); void setup_audio_channels_choice (); + int minimum_allowed_audio_channels () const; + wxPanel* make_general_panel (); wxPanel* make_video_panel (); wxPanel* make_audio_panel (); |
