summaryrefslogtreecommitdiff
path: root/src/wx/i18n_hook.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-03-21 23:07:44 +0000
committerCarl Hetherington <cth@carlh.net>2019-03-21 23:07:44 +0000
commit674f59e307919856118d21aa03b53eb6fa82aeb0 (patch)
tree2baaef6d55fb3b8c55fa2715ab5263f65e1e5043 /src/wx/i18n_hook.cc
parentda9fd55339dab2605d14579a0f79588db27c232a (diff)
Fix instant-translation when things are changed more than once.
Diffstat (limited to 'src/wx/i18n_hook.cc')
-rw-r--r--src/wx/i18n_hook.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/wx/i18n_hook.cc b/src/wx/i18n_hook.cc
index 84dcd761f..b2cd6df8e 100644
--- a/src/wx/i18n_hook.cc
+++ b/src/wx/i18n_hook.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -30,8 +30,9 @@ using std::string;
map<string, string> I18NHook::_translations;
-I18NHook::I18NHook (wxWindow* window)
+I18NHook::I18NHook (wxWindow* window, wxString original)
: _window (window)
+ , _original (original)
{
_window->Bind (wxEVT_MIDDLE_DOWN, bind(&I18NHook::handle, this, _1));
}
@@ -39,8 +40,6 @@ I18NHook::I18NHook (wxWindow* window)
void
I18NHook::handle (wxMouseEvent& ev)
{
- wxString const original = get_text ();
-
InstantI18NDialog* d = new InstantI18NDialog (_window, get_text());
d->ShowModal();
set_text (d->get());
@@ -56,5 +55,5 @@ I18NHook::handle (wxMouseEvent& ev)
ev.Skip ();
- _translations[wx_to_std(original)] = wx_to_std(get_text());
+ _translations[wx_to_std(_original)] = wx_to_std(get_text());
}