diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-12 23:29:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-12 23:29:21 +0100 |
| commit | 93facb40ea1d2bf88053230afdc80af2737d7b99 (patch) | |
| tree | 9dec85dd42776e859ce3a0830011a82c155a3260 /src/wx | |
| parent | 1a944e0bd39abf49bbe863b23c3b4b84eb7459fc (diff) | |
Add option to use any DCP frame rate, rather than just the
"allowed" set.
Requested-by: Noah Orozco
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/config_dialog.cc | 12 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 63 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 8 |
3 files changed, 66 insertions, 17 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index e7133a534..e27b79172 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -109,6 +109,10 @@ public: add_label_to_sizer (table, panel, _("Maximum JPEG2000 bandwidth"), true); _maximum_j2k_bandwidth = new wxSpinCtrl (panel); table->Add (_maximum_j2k_bandwidth, 1); + + _allow_any_dcp_frame_rate = new wxCheckBox (panel, wxID_ANY, _("Allow any DCP frame rate")); + table->Add (_allow_any_dcp_frame_rate, 1, wxEXPAND | wxALL); + table->AddSpacer (0); add_label_to_sizer (table, panel, _("Outgoing mail server"), true); _mail_server = new wxTextCtrl (panel, wxID_ANY); @@ -183,6 +187,8 @@ public: _check_for_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_updates_changed, this)); _check_for_test_updates->SetValue (config->check_for_test_updates ()); _check_for_test_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_test_updates_changed, this)); + _allow_any_dcp_frame_rate->SetValue (config->allow_any_dcp_frame_rate ()); + _allow_any_dcp_frame_rate->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::allow_any_dcp_frame_rate_changed, this)); return panel; } @@ -269,11 +275,17 @@ private: { Config::instance()->set_maximum_j2k_bandwidth (_maximum_j2k_bandwidth->GetValue() * 1000000); } + + void allow_any_dcp_frame_rate_changed () + { + Config::instance()->set_allow_any_dcp_frame_rate (_allow_any_dcp_frame_rate->GetValue ()); + } wxCheckBox* _set_language; wxChoice* _language; wxSpinCtrl* _num_local_encoding_threads; wxSpinCtrl* _maximum_j2k_bandwidth; + wxCheckBox* _allow_any_dcp_frame_rate; wxTextCtrl* _mail_server; wxTextCtrl* _mail_user; wxTextCtrl* _mail_password; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 17198e8b3..51bb1f534 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -143,12 +143,15 @@ FilmEditor::make_dcp_panel () { add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Frame Rate"), true, wxGBPosition (r, 0)); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _frame_rate = new wxChoice (_dcp_panel, wxID_ANY); - s->Add (_frame_rate, 1, wxALIGN_CENTER_VERTICAL); + _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL); + _frame_rate_choice = new wxChoice (_dcp_panel, wxID_ANY); + _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL); + _frame_rate_spin = new wxSpinCtrl (_dcp_panel, wxID_ANY); + _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL); + setup_frame_rate_widget (); _best_frame_rate = new wxButton (_dcp_panel, wxID_ANY, _("Use best")); - s->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND); - grid->Add (s, wxGBPosition (r, 1)); + _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND); + grid->Add (_frame_rate_sizer, wxGBPosition (r, 1)); } ++r; @@ -211,7 +214,7 @@ FilmEditor::make_dcp_panel () list<int> const dfr = Config::instance()->allowed_dcp_frame_rates (); for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) { - _frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i))); + _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i))); } _audio_channels->SetRange (0, MAX_DCP_AUDIO_CHANNELS); @@ -242,7 +245,8 @@ FilmEditor::connect_to_widgets () _content_timeline->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_timeline_clicked, this)); _scaler->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::scaler_changed, this)); _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::dcp_content_type_changed, this)); - _frame_rate->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::frame_rate_changed, this)); + _frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::frame_rate_choice_changed, this)); + _frame_rate_spin->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&FilmEditor::frame_rate_spin_changed, this)); _best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::best_frame_rate_clicked, this)); _signed->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::signed_toggled, this)); _encrypted->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::encrypted_toggled, this)); @@ -352,9 +356,9 @@ FilmEditor::encrypted_toggled () _film->set_encrypted (_encrypted->GetValue ()); } -/** Called when the name widget has been changed */ +/** Called when the frame rate choice widget has been changed */ void -FilmEditor::frame_rate_changed () +FilmEditor::frame_rate_choice_changed () { if (!_film) { return; @@ -362,11 +366,22 @@ FilmEditor::frame_rate_changed () _film->set_video_frame_rate ( boost::lexical_cast<int> ( - wx_to_std (_frame_rate->GetString (_frame_rate->GetSelection ())) + wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ())) ) ); } +/** Called when the frame rate spin widget has been changed */ +void +FilmEditor::frame_rate_spin_changed () +{ + if (!_film) { + return; + } + + _film->set_video_frame_rate (_frame_rate_spin->GetValue ()); +} + void FilmEditor::audio_channels_changed () { @@ -468,18 +483,20 @@ FilmEditor::film_changed (Film::Property p) case Film::VIDEO_FRAME_RATE: { bool done = false; - for (unsigned int i = 0; i < _frame_rate->GetCount(); ++i) { - if (wx_to_std (_frame_rate->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) { - checked_set (_frame_rate, i); + for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) { + if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) { + checked_set (_frame_rate_choice, i); done = true; break; } } if (!done) { - checked_set (_frame_rate, -1); + checked_set (_frame_rate_choice, -1); } + _frame_rate_spin->SetValue (_film->video_frame_rate ()); + _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ()); break; } @@ -646,7 +663,8 @@ FilmEditor::set_general_sensitivity (bool s) _signed->Enable (si); _encrypted->Enable (s); - _frame_rate->Enable (s); + _frame_rate_choice->Enable (s); + _frame_rate_spin->Enable (s); _audio_channels->Enable (s); _j2k_bandwidth->Enable (s); _container->Enable (s); @@ -1016,4 +1034,19 @@ void FilmEditor::config_changed () { _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000); + setup_frame_rate_widget (); +} + +void +FilmEditor::setup_frame_rate_widget () +{ + if (Config::instance()->allow_any_dcp_frame_rate ()) { + _frame_rate_choice->Hide (); + _frame_rate_spin->Show (); + } else { + _frame_rate_choice->Show (); + _frame_rate_spin->Hide (); + } + + _frame_rate_sizer->Layout (); } diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index a1336ec90..56e54734b 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -87,7 +87,8 @@ private: void dcp_content_type_changed (); void scaler_changed (); void j2k_bandwidth_changed (); - void frame_rate_changed (); + void frame_rate_choice_changed (); + void frame_rate_spin_changed (); void best_frame_rate_clicked (); void content_timeline_clicked (); void audio_channels_changed (); @@ -108,6 +109,7 @@ private: void setup_content (); void setup_container (); void setup_content_sensitivity (); + void setup_frame_rate_widget (); void active_jobs_changed (bool); void config_changed (); @@ -143,7 +145,9 @@ private: wxChoice* _scaler; wxSpinCtrl* _j2k_bandwidth; wxChoice* _dcp_content_type; - wxChoice* _frame_rate; + wxChoice* _frame_rate_choice; + wxSpinCtrl* _frame_rate_spin; + wxSizer* _frame_rate_sizer; wxSpinCtrl* _audio_channels; wxButton* _best_frame_rate; wxCheckBox* _three_d; |
