diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-10-16 02:35:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-10-16 02:35:30 +0100 |
| commit | 4d3caea8b70b4a19c8aa80d626d52d4f95114f8e (patch) | |
| tree | 3cff0617d07cd4a192350abea7d5dfc9aa8add7e /src/wx | |
| parent | 763acf87c7c80d508f6c10af0f3f46045d5c23df (diff) | |
Clumsy DCI naming dialog.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/dci_name_dialog.cc | 141 | ||||
| -rw-r--r-- | src/wx/dci_name_dialog.h | 50 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 36 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 2 | ||||
| -rw-r--r-- | src/wx/wscript | 17 |
5 files changed, 238 insertions, 8 deletions
diff --git a/src/wx/dci_name_dialog.cc b/src/wx/dci_name_dialog.cc new file mode 100644 index 000000000..9feb4aa86 --- /dev/null +++ b/src/wx/dci_name_dialog.cc @@ -0,0 +1,141 @@ +/* + Copyright (C) 2012 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <wx/sizer.h> +#include "dci_name_dialog.h" +#include "wx_util.h" +#include "film.h" + +DCINameDialog::DCINameDialog (wxWindow* parent, Film* film) + : wxDialog (parent, wxID_ANY, _("DCI name"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + , _film (film) +{ + wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6); + table->AddGrowableCol (1, 1); + + add_label_to_sizer (table, this, "Short Name (e.g. BLUES-BROS)"); + _dci_name_prefix = new wxTextCtrl (this, wxID_ANY); + table->Add (_dci_name_prefix, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Audio Language (e.g. EN)"); + _audio_language = new wxTextCtrl (this, wxID_ANY); + table->Add (_audio_language, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Subtitle Language (e.g. FR)"); + _subtitle_language = new wxTextCtrl (this, wxID_ANY); + table->Add (_subtitle_language, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Territory (e.g. UK)"); + _territory = new wxTextCtrl (this, wxID_ANY); + table->Add (_territory, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Rating (e.g. 15"); + _rating = new wxTextCtrl (this, wxID_ANY); + table->Add (_rating, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Studio (e.g. TCF)"); + _studio = new wxTextCtrl (this, wxID_ANY); + table->Add (_studio, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Facility (e.g. DLA)"); + _facility = new wxTextCtrl (this, wxID_ANY); + table->Add (_facility, 1, wxEXPAND); + + add_label_to_sizer (table, this, "Package Type (e.g. OV"); + _package_type = new wxTextCtrl (this, wxID_ANY); + table->Add (_package_type, 1, wxEXPAND); + + _dci_name_prefix->SetValue (std_to_wx (_film->dci_name_prefix ())); + _audio_language->SetValue (std_to_wx (_film->audio_language ())); + _subtitle_language->SetValue (std_to_wx (_film->subtitle_language ())); + _territory->SetValue (std_to_wx (_film->territory ())); + _rating->SetValue (std_to_wx (_film->rating ())); + _studio->SetValue (std_to_wx (_film->studio ())); + _facility->SetValue (std_to_wx (_film->facility ())); + _package_type->SetValue (std_to_wx (_film->package_type ())); + + _dci_name_prefix->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::dci_name_prefix_changed), 0, this); + _audio_language->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::audio_language_changed), 0, this); + _subtitle_language->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::subtitle_language_changed), 0, this); + _territory->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::territory_changed), 0, this); + _rating->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::rating_changed), 0, this); + _studio->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::studio_changed), 0, this); + _facility->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::facility_changed), 0, this); + _package_type->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (DCINameDialog::package_type_changed), 0, this); + + wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); + overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6); + + wxSizer* buttons = CreateSeparatedButtonSizer (wxOK); + if (buttons) { + overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); + } + + SetSizer (overall_sizer); + overall_sizer->Layout (); + overall_sizer->SetSizeHints (this); +} + +void +DCINameDialog::dci_name_prefix_changed (wxCommandEvent &) +{ + _film->set_dci_name_prefix (wx_to_std (_dci_name_prefix->GetValue ())); +} + +void +DCINameDialog::audio_language_changed (wxCommandEvent &) +{ + _film->set_audio_language (wx_to_std (_audio_language->GetValue ())); +} + +void +DCINameDialog::subtitle_language_changed (wxCommandEvent &) +{ + _film->set_subtitle_language (wx_to_std (_subtitle_language->GetValue ())); +} + +void +DCINameDialog::territory_changed (wxCommandEvent &) +{ + _film->set_territory (wx_to_std (_territory->GetValue ())); +} + +void +DCINameDialog::rating_changed (wxCommandEvent &) +{ + _film->set_rating (wx_to_std (_rating->GetValue ())); +} + +void +DCINameDialog::studio_changed (wxCommandEvent &) +{ + _film->set_studio (wx_to_std (_studio->GetValue ())); +} + +void +DCINameDialog::facility_changed (wxCommandEvent &) +{ + _film->set_facility (wx_to_std (_facility->GetValue ())); +} + +void +DCINameDialog::package_type_changed (wxCommandEvent &) +{ + _film->set_package_type (wx_to_std (_package_type->GetValue ())); +} diff --git a/src/wx/dci_name_dialog.h b/src/wx/dci_name_dialog.h new file mode 100644 index 000000000..95578f779 --- /dev/null +++ b/src/wx/dci_name_dialog.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2012 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <wx/dialog.h> +#include <wx/textctrl.h> + +class Film; + +class DCINameDialog : public wxDialog +{ +public: + DCINameDialog (wxWindow *, Film *); + +private: + void dci_name_prefix_changed (wxCommandEvent &); + void audio_language_changed (wxCommandEvent &); + void subtitle_language_changed (wxCommandEvent &); + void territory_changed (wxCommandEvent &); + void rating_changed (wxCommandEvent &); + void studio_changed (wxCommandEvent &); + void facility_changed (wxCommandEvent &); + void package_type_changed (wxCommandEvent &); + + wxTextCtrl* _dci_name_prefix; + wxTextCtrl* _audio_language; + wxTextCtrl* _subtitle_language; + wxTextCtrl* _territory; + wxTextCtrl* _rating; + wxTextCtrl* _studio; + wxTextCtrl* _facility; + wxTextCtrl* _package_type; + + Film* _film; +}; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 7fd2eb9fc..946c91e0c 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -43,6 +43,7 @@ #include "dcp_range_dialog.h" #include "gain_calculator_dialog.h" #include "sound_processor.h" +#include "dci_name_dialog.h" using namespace std; using namespace boost; @@ -222,6 +223,8 @@ FilmEditor::FilmEditor (Film* f, wxWindow* parent) /* Now connect to them, since initial values are safely set */ _name->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (FilmEditor::name_changed), 0, this); + _use_dci_name->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::use_dci_name_toggled), 0, this); + _edit_dci_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_dci_button_clicked), 0, this); _format->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this); _content->Connect (wxID_ANY, wxEVT_COMMAND_FILEPICKER_CHANGED, wxCommandEventHandler (FilmEditor::content_changed), 0, this); _left_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::left_crop_changed), 0, this); @@ -503,6 +506,12 @@ FilmEditor::film_changed (Film::Property p) case Film::SUBTITLE_SCALE: _subtitle_scale->SetValue (_film->subtitle_scale() * 100); break; + case Film::USE_DCI_NAME: + _use_dci_name->SetValue (_film->use_dci_name ()); + break; + case Film::DCI_METADATA: + _name->SetValue (std_to_wx (_film->state_copy()->dci_name())); + break; } } @@ -578,6 +587,8 @@ FilmEditor::set_film (Film* f) film_changed (Film::WITH_SUBTITLES); film_changed (Film::SUBTITLE_OFFSET); film_changed (Film::SUBTITLE_SCALE); + film_changed (Film::USE_DCI_NAME); + film_changed (Film::DCI_METADATA); } /** Updates the sensitivity of lots of widgets to a given value. @@ -587,6 +598,8 @@ void FilmEditor::set_things_sensitive (bool s) { _name->Enable (s); + _use_dci_name->Enable (s); + _edit_dci_button->Enable (s); _frames_per_second->Enable (s); _format->Enable (s); _content->Enable (s); @@ -799,3 +812,26 @@ FilmEditor::setup_subtitle_button () } } +void +FilmEditor::use_dci_name_toggled (wxCommandEvent &) +{ + if (!_film) { + return; + } + + _ignore_changes = Film::USE_DCI_NAME; + _film->set_use_dci_name (_use_dci_name->GetValue ()); + _ignore_changes = Film::NONE; +} + +void +FilmEditor::edit_dci_button_clicked (wxCommandEvent &) +{ + if (!_film) { + return; + } + + DCINameDialog* d = new DCINameDialog (this, _film); + d->ShowModal (); + d->Destroy (); +} diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 2a3be6d0c..2d13d2dc9 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -46,6 +46,8 @@ public: private: /* Handle changes to the view */ void name_changed (wxCommandEvent &); + void use_dci_name_toggled (wxCommandEvent &); + void edit_dci_button_clicked (wxCommandEvent &); void left_crop_changed (wxCommandEvent &); void right_crop_changed (wxCommandEvent &); void top_crop_changed (wxCommandEvent &); diff --git a/src/wx/wscript b/src/wx/wscript index 38107bb54..df2edbde1 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -9,20 +9,21 @@ def build(bld): obj.uselib = 'WXWIDGETS' obj.use = 'libdvdomatic' obj.source = """ + config_dialog.cc + dci_name_dialog.cc + dcp_range_dialog.cc + dir_picker_ctrl.cc film_editor.cc - wx_util.cc film_viewer.cc - job_manager_view.cc - job_wrapper.cc - gain_calculator_dialog.cc - config_dialog.cc filter_dialog.cc filter_view.cc - dcp_range_dialog.cc - server_dialog.cc + gain_calculator_dialog.cc + job_manager_view.cc + job_wrapper.cc new_film_dialog.cc - dir_picker_ctrl.cc properties_dialog.cc + server_dialog.cc + wx_util.cc """ # alignment.cc |
