From b7533d4b2776daa43993fd416d395088c7e04418 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 26 Apr 2016 16:05:42 +0200 Subject: [PATCH] Character selector feature skeleton added --- ZRCola/ZRCola.fbp | 982 ++++++++++++++++++++++++++++++++++ ZRCola/ZRCola.vcxproj | 2 + ZRCola/ZRCola.vcxproj.filters | 6 + ZRCola/locale/sl_SI.po | 98 ++-- ZRCola/stdafx.h | 1 + ZRCola/zrcolachrslct.cpp | 89 +++ ZRCola/zrcolachrslct.h | 59 ++ ZRCola/zrcolafrm.cpp | 15 + ZRCola/zrcolafrm.h | 7 +- ZRCola/zrcolagui.cpp | 277 ++++++++++ ZRCola/zrcolagui.h | 42 +- 11 files changed, 1545 insertions(+), 33 deletions(-) create mode 100644 ZRCola/zrcolachrslct.cpp create mode 100644 ZRCola/zrcolachrslct.h diff --git a/ZRCola/ZRCola.fbp b/ZRCola/ZRCola.fbp index e714be4..d0ea708 100644 --- a/ZRCola/ZRCola.fbp +++ b/ZRCola/ZRCola.fbp @@ -225,6 +225,25 @@ m_separatorEdit2 none + + + 0 + 1 + Display character selector to select character to insert into text + wxID_INSERT_CHARACTER + wxITEM_NORMAL + &Insert Character... + m_menuInsertCharacter + none + F8 + + + + + + m_separatorEdit3 + none + Load From Icon Resource; send_composed.ico; [16; 16] 0 @@ -1776,5 +1795,968 @@ + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + wxZRColaCharSelectBase + + + wxDEFAULT_DIALOG_STYLE + + Character Selector + + + ZRColaCharSelect + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerContent + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerColumns + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizerLeft + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + &Browse + + sbSizerBrowse + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + 1 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_search + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnSearchText + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + 00 ZRCola,90,90,20,70,0 + wxALIGN_CENTRE + + wxALIGN_CENTRE + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 16 + 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35 + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + ,90,90,-1,70,0 + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_gridResults + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 35,35,35,35,35,35,35,35,35,35 + 10 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnResultSelectCell + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Re&cently Used + + sbSizerRecent + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + 00 ZRCola,90,90,20,70,0 + wxALIGN_CENTRE + + wxALIGN_CENTRE + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 16 + 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35 + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + ,90,90,-1,70,0 + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_gridRecent + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 35 + 1 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnRecentSelectCell + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerRight + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + &Unicode + + sbSizerUnicode + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 4 + + 0 + + 1 + m_unicode + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_CENTRE + + 0 + + wxString + wxFILTER_INCLUDE_CHAR_LIST + wxTextValidator + m_unicodeValid + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUnicodeText + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Preview + + sbSizerPreview + wxVERTICAL + none + + + 5 + wxALIGN_CENTER|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + 00 ZRCola,90,90,180,70,0 + wxALIGN_CENTRE + + wxALIGN_CENTRE + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 1 + 250 + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + + + 0 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_gridPreview + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 250 + 1 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Re&lated + + sbSizerRelated + wxVERTICAL + none + + + 5 + wxALIGN_CENTER|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + 00 ZRCola,90,90,20,70,0 + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 7 + 35,35,35,35,35,35,35 + + 1 + 0 + Dock + 0 + Left + 0 + 0 + 0 + 0 + 0 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_gridRelated + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + 35,35,35 + 3 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnRelatedSelectCell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 5 + protected + 5 + + + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizerButtons + protected + + + + + + + + + + + + diff --git a/ZRCola/ZRCola.vcxproj b/ZRCola/ZRCola.vcxproj index 2509f21..6b72a78 100644 --- a/ZRCola/ZRCola.vcxproj +++ b/ZRCola/ZRCola.vcxproj @@ -81,6 +81,7 @@ Create + @@ -89,6 +90,7 @@ + diff --git a/ZRCola/ZRCola.vcxproj.filters b/ZRCola/ZRCola.vcxproj.filters index 0e7ebea..20a3aee 100644 --- a/ZRCola/ZRCola.vcxproj.filters +++ b/ZRCola/ZRCola.vcxproj.filters @@ -37,6 +37,9 @@ Source Files + + Source Files + @@ -57,6 +60,9 @@ Header Files + + Header Files + diff --git a/ZRCola/locale/sl_SI.po b/ZRCola/locale/sl_SI.po index f626042..fb55a00 100644 --- a/ZRCola/locale/sl_SI.po +++ b/ZRCola/locale/sl_SI.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: ZRCola\n" -"POT-Creation-Date: 2016-04-23 22:20+0200\n" -"PO-Revision-Date: 2016-04-23 22:22+0200\n" +"POT-Creation-Date: 2016-04-23 22:24+0200\n" +"PO-Revision-Date: 2016-04-23 22:24+0200\n" "Last-Translator: Simon Rozman \n" "Language-Team: Amebis, d. o. o., Kamnik \n" "Language: sl_SI\n" @@ -17,12 +17,12 @@ msgstr "" "X-Poedit-KeywordsList: _\n" "X-Poedit-SearchPath-0: .\n" -#: zrcolafrm.cpp:70 +#: zrcolafrm.cpp:73 #, c-format msgid "Select %s language for decomposition" msgstr "Izberi jezik %s za razstavljanje" -#: zrcolafrm.cpp:81 +#: zrcolafrm.cpp:87 msgid "" "ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality " "will not be available." @@ -30,11 +30,11 @@ msgstr "" "ZRColine bližnjice na tipkovnici Win+F5 ni mogoče registrirati. Nekaj " "funkcionalnosti ne bo na voljo." -#: zrcolafrm.cpp:81 zrcolafrm.cpp:83 +#: zrcolafrm.cpp:87 zrcolafrm.cpp:89 msgid "Warning" msgstr "Opozorilo" -#: zrcolafrm.cpp:83 +#: zrcolafrm.cpp:89 msgid "" "ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality " "will not be available." @@ -42,7 +42,7 @@ msgstr "" "ZRColine bližnjice na tipkovnici Win+F6 ni mogoče registrirati. Nekaj " "funkcionalnosti ne bo na voljo." -#: zrcolafrm.cpp:205 +#: zrcolafrm.cpp:220 #, c-format msgid "" "ZRCola v%s\n" @@ -51,7 +51,7 @@ msgstr "" "ZRCola v%s\n" "Vse pravice pridržane 2015-%s Amebis" -#: zrcolafrm.cpp:205 +#: zrcolafrm.cpp:220 msgid "About ZRCola" msgstr "O ZRColi" @@ -76,100 +76,132 @@ msgid "Select all text" msgstr "Izberi celotno besedilo" #: zrcolagui.cpp:74 +msgid "&Insert Character..." +msgstr "Vstav&i znak ..." + +#: zrcolagui.cpp:74 +msgid "Display character selector to select character to insert into text" +msgstr "Prikaži izbirnik znaka za izbor znaka za vstavljanje v besedilo" + +#: zrcolagui.cpp:80 msgid "&Send Composed" msgstr "Pošlji &sestavljeno" -#: zrcolagui.cpp:74 zrcolagui.cpp:125 +#: zrcolagui.cpp:80 zrcolagui.cpp:131 msgid "Send composed text to source window" msgstr "Pošlji sestavljeno besedilo izvornemu oknu" -#: zrcolagui.cpp:83 +#: zrcolagui.cpp:89 msgid "Send &Decomposed" msgstr "Pošlji &razstavljeno" -#: zrcolagui.cpp:83 zrcolagui.cpp:127 +#: zrcolagui.cpp:89 zrcolagui.cpp:133 msgid "Send decomposed text to source window" msgstr "Pošlji razstavljeno besedilo izvornemu oknu" -#: zrcolagui.cpp:92 +#: zrcolagui.cpp:98 msgid "Abort (De)composition" msgstr "Prekini raz/sestavljanje" -#: zrcolagui.cpp:92 +#: zrcolagui.cpp:98 msgid "Abort composition and return focus to source window" msgstr "Prekini sestavljanje in vrni fokus nazaj izvornemu oknu" -#: zrcolagui.cpp:101 +#: zrcolagui.cpp:107 msgid "&Language" msgstr "&Jezik" -#: zrcolagui.cpp:104 +#: zrcolagui.cpp:110 msgid "&Edit" msgstr "Ur&edi" -#: zrcolagui.cpp:111 +#: zrcolagui.cpp:117 msgid "&Help" msgstr "&Pomoč" -#: zrcolagui.cpp:117 +#: zrcolagui.cpp:123 msgid "Cut" msgstr "Izreži" -#: zrcolagui.cpp:117 +#: zrcolagui.cpp:123 msgid "Cut selection" msgstr "Izreži izbor" -#: zrcolagui.cpp:119 +#: zrcolagui.cpp:125 msgid "Copy" msgstr "Kopiraj" -#: zrcolagui.cpp:119 +#: zrcolagui.cpp:125 msgid "Copy selection" msgstr "Kopiraj izbor" -#: zrcolagui.cpp:121 +#: zrcolagui.cpp:127 msgid "Paste" msgstr "Prilepi" -#: zrcolagui.cpp:121 +#: zrcolagui.cpp:127 msgid "Paste selection" msgstr "Prilepi izbor" -#: zrcolagui.cpp:125 +#: zrcolagui.cpp:131 msgid "Send Composed" msgstr "Pošlji sestavljeno" -#: zrcolagui.cpp:127 +#: zrcolagui.cpp:133 msgid "Send Decomposed" msgstr "Pošlji razstavljeno" -#: zrcolagui.cpp:129 +#: zrcolagui.cpp:135 msgid "Language:" msgstr "Jezik:" -#: zrcolagui.cpp:178 +#: zrcolagui.cpp:184 msgid "Decomposed Text" msgstr "Razstavljeno besedilo" -#: zrcolagui.cpp:198 +#: zrcolagui.cpp:204 msgid "Decomposed Unicode Dump" msgstr "Unicode razstavljenega" -#: zrcolagui.cpp:225 +#: zrcolagui.cpp:231 msgid "Composed Text" msgstr "Sestavljeno besedilo" -#: zrcolagui.cpp:245 +#: zrcolagui.cpp:251 msgid "Composed Unicode Dump" msgstr "Unicode sestavljenega" -#: zrcolagui.h:75 MSIBuild/En.Win32.Release.Feature-2.idtx:4 +#: zrcolagui.cpp:308 +msgid "&Browse" +msgstr "Pre&brskaj" + +#: zrcolagui.cpp:376 +msgid "Re¢ly Used" +msgstr "Nedavno &uporabljeni" + +#: zrcolagui.cpp:434 +msgid "&Unicode" +msgstr "&Unicode" + +#: zrcolagui.cpp:446 +msgid "Preview" +msgstr "Predogled" + +#: zrcolagui.cpp:481 +msgid "Re&lated" +msgstr "&Sorodni" + +#: zrcolagui.h:81 MSIBuild/En.Win32.Release.Feature-2.idtx:4 #: MSIBuild/En.Win32.Release.Shortcut-2.idtx:4 #: MSIBuild/En.x64.Release.Feature-2.idtx:4 #: MSIBuild/En.x64.Release.Shortcut-2.idtx:4 msgid "ZRCola" msgstr "ZRCola" +#: zrcolagui.h:163 +msgid "Character Selector" +msgstr "Izbirnik znaka" + # Windows charset for this language (decimal) #: MSIBuild/En.Win32.Release.Feature-2.idtx:3 #: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3 @@ -185,6 +217,12 @@ msgstr "1250" msgid "Input system for linguistic use" msgstr "Vnašalni sistem za jezikoslovno rabo" +#~ msgid "&Results" +#~ msgstr "&Rezultati" + +#~ msgid "&Search" +#~ msgstr "I&skanje" + #~ msgid "&About" #~ msgstr "O progr&amu" diff --git a/ZRCola/stdafx.h b/ZRCola/stdafx.h index 6f92d90..50fde09 100644 --- a/ZRCola/stdafx.h +++ b/ZRCola/stdafx.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/ZRCola/zrcolachrslct.cpp b/ZRCola/zrcolachrslct.cpp new file mode 100644 index 0000000..6593dc5 --- /dev/null +++ b/ZRCola/zrcolachrslct.cpp @@ -0,0 +1,89 @@ +/* + Copyright 2015-2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#include "stdafx.h" + + +////////////////////////////////////////////////////////////////////////// +// wxZRColaCharSelect +////////////////////////////////////////////////////////////////////////// + +wxZRColaCharSelect::wxZRColaCharSelect(wxWindow* parent) : wxZRColaCharSelectBase(parent) +{ + wxTextValidator *validator = dynamic_cast(m_unicode->GetValidator()); + if (validator) + validator->SetCharIncludes(wxT("0123456789ABCDEFabcdef")); +} + + +////////////////////////////////////////////////////////////////////////// +// wxPersistentZRColaCharSelect +////////////////////////////////////////////////////////////////////////// + +wxPersistentZRColaCharSelect::wxPersistentZRColaCharSelect(wxZRColaCharSelect *wnd) : wxPersistentWindow(wnd) +{ +} + + +wxString wxPersistentZRColaCharSelect::GetKind() const +{ + return wxT(wxPERSIST_TLW_KIND); +} + + +void wxPersistentZRColaCharSelect::Save() const +{ + const wxZRColaCharSelect * const wnd = static_cast(GetWindow()); + + // Code copied from wxPersistentTLW::Save() + const wxPoint pos = wnd->GetScreenPosition(); + SaveValue(wxPERSIST_TLW_X, pos.x); + SaveValue(wxPERSIST_TLW_Y, pos.y); +} + + +bool wxPersistentZRColaCharSelect::Restore() +{ + wxZRColaCharSelect * const wnd = static_cast(GetWindow()); + + // Code copied from wxPersistentTLW::Restore() + long + x wxDUMMY_INITIALIZE(-1), + y wxDUMMY_INITIALIZE(-1); + const wxSize size = wnd->GetSize(); + const bool hasPos = RestoreValue(wxPERSIST_TLW_X, &x) && + RestoreValue(wxPERSIST_TLW_Y, &y); + + if (hasPos) { + // to avoid making the window completely invisible if it had been + // shown on a monitor which was disconnected since the last run + // (this is pretty common for notebook with external displays) + // + // NB: we should allow window position to be (slightly) off screen, + // it's not uncommon to position the window so that its upper + // left corner has slightly negative coordinate + if (wxDisplay::GetFromPoint(wxPoint(x , y )) != wxNOT_FOUND || + wxDisplay::GetFromPoint(wxPoint(x + size.x, y + size.y)) != wxNOT_FOUND) + { + wnd->Move(x, y, wxSIZE_ALLOW_MINUS_ONE); + } + } + + return true; +} diff --git a/ZRCola/zrcolachrslct.h b/ZRCola/zrcolachrslct.h new file mode 100644 index 0000000..48d765e --- /dev/null +++ b/ZRCola/zrcolachrslct.h @@ -0,0 +1,59 @@ +/* + Copyright 2015-2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + + +/// +/// Forward declarations +/// +class wxZRColaCharSelect; + + +#pragma once + +#include "zrcolagui.h" + + +/// +/// ZRCola character select dialog +/// +class wxZRColaCharSelect : public wxZRColaCharSelectBase +{ +public: + wxZRColaCharSelect(wxWindow* parent); +}; + + +/// +/// Supports saving/restoring wxZRColaCharSelect state +/// +class wxPersistentZRColaCharSelect : public wxPersistentWindow +{ +public: + wxPersistentZRColaCharSelect(wxZRColaCharSelect *wnd); + + virtual wxString GetKind() const; + virtual void Save() const; + virtual bool Restore(); +}; + + +inline wxPersistentObject *wxCreatePersistentObject(wxZRColaCharSelect *wnd) +{ + return new wxPersistentZRColaCharSelect(wnd); +} diff --git a/ZRCola/zrcolafrm.cpp b/ZRCola/zrcolafrm.cpp index d689b0a..5994863 100644 --- a/ZRCola/zrcolafrm.cpp +++ b/ZRCola/zrcolafrm.cpp @@ -30,6 +30,8 @@ wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase) EVT_UPDATE_UI(wxID_SELECTALL, wxZRColaFrame::OnForwardEventUpdate) EVT_MENU(wxID_SELECTALL, wxZRColaFrame::OnForwardEvent) + EVT_MENU(wxID_INSERT_CHARACTER, wxZRColaFrame::OnInsertCharacter) + EVT_UPDATE_UI_RANGE(wxID_SEND_COMPOSED, wxID_SEND_ABORT, wxZRColaFrame::OnSendUpdate) EVT_MENU(wxID_SEND_COMPOSED , wxZRColaFrame::OnSendComposed ) EVT_MENU(wxID_SEND_DECOMPOSED, wxZRColaFrame::OnSendDecomposed ) @@ -45,6 +47,7 @@ wxEND_EVENT_TABLE() wxZRColaFrame::wxZRColaFrame() : m_hWndSource(NULL), + m_chrSelect(NULL), wxZRColaFrameBase(NULL) { // Load main window icons. @@ -76,6 +79,9 @@ wxZRColaFrame::wxZRColaFrame() : // Set focus. m_panel->m_decomposed->SetFocus(); + m_chrSelect = new wxZRColaCharSelect(this); + wxPersistentRegisterAndRestore(m_chrSelect); + // Register global hotkey(s). if (!RegisterHotKey(wxZRColaHKID_INVOKE_COMPOSE, wxMOD_WIN, VK_F5)) wxMessageBox(_("ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING); @@ -89,6 +95,9 @@ wxZRColaFrame::~wxZRColaFrame() // Unregister global hotkey(s). UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE); UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE); + + if (m_chrSelect) + delete m_chrSelect; } @@ -112,6 +121,12 @@ void wxZRColaFrame::OnForwardEvent(wxCommandEvent& event) } +void wxZRColaFrame::OnInsertCharacter(wxCommandEvent& event) +{ + m_chrSelect->ShowModal(); +} + + void wxZRColaFrame::OnSendUpdate(wxUpdateUIEvent& event) { event.Enable(m_hWndSource ? true : false); diff --git a/ZRCola/zrcolafrm.h b/ZRCola/zrcolafrm.h index b960062..02524ba 100644 --- a/ZRCola/zrcolafrm.h +++ b/ZRCola/zrcolafrm.h @@ -27,6 +27,7 @@ class wxZRColaFrame; #pragma once #include "zrcolagui.h" +#include "zrcolachrslct.h" #include #include @@ -56,6 +57,7 @@ public: protected: void OnForwardEventUpdate(wxUpdateUIEvent& event); void OnForwardEvent(wxCommandEvent& event); + void OnInsertCharacter(wxCommandEvent& event); void OnSendUpdate(wxUpdateUIEvent& event); void OnSendComposed(wxCommandEvent& event); void OnSendDecomposed(wxCommandEvent& event); @@ -77,8 +79,9 @@ protected: virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); protected: - ZRCola::langid_t m_lang; ///< Language for decomposing - WXHWND m_hWndSource; ///< handle of the active window, when the ZRCola hotkey was pressed + ZRCola::langid_t m_lang; ///< Language for decomposing + WXHWND m_hWndSource; ///< handle of the active window, when the ZRCola hotkey was pressed + wxZRColaCharSelect *m_chrSelect; ///< Character selection dialog }; diff --git a/ZRCola/zrcolagui.cpp b/ZRCola/zrcolagui.cpp index af7196e..1bc6ca2 100644 --- a/ZRCola/zrcolagui.cpp +++ b/ZRCola/zrcolagui.cpp @@ -70,6 +70,12 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS m_menuEdit->AppendSeparator(); + wxMenuItem* m_menuInsertCharacter; + m_menuInsertCharacter = new wxMenuItem( m_menuEdit, wxID_INSERT_CHARACTER, wxString( _("&Insert Character...") ) + wxT('\t') + wxT("F8"), _("Display character selector to select character to insert into text"), wxITEM_NORMAL ); + m_menuEdit->Append( m_menuInsertCharacter ); + + m_menuEdit->AppendSeparator(); + wxMenuItem* m_menuItemSendComposed; m_menuItemSendComposed = new wxMenuItem( m_menuEdit, wxID_SEND_COMPOSED, wxString( _("&Send Composed") ) + wxT('\t') + wxT("F5"), _("Send composed text to source window"), wxITEM_NORMAL ); #ifdef __WXMSW__ @@ -284,3 +290,274 @@ wxZRColaComposerPanelBase::~wxZRColaComposerPanelBase() m_composedHex->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnComposedHexPaint ), NULL, this ); } + +wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( parent, id, title, pos, size, style, name ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerContent; + bSizerContent = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerColumns; + bSizerColumns = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerLeft; + bSizerLeft = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerBrowse; + sbSizerBrowse = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("&Browse") ), wxVERTICAL ); + + m_search = new wxSearchCtrl( sbSizerBrowse->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + #ifndef __WXMAC__ + m_search->ShowSearchButton( true ); + #endif + m_search->ShowCancelButton( true ); + sbSizerBrowse->Add( m_search, 0, wxALL|wxEXPAND, 5 ); + + m_gridResults = new wxGrid( sbSizerBrowse->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridResults->CreateGrid( 10, 16 ); + m_gridResults->EnableEditing( false ); + m_gridResults->EnableGridLines( true ); + m_gridResults->EnableDragGridSize( false ); + m_gridResults->SetMargins( 0, 0 ); + + // Columns + m_gridResults->SetColSize( 0, 35 ); + m_gridResults->SetColSize( 1, 35 ); + m_gridResults->SetColSize( 2, 35 ); + m_gridResults->SetColSize( 3, 35 ); + m_gridResults->SetColSize( 4, 35 ); + m_gridResults->SetColSize( 5, 35 ); + m_gridResults->SetColSize( 6, 35 ); + m_gridResults->SetColSize( 7, 35 ); + m_gridResults->SetColSize( 8, 35 ); + m_gridResults->SetColSize( 9, 35 ); + m_gridResults->SetColSize( 10, 35 ); + m_gridResults->SetColSize( 11, 35 ); + m_gridResults->SetColSize( 12, 35 ); + m_gridResults->SetColSize( 13, 35 ); + m_gridResults->SetColSize( 14, 35 ); + m_gridResults->SetColSize( 15, 35 ); + m_gridResults->EnableDragColMove( false ); + m_gridResults->EnableDragColSize( false ); + m_gridResults->SetColLabelSize( 0 ); + m_gridResults->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridResults->SetRowSize( 0, 35 ); + m_gridResults->SetRowSize( 1, 35 ); + m_gridResults->SetRowSize( 2, 35 ); + m_gridResults->SetRowSize( 3, 35 ); + m_gridResults->SetRowSize( 4, 35 ); + m_gridResults->SetRowSize( 5, 35 ); + m_gridResults->SetRowSize( 6, 35 ); + m_gridResults->SetRowSize( 7, 35 ); + m_gridResults->SetRowSize( 8, 35 ); + m_gridResults->SetRowSize( 9, 35 ); + m_gridResults->EnableDragRowSize( false ); + m_gridResults->SetRowLabelSize( 0 ); + m_gridResults->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridResults->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) ); + m_gridResults->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + m_gridResults->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) ); + + sbSizerBrowse->Add( m_gridResults, 0, wxALL|wxEXPAND, 5 ); + + + bSizerLeft->Add( sbSizerBrowse, 0, wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerRecent; + sbSizerRecent = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Re¢ly Used") ), wxVERTICAL ); + + m_gridRecent = new wxGrid( sbSizerRecent->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridRecent->CreateGrid( 1, 16 ); + m_gridRecent->EnableEditing( false ); + m_gridRecent->EnableGridLines( true ); + m_gridRecent->EnableDragGridSize( false ); + m_gridRecent->SetMargins( 0, 0 ); + + // Columns + m_gridRecent->SetColSize( 0, 35 ); + m_gridRecent->SetColSize( 1, 35 ); + m_gridRecent->SetColSize( 2, 35 ); + m_gridRecent->SetColSize( 3, 35 ); + m_gridRecent->SetColSize( 4, 35 ); + m_gridRecent->SetColSize( 5, 35 ); + m_gridRecent->SetColSize( 6, 35 ); + m_gridRecent->SetColSize( 7, 35 ); + m_gridRecent->SetColSize( 8, 35 ); + m_gridRecent->SetColSize( 9, 35 ); + m_gridRecent->SetColSize( 10, 35 ); + m_gridRecent->SetColSize( 11, 35 ); + m_gridRecent->SetColSize( 12, 35 ); + m_gridRecent->SetColSize( 13, 35 ); + m_gridRecent->SetColSize( 14, 35 ); + m_gridRecent->SetColSize( 15, 35 ); + m_gridRecent->EnableDragColMove( false ); + m_gridRecent->EnableDragColSize( false ); + m_gridRecent->SetColLabelSize( 0 ); + m_gridRecent->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridRecent->SetRowSize( 0, 35 ); + m_gridRecent->EnableDragRowSize( false ); + m_gridRecent->SetRowLabelSize( 0 ); + m_gridRecent->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridRecent->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) ); + m_gridRecent->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + m_gridRecent->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) ); + + sbSizerRecent->Add( m_gridRecent, 0, wxALL, 5 ); + + + bSizerLeft->Add( sbSizerRecent, 0, wxALL|wxEXPAND, 5 ); + + + bSizerColumns->Add( bSizerLeft, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerRight; + bSizerRight = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerUnicode; + sbSizerUnicode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("&Unicode") ), wxVERTICAL ); + + m_unicode = new wxTextCtrl( sbSizerUnicode->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE ); + m_unicode->SetMaxLength( 4 ); + m_unicode->SetValidator( wxTextValidator( wxFILTER_INCLUDE_CHAR_LIST, &m_unicodeValid ) ); + + sbSizerUnicode->Add( m_unicode, 0, wxALL|wxEXPAND, 5 ); + + + bSizerRight->Add( sbSizerUnicode, 0, wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerPreview; + sbSizerPreview = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Preview") ), wxVERTICAL ); + + m_gridPreview = new wxGrid( sbSizerPreview->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridPreview->CreateGrid( 1, 1 ); + m_gridPreview->EnableEditing( false ); + m_gridPreview->EnableGridLines( false ); + m_gridPreview->EnableDragGridSize( false ); + m_gridPreview->SetMargins( 0, 0 ); + + // Columns + m_gridPreview->SetColSize( 0, 250 ); + m_gridPreview->EnableDragColMove( false ); + m_gridPreview->EnableDragColSize( false ); + m_gridPreview->SetColLabelSize( 0 ); + m_gridPreview->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridPreview->SetRowSize( 0, 250 ); + m_gridPreview->EnableDragRowSize( false ); + m_gridPreview->SetRowLabelSize( 0 ); + m_gridPreview->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridPreview->SetDefaultCellFont( wxFont( 180, 70, 90, 90, false, wxT("00 ZRCola") ) ); + m_gridPreview->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + sbSizerPreview->Add( m_gridPreview, 0, wxALIGN_CENTER|wxALL, 5 ); + + + bSizerRight->Add( sbSizerPreview, 0, wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerRelated; + sbSizerRelated = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Re&lated") ), wxVERTICAL ); + + m_gridRelated = new wxGrid( sbSizerRelated->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridRelated->CreateGrid( 3, 7 ); + m_gridRelated->EnableEditing( false ); + m_gridRelated->EnableGridLines( true ); + m_gridRelated->EnableDragGridSize( false ); + m_gridRelated->SetMargins( 0, 0 ); + + // Columns + m_gridRelated->SetColSize( 0, 35 ); + m_gridRelated->SetColSize( 1, 35 ); + m_gridRelated->SetColSize( 2, 35 ); + m_gridRelated->SetColSize( 3, 35 ); + m_gridRelated->SetColSize( 4, 35 ); + m_gridRelated->SetColSize( 5, 35 ); + m_gridRelated->SetColSize( 6, 35 ); + m_gridRelated->EnableDragColMove( false ); + m_gridRelated->EnableDragColSize( false ); + m_gridRelated->SetColLabelSize( 0 ); + m_gridRelated->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_gridRelated->SetRowSize( 0, 35 ); + m_gridRelated->SetRowSize( 1, 35 ); + m_gridRelated->SetRowSize( 2, 35 ); + m_gridRelated->EnableDragRowSize( false ); + m_gridRelated->SetRowLabelSize( 0 ); + m_gridRelated->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_gridRelated->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) ); + m_gridRelated->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + sbSizerRelated->Add( m_gridRelated, 0, wxALIGN_CENTER|wxALL, 5 ); + + + bSizerRight->Add( sbSizerRelated, 1, wxALL|wxEXPAND, 5 ); + + + bSizerColumns->Add( bSizerRight, 0, wxEXPAND, 5 ); + + + bSizerContent->Add( bSizerColumns, 1, wxEXPAND, 5 ); + + + bSizerContent->Add( 5, 5, 0, wxALL|wxEXPAND, 5 ); + + m_sdbSizerButtons = new wxStdDialogButtonSizer(); + m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); + m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK ); + m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); + m_sdbSizerButtons->Realize(); + + bSizerContent->Add( m_sdbSizerButtons, 0, wxALL|wxEXPAND, 5 ); + + + this->SetSizer( bSizerContent ); + this->Layout(); + bSizerContent->Fit( this ); + + // Connect Events + m_search->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaCharSelectBase::OnSearchText ), NULL, this ); + m_gridResults->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( wxZRColaCharSelectBase::OnResultSelectCell ), NULL, this ); + m_gridRecent->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( wxZRColaCharSelectBase::OnRecentSelectCell ), NULL, this ); + m_unicode->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaCharSelectBase::OnUnicodeText ), NULL, this ); + m_gridRelated->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( wxZRColaCharSelectBase::OnRelatedSelectCell ), NULL, this ); +} + +wxZRColaCharSelectBase::~wxZRColaCharSelectBase() +{ + // Disconnect Events + m_search->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaCharSelectBase::OnSearchText ), NULL, this ); + m_gridResults->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( wxZRColaCharSelectBase::OnResultSelectCell ), NULL, this ); + m_gridRecent->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( wxZRColaCharSelectBase::OnRecentSelectCell ), NULL, this ); + m_unicode->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaCharSelectBase::OnUnicodeText ), NULL, this ); + m_gridRelated->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( wxZRColaCharSelectBase::OnRelatedSelectCell ), NULL, this ); + +} diff --git a/ZRCola/zrcolagui.h b/ZRCola/zrcolagui.h index 7f583e3..3ae9d19 100644 --- a/ZRCola/zrcolagui.h +++ b/ZRCola/zrcolagui.h @@ -32,6 +32,11 @@ #include #include #include +#include +#include +#include +#include +#include /////////////////////////////////////////////////////////////////////////// @@ -45,7 +50,8 @@ class wxZRColaFrameBase : public wxFrame protected: enum { - wxID_SEND_COMPOSED = 1000, + wxID_INSERT_CHARACTER = 1000, + wxID_SEND_COMPOSED, wxID_SEND_DECOMPOSED, wxID_SEND_ABORT }; @@ -125,4 +131,38 @@ class wxZRColaComposerPanelBase : public wxPanel }; +/////////////////////////////////////////////////////////////////////////////// +/// Class wxZRColaCharSelectBase +/////////////////////////////////////////////////////////////////////////////// +class wxZRColaCharSelectBase : public wxDialog +{ + private: + + protected: + wxSearchCtrl* m_search; + wxGrid* m_gridResults; + wxGrid* m_gridRecent; + wxTextCtrl* m_unicode; + wxGrid* m_gridPreview; + wxGrid* m_gridRelated; + wxStdDialogButtonSizer* m_sdbSizerButtons; + wxButton* m_sdbSizerButtonsOK; + wxButton* m_sdbSizerButtonsCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnSearchText( wxCommandEvent& event ) { event.Skip(); } + virtual void OnResultSelectCell( wxGridEvent& event ) { event.Skip(); } + virtual void OnRecentSelectCell( wxGridEvent& event ) { event.Skip(); } + virtual void OnUnicodeText( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRelatedSelectCell( wxGridEvent& event ) { event.Skip(); } + + + public: + wxString m_unicodeValid; + + wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Character Selector"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaCharSelect") ); + ~wxZRColaCharSelectBase(); + +}; + #endif //__ZRCOLAGUI_H__