diff --git a/ZRCola/ZRCola.fbp b/ZRCola/ZRCola.fbp index 9131ae9..482161d 100644 --- a/ZRCola/ZRCola.fbp +++ b/ZRCola/ZRCola.fbp @@ -9,7 +9,7 @@ 0 0 res - UTF-8 + ANSI connect zrcolagui 1000 @@ -41,10 +41,10 @@ 0 wxID_ANY - 100,100 + 150,150 wxZRColaFrameBase - 500,200 + 600,400 wxDEFAULT_FRAME_STYLE ZRCola @@ -88,6 +88,252 @@ + + + + 1 + 1 + + + 0 + wxID_ANY + Menu + + + m_menubar + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &File + m_menuFile + protected + + + 0 + 1 + + wxID_EXIT + wxITEM_NORMAL + E&xit + m_menuItemExit + none + Alt+F4 + + + + + + + &Accents + m_menuAccents + protected + + + 0 + 1 + + wxID_INSERT_GRAVE + wxITEM_NORMAL + Grave &7 + m_menuItemGrave + none + + + + + + + + 0 + 1 + + wxID_INSERT_ACUTE + wxITEM_NORMAL + Acute &9 + m_menuItemAcute + none + + + + + + + + 0 + 1 + + wxID_INSERT_CIRCUMFLEX + wxITEM_NORMAL + Circumflex &3 + m_menuItemCircumflex + none + + + + + + + m_separator2 + none + + + + 0 + 1 + + wxID_INSERT_INV_BREVE_BELOW + wxITEM_NORMAL + Inverted &breve + m_menuItemInvBreveBelow + none + + + + + + + + &Help + m_menuHelp + protected + + + 0 + 1 + + wxID_ABOUT + wxITEM_NORMAL + &About + m_menuItemAbout + none + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 100 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + wxZRColaComposerPanel + 1 + m_panel = new wxZRColaComposerPanel( this ); + + 1 + wxZRColaComposerPanel* m_panel; + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + #include "zrcolacomppnl.h" + + 0 + + + 0 + + 1 + m_panel + 1 + + + protected + 1 + + Resizable + + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 @@ -184,7 +430,7 @@ 0 - + 100,25 1 m_decomposed 1 @@ -275,7 +521,7 @@ 0 - + 100,25 1 m_composed 1 diff --git a/ZRCola/zrcolaapp.h b/ZRCola/zrcolaapp.h index 7e47da8..8e4eb31 100644 --- a/ZRCola/zrcolaapp.h +++ b/ZRCola/zrcolaapp.h @@ -17,6 +17,12 @@ along with ZRCola. If not, see . */ +/// +/// Forward declarations +/// +class ZRColaApp; + + #pragma once #include diff --git a/ZRCola/zrcolacomppnl.h b/ZRCola/zrcolacomppnl.h index 6296afe..a7f13b3 100644 --- a/ZRCola/zrcolacomppnl.h +++ b/ZRCola/zrcolacomppnl.h @@ -17,6 +17,12 @@ along with ZRCola. If not, see . */ +/// +/// Forward declarations +/// +class wxZRColaComposerPanel; + + #pragma once #include "zrcolagui.h" diff --git a/ZRCola/zrcolafrm.cpp b/ZRCola/zrcolafrm.cpp index 90686e4..8f1d926 100644 --- a/ZRCola/zrcolafrm.cpp +++ b/ZRCola/zrcolafrm.cpp @@ -27,11 +27,16 @@ wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase) EVT_UPDATE_UI_RANGE(wxZRColaFrame::wxID_SEND, wxZRColaFrame::wxID_SEND_DECOMPOSED, wxZRColaFrame::OnSendUpdate) - EVT_MENU(wxZRColaFrame::wxID_SEND , wxZRColaFrame::OnSend ) - EVT_MENU(wxZRColaFrame::wxID_SEND_COMPOSED , wxZRColaFrame::OnSendComposed ) - EVT_MENU(wxZRColaFrame::wxID_SEND_DECOMPOSED, wxZRColaFrame::OnSendDecomposed) - EVT_MENU(wxZRColaFrame::wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort ) - EVT_MENU( wxID_ABOUT , wxZRColaFrame::OnAbout ) + EVT_MENU(wxZRColaFrame::wxID_SEND , wxZRColaFrame::OnSend ) + EVT_MENU(wxZRColaFrame::wxID_SEND_COMPOSED , wxZRColaFrame::OnSendComposed ) + EVT_MENU(wxZRColaFrame::wxID_SEND_DECOMPOSED , wxZRColaFrame::OnSendDecomposed ) + EVT_MENU(wxZRColaFrame::wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort ) + EVT_MENU( wxID_EXIT , wxZRColaFrame::OnExit ) + EVT_MENU( wxID_INSERT_GRAVE , wxZRColaFrame::OnInsertGrave ) + EVT_MENU( wxID_INSERT_ACUTE , wxZRColaFrame::OnInsertAcute ) + EVT_MENU( wxID_INSERT_CIRCUMFLEX , wxZRColaFrame::OnInsertCircumflex ) + EVT_MENU( wxID_INSERT_INV_BREVE_BELOW, wxZRColaFrame::OnInsertInvertedBreveBelow) + EVT_MENU( wxID_ABOUT , wxZRColaFrame::OnAbout ) wxEND_EVENT_TABLE() @@ -50,8 +55,7 @@ wxZRColaFrame::wxZRColaFrame() : SetIcon(wxICON(00_zrcola.ico)); #endif - // Create the composer panel. - m_panel = new wxZRColaComposerPanel(this); + m_panel->m_decomposed->SetFocus(); // Register global hotkey(s). if (!RegisterHotKey(wxZRColaHKID_INVOKE_COMPOSE, MOD_ALT | MOD_CONTROL, 'Z')) @@ -183,6 +187,36 @@ void wxZRColaFrame::OnSendAbort(wxCommandEvent& event) } +void wxZRColaFrame::OnExit(wxCommandEvent& event) +{ + Close(); +} + + +void wxZRColaFrame::OnInsertGrave(wxCommandEvent& event) +{ + m_panel->m_decomposed->WriteText(L"\xE000"); +} + + +void wxZRColaFrame::OnInsertAcute(wxCommandEvent& event) +{ + m_panel->m_decomposed->WriteText(L"\xE001"); +} + + +void wxZRColaFrame::OnInsertCircumflex(wxCommandEvent& event) +{ + m_panel->m_decomposed->WriteText(L"\xE002"); +} + + +void wxZRColaFrame::OnInsertInvertedBreveBelow(wxCommandEvent& event) +{ + m_panel->m_decomposed->WriteText(L"\xE02F"); +} + + void wxZRColaFrame::OnAbout(wxCommandEvent& event) { wxMessageBox(wxString::Format(_("ZRCola v%s\nCopyright 2015-%s Amebis"), wxT(ZRCOLA_VERSION_STR), wxT(ZRCOLA_BUILD_YEAR_STR)), _("About ZRCola"), wxOK | wxICON_INFORMATION); diff --git a/ZRCola/zrcolafrm.h b/ZRCola/zrcolafrm.h index 0ea4027..a28c948 100644 --- a/ZRCola/zrcolafrm.h +++ b/ZRCola/zrcolafrm.h @@ -17,10 +17,16 @@ along with ZRCola. If not, see . */ + +/// +/// Forward declarations +/// +class wxZRColaFrame; + + #pragma once #include "zrcolagui.h" -#include "zrcolacomppnl.h" /// @@ -53,6 +59,11 @@ protected: void OnSendComposed(wxCommandEvent& event); void OnSendDecomposed(wxCommandEvent& event); void OnSendAbort(wxCommandEvent& event); + void OnExit(wxCommandEvent& event); + void OnInsertGrave(wxCommandEvent& event); + void OnInsertAcute(wxCommandEvent& event); + void OnInsertCircumflex(wxCommandEvent& event); + void OnInsertInvertedBreveBelow(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); wxDECLARE_EVENT_TABLE(); @@ -62,5 +73,4 @@ protected: protected: WXHWND m_hWndSource; ///< handle of the active window, when the ZRCola hotkey was pressed int m_hotkey; ///< hotkey ID that was pressed - wxZRColaComposerPanel *m_panel; ///< composer panel }; diff --git a/ZRCola/zrcolagui.cpp b/ZRCola/zrcolagui.cpp index 76d5e53..6c853eb 100644 --- a/ZRCola/zrcolagui.cpp +++ b/ZRCola/zrcolagui.cpp @@ -24,8 +24,56 @@ static wxFBContextSensitiveHelpSetter s_wxFBSetTheHelpProvider; wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 100,100 ), wxDefaultSize ); + this->SetSizeHints( wxSize( 150,150 ), wxDefaultSize ); + m_menubar = new wxMenuBar( 0 ); + m_menuFile = new wxMenu(); + wxMenuItem* m_menuItemExit; + m_menuItemExit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("E&xit") ) + wxT('\t') + wxT("Alt+F4"), wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemExit ); + + m_menubar->Append( m_menuFile, _("&File") ); + + m_menuAccents = new wxMenu(); + wxMenuItem* m_menuItemGrave; + m_menuItemGrave = new wxMenuItem( m_menuAccents, wxID_INSERT_GRAVE, wxString( _("Grave\t&7") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuAccents->Append( m_menuItemGrave ); + + wxMenuItem* m_menuItemAcute; + m_menuItemAcute = new wxMenuItem( m_menuAccents, wxID_INSERT_ACUTE, wxString( _("Acute\t&9") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuAccents->Append( m_menuItemAcute ); + + wxMenuItem* m_menuItemCircumflex; + m_menuItemCircumflex = new wxMenuItem( m_menuAccents, wxID_INSERT_CIRCUMFLEX, wxString( _("Circumflex\t&3") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuAccents->Append( m_menuItemCircumflex ); + + m_menuAccents->AppendSeparator(); + + wxMenuItem* m_menuItemInvBreveBelow; + m_menuItemInvBreveBelow = new wxMenuItem( m_menuAccents, wxID_INSERT_INV_BREVE_BELOW, wxString( _("Inverted &breve") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuAccents->Append( m_menuItemInvBreveBelow ); + + m_menubar->Append( m_menuAccents, _("&Accents") ); + + m_menuHelp = new wxMenu(); + wxMenuItem* m_menuItemAbout; + m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemAbout ); + + m_menubar->Append( m_menuHelp, _("&Help") ); + + this->SetMenuBar( m_menubar ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + m_panel = new wxZRColaComposerPanel( this ); + + bSizerMain->Add( m_panel, 100, wxEXPAND, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); this->Centre( wxBOTH ); } @@ -41,11 +89,13 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow m_decomposed = new wxTextCtrl( this, wxID_DECOMPOSED, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE ); m_decomposed->SetFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) ); + m_decomposed->SetMinSize( wxSize( 100,25 ) ); bSizerEditor->Add( m_decomposed, 50, wxALL|wxEXPAND, 5 ); m_composed = new wxTextCtrl( this, wxID_COMPOSED, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE ); m_composed->SetFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) ); + m_composed->SetMinSize( wxSize( 100,25 ) ); bSizerEditor->Add( m_composed, 50, wxALL|wxEXPAND, 5 ); diff --git a/ZRCola/zrcolagui.h b/ZRCola/zrcolagui.h index 38e5f58..d25b6a3 100644 --- a/ZRCola/zrcolagui.h +++ b/ZRCola/zrcolagui.h @@ -13,13 +13,18 @@ #include #include #include -#include +#include +#include +#include +#include #include #include #include #include -#include +#include "zrcolacomppnl.h" #include +#include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -32,10 +37,23 @@ class wxZRColaFrameBase : public wxFrame private: protected: + enum + { + wxID_INSERT_GRAVE = 1000, + wxID_INSERT_ACUTE, + wxID_INSERT_CIRCUMFLEX, + wxID_INSERT_INV_BREVE_BELOW + }; + + wxMenuBar* m_menubar; + wxMenu* m_menuFile; + wxMenu* m_menuAccents; + wxMenu* m_menuHelp; + wxZRColaComposerPanel* m_panel; public: - wxZRColaFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("ZRCola"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,200 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + wxZRColaFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("ZRCola"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,400 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); ~wxZRColaFrameBase();