UI: Introduce PUA warning
Private-Use-Area characters are not correctly rendered unless ZRCola font is used. The PUA characters are now displayed in blue. This commit also required to upgrade (de)composition text box to use RichEdit control. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
e43a5a0ef0
commit
34e409ef2f
BIN
ZRCola/ZRCola.rc
BIN
ZRCola/ZRCola.rc
Binary file not shown.
@ -266,6 +266,19 @@
|
||||
<property name="shortcut"></property>
|
||||
<property name="unchecked_bitmap"></property>
|
||||
</object>
|
||||
<object class="wxMenuItem" expanded="0">
|
||||
<property name="bitmap"></property>
|
||||
<property name="checked">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="help">Toggle PUA warning</property>
|
||||
<property name="id">wxID_WARN_PUA_MENU</property>
|
||||
<property name="kind">wxITEM_CHECK</property>
|
||||
<property name="label">&PUA Warning</property>
|
||||
<property name="name">m_menuItemWarnPUA</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="shortcut"></property>
|
||||
<property name="unchecked_bitmap"></property>
|
||||
</object>
|
||||
<object class="separator" expanded="0">
|
||||
<property name="name">separator5</property>
|
||||
<property name="permission">none</property>
|
||||
@ -670,6 +683,17 @@
|
||||
<property name="statusbar">Toggle ZRCola character (De)composition</property>
|
||||
<property name="tooltip">ZRCola (De)composition</property>
|
||||
</object>
|
||||
<object class="tool" expanded="0">
|
||||
<property name="bitmap">Load From Icon Resource; warn_pua.ico; [24; 24]</property>
|
||||
<property name="context_menu">0</property>
|
||||
<property name="id">wxID_WARN_PUA_TOOLBAR</property>
|
||||
<property name="kind">wxITEM_CHECK</property>
|
||||
<property name="label">PUA Warning</property>
|
||||
<property name="name">m_toolWarnPUA</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="statusbar">Toggle PUA warning</property>
|
||||
<property name="tooltip">Highlight PUA Characters</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="CustomControl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
@ -1016,7 +1040,7 @@
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxTE_MULTILINE</property>
|
||||
<property name="style">wxTE_MULTILINE|wxTE_RICH</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
@ -1358,7 +1382,7 @@
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxTE_MULTILINE</property>
|
||||
<property name="style">wxTE_MULTILINE|wxTE_RICH</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
|
BIN
ZRCola/res/warn_pua.ico
Normal file
BIN
ZRCola/res/warn_pua.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
1690
ZRCola/res/warn_pua.pdf
Normal file
1690
ZRCola/res/warn_pua.pdf
Normal file
File diff suppressed because one or more lines are too long
@ -140,6 +140,9 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION_MENU, wxString( _("&ZRCola (De)composition") ) , _("Toggle ZRCola character (De)composition"), wxITEM_CHECK );
|
||||
m_menuEdit->Append( m_menuItemComposition );
|
||||
|
||||
m_menuItemWarnPUA = new wxMenuItem( m_menuEdit, wxID_WARN_PUA_MENU, wxString( _("&PUA Warning") ) , _("Toggle PUA warning"), wxITEM_CHECK );
|
||||
m_menuEdit->Append( m_menuItemWarnPUA );
|
||||
|
||||
m_menuEdit->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuSettings;
|
||||
@ -219,6 +222,8 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_toolbarTranslate->AddControl( m_toolTranslationSeq );
|
||||
m_toolComposition = m_toolbarTranslate->AddTool( wxID_COMPOSITION_TOOLBAR, _("ZRCola (De)composition"), wxIcon( wxT("composition.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_CHECK, _("ZRCola (De)composition"), _("Toggle ZRCola character (De)composition"), NULL );
|
||||
|
||||
m_toolWarnPUA = m_toolbarTranslate->AddTool( wxID_WARN_PUA_TOOLBAR, _("PUA Warning"), wxIcon( wxT("warn_pua.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_CHECK, _("Highlight PUA Characters"), _("Toggle PUA warning"), NULL );
|
||||
|
||||
m_toolbarTranslate->Realize();
|
||||
m_mgr.AddPane( m_toolbarTranslate, wxAuiPaneInfo().Name( wxT("toolbarCompose") ).Top().Caption( _("Compose") ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
|
||||
|
||||
@ -271,7 +276,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
|
||||
wxStaticBoxSizer* bSizerSourceEdit2;
|
||||
bSizerSourceEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelSourceEdit, wxID_ANY, _("Decomposed Text") ), wxVERTICAL );
|
||||
|
||||
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
|
||||
m_source->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
|
||||
m_source->SetMinSize( wxSize( 100,25 ) );
|
||||
|
||||
@ -318,7 +323,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
|
||||
wxStaticBoxSizer* bSizerDestinationEdit2;
|
||||
bSizerDestinationEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDestinationEdit, wxID_ANY, _("Composed Text") ), wxVERTICAL );
|
||||
|
||||
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
|
||||
m_destination->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
|
||||
m_destination->SetMinSize( wxSize( 100,25 ) );
|
||||
|
||||
|
@ -68,6 +68,7 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxID_COPY_SOURCE_AND_RETURN,
|
||||
wxID_SEND_ABORT,
|
||||
wxID_COMPOSITION_MENU,
|
||||
wxID_WARN_PUA_MENU,
|
||||
wxID_SETTINGS,
|
||||
wxID_TOOLBAR_EDIT,
|
||||
wxID_TOOLBAR_TRANSLATE,
|
||||
@ -76,7 +77,8 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxID_HELP_SHORTCUTS,
|
||||
wxID_HELP_REQCHAR,
|
||||
wxID_HELP_UPDATE,
|
||||
wxID_COMPOSITION_TOOLBAR
|
||||
wxID_COMPOSITION_TOOLBAR,
|
||||
wxID_WARN_PUA_TOOLBAR
|
||||
};
|
||||
|
||||
wxMenuBar* m_menubar;
|
||||
@ -84,6 +86,7 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxMenu* m_menuEdit;
|
||||
wxMenu* m_menuTranslationSeq;
|
||||
wxMenuItem* m_menuItemComposition;
|
||||
wxMenuItem* m_menuItemWarnPUA;
|
||||
wxMenu* m_menuView;
|
||||
wxMenu* m_menuHelp;
|
||||
wxAuiToolBar* m_toolbarEdit;
|
||||
@ -96,6 +99,7 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxAuiToolBarItem* m_toolSendSource;
|
||||
wxChoice* m_toolTranslationSeq;
|
||||
wxAuiToolBarItem* m_toolComposition;
|
||||
wxAuiToolBarItem* m_toolWarnPUA;
|
||||
wxZRColaCharacterCatalogPanel* m_panelChrCat;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
static inline bool is_pua(_In_ wchar_t c)
|
||||
{
|
||||
return L'\ue000' <= c && c <= L'\uf8ff';
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// wxZRColaComposerPanel
|
||||
@ -27,10 +32,18 @@
|
||||
wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
|
||||
m_sourceChanged(false),
|
||||
m_destinationChanged(false),
|
||||
m_sourceRestyled(false),
|
||||
m_destinationRestyled(false),
|
||||
m_styleNormal(*wxBLACK, *wxWHITE, wxFont(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola"))),
|
||||
m_stylePUA(*wxBLUE, *wxWHITE, wxFont(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola"))),
|
||||
m_selSource(0, 0),
|
||||
m_selDestination(0, 0),
|
||||
wxZRColaComposerPanelBase(parent)
|
||||
{
|
||||
// RichEdit control has no inner margins by default.
|
||||
m_source->SetMargins(FromDIP(wxPoint(5, 2)));
|
||||
m_destination->SetMargins(FromDIP(wxPoint(5, 2)));
|
||||
|
||||
m_source->PushEventHandler(&m_keyhandler);
|
||||
|
||||
// Restore the previously saved state (if exists).
|
||||
@ -88,8 +101,8 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
||||
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
|
||||
wxString src;
|
||||
size_t len = GetValue(m_source, src);
|
||||
wxString src = m_source->GetValue();
|
||||
size_t len = src.Length();
|
||||
std::wstring dst(src.data(), len), dst2;
|
||||
ZRCola::mapping_vector map;
|
||||
|
||||
@ -132,8 +145,8 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
||||
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
|
||||
wxString src;
|
||||
size_t len = GetValue(m_destination, src);
|
||||
wxString src = m_destination->GetValue();
|
||||
size_t len = src.Length();
|
||||
std::wstring dst(src.data(), len), dst2;
|
||||
ZRCola::mapping_vector map;
|
||||
|
||||
@ -185,6 +198,9 @@ void wxZRColaComposerPanel::OnSourcePaint(wxPaintEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
if (m_sourceRestyled)
|
||||
return;
|
||||
|
||||
long from, to;
|
||||
m_source->GetSelection(&from, &to);
|
||||
|
||||
@ -239,8 +255,15 @@ void wxZRColaComposerPanel::OnSourceText(wxCommandEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
if (m_sourceRestyled)
|
||||
return;
|
||||
|
||||
// Set the flag the source text changed to trigger idle-time translation.
|
||||
m_sourceChanged = true;
|
||||
|
||||
m_sourceRestyled = true;
|
||||
m_source->SetStyle(0, GetWindowTextLength(m_source->GetHWND()), m_styleNormal);
|
||||
m_sourceRestyled = false;
|
||||
}
|
||||
|
||||
|
||||
@ -248,6 +271,9 @@ void wxZRColaComposerPanel::OnDestinationPaint(wxPaintEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
if (m_destinationRestyled)
|
||||
return;
|
||||
|
||||
long from, to;
|
||||
m_destination->GetSelection(&from, &to);
|
||||
|
||||
@ -302,8 +328,26 @@ void wxZRColaComposerPanel::OnDestinationText(wxCommandEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
if (m_destinationRestyled)
|
||||
return;
|
||||
|
||||
// Set the flag the destination text changed to trigger idle-time inverse translation.
|
||||
m_destinationChanged = true;
|
||||
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
m_destinationRestyled = true;
|
||||
if (app->m_mainWnd->m_warnPUA) {
|
||||
wxString src = m_destination->GetValue();
|
||||
size_t len = src.Length();
|
||||
for (size_t i = 0, j; i < len;) {
|
||||
bool pua_i = is_pua(src[i]);
|
||||
for (j = i + 1; j < len && pua_i == is_pua(src[j]); j++);
|
||||
m_destination->SetStyle((long)i, (long)j, pua_i ? m_stylePUA : m_styleNormal);
|
||||
i = j;
|
||||
}
|
||||
} else
|
||||
m_destination->SetStyle(0, GetWindowTextLength(m_destination->GetHWND()), m_styleNormal);
|
||||
m_destinationRestyled = false;
|
||||
}
|
||||
|
||||
|
||||
@ -312,19 +356,22 @@ void wxZRColaComposerPanel::OnSaveTimer(wxTimerEvent& event)
|
||||
wxString fileName(GetStateFileName());
|
||||
wxFFile file(fileName, wxT("wb"));
|
||||
if (file.IsOpened()) {
|
||||
wxString text;
|
||||
size_t len;
|
||||
|
||||
{
|
||||
// Save source text.
|
||||
len = GetValue(m_source, text);
|
||||
wxString text = m_source->GetValue();
|
||||
size_t len = text.Length();
|
||||
file.Write(&len, sizeof(len));
|
||||
file.Write((const wchar_t*)text, sizeof(wchar_t)*len);
|
||||
}
|
||||
|
||||
{
|
||||
// Save destination text.
|
||||
len = GetValue(m_destination, text);
|
||||
wxString text = m_destination->GetValue();
|
||||
size_t len = text.Length();
|
||||
file.Write(&len, sizeof(len));
|
||||
file.Write((const wchar_t*)text, sizeof(wchar_t)*len);
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
@ -348,31 +395,6 @@ wxString wxZRColaComposerPanel::GetStateFileName()
|
||||
}
|
||||
|
||||
|
||||
size_t wxZRColaComposerPanel::GetValue(wxTextCtrl *wnd, wxString &text)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
// Use Windows GetWindowText() function to avoid line ending conversion incompletely imposed by wxWidgets.
|
||||
WXHWND hWnd = wnd->GetHWND();
|
||||
size_t len = ::GetWindowTextLengthW(hWnd);
|
||||
if (len < 0x100) {
|
||||
WCHAR buf[0x100];
|
||||
::GetWindowTextW(hWnd, buf, (int)(len + 1));
|
||||
text.assign(buf, len);
|
||||
} else {
|
||||
LPWSTR buf = new WCHAR[len + 1];
|
||||
::GetWindowTextW(hWnd, buf, (int)(len + 1));
|
||||
text.assign(buf, len);
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
return len;
|
||||
#else
|
||||
text = wnd->GetValue();
|
||||
return text.Length();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &range, ZRCola::mapping_vector &mapping, const wchar_t *src, size_t len, long from, long to)
|
||||
{
|
||||
wxString hex;
|
||||
@ -381,8 +403,8 @@ void wxZRColaComposerPanel::SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &
|
||||
mapping.clear();
|
||||
for (size_t i = 0; i < len && src[i]; i++) {
|
||||
wchar_t c = src[i];
|
||||
if (c == L'\n' || c == '\r') {
|
||||
hex += c;
|
||||
if (c == L'\n') {
|
||||
hex += L"\r\n";
|
||||
first = true;
|
||||
} else {
|
||||
hex += wxString::Format(first ? wxT("%04X") : wxT(" %04X"), src[i]);
|
||||
|
@ -66,12 +66,17 @@ protected:
|
||||
inline void GetTranslationSeq(_Out_ const ZRCola::transetid_t *&sets_begin, _Out_ const ZRCola::transetid_t *&sets_end) const;
|
||||
|
||||
static wxString GetStateFileName();
|
||||
static size_t GetValue(wxTextCtrl *wnd, wxString &text);
|
||||
static void SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &range, ZRCola::mapping_vector &mapping, const wchar_t *src, size_t len, long from, long to);
|
||||
|
||||
protected:
|
||||
bool m_sourceChanged; ///< Boolean flag to mark source text "dirty" to trigger translation
|
||||
bool m_destinationChanged; ///< Boolean flag to mark destination text "dirty" to trigger inverse translation
|
||||
volatile bool
|
||||
m_sourceRestyled, ///< Boolean flag to mark source text is being restyled
|
||||
m_destinationRestyled; ///< Boolean flag to mark destination text is being restyled
|
||||
wxTextAttr
|
||||
m_styleNormal, ///< Normal text style
|
||||
m_stylePUA; ///< PUA character text style
|
||||
std::vector<ZRCola::mapping_vector> m_mapping; ///< Character index mapping vector between source and normalized text
|
||||
std::pair<long, long>
|
||||
m_selSource, ///< Character index of selected text in source text control
|
||||
|
@ -44,6 +44,8 @@ wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
|
||||
|
||||
EVT_MENU (wxID_COMPOSITION_MENU , wxZRColaFrame::OnCompositionMenu )
|
||||
EVT_MENU (wxID_COMPOSITION_TOOLBAR , wxZRColaFrame::OnCompositionToolbar )
|
||||
EVT_MENU (wxID_WARN_PUA_MENU , wxZRColaFrame::OnWarnPUAMenu )
|
||||
EVT_MENU (wxID_WARN_PUA_TOOLBAR , wxZRColaFrame::OnWarnPUAToolbar )
|
||||
EVT_MENU_RANGE (wxID_TRANSLATION_SEQ_DEFAULT, wxID_TRANSLATION_SEQ_END, wxZRColaFrame::OnTranslationSeqMenu )
|
||||
|
||||
EVT_MENU (wxID_SETTINGS , wxZRColaFrame::OnSettings )
|
||||
@ -75,6 +77,7 @@ wxZRColaFrame::wxZRColaFrame() :
|
||||
m_settings(NULL),
|
||||
m_chrReq(NULL),
|
||||
m_composition(true),
|
||||
m_warnPUA(false),
|
||||
m_transeq_id(ZRCOLA_TRANSEQID_DEFAULT),
|
||||
m_transeq(NULL),
|
||||
wxZRColaFrameBase(NULL)
|
||||
@ -195,6 +198,14 @@ wxZRColaFrame::wxZRColaFrame() :
|
||||
m_toolComposition->SetState(m_toolComposition->GetState() & ~wxAUI_BUTTON_STATE_CHECKED);
|
||||
}
|
||||
|
||||
if (m_warnPUA) {
|
||||
m_menuItemWarnPUA->Check(true);
|
||||
m_toolWarnPUA->SetState(m_toolWarnPUA->GetState() | wxAUI_BUTTON_STATE_CHECKED);
|
||||
} else {
|
||||
m_menuItemWarnPUA->Check(false);
|
||||
m_toolWarnPUA->SetState(m_toolWarnPUA->GetState() & ~wxAUI_BUTTON_STATE_CHECKED);
|
||||
}
|
||||
|
||||
// Update translation sequence selection.
|
||||
for (unsigned int i = 0, n = m_toolTranslationSeq->GetCount(); ; i++) {
|
||||
if (i < n) {
|
||||
@ -370,6 +381,33 @@ void wxZRColaFrame::OnCompositionToolbar(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnWarnPUAMenu(wxCommandEvent& event)
|
||||
{
|
||||
m_warnPUA = m_menuItemWarnPUA->IsChecked();
|
||||
m_toolWarnPUA->SetState((m_toolWarnPUA->GetState() & ~wxAUI_BUTTON_STATE_CHECKED) | (m_warnPUA ? wxAUI_BUTTON_STATE_CHECKED : 0));
|
||||
m_toolbarTranslate->Refresh();
|
||||
|
||||
// Notify source text something changed and should re-translate.
|
||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||
m_panel->m_source->ProcessWindowEvent(event2);
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnWarnPUAToolbar(wxCommandEvent& event)
|
||||
{
|
||||
m_warnPUA = (m_toolWarnPUA->GetState() & wxAUI_BUTTON_STATE_CHECKED) ? true : false;
|
||||
m_menuItemWarnPUA->Check(m_warnPUA);
|
||||
|
||||
// Notify source text something changed and should re-translate.
|
||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||
m_panel->m_source->ProcessWindowEvent(event2);
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnSettings(wxCommandEvent& event)
|
||||
{
|
||||
m_settings->ShowModal();
|
||||
@ -746,6 +784,7 @@ void wxPersistentZRColaFrame::Save() const
|
||||
auto wnd = static_cast<const wxZRColaFrame*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||
|
||||
SaveValue(wxT("composition"), wnd->m_composition);
|
||||
SaveValue(wxT("warnPUA"), wnd->m_warnPUA);
|
||||
SaveValue(wxT("transeqId"), static_cast<int>(wnd->m_transeq_id));
|
||||
|
||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
|
||||
@ -769,6 +808,10 @@ bool wxPersistentZRColaFrame::Restore()
|
||||
wnd->m_composition = b;
|
||||
else
|
||||
wnd->m_composition = wnd->m_transeq_id == ZRCOLA_TRANSEQID_DEFAULT;
|
||||
if (RestoreValue(wxT("warnPUA"), &b))
|
||||
wnd->m_warnPUA = b;
|
||||
else
|
||||
wnd->m_warnPUA = false;
|
||||
|
||||
int guiLevel;
|
||||
return RestoreValue(wxT("guiLevel"), &guiLevel) && guiLevel == s_guiLevel ? wxPersistentTLWEx::Restore() : true;
|
||||
|
@ -92,6 +92,8 @@ protected:
|
||||
void OnSendAbort(wxCommandEvent& event);
|
||||
void OnCompositionMenu(wxCommandEvent& event);
|
||||
void OnCompositionToolbar(wxCommandEvent& event);
|
||||
void OnWarnPUAMenu(wxCommandEvent& event);
|
||||
void OnWarnPUAToolbar(wxCommandEvent& event);
|
||||
void OnSettings(wxCommandEvent& event);
|
||||
virtual void OnIdle(wxIdleEvent& event);
|
||||
void OnTaskbarIconClick(wxTaskBarIconEvent& event);
|
||||
@ -149,6 +151,7 @@ protected:
|
||||
wxZRColaCharRequest *m_chrReq; ///< Request a New Character dialog
|
||||
wxZRColaSettings *m_settings; ///< Configuration dialog
|
||||
bool m_composition; ///< Is (de)composition enabled?
|
||||
bool m_warnPUA; ///< Mark Private-Use-Area characters in destination text
|
||||
ZRCola::transeqid_t m_transeq_id; ///< Translation sequence ID
|
||||
wxZRColaTranslationSeq *m_transeq; ///< Custom translation sequence dialog
|
||||
};
|
||||
|
@ -140,6 +140,9 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION_MENU, wxString( _("&ZRCola (De)composition") ) , _("Toggle ZRCola character (De)composition"), wxITEM_CHECK );
|
||||
m_menuEdit->Append( m_menuItemComposition );
|
||||
|
||||
m_menuItemWarnPUA = new wxMenuItem( m_menuEdit, wxID_WARN_PUA_MENU, wxString( _("&PUA Warning") ) , _("Toggle PUA warning"), wxITEM_CHECK );
|
||||
m_menuEdit->Append( m_menuItemWarnPUA );
|
||||
|
||||
m_menuEdit->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuSettings;
|
||||
@ -219,6 +222,8 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_toolbarTranslate->AddControl( m_toolTranslationSeq );
|
||||
m_toolComposition = m_toolbarTranslate->AddTool( wxID_COMPOSITION_TOOLBAR, _("ZRCola (De)composition"), wxIcon( wxT("composition.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_CHECK, _("ZRCola (De)composition"), _("Toggle ZRCola character (De)composition"), NULL );
|
||||
|
||||
m_toolWarnPUA = m_toolbarTranslate->AddTool( wxID_WARN_PUA_TOOLBAR, _("PUA Warning"), wxIcon( wxT("warn_pua.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_CHECK, _("Highlight PUA Characters"), _("Toggle PUA warning"), NULL );
|
||||
|
||||
m_toolbarTranslate->Realize();
|
||||
m_mgr.AddPane( m_toolbarTranslate, wxAuiPaneInfo().Name( wxT("toolbarCompose") ).Top().Caption( _("Compose") ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
|
||||
|
||||
@ -271,7 +276,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
|
||||
wxStaticBoxSizer* bSizerSourceEdit2;
|
||||
bSizerSourceEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelSourceEdit, wxID_ANY, _("Decomposed Text") ), wxVERTICAL );
|
||||
|
||||
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
|
||||
m_source->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
|
||||
m_source->SetMinSize( FromDIP(wxSize( 100,25 )) );
|
||||
|
||||
@ -318,7 +323,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
|
||||
wxStaticBoxSizer* bSizerDestinationEdit2;
|
||||
bSizerDestinationEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDestinationEdit, wxID_ANY, _("Composed Text") ), wxVERTICAL );
|
||||
|
||||
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
|
||||
m_destination->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
|
||||
m_destination->SetMinSize( FromDIP(wxSize( 100,25 )) );
|
||||
|
||||
|
@ -68,6 +68,7 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxID_COPY_SOURCE_AND_RETURN,
|
||||
wxID_SEND_ABORT,
|
||||
wxID_COMPOSITION_MENU,
|
||||
wxID_WARN_PUA_MENU,
|
||||
wxID_SETTINGS,
|
||||
wxID_TOOLBAR_EDIT,
|
||||
wxID_TOOLBAR_TRANSLATE,
|
||||
@ -76,7 +77,8 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxID_HELP_SHORTCUTS,
|
||||
wxID_HELP_REQCHAR,
|
||||
wxID_HELP_UPDATE,
|
||||
wxID_COMPOSITION_TOOLBAR
|
||||
wxID_COMPOSITION_TOOLBAR,
|
||||
wxID_WARN_PUA_TOOLBAR
|
||||
};
|
||||
|
||||
wxMenuBar* m_menubar;
|
||||
@ -84,6 +86,7 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxMenu* m_menuEdit;
|
||||
wxMenu* m_menuTranslationSeq;
|
||||
wxMenuItem* m_menuItemComposition;
|
||||
wxMenuItem* m_menuItemWarnPUA;
|
||||
wxMenu* m_menuView;
|
||||
wxMenu* m_menuHelp;
|
||||
wxAuiToolBar* m_toolbarEdit;
|
||||
@ -96,6 +99,7 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxAuiToolBarItem* m_toolSendSource;
|
||||
wxChoice* m_toolTranslationSeq;
|
||||
wxAuiToolBarItem* m_toolComposition;
|
||||
wxAuiToolBarItem* m_toolWarnPUA;
|
||||
wxZRColaCharacterCatalogPanel* m_panelChrCat;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user