/*
- 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.
CheckBox::CheckBox (wxWindow* parent, wxString label)
: wxCheckBox (parent, wxID_ANY, label)
- , I18NHook (this)
+ , I18NHook (this, get_text())
{
}
/*
- 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.
Button::Button (wxWindow* parent, wxString label, wxPoint pos, wxSize size, long style)
: wxButton (parent, wxID_ANY, label, pos, size, style)
- , I18NHook (this)
+ , I18NHook (this, get_text())
{
}
/*
- 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.
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));
}
void
I18NHook::handle (wxMouseEvent& ev)
{
- wxString const original = get_text ();
-
InstantI18NDialog* d = new InstantI18NDialog (_window, get_text());
d->ShowModal();
set_text (d->get());
ev.Skip ();
- _translations[wx_to_std(original)] = wx_to_std(get_text());
+ _translations[wx_to_std(_original)] = wx_to_std(get_text());
}
/*
- 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.
class I18NHook
{
public:
- I18NHook (wxWindow* window);
+ I18NHook (wxWindow* window, wxString original);
virtual void set_text (wxString text) = 0;
virtual wxString get_text () const = 0;
void handle (wxMouseEvent &);
wxWindow* _window;
+ wxString _original;
static std::map<std::string, std::string> _translations;
};
/*
- 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.
StaticText::StaticText (wxWindow* parent, wxString label, wxPoint pos, wxSize size, long style)
: wxStaticText (parent, wxID_ANY, label, pos, size, style)
- , I18NHook (this)
+ , I18NHook (this, get_text())
{
}