Compare commits

..

19 Commits

Author SHA1 Message Date
Simon Rozman
02f164cee6 Version set to 2.0-alpha4 2016-04-08 14:54:18 +02:00
Simon Rozman
a35c0d83ca Merge branch 'master' of https://github.com/Amebis/ZRCola 2016-04-08 14:49:47 +02:00
Simon Rozman
6b4ed23801 ZRCola database updated
(resolves #7)
2016-04-08 14:49:27 +02:00
Simon Rozman
2c602ad659 ZRCola database updated 2016-04-08 14:48:23 +02:00
Simon Rozman
279537b1f3 Combinations with partial longer match not composed issue resolved
(resolves #6)
2016-04-08 14:45:28 +02:00
Simon Rozman
f918c49bfd Accessing an element of table before determining size issue resolved 2016-04-08 13:48:33 +02:00
Simon Rozman
72c29a692e GUI aligned with stock text 2016-04-08 13:22:23 +02:00
Simon Rozman
fc78a650a2 Select All (text) feature added 2016-04-08 13:01:09 +02:00
Simon Rozman
acec7098e5 Minor GUI improvements 2016-04-08 12:44:35 +02:00
Simon Rozman
98eff47054 Clipboard events are forwarded to focused control now
(resolves #12)
2016-04-08 12:35:38 +02:00
Simon Rozman
cd2c20fc06 Version set to 2.0-alpha3. 2016-04-08 09:22:10 +02:00
Simon Rozman
ac772671cc Publish target split into PublishPre and Publish 2016-04-08 09:21:53 +02:00
Simon Rozman
acfe980705 Non-working OEM key sequences issue fixed
resolves #5
2016-04-07 14:52:45 +02:00
Simon Rozman
426b7a6227 Keyboard sequence monitoring upgraded not to react on modifier keys, canceling multi-key sequences when non-first key modifier pressed 2016-04-07 14:49:28 +02:00
Simon Rozman
834743c7dd Cleanup 2016-04-07 13:10:54 +02:00
Simon Rozman
c8628ef4eb Key sequence import fixed (resolves #7) 2016-04-07 12:53:19 +02:00
Simon Rozman
4f52304fe9 Advertised shortcuts disabled (closes #4) 2016-04-07 10:50:31 +02:00
Simon Rozman
eef80067bb Language setting moved from HKCU (per-user) to HKLM (global) 2016-04-07 09:41:29 +02:00
Simon Rozman
9240288245 Generic module names replaced 2016-04-06 14:14:35 +02:00
33 changed files with 409 additions and 262 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -317,6 +317,7 @@ s$(MSIBUILD_LENGTH_ID) l0
Property Property
ARPPRODUCTICON iconZRCola.ico
ALLUSERS 1
DISABLEADVTSHORTCUTS 1
INSTALLLEVEL 3
InstallMode Typical
SecureCustomProperties OLDPRODUCTFOUND;NEWPRODUCTFOUND
@@ -346,7 +347,7 @@ regDatabasePath 2 SOFTWARE\Amebis\ZRCola DatabasePath [ZRCOLADATADIR] compDataba
Registry Root Key Name Value Component_
s$(MSIBUILD_LENGTH_ID) i2 l255 L255 L0 s$(MSIBUILD_LENGTH_ID)
1252 Registry Registry
regLanguage 1 SOFTWARE\Amebis\ZRCola Language #60 compLanguage
regLanguage 2 SOFTWARE\Amebis\ZRCola Language #60 compLanguage
<<NOKEEP
"De.$(PLAT).$(CFG).Registry-2.idt" : "En.$(PLAT).$(CFG).Registry-2.idtx" "..\locale\de_DE.po"

View File

@@ -82,6 +82,7 @@ Setup \
SetupDebug \
Register \
Unregister \
PublishPre \
Publish :: "MSI\MSIBuild\Version\Version.mak"
$(MAKE) /f "Makefile" /$(MAKEFLAGS) HAS_VERSION=1 $@
@@ -183,12 +184,15 @@ RegisterShortcuts :: \
UnregisterShortcuts ::
-if exist "$(PROGRAMDATA)\Microsoft\Windows\Start Menu\Programs\ZRCola" rd /s /q "$(PROGRAMDATA)\Microsoft\Windows\Start Menu\Programs\ZRCola"
Publish :: \
PublishPre :: \
"$(PUBLISH_PACKAGE_DIR)" \
$(REDIST_EN_WIN32) \
$(REDIST_EN_X64) \
$(REDIST_SL_WIN32) \
$(REDIST_SL_X64) \
$(REDIST_SL_X64)
Publish :: \
PublishPre \
"$(PUBLISH_DIR)\catalog-0000.xml"

View File

@@ -141,7 +141,7 @@
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="help">Quit this program</property>
<property name="id">wxID_EXIT</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">E&amp;xit</property>
@@ -161,13 +161,13 @@
<property name="bitmap">Load From Icon Resource; edit_cut.ico; [16; 16]</property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Cuts selected text and puts it on the clipboard</property>
<property name="help"></property>
<property name="id">wxID_CUT</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Cut</property>
<property name="label"></property>
<property name="name">m_menuItemEditCut</property>
<property name="permission">none</property>
<property name="shortcut">Ctrl+X</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event>
<event name="OnUpdateUI"></event>
@@ -176,13 +176,13 @@
<property name="bitmap">Load From Icon Resource; edit_copy.ico; [16; 16]</property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Copies selected text to the clipboard</property>
<property name="help"></property>
<property name="id">wxID_COPY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&amp;Copy</property>
<property name="label"></property>
<property name="name">m_menuItemEditCopy</property>
<property name="permission">none</property>
<property name="shortcut">Ctrl+C</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event>
<event name="OnUpdateUI"></event>
@@ -191,13 +191,13 @@
<property name="bitmap">Load From Icon Resource; edit_paste.ico; [16; 16]</property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Inserts text from the clipboard</property>
<property name="help"></property>
<property name="id">wxID_PASTE</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&amp;Paste</property>
<property name="label"></property>
<property name="name">m_menuItemEditPaste</property>
<property name="permission">none</property>
<property name="shortcut">Ctrl+V</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event>
<event name="OnUpdateUI"></event>
@@ -206,11 +206,30 @@
<property name="name">m_separatorEdit1</property>
<property name="permission">none</property>
</object>
<object class="wxMenuItem" expanded="1">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Select all text</property>
<property name="id">wxID_SELECTALL</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Select &amp;All</property>
<property name="name">m_menuSelectAll</property>
<property name="permission">none</property>
<property name="shortcut">Ctrl+A</property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event>
<event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="1">
<property name="name">m_separatorEdit2</property>
<property name="permission">none</property>
</object>
<object class="wxMenuItem" expanded="1">
<property name="bitmap">Load From Icon Resource; send_composed.ico; [16; 16]</property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Sends composed text to source window</property>
<property name="help">Send composed text to source window</property>
<property name="id">wxID_SEND_COMPOSED</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&amp;Send Composed</property>
@@ -225,7 +244,7 @@
<property name="bitmap">Load From Icon Resource; send_decomposed.ico; [16; 16]</property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Sends decomposed text to source window</property>
<property name="help">Send decomposed text to source window</property>
<property name="id">wxID_SEND_DECOMPOSED</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Send &amp;Decomposed</property>
@@ -240,7 +259,7 @@
<property name="bitmap">Load From Icon Resource; send_abort.ico; [16; 16]</property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Aborts composition and returns focus to source window</property>
<property name="help">Abort composition and return focus to source window</property>
<property name="id">wxID_SEND_ABORT</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Abort (De)composition</property>
@@ -263,7 +282,7 @@
<property name="help"></property>
<property name="id">wxID_ABOUT</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&amp;About</property>
<property name="label"></property>
<property name="name">m_menuItemAbout</property>
<property name="permission">none</property>
<property name="shortcut"></property>
@@ -284,7 +303,7 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmapsize"></property>
<property name="bitmapsize">16,16</property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
@@ -360,7 +379,7 @@
<property name="label">Cut</property>
<property name="name">m_toolEditCut</property>
<property name="permission">protected</property>
<property name="statusbar">Cuts selected text and puts it on the clipboard</property>
<property name="statusbar">Cut selection</property>
<property name="tooltip">Cut</property>
<event name="OnAuiToolBarBeginDrag"></event>
<event name="OnAuiToolBarMiddleClick"></event>
@@ -381,7 +400,7 @@
<property name="label">Copy</property>
<property name="name">m_toolEditCopy</property>
<property name="permission">protected</property>
<property name="statusbar">Copies selected text to the clipboard</property>
<property name="statusbar">Copy selection</property>
<property name="tooltip">Copy</property>
<event name="OnAuiToolBarBeginDrag"></event>
<event name="OnAuiToolBarMiddleClick"></event>
@@ -402,7 +421,7 @@
<property name="label">Paste</property>
<property name="name">m_toolEditPaste</property>
<property name="permission">protected</property>
<property name="statusbar">Inserts text from the clipboard</property>
<property name="statusbar">Paste selection</property>
<property name="tooltip">Paste</property>
<event name="OnAuiToolBarBeginDrag"></event>
<event name="OnAuiToolBarMiddleClick"></event>
@@ -426,7 +445,7 @@
<property name="label">Send Composed</property>
<property name="name">m_toolSendComposed</property>
<property name="permission">protected</property>
<property name="statusbar">Sends composed text to source window</property>
<property name="statusbar">Send composed text to source window</property>
<property name="tooltip">Send Composed</property>
<event name="OnAuiToolBarBeginDrag"></event>
<event name="OnAuiToolBarMiddleClick"></event>
@@ -447,7 +466,7 @@
<property name="label">Send Decomposed</property>
<property name="name">m_toolSendDecomposed</property>
<property name="permission">protected</property>
<property name="statusbar">Sends decomposed text to source window</property>
<property name="statusbar">Send decomposed text to source window</property>
<property name="tooltip">Send Decomposed</property>
<event name="OnAuiToolBarBeginDrag"></event>
<event name="OnAuiToolBarMiddleClick"></event>

View File

@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: ZRCola\n"
"POT-Creation-Date: 2016-04-06 12:31+0200\n"
"PO-Revision-Date: 2016-04-06 12:31+0200\n"
"POT-Creation-Date: 2016-04-08 13:13+0200\n"
"PO-Revision-Date: 2016-04-08 13:13+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
"Language: sl_SI\n"
@@ -17,7 +17,7 @@ msgstr ""
"X-Poedit-KeywordsList: _\n"
"X-Poedit-SearchPath-0: .\n"
#: zrcolafrm.cpp:56
#: zrcolafrm.cpp:61
msgid ""
"ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality "
"will not be available."
@@ -25,11 +25,11 @@ msgstr ""
"ZRColine bližnjice na tipkovnici Win+F5 ni mogoče registrirati. Nekaj "
"funkcionalnosti ne bo na voljo."
#: zrcolafrm.cpp:56 zrcolafrm.cpp:58
#: zrcolafrm.cpp:61 zrcolafrm.cpp:63
msgid "Warning"
msgstr "Opozorilo"
#: zrcolafrm.cpp:58
#: zrcolafrm.cpp:63
msgid ""
"ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality "
"will not be available."
@@ -37,7 +37,7 @@ msgstr ""
"ZRColine bližnjice na tipkovnici Win+F6 ni mogoče registrirati. Nekaj "
"funkcionalnosti ne bo na voljo."
#: zrcolafrm.cpp:119
#: zrcolafrm.cpp:144
#, c-format
msgid ""
"ZRCola v%s\n"
@@ -46,7 +46,7 @@ msgstr ""
"ZRCola v%s\n"
"Vse pravice pridržane 2015-%s Amebis"
#: zrcolafrm.cpp:119
#: zrcolafrm.cpp:144
msgid "About ZRCola"
msgstr "O ZRColi"
@@ -54,83 +54,83 @@ msgstr "O ZRColi"
msgid "E&xit"
msgstr "I&zhod"
#: zrcolagui.cpp:32
msgid "Quit this program"
msgstr "Zapri ta program"
#: zrcolagui.cpp:35
msgid "&Program"
msgstr "&Program"
#: zrcolagui.cpp:39 zrcolagui.cpp:106
msgid "Cut"
msgstr "Izreži"
#: zrcolagui.cpp:39 zrcolagui.cpp:106
msgid "Cuts selected text and puts it on the clipboard"
msgstr "Izreže izbrano besedilo in ga shrani na odložišče"
#: zrcolagui.cpp:48
msgid "&Copy"
msgstr "&Kopiraj"
#: zrcolagui.cpp:48 zrcolagui.cpp:108
msgid "Copies selected text to the clipboard"
msgstr "Kopira izbrano besedilo na odložišče"
#: zrcolagui.cpp:57
msgid "&Paste"
msgstr "&Prilepi"
#: zrcolagui.cpp:57 zrcolagui.cpp:110
msgid "Inserts text from the clipboard"
msgstr "Vstavi besedilo z odložišča"
#: zrcolagui.cpp:68
msgid "Select &All"
msgstr "Izberi &vse"
#: zrcolagui.cpp:68
msgid "Select all text"
msgstr "Izberi celotno besedilo"
#: zrcolagui.cpp:74
msgid "&Send Composed"
msgstr "Pošlji &sestavljeno"
#: zrcolagui.cpp:68 zrcolagui.cpp:114
msgid "Sends composed text to source window"
msgstr "Pošlje sestavljeno besedilo izvornemu oknu"
#: zrcolagui.cpp:74 zrcolagui.cpp:121
msgid "Send composed text to source window"
msgstr "Pošlji sestavljeno besedilo izvornemu oknu"
#: zrcolagui.cpp:77
#: zrcolagui.cpp:83
msgid "Send &Decomposed"
msgstr "Pošlji &razstavljeno"
#: zrcolagui.cpp:77 zrcolagui.cpp:116
msgid "Sends decomposed text to source window"
msgstr "Pošlje razstavljeno besedilo izvornemu oknu"
#: zrcolagui.cpp:83 zrcolagui.cpp:123
msgid "Send decomposed text to source window"
msgstr "Pošlji razstavljeno besedilo izvornemu oknu"
#: zrcolagui.cpp:86
#: zrcolagui.cpp:92
msgid "Abort (De)composition"
msgstr "Prekini raz/sestavljanje"
#: zrcolagui.cpp:86
msgid "Aborts composition and returns focus to source window"
msgstr "Prekine sestavljanje in vrne fokus nazaj izvornemu oknu"
#: zrcolagui.cpp:92
msgid "Abort composition and return focus to source window"
msgstr "Prekini sestavljanje in vrni fokus nazaj izvornemu oknu"
#: zrcolagui.cpp:94
#: zrcolagui.cpp:100
msgid "&Edit"
msgstr "Ur&edi"
#: zrcolagui.cpp:98
msgid "&About"
msgstr "O progr&amu"
#: zrcolagui.cpp:101
#: zrcolagui.cpp:107
msgid "&Help"
msgstr "&Pomoč"
#: zrcolagui.cpp:108
#: zrcolagui.cpp:113
msgid "Cut"
msgstr "Izreži"
#: zrcolagui.cpp:113
msgid "Cut selection"
msgstr "Izreži izbor"
#: zrcolagui.cpp:115
msgid "Copy"
msgstr "Kopiraj"
#: zrcolagui.cpp:110
#: zrcolagui.cpp:115
msgid "Copy selection"
msgstr "Kopiraj izbor"
#: zrcolagui.cpp:117
msgid "Paste"
msgstr "Prilepi"
#: zrcolagui.cpp:114
#: zrcolagui.cpp:117
msgid "Paste selection"
msgstr "Prilepi izbor"
#: zrcolagui.cpp:121
msgid "Send Composed"
msgstr "Pošlji sestavljeno"
#: zrcolagui.cpp:116
#: zrcolagui.cpp:123
msgid "Send Decomposed"
msgstr "Pošlji razstavljeno"
@@ -156,6 +156,24 @@ msgstr "1250"
msgid "Input system for linguistic use"
msgstr "Vnašalni sistem za jezikoslovno rabo"
#~ msgid "&About"
#~ msgstr "O progr&amu"
#~ msgid "Cuts selected text and puts it on the clipboard"
#~ msgstr "Izreže izbrano besedilo in ga shrani na odložišče"
#~ msgid "Copies selected text to the clipboard"
#~ msgstr "Kopira izbrano besedilo na odložišče"
#~ msgid "Inserts text from the clipboard"
#~ msgstr "Vstavi besedilo z odložišča"
#~ msgid "&Copy"
#~ msgstr "&Kopiraj"
#~ msgid "&Paste"
#~ msgstr "&Prilepi"
#~ msgid "&File"
#~ msgstr "&Datoteka"

View File

@@ -35,3 +35,7 @@
#include <vector>
#include <stdex/idrec.h>
#if defined(__WXMSW__)
#include <Msi.h>
#endif

View File

@@ -18,6 +18,9 @@
*/
#include "stdafx.h"
#if defined(__WXMSW__)
#pragma comment(lib, "msi.lib")
#endif
//////////////////////////////////////////////////////////////////////////
@@ -34,6 +37,14 @@ ZRColaApp::ZRColaApp() : wxApp()
bool ZRColaApp::OnInit()
{
#if defined(__WXMSW__)
// To compensate migration to non-advertised shortcut, do the Microsoft Installer's feature completeness check manually.
// If execution got this far in the first place (EXE and dependent DLLs are present and loadable).
// Furthermore, this increments program usage counter.
if (::MsiQueryFeatureState(_T(ZRCOLA_VERSION_GUID), _T("featZRCola")) != INSTALLSTATE_UNKNOWN)
::MsiUseFeature(_T(ZRCOLA_VERSION_GUID), _T("featZRCola"));
#endif
wxConfigBase *cfgPrev = wxConfigBase::Set(new wxConfig(wxT(ZRCOLA_CFG_APPLICATION), wxT(ZRCOLA_CFG_VENDOR)));
if (cfgPrev) wxDELETE(cfgPrev);

View File

@@ -25,13 +25,18 @@
//////////////////////////////////////////////////////////////////////////
wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
EVT_UPDATE_UI_RANGE(wxID_SEND_COMPOSED, wxID_SEND_ABORT, wxZRColaFrame::OnSendUpdate)
EVT_UPDATE_UI_RANGE(wxID_CUT, wxID_CLEAR, wxZRColaFrame::OnForwardEventUpdate)
EVT_MENU_RANGE(wxID_CUT, wxID_CLEAR, wxZRColaFrame::OnForwardEvent)
EVT_UPDATE_UI(wxID_SELECTALL, wxZRColaFrame::OnForwardEventUpdate)
EVT_MENU(wxID_SELECTALL, wxZRColaFrame::OnForwardEvent)
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 )
EVT_MENU(wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
EVT_MENU(wxID_EXIT , wxZRColaFrame::OnExit )
EVT_MENU(wxID_ABOUT , wxZRColaFrame::OnAbout )
EVT_MENU(wxID_EXIT , wxZRColaFrame::OnExit )
EVT_MENU(wxID_ABOUT, wxZRColaFrame::OnAbout)
wxEND_EVENT_TABLE()
@@ -67,6 +72,26 @@ wxZRColaFrame::~wxZRColaFrame()
}
void wxZRColaFrame::OnForwardEventUpdate(wxUpdateUIEvent& event)
{
wxControl *focusWnd = wxDynamicCast(FindFocus(), wxControl);
if (focusWnd)
focusWnd->GetEventHandler()->ProcessEvent(event);
else
event.Enable(false);
}
void wxZRColaFrame::OnForwardEvent(wxCommandEvent& event)
{
wxControl *focusWnd = wxDynamicCast(FindFocus(), wxControl);
if (focusWnd)
focusWnd->GetEventHandler()->ProcessEvent(event);
else
event.Skip();
}
void wxZRColaFrame::OnSendUpdate(wxUpdateUIEvent& event)
{
event.Enable(m_hWndSource ? true : false);

View File

@@ -46,6 +46,8 @@ public:
virtual ~wxZRColaFrame();
protected:
void OnForwardEventUpdate(wxUpdateUIEvent& event);
void OnForwardEvent(wxCommandEvent& event);
void OnSendUpdate(wxUpdateUIEvent& event);
void OnSendComposed(wxCommandEvent& event);
void OnSendDecomposed(wxCommandEvent& event);

View File

@@ -29,14 +29,14 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menubar = new wxMenuBar( 0 );
m_menuProgram = new wxMenu();
wxMenuItem* m_menuItemExit;
m_menuItemExit = new wxMenuItem( m_menuProgram, wxID_EXIT, wxString( _("E&xit") ) + wxT('\t') + wxT("Alt+F4"), wxEmptyString, wxITEM_NORMAL );
m_menuItemExit = new wxMenuItem( m_menuProgram, wxID_EXIT, wxString( _("E&xit") ) + wxT('\t') + wxT("Alt+F4"), _("Quit this program"), wxITEM_NORMAL );
m_menuProgram->Append( m_menuItemExit );
m_menubar->Append( m_menuProgram, _("&Program") );
m_menuEdit = new wxMenu();
wxMenuItem* m_menuItemEditCut;
m_menuItemEditCut = new wxMenuItem( m_menuEdit, wxID_CUT, wxString( _("Cut") ) + wxT('\t') + wxT("Ctrl+X"), _("Cuts selected text and puts it on the clipboard"), wxITEM_NORMAL );
m_menuItemEditCut = new wxMenuItem( m_menuEdit, wxID_CUT, wxString( wxEmptyString ) , wxEmptyString, wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuItemEditCut->SetBitmaps( wxIcon( wxT("edit_cut.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
@@ -45,7 +45,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->Append( m_menuItemEditCut );
wxMenuItem* m_menuItemEditCopy;
m_menuItemEditCopy = new wxMenuItem( m_menuEdit, wxID_COPY, wxString( _("&Copy") ) + wxT('\t') + wxT("Ctrl+C"), _("Copies selected text to the clipboard"), wxITEM_NORMAL );
m_menuItemEditCopy = new wxMenuItem( m_menuEdit, wxID_COPY, wxString( wxEmptyString ) , wxEmptyString, wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuItemEditCopy->SetBitmaps( wxIcon( wxT("edit_copy.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
@@ -54,7 +54,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->Append( m_menuItemEditCopy );
wxMenuItem* m_menuItemEditPaste;
m_menuItemEditPaste = new wxMenuItem( m_menuEdit, wxID_PASTE, wxString( _("&Paste") ) + wxT('\t') + wxT("Ctrl+V"), _("Inserts text from the clipboard"), wxITEM_NORMAL );
m_menuItemEditPaste = new wxMenuItem( m_menuEdit, wxID_PASTE, wxString( wxEmptyString ) , wxEmptyString, wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuItemEditPaste->SetBitmaps( wxIcon( wxT("edit_paste.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
@@ -64,8 +64,14 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuSelectAll;
m_menuSelectAll = new wxMenuItem( m_menuEdit, wxID_SELECTALL, wxString( _("Select &All") ) + wxT('\t') + wxT("Ctrl+A"), _("Select all text"), wxITEM_NORMAL );
m_menuEdit->Append( m_menuSelectAll );
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuItemSendComposed;
m_menuItemSendComposed = new wxMenuItem( m_menuEdit, wxID_SEND_COMPOSED, wxString( _("&Send Composed") ) + wxT('\t') + wxT("F5"), _("Sends composed text to source window"), wxITEM_NORMAL );
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__
m_menuItemSendComposed->SetBitmaps( wxIcon( wxT("send_composed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
@@ -74,7 +80,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->Append( m_menuItemSendComposed );
wxMenuItem* m_menuItemSendDecomposed;
m_menuItemSendDecomposed = new wxMenuItem( m_menuEdit, wxID_SEND_DECOMPOSED, wxString( _("Send &Decomposed") ) + wxT('\t') + wxT("F6"), _("Sends decomposed text to source window"), wxITEM_NORMAL );
m_menuItemSendDecomposed = new wxMenuItem( m_menuEdit, wxID_SEND_DECOMPOSED, wxString( _("Send &Decomposed") ) + wxT('\t') + wxT("F6"), _("Send decomposed text to source window"), wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuItemSendDecomposed->SetBitmaps( wxIcon( wxT("send_decomposed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
@@ -83,7 +89,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->Append( m_menuItemSendDecomposed );
wxMenuItem* m_menuItemSendAbort;
m_menuItemSendAbort = new wxMenuItem( m_menuEdit, wxID_SEND_ABORT, wxString( _("Abort (De)composition") ) + wxT('\t') + wxT("Esc"), _("Aborts composition and returns focus to source window"), wxITEM_NORMAL );
m_menuItemSendAbort = new wxMenuItem( m_menuEdit, wxID_SEND_ABORT, wxString( _("Abort (De)composition") ) + wxT('\t') + wxT("Esc"), _("Abort composition and return focus to source window"), wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuItemSendAbort->SetBitmaps( wxIcon( wxT("send_abort.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
@@ -95,25 +101,26 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuHelp = new wxMenu();
wxMenuItem* m_menuItemAbout;
m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About") ) , wxEmptyString, wxITEM_NORMAL );
m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( wxEmptyString ) , wxEmptyString, wxITEM_NORMAL );
m_menuHelp->Append( m_menuItemAbout );
m_menubar->Append( m_menuHelp, _("&Help") );
this->SetMenuBar( m_menubar );
m_toolbar = this->CreateToolBar( wxTB_HORIZONTAL, wxID_ANY );
m_toolEditCut = m_toolbar->AddTool( wxID_CUT, _("Cut"), wxIcon( wxT("edit_cut.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Cut"), _("Cuts selected text and puts it on the clipboard"), NULL );
m_toolbar = this->CreateToolBar( wxTB_HORIZONTAL, wxID_ANY );
m_toolbar->SetToolBitmapSize( wxSize( 16,16 ) );
m_toolEditCut = m_toolbar->AddTool( wxID_CUT, _("Cut"), wxIcon( wxT("edit_cut.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Cut"), _("Cut selection"), NULL );
m_toolEditCopy = m_toolbar->AddTool( wxID_COPY, _("Copy"), wxIcon( wxT("edit_copy.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Copy"), _("Copies selected text to the clipboard"), NULL );
m_toolEditCopy = m_toolbar->AddTool( wxID_COPY, _("Copy"), wxIcon( wxT("edit_copy.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Copy"), _("Copy selection"), NULL );
m_toolEditPaste = m_toolbar->AddTool( wxID_PASTE, _("Paste"), wxIcon( wxT("edit_paste.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Paste"), _("Inserts text from the clipboard"), NULL );
m_toolEditPaste = m_toolbar->AddTool( wxID_PASTE, _("Paste"), wxIcon( wxT("edit_paste.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Paste"), _("Paste selection"), NULL );
m_toolbar->AddSeparator();
m_toolSendComposed = m_toolbar->AddTool( wxID_SEND_COMPOSED, _("Send Composed"), wxIcon( wxT("send_composed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Send Composed"), _("Sends composed text to source window"), NULL );
m_toolSendComposed = m_toolbar->AddTool( wxID_SEND_COMPOSED, _("Send Composed"), wxIcon( wxT("send_composed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Send Composed"), _("Send composed text to source window"), NULL );
m_toolSendDecomposed = m_toolbar->AddTool( wxID_SEND_DECOMPOSED, _("Send Decomposed"), wxIcon( wxT("send_decomposed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Send Decomposed"), _("Sends decomposed text to source window"), NULL );
m_toolSendDecomposed = m_toolbar->AddTool( wxID_SEND_DECOMPOSED, _("Send Decomposed"), wxIcon( wxT("send_decomposed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Send Decomposed"), _("Send decomposed text to source window"), NULL );
m_toolbar->Realize();

View File

@@ -54,62 +54,64 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
{
if (event.GetEventType() == wxEVT_KEY_DOWN) {
// The character event occured.
ZRCola::keyseq_db::indexKey::size_type start, end;
bool found;
wxFrame *pFrame = wxDynamicCast(wxTheApp->GetTopWindow(), wxFrame);
wxKeyEvent &e = (wxKeyEvent&)event;
if (e.GetUnicodeKey() || !e.HasAnyModifiers()) {
ZRCola::keyseq_db::indexKey::size_type start, end;
bool found;
wxFrame *pFrame = wxDynamicCast(wxTheApp->GetTopWindow(), wxFrame);
{
// Parse key event and save it at the end of the key sequence.
wxKeyEvent &e = (wxKeyEvent&)event;
ZRCola::keyseq_db::keyseq::key_t key;
key.key = e.GetKeyCode(); //wxToupper(e.m_uniChar);
key.modifiers =
(e.ShiftDown() ? ZRCola::keyseq_db::keyseq::SHIFT : 0) |
(e.ControlDown() ? ZRCola::keyseq_db::keyseq::CTRL : 0) |
(e.AltDown() ? ZRCola::keyseq_db::keyseq::ALT : 0);
m_seq.push_back(key);
{
// Parse key event and save it at the end of the key sequence.
ZRCola::keyseq_db::keyseq::key_t key;
key.key = e.GetRawKeyCode();
key.modifiers =
(e.ShiftDown() ? ZRCola::keyseq_db::keyseq::SHIFT : 0) |
(e.ControlDown() ? ZRCola::keyseq_db::keyseq::CTRL : 0) |
(e.AltDown() ? ZRCola::keyseq_db::keyseq::ALT : 0);
m_seq.push_back(key);
std::vector<ZRCola::keyseq_db::keyseq::key_t>::size_type n = m_seq.size();
ZRCola::keyseq_db::keyseq *ks = (ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(ZRCola::keyseq_db::keyseq::key_t)*n];
ks->chr = 0;
ks->seq_len = n;
memcpy(ks->seq, m_seq.data(), sizeof(ZRCola::keyseq_db::keyseq::key_t)*n);
found = m_ks_db.idxKey.find(*ks, start, end);
delete ks;
}
std::vector<ZRCola::keyseq_db::keyseq::key_t>::size_type n = m_seq.size();
ZRCola::keyseq_db::keyseq *ks = (ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(ZRCola::keyseq_db::keyseq::key_t)*n];
ks->chr = 0;
ks->seq_len = n;
memcpy(ks->seq, m_seq.data(), sizeof(ZRCola::keyseq_db::keyseq::key_t)*n);
found = m_ks_db.idxKey.find(*ks, start, end);
delete ks;
}
if (found) {
// The exact key sequence found.
const ZRCola::keyseq_db::keyseq &ks = m_ks_db.idxKey[start];
m_seq.clear();
if (found) {
// The exact key sequence found.
const ZRCola::keyseq_db::keyseq &ks = m_ks_db.idxKey[start];
m_seq.clear();
if (pFrame && pFrame->GetStatusBar())
pFrame->SetStatusText(wxEmptyString);
if (pFrame && pFrame->GetStatusBar())
pFrame->SetStatusText(wxEmptyString);
wxObject *obj = event.GetEventObject();
if (obj && obj->IsKindOf(wxCLASSINFO(wxTextCtrl))) {
// Push text to source control.
((wxTextCtrl*)obj)->WriteText(ks.chr);
wxObject *obj = event.GetEventObject();
if (obj && obj->IsKindOf(wxCLASSINFO(wxTextCtrl))) {
// Push text to source control.
((wxTextCtrl*)obj)->WriteText(ks.chr);
// Event is fully processed now.
event.StopPropagation();
return true;
}
} else if (start < m_ks_db.idxKey.size() &&
ZRCola::keyseq_db::keyseq::CompareSequence(m_seq.data(), m_seq.size(), m_ks_db.idxKey[start].seq, std::min<unsigned __int16>(m_ks_db.idxKey[start].seq_len, m_seq.size())) == 0)
{
// The sequence is a partial match. Continue watching.
if (pFrame && pFrame->GetStatusBar())
pFrame->SetStatusText(ZRCola::keyseq_db::GetSequenceAsText(m_seq.data(), m_seq.size()));
// Event is fully processed now.
event.StopPropagation();
return true;
} else {
// The key sequence has no future chance to match. Start all over again.
m_seq.clear();
if (pFrame && pFrame->GetStatusBar())
pFrame->SetStatusText(wxEmptyString);
}
} else if (start < m_ks_db.idxKey.size() &&
ZRCola::keyseq_db::keyseq::CompareSequence(m_seq.data(), m_seq.size(), m_ks_db.idxKey[start].seq, std::min<unsigned __int16>(m_ks_db.idxKey[start].seq_len, m_seq.size())) == 0)
{
// The sequence is a partial match. Continue watching.
if (pFrame && pFrame->GetStatusBar())
pFrame->SetStatusText(ZRCola::keyseq_db::GetSequenceAsText(m_seq.data(), m_seq.size()));
event.StopPropagation();
return true;
} else {
// The key sequence has no future chance to match. Start all over again.
m_seq.clear();
if (pFrame && pFrame->GetStatusBar())
pFrame->SetStatusText(wxEmptyString);
}
}

View File

@@ -99,15 +99,43 @@ void ZRCola::DBSource::LogErrors() const
}
bool ZRCola::DBSource::GetValue(const ATL::CComPtr<ADOField>& f, bool& val) const
{
wxASSERT_MSG(f, wxT("field is empty"));
ATL::CComVariant v;
wxVERIFY(SUCCEEDED(f->get_Value(&v)));
wxCHECK(SUCCEEDED(v.ChangeType(VT_BOOL)), false);
val = V_BOOL(&v) ? true : false;
return true;
}
bool ZRCola::DBSource::GetValue(const ATL::CComPtr<ADOField>& f, int& val) const
{
wxASSERT_MSG(f, wxT("field is empty"));
ATL::CComVariant v;
wxVERIFY(SUCCEEDED(f->get_Value(&v)));
wxCHECK(SUCCEEDED(v.ChangeType(VT_I4)), false);
val = V_I4(&v);
return true;
}
bool ZRCola::DBSource::GetUnicodeCharacter(const ATL::CComPtr<ADOField>& f, wchar_t& chr) const
{
wxASSERT_MSG(f, wxT("field is empty"));
ATL::CComVariant v;
wxVERIFY(SUCCEEDED(f->get_Value(&v)));
wxCHECK(SUCCEEDED(v.ChangeType(VT_BSTR)), false);
// Parse the field. Must be exactly one Unicode code.
wxVERIFY(SUCCEEDED(v.ChangeType(VT_BSTR)));
UINT i = 0, n = ::SysStringLen(V_BSTR(&v));
chr = 0;
for (; i < n && V_BSTR(&v)[i]; i++) {
@@ -136,9 +164,9 @@ bool ZRCola::DBSource::GetUnicodeString(const ATL::CComPtr<ADOField>& f, std::ws
ATL::CComVariant v;
wxVERIFY(SUCCEEDED(f->get_Value(&v)));
wxCHECK(SUCCEEDED(v.ChangeType(VT_BSTR)), false);
// Parse the field. Must be "xxxx+xxxx+xxxx..." sequence.
wxVERIFY(SUCCEEDED(v.ChangeType(VT_BSTR)));
str.clear();
for (UINT i = 0, n = ::SysStringLen(V_BSTR(&v)); i < n && V_BSTR(&v)[i];) {
// Parse Unicode code.
@@ -165,58 +193,48 @@ bool ZRCola::DBSource::GetUnicodeString(const ATL::CComPtr<ADOField>& f, std::ws
}
bool ZRCola::DBSource::GetKeySequence(const ATL::CComPtr<ADOField>& f, std::vector<keyseq::keycode>& seq) const
bool ZRCola::DBSource::GetKeyCode(const ATL::CComPtr<ADOField>& f, ZRCola::DBSource::keyseq::keycode& kc) const
{
wxASSERT_MSG(f, wxT("field is empty"));
ATL::CComVariant v;
wxVERIFY(SUCCEEDED(f->get_Value(&v)));
wxVERIFY(SUCCEEDED(v.ChangeType(VT_BSTR)));
wxCHECK(SUCCEEDED(v.ChangeType(VT_BSTR)), false);
// Convert to uppercase.
_wcsupr_l(V_BSTR(&v), m_locale);
// Parse the field. Must be comma delimited sequence of key codes.
seq.clear();
// Parse the field.
memset(&kc, 0, sizeof(kc));
for (UINT i = 0, n = ::SysStringLen(V_BSTR(&v)); i < n && V_BSTR(&v)[i];) {
keyseq::keycode kc = {};
while (i < n && V_BSTR(&v)[i]) {
// Parse key code.
static const wchar_t str_shift[] = L"SHIFT+", str_ctrl[] = L"CTRL+", str_alt[] = L"ALT+";
if (i + _countof(str_shift) <= n && wmemcmp(V_BSTR(&v) + i, str_shift, _countof(str_shift) - 1) == 0) {
kc.shift = true;
i += _countof(str_shift) - 1;
} else if (i + _countof(str_ctrl) <= n && wmemcmp(V_BSTR(&v) + i, str_ctrl, _countof(str_ctrl) - 1) == 0) {
kc.ctrl = true;
i += _countof(str_ctrl) - 1;
} else if (i + _countof(str_alt) <= n && wmemcmp(V_BSTR(&v) + i, str_alt, _countof(str_alt) - 1) == 0) {
kc.alt = true;
i += _countof(str_alt) - 1;
} else {
kc.key = V_BSTR(&v)[i];
i++;
break;
// Parse key code.
if (i) {
// Check for "+" separator.
if (V_BSTR(&v)[i] != L'+') {
ATL::CComBSTR fieldname; wxVERIFY(SUCCEEDED(f->get_Name(&fieldname)));
_ftprintf(stderr, wxT("%s: error ZCC0070: Syntax error in \"%.*ls\" field (\"%.*ls\"). Key codes must be \"Ctrl+Alt+<key>\" formatted.\n"), m_filename.c_str(), fieldname.Length(), (BSTR)fieldname, n, V_BSTR(&v));
}
i++;
if (i >= n || !V_BSTR(&v)[i]) {
ATL::CComBSTR fieldname; wxVERIFY(SUCCEEDED(f->get_Name(&fieldname)));
_ftprintf(stderr, wxT("%s: error ZCC0071: Syntax error in \"%.*ls\" field (\"%.*ls\"). Trailing separator \"+\" found.\n"), m_filename.c_str(), fieldname.Length(), (BSTR)fieldname, n, V_BSTR(&v));
}
}
if (i < n && V_BSTR(&v)[i] && V_BSTR(&v)[i] != L',' && !_iswspace_l(V_BSTR(&v)[i], m_locale)) {
ATL::CComBSTR fieldname; wxVERIFY(SUCCEEDED(f->get_Name(&fieldname)));
_ftprintf(stderr, wxT("%s: error ZCC0060: Syntax error in \"%.*ls\" field (\"%.*ls\"). Key sequences must be \"Ctrl+Alt+<key>\" formatted, delimited by commas and/or space.\n"), m_filename.c_str(), fieldname.Length(), (BSTR)fieldname, n, V_BSTR(&v));
return false;
}
if (seq.size() > 0xffff) {
_ftprintf(stderr, wxT("%s: warning ZCC0061: Key sequence \"%.*ls...\" too long. Ignored.\n"), (LPCTSTR)m_filename.c_str(), std::min<UINT>(n, 20), V_BSTR(&v));
return false;
}
seq.push_back(kc);
// Skip delimiter(s) and whitespace.
for (; i < n && V_BSTR(&v)[i] && (V_BSTR(&v)[i] == L',' || _iswspace_l(V_BSTR(&v)[i], m_locale)); i++);
}
if (seq.empty()) {
_ftprintf(stderr, wxT("%s: warning ZCC0062: Empty key sequence. Ignored.\n"), (LPCTSTR)m_filename.c_str());
return false;
static const wchar_t str_shift[] = L"SHIFT", str_ctrl[] = L"CTRL", str_alt[] = L"ALT";
if (i + _countof(str_shift) - 1 <= n && wmemcmp(V_BSTR(&v) + i, str_shift, _countof(str_shift) - 1) == 0) {
kc.shift = true;
i += _countof(str_shift) - 1;
} else if (i + _countof(str_ctrl) - 1 <= n && wmemcmp(V_BSTR(&v) + i, str_ctrl, _countof(str_ctrl) - 1) == 0) {
kc.ctrl = true;
i += _countof(str_ctrl) - 1;
} else if (i + _countof(str_alt) - 1 <= n && wmemcmp(V_BSTR(&v) + i, str_alt, _countof(str_alt) - 1) == 0) {
kc.alt = true;
i += _countof(str_alt) - 1;
} else {
kc.key = V_BSTR(&v)[i];
i++;
}
}
return true;
@@ -270,7 +288,7 @@ bool ZRCola::DBSource::SelectKeySequences(ATL::CComPtr<ADORecordset> &rs) const
wxCHECK(SUCCEEDED(::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_ALL, IID_IADORecordset, (LPVOID*)&rs)), false);
// Open it.
if (FAILED(rs->Open(ATL::CComVariant(L"SELECT DISTINCT [Znak], [tipka] FROM [wrd_KeyCodes]"), ATL::CComVariant(m_db), adOpenStatic, adLockReadOnly, adCmdText))) {
if (FAILED(rs->Open(ATL::CComVariant(L"SELECT DISTINCT [VRS_KeyCodes].[Znak], [VRS_CharGroup].[Name] AS [CharGroup], [VRS_KeyCodes].[KeyCode], [VRS_KeyCodes].[Shift] FROM [VRS_KeyCodes] LEFT JOIN [VRS_CharGroup] ON [VRS_CharGroup].[CharGroup]=[VRS_KeyCodes].[CharGroup]"), ATL::CComVariant(m_db), adOpenStatic, adLockReadOnly, adCmdText))) {
_ftprintf(stderr, wxT("%s: error ZCC0050: Error loading key sequences from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
LogErrors();
return false;
@@ -293,10 +311,38 @@ bool ZRCola::DBSource::GetKeySequence(const ATL::CComPtr<ADORecordset>& rs, ZRCo
wxCHECK(GetUnicodeCharacter(f, ks.chr), false);
}
keyseq::keycode kc1;
{
ATL::CComPtr<ADOField> f;
wxVERIFY(SUCCEEDED(flds->get_Item(ATL::CComVariant(L"tipka"), &f)));
wxCHECK(GetKeySequence(f, ks.seq), false);
wxVERIFY(SUCCEEDED(flds->get_Item(ATL::CComVariant(L"CharGroup"), &f)));
wxCHECK(GetKeyCode(f, kc1), false);
}
int keycode;
{
ATL::CComPtr<ADOField> f;
wxVERIFY(SUCCEEDED(flds->get_Item(ATL::CComVariant(L"KeyCode"), &f)));
wxCHECK(GetValue(f, keycode), false);
}
bool shift;
{
ATL::CComPtr<ADOField> f;
wxVERIFY(SUCCEEDED(flds->get_Item(ATL::CComVariant(L"Shift"), &f)));
wxCHECK(GetValue(f, shift), false);
}
ks.seq.clear();
if (kc1.key) {
// First key in the sequence is complete.
ks.seq.push_back(kc1);
keyseq::keycode kc2 = { keycode, shift };
ks.seq.push_back(kc2);
} else {
// First key in the sequence is only modifier(s).
kc1.key = keycode;
if (shift) kc1.shift = true;
ks.seq.push_back(kc1);
}
return true;

View File

@@ -115,6 +115,32 @@ namespace ZRCola {
}
///
/// Gets boolean from ZRCola.zrc database
///
/// \param[in] f Data field
/// \param[out] val Output boolean value
///
/// \returns
/// - true when successful
/// - false otherwise
///
bool GetValue(const ATL::CComPtr<ADOField>& f, bool& val) const;
///
/// Gets integer from ZRCola.zrc database
///
/// \param[in] f Data field
/// \param[out] val Output integer value
///
/// \returns
/// - true when successful
/// - false otherwise
///
bool GetValue(const ATL::CComPtr<ADOField>& f, int& val) const;
///
/// Gets encoded Unicode character from ZRCola.zrc database
///
@@ -142,16 +168,16 @@ namespace ZRCola {
///
/// Gets encoded key sequence from ZRCola.zrc database
/// Gets encoded key from ZRCola.zrc database
///
/// \param[in] f Data field
/// \param[out] seq Output sequence
/// \param[in] f Data field
/// \param[out] kc Output key code
///
/// \returns
/// - true when successful
/// - false otherwise
///
bool GetKeySequence(const ATL::CComPtr<ADOField>& f, std::vector<keyseq::keycode>& seq) const;
bool GetKeyCode(const ATL::CComPtr<ADOField>& f, keyseq::keycode& kc) const;
///

View File

@@ -23,7 +23,7 @@
// Product version as a single DWORD
// Note: Used for version comparison within C/C++ code.
//
#define ZRCOLA_VERSION 0x01ff0200
#define ZRCOLA_VERSION 0x01ff0400
//
// Product version by components
@@ -33,26 +33,26 @@
//
#define ZRCOLA_VERSION_MAJ 1
#define ZRCOLA_VERSION_MIN 255
#define ZRCOLA_VERSION_REV 2
#define ZRCOLA_VERSION_REV 4
#define ZRCOLA_VERSION_BUILD 0
//
// Human readable product version and build year for UI
//
#define ZRCOLA_VERSION_STR "2.0-alpha2"
#define ZRCOLA_VERSION_STR "2.0-alpha4"
#define ZRCOLA_BUILD_YEAR_STR "2016"
//
// Numerical version presentation for ProductVersion propery in
// MSI packages (syntax: N.N[.N[.N]])
//
#define ZRCOLA_VERSION_INST "1.255.2"
#define ZRCOLA_VERSION_INST "1.255.4"
//
// The product code for ProductCode property in MSI packages
// Replace with new on every version change, regardless how minor it is.
//
#define ZRCOLA_VERSION_GUID "{221AC7C3-020F-4A9B-8005-D49F8B5FE815}"
#define ZRCOLA_VERSION_GUID "{CD41C45D-02B7-4236-9338-F7A5CC26A666}"
//
// The product vendor and application name for configuration keeping.

View File

@@ -37,85 +37,67 @@ void ZRCola::translation_db::Compose(_In_z_count_(inputMax) const wchar_t* input
indexComp::size_type compositionsCount = idxComp.size();
for (size_t i = 0; i < inputMax;) {
// Start with the full search area at i-th character.
for (size_t l = 0, r = compositionsCount, ii = i, j = 0;; ii++, j++) {
if (ii < inputMax) {
size_t l_prev = l;
wchar_t c = input[ii];
while (l < r) {
// Test the composition in the middle of the search area.
size_t m = (l + r) / 2;
// Find the longest matching composition at i-th character.
size_t l_match = (size_t)-1;
for (size_t l = 0, r = compositionsCount, ii = i, j = 0; ii < inputMax && l < r; ii++, j++) {
wchar_t c = input[ii];
while (l < r) {
// Test the composition in the middle of the search area.
size_t m = (l + r) / 2;
// Get the j-th character of the composition.
// All compositions that get short on characters are lexically ordered before.
// Thus the j-th character is considered 0.
const translation &trans = idxComp[m];
wchar_t s = j < trans.str_len ? trans.str[j] : 0;
// Get the j-th character of the composition.
// All compositions that get short on characters are lexically ordered before.
// Thus the j-th character is considered 0.
const translation &trans = idxComp[m];
wchar_t s = j < trans.str_len ? trans.str[j] : 0;
// Do the bisection test.
if (c < s) r = m;
else if (s < c) l = m + 1;
else {
// Character found.
// Do the bisection test.
if (c < s) r = m;
else if (s < c) l = m + 1;
else {
// Character found.
// Narrow the search area on the left to start at the first composition in the run.
for (size_t rr = m; l < rr;) {
size_t m = (l + rr) / 2;
const translation &trans = idxComp[m];
wchar_t s = j < trans.str_len ? trans.str[j] : 0;
if (c <= s) rr = m; else l = m + 1;
}
// Narrow the search area on the right to end at the first composition not in the run.
for (size_t ll = m + 1; ll < r;) {
size_t m = (ll + r) / 2;
const translation &trans = idxComp[m];
wchar_t s = j < trans.str_len ? trans.str[j] : 0;
if (s <= c) ll = m + 1; else r = m;
}
break;
// Narrow the search area on the left to start at the first composition in the run.
for (size_t rr = m; l < rr;) {
size_t m = (l + rr) / 2;
const translation &trans = idxComp[m];
wchar_t s = j < trans.str_len ? trans.str[j] : 0;
if (c <= s) rr = m; else l = m + 1;
}
}
if (l >= r) {
// The search area is empty.
const translation &trans = idxComp[l_prev];
if (j && l_prev < compositionsCount && j == trans.str_len) {
// The first composition of the previous run was a match.
output += trans.chr;
i = ii;
if (j > 1 && map) {
// Mapping changed.
map->push_back(ZRCola::mapping(output.length(), i));
}
} else {
// The exact match was not found.
output += input[i];
i++;
// Narrow the search area on the right to end at the first composition not in the run.
for (size_t ll = m + 1; ll < r;) {
size_t m = (ll + r) / 2;
const translation &trans = idxComp[m];
wchar_t s = j < trans.str_len ? trans.str[j] : 0;
if (s <= c) ll = m + 1; else r = m;
}
const translation &trans = idxComp[l];
if (j + 1 == trans.str_len) {
// The first composition of the run was a match (thus far). Save it.
l_match = l;
}
break;
}
} else {
// End of input reached.
const translation &trans = idxComp[l];
if (l < compositionsCount && j == trans.str_len) {
// The first composition of the previous run was a match.
output += trans.chr;
i = ii;
if (j > 1 && map) {
// Mapping changed.
map->push_back(ZRCola::mapping(output.length(), i));
}
} else {
output += input[i];
i++;
}
break;
}
}
if (l_match < compositionsCount) {
// The saved composition was an exact match.
const translation &trans = idxComp[l_match];
output += trans.chr;
i += trans.str_len;
if (trans.str_len > 1 && map) {
// Mapping changed.
map->push_back(ZRCola::mapping(output.length(), i));
}
} else {
// The match was not found.
output += input[i];
i++;
}
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: wxWidgets 3.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-02-02 15:21+0100\n"
"PO-Revision-Date: 2016-03-14 17:12+0100\n"
"PO-Revision-Date: 2016-04-08 13:05+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Simon Rozman <simon.rozman@amebis.si>\n"
"Language: sl_SI\n"
@@ -2955,7 +2955,7 @@ msgstr "Izreži"
# generic/dirdlgg.cpp:191
#: ../src/common/stockitem.cpp:259
msgid "Cut selection"
msgstr "Prilepi izbor"
msgstr "Izreži izbor"
#: ../src/common/fmapbase.cpp:152
msgid "Cyrillic (ISO-8859-5)"