From c2b7422b8f0ad9fdf1e6e174a90486fb9e6346f4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 12 Jul 2024 00:11:02 +0200 Subject: Remove some more stuff related to the old "instant i18n" feature. --- src/tools/dcpomatic.cc | 1 - src/wx/check_box.cc | 4 --- src/wx/check_box.h | 7 ++--- src/wx/dcpomatic_button.cc | 1 - src/wx/dcpomatic_button.h | 7 ++--- src/wx/i18n_hook.cc | 69 ------------------------------------------- src/wx/i18n_hook.h | 55 ---------------------------------- src/wx/instant_i18n_dialog.cc | 50 ------------------------------- src/wx/instant_i18n_dialog.h | 39 ------------------------ src/wx/static_text.cc | 1 - src/wx/static_text.h | 7 ++--- src/wx/wscript | 2 -- 12 files changed, 9 insertions(+), 234 deletions(-) delete mode 100644 src/wx/i18n_hook.cc delete mode 100644 src/wx/i18n_hook.h delete mode 100644 src/wx/instant_i18n_dialog.cc delete mode 100644 src/wx/instant_i18n_dialog.h diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 0a6728731..5e56a2672 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -38,7 +38,6 @@ #include "wx/hints_dialog.h" #include "wx/html_dialog.h" #include "wx/file_dialog.h" -#include "wx/i18n_hook.h" #include "wx/id.h" #include "wx/job_manager_view.h" #include "wx/kdm_dialog.h" diff --git a/src/wx/check_box.cc b/src/wx/check_box.cc index c18ceba47..b183c6ddd 100644 --- a/src/wx/check_box.cc +++ b/src/wx/check_box.cc @@ -22,12 +22,8 @@ #include "check_box.h" -using std::cout; - - CheckBox::CheckBox (wxWindow* parent, wxString label) : wxCheckBox (parent, wxID_ANY, label) - , I18NHook (this, get_text()) { } diff --git a/src/wx/check_box.h b/src/wx/check_box.h index d9feb00c9..7f8c6dd43 100644 --- a/src/wx/check_box.h +++ b/src/wx/check_box.h @@ -23,7 +23,6 @@ #define DCPOMATIC_CHECK_BOX_H -#include "i18n_hook.h" #include LIBDCP_DISABLE_WARNINGS #include @@ -31,13 +30,13 @@ LIBDCP_ENABLE_WARNINGS #include -class CheckBox : public wxCheckBox, public I18NHook +class CheckBox : public wxCheckBox { public: CheckBox (wxWindow* parent, wxString label); - void set_text (wxString text) override; - wxString get_text () const override; + void set_text(wxString text); + wxString get_text() const; bool get() const; void set(bool state); diff --git a/src/wx/dcpomatic_button.cc b/src/wx/dcpomatic_button.cc index beab64227..d1b753523 100644 --- a/src/wx/dcpomatic_button.cc +++ b/src/wx/dcpomatic_button.cc @@ -22,7 +22,6 @@ Button::Button (wxWindow* parent, wxString label, wxPoint pos, wxSize size, long style) : wxButton (parent, wxID_ANY, label, pos, size, style) - , I18NHook (this, get_text()) { } diff --git a/src/wx/dcpomatic_button.h b/src/wx/dcpomatic_button.h index 6de8b60f4..75f44e01f 100644 --- a/src/wx/dcpomatic_button.h +++ b/src/wx/dcpomatic_button.h @@ -23,7 +23,6 @@ #define DCPOMATIC_BUTTON_H -#include "i18n_hook.h" #include LIBDCP_DISABLE_WARNINGS #include @@ -31,13 +30,13 @@ LIBDCP_ENABLE_WARNINGS #include -class Button : public wxButton, public I18NHook +class Button : public wxButton { public: Button (wxWindow* parent, wxString label, wxPoint pos = wxDefaultPosition, wxSize = wxDefaultSize, long style = 0); - void set_text (wxString text) override; - wxString get_text () const override; + void set_text(wxString text); + wxString get_text() const; template void bind(Args... args) { diff --git a/src/wx/i18n_hook.cc b/src/wx/i18n_hook.cc deleted file mode 100644 index eb6e61d5f..000000000 --- a/src/wx/i18n_hook.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2018-2021 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 -LIBDCP_DISABLE_WARNINGS -#include -LIBDCP_ENABLE_WARNINGS -#include - - -using std::map; -using std::string; -#if BOOST_VERSION >= 106100 -using namespace boost::placeholders; -#endif - - -map I18NHook::_translations; - -I18NHook::I18NHook (wxWindow* window, wxString original) - : _window (window) - , _original (original) -{ - _window->Bind (wxEVT_MIDDLE_DOWN, bind(&I18NHook::handle, this, _1)); -} - - -void -I18NHook::handle (wxMouseEvent& ev) -{ - auto d = new InstantI18NDialog (_window, get_text()); - d->ShowModal(); - set_text (d->get()); - d->Destroy (); - - auto w = _window; - while (w) { - if (w->GetContainingSizer()) { - w->GetContainingSizer()->Layout(); - } - w = w->GetParent(); - } - - ev.Skip (); - - _translations[wx_to_std(_original)] = wx_to_std(get_text()); -} diff --git a/src/wx/i18n_hook.h b/src/wx/i18n_hook.h deleted file mode 100644 index 50c020b2a..000000000 --- a/src/wx/i18n_hook.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2018-2021 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 -LIBDCP_DISABLE_WARNINGS -#include -LIBDCP_ENABLE_WARNINGS -#include - - -class I18NHook -{ -public: - I18NHook (wxWindow* window, wxString original); - - virtual void set_text (wxString text) = 0; - virtual wxString get_text () const = 0; - - static std::map translations () { - return _translations; - } - -private: - void handle (wxMouseEvent &); - - wxWindow* _window; - wxString _original; - - static std::map _translations; -}; - - -#endif diff --git a/src/wx/instant_i18n_dialog.cc b/src/wx/instant_i18n_dialog.cc deleted file mode 100644 index 364b4dd18..000000000 --- a/src/wx/instant_i18n_dialog.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - 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 deleted file mode 100644 index ee7f94f4c..000000000 --- a/src/wx/instant_i18n_dialog.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - 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 -LIBDCP_DISABLE_WARNINGS -#include -LIBDCP_ENABLE_WARNINGS - - -class InstantI18NDialog : public wxDialog -{ -public: - InstantI18NDialog (wxWindow* parent, wxString text); - - wxString get () const; - -private: - void close (); - - wxTextCtrl* _text; -}; diff --git a/src/wx/static_text.cc b/src/wx/static_text.cc index 40710590f..11f099337 100644 --- a/src/wx/static_text.cc +++ b/src/wx/static_text.cc @@ -22,7 +22,6 @@ StaticText::StaticText (wxWindow* parent, wxString label, wxPoint pos, wxSize size, long style) : wxStaticText (parent, wxID_ANY, label, pos, size, style) - , I18NHook (this, get_text()) { } diff --git a/src/wx/static_text.h b/src/wx/static_text.h index f10d67866..eec8c7367 100644 --- a/src/wx/static_text.h +++ b/src/wx/static_text.h @@ -19,18 +19,17 @@ */ -#include "i18n_hook.h" #include LIBDCP_DISABLE_WARNINGS #include LIBDCP_ENABLE_WARNINGS -class StaticText : public wxStaticText, public I18NHook +class StaticText : public wxStaticText { public: StaticText (wxWindow* parent, wxString label, wxPoint pos = wxDefaultPosition, wxSize = wxDefaultSize, long style = 0); - void set_text (wxString text) override; - wxString get_text () const override; + void set_text(wxString text); + wxString get_text() const; }; diff --git a/src/wx/wscript b/src/wx/wscript index 0255149ed..9a7b47263 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -97,10 +97,8 @@ sources = """ gl_video_view.cc hints_dialog.cc html_dialog.cc - i18n_hook.cc image_sequence_dialog.cc invalid_certificate_period_dialog.cc - instant_i18n_dialog.cc interop_metadata_dialog.cc job_manager_view.cc job_view.cc -- cgit v1.2.3