From 9c1bb2e5ca7c80c4e26b1b2e41159aa171360a94 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 8 Dec 2018 00:09:57 +0000 Subject: [PATCH] Basics of in-place i18n with support for wxStaticText and wxCheckBox. --- src/tools/dcpomatic_kdm.cc | 9 ++-- src/tools/dcpomatic_server.cc | 3 +- src/wx/about_dialog.cc | 17 +++---- src/wx/audio_dialog.cc | 22 +++++---- src/wx/audio_panel.cc | 12 +++-- src/wx/check_box.cc | 42 ++++++++++++++++ src/wx/check_box.h | 36 ++++++++++++++ src/wx/colour_conversion_editor.cc | 14 +++--- src/wx/config_dialog.cc | 20 ++++---- src/wx/config_move_dialog.cc | 5 +- src/wx/confirm_kdm_email_dialog.cc | 8 ++-- src/wx/content_colour_conversion_dialog.cc | 11 +++-- src/wx/content_properties_dialog.cc | 7 +-- src/wx/controls.cc | 10 ++-- src/wx/dcp_panel.cc | 25 +++++----- src/wx/dir_picker_ctrl.cc | 7 +-- src/wx/download_certificate_dialog.cc | 5 +- src/wx/export_dialog.cc | 5 +- src/wx/film_name_location_dialog.cc | 5 +- src/wx/filter_editor.cc | 14 +++--- src/wx/font_files_dialog.cc | 7 +-- src/wx/full_config_dialog.cc | 38 ++++++++------- src/wx/hints_dialog.cc | 6 ++- src/wx/i18n_hook.cc | 56 ++++++++++++++++++++++ src/wx/i18n_hook.h | 40 ++++++++++++++++ src/wx/initial_setup_dialog.cc | 5 +- src/wx/instant_i18n_dialog.cc | 50 +++++++++++++++++++ src/wx/instant_i18n_dialog.h | 34 +++++++++++++ src/wx/isdcf_metadata_dialog.cc | 11 +++-- src/wx/job_view.cc | 6 ++- src/wx/kdm_advanced_dialog.cc | 5 +- src/wx/kdm_cpl_panel.cc | 9 ++-- src/wx/kdm_dialog.cc | 11 +++-- src/wx/kdm_output_panel.cc | 5 +- src/wx/kdm_timing_panel.cc | 5 +- src/wx/make_chain_dialog.cc | 9 ++-- src/wx/message_dialog.cc | 3 +- src/wx/nag_dialog.cc | 8 ++-- src/wx/name_format_editor.cc | 7 +-- src/wx/paste_dialog.cc | 7 +-- src/wx/player_config_dialog.cc | 3 +- src/wx/recreate_chain_dialog.cc | 6 ++- src/wx/report_problem_dialog.cc | 10 ++-- src/wx/rgba_colour_picker.cc | 7 +-- src/wx/screen_dialog.cc | 5 +- src/wx/self_dkdm_dialog.cc | 5 +- src/wx/static_text.cc | 40 ++++++++++++++++ src/wx/static_text.h | 31 ++++++++++++ src/wx/subtitle_appearance_dialog.cc | 8 ++-- src/wx/table_dialog.cc | 5 +- src/wx/text_panel.cc | 20 ++++---- src/wx/time_picker.cc | 5 +- src/wx/timing_panel.cc | 13 ++--- src/wx/update_dialog.cc | 9 ++-- src/wx/video_panel.cc | 12 +++-- src/wx/video_waveform_dialog.cc | 5 +- src/wx/wscript | 4 ++ src/wx/wx_util.cc | 3 +- 58 files changed, 595 insertions(+), 195 deletions(-) create mode 100644 src/wx/check_box.cc create mode 100644 src/wx/check_box.h create mode 100644 src/wx/i18n_hook.cc create mode 100644 src/wx/i18n_hook.h create mode 100644 src/wx/instant_i18n_dialog.cc create mode 100644 src/wx/instant_i18n_dialog.h create mode 100644 src/wx/static_text.cc create mode 100644 src/wx/static_text.h diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 2af57e369..999bba17e 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -31,6 +31,7 @@ #include "wx/file_dialog_wrapper.h" #include "wx/new_dkdm_folder_dialog.h" #include "wx/editable_list.h" +#include "wx/static_text.h" #include "lib/config.h" #include "lib/util.h" #include "lib/screen.h" @@ -129,20 +130,20 @@ public: wxFont subheading_font (*wxNORMAL_FONT); subheading_font.SetWeight (wxFONTWEIGHT_BOLD); - wxStaticText* h = new wxStaticText (overall_panel, wxID_ANY, _("Screens")); + wxStaticText* h = new StaticText (overall_panel, _("Screens")); h->SetFont (subheading_font); left->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); _screens = new ScreensPanel (overall_panel); left->Add (_screens, 1, wxEXPAND | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); /// TRANSLATORS: translate the word "Timing" here; do not include the "KDM|" prefix - h = new wxStaticText (overall_panel, wxID_ANY, S_("KDM|Timing")); + h = new StaticText (overall_panel, S_("KDM|Timing")); h->SetFont (subheading_font); right->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2); _timing = new KDMTimingPanel (overall_panel); right->Add (_timing, 0, wxALL, DCPOMATIC_SIZER_Y_GAP); - h = new wxStaticText (overall_panel, wxID_ANY, _("DKDM")); + h = new StaticText (overall_panel, _("DKDM")); h->SetFont (subheading_font); right->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); wxBoxSizer* dkdm_sizer = new wxBoxSizer (wxHORIZONTAL); @@ -162,7 +163,7 @@ public: add_dkdm_view (Config::instance()->dkdms()); - h = new wxStaticText (overall_panel, wxID_ANY, _("Output")); + h = new StaticText (overall_panel, _("Output")); h->SetFont (subheading_font); right->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); /* XXX: hard-coded non-interop here */ diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 64bbb3049..1a3a8de1a 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -20,6 +20,7 @@ #include "wx/wx_util.h" #include "wx/wx_signal_manager.h" +#include "wx/static_text.h" #include "lib/util.h" #include "lib/encoded_log_entry.h" #include "lib/encode_server.h" @@ -147,7 +148,7 @@ public: wxFlexGridSizer* state_sizer = new wxFlexGridSizer (2, DCPOMATIC_SIZER_GAP, DCPOMATIC_SIZER_GAP); add_label_to_sizer (state_sizer, this, _("Frames per second"), true); - _fps = new wxStaticText (this, wxID_ANY, wxT("")); + _fps = new StaticText (this, wxT("")); state_sizer->Add (_fps); wxFlexGridSizer* log_sizer = new wxFlexGridSizer (1, DCPOMATIC_SIZER_GAP, DCPOMATIC_SIZER_GAP); diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index b9233ef1f..db33ad647 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2017 Carl Hetherington + Copyright (C) 2013-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -24,6 +24,7 @@ #include "about_dialog.h" #include "wx_util.h" +#include "static_text.h" #include "lib/version.h" #include "lib/compose.hpp" #include @@ -47,22 +48,22 @@ AboutDialog::AboutDialog (wxWindow* parent) wxFont version_font (*wxNORMAL_FONT); version_font.SetWeight (wxFONTWEIGHT_BOLD); - wxStaticText* t = new wxStaticText (this, wxID_ANY, _("DCP-o-matic")); + wxStaticText* t = new StaticText (this, _("DCP-o-matic")); t->SetFont (title_font); sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 16)); wxString s; if (strcmp (dcpomatic_git_commit, "release") == 0) { - t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1", dcpomatic_version))); + t = new StaticText (this, std_to_wx(String::compose("Version %1", dcpomatic_version))); } else { - t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit))); + t = new StaticText (this, std_to_wx(String::compose("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit))); } t->SetFont (version_font); sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 2)); sizer->AddSpacer (12); - t = new wxStaticText ( - this, wxID_ANY, + t = new StaticText ( + this, _("Free, open-source DCP creation from almost anything."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER ); @@ -78,8 +79,8 @@ AboutDialog::AboutDialog (wxWindow* parent) sizer->Add (h, wxSizerFlags().Centre().Border(wxALL, 8)); - t = new wxStaticText ( - this, wxID_ANY, + t = new StaticText ( + this, _("(C) 2012-2018 Carl Hetherington, Terrence Meiczinger\n Ole Laursen, Brecht Sanders"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER ); diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index 48540077e..81687ca80 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -21,6 +21,8 @@ #include "audio_dialog.h" #include "audio_plot.h" #include "wx_util.h" +#include "static_text.h" +#include "check_box.h" #include "lib/audio_analysis.h" #include "lib/film.h" #include "lib/analyse_audio_job.h" @@ -74,17 +76,17 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptrAdd (_cursor, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP); _plot = new AudioPlot (this); left->Add (_plot, 1, wxTOP | wxEXPAND, 12); - _sample_peak = new wxStaticText (this, wxID_ANY, wxT ("")); + _sample_peak = new StaticText (this, wxT ("")); left->Add (_sample_peak, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP); - _true_peak = new wxStaticText (this, wxID_ANY, wxT ("")); + _true_peak = new StaticText (this, wxT ("")); left->Add (_true_peak, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP); - _integrated_loudness = new wxStaticText (this, wxID_ANY, wxT ("")); + _integrated_loudness = new StaticText (this, wxT ("")); left->Add (_integrated_loudness, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP); - _loudness_range = new wxStaticText (this, wxID_ANY, wxT ("")); + _loudness_range = new StaticText (this, wxT ("")); left->Add (_loudness_range, 0, wxTOP, DCPOMATIC_SIZER_Y_GAP); lr_sizer->Add (left, 1, wxALL | wxEXPAND, 12); @@ -92,13 +94,13 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptrSetFont (subheading_font); right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 16); } for (int i = 0; i < _channels; ++i) { - _channel_checkbox[i] = new wxCheckBox (this, wxID_ANY, std_to_wx (audio_channel_name (i))); + _channel_checkbox[i] = new CheckBox (this, std_to_wx(audio_channel_name(i))); _channel_checkbox[i]->SetForegroundColour(wxColour(_plot->colour(i))); right->Add (_channel_checkbox[i], 0, wxEXPAND | wxALL, 3); _channel_checkbox[i]->Bind (wxEVT_CHECKBOX, boost::bind (&AudioDialog::channel_clicked, this, _1)); @@ -109,7 +111,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptrSetFont (subheading_font); right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16); } @@ -120,13 +122,13 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr film, shared_ptrAdd (_type_checkbox[i], 0, wxEXPAND | wxALL, 3); _type_checkbox[i]->Bind (wxEVT_CHECKBOX, boost::bind (&AudioDialog::type_clicked, this, _1)); } { - wxStaticText* m = new wxStaticText (this, wxID_ANY, _("Smoothing")); + wxStaticText* m = new StaticText (this, _("Smoothing")); m->SetFont (subheading_font); right->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16); } diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 38504eacf..34292620b 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -24,6 +24,8 @@ #include "gain_calculator_dialog.h" #include "content_panel.h" #include "audio_dialog.h" +#include "static_text.h" +#include "check_box.h" #include "lib/config.h" #include "lib/ffmpeg_audio_stream.h" #include "lib/ffmpeg_content.h" @@ -48,8 +50,8 @@ AudioPanel::AudioPanel (ContentPanel* p) : ContentSubPanel (p, _("Audio")) , _audio_dialog (0) { - _reference = new wxCheckBox (this, wxID_ANY, _("Use this DCP's audio as OV and make VF")); - _reference_note = new wxStaticText (this, wxID_ANY, wxT("")); + _reference = new CheckBox (this, _("Use this DCP's audio as OV and make VF")); + _reference_note = new StaticText (this, wxT("")); _reference_note->Wrap (200); wxFont font = _reference_note->GetFont(); font.SetStyle(wxFONTSTYLE_ITALIC); @@ -57,7 +59,7 @@ AudioPanel::AudioPanel (ContentPanel* p) _reference_note->SetFont(font); _show = new wxButton (this, wxID_ANY, _("Show graph of audio levels...")); - _peak = new wxStaticText (this, wxID_ANY, wxT ("")); + _peak = new StaticText (this, wxT ("")); _gain_label = create_label (this, _("Gain"), true); _gain = new ContentSpinCtrlDouble ( @@ -88,7 +90,7 @@ AudioPanel::AudioPanel (ContentPanel* p) _mapping = new AudioMappingView (this); _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6); - _description = new wxStaticText (this, wxID_ANY, wxT (" \n"), wxDefaultPosition, wxDefaultSize); + _description = new StaticText (this, wxT(" \n"), wxDefaultPosition, wxDefaultSize); _sizer->Add (_description, 0, wxALL, 12); _description->SetFont (font); diff --git a/src/wx/check_box.cc b/src/wx/check_box.cc new file mode 100644 index 000000000..8f24f43ec --- /dev/null +++ b/src/wx/check_box.cc @@ -0,0 +1,42 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#include "check_box.h" + +using std::cout; + +CheckBox::CheckBox (wxWindow* parent, wxString label) + : wxCheckBox (parent, wxID_ANY, label) + , I18NHook (this) +{ + +} + +void +CheckBox::set_text (wxString text) +{ + SetLabel (text); +} + +wxString +CheckBox::get_text () const +{ + return GetLabel (); +} diff --git a/src/wx/check_box.h b/src/wx/check_box.h new file mode 100644 index 000000000..ff47bc524 --- /dev/null +++ b/src/wx/check_box.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#ifndef DCPOMATIC_CHECK_BOX_H +#define DCPOMATIC_CHECK_BOX_H + +#include "i18n_hook.h" +#include + +class CheckBox : public wxCheckBox, public I18NHook +{ +public: + CheckBox (wxWindow* parent, wxString label); + + void set_text (wxString text); + wxString get_text () const; +}; + +#endif diff --git a/src/wx/colour_conversion_editor.cc b/src/wx/colour_conversion_editor.cc index 3a1ffe0bf..3c59dbeed 100644 --- a/src/wx/colour_conversion_editor.cc +++ b/src/wx/colour_conversion_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -19,7 +19,9 @@ */ #include "wx_util.h" +#include "static_text.h" #include "colour_conversion_editor.h" +#include "check_box.h" #include "lib/colour_conversion.h" #include #include @@ -161,7 +163,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv) wxFlexGridSizer* rgb_to_xyz_sizer = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { - _rgb_to_xyz[i][j] = new wxStaticText (this, wxID_ANY, wxT (""), wxDefaultPosition, size, 0); + _rgb_to_xyz[i][j] = new StaticText (this, wxT (""), wxDefaultPosition, size, 0); rgb_to_xyz_sizer->Add (_rgb_to_xyz[i][j]); } } @@ -174,7 +176,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv) subhead (table, this, _("White point adjustment"), r); - _adjust_white = new wxCheckBox (this, wxID_ANY, _("Adjust white point to")); + _adjust_white = new CheckBox (this, _("Adjust white point to")); table->Add (_adjust_white, wxGBPosition (r, 0)); _adjusted_white_x = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, size, 0, validator); table->Add (_adjusted_white_x, wxGBPosition (r, 1)); @@ -191,7 +193,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv) wxFlexGridSizer* bradford_sizer = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { - _bradford[i][j] = new wxStaticText (this, wxID_ANY, wxT (""), wxDefaultPosition, size, 0); + _bradford[i][j] = new StaticText (this, wxT (""), wxDefaultPosition, size, 0); bradford_sizer->Add (_bradford[i][j]); } } @@ -202,7 +204,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv) subhead (table, this, _("Output gamma correction"), r); - _output = new wxCheckBox (this, wxID_ANY, _("Inverse 2.6 gamma correction on output")); + _output = new CheckBox (this, _("Inverse 2.6 gamma correction on output")); table->Add (_output, wxGBPosition (r, 0), wxGBSpan (1, 2)); _input_gamma->SetRange (0.1, 4.0); @@ -236,7 +238,7 @@ ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv) wxStaticText * ColourConversionEditor::subhead (wxGridBagSizer* sizer, wxWindow* parent, wxString text, int& row) const { - wxStaticText* m = new wxStaticText (parent, wxID_ANY, text); + wxStaticText* m = new StaticText (parent, text); wxFont font (*wxNORMAL_FONT); font.SetWeight (wxFONTWEIGHT_BOLD); m->SetFont (font); diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 34bdee8b3..1066a88b0 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -19,6 +19,8 @@ */ #include "config_dialog.h" +#include "static_text.h" +#include "check_box.h" #include "nag_dialog.h" using std::string; @@ -112,7 +114,7 @@ GeneralPage::GeneralPage (wxSize panel_size, int border) void GeneralPage::add_language_controls (wxGridBagSizer* table, int& r) { - _set_language = new wxCheckBox (_panel, wxID_ANY, _("Set language")); + _set_language = new CheckBox (_panel, _("Set language")); table->Add (_set_language, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); _language = new wxChoice (_panel, wxID_ANY); vector > languages; @@ -152,7 +154,7 @@ GeneralPage::add_language_controls (wxGridBagSizer* table, int& r) void GeneralPage::add_play_sound_controls (wxGridBagSizer* table, int& r) { - _sound = new wxCheckBox (_panel, wxID_ANY, _("Play sound via")); + _sound = new CheckBox (_panel, _("Play sound via")); table->Add (_sound, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); _sound_output = new wxChoice (_panel, wxID_ANY); table->Add (_sound_output, wxGBPosition (r, 1)); @@ -173,11 +175,11 @@ GeneralPage::add_play_sound_controls (wxGridBagSizer* table, int& r) void GeneralPage::add_update_controls (wxGridBagSizer* table, int& r) { - _check_for_updates = new wxCheckBox (_panel, wxID_ANY, _("Check for updates on startup")); + _check_for_updates = new CheckBox (_panel, _("Check for updates on startup")); table->Add (_check_for_updates, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; - _check_for_test_updates = new wxCheckBox (_panel, wxID_ANY, _("Check for testing updates on startup")); + _check_for_test_updates = new CheckBox (_panel, _("Check for testing updates on startup")); table->Add (_check_for_test_updates, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; @@ -342,7 +344,7 @@ CertificateChainEditor::CertificateChainEditor ( _sizer = new wxBoxSizer (wxVERTICAL); { - wxStaticText* m = new wxStaticText (this, wxID_ANY, title); + wxStaticText* m = new StaticText (this, title); m->SetFont (subheading_font); _sizer->Add (m, 0, wxALL, border); } @@ -391,7 +393,7 @@ CertificateChainEditor::CertificateChainEditor ( int r = 0; add_label_to_sizer (table, this, _("Leaf private key"), true, wxGBPosition (r, 0)); - _private_key = new wxStaticText (this, wxID_ANY, wxT ("")); + _private_key = new StaticText (this, wxT("")); wxFont font = _private_key->GetFont (); font.SetFamily (wxFONTFAMILY_TELETYPE); _private_key->SetFont (font); @@ -408,7 +410,7 @@ CertificateChainEditor::CertificateChainEditor ( table->Add (_button_sizer, wxGBPosition (r, 0), wxGBSpan (1, 4)); ++r; - _private_key_bad = new wxStaticText (this, wxID_ANY, _("Leaf private key does not match leaf certificate!")); + _private_key_bad = new StaticText (this, _("Leaf private key does not match leaf certificate!")); font = *wxSMALL_FONT; font.SetWeight (wxFONTWEIGHT_BOLD); _private_key_bad->SetFont (font); @@ -727,7 +729,7 @@ KeysPage::setup () wxSizer* sizer = _panel->GetSizer(); { - wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Decrypting KDMs")); + wxStaticText* m = new StaticText (_panel, _("Decrypting KDMs")); m->SetFont (subheading_font); sizer->Add (m, 0, wxALL, _border); } @@ -750,7 +752,7 @@ KeysPage::setup () decryption_advanced->Bind (wxEVT_BUTTON, bind (&KeysPage::decryption_advanced, this)); { - wxStaticText* m = new wxStaticText (_panel, wxID_ANY, _("Signing DCPs and KDMs")); + wxStaticText* m = new StaticText (_panel, _("Signing DCPs and KDMs")); m->SetFont (subheading_font); sizer->Add (m, 0, wxALL, _border); } diff --git a/src/wx/config_move_dialog.cc b/src/wx/config_move_dialog.cc index ec677f6af..baf55f18a 100644 --- a/src/wx/config_move_dialog.cc +++ b/src/wx/config_move_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017 Carl Hetherington + Copyright (C) 2017-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "config_move_dialog.h" #include "wx_util.h" +#include "static_text.h" #include ConfigMoveDialog::ConfigMoveDialog (wxWindow* parent, boost::filesystem::path new_file) @@ -35,7 +36,7 @@ ConfigMoveDialog::ConfigMoveDialog (wxWindow* parent, boost::filesystem::path ne std_to_wx(new_file.string()).data() ); - _sizer->Add (new wxStaticText (this, wxID_ANY, message), 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); + _sizer->Add (new StaticText (this, message), 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); layout (); } diff --git a/src/wx/confirm_kdm_email_dialog.cc b/src/wx/confirm_kdm_email_dialog.cc index 4815f26db..eca34b5cf 100644 --- a/src/wx/confirm_kdm_email_dialog.cc +++ b/src/wx/confirm_kdm_email_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,8 @@ #include "confirm_kdm_email_dialog.h" #include "wx_util.h" +#include "static_text.h" +#include "check_box.h" #include "lib/config.h" #include "lib/cinema_kdms.h" #include @@ -35,9 +37,9 @@ ConfirmKDMEmailDialog::ConfirmKDMEmailDialog (wxWindow* parent, list ema message += "\t" + std_to_wx (i) + "\n"; } - _sizer->Add (new wxStaticText (this, wxID_ANY, message), 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); + _sizer->Add (new StaticText (this, message), 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - wxCheckBox* shut_up = new wxCheckBox (this, wxID_ANY, _("Don't ask this again")); + wxCheckBox* shut_up = new CheckBox (this, _("Don't ask this again")); _sizer->Add (shut_up, 0, wxALL, DCPOMATIC_DIALOG_BORDER); shut_up->Bind (wxEVT_CHECKBOX, bind (&ConfirmKDMEmailDialog::shut_up, this, _1)); diff --git a/src/wx/content_colour_conversion_dialog.cc b/src/wx/content_colour_conversion_dialog.cc index 100d766f2..351d5aa65 100644 --- a/src/wx/content_colour_conversion_dialog.cc +++ b/src/wx/content_colour_conversion_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington + Copyright (C) 2013-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -18,12 +18,13 @@ */ -#include "lib/colour_conversion.h" -#include "lib/config.h" -#include "lib/util.h" #include "wx_util.h" +#include "check_box.h" #include "content_colour_conversion_dialog.h" #include "colour_conversion_editor.h" +#include "lib/colour_conversion.h" +#include "lib/config.h" +#include "lib/util.h" #include #include #include @@ -42,7 +43,7 @@ ContentColourConversionDialog::ContentColourConversionDialog (wxWindow* parent, SetSizer (overall_sizer); wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_Y_GAP - 2, DCPOMATIC_SIZER_X_GAP); - _preset_check = new wxCheckBox (this, wxID_ANY, _("Use preset")); + _preset_check = new CheckBox (this, _("Use preset")); table->Add (_preset_check, 0, wxALIGN_CENTER_VERTICAL); _preset_choice = new wxChoice (this, wxID_ANY); table->Add (_preset_choice); diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc index 2f4e1a48b..efc0e6ef1 100644 --- a/src/wx/content_properties_dialog.cc +++ b/src/wx/content_properties_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington + Copyright (C) 2015-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "content_properties_dialog.h" #include "wx_util.h" +#include "static_text.h" #include "lib/content.h" #include "lib/video_content.h" #include "lib/audio_content.h" @@ -80,7 +81,7 @@ ContentPropertiesDialog::maybe_add_group (mapSetFont (font); @@ -92,6 +93,6 @@ ContentPropertiesDialog::maybe_add_group (mapsecond) { add (std_to_wx (j.key), true); - add (new wxStaticText (this, wxID_ANY, std_to_wx (j.value + " " + j.unit))); + add (new StaticText (this, std_to_wx (j.value + " " + j.unit))); } } diff --git a/src/wx/controls.cc b/src/wx/controls.cc index dd47aa184..08d3a9460 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -24,6 +24,8 @@ #include "playhead_to_timecode_dialog.h" #include "playhead_to_frame_dialog.h" #include "content_view.h" +#include "static_text.h" +#include "check_box.h" #include "lib/job_manager.h" #include "lib/player_video.h" #include "lib/dcp_content.h" @@ -62,22 +64,22 @@ Controls::Controls (wxWindow* parent, shared_ptr viewer, bool editor , _rewind_button (new wxButton (this, wxID_ANY, wxT("|<"))) , _back_button (new wxButton (this, wxID_ANY, wxT("<"))) , _forward_button (new wxButton (this, wxID_ANY, wxT(">"))) - , _frame_number (new wxStaticText (this, wxID_ANY, wxT(""))) - , _timecode (new wxStaticText (this, wxID_ANY, wxT(""))) + , _frame_number (new StaticText (this, wxT(""))) + , _timecode (new StaticText (this, wxT(""))) { _v_sizer = new wxBoxSizer (wxVERTICAL); SetSizer (_v_sizer); wxBoxSizer* view_options = new wxBoxSizer (wxHORIZONTAL); if (editor_controls) { - _outline_content = new wxCheckBox (this, wxID_ANY, _("Outline content")); + _outline_content = new CheckBox (this, _("Outline content")); view_options->Add (_outline_content, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); _eye = new wxChoice (this, wxID_ANY); _eye->Append (_("Left")); _eye->Append (_("Right")); _eye->SetSelection (0); view_options->Add (_eye, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); - _jump_to_selected = new wxCheckBox (this, wxID_ANY, _("Jump to selected content")); + _jump_to_selected = new CheckBox (this, _("Jump to selected content")); view_options->Add (_jump_to_selected, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); } diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 2ace72190..ded073152 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -24,6 +24,9 @@ #include "isdcf_metadata_dialog.h" #include "audio_dialog.h" #include "focus_manager.h" +#include "check_box.h" +#include "static_text.h" +#include "check_box.h" #include "lib/ratio.h" #include "lib/config.h" #include "lib/dcp_content_type.h" @@ -72,30 +75,30 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr film) _name = new wxTextCtrl (_panel, wxID_ANY); FocusManager::instance()->add(_name); - _use_isdcf_name = new wxCheckBox (_panel, wxID_ANY, _("Use ISDCF name")); + _use_isdcf_name = new CheckBox (_panel, _("Use ISDCF name")); _edit_isdcf_button = new wxButton (_panel, wxID_ANY, _("Details...")); _copy_isdcf_name_button = new wxButton (_panel, wxID_ANY, _("Copy as name")); /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see http://trac.wxwidgets.org/ticket/12539 */ - _dcp_name = new wxStaticText ( - _panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, + _dcp_name = new StaticText ( + _panel, wxT (""), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE ); _dcp_content_type_label = create_label (_panel, _("Content Type"), true); _dcp_content_type = new wxChoice (_panel, wxID_ANY); - _signed = new wxCheckBox (_panel, wxID_ANY, _("Signed")); - _encrypted = new wxCheckBox (_panel, wxID_ANY, _("Encrypted")); + _signed = new CheckBox (_panel, _("Signed")); + _encrypted = new CheckBox (_panel, _("Encrypted")); wxClientDC dc (_panel); wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG...")); size.SetHeight (-1); _key_label = create_label (_panel, _("Key"), true); - _key = new wxStaticText (_panel, wxID_ANY, "", wxDefaultPosition, size); + _key = new StaticText (_panel, "", wxDefaultPosition, size); _edit_key = new wxButton (_panel, wxID_ANY, _("Edit...")); _reels_label = create_label (_panel, _("Reels"), true); @@ -108,7 +111,7 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr film) _standard_label = create_label (_panel, _("Standard"), true); _standard = new wxChoice (_panel, wxID_ANY); - _upload_after_make_dcp = new wxCheckBox (_panel, wxID_ANY, _("Upload DCP to TMS after it is made")); + _upload_after_make_dcp = new CheckBox (_panel, _("Upload DCP to TMS after it is made")); _notebook = new wxNotebook (_panel, wxID_ANY); _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6); @@ -733,7 +736,7 @@ DCPPanel::make_video_panel () _container_label = create_label (panel, _("Container"), true); _container = new wxChoice (panel, wxID_ANY); - _container_size = new wxStaticText (panel, wxID_ANY, wxT ("")); + _container_size = new StaticText (panel, wxT ("")); _resolution_label = create_label (panel, _("Resolution"), true); _resolution = new wxChoice (panel, wxID_ANY); @@ -748,13 +751,13 @@ DCPPanel::make_video_panel () _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best")); _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL); - _three_d = new wxCheckBox (panel, wxID_ANY, _("3D")); + _three_d = new CheckBox (panel, _("3D")); _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true); _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY); _mbits_label = create_label (panel, _("Mbit/s"), false); - _reencode_j2k = new wxCheckBox (panel, wxID_ANY, _("Re-encode JPEG2000 data from input")); + _reencode_j2k = new CheckBox (panel, _("Re-encode JPEG2000 data from input")); _container->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::container_changed, this)); _frame_rate_choice->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::frame_rate_choice_changed, this)); diff --git a/src/wx/dir_picker_ctrl.cc b/src/wx/dir_picker_ctrl.cc index 2330e584a..ffd3b6fa1 100644 --- a/src/wx/dir_picker_ctrl.cc +++ b/src/wx/dir_picker_ctrl.cc @@ -18,12 +18,13 @@ */ +#include "dir_picker_ctrl.h" +#include "wx_util.h" +#include "static_text.h" #include #include #include #include -#include "dir_picker_ctrl.h" -#include "wx_util.h" using namespace std; using namespace boost; @@ -33,7 +34,7 @@ DirPickerCtrl::DirPickerCtrl (wxWindow* parent) { _sizer = new wxBoxSizer (wxHORIZONTAL); - _folder = new wxStaticText (this, wxID_ANY, wxT ("")); + _folder = new StaticText (this, wxT("")); _sizer->Add (_folder, 1, wxEXPAND | wxALL, 6); _browse = new wxButton (this, wxID_ANY, _("Browse...")); _sizer->Add (_browse, 0); diff --git a/src/wx/download_certificate_dialog.cc b/src/wx/download_certificate_dialog.cc index a12097001..21a675ac7 100644 --- a/src/wx/download_certificate_dialog.cc +++ b/src/wx/download_certificate_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington + Copyright (C) 2014-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -23,6 +23,7 @@ #include "christie_certificate_panel.h" #include "gdc_certificate_panel.h" #include "download_certificate_dialog.h" +#include "static_text.h" #include "wx_util.h" using boost::optional; @@ -38,7 +39,7 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent) _download = new wxButton (this, wxID_ANY, _("Download")); sizer->Add (_download, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); - _message = new wxStaticText (this, wxID_ANY, wxT ("")); + _message = new StaticText (this, wxT ("")); sizer->Add (_message, 0, wxALL, DCPOMATIC_SIZER_GAP); wxFont font = _message->GetFont(); font.SetStyle (wxFONTSTYLE_ITALIC); diff --git a/src/wx/export_dialog.cc b/src/wx/export_dialog.cc index 3c08da1b7..68d3706ff 100644 --- a/src/wx/export_dialog.cc +++ b/src/wx/export_dialog.cc @@ -21,6 +21,7 @@ #include "export_dialog.h" #include "file_picker_ctrl.h" #include "wx_util.h" +#include "check_box.h" #include #include @@ -55,10 +56,10 @@ ExportDialog::ExportDialog (wxWindow* parent) _format = new wxChoice (this, wxID_ANY); add (_format); add_spacer (); - _mixdown = new wxCheckBox (this, wxID_ANY, _("Mix audio down to stereo")); + _mixdown = new CheckBox (this, _("Mix audio down to stereo")); add (_mixdown, false); add_spacer (); - _split_reels = new wxCheckBox (this, wxID_ANY, _("Write reels into separate files")); + _split_reels = new CheckBox (this, _("Write reels into separate files")); add (_split_reels, false); _x264_crf_label[0] = add (_("Quality"), true); _x264_crf = new wxSlider (this, wxID_ANY, 23, 0, 51, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS); diff --git a/src/wx/film_name_location_dialog.cc b/src/wx/film_name_location_dialog.cc index d91171acb..0cc406d02 100644 --- a/src/wx/film_name_location_dialog.cc +++ b/src/wx/film_name_location_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2017 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "wx_util.h" #include "film_name_location_dialog.h" +#include "check_box.h" #ifdef DCPOMATIC_USE_OWN_PICKER #include "dir_picker_ctrl.h" #endif @@ -56,7 +57,7 @@ FilmNameLocationDialog::FilmNameLocationDialog (wxWindow* parent, wxString title add (_folder); if (offer_templates) { - _use_template = new wxCheckBox (this, wxID_ANY, _("From template")); + _use_template = new CheckBox (this, _("From template")); add (_use_template); _template_name = new wxChoice (this, wxID_ANY); add (_template_name); diff --git a/src/wx/filter_editor.cc b/src/wx/filter_editor.cc index d70402b5f..32faee35d 100644 --- a/src/wx/filter_editor.cc +++ b/src/wx/filter_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -22,11 +22,13 @@ * @brief A panel to select FFmpeg filters. */ -#include -#include -#include "lib/filter.h" #include "filter_editor.h" #include "wx_util.h" +#include "static_text.h" +#include "check_box.h" +#include "lib/filter.h" +#include +#include using namespace std; @@ -54,14 +56,14 @@ FilterEditor::FilterEditor (wxWindow* parent, vector const & act for (CategoryMap::iterator i = categories.begin(); i != categories.end(); ++i) { - wxStaticText* c = new wxStaticText (this, wxID_ANY, std_to_wx (i->first)); + wxStaticText* c = new StaticText (this, std_to_wx(i->first)); wxFont font = c->GetFont(); font.SetWeight(wxFONTWEIGHT_BOLD); c->SetFont(font); sizer->Add (c); for (list::iterator j = i->second.begin(); j != i->second.end(); ++j) { - wxCheckBox* b = new wxCheckBox (this, wxID_ANY, std_to_wx ((*j)->name ())); + wxCheckBox* b = new CheckBox (this, std_to_wx ((*j)->name ())); bool const a = find (active.begin(), active.end(), *j) != active.end (); b->SetValue (a); _filters[*j] = b; diff --git a/src/wx/font_files_dialog.cc b/src/wx/font_files_dialog.cc index 0c64492d5..7fd4f9d99 100644 --- a/src/wx/font_files_dialog.cc +++ b/src/wx/font_files_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington + Copyright (C) 2015-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "font_files_dialog.h" #include "system_font_dialog.h" +#include "static_text.h" using boost::bind; @@ -41,8 +42,8 @@ FontFilesDialog::FontFilesDialog (wxWindow* parent, FontFiles files) for (int i = 0; i < FontFiles::VARIANTS; ++i) { add (labels[i], true); - _name[i] = new wxStaticText ( - this, wxID_ANY, + _name[i] = new StaticText ( + this, std_to_wx(_files.get(static_cast(i)).get_value_or("").string()), wxDefaultPosition, wxSize (200, -1) diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 96a4c86e9..8e176b4d6 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -36,6 +36,8 @@ #include "nag_dialog.h" #include "config_move_dialog.h" #include "config_dialog.h" +#include "static_text.h" +#include "check_box.h" #include "lib/config.h" #include "lib/ratio.h" #include "lib/filter.h" @@ -115,12 +117,12 @@ private: add_play_sound_controls (table, r); #ifdef DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG - _analyse_ebur128 = new wxCheckBox (_panel, wxID_ANY, _("Find integrated loudness, true peak and loudness range when analysing audio")); + _analyse_ebur128 = new CheckBox (_panel, _("Find integrated loudness, true peak and loudness range when analysing audio")); table->Add (_analyse_ebur128, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; #endif - _automatic_audio_analysis = new wxCheckBox (_panel, wxID_ANY, _("Automatically analyse content audio")); + _automatic_audio_analysis = new CheckBox (_panel, _("Automatically analyse content audio")); table->Add (_automatic_audio_analysis, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; @@ -381,7 +383,7 @@ private: table->Add (_kdm_directory, 1, wxEXPAND); - _upload_after_make_dcp = new wxCheckBox (_panel, wxID_ANY, _("Default to enabling upload of DCP to TMS")); + _upload_after_make_dcp = new CheckBox (_panel, _("Default to enabling upload of DCP to TMS")); table->Add (_upload_after_make_dcp, 1, wxEXPAND); _still_length->SetRange (1, 3600); @@ -585,7 +587,7 @@ public: private: void setup () { - _use_any_servers = new wxCheckBox (_panel, wxID_ANY, _("Search network for servers")); + _use_any_servers = new CheckBox (_panel, _("Search network for servers")); _panel->GetSizer()->Add (_use_any_servers, 0, wxALL, _border); vector columns; @@ -1073,11 +1075,11 @@ private: table->AddGrowableCol (1, 1); _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border); - _enable_message_box = new wxCheckBox (_panel, wxID_ANY, _("Message box")); + _enable_message_box = new CheckBox (_panel, _("Message box")); table->Add (_enable_message_box, 1, wxEXPAND | wxALL); table->AddSpacer (0); - _enable_email = new wxCheckBox (_panel, wxID_ANY, _("Email")); + _enable_email = new CheckBox (_panel, _("Email")); table->Add (_enable_email, 1, wxEXPAND | wxALL); table->AddSpacer (0); @@ -1306,7 +1308,7 @@ private: flags |= wxALIGN_RIGHT; text += wxT (":"); #endif - wxStaticText* m = new wxStaticText (parent, wxID_ANY, text); + wxStaticText* m = new StaticText (parent, text); table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP); } @@ -1325,11 +1327,11 @@ private: table->Add (s, 1); } - _allow_any_dcp_frame_rate = new wxCheckBox (_panel, wxID_ANY, _("Allow any DCP frame rate")); + _allow_any_dcp_frame_rate = new CheckBox (_panel, _("Allow any DCP frame rate")); table->Add (_allow_any_dcp_frame_rate, 1, wxEXPAND | wxALL); table->AddSpacer (0); - _allow_any_container = new wxCheckBox (_panel, wxID_ANY, _("Allow non-standard container ratios")); + _allow_any_container = new CheckBox (_panel, _("Allow non-standard container ratios")); table->Add (_allow_any_container, 1, wxEXPAND | wxALL); table->AddSpacer (0); @@ -1340,7 +1342,7 @@ private: restart->SetFont (font); table->AddSpacer (0); - _only_servers_encode = new wxCheckBox (_panel, wxID_ANY, _("Only servers encode")); + _only_servers_encode = new CheckBox (_panel, _("Only servers encode")); table->Add (_only_servers_encode, 1, wxEXPAND | wxALL); table->AddSpacer (0); @@ -1385,26 +1387,26 @@ private: { add_top_aligned_label_to_sizer (table, _panel, _("Log")); wxBoxSizer* t = new wxBoxSizer (wxVERTICAL); - _log_general = new wxCheckBox (_panel, wxID_ANY, _("General")); + _log_general = new CheckBox (_panel, _("General")); t->Add (_log_general, 1, wxEXPAND | wxALL); - _log_warning = new wxCheckBox (_panel, wxID_ANY, _("Warnings")); + _log_warning = new CheckBox (_panel, _("Warnings")); t->Add (_log_warning, 1, wxEXPAND | wxALL); - _log_error = new wxCheckBox (_panel, wxID_ANY, _("Errors")); + _log_error = new CheckBox (_panel, _("Errors")); t->Add (_log_error, 1, wxEXPAND | wxALL); /// TRANSLATORS: translate the word "Timing" here; do not include the "Config|" prefix - _log_timing = new wxCheckBox (_panel, wxID_ANY, S_("Config|Timing")); + _log_timing = new CheckBox (_panel, S_("Config|Timing")); t->Add (_log_timing, 1, wxEXPAND | wxALL); - _log_debug_decode = new wxCheckBox (_panel, wxID_ANY, _("Debug: decode")); + _log_debug_decode = new CheckBox (_panel, _("Debug: decode")); t->Add (_log_debug_decode, 1, wxEXPAND | wxALL); - _log_debug_encode = new wxCheckBox (_panel, wxID_ANY, _("Debug: encode")); + _log_debug_encode = new CheckBox (_panel, _("Debug: encode")); t->Add (_log_debug_encode, 1, wxEXPAND | wxALL); - _log_debug_email = new wxCheckBox (_panel, wxID_ANY, _("Debug: email sending")); + _log_debug_email = new CheckBox (_panel, _("Debug: email sending")); t->Add (_log_debug_email, 1, wxEXPAND | wxALL); table->Add (t, 0, wxALL, 6); } #ifdef DCPOMATIC_WINDOWS - _win32_console = new wxCheckBox (_panel, wxID_ANY, _("Open console window")); + _win32_console = new CheckBox (_panel, _("Open console window")); table->Add (_win32_console, 1, wxEXPAND | wxALL); table->AddSpacer (0); #endif diff --git a/src/wx/hints_dialog.cc b/src/wx/hints_dialog.cc index cbd48ec36..099b31327 100644 --- a/src/wx/hints_dialog.cc +++ b/src/wx/hints_dialog.cc @@ -20,6 +20,8 @@ #include "hints_dialog.h" #include "wx_util.h" +#include "static_text.h" +#include "check_box.h" #include "lib/film.h" #include "lib/hints.h" #include "lib/config.h" @@ -44,14 +46,14 @@ HintsDialog::HintsDialog (wxWindow* parent, boost::weak_ptr film, bool ok) _gauge = new wxGauge (this, wxID_ANY, 100); sizer->Add (_gauge, 0, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP); - _gauge_message = new wxStaticText (this, wxID_ANY, wxT("")); + _gauge_message = new StaticText (this, wxT("")); sizer->Add (_gauge_message, 0, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP); _text = new wxRichTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (400, 300), wxRE_READONLY); sizer->Add (_text, 1, wxEXPAND | wxALL, 6); if (!ok) { - wxCheckBox* b = new wxCheckBox (this, wxID_ANY, _("Don't show hints again")); + wxCheckBox* b = new CheckBox (this, _("Don't show hints again")); sizer->Add (b, 0, wxALL, 6); b->Bind (wxEVT_CHECKBOX, bind (&HintsDialog::shut_up, this, _1)); } diff --git a/src/wx/i18n_hook.cc b/src/wx/i18n_hook.cc new file mode 100644 index 000000000..bb185526e --- /dev/null +++ b/src/wx/i18n_hook.cc @@ -0,0 +1,56 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#include "i18n_hook.h" +#include "instant_i18n_dialog.h" +#include "wx_util.h" +#include "lib/cross.h" +#include +#include +#include + +I18NHook::I18NHook (wxWindow* window) + : _window (window) +{ + _window->Bind (wxEVT_MIDDLE_DOWN, bind(&I18NHook::handle, this, _1)); +} + +void +I18NHook::handle (wxMouseEvent& ev) +{ + wxString const original = get_text (); + + InstantI18NDialog* d = new InstantI18NDialog (_window, get_text()); + d->ShowModal(); + set_text (d->get()); + _window->GetContainingSizer()->Layout(); + ev.Skip (); + + boost::filesystem::path file = "instant_i18n"; + + FILE* f = fopen_boost (file, "a"); + if (!f) { + error_dialog (_window, wxString::Format(_("Could not open translation file %s"), std_to_wx(file.string()).data())); + return; + } + fprintf (f, "%s\n", wx_to_std(original).c_str()); + fprintf (f, "%s\n", wx_to_std(get_text()).c_str()); + fclose (f); +} diff --git a/src/wx/i18n_hook.h b/src/wx/i18n_hook.h new file mode 100644 index 000000000..9462e3f7f --- /dev/null +++ b/src/wx/i18n_hook.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#ifndef DCPOMATIC_I18N_HOOK_H +#define DCPOMATIC_I18N_HOOK_H + +#include + +class I18NHook +{ +public: + I18NHook (wxWindow* window); + + virtual void set_text (wxString text) = 0; + virtual wxString get_text () const = 0; + +private: + void handle (wxMouseEvent &); + + wxWindow* _window; +}; + +#endif diff --git a/src/wx/initial_setup_dialog.cc b/src/wx/initial_setup_dialog.cc index ac6f918a0..0d04c5002 100644 --- a/src/wx/initial_setup_dialog.cc +++ b/src/wx/initial_setup_dialog.cc @@ -19,6 +19,7 @@ */ #include "initial_setup_dialog.h" +#include "static_text.h" #include "lib/config.h" #include @@ -26,7 +27,7 @@ InitialSetupDialog::InitialSetupDialog () : wxDialog (0, wxID_ANY, _("DCP-o-matic setup")) { wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); - wxStaticText* text1 = new wxStaticText (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(600, -1)); + wxStaticText* text1 = new StaticText (this, wxEmptyString, wxDefaultPosition, wxSize(600, -1)); sizer->Add (text1, 1, wxEXPAND | wxALL, 12); text1->SetLabelMarkup ( @@ -55,7 +56,7 @@ InitialSetupDialog::InitialSetupDialog () _full->SetValue (true); } - wxStaticText* text2 = new wxStaticText (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(400, -1)); + wxStaticText* text2 = new StaticText (this, wxEmptyString, wxDefaultPosition, wxSize(400, -1)); sizer->Add (text2, 0, wxEXPAND | wxALL, 12); text2->SetLabelMarkup (_("\nYou can change the mode at any time from the General page of Preferences.")); diff --git a/src/wx/instant_i18n_dialog.cc b/src/wx/instant_i18n_dialog.cc new file mode 100644 index 000000000..e86e48ced --- /dev/null +++ b/src/wx/instant_i18n_dialog.cc @@ -0,0 +1,50 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#include "instant_i18n_dialog.h" +#include "wx_util.h" +#include + +using boost::bind; + +InstantI18NDialog::InstantI18NDialog (wxWindow* parent, wxString text) + : wxDialog (parent, wxID_ANY, _("Translate")) +{ + wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); + + _text = new wxTextCtrl (this, wxID_ANY, text, wxDefaultPosition, wxSize(200, -1), wxTE_PROCESS_ENTER); + + _text->Bind (wxEVT_TEXT_ENTER, bind(&InstantI18NDialog::close, this)); + + overall_sizer->Add (_text, 0, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); + SetSizerAndFit (overall_sizer); +} + +wxString +InstantI18NDialog::get () const +{ + return _text->GetValue (); +} + +void +InstantI18NDialog::close () +{ + Close (); +} diff --git a/src/wx/instant_i18n_dialog.h b/src/wx/instant_i18n_dialog.h new file mode 100644 index 000000000..f9fe96d6a --- /dev/null +++ b/src/wx/instant_i18n_dialog.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#include + +class InstantI18NDialog : public wxDialog +{ +public: + InstantI18NDialog (wxWindow* parent, wxString text); + + wxString get () const; + +private: + void close (); + + wxTextCtrl* _text; +}; diff --git a/src/wx/isdcf_metadata_dialog.cc b/src/wx/isdcf_metadata_dialog.cc index ee7d4ae70..297f54fa1 100644 --- a/src/wx/isdcf_metadata_dialog.cc +++ b/src/wx/isdcf_metadata_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "isdcf_metadata_dialog.h" #include "wx_util.h" +#include "check_box.h" #include "lib/film.h" #include #include @@ -55,19 +56,19 @@ ISDCFMetadataDialog::ISDCFMetadataDialog (wxWindow* parent, ISDCFMetadata dm, bo add (_("Facility (e.g. DLA)"), true); _facility = add (new wxTextCtrl (this, wxID_ANY)); - _temp_version = add (new wxCheckBox (this, wxID_ANY, _("Temp version"))); + _temp_version = add (new CheckBox(this, _("Temp version"))); add_spacer (); - _pre_release = add (new wxCheckBox (this, wxID_ANY, _("Pre-release"))); + _pre_release = add (new CheckBox(this, _("Pre-release"))); add_spacer (); - _red_band = add (new wxCheckBox (this, wxID_ANY, _("Red band"))); + _red_band = add (new CheckBox(this, _("Red band"))); add_spacer (); add (_("Chain"), true); _chain = add (new wxTextCtrl (this, wxID_ANY)); - _two_d_version_of_three_d = add (new wxCheckBox (this, wxID_ANY, _("2D version of content available in 3D"))); + _two_d_version_of_three_d = add (new CheckBox(this, _("2D version of content available in 3D"))); add_spacer (); if (threed) { diff --git a/src/wx/job_view.cc b/src/wx/job_view.cc index 5d3cc0f9c..28b171b82 100644 --- a/src/wx/job_view.cc +++ b/src/wx/job_view.cc @@ -21,6 +21,8 @@ #include "job_view.h" #include "wx_util.h" #include "message_dialog.h" +#include "static_text.h" +#include "check_box.h" #include "lib/job.h" #include "lib/job_manager.h" #include "lib/compose.hpp" @@ -56,7 +58,7 @@ JobView::setup () /* This seems to be required to allow the gauge to shrink under OS X */ _gauge->SetMinSize (wxSize (0, -1)); _gauge_message->Add (_gauge, 0, wxEXPAND | wxLEFT | wxRIGHT); - _message = new wxStaticText (_container, wxID_ANY, wxT (" \n "), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_MIDDLE); + _message = new StaticText (_container, wxT(" \n "), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_MIDDLE); _gauge_message->Add (_message, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6); _table->Insert (n, _gauge_message, 1, wxEXPAND | wxLEFT | wxRIGHT); ++n; @@ -76,7 +78,7 @@ JobView::setup () _controls = new wxBoxSizer (wxVERTICAL); _controls->Add (_buttons); - _notify = new wxCheckBox (_container, wxID_ANY, _("Notify when complete")); + _notify = new CheckBox (_container, _("Notify when complete")); _notify->Bind (wxEVT_CHECKBOX, bind (&JobView::notify_clicked, this)); _notify->SetValue (Config::instance()->default_notify()); _controls->Add (_notify); diff --git a/src/wx/kdm_advanced_dialog.cc b/src/wx/kdm_advanced_dialog.cc index 9c35f506a..2027c0639 100644 --- a/src/wx/kdm_advanced_dialog.cc +++ b/src/wx/kdm_advanced_dialog.cc @@ -19,15 +19,16 @@ */ #include "kdm_advanced_dialog.h" +#include "check_box.h" KDMAdvancedDialog::KDMAdvancedDialog (wxWindow* parent, bool forensic_mark_video, bool forensic_mark_audio) : TableDialog (parent, _("Advanced KDM options"), 2, 1, false) { - _forensic_mark_video = new wxCheckBox (this, wxID_ANY, _("Forensically mark video")); + _forensic_mark_video = new CheckBox (this, _("Forensically mark video")); _forensic_mark_video->SetValue (forensic_mark_video); add (_forensic_mark_video); add_spacer (); - _forensic_mark_audio = new wxCheckBox (this, wxID_ANY, _("Forensically mark audio")); + _forensic_mark_audio = new CheckBox (this, _("Forensically mark audio")); _forensic_mark_audio->SetValue (forensic_mark_audio); add (_forensic_mark_audio); add_spacer (); diff --git a/src/wx/kdm_cpl_panel.cc b/src/wx/kdm_cpl_panel.cc index e14511ad8..d710d88aa 100644 --- a/src/wx/kdm_cpl_panel.cc +++ b/src/wx/kdm_cpl_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington + Copyright (C) 2015-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "kdm_cpl_panel.h" #include "wx_util.h" +#include "static_text.h" #include using std::vector; @@ -42,13 +43,13 @@ KDMCPLPanel::KDMCPLPanel (wxWindow* parent, vector cpls) /* CPL details */ wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); add_label_to_sizer (table, this, _("DCP directory"), true); - _dcp_directory = new wxStaticText (this, wxID_ANY, ""); + _dcp_directory = new StaticText (this, ""); table->Add (_dcp_directory); add_label_to_sizer (table, this, _("CPL ID"), true); - _cpl_id = new wxStaticText (this, wxID_ANY, ""); + _cpl_id = new StaticText (this, ""); table->Add (_cpl_id); add_label_to_sizer (table, this, _("CPL annotation text"), true); - _cpl_annotation_text = new wxStaticText (this, wxID_ANY, ""); + _cpl_annotation_text = new StaticText (this, ""); table->Add (_cpl_annotation_text); vertical->Add (table, 0, wxEXPAND | wxTOP, DCPOMATIC_SIZER_GAP + 2); diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index abb28c228..f59250750 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -25,6 +25,7 @@ #include "kdm_output_panel.h" #include "kdm_cpl_panel.h" #include "confirm_kdm_email_dialog.h" +#include "static_text.h" #include "lib/film.h" #include "lib/screen.h" #include "lib/screen_kdm.h" @@ -68,7 +69,7 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) subheading_font.SetWeight (wxFONTWEIGHT_BOLD); /* Sub-heading: Screens */ - wxStaticText* h = new wxStaticText (this, wxID_ANY, _("Screens")); + wxStaticText* h = new StaticText (this, _("Screens")); h->SetFont (subheading_font); left->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM, DCPOMATIC_SIZER_Y_GAP); _screens = new ScreensPanel (this); @@ -76,21 +77,21 @@ KDMDialog::KDMDialog (wxWindow* parent, shared_ptr film) /* Sub-heading: Timing */ /// TRANSLATORS: translate the word "Timing" here; do not include the "KDM|" prefix - h = new wxStaticText (this, wxID_ANY, S_("KDM|Timing")); + h = new StaticText (this, S_("KDM|Timing")); h->SetFont (subheading_font); right->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2); _timing = new KDMTimingPanel (this); right->Add (_timing); /* Sub-heading: CPL */ - h = new wxStaticText (this, wxID_ANY, _("CPL")); + h = new StaticText (this, _("CPL")); h->SetFont (subheading_font); right->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2); _cpl = new KDMCPLPanel (this, film->cpls ()); right->Add (_cpl, 0, wxEXPAND); /* Sub-heading: Output */ - h = new wxStaticText (this, wxID_ANY, _("Output")); + h = new StaticText (this, _("Output")); h->SetFont (subheading_font); right->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); _output = new KDMOutputPanel (this, film->interop ()); diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index 694957ee8..1e222591d 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -28,6 +28,7 @@ #include "wx_util.h" #include "kdm_advanced_dialog.h" #include "name_format_editor.h" +#include "check_box.h" #include #include #ifdef DCPOMATIC_USE_OWN_PICKER @@ -89,7 +90,7 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop) _filename_format = new NameFormatEditor (this, Config::instance()->kdm_filename_format(), titles, ex, ".xml"); table->Add (_filename_format->panel(), 1, wxEXPAND); - _write_to = new wxCheckBox (this, wxID_ANY, _("Write to")); + _write_to = new CheckBox (this, _("Write to")); table->Add (_write_to, 1, wxEXPAND); #ifdef DCPOMATIC_USE_OWN_PICKER @@ -117,7 +118,7 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop) table->AddSpacer (0); table->Add (write_options); - _email = new wxCheckBox (this, wxID_ANY, _("Send by email")); + _email = new CheckBox (this, _("Send by email")); table->Add (_email, 1, wxEXPAND); table->AddSpacer (0); diff --git a/src/wx/kdm_timing_panel.cc b/src/wx/kdm_timing_panel.cc index 53f674e2e..bad900d27 100644 --- a/src/wx/kdm_timing_panel.cc +++ b/src/wx/kdm_timing_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015-2016 Carl Hetherington + Copyright (C) 2015-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -21,6 +21,7 @@ #include "kdm_timing_panel.h" #include "wx_util.h" #include "time_picker.h" +#include "static_text.h" #include #include @@ -61,7 +62,7 @@ KDMTimingPanel::KDMTimingPanel (wxWindow* parent) overall_sizer->Add (table); - _warning = new wxStaticText (this, wxID_ANY, wxT ("")); + _warning = new StaticText (this, wxT("")); overall_sizer->Add (_warning, 0, wxTOP, DCPOMATIC_SIZER_GAP); wxFont font = _warning->GetFont(); font.SetStyle(wxFONTSTYLE_ITALIC); diff --git a/src/wx/make_chain_dialog.cc b/src/wx/make_chain_dialog.cc index 74d2e24b5..e1ba112ce 100644 --- a/src/wx/make_chain_dialog.cc +++ b/src/wx/make_chain_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington + Copyright (C) 2014-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -19,6 +19,7 @@ */ #include "make_chain_dialog.h" +#include "static_text.h" #include using std::string; @@ -57,7 +58,7 @@ MakeChainDialog::MakeChainDialog ( { wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - s->Add (new wxStaticText (this, wxID_ANY, wxT (".")), 0, wxALIGN_CENTER_VERTICAL); + s->Add (new StaticText (this, wxT (".")), 0, wxALIGN_CENTER_VERTICAL); s->Add (_root_common_name = new wxTextCtrl ( this, wxID_ANY, std_to_wx (root_common_name), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL ); @@ -68,7 +69,7 @@ MakeChainDialog::MakeChainDialog ( { wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - s->Add (new wxStaticText (this, wxID_ANY, wxT (".")), 0, wxALIGN_CENTER_VERTICAL); + s->Add (new StaticText (this, wxT (".")), 0, wxALIGN_CENTER_VERTICAL); s->Add (_intermediate_common_name = new wxTextCtrl ( this, wxID_ANY, std_to_wx (intermediate_common_name), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL ); @@ -79,7 +80,7 @@ MakeChainDialog::MakeChainDialog ( { wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - s->Add (new wxStaticText (this, wxID_ANY, wxT ("CS.")), 0, wxALIGN_CENTER_VERTICAL); + s->Add (new StaticText (this, wxT ("CS.")), 0, wxALIGN_CENTER_VERTICAL); s->Add (_leaf_common_name = new wxTextCtrl ( this, wxID_ANY, std_to_wx (leaf_common_name), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL ); diff --git a/src/wx/message_dialog.cc b/src/wx/message_dialog.cc index b3cbb53fc..56258b1a0 100644 --- a/src/wx/message_dialog.cc +++ b/src/wx/message_dialog.cc @@ -20,12 +20,13 @@ #include "message_dialog.h" #include "wx_util.h" +#include "static_text.h" MessageDialog::MessageDialog (wxWindow* parent, wxString title, wxString message) : wxDialog (parent, wxID_ANY, title) { wxSizer* sizer = new wxBoxSizer (wxVERTICAL); - wxStaticText* text = new wxStaticText (this, wxID_ANY, message); + wxStaticText* text = new StaticText (this, message); sizer->Add (text, 1, wxALL, DCPOMATIC_DIALOG_BORDER); wxSizer* buttons = CreateSeparatedButtonSizer (wxCLOSE); if (buttons) { diff --git a/src/wx/nag_dialog.cc b/src/wx/nag_dialog.cc index b7efb43db..2226938f3 100644 --- a/src/wx/nag_dialog.cc +++ b/src/wx/nag_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017 Carl Hetherington + Copyright (C) 2017-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,8 @@ #include "nag_dialog.h" #include "wx_util.h" +#include "static_text.h" +#include "check_box.h" #include #include @@ -30,10 +32,10 @@ NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message, bool , _nag (nag) { wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); - _text = new wxStaticText (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (400, 300)); + _text = new StaticText (this, wxEmptyString, wxDefaultPosition, wxSize (400, 300)); sizer->Add (_text, 1, wxEXPAND | wxALL, 6); - wxCheckBox* b = new wxCheckBox (this, wxID_ANY, _("Don't show this message again")); + wxCheckBox* b = new CheckBox (this, _("Don't show this message again")); sizer->Add (b, 0, wxALL, 6); b->Bind (wxEVT_CHECKBOX, bind (&NagDialog::shut_up, this, _1)); diff --git a/src/wx/name_format_editor.cc b/src/wx/name_format_editor.cc index 82adc3f55..5755d75f4 100644 --- a/src/wx/name_format_editor.cc +++ b/src/wx/name_format_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016-2017 Carl Hetherington + Copyright (C) 2016-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,13 +20,14 @@ #include "name_format_editor.h" #include "wx_util.h" +#include "static_text.h" #include "lib/util.h" using std::string; NameFormatEditor::NameFormatEditor (wxWindow* parent, dcp::NameFormat name, dcp::NameFormat::Map titles, dcp::NameFormat::Map examples, string suffix) : _panel (new wxPanel (parent)) - , _example (new wxStaticText (_panel, wxID_ANY, "")) + , _example (new StaticText (_panel, "")) , _sizer (new wxBoxSizer (wxVERTICAL)) , _specification (new wxTextCtrl (_panel, wxID_ANY, "")) , _name (name) @@ -40,7 +41,7 @@ NameFormatEditor::NameFormatEditor (wxWindow* parent, dcp::NameFormat name, dcp: _panel->SetSizer (_sizer); for (dcp::NameFormat::Map::const_iterator i = titles.begin(); i != titles.end(); ++i) { - wxStaticText* t = new wxStaticText (_panel, wxID_ANY, std_to_wx (String::compose ("%%%1 %2", i->first, i->second))); + wxStaticText* t = new StaticText (_panel, std_to_wx (String::compose ("%%%1 %2", i->first, i->second))); _sizer->Add (t); wxFont font = t->GetFont(); font.SetStyle (wxFONTSTYLE_ITALIC); diff --git a/src/wx/paste_dialog.cc b/src/wx/paste_dialog.cc index c613cad3b..cd4518881 100644 --- a/src/wx/paste_dialog.cc +++ b/src/wx/paste_dialog.cc @@ -19,17 +19,18 @@ */ #include "paste_dialog.h" +#include "check_box.h" PasteDialog::PasteDialog (wxWindow* parent, bool video, bool audio, bool text) : TableDialog (parent, _("Paste"), 1, 0, true) { - _video = new wxCheckBox (this, wxID_ANY, _("Paste video settings")); + _video = new CheckBox (this, _("Paste video settings")); _video->Enable (video); add (_video); - _audio = new wxCheckBox (this, wxID_ANY, _("Paste audio settings")); + _audio = new CheckBox (this, _("Paste audio settings")); _audio->Enable (audio); add (_audio); - _text = new wxCheckBox (this, wxID_ANY, _("Paste subtitle and caption settings")); + _text = new CheckBox (this, _("Paste subtitle and caption settings")); _text->Enable (text); add (_text); diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc index de97f2b71..ca65711a7 100644 --- a/src/wx/player_config_dialog.cc +++ b/src/wx/player_config_dialog.cc @@ -35,6 +35,7 @@ #include "name_format_editor.h" #include "nag_dialog.h" #include "monitor_dialog.h" +#include "check_box.h" #include "lib/config.h" #include "lib/ratio.h" #include "lib/filter.h" @@ -101,7 +102,7 @@ private: table->Add (_image_display, wxGBPosition(r, 1)); ++r; - _respect_kdm = new wxCheckBox (_panel, wxID_ANY, _("Respect KDM validity periods")); + _respect_kdm = new CheckBox (_panel, _("Respect KDM validity periods")); table->Add (_respect_kdm, wxGBPosition(r, 0), wxGBSpan(1, 2)); ++r; diff --git a/src/wx/recreate_chain_dialog.cc b/src/wx/recreate_chain_dialog.cc index 9b767c927..1dd14e0c8 100644 --- a/src/wx/recreate_chain_dialog.cc +++ b/src/wx/recreate_chain_dialog.cc @@ -20,6 +20,8 @@ #include "recreate_chain_dialog.h" #include "wx_util.h" +#include "static_text.h" +#include "check_box.h" #include "lib/config.h" #include "lib/cinema_kdms.h" #include @@ -34,9 +36,9 @@ RecreateChainDialog::RecreateChainDialog (wxWindow* parent) "which will prevent DCPs from being validated correctly on some systems. Do you want to re-create\n" "the certificate chain for signing DCPs and KDMs?"); - _sizer->Add (new wxStaticText (this, wxID_ANY, message), 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); + _sizer->Add (new StaticText (this, message), 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - wxCheckBox* shut_up = new wxCheckBox (this, wxID_ANY, _("Don't ask this again")); + wxCheckBox* shut_up = new CheckBox (this, _("Don't ask this again")); _sizer->Add (shut_up, 0, wxALL, DCPOMATIC_DIALOG_BORDER); shut_up->Bind (wxEVT_CHECKBOX, bind (&RecreateChainDialog::shut_up, this, _1)); diff --git a/src/wx/report_problem_dialog.cc b/src/wx/report_problem_dialog.cc index 77540fcbc..c79c542ed 100644 --- a/src/wx/report_problem_dialog.cc +++ b/src/wx/report_problem_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2015 Carl Hetherington + Copyright (C) 2014-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,8 @@ #include "report_problem_dialog.h" #include "wx_util.h" +#include "static_text.h" +#include "check_box.h" #include "lib/config.h" #include "lib/job_manager.h" #include "lib/send_problem_report_job.h" @@ -54,13 +56,13 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr fil flags |= wxALIGN_RIGHT; t += wxT (":"); #endif - wxStaticText* m = new wxStaticText (this, wxID_ANY, t); + wxStaticText* m = new StaticText (this, t); _table->Add (m, 1, flags, 6); _summary = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (320, 240), wxTE_MULTILINE); _table->Add (_summary, 1, wxEXPAND | wxALIGN_TOP); - _send_logs = new wxCheckBox (this, wxID_ANY, _("Send logs")); + _send_logs = new CheckBox (this, _("Send logs")); _send_logs->SetValue (true); _table->Add (_send_logs, 1, wxEXPAND); _table->AddSpacer (0); @@ -88,7 +90,7 @@ ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr fil } } - wxStaticText* n = new wxStaticText (this, wxID_ANY, wxT ("")); + wxStaticText* n = new StaticText (this, wxT ("")); n->SetLabelMarkup (out); _table->AddSpacer (0); _table->Add (n, 1, wxEXPAND); diff --git a/src/wx/rgba_colour_picker.cc b/src/wx/rgba_colour_picker.cc index 038bf97e4..6ea3571a1 100644 --- a/src/wx/rgba_colour_picker.cc +++ b/src/wx/rgba_colour_picker.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "rgba_colour_picker.h" #include "wx_util.h" +#include "static_text.h" #include RGBAColourPicker::RGBAColourPicker (wxWindow* parent, RGBA colour) @@ -30,10 +31,10 @@ RGBAColourPicker::RGBAColourPicker (wxWindow* parent, RGBA colour) _picker = new wxColourPickerCtrl (this, wxID_ANY); _picker->SetColour (wxColour (colour.r, colour.g, colour.b)); sizer->Add (_picker, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP); - sizer->Add (new wxStaticText (this, wxID_ANY, _("Alpha 0")), 0, wxALIGN_CENTRE_VERTICAL); + sizer->Add (new StaticText (this, _("Alpha 0")), 0, wxALIGN_CENTRE_VERTICAL); _alpha = new wxSlider (this, wxID_ANY, colour.a, 0, 255); sizer->Add (_alpha, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP); - sizer->Add (new wxStaticText (this, wxID_ANY, _("255")), 0, wxALIGN_CENTRE_VERTICAL); + sizer->Add (new StaticText (this, _("255")), 0, wxALIGN_CENTRE_VERTICAL); SetSizer (sizer); } diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc index f5d4b044a..e8361dcd8 100644 --- a/src/wx/screen_dialog.cc +++ b/src/wx/screen_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -21,6 +21,7 @@ #include "screen_dialog.h" #include "wx_util.h" #include "file_dialog_wrapper.h" +#include "static_text.h" #include "download_certificate_dialog.h" #include "table_dialog.h" #include "lib/compose.hpp" @@ -126,7 +127,7 @@ ScreenDialog::ScreenDialog ( add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition (r, 0)); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _recipient_thumbprint = new wxStaticText (this, wxID_ANY, wxT (""), wxDefaultPosition, size); + _recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size); _recipient_thumbprint->SetFont (font); set_recipient (recipient); _get_recipient_from_file = new wxButton (this, wxID_ANY, _("Get from file...")); diff --git a/src/wx/self_dkdm_dialog.cc b/src/wx/self_dkdm_dialog.cc index f53338517..5eae05de4 100644 --- a/src/wx/self_dkdm_dialog.cc +++ b/src/wx/self_dkdm_dialog.cc @@ -22,6 +22,7 @@ #include "wx_util.h" #include "kdm_output_panel.h" #include "kdm_cpl_panel.h" +#include "static_text.h" #include "lib/film.h" #include "lib/screen.h" #include "lib/config.h" @@ -57,14 +58,14 @@ SelfDKDMDialog::SelfDKDMDialog (wxWindow* parent, boost::shared_ptr subheading_font.SetWeight (wxFONTWEIGHT_BOLD); /* Sub-heading: CPL */ - wxStaticText* h = new wxStaticText (this, wxID_ANY, _("CPL")); + wxStaticText* h = new StaticText (this, _("CPL")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2); _cpl = new KDMCPLPanel (this, film->cpls ()); vertical->Add (_cpl); /* Sub-heading: output */ - h = new wxStaticText (this, wxID_ANY, _("Output")); + h = new StaticText (this, _("Output")); h->SetFont (subheading_font); vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL | wxTOP, DCPOMATIC_SIZER_Y_GAP * 2); diff --git a/src/wx/static_text.cc b/src/wx/static_text.cc new file mode 100644 index 000000000..6a11f647a --- /dev/null +++ b/src/wx/static_text.cc @@ -0,0 +1,40 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#include "static_text.h" + +StaticText::StaticText (wxWindow* parent, wxString label, wxPoint pos, wxSize size, long style) + : wxStaticText (parent, wxID_ANY, label, pos, size, style) + , I18NHook (this) +{ + +} + +void +StaticText::set_text (wxString text) +{ + SetLabel (text); +} + +wxString +StaticText::get_text () const +{ + return GetLabel (); +} diff --git a/src/wx/static_text.h b/src/wx/static_text.h new file mode 100644 index 000000000..0e49379a9 --- /dev/null +++ b/src/wx/static_text.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#include "i18n_hook.h" +#include + +class StaticText : public wxStaticText, public I18NHook +{ +public: + StaticText (wxWindow* parent, wxString label, wxPoint pos = wxDefaultPosition, wxSize = wxDefaultSize, long style = 0); + + void set_text (wxString text); + wxString get_text () const; +}; diff --git a/src/wx/subtitle_appearance_dialog.cc b/src/wx/subtitle_appearance_dialog.cc index a37f5a2ce..dd8353cf4 100644 --- a/src/wx/subtitle_appearance_dialog.cc +++ b/src/wx/subtitle_appearance_dialog.cc @@ -20,6 +20,8 @@ #include "subtitle_appearance_dialog.h" #include "rgba_colour_picker.h" +#include "static_text.h" +#include "check_box.h" #include "lib/string_text_file_content.h" #include "lib/text_content.h" #include "lib/ffmpeg_subtitle_stream.h" @@ -90,10 +92,10 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr map colours = _stream->colours (); - wxStaticText* t = new wxStaticText (colours_panel, wxID_ANY, ""); + wxStaticText* t = new StaticText (colours_panel, ""); t->SetLabelMarkup (_("Original colour")); table->Add (t, 1, wxEXPAND); - t = new wxStaticText (colours_panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL); + t = new StaticText (colours_panel, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL); t->SetLabelMarkup (_("New colour")); table->Add (t, 1, wxALIGN_CENTER); @@ -203,7 +205,7 @@ wxCheckBox* SubtitleAppearanceDialog::set_to (wxWindow* w, int& r) { wxSizer* s = new wxBoxSizer (wxHORIZONTAL); - wxCheckBox* set_to = new wxCheckBox (this, wxID_ANY, _("Set to")); + wxCheckBox* set_to = new CheckBox (this, _("Set to")); s->Add (set_to, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 8); s->Add (w, 0, wxALIGN_CENTER_VERTICAL); _table->Add (s, wxGBPosition (r, 1)); diff --git a/src/wx/table_dialog.cc b/src/wx/table_dialog.cc index 240a997d2..862f7db1a 100644 --- a/src/wx/table_dialog.cc +++ b/src/wx/table_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "table_dialog.h" #include "wx_util.h" +#include "static_text.h" TableDialog::TableDialog (wxWindow* parent, wxString title, int columns, int growable, bool cancel) : wxDialog (parent, wxID_ANY, title) @@ -64,7 +65,7 @@ TableDialog::add (wxString text, bool) text += wxT (":"); } #endif - wxStaticText* m = new wxStaticText (this, wxID_ANY, wxT ("")); + wxStaticText* m = new StaticText (this, wxT ("")); m->SetLabelMarkup (text); _table->Add (m, 0, flags, 6); return m; diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 4b53a941e..31881806f 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -26,6 +26,8 @@ #include "fonts_dialog.h" #include "dcp_text_track_dialog.h" #include "subtitle_appearance_dialog.h" +#include "static_text.h" +#include "check_box.h" #include "lib/ffmpeg_content.h" #include "lib/string_text_file_content.h" #include "lib/ffmpeg_subtitle_stream.h" @@ -58,40 +60,40 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) refer = _("Use this DCP's closed caption as OV and make VF"); } - _reference = new wxCheckBox (this, wxID_ANY, refer); - _reference_note = new wxStaticText (this, wxID_ANY, wxT("")); + _reference = new CheckBox (this, refer); + _reference_note = new StaticText (this, wxT("")); _reference_note->Wrap (200); wxFont font = _reference_note->GetFont(); font.SetStyle(wxFONTSTYLE_ITALIC); font.SetPointSize(font.GetPointSize() - 1); _reference_note->SetFont(font); - _use = new wxCheckBox (this, wxID_ANY, _("Use as")); + _use = new CheckBox (this, _("Use as")); _type = new wxChoice (this, wxID_ANY); _type->Append (_("open subtitles")); _type->Append (_("closed captions")); - _burn = new wxCheckBox (this, wxID_ANY, _("Burn subtitles into image")); + _burn = new CheckBox (this, _("Burn subtitles into image")); _offset_label = create_label (this, _("Offset"), true); _x_offset_label = create_label (this, _("X"), true); _x_offset = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(64, -1)); - _x_offset_pc_label = new wxStaticText (this, wxID_ANY, _("%")); + _x_offset_pc_label = new StaticText (this, _("%")); _y_offset_label = create_label (this, _("Y"), true); _y_offset = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(64, -1)); - _y_offset_pc_label = new wxStaticText (this, wxID_ANY, _("%")); + _y_offset_pc_label = new StaticText (this, _("%")); _scale_label = create_label (this, _("Scale"), true); _x_scale_label = create_label (this, _("X"), true); _x_scale = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(64, -1)); - _x_scale_pc_label = new wxStaticText (this, wxID_ANY, _("%")); + _x_scale_pc_label = new StaticText (this, _("%")); _y_scale_label = create_label (this, _("Y"), true); _y_scale = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(64, -1)); - _y_scale_pc_label = new wxStaticText (this, wxID_ANY, _("%")); + _y_scale_pc_label = new StaticText (this, _("%")); _line_spacing_label = create_label (this, _("Line spacing"), true); _line_spacing = new wxSpinCtrl (this); - _line_spacing_pc_label = new wxStaticText (this, wxID_ANY, _("%")); + _line_spacing_pc_label = new StaticText (this, _("%")); _dcp_track_label = create_label (this, _("DCP track"), true); _dcp_track = new wxChoice (this, wxID_ANY); diff --git a/src/wx/time_picker.cc b/src/wx/time_picker.cc index 91b201aac..295bbd52d 100644 --- a/src/wx/time_picker.cc +++ b/src/wx/time_picker.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -20,6 +20,7 @@ #include "time_picker.h" #include "wx_util.h" +#include "static_text.h" #include #include #include @@ -44,7 +45,7 @@ TimePicker::TimePicker (wxWindow* parent, wxDateTime time) wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL); _hours = new wxSpinCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size); sizer->Add (_hours, 1, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); - sizer->Add (new wxStaticText (this, wxID_ANY, wxT (":")), 0, wxALIGN_CENTER_VERTICAL); + sizer->Add (new StaticText (this, wxT (":")), 0, wxALIGN_CENTER_VERTICAL); _minutes = new wxSpinCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size); sizer->Add (_minutes, 1, wxEXPAND | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP); diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index cbaed6870..ebdd99487 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -24,6 +24,7 @@ #include "timecode.h" #include "content_panel.h" #include "move_to_dialog.h" +#include "static_text.h" #include "lib/content.h" #include "lib/image_content.h" #include "lib/text_content.h" @@ -58,23 +59,23 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr viewer) } //// TRANSLATORS: this is an abbreviation for "hours" - _h_label = new wxStaticText (this, wxID_ANY, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); + _h_label = new StaticText (this, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX /* Hack to work around failure to centre text on GTK */ gtk_label_set_line_wrap (GTK_LABEL(_h_label->GetHandle()), FALSE); #endif //// TRANSLATORS: this is an abbreviation for "minutes" - _m_label = new wxStaticText (this, wxID_ANY, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); + _m_label = new StaticText (this, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX gtk_label_set_line_wrap (GTK_LABEL (_m_label->GetHandle()), FALSE); #endif //// TRANSLATORS: this is an abbreviation for "seconds" - _s_label = new wxStaticText (this, wxID_ANY, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); + _s_label = new StaticText (this, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX gtk_label_set_line_wrap (GTK_LABEL(_s_label->GetHandle()), FALSE); #endif //// TRANSLATORS: this is an abbreviation for "frames" - _f_label = new wxStaticText (this, wxID_ANY, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); + _f_label = new StaticText (this, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL); #ifdef DCPOMATIC_LINUX gtk_label_set_line_wrap (GTK_LABEL(_f_label->GetHandle()), FALSE); #endif @@ -116,7 +117,7 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr viewer) } } - _tip = new wxStaticText (this, wxID_ANY, wxT ("")); + _tip = new StaticText (this, wxT ("")); _tip->SetLabelMarkup (out); #ifdef DCPOMATIC_OSX /* Hack to stop hidden text on some versions of OS X */ diff --git a/src/wx/update_dialog.cc b/src/wx/update_dialog.cc index c88ddbff2..a4da39e18 100644 --- a/src/wx/update_dialog.cc +++ b/src/wx/update_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -18,9 +18,10 @@ */ -#include #include "update_dialog.h" +#include "static_text.h" #include "wx_util.h" +#include using std::string; using boost::optional; @@ -33,9 +34,9 @@ UpdateDialog::UpdateDialog (wxWindow* parent, optional stable, optional< wxStaticText* message; if ((stable || test) && !(stable && test)) { - message = new wxStaticText (this, wxID_ANY, _("A new version of DCP-o-matic is available.")); + message = new StaticText (this, _("A new version of DCP-o-matic is available.")); } else { - message = new wxStaticText (this, wxID_ANY, _("New versions of DCP-o-matic are available.")); + message = new StaticText (this, _("New versions of DCP-o-matic are available.")); } overall_sizer->Add (message, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER); diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 55c0984a3..aaafe34c1 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -24,6 +24,8 @@ #include "content_colour_conversion_dialog.h" #include "content_widget.h" #include "content_panel.h" +#include "static_text.h" +#include "check_box.h" #include "lib/filter.h" #include "lib/ffmpeg_content.h" #include "lib/colour_conversion.h" @@ -74,8 +76,8 @@ scale_to_index (VideoContentScale scale) VideoPanel::VideoPanel (ContentPanel* p) : ContentSubPanel (p, _("Video")) { - _reference = new wxCheckBox (this, wxID_ANY, _("Use this DCP's video as OV and make VF")); - _reference_note = new wxStaticText (this, wxID_ANY, wxT("")); + _reference = new CheckBox (this, _("Use this DCP's video as OV and make VF")); + _reference_note = new StaticText (this, wxT("")); _reference_note->Wrap (200); wxFont font = _reference_note->GetFont(); font.SetStyle(wxFONTSTYLE_ITALIC); @@ -157,7 +159,7 @@ VideoPanel::VideoPanel (ContentPanel* p) size.SetHeight (-1); _filters_label = create_label (this, _("Filters"), true); - _filters = new wxStaticText (this, wxID_ANY, _("None"), wxDefaultPosition, size); + _filters = new StaticText (this, _("None"), wxDefaultPosition, size); _filters_button = new wxButton (this, wxID_ANY, _("Edit...")); _colour_conversion_label = create_label (this, _("Colour conversion"), true); @@ -171,7 +173,7 @@ VideoPanel::VideoPanel (ContentPanel* p) _colour_conversion->Append (S_("Colour|Custom")); _edit_colour_conversion_button = new wxButton (this, wxID_ANY, _("Edit...")); - _description = new wxStaticText (this, wxID_ANY, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize); + _description = new StaticText (this, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize); _description->SetFont(font); _left_crop->wrapped()->SetRange (0, 4096); diff --git a/src/wx/video_waveform_dialog.cc b/src/wx/video_waveform_dialog.cc index 6b0ed4410..f3d4a7aa5 100644 --- a/src/wx/video_waveform_dialog.cc +++ b/src/wx/video_waveform_dialog.cc @@ -22,6 +22,7 @@ #include "video_waveform_plot.h" #include "film_viewer.h" #include "wx_util.h" +#include "static_text.h" #include #include @@ -67,11 +68,11 @@ VideoWaveformDialog::VideoWaveformDialog (wxWindow* parent, weak_ptr wxBoxSizer* position = new wxBoxSizer (wxHORIZONTAL); add_label_to_sizer (position, this, _("Image X position"), true); - _x_position = new wxStaticText (this, wxID_ANY, ""); + _x_position = new StaticText (this, ""); _x_position->SetMinSize (wxSize (64, -1)); position->Add (_x_position, 0, wxALL, DCPOMATIC_SIZER_X_GAP); add_label_to_sizer (position, this, _("component value"), true); - _value = new wxStaticText (this, wxID_ANY, ""); + _value = new StaticText (this, ""); _value->SetMinSize (wxSize (64, -1)); position->Add (_value, 0, wxALL, DCPOMATIC_SIZER_X_GAP); overall_sizer->Add (position, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP); diff --git a/src/wx/wscript b/src/wx/wscript index bec58a353..a8c14677d 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -36,6 +36,7 @@ sources = """ subtitle_appearance_dialog.cc text_panel.cc text_view.cc + check_box.cc christie_certificate_panel.cc cinema_dialog.cc colour_conversion_editor.cc @@ -74,6 +75,8 @@ sources = """ gdc_certificate_panel.cc hints_dialog.cc initial_setup_dialog.cc + instant_i18n_dialog.cc + i18n_hook.cc job_view.cc job_view_dialog.cc job_manager_view.cc @@ -109,6 +112,7 @@ sources = """ server_dialog.cc servers_list_dialog.cc standard_controls.cc + static_text.cc swaroop_controls.cc system_font_dialog.cc table_dialog.cc diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 98d69e0db..354297d49 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -24,6 +24,7 @@ #include "wx_util.h" #include "file_picker_ctrl.h" +#include "static_text.h" #include "lib/config.h" #include "lib/job_manager.h" #include "lib/util.h" @@ -55,7 +56,7 @@ create_label (wxWindow* p, wxString t, bool) t += wxT (":"); } #endif - return new wxStaticText (p, wxID_ANY, t); + return new StaticText (p, t); } /** Add a wxStaticText to a wxSizer, aligning it at vertical centre. -- 2.30.2