This commit is contained in:
Simon Rozman 2021-04-02 13:58:52 +02:00
parent 34e409ef2f
commit bc4b6b30d1
7 changed files with 30 additions and 62 deletions

View File

@ -258,7 +258,7 @@
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Toggle ZRCola character (De)composition</property>
<property name="id">wxID_COMPOSITION_MENU</property>
<property name="id">wxID_COMPOSITION</property>
<property name="kind">wxITEM_CHECK</property>
<property name="label">&amp;ZRCola (De)composition</property>
<property name="name">m_menuItemComposition</property>
@ -271,7 +271,7 @@
<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="id">wxID_WARN_PUA</property>
<property name="kind">wxITEM_CHECK</property>
<property name="label">&amp;PUA Warning</property>
<property name="name">m_menuItemWarnPUA</property>
@ -675,7 +675,7 @@
<object class="tool" expanded="0">
<property name="bitmap">Load From Icon Resource; composition.ico; [24; 24]</property>
<property name="context_menu">0</property>
<property name="id">wxID_COMPOSITION_TOOLBAR</property>
<property name="id">wxID_COMPOSITION</property>
<property name="kind">wxITEM_CHECK</property>
<property name="label">ZRCola (De)composition</property>
<property name="name">m_toolComposition</property>
@ -686,7 +686,7 @@
<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="id">wxID_WARN_PUA</property>
<property name="kind">wxITEM_CHECK</property>
<property name="label">PUA Warning</property>
<property name="name">m_toolWarnPUA</property>

View File

@ -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() );

View File

@ -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;

View File

@ -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();
}

View File

@ -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);

View File

@ -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() );

View File

@ -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;