From a7130995cf5f13396746932511ba133e8ad4ca9d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 25 Jan 2013 19:55:37 +0000 Subject: [PATCH] Use wxChoice instead of wxComboBox throughout. Fixes dcp content type hanging over on new film. --- src/wx/config_dialog.cc | 2 +- src/wx/config_dialog.h | 2 +- src/wx/film_editor.cc | 16 ++++++++-------- src/wx/film_editor.h | 12 ++++++------ src/wx/wx_util.cc | 13 +++---------- src/wx/wx_util.h | 4 ++-- 6 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 8886fa160..99527ffe7 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -86,7 +86,7 @@ ConfigDialog::ConfigDialog (wxWindow* parent) table->AddSpacer (1); add_label_to_sizer (table, this, "Reference scaler for A/B"); - _reference_scaler = new wxComboBox (this, wxID_ANY); + _reference_scaler = new wxChoice (this, wxID_ANY); vector const sc = Scaler::all (); for (vector::const_iterator i = sc.begin(); i != sc.end(); ++i) { _reference_scaler->Append (std_to_wx ((*i)->name ())); diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index fdbe99a4c..948bf0571 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -67,7 +67,7 @@ private: wxDirPickerCtrl* _default_directory; #endif wxButton* _default_dci_metadata_button; - wxComboBox* _reference_scaler; + wxChoice* _reference_scaler; wxStaticText* _reference_filters; wxButton* _reference_filters_button; wxListCtrl* _servers; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index aa32585df..1e5765ae8 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -120,7 +120,7 @@ FilmEditor::make_film_panel () _film_sizer->AddSpacer (0); add_label_to_sizer (_film_sizer, _film_panel, "Content Type"); - _dcp_content_type = new wxComboBox (_film_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY); + _dcp_content_type = new wxChoice (_film_panel, wxID_ANY); _film_sizer->Add (_dcp_content_type); video_control (add_label_to_sizer (_film_sizer, _film_panel, "Frames Per Second")); @@ -186,7 +186,7 @@ FilmEditor::connect_to_widgets () _bottom_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::bottom_crop_changed), 0, this); _filters_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_filters_clicked), 0, this); _scaler->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::scaler_changed), 0, this); - _dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this); + _dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this); _dcp_ab->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::dcp_ab_toggled), 0, this); _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this); _dcp_trim_start->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_trim_start_changed), 0, this); @@ -222,7 +222,7 @@ FilmEditor::make_video_panel () _video_panel->SetSizer (pad); add_label_to_sizer (_video_sizer, _video_panel, "Format"); - _format = new wxComboBox (_video_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY); + _format = new wxChoice (_video_panel, wxID_ANY); _video_sizer->Add (_format); { @@ -259,7 +259,7 @@ FilmEditor::make_video_panel () } video_control (add_label_to_sizer (_video_sizer, _video_panel, "Scaler")); - _scaler = new wxComboBox (_video_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY); + _scaler = new wxChoice (_video_panel, wxID_ANY); _video_sizer->Add (video_control (_scaler), 1); vector const sc = Scaler::all (); @@ -268,7 +268,7 @@ FilmEditor::make_video_panel () } add_label_to_sizer (_video_sizer, _video_panel, "Colour look-up table"); - _colour_lut = new wxComboBox (_video_panel, wxID_ANY); + _colour_lut = new wxChoice (_video_panel, wxID_ANY); for (int i = 0; i < 2; ++i) { _colour_lut->Append (std_to_wx (colour_lut_index_to_name (i))); } @@ -328,7 +328,7 @@ FilmEditor::make_audio_panel () _use_content_audio = new wxRadioButton (_audio_panel, wxID_ANY, _("Use content's audio"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); _audio_sizer->Add (video_control (_use_content_audio)); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _audio_stream = new wxComboBox (_audio_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY); + _audio_stream = new wxChoice (_audio_panel, wxID_ANY); s->Add (video_control (_audio_stream), 1); _audio = new wxStaticText (_audio_panel, wxID_ANY, wxT ("")); s->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8); @@ -373,7 +373,7 @@ FilmEditor::make_subtitle_panel () video_control (_with_subtitles); _subtitle_sizer->Add (_with_subtitles, 1); - _subtitle_stream = new wxComboBox (_subtitle_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY); + _subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY); _subtitle_sizer->Add (video_control (_subtitle_stream)); video_control (add_label_to_sizer (_subtitle_sizer, _subtitle_panel, "Subtitle Offset")); @@ -1085,7 +1085,7 @@ FilmEditor::setup_streams () if (_film->subtitle_stream()) { checked_set (_subtitle_stream, _film->subtitle_stream()->to_string()); } else { - _subtitle_stream->SetValue (wxT ("")); + _subtitle_stream->SetSelection (wxNOT_FOUND); } } diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 8a900f1e4..581ae3f69 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -118,7 +118,7 @@ private: wxCheckBox* _use_dci_name; wxButton* _edit_dci_button; /** The Film's format */ - wxComboBox* _format; + wxChoice* _format; /** The Film's content file */ wxFilePickerCtrl* _content; wxCheckBox* _trust_content_header; @@ -135,9 +135,9 @@ private: /** Button to open the filters dialogue */ wxButton* _filters_button; /** The Film's scaler */ - wxComboBox* _scaler; + wxChoice* _scaler; wxRadioButton* _use_content_audio; - wxComboBox* _audio_stream; + wxChoice* _audio_stream; wxRadioButton* _use_external_audio; wxFilePickerCtrl* _external_audio[MAX_AUDIO_CHANNELS]; /** The Film's audio gain */ @@ -147,13 +147,13 @@ private: /** The Film's audio delay */ wxSpinCtrl* _audio_delay; wxCheckBox* _with_subtitles; - wxComboBox* _subtitle_stream; + wxChoice* _subtitle_stream; wxSpinCtrl* _subtitle_offset; wxSpinCtrl* _subtitle_scale; - wxComboBox* _colour_lut; + wxChoice* _colour_lut; wxSpinCtrl* _j2k_bandwidth; /** The Film's DCP content type */ - wxComboBox* _dcp_content_type; + wxChoice* _dcp_content_type; /** The Film's frames per second */ wxStaticText* _frames_per_second; /** The Film's original size */ diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index bc444e4bc..413071ea6 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -138,22 +138,15 @@ checked_set (wxSpinCtrl* widget, int value) } void -checked_set (wxComboBox* widget, int value) +checked_set (wxChoice* widget, int value) { if (widget->GetSelection() != value) { - if (value == wxNOT_FOUND) { - /* Work around an apparent wxWidgets bug; SetSelection (wxNOT_FOUND) - appears not to work sometimes. - */ - widget->SetValue (wxT ("")); - } else { - widget->SetSelection (value); - } + widget->SetSelection (value); } } void -checked_set (wxComboBox* widget, string value) +checked_set (wxChoice* widget, string value) { wxClientData* o = 0; if (widget->GetSelection() != -1) { diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 6cb7fd002..0c77735eb 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -58,8 +58,8 @@ extern std::string string_client_data (wxClientData* o); extern void checked_set (wxFilePickerCtrl* widget, std::string value); extern void checked_set (wxSpinCtrl* widget, int value); -extern void checked_set (wxComboBox* widget, int value); -extern void checked_set (wxComboBox* widget, std::string value); +extern void checked_set (wxChoice* widget, int value); +extern void checked_set (wxChoice* widget, std::string value); extern void checked_set (wxTextCtrl* widget, std::string value); extern void checked_set (wxCheckBox* widget, bool value); extern void checked_set (wxRadioButton* widget, bool value); -- 2.30.2