parent
4a27d62b4e
commit
15365aff46
@ -294,6 +294,25 @@
|
|||||||
<property name="label">&Language</property>
|
<property name="label">&Language</property>
|
||||||
<property name="name">m_menuDecompLanguage</property>
|
<property name="name">m_menuDecompLanguage</property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
|
<object class="wxMenuItem" expanded="0">
|
||||||
|
<property name="bitmap"></property>
|
||||||
|
<property name="checked">0</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="help">Set language according to keyboard layout automatically</property>
|
||||||
|
<property name="id">wxID_DECOMP_LANG_AUTO</property>
|
||||||
|
<property name="kind">wxITEM_CHECK</property>
|
||||||
|
<property name="label">&Automatic</property>
|
||||||
|
<property name="name">m_menuDecompLanguageAuto</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
<property name="shortcut"></property>
|
||||||
|
<property name="unchecked_bitmap"></property>
|
||||||
|
<event name="OnMenuSelection"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
<object class="separator" expanded="0">
|
||||||
|
<property name="name">m_separatorDecompLanguage1</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxMenu" expanded="0">
|
<object class="wxMenu" expanded="0">
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: ZRCola\n"
|
"Project-Id-Version: ZRCola\n"
|
||||||
"POT-Creation-Date: 2016-04-29 09:43+0200\n"
|
"POT-Creation-Date: 2016-04-29 12:50+0200\n"
|
||||||
"PO-Revision-Date: 2016-04-29 09:44+0200\n"
|
"PO-Revision-Date: 2016-04-29 12:50+0200\n"
|
||||||
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||||
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||||
"Language: sl_SI\n"
|
"Language: sl_SI\n"
|
||||||
@ -17,12 +17,12 @@ msgstr ""
|
|||||||
"X-Poedit-KeywordsList: _\n"
|
"X-Poedit-KeywordsList: _\n"
|
||||||
"X-Poedit-SearchPath-0: .\n"
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
|
||||||
#: zrcolafrm.cpp:73
|
#: zrcolafrm.cpp:76
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Select %s language for decomposition"
|
msgid "Select %s language for decomposition"
|
||||||
msgstr "Izberi jezik %s za razstavljanje"
|
msgstr "Izberi jezik %s za razstavljanje"
|
||||||
|
|
||||||
#: zrcolafrm.cpp:84
|
#: zrcolafrm.cpp:87
|
||||||
msgid ""
|
msgid ""
|
||||||
"ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality "
|
"ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality "
|
||||||
"will not be available."
|
"will not be available."
|
||||||
@ -30,11 +30,11 @@ msgstr ""
|
|||||||
"ZRColine bližnjice na tipkovnici Win+F5 ni mogoče registrirati. Nekaj "
|
"ZRColine bližnjice na tipkovnici Win+F5 ni mogoče registrirati. Nekaj "
|
||||||
"funkcionalnosti ne bo na voljo."
|
"funkcionalnosti ne bo na voljo."
|
||||||
|
|
||||||
#: zrcolafrm.cpp:84 zrcolafrm.cpp:86
|
#: zrcolafrm.cpp:87 zrcolafrm.cpp:89
|
||||||
msgid "Warning"
|
msgid "Warning"
|
||||||
msgstr "Opozorilo"
|
msgstr "Opozorilo"
|
||||||
|
|
||||||
#: zrcolafrm.cpp:86
|
#: zrcolafrm.cpp:89
|
||||||
msgid ""
|
msgid ""
|
||||||
"ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality "
|
"ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality "
|
||||||
"will not be available."
|
"will not be available."
|
||||||
@ -42,11 +42,11 @@ msgstr ""
|
|||||||
"ZRColine bližnjice na tipkovnici Win+F6 ni mogoče registrirati. Nekaj "
|
"ZRColine bližnjice na tipkovnici Win+F6 ni mogoče registrirati. Nekaj "
|
||||||
"funkcionalnosti ne bo na voljo."
|
"funkcionalnosti ne bo na voljo."
|
||||||
|
|
||||||
#: zrcolafrm.cpp:123
|
#: zrcolafrm.cpp:151
|
||||||
msgid "Start ZRCola automatically on logon"
|
msgid "Start ZRCola automatically on logon"
|
||||||
msgstr "Samodejno zaženi ZRColo ob prijavi"
|
msgstr "Samodejno zaženi ZRColo ob prijavi"
|
||||||
|
|
||||||
#: zrcolafrm.cpp:253
|
#: zrcolafrm.cpp:309
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"ZRCola v%s\n"
|
"ZRCola v%s\n"
|
||||||
@ -55,7 +55,7 @@ msgstr ""
|
|||||||
"ZRCola v%s\n"
|
"ZRCola v%s\n"
|
||||||
"Vse pravice pridržane 2015-%s Amebis"
|
"Vse pravice pridržane 2015-%s Amebis"
|
||||||
|
|
||||||
#: zrcolafrm.cpp:253
|
#: zrcolafrm.cpp:309
|
||||||
msgid "About ZRCola"
|
msgid "About ZRCola"
|
||||||
msgstr "O ZRColi"
|
msgstr "O ZRColi"
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ msgstr "Izberi celotno besedilo"
|
|||||||
msgid "&Send Composed"
|
msgid "&Send Composed"
|
||||||
msgstr "Pošlji &sestavljeno"
|
msgstr "Pošlji &sestavljeno"
|
||||||
|
|
||||||
#: zrcolagui.cpp:80 zrcolagui.cpp:131
|
#: zrcolagui.cpp:80 zrcolagui.cpp:137
|
||||||
msgid "Send composed text to source window"
|
msgid "Send composed text to source window"
|
||||||
msgstr "Pošlji sestavljeno besedilo izvornemu oknu"
|
msgstr "Pošlji sestavljeno besedilo izvornemu oknu"
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ msgstr "Pošlji sestavljeno besedilo izvornemu oknu"
|
|||||||
msgid "Send &Decomposed"
|
msgid "Send &Decomposed"
|
||||||
msgstr "Pošlji &razstavljeno"
|
msgstr "Pošlji &razstavljeno"
|
||||||
|
|
||||||
#: zrcolagui.cpp:89 zrcolagui.cpp:133
|
#: zrcolagui.cpp:89 zrcolagui.cpp:139
|
||||||
msgid "Send decomposed text to source window"
|
msgid "Send decomposed text to source window"
|
||||||
msgstr "Pošlji razstavljeno besedilo izvornemu oknu"
|
msgstr "Pošlji razstavljeno besedilo izvornemu oknu"
|
||||||
|
|
||||||
@ -115,67 +115,75 @@ msgstr "Prekini sestavljanje in vrni fokus nazaj izvornemu oknu"
|
|||||||
msgid "&Language"
|
msgid "&Language"
|
||||||
msgstr "&Jezik"
|
msgstr "&Jezik"
|
||||||
|
|
||||||
#: zrcolagui.cpp:110
|
#: zrcolagui.cpp:109
|
||||||
|
msgid "&Automatic"
|
||||||
|
msgstr "S&amodejno"
|
||||||
|
|
||||||
|
#: zrcolagui.cpp:109
|
||||||
|
msgid "Set language according to keyboard layout automatically"
|
||||||
|
msgstr "Samodejno nastavi jezik glede na izbrano tipkovnico"
|
||||||
|
|
||||||
|
#: zrcolagui.cpp:116
|
||||||
msgid "&Edit"
|
msgid "&Edit"
|
||||||
msgstr "Ur&edi"
|
msgstr "Ur&edi"
|
||||||
|
|
||||||
#: zrcolagui.cpp:117
|
#: zrcolagui.cpp:123
|
||||||
msgid "&Help"
|
msgid "&Help"
|
||||||
msgstr "&Pomoč"
|
msgstr "&Pomoč"
|
||||||
|
|
||||||
#: zrcolagui.cpp:123
|
#: zrcolagui.cpp:129
|
||||||
msgid "Cut"
|
msgid "Cut"
|
||||||
msgstr "Izreži"
|
msgstr "Izreži"
|
||||||
|
|
||||||
#: zrcolagui.cpp:123
|
#: zrcolagui.cpp:129
|
||||||
msgid "Cut selection"
|
msgid "Cut selection"
|
||||||
msgstr "Izreži izbor"
|
msgstr "Izreži izbor"
|
||||||
|
|
||||||
#: zrcolagui.cpp:125
|
#: zrcolagui.cpp:131
|
||||||
msgid "Copy"
|
msgid "Copy"
|
||||||
msgstr "Kopiraj"
|
msgstr "Kopiraj"
|
||||||
|
|
||||||
#: zrcolagui.cpp:125
|
#: zrcolagui.cpp:131
|
||||||
msgid "Copy selection"
|
msgid "Copy selection"
|
||||||
msgstr "Kopiraj izbor"
|
msgstr "Kopiraj izbor"
|
||||||
|
|
||||||
#: zrcolagui.cpp:127
|
#: zrcolagui.cpp:133
|
||||||
msgid "Paste"
|
msgid "Paste"
|
||||||
msgstr "Prilepi"
|
msgstr "Prilepi"
|
||||||
|
|
||||||
#: zrcolagui.cpp:127
|
#: zrcolagui.cpp:133
|
||||||
msgid "Paste selection"
|
msgid "Paste selection"
|
||||||
msgstr "Prilepi izbor"
|
msgstr "Prilepi izbor"
|
||||||
|
|
||||||
#: zrcolagui.cpp:131
|
#: zrcolagui.cpp:137
|
||||||
msgid "Send Composed"
|
msgid "Send Composed"
|
||||||
msgstr "Pošlji sestavljeno"
|
msgstr "Pošlji sestavljeno"
|
||||||
|
|
||||||
#: zrcolagui.cpp:133
|
#: zrcolagui.cpp:139
|
||||||
msgid "Send Decomposed"
|
msgid "Send Decomposed"
|
||||||
msgstr "Pošlji razstavljeno"
|
msgstr "Pošlji razstavljeno"
|
||||||
|
|
||||||
#: zrcolagui.cpp:135
|
#: zrcolagui.cpp:141
|
||||||
msgid "Language:"
|
msgid "Language:"
|
||||||
msgstr "Jezik:"
|
msgstr "Jezik:"
|
||||||
|
|
||||||
#: zrcolagui.cpp:184
|
#: zrcolagui.cpp:190
|
||||||
msgid "Decomposed Text"
|
msgid "Decomposed Text"
|
||||||
msgstr "Razstavljeno besedilo"
|
msgstr "Razstavljeno besedilo"
|
||||||
|
|
||||||
#: zrcolagui.cpp:204
|
#: zrcolagui.cpp:210
|
||||||
msgid "Decomposed Unicode Dump"
|
msgid "Decomposed Unicode Dump"
|
||||||
msgstr "Unicode razstavljenega"
|
msgstr "Unicode razstavljenega"
|
||||||
|
|
||||||
#: zrcolagui.cpp:231
|
#: zrcolagui.cpp:237
|
||||||
msgid "Composed Text"
|
msgid "Composed Text"
|
||||||
msgstr "Sestavljeno besedilo"
|
msgstr "Sestavljeno besedilo"
|
||||||
|
|
||||||
#: zrcolagui.cpp:251
|
#: zrcolagui.cpp:257
|
||||||
msgid "Composed Unicode Dump"
|
msgid "Composed Unicode Dump"
|
||||||
msgstr "Unicode sestavljenega"
|
msgstr "Unicode sestavljenega"
|
||||||
|
|
||||||
#: zrcolagui.h:76 MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
#: zrcolagui.h:77 MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||||
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:4
|
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:4
|
||||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||||
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:4
|
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:4
|
||||||
|
@ -25,28 +25,31 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
|
wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
|
||||||
EVT_UPDATE_UI (wxID_AUTOSTART , wxZRColaFrame::OnAutostartUpdate )
|
EVT_UPDATE_UI (wxID_AUTOSTART , wxZRColaFrame::OnAutostartUpdate )
|
||||||
EVT_MENU (wxID_AUTOSTART , wxZRColaFrame::OnAutostart )
|
EVT_MENU (wxID_AUTOSTART , wxZRColaFrame::OnAutostart )
|
||||||
EVT_MENU (wxID_EXIT , wxZRColaFrame::OnExit )
|
EVT_MENU (wxID_EXIT , wxZRColaFrame::OnExit )
|
||||||
|
|
||||||
EVT_UPDATE_UI_RANGE(wxID_CUT, wxID_CLEAR , wxZRColaFrame::OnForwardEventUpdate )
|
EVT_UPDATE_UI_RANGE(wxID_CUT, wxID_CLEAR , wxZRColaFrame::OnForwardEventUpdate )
|
||||||
EVT_MENU_RANGE (wxID_CUT, wxID_CLEAR , wxZRColaFrame::OnForwardEvent )
|
EVT_MENU_RANGE (wxID_CUT, wxID_CLEAR , wxZRColaFrame::OnForwardEvent )
|
||||||
EVT_UPDATE_UI (wxID_SELECTALL , wxZRColaFrame::OnForwardEventUpdate )
|
EVT_UPDATE_UI (wxID_SELECTALL , wxZRColaFrame::OnForwardEventUpdate )
|
||||||
EVT_MENU (wxID_SELECTALL , wxZRColaFrame::OnForwardEvent )
|
EVT_MENU (wxID_SELECTALL , wxZRColaFrame::OnForwardEvent )
|
||||||
|
|
||||||
EVT_UPDATE_UI_RANGE(wxID_SEND_COMPOSED, wxID_SEND_ABORT , wxZRColaFrame::OnSendUpdate )
|
EVT_UPDATE_UI_RANGE(wxID_SEND_COMPOSED, wxID_SEND_ABORT , wxZRColaFrame::OnSendUpdate )
|
||||||
EVT_MENU (wxID_SEND_COMPOSED , wxZRColaFrame::OnSendComposed )
|
EVT_MENU (wxID_SEND_COMPOSED , wxZRColaFrame::OnSendComposed )
|
||||||
EVT_MENU (wxID_SEND_DECOMPOSED , wxZRColaFrame::OnSendDecomposed )
|
EVT_MENU (wxID_SEND_DECOMPOSED , wxZRColaFrame::OnSendDecomposed )
|
||||||
EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
|
EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
|
||||||
|
|
||||||
EVT_UPDATE_UI_RANGE(wxID_DECOMP_LANGUAGE_START, wxID_DECOMP_LANGUAGE_END, wxZRColaFrame::OnDecomposedLanguageUpdate)
|
EVT_UPDATE_UI (wxID_DECOMP_LANG_AUTO , wxZRColaFrame::OnDecomposedLanguageAutoUpdate)
|
||||||
EVT_MENU_RANGE (wxID_DECOMP_LANGUAGE_START, wxID_DECOMP_LANGUAGE_END, wxZRColaFrame::OnDecomposedLanguage )
|
EVT_MENU (wxID_DECOMP_LANG_AUTO , wxZRColaFrame::OnDecomposedLanguageAuto )
|
||||||
|
EVT_UPDATE_UI_RANGE(wxID_DECOMP_LANGUAGE_START, wxID_DECOMP_LANGUAGE_END, wxZRColaFrame::OnDecomposedLanguageUpdate )
|
||||||
|
EVT_MENU_RANGE (wxID_DECOMP_LANGUAGE_START, wxID_DECOMP_LANGUAGE_END, wxZRColaFrame::OnDecomposedLanguage )
|
||||||
|
|
||||||
EVT_MENU (wxID_ABOUT , wxZRColaFrame::OnAbout )
|
EVT_MENU (wxID_ABOUT , wxZRColaFrame::OnAbout )
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
wxZRColaFrame::wxZRColaFrame() :
|
wxZRColaFrame::wxZRColaFrame() :
|
||||||
|
m_lang_auto(true),
|
||||||
m_hWndSource(NULL),
|
m_hWndSource(NULL),
|
||||||
wxZRColaFrameBase(NULL)
|
wxZRColaFrameBase(NULL)
|
||||||
{
|
{
|
||||||
@ -70,7 +73,7 @@ wxZRColaFrame::wxZRColaFrame() :
|
|||||||
label(lang.name, lang.name_len),
|
label(lang.name, lang.name_len),
|
||||||
label_tran(wxGetTranslation(label));
|
label_tran(wxGetTranslation(label));
|
||||||
if (i < wxID_DECOMP_LANGUAGE_END - wxID_DECOMP_LANGUAGE_START + 1)
|
if (i < wxID_DECOMP_LANGUAGE_END - wxID_DECOMP_LANGUAGE_START + 1)
|
||||||
m_menuDecompLanguage->Insert(i, wxID_DECOMP_LANGUAGE_START + i, label_tran, wxString::Format(_("Select %s language for decomposition"), (const wxStringCharType*)label_tran), wxITEM_RADIO);
|
m_menuDecompLanguage->AppendRadioItem(wxID_DECOMP_LANGUAGE_START + i, label_tran, wxString::Format(_("Select %s language for decomposition"), (const wxStringCharType*)label_tran));
|
||||||
m_toolDecompLanguage->Insert(label_tran, i);
|
m_toolDecompLanguage->Insert(label_tran, i);
|
||||||
if (memcmp(m_lang, lang.id, sizeof(m_lang)) == 0)
|
if (memcmp(m_lang, lang.id, sizeof(m_lang)) == 0)
|
||||||
m_toolDecompLanguage->Select(i);
|
m_toolDecompLanguage->Select(i);
|
||||||
@ -84,11 +87,38 @@ wxZRColaFrame::wxZRColaFrame() :
|
|||||||
wxMessageBox(_("ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
|
wxMessageBox(_("ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
|
||||||
if (!RegisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE, wxMOD_WIN, VK_F6))
|
if (!RegisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE, wxMOD_WIN, VK_F6))
|
||||||
wxMessageBox(_("ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
|
wxMessageBox(_("ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
|
||||||
|
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
// Register notification sink for language detection.
|
||||||
|
m_ulRefCount = 1;
|
||||||
|
m_tfSource = NULL;
|
||||||
|
ITfInputProcessorProfiles *pProfiles;
|
||||||
|
HRESULT hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER, IID_ITfInputProcessorProfiles, (LPVOID*)&pProfiles);
|
||||||
|
if(SUCCEEDED(hr)) {
|
||||||
|
hr = pProfiles->QueryInterface(IID_ITfSource, (LPVOID*)&m_tfSource);
|
||||||
|
if(SUCCEEDED(hr)) {
|
||||||
|
hr = m_tfSource->AdviseSink(IID_ITfLanguageProfileNotifySink, (ITfLanguageProfileNotifySink*)this, &m_dwCookie);
|
||||||
|
if (FAILED(hr) || m_dwCookie == -1) {
|
||||||
|
m_tfSource->Release();
|
||||||
|
m_tfSource = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pProfiles->Release();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxZRColaFrame::~wxZRColaFrame()
|
wxZRColaFrame::~wxZRColaFrame()
|
||||||
{
|
{
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
if (m_tfSource) {
|
||||||
|
m_tfSource->UnadviseSink(m_dwCookie);
|
||||||
|
m_tfSource->Release();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Unregister global hotkey(s).
|
// Unregister global hotkey(s).
|
||||||
UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
|
UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
|
||||||
UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);
|
UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);
|
||||||
@ -207,6 +237,32 @@ void wxZRColaFrame::OnSendAbort(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxZRColaFrame::OnDecomposedLanguageAutoUpdate(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
event.Check(m_lang_auto);
|
||||||
|
#else
|
||||||
|
event.Enable(false);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxZRColaFrame::OnDecomposedLanguageAuto(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
// Toggle auto language flag.
|
||||||
|
m_lang_auto = !m_lang_auto;
|
||||||
|
|
||||||
|
if (m_lang_auto) {
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
// Set keyboard language.
|
||||||
|
HKL hkl = ::GetKeyboardLayout(0);
|
||||||
|
ZRCola::LangConvert(LOWORD(hkl), m_lang);
|
||||||
|
UpdateDecomposedLanguage();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxZRColaFrame::OnDecomposedLanguageUpdate(wxUpdateUIEvent& event)
|
void wxZRColaFrame::OnDecomposedLanguageUpdate(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||||
@ -228,6 +284,7 @@ void wxZRColaFrame::OnDecomposedLanguage(wxCommandEvent& event)
|
|||||||
// Notify composed text something changed and should re-decompose.
|
// Notify composed text something changed and should re-decompose.
|
||||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
m_panel->m_composed->ProcessWindowEvent(event2);
|
m_panel->m_composed->ProcessWindowEvent(event2);
|
||||||
|
m_lang_auto = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +301,7 @@ void wxZRColaFrame::OnDecompLanguageChoice(wxCommandEvent& event)
|
|||||||
// Notify composed text something changed and should re-decompose.
|
// Notify composed text something changed and should re-decompose.
|
||||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
m_panel->m_composed->ProcessWindowEvent(event2);
|
m_panel->m_composed->ProcessWindowEvent(event2);
|
||||||
|
m_lang_auto = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,6 +312,66 @@ void wxZRColaFrame::OnAbout(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE wxZRColaFrame::OnLanguageChange(LANGID langid, __RPC__out BOOL *pfAccept)
|
||||||
|
{
|
||||||
|
if (pfAccept) *pfAccept = TRUE;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE wxZRColaFrame::OnLanguageChanged()
|
||||||
|
{
|
||||||
|
if (m_lang_auto) {
|
||||||
|
// Set keyboard language.
|
||||||
|
HKL hkl = ::GetKeyboardLayout(0);
|
||||||
|
ZRCola::LangConvert(LOWORD(hkl), m_lang);
|
||||||
|
UpdateDecomposedLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE wxZRColaFrame::QueryInterface(REFIID riid, __RPC__deref_out void __RPC_FAR *__RPC_FAR *ppvObject)
|
||||||
|
{
|
||||||
|
if (!ppvObject)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (riid == IID_IUnknown)
|
||||||
|
*ppvObject = static_cast<IUnknown*>(this);
|
||||||
|
else if (riid == IID_ITfLanguageProfileNotifySink)
|
||||||
|
*ppvObject = static_cast<ITfLanguageProfileNotifySink*>(this);
|
||||||
|
else {
|
||||||
|
*ppvObject = NULL;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddRef();
|
||||||
|
return NOERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE wxZRColaFrame::AddRef()
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_ulRefCount);
|
||||||
|
return m_ulRefCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE wxZRColaFrame::Release()
|
||||||
|
{
|
||||||
|
// Decrement the object's internal counter.
|
||||||
|
ULONG ulRefCount = InterlockedDecrement(&m_ulRefCount);
|
||||||
|
if (m_ulRefCount == 0)
|
||||||
|
delete this;
|
||||||
|
return ulRefCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void wxZRColaFrame::DoSend(const wxString& str)
|
void wxZRColaFrame::DoSend(const wxString& str)
|
||||||
{
|
{
|
||||||
// Prepare the INPUT table.
|
// Prepare the INPUT table.
|
||||||
@ -288,6 +406,22 @@ void wxZRColaFrame::DoSend(const wxString& str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxZRColaFrame::UpdateDecomposedLanguage()
|
||||||
|
{
|
||||||
|
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||||
|
|
||||||
|
// Find language on the language list.
|
||||||
|
ZRCola::language_db::language *l = new ZRCola::language_db::language;
|
||||||
|
memcpy(l->id, m_lang, sizeof(l->id));
|
||||||
|
l->name_len = 0;
|
||||||
|
ZRCola::language_db::indexLang::size_type start, end;
|
||||||
|
m_toolDecompLanguage->SetSelection(app->m_lang_db.idxLng.find(*l, start, end) ? start : -1);
|
||||||
|
delete l;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
|
||||||
WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
if (message == WM_HOTKEY) {
|
if (message == WM_HOTKEY) {
|
||||||
@ -334,6 +468,8 @@ WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM
|
|||||||
return wxZRColaFrameBase::MSWWindowProc(message, wParam, lParam);
|
return wxZRColaFrameBase::MSWWindowProc(message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// wxPersistentZRColaFrame
|
// wxPersistentZRColaFrame
|
||||||
@ -349,7 +485,8 @@ void wxPersistentZRColaFrame::Save() const
|
|||||||
const wxZRColaFrame * const wnd = static_cast<const wxZRColaFrame*>(GetWindow());
|
const wxZRColaFrame * const wnd = static_cast<const wxZRColaFrame*>(GetWindow());
|
||||||
|
|
||||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
|
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
|
||||||
SaveValue(wxT("lang"), wxString::FromAscii(wnd->m_lang, sizeof(wnd->m_lang)));
|
SaveValue(wxT("langAuto"), wnd->m_lang_auto);
|
||||||
|
SaveValue(wxT("lang" ), wxString::FromAscii(wnd->m_lang, sizeof(wnd->m_lang)));
|
||||||
wxPersistentTLW::Save();
|
wxPersistentTLW::Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,24 +499,24 @@ bool wxPersistentZRColaFrame::Restore()
|
|||||||
|
|
||||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||||
wxString lang;
|
wxString lang;
|
||||||
if (RestoreValue(wxT("lang"), &lang) && lang.Length() == 3) {
|
|
||||||
memcpy(wnd->m_lang, (const char*)lang.c_str(), sizeof(wnd->m_lang));
|
|
||||||
|
|
||||||
ZRCola::language_db::language *lang = new ZRCola::language_db::language;
|
// Restore automatic language detection setting first.
|
||||||
memcpy(lang->id, wnd->m_lang, sizeof(lang->id));
|
RestoreValue(wxT("langAuto"), &(wnd->m_lang_auto));
|
||||||
lang->name_len = 0;
|
if (wnd->m_lang_auto) {
|
||||||
ZRCola::language_db::indexLang::size_type start, end;
|
#if defined(__WXMSW__)
|
||||||
wnd->m_toolDecompLanguage->SetSelection(app->m_lang_db.idxLng.find(*lang, start, end) ? start : -1);
|
// Set keyboard language.
|
||||||
delete lang;
|
HKL hkl = ::GetKeyboardLayout(0);
|
||||||
} else {
|
ZRCola::LangConvert(LOWORD(hkl), wnd->m_lang);
|
||||||
if (!app->m_lang_db.idxLng.empty()) {
|
#endif
|
||||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[0];
|
} else if (RestoreValue(wxT("lang"), &lang) && lang.Length() == 3) {
|
||||||
memcpy(wnd->m_lang, lang.id, sizeof(wnd->m_lang));
|
// The language was read from configuration.
|
||||||
wnd->m_toolDecompLanguage->Select(0);
|
memcpy(wnd->m_lang, (const char*)lang.c_str(), sizeof(wnd->m_lang));
|
||||||
} else {
|
} else if (!app->m_lang_db.idxLng.empty()) {
|
||||||
memcpy(wnd->m_lang, ZRCOLA_LANG_VOID, sizeof(wnd->m_lang));
|
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[0];
|
||||||
}
|
memcpy(wnd->m_lang, lang.id, sizeof(wnd->m_lang));
|
||||||
}
|
} else
|
||||||
|
memcpy(wnd->m_lang, ZRCOLA_LANG_VOID, sizeof(wnd->m_lang));
|
||||||
|
wnd->UpdateDecomposedLanguage();
|
||||||
|
|
||||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Restore();
|
wxPersistentZRColaComposerPanel(wnd->m_panel).Restore();
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ class wxZRColaFrame;
|
|||||||
#include "zrcolagui.h"
|
#include "zrcolagui.h"
|
||||||
#include <zrcola/language.h>
|
#include <zrcola/language.h>
|
||||||
#include <wx/persist/toplevel.h>
|
#include <wx/persist/toplevel.h>
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
#include <msctf.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -41,7 +44,11 @@ class wxZRColaFrame;
|
|||||||
///
|
///
|
||||||
/// ZRCola main frame
|
/// ZRCola main frame
|
||||||
///
|
///
|
||||||
class wxZRColaFrame : public wxZRColaFrameBase
|
class wxZRColaFrame :
|
||||||
|
public wxZRColaFrameBase
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
, protected ITfLanguageProfileNotifySink
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
@ -53,6 +60,9 @@ public:
|
|||||||
wxZRColaFrame();
|
wxZRColaFrame();
|
||||||
virtual ~wxZRColaFrame();
|
virtual ~wxZRColaFrame();
|
||||||
|
|
||||||
|
friend class wxPersistentZRColaFrame;
|
||||||
|
friend class wxZRColaComposerPanel;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnAutostartUpdate(wxUpdateUIEvent& event);
|
void OnAutostartUpdate(wxUpdateUIEvent& event);
|
||||||
void OnAutostart(wxCommandEvent& event);
|
void OnAutostart(wxCommandEvent& event);
|
||||||
@ -63,22 +73,41 @@ protected:
|
|||||||
void OnSendComposed(wxCommandEvent& event);
|
void OnSendComposed(wxCommandEvent& event);
|
||||||
void OnSendDecomposed(wxCommandEvent& event);
|
void OnSendDecomposed(wxCommandEvent& event);
|
||||||
void OnSendAbort(wxCommandEvent& event);
|
void OnSendAbort(wxCommandEvent& event);
|
||||||
|
void OnDecomposedLanguageAutoUpdate(wxUpdateUIEvent& event);
|
||||||
|
void OnDecomposedLanguageAuto(wxCommandEvent& event);
|
||||||
void OnDecomposedLanguageUpdate(wxUpdateUIEvent& event);
|
void OnDecomposedLanguageUpdate(wxUpdateUIEvent& event);
|
||||||
void OnDecomposedLanguage(wxCommandEvent& event);
|
void OnDecomposedLanguage(wxCommandEvent& event);
|
||||||
virtual void OnDecompLanguageChoice(wxCommandEvent& event);
|
virtual void OnDecompLanguageChoice(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
friend class wxPersistentZRColaFrame;
|
protected:
|
||||||
friend class wxZRColaComposerPanel;
|
#if defined(__WXMSW__)
|
||||||
|
ITfSource *m_tfSource; ///< Text Services install sink helper
|
||||||
|
DWORD m_dwCookie; ///< Text Services installed sink cookie
|
||||||
|
|
||||||
|
// ITfLanguageProfileNotifySink implementation
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE OnLanguageChange(LANGID langid, __RPC__out BOOL *pfAccept);
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE OnLanguageChanged();
|
||||||
|
|
||||||
|
// IUnknown implementation
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, __RPC__deref_out void __RPC_FAR *__RPC_FAR *ppvObject);
|
||||||
|
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||||
|
virtual ULONG STDMETHODCALLTYPE Release();
|
||||||
|
ULONG m_ulRefCount; ///< COM object reference count
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoSend(const wxString& str);
|
void DoSend(const wxString& str);
|
||||||
|
void UpdateDecomposedLanguage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
#ifdef __WXMSW__
|
||||||
virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool m_lang_auto; ///< Automatic language selection according to keyboard layout
|
||||||
ZRCola::langid_t m_lang; ///< Language for decomposing
|
ZRCola::langid_t m_lang; ///< Language for decomposing
|
||||||
WXHWND m_hWndSource; ///< handle of the active window, when the ZRCola hotkey was pressed
|
WXHWND m_hWndSource; ///< handle of the active window, when the ZRCola hotkey was pressed
|
||||||
};
|
};
|
||||||
|
@ -105,6 +105,12 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
|||||||
|
|
||||||
m_menuDecompLanguage = new wxMenu();
|
m_menuDecompLanguage = new wxMenu();
|
||||||
wxMenuItem* m_menuDecompLanguageItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("&Language"), wxEmptyString, wxITEM_NORMAL, m_menuDecompLanguage );
|
wxMenuItem* m_menuDecompLanguageItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("&Language"), wxEmptyString, wxITEM_NORMAL, m_menuDecompLanguage );
|
||||||
|
wxMenuItem* m_menuDecompLanguageAuto;
|
||||||
|
m_menuDecompLanguageAuto = new wxMenuItem( m_menuDecompLanguage, wxID_DECOMP_LANG_AUTO, wxString( _("&Automatic") ) , _("Set language according to keyboard layout automatically"), wxITEM_CHECK );
|
||||||
|
m_menuDecompLanguage->Append( m_menuDecompLanguageAuto );
|
||||||
|
|
||||||
|
m_menuDecompLanguage->AppendSeparator();
|
||||||
|
|
||||||
m_menuEdit->Append( m_menuDecompLanguageItem );
|
m_menuEdit->Append( m_menuDecompLanguageItem );
|
||||||
|
|
||||||
m_menubar->Append( m_menuEdit, _("&Edit") );
|
m_menubar->Append( m_menuEdit, _("&Edit") );
|
||||||
|
@ -48,7 +48,8 @@ class wxZRColaFrameBase : public wxFrame
|
|||||||
wxID_AUTOSTART = 1000,
|
wxID_AUTOSTART = 1000,
|
||||||
wxID_SEND_COMPOSED,
|
wxID_SEND_COMPOSED,
|
||||||
wxID_SEND_DECOMPOSED,
|
wxID_SEND_DECOMPOSED,
|
||||||
wxID_SEND_ABORT
|
wxID_SEND_ABORT,
|
||||||
|
wxID_DECOMP_LANG_AUTO
|
||||||
};
|
};
|
||||||
|
|
||||||
wxMenuBar* m_menubar;
|
wxMenuBar* m_menubar;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user