diff --git a/ZRCola/res/ZRCola.fbp b/ZRCola/res/ZRCola.fbp index 0e6f44f..b752e40 100644 --- a/ZRCola/res/ZRCola.fbp +++ b/ZRCola/res/ZRCola.fbp @@ -258,7 +258,7 @@ 0 1 Toggle ZRCola character (De)composition - wxID_COMPOSITION_MENU + wxID_COMPOSITION wxITEM_CHECK &ZRCola (De)composition m_menuItemComposition @@ -271,7 +271,7 @@ 0 1 Toggle PUA warning - wxID_WARN_PUA_MENU + wxID_WARN_PUA wxITEM_CHECK &PUA Warning m_menuItemWarnPUA @@ -675,7 +675,7 @@ Load From Icon Resource; composition.ico; [24; 24] 0 - wxID_COMPOSITION_TOOLBAR + wxID_COMPOSITION wxITEM_CHECK ZRCola (De)composition m_toolComposition @@ -686,7 +686,7 @@ Load From Icon Resource; warn_pua.ico; [24; 24] 0 - wxID_WARN_PUA_TOOLBAR + wxID_WARN_PUA wxITEM_CHECK PUA Warning m_toolWarnPUA diff --git a/ZRCola/res/zrcolagui.cpp b/ZRCola/res/zrcolagui.cpp index 390dae8..18e9ee1 100644 --- a/ZRCola/res/zrcolagui.cpp +++ b/ZRCola/res/zrcolagui.cpp @@ -137,10 +137,10 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS wxMenuItem* m_menuTranslationSeqItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("Tra&nslation"), wxEmptyString, wxITEM_NORMAL, m_menuTranslationSeq ); m_menuEdit->Append( m_menuTranslationSeqItem ); - m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION_MENU, wxString( _("&ZRCola (De)composition") ) , _("Toggle ZRCola character (De)composition"), wxITEM_CHECK ); + m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION, 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_menuItemWarnPUA = new wxMenuItem( m_menuEdit, wxID_WARN_PUA, wxString( _("&PUA Warning") ) , _("Toggle PUA warning"), wxITEM_CHECK ); m_menuEdit->Append( m_menuItemWarnPUA ); m_menuEdit->AppendSeparator(); @@ -220,9 +220,9 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS m_toolTranslationSeq = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, wxSize( 240,-1 ), m_toolTranslationSeqChoices, 0 ); m_toolTranslationSeq->SetSelection( 0 ); 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_toolComposition = m_toolbarTranslate->AddTool( wxID_COMPOSITION, _("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_toolWarnPUA = m_toolbarTranslate->AddTool( wxID_WARN_PUA, _("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() ); diff --git a/ZRCola/res/zrcolagui.h b/ZRCola/res/zrcolagui.h index 3122312..3f4b8ac 100644 --- a/ZRCola/res/zrcolagui.h +++ b/ZRCola/res/zrcolagui.h @@ -67,8 +67,8 @@ class wxZRColaFrameBase : public wxFrame wxID_SEND_SOURCE, wxID_COPY_SOURCE_AND_RETURN, wxID_SEND_ABORT, - wxID_COMPOSITION_MENU, - wxID_WARN_PUA_MENU, + wxID_COMPOSITION, + wxID_WARN_PUA, wxID_SETTINGS, wxID_TOOLBAR_EDIT, wxID_TOOLBAR_TRANSLATE, @@ -76,9 +76,7 @@ class wxZRColaFrameBase : public wxFrame wxID_HELP_INSTRUCTIONS, wxID_HELP_SHORTCUTS, wxID_HELP_REQCHAR, - wxID_HELP_UPDATE, - wxID_COMPOSITION_TOOLBAR, - wxID_WARN_PUA_TOOLBAR + wxID_HELP_UPDATE }; wxMenuBar* m_menubar; diff --git a/ZRCola/zrcolafrm.cpp b/ZRCola/zrcolafrm.cpp index abb6849..7cc73bd 100644 --- a/ZRCola/zrcolafrm.cpp +++ b/ZRCola/zrcolafrm.cpp @@ -42,10 +42,8 @@ wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase) EVT_MENU (wxID_SEND_SOURCE , wxZRColaFrame::OnSendSource ) EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort ) - 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 (wxID_COMPOSITION , wxZRColaFrame::OnComposition ) + EVT_MENU (wxID_WARN_PUA , wxZRColaFrame::OnWarnPUA ) EVT_MENU_RANGE (wxID_TRANSLATION_SEQ_DEFAULT, wxID_TRANSLATION_SEQ_END, wxZRColaFrame::OnTranslationSeqMenu ) EVT_MENU (wxID_SETTINGS , wxZRColaFrame::OnSettings ) @@ -354,9 +352,10 @@ void wxZRColaFrame::OnSendAbort(wxCommandEvent& event) } -void wxZRColaFrame::OnCompositionMenu(wxCommandEvent& event) +void wxZRColaFrame::OnComposition(wxCommandEvent& event) { - m_composition = m_menuItemComposition->IsChecked(); + m_composition = !m_composition; + m_menuItemComposition->Check(m_composition); m_toolComposition->SetState((m_toolComposition->GetState() & ~wxAUI_BUTTON_STATE_CHECKED) | (m_composition ? wxAUI_BUTTON_STATE_CHECKED : 0)); m_toolbarTranslate->Refresh(); @@ -368,41 +367,16 @@ void wxZRColaFrame::OnCompositionMenu(wxCommandEvent& event) } -void wxZRColaFrame::OnCompositionToolbar(wxCommandEvent& event) +void wxZRColaFrame::OnWarnPUA(wxCommandEvent& event) { - m_composition = (m_toolComposition->GetState() & wxAUI_BUTTON_STATE_CHECKED) ? true : false; - m_menuItemComposition->Check(m_composition); - - // 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::OnWarnPUAMenu(wxCommandEvent& event) -{ - m_warnPUA = m_menuItemWarnPUA->IsChecked(); + m_warnPUA = !m_warnPUA; + m_menuItemWarnPUA->Check(m_warnPUA); 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. + // Notify destination text something changed and should re-paint. 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); + m_panel->m_destination->ProcessWindowEvent(event2); event.Skip(); } diff --git a/ZRCola/zrcolafrm.h b/ZRCola/zrcolafrm.h index 694ebec..0101df1 100644 --- a/ZRCola/zrcolafrm.h +++ b/ZRCola/zrcolafrm.h @@ -90,10 +90,8 @@ protected: void OnSendSource(wxCommandEvent& event); void OnCopySourceAndReturn(wxCommandEvent& event); void OnSendAbort(wxCommandEvent& event); - void OnCompositionMenu(wxCommandEvent& event); - void OnCompositionToolbar(wxCommandEvent& event); - void OnWarnPUAMenu(wxCommandEvent& event); - void OnWarnPUAToolbar(wxCommandEvent& event); + void OnComposition(wxCommandEvent& event); + void OnWarnPUA(wxCommandEvent& event); void OnSettings(wxCommandEvent& event); virtual void OnIdle(wxIdleEvent& event); void OnTaskbarIconClick(wxTaskBarIconEvent& event); diff --git a/ZRCola/zrcolagui.cpp b/ZRCola/zrcolagui.cpp index 0e1fb15..f03fe3b 100644 --- a/ZRCola/zrcolagui.cpp +++ b/ZRCola/zrcolagui.cpp @@ -137,10 +137,10 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS wxMenuItem* m_menuTranslationSeqItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("Tra&nslation"), wxEmptyString, wxITEM_NORMAL, m_menuTranslationSeq ); m_menuEdit->Append( m_menuTranslationSeqItem ); - m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION_MENU, wxString( _("&ZRCola (De)composition") ) , _("Toggle ZRCola character (De)composition"), wxITEM_CHECK ); + m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION, 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_menuItemWarnPUA = new wxMenuItem( m_menuEdit, wxID_WARN_PUA, wxString( _("&PUA Warning") ) , _("Toggle PUA warning"), wxITEM_CHECK ); m_menuEdit->Append( m_menuItemWarnPUA ); m_menuEdit->AppendSeparator(); @@ -220,9 +220,9 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS m_toolTranslationSeq = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, FromDIP(wxSize( 240,-1 )), m_toolTranslationSeqChoices, 0 ); m_toolTranslationSeq->SetSelection( 0 ); 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_toolComposition = m_toolbarTranslate->AddTool( wxID_COMPOSITION, _("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_toolWarnPUA = m_toolbarTranslate->AddTool( wxID_WARN_PUA, _("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() ); diff --git a/ZRCola/zrcolagui.h b/ZRCola/zrcolagui.h index 18f0594..6c5c118 100644 --- a/ZRCola/zrcolagui.h +++ b/ZRCola/zrcolagui.h @@ -67,8 +67,8 @@ class wxZRColaFrameBase : public wxFrame wxID_SEND_SOURCE, wxID_COPY_SOURCE_AND_RETURN, wxID_SEND_ABORT, - wxID_COMPOSITION_MENU, - wxID_WARN_PUA_MENU, + wxID_COMPOSITION, + wxID_WARN_PUA, wxID_SETTINGS, wxID_TOOLBAR_EDIT, wxID_TOOLBAR_TRANSLATE, @@ -76,9 +76,7 @@ class wxZRColaFrameBase : public wxFrame wxID_HELP_INSTRUCTIONS, wxID_HELP_SHORTCUTS, wxID_HELP_REQCHAR, - wxID_HELP_UPDATE, - wxID_COMPOSITION_TOOLBAR, - wxID_WARN_PUA_TOOLBAR + wxID_HELP_UPDATE }; wxMenuBar* m_menubar;