parent
a81dd7e250
commit
e4fb91e305
1024
ZRCola/ZRCola.fbp
1024
ZRCola/ZRCola.fbp
File diff suppressed because it is too large
Load Diff
@ -88,6 +88,7 @@
|
||||
<ClCompile Include="zrcolafrm.cpp" />
|
||||
<ClCompile Include="zrcolagui.cpp" />
|
||||
<ClCompile Include="zrcolakeyhndlr.cpp" />
|
||||
<ClCompile Include="zrcolasettings.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
@ -99,6 +100,7 @@
|
||||
<ClInclude Include="zrcolafrm.h" />
|
||||
<ClInclude Include="zrcolagui.h" />
|
||||
<ClInclude Include="zrcolakeyhndlr.h" />
|
||||
<ClInclude Include="zrcolasettings.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\lib\libZRColaUI\build\libZRColaUI.vcxproj">
|
||||
|
@ -46,6 +46,9 @@
|
||||
<ClCompile Include="zrcolachrslct.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="zrcolasettings.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
@ -75,6 +78,9 @@
|
||||
<ClInclude Include="zrcolachrslct.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zrcolasettings.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\zrcola.ico">
|
||||
|
@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ZRCola\n"
|
||||
"POT-Creation-Date: 2016-05-13 13:33+0200\n"
|
||||
"PO-Revision-Date: 2016-05-13 13:34+0200\n"
|
||||
"POT-Creation-Date: 2016-05-13 15:52+0200\n"
|
||||
"PO-Revision-Date: 2016-05-13 15:52+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,19 +17,14 @@ msgstr ""
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
|
||||
#: zrcolafrm.cpp:96 zrcolagui.h:97 MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: zrcolafrm.cpp:90 zrcolagui.h:98 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"
|
||||
|
||||
#: zrcolafrm.cpp:107
|
||||
#, c-format
|
||||
msgid "Select %s language for decomposition"
|
||||
msgstr "Izberi jezik %s za razstavljanje"
|
||||
|
||||
#: zrcolafrm.cpp:129
|
||||
#: zrcolafrm.cpp:108
|
||||
msgid ""
|
||||
"ZRCola keyboard shortcut Win+F5 could not be registered. Some functionality "
|
||||
"will not be available."
|
||||
@ -37,11 +32,11 @@ msgstr ""
|
||||
"ZRColine bližnjice na tipkovnici Win+F5 ni mogoče registrirati. Nekaj "
|
||||
"funkcionalnosti ne bo na voljo."
|
||||
|
||||
#: zrcolafrm.cpp:129 zrcolafrm.cpp:131
|
||||
#: zrcolafrm.cpp:108 zrcolafrm.cpp:110
|
||||
msgid "Warning"
|
||||
msgstr "Opozorilo"
|
||||
|
||||
#: zrcolafrm.cpp:131
|
||||
#: zrcolafrm.cpp:110
|
||||
msgid ""
|
||||
"ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality "
|
||||
"will not be available."
|
||||
@ -49,15 +44,11 @@ msgstr ""
|
||||
"ZRColine bližnjice na tipkovnici Win+F6 ni mogoče registrirati. Nekaj "
|
||||
"funkcionalnosti ne bo na voljo."
|
||||
|
||||
#: zrcolafrm.cpp:214
|
||||
msgid "Start ZRCola automatically on logon"
|
||||
msgstr "Samodejno zaženi ZRColo ob prijavi"
|
||||
|
||||
#: zrcolafrm.cpp:464
|
||||
#: zrcolafrm.cpp:336
|
||||
msgid "http://zrcola-2.amebis.si/en/contact/"
|
||||
msgstr "http://zrcola-2.amebis.si/contact/"
|
||||
|
||||
#: zrcolafrm.cpp:470
|
||||
#: zrcolafrm.cpp:342
|
||||
#, c-format
|
||||
msgid ""
|
||||
"ZRCola v%s\n"
|
||||
@ -66,214 +57,242 @@ msgstr ""
|
||||
"ZRCola v%s\n"
|
||||
"Vse pravice pridržane 2015-%s Amebis"
|
||||
|
||||
#: zrcolafrm.cpp:470
|
||||
#: zrcolafrm.cpp:342
|
||||
msgid "About ZRCola"
|
||||
msgstr "O ZRColi"
|
||||
|
||||
#: zrcolagui.cpp:36
|
||||
msgid "&Start on Logon"
|
||||
msgstr "Z&aženi ob prijavi"
|
||||
|
||||
#: zrcolagui.cpp:36
|
||||
msgid "Start this program automatically on logon"
|
||||
msgstr "Samodejno zaženi ta program ob prijavi"
|
||||
|
||||
#: zrcolagui.cpp:42
|
||||
msgid "E&xit"
|
||||
msgstr "I&zhod"
|
||||
|
||||
#: zrcolagui.cpp:42
|
||||
#: zrcolagui.cpp:36
|
||||
msgid "Quit this program"
|
||||
msgstr "Zapri ta program"
|
||||
|
||||
#: zrcolagui.cpp:45
|
||||
#: zrcolagui.cpp:39
|
||||
msgid "&Program"
|
||||
msgstr "&Program"
|
||||
|
||||
#: zrcolagui.cpp:78
|
||||
#: zrcolagui.cpp:72
|
||||
msgid "Select &All"
|
||||
msgstr "Izberi &vse"
|
||||
|
||||
#: zrcolagui.cpp:78
|
||||
#: zrcolagui.cpp:72
|
||||
msgid "Select all text"
|
||||
msgstr "Izberi celotno besedilo"
|
||||
|
||||
#: zrcolagui.cpp:84
|
||||
#: zrcolagui.cpp:78
|
||||
msgid "C&haracter Selector..."
|
||||
msgstr "Izbirnik &znaka ..."
|
||||
|
||||
#: zrcolagui.cpp:84 zrcolagui.cpp:176
|
||||
#: zrcolagui.cpp:78 zrcolagui.cpp:166
|
||||
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:95
|
||||
#: zrcolagui.cpp:89
|
||||
msgid "&Send Composed"
|
||||
msgstr "Pošlji &sestavljeno"
|
||||
|
||||
#: zrcolagui.cpp:95 zrcolagui.cpp:178
|
||||
#: zrcolagui.cpp:89 zrcolagui.cpp:168
|
||||
msgid "Send composed text to source window"
|
||||
msgstr "Pošlji sestavljeno besedilo izvornemu oknu"
|
||||
|
||||
#: zrcolagui.cpp:104
|
||||
#: zrcolagui.cpp:98
|
||||
msgid "Send &Decomposed"
|
||||
msgstr "Pošlji &razstavljeno"
|
||||
|
||||
#: zrcolagui.cpp:104 zrcolagui.cpp:180
|
||||
#: zrcolagui.cpp:98 zrcolagui.cpp:170
|
||||
msgid "Send decomposed text to source window"
|
||||
msgstr "Pošlji razstavljeno besedilo izvornemu oknu"
|
||||
|
||||
#: zrcolagui.cpp:113
|
||||
#: zrcolagui.cpp:107
|
||||
msgid "Abort (De)composition"
|
||||
msgstr "Prekini raz/sestavljanje"
|
||||
|
||||
#: zrcolagui.cpp:113
|
||||
#: zrcolagui.cpp:107
|
||||
msgid "Abort composition and return focus to source window"
|
||||
msgstr "Prekini sestavljanje in vrni fokus nazaj izvornemu oknu"
|
||||
|
||||
#: zrcolagui.cpp:122
|
||||
msgid "&Language"
|
||||
msgstr "&Jezik"
|
||||
#: zrcolagui.cpp:118
|
||||
msgid "&Settings..."
|
||||
msgstr "Na&stavitve ..."
|
||||
|
||||
#: zrcolagui.cpp:124
|
||||
msgid "&Automatic"
|
||||
msgstr "S&amodejno"
|
||||
#: zrcolagui.cpp:118
|
||||
msgid "Open program configuration dialog"
|
||||
msgstr "Odpri nastavitveni dialog programa"
|
||||
|
||||
#: zrcolagui.cpp:124
|
||||
msgid "Set language according to keyboard layout automatically"
|
||||
msgstr "Samodejno nastavi jezik glede na izbrano tipkovnico"
|
||||
|
||||
#: zrcolagui.cpp:131
|
||||
#: zrcolagui.cpp:121
|
||||
msgid "&Edit"
|
||||
msgstr "Ur&edi"
|
||||
|
||||
#: zrcolagui.cpp:135
|
||||
#: zrcolagui.cpp:125
|
||||
msgid "&Edit Toolbar"
|
||||
msgstr "Orodna vrstica za ur&ejanje"
|
||||
|
||||
#: zrcolagui.cpp:135
|
||||
#: zrcolagui.cpp:125
|
||||
msgid "Toggle edit toolbar"
|
||||
msgstr "Prikaži/skrij orodno vrstico za urejanje"
|
||||
|
||||
#: zrcolagui.cpp:139
|
||||
#: zrcolagui.cpp:129
|
||||
msgid "&Compose Toolbar"
|
||||
msgstr "Orodna vrsti&ca za sestavljanje"
|
||||
|
||||
#: zrcolagui.cpp:139
|
||||
#: zrcolagui.cpp:129
|
||||
msgid "Toggle compose toolbar"
|
||||
msgstr "Prikaži/skrij orodno vrstico za sestavljanje"
|
||||
|
||||
#: zrcolagui.cpp:145
|
||||
#: zrcolagui.cpp:135
|
||||
msgid "Character Catalo&g"
|
||||
msgstr "Katalo&g znakov"
|
||||
|
||||
#: zrcolagui.cpp:145
|
||||
#: zrcolagui.cpp:135
|
||||
msgid "Toggle character catalog panel"
|
||||
msgstr "Prikaži/skrij katalog znakov"
|
||||
|
||||
#: zrcolagui.cpp:148
|
||||
#: zrcolagui.cpp:138
|
||||
msgid "&View"
|
||||
msgstr "Po&gled"
|
||||
|
||||
#: zrcolagui.cpp:152
|
||||
#: zrcolagui.cpp:142
|
||||
msgid "&Request a new character..."
|
||||
msgstr "&Zahtevaj nov znak ..."
|
||||
|
||||
#: zrcolagui.cpp:152
|
||||
#: zrcolagui.cpp:142
|
||||
msgid "Submit a request to ZRC to add a new character"
|
||||
msgstr "Oddaj prošnjo ZRC-u za dodajanje novega znaka"
|
||||
|
||||
#: zrcolagui.cpp:161
|
||||
#: zrcolagui.cpp:151
|
||||
msgid "&Help"
|
||||
msgstr "Po&moč"
|
||||
|
||||
#: zrcolagui.cpp:166
|
||||
#: zrcolagui.cpp:156
|
||||
msgid "Cut"
|
||||
msgstr "Izreži"
|
||||
|
||||
#: zrcolagui.cpp:166
|
||||
#: zrcolagui.cpp:156
|
||||
msgid "Cut selection"
|
||||
msgstr "Izreži izbor"
|
||||
|
||||
#: zrcolagui.cpp:168
|
||||
#: zrcolagui.cpp:158
|
||||
msgid "Copy"
|
||||
msgstr "Kopiraj"
|
||||
|
||||
#: zrcolagui.cpp:168
|
||||
#: zrcolagui.cpp:158
|
||||
msgid "Copy selection"
|
||||
msgstr "Kopiraj izbor"
|
||||
|
||||
#: zrcolagui.cpp:170
|
||||
#: zrcolagui.cpp:160
|
||||
msgid "Paste"
|
||||
msgstr "Prilepi"
|
||||
|
||||
#: zrcolagui.cpp:170
|
||||
#: zrcolagui.cpp:160
|
||||
msgid "Paste selection"
|
||||
msgstr "Prilepi izbor"
|
||||
|
||||
#: zrcolagui.cpp:173
|
||||
#: zrcolagui.cpp:163
|
||||
msgid "Edit"
|
||||
msgstr "Urejanje"
|
||||
|
||||
#: zrcolagui.cpp:176 zrcolagui.h:221
|
||||
#: zrcolagui.cpp:166 zrcolagui.h:222
|
||||
msgid "Character Selector"
|
||||
msgstr "Izbirnik znaka"
|
||||
|
||||
#: zrcolagui.cpp:178
|
||||
#: zrcolagui.cpp:168
|
||||
msgid "Send Composed"
|
||||
msgstr "Pošlji sestavljeno"
|
||||
|
||||
#: zrcolagui.cpp:180
|
||||
#: zrcolagui.cpp:170
|
||||
msgid "Send Decomposed"
|
||||
msgstr "Pošlji razstavljeno"
|
||||
|
||||
#: zrcolagui.cpp:189
|
||||
#: zrcolagui.cpp:173
|
||||
msgid "Compose"
|
||||
msgstr "Sestavljanje"
|
||||
|
||||
#: zrcolagui.cpp:193
|
||||
#: zrcolagui.cpp:177
|
||||
msgid "Character Catalog"
|
||||
msgstr "Katalog znakov"
|
||||
|
||||
#: zrcolagui.cpp:197
|
||||
#: zrcolagui.cpp:181
|
||||
msgid "(De)Composer"
|
||||
msgstr "Raz/Sestavljalnik"
|
||||
|
||||
#: zrcolagui.cpp:236
|
||||
#: zrcolagui.cpp:218
|
||||
msgid "Decomposed Text"
|
||||
msgstr "Razstavljeno besedilo"
|
||||
|
||||
#: zrcolagui.cpp:256
|
||||
#: zrcolagui.cpp:238
|
||||
msgid "Decomposed Unicode Dump"
|
||||
msgstr "Unicode razstavljenega"
|
||||
|
||||
#: zrcolagui.cpp:283
|
||||
#: zrcolagui.cpp:265
|
||||
msgid "Composed Text"
|
||||
msgstr "Sestavljeno besedilo"
|
||||
|
||||
#: zrcolagui.cpp:303
|
||||
#: zrcolagui.cpp:285
|
||||
msgid "Composed Unicode Dump"
|
||||
msgstr "Unicode sestavljenega"
|
||||
|
||||
#: zrcolagui.cpp:423
|
||||
#: zrcolagui.cpp:405
|
||||
msgid "&Browse"
|
||||
msgstr "Pre&brskaj"
|
||||
|
||||
#: zrcolagui.cpp:471
|
||||
#: zrcolagui.cpp:453
|
||||
msgid "Re¢ly Used"
|
||||
msgstr "Nedavno &uporabljeni"
|
||||
|
||||
#: zrcolagui.cpp:512
|
||||
#: zrcolagui.cpp:494
|
||||
msgid "Preview"
|
||||
msgstr "Predogled"
|
||||
|
||||
#: zrcolagui.cpp:517
|
||||
#: zrcolagui.cpp:499
|
||||
msgid "U+"
|
||||
msgstr "U+"
|
||||
|
||||
#: zrcolagui.cpp:568
|
||||
#: zrcolagui.cpp:550
|
||||
msgid "Re&lated"
|
||||
msgstr "&Sorodni"
|
||||
|
||||
#: zrcolagui.cpp:650
|
||||
msgid ""
|
||||
"Some character native to specific language you are working with should not "
|
||||
"decompose to primitives.\n"
|
||||
"For optimal decomposition you should set the language correctly."
|
||||
msgstr ""
|
||||
"Nekateri znaki iz posameznih jezikov, s katerimi delate, se ne smejo "
|
||||
"razstaviti v dele.\n"
|
||||
"Za optimalno razstavljanje izberite pravilni jezik."
|
||||
|
||||
#: zrcolagui.cpp:654
|
||||
msgid "Select language &automatically according to selected keyboard"
|
||||
msgstr "S&amodejno izberi jezik glede na izbrano tipkovnico"
|
||||
|
||||
#: zrcolagui.cpp:657
|
||||
msgid "&Manually select the language from the list below:"
|
||||
msgstr "Ročno izberi jezik na spodnje&m spisku:"
|
||||
|
||||
#: zrcolagui.cpp:669
|
||||
msgid "Text Language"
|
||||
msgstr "Jezik besedila"
|
||||
|
||||
#: zrcolagui.cpp:674
|
||||
msgid ""
|
||||
"ZRCola can be launched every time you log in to your computer.\n"
|
||||
"It will be available on the system tray and via registered shortcuts Win+F5 "
|
||||
"and Win+F6."
|
||||
msgstr ""
|
||||
"ZRCola se lahko zažene ob vsaki prijavi v vaš računalnik.\n"
|
||||
"Na voljo bo na vrstici za sistemska obvestila ter preko registriranih "
|
||||
"bližnjic Win+F5 in Win+F6."
|
||||
|
||||
#: zrcolagui.cpp:678
|
||||
msgid "Start ZRCola &automatically on logon"
|
||||
msgstr "S&amodejno zaženi ZRColo ob prijavi"
|
||||
|
||||
#: zrcolagui.cpp:685
|
||||
msgid "Startup"
|
||||
msgstr "Zagon"
|
||||
|
||||
#: zrcolakeyhndlr.cpp:44
|
||||
msgid ""
|
||||
"INS key is pressed. Type the Unicode code of desired character now (up to "
|
||||
@ -282,6 +301,14 @@ msgstr ""
|
||||
"Pritisnjena tipka INS. Zdaj vtpikajte kodo Unicode želenega znaka (do štiri "
|
||||
"šestnajstiške števke: 0-9, A-F), nato izpustite INS."
|
||||
|
||||
#: zrcolasettings.cpp:116
|
||||
msgid "Start ZRCola automatically on logon"
|
||||
msgstr "Samodejno zaženi ZRColo ob prijavi"
|
||||
|
||||
#: zrcolagui.h:258
|
||||
msgid "Settings"
|
||||
msgstr "Nastavitve"
|
||||
|
||||
# Windows charset for this language (decimal)
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3
|
||||
@ -297,6 +324,21 @@ msgstr "1250"
|
||||
msgid "Input system for linguistic use"
|
||||
msgstr "Vnašalni sistem za jezikoslovno rabo"
|
||||
|
||||
#~ msgid "Auto Start"
|
||||
#~ msgstr "Samodejni zagon"
|
||||
|
||||
#~ msgid "Select %s language for decomposition"
|
||||
#~ msgstr "Izberi jezik %s za razstavljanje"
|
||||
|
||||
#~ msgid "&Start on Logon"
|
||||
#~ msgstr "Z&aženi ob prijavi"
|
||||
|
||||
#~ msgid "Start this program automatically on logon"
|
||||
#~ msgstr "Samodejno zaženi ta program ob prijavi"
|
||||
|
||||
#~ msgid "Set language according to keyboard layout automatically"
|
||||
#~ msgstr "Samodejno nastavi jezik glede na izbrano tipkovnico"
|
||||
|
||||
#~ msgid "&Unicode"
|
||||
#~ msgstr "&Unicode"
|
||||
|
||||
|
@ -48,3 +48,4 @@
|
||||
#include "zrcolacomppnl.h"
|
||||
#include "zrcolafrm.h"
|
||||
#include "zrcolakeyhndlr.h"
|
||||
#include "zrcolasettings.h"
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
wxZRColaFrame *m_mainWnd; ///< Main window
|
||||
|
||||
protected:
|
||||
wxLocale m_locale; ///< Current locale
|
||||
wxLocale m_locale; ///< Current locale
|
||||
};
|
||||
|
||||
|
||||
|
@ -88,11 +88,9 @@ wxString wxZRColaCharGrid::GetToolTipText(int idx)
|
||||
// See if this character has a key sequence registered.
|
||||
ZRCola::keyseq_db::indexKey::size_type start;
|
||||
bool found;
|
||||
ZRCola::keyseq_db::keyseq *ks = (ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq)];
|
||||
ks->chr = m_chars[idx];
|
||||
ks->seq_len = 0;
|
||||
found = app->m_ks_db.idxChr.find(*ks, start);
|
||||
delete ks;
|
||||
char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {};
|
||||
((ZRCola::keyseq_db::keyseq*)ks)->chr = m_chars[idx];
|
||||
found = app->m_ks_db.idxChr.find(*(ZRCola::keyseq_db::keyseq*)ks, start);
|
||||
|
||||
if (found) {
|
||||
ZRCola::keyseq_db::keyseq &seq = app->m_ks_db.idxChr[start];
|
||||
|
@ -71,10 +71,10 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
||||
m_gridPreview->SetCellValue(wxString(1, m_char), 0, 0);
|
||||
|
||||
{
|
||||
ZRCola::character_db::character *chr = (ZRCola::character_db::character*)new char[sizeof(ZRCola::character_db::character)];
|
||||
chr->chr = m_char;
|
||||
char chr[sizeof(ZRCola::character_db::character)] = {};
|
||||
((ZRCola::character_db::character*)chr)->chr = m_char;
|
||||
size_t start;
|
||||
if (app->m_chr_db.idxChr.find(*chr, start)) {
|
||||
if (app->m_chr_db.idxChr.find(*(ZRCola::character_db::character*)chr, start)) {
|
||||
const ZRCola::character_db::character &chr = app->m_chr_db.idxChr[start];
|
||||
m_description->SetValue(wxString(chr.data, chr.desc_len));
|
||||
{
|
||||
@ -94,7 +94,6 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
||||
m_gridRelated->ClearGrid();
|
||||
}
|
||||
m_gridRelated->Scroll(0, 0);
|
||||
delete chr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
///
|
||||
/// Forward declarations
|
||||
///
|
||||
class wxZRColaCharSelect;
|
||||
class wxPersistentZRColaCharSelect;
|
||||
|
||||
|
||||
#pragma once
|
||||
|
@ -119,7 +119,7 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
||||
std::wstring dst;
|
||||
wxZRColaFrame *mainWnd = dynamic_cast<wxZRColaFrame*>(wxGetActiveWindow());
|
||||
if (mainWnd)
|
||||
app->m_t_db.Decompose(src.data(), len, &app->m_lc_db, mainWnd->m_lang, dst, &m_mapping2);
|
||||
app->m_t_db.Decompose(src.data(), len, &app->m_lc_db, mainWnd->m_settings->m_lang, dst, &m_mapping2);
|
||||
else
|
||||
app->m_t_db.Decompose(src.data(), len, dst, &m_mapping2);
|
||||
|
||||
|
@ -25,46 +25,40 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
|
||||
EVT_UPDATE_UI (wxID_AUTOSTART , wxZRColaFrame::OnAutostartUpdate )
|
||||
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_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_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_CHARACTER_SELECTOR , wxZRColaFrame::OnInsertCharacter )
|
||||
|
||||
EVT_MENU (wxID_CHARACTER_SELECTOR , 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 )
|
||||
EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
|
||||
|
||||
EVT_UPDATE_UI (wxID_DECOMP_LANG_AUTO , wxZRColaFrame::OnDecomposedLanguageAutoUpdate)
|
||||
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_SETTINGS , wxZRColaFrame::OnSettings )
|
||||
|
||||
EVT_UPDATE_UI (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEditUpdate )
|
||||
EVT_MENU (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEdit )
|
||||
EVT_UPDATE_UI (wxID_TOOLBAR_COMPOSE , wxZRColaFrame::OnToolbarComposeUpdate )
|
||||
EVT_MENU (wxID_TOOLBAR_COMPOSE , wxZRColaFrame::OnToolbarCompose )
|
||||
EVT_UPDATE_UI (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalogUpdate )
|
||||
EVT_MENU (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalog )
|
||||
EVT_MENU (wxID_FOCUS_CHARACTER_CATALOG , wxZRColaFrame::OnPanelCharacterCatalogFocus )
|
||||
EVT_UPDATE_UI (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEditUpdate )
|
||||
EVT_MENU (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEdit )
|
||||
EVT_UPDATE_UI (wxID_TOOLBAR_COMPOSE , wxZRColaFrame::OnToolbarComposeUpdate )
|
||||
EVT_MENU (wxID_TOOLBAR_COMPOSE , wxZRColaFrame::OnToolbarCompose )
|
||||
EVT_UPDATE_UI (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalogUpdate)
|
||||
EVT_MENU (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalog )
|
||||
EVT_MENU (wxID_FOCUS_CHARACTER_CATALOG , wxZRColaFrame::OnPanelCharacterCatalogFocus )
|
||||
|
||||
EVT_MENU (wxID_HELP_REQCHAR , wxZRColaFrame::OnHelpReqChar )
|
||||
EVT_MENU (wxID_HELP_REQCHAR , wxZRColaFrame::OnHelpReqChar )
|
||||
|
||||
EVT_MENU (wxID_ABOUT , wxZRColaFrame::OnAbout )
|
||||
EVT_MENU (wxID_ABOUT , wxZRColaFrame::OnAbout )
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
|
||||
wxZRColaFrame::wxZRColaFrame() :
|
||||
m_lang_auto(true),
|
||||
m_lang(ZRCola::langid_t_blank),
|
||||
m_hWndSource(NULL),
|
||||
m_chrSelect(NULL),
|
||||
m_settings(NULL),
|
||||
wxZRColaFrameBase(NULL)
|
||||
{
|
||||
{
|
||||
@ -100,30 +94,15 @@ wxZRColaFrame::wxZRColaFrame() :
|
||||
delete m_taskBarIcon;
|
||||
}
|
||||
|
||||
{
|
||||
// Populate language lists.
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
m_toolDecompLanguage->Clear();
|
||||
wxString label1_tran(_("Select %s language for decomposition"));
|
||||
for (size_t i = 0, n = app->m_lang_db.idxLng.size(); i < n; i++) {
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[i];
|
||||
wxString
|
||||
label(lang.name, lang.name_len),
|
||||
label_tran2(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
|
||||
if (i < wxID_DECOMP_LANGUAGE_END - wxID_DECOMP_LANGUAGE_START + 1)
|
||||
m_menuDecompLanguage->AppendRadioItem(wxID_DECOMP_LANGUAGE_START + i, label_tran2, wxString::Format(label1_tran, (const wxStringCharType*)label_tran2));
|
||||
m_toolDecompLanguage->Insert(label_tran2, i);
|
||||
if (m_lang == lang.id)
|
||||
m_toolDecompLanguage->Select(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Set focus.
|
||||
m_panel->m_decomposed->SetFocus();
|
||||
m_settings = new wxZRColaSettings(this);
|
||||
wxPersistentRegisterAndRestore<wxZRColaSettings>(m_settings);
|
||||
|
||||
m_chrSelect = new wxZRColaCharSelect(this);
|
||||
wxPersistentRegisterAndRestore<wxZRColaCharSelect>(m_chrSelect);
|
||||
|
||||
// Set focus.
|
||||
m_panel->m_decomposed->SetFocus();
|
||||
|
||||
// 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);
|
||||
@ -175,6 +154,9 @@ wxZRColaFrame::~wxZRColaFrame()
|
||||
if (m_chrSelect)
|
||||
delete m_chrSelect;
|
||||
|
||||
if (m_settings)
|
||||
delete m_settings;
|
||||
|
||||
if (m_taskBarIcon) {
|
||||
m_taskBarIcon->Disconnect(wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEventHandler(wxZRColaFrame::OnTaskbarIconClick), NULL, this);
|
||||
delete m_taskBarIcon;
|
||||
@ -186,51 +168,6 @@ wxZRColaFrame::~wxZRColaFrame()
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnAutostartUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
wxString linkName(wxExpandEnvVars("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\ZRCola.lnk"));
|
||||
event.Check(wxFileExists(linkName));
|
||||
#else
|
||||
event.Enable(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnAutostart(wxCommandEvent& event)
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
wxString linkName(wxExpandEnvVars("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\ZRCola.lnk"));
|
||||
if (wxFileExists(linkName)) {
|
||||
// The shortcut already exists. Remove it.
|
||||
wxRemoveFile(linkName);
|
||||
} else {
|
||||
// Create the shortcut.
|
||||
IShellLink *sl;
|
||||
HRESULT hr = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&sl);
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Setup ZRCola shortcut.
|
||||
sl->SetPath(wxTheApp->argv[0]);
|
||||
sl->SetDescription(_("Start ZRCola automatically on logon"));
|
||||
sl->SetShowCmd(SW_SHOWMINNOACTIVE);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface, used for saving the
|
||||
// shortcut in persistent storage.
|
||||
IPersistFile *pf;
|
||||
hr = sl->QueryInterface(IID_IPersistFile, (LPVOID*)&pf);
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hr = pf->Save(linkName, TRUE);
|
||||
pf->Release();
|
||||
}
|
||||
|
||||
sl->Release();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnExit(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
@ -307,74 +244,9 @@ void wxZRColaFrame::OnSendAbort(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnDecomposedLanguageAutoUpdate(wxUpdateUIEvent& event)
|
||||
void wxZRColaFrame::OnSettings(wxCommandEvent& 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)
|
||||
{
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[event.GetId() - wxID_DECOMP_LANGUAGE_START];
|
||||
event.Check(m_lang == lang.id);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnDecomposedLanguage(wxCommandEvent& event)
|
||||
{
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
size_t i = event.GetId() - wxID_DECOMP_LANGUAGE_START;
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[i];
|
||||
|
||||
if (m_lang != lang.id) {
|
||||
m_lang = lang.id;
|
||||
m_toolDecompLanguage->Select(i);
|
||||
|
||||
// Notify composed text something changed and should re-decompose.
|
||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||
m_panel->m_composed->ProcessWindowEvent(event2);
|
||||
m_lang_auto = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnDecompLanguageChoice(wxCommandEvent& event)
|
||||
{
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
size_t i = event.GetSelection();
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[i];
|
||||
|
||||
if (m_lang != lang.id) {
|
||||
m_lang = lang.id;
|
||||
|
||||
// Notify composed text something changed and should re-decompose.
|
||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||
m_panel->m_composed->ProcessWindowEvent(event2);
|
||||
m_lang_auto = false;
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
m_settings->ShowModal();
|
||||
}
|
||||
|
||||
|
||||
@ -482,11 +354,10 @@ HRESULT STDMETHODCALLTYPE wxZRColaFrame::OnLanguageChange(LANGID langid, __RPC__
|
||||
|
||||
HRESULT STDMETHODCALLTYPE wxZRColaFrame::OnLanguageChanged()
|
||||
{
|
||||
if (m_lang_auto) {
|
||||
if (m_settings->m_lang_auto) {
|
||||
// Set keyboard language.
|
||||
HKL hkl = ::GetKeyboardLayout(0);
|
||||
ZRCola::LangConvert(LOWORD(hkl), m_lang);
|
||||
UpdateDecomposedLanguage();
|
||||
ZRCola::LangConvert(LOWORD(hkl), m_settings->m_lang);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@ -565,20 +436,6 @@ 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;
|
||||
l->id = m_lang;
|
||||
l->name_len = 0;
|
||||
ZRCola::language_db::indexLang::size_type start;
|
||||
m_toolDecompLanguage->SetSelection(app->m_lang_db.idxLng.find(*l, start) ? start : -1);
|
||||
delete l;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
@ -646,8 +503,6 @@ void wxPersistentZRColaFrame::Save() const
|
||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
|
||||
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Save();
|
||||
|
||||
SaveValue(wxT("langAuto" ), wnd->m_lang_auto);
|
||||
SaveValue(wxT("lang" ), wxString::FromAscii(wnd->m_lang.data, _countof(wnd->m_lang.data)));
|
||||
wxPersistentTLW::Save();
|
||||
}
|
||||
|
||||
@ -658,27 +513,6 @@ bool wxPersistentZRColaFrame::Restore()
|
||||
|
||||
wxZRColaFrame * const wnd = static_cast<wxZRColaFrame*>(GetWindow());
|
||||
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
wxString lang;
|
||||
|
||||
// Restore automatic language detection setting first.
|
||||
RestoreValue(wxT("langAuto"), &(wnd->m_lang_auto));
|
||||
if (wnd->m_lang_auto) {
|
||||
#if defined(__WXMSW__)
|
||||
// Set keyboard language.
|
||||
HKL hkl = ::GetKeyboardLayout(0);
|
||||
ZRCola::LangConvert(LOWORD(hkl), wnd->m_lang);
|
||||
#endif
|
||||
} else if (RestoreValue(wxT("lang"), &lang) && lang.Length() == 3) {
|
||||
// The language was read from configuration.
|
||||
wnd->m_lang = lang.c_str();
|
||||
} else if (!app->m_lang_db.idxLng.empty()) {
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[0];
|
||||
wnd->m_lang = lang.id;
|
||||
} else
|
||||
wnd->m_lang = ZRCola::langid_t_blank;
|
||||
wnd->UpdateDecomposedLanguage();
|
||||
|
||||
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Restore();
|
||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Restore();
|
||||
|
||||
|
@ -27,6 +27,7 @@ class wxZRColaFrame;
|
||||
|
||||
#include "zrcolagui.h"
|
||||
#include "zrcolachrslct.h"
|
||||
#include "zrcolasettings.h"
|
||||
#include <zrcola/language.h>
|
||||
#include <wx/taskbar.h>
|
||||
#include <wx/persist/toplevel.h>
|
||||
@ -54,9 +55,7 @@ class wxZRColaFrame :
|
||||
public:
|
||||
enum
|
||||
{
|
||||
wxID_DECOMP_LANGUAGE_START = 6000,
|
||||
wxID_DECOMP_LANGUAGE_END = 6099,
|
||||
wxID_FOCUS_CHARACTER_CATALOG,
|
||||
wxID_FOCUS_CHARACTER_CATALOG = 2000,
|
||||
};
|
||||
|
||||
wxZRColaFrame();
|
||||
@ -66,8 +65,6 @@ public:
|
||||
friend class wxZRColaComposerPanel;
|
||||
|
||||
protected:
|
||||
void OnAutostartUpdate(wxUpdateUIEvent& event);
|
||||
void OnAutostart(wxCommandEvent& event);
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnForwardEventUpdate(wxUpdateUIEvent& event);
|
||||
void OnForwardEvent(wxCommandEvent& event);
|
||||
@ -76,11 +73,7 @@ protected:
|
||||
void OnSendComposed(wxCommandEvent& event);
|
||||
void OnSendDecomposed(wxCommandEvent& event);
|
||||
void OnSendAbort(wxCommandEvent& event);
|
||||
void OnDecomposedLanguageAutoUpdate(wxUpdateUIEvent& event);
|
||||
void OnDecomposedLanguageAuto(wxCommandEvent& event);
|
||||
void OnDecomposedLanguageUpdate(wxUpdateUIEvent& event);
|
||||
void OnDecomposedLanguage(wxCommandEvent& event);
|
||||
virtual void OnDecompLanguageChoice(wxCommandEvent& event);
|
||||
void OnSettings(wxCommandEvent& event);
|
||||
virtual void OnIdle(wxIdleEvent& event);
|
||||
void OnTaskbarIconClick(wxTaskBarIconEvent& event);
|
||||
virtual void OnIconize(wxIconizeEvent& event);
|
||||
@ -113,7 +106,6 @@ protected:
|
||||
|
||||
private:
|
||||
void DoSend(const wxString& str);
|
||||
void UpdateDecomposedLanguage();
|
||||
|
||||
protected:
|
||||
#ifdef __WXMSW__
|
||||
@ -121,11 +113,10 @@ protected:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool m_lang_auto; ///< Automatic language selection according to keyboard layout
|
||||
ZRCola::langid_t m_lang; ///< Language for decomposing
|
||||
WXHWND m_hWndSource; ///< Handle of the active window, when the ZRCola hotkey was pressed
|
||||
wxTaskBarIcon *m_taskBarIcon; ///< Taskbar icon
|
||||
wxZRColaCharSelect *m_chrSelect; ///< Character selection dialog
|
||||
wxZRColaSettings *m_settings; ///< Configuration dialog
|
||||
};
|
||||
|
||||
|
||||
|
@ -32,12 +32,6 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
|
||||
m_menubar = new wxMenuBar( 0 );
|
||||
m_menuProgram = new wxMenu();
|
||||
wxMenuItem* m_menuItemAutoStart;
|
||||
m_menuItemAutoStart = new wxMenuItem( m_menuProgram, wxID_AUTOSTART, wxString( _("&Start on Logon") ) , _("Start this program automatically on logon"), wxITEM_CHECK );
|
||||
m_menuProgram->Append( m_menuItemAutoStart );
|
||||
|
||||
m_menuProgram->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuItemExit;
|
||||
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 );
|
||||
@ -118,15 +112,11 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
#endif
|
||||
m_menuEdit->Append( m_menuItemSendAbort );
|
||||
|
||||
m_menuDecompLanguage = new wxMenu();
|
||||
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_menuEdit->AppendSeparator();
|
||||
|
||||
m_menuDecompLanguage->AppendSeparator();
|
||||
|
||||
m_menuEdit->Append( m_menuDecompLanguageItem );
|
||||
wxMenuItem* m_menuSettings;
|
||||
m_menuSettings = new wxMenuItem( m_menuEdit, wxID_SETTINGS, wxString( _("&Settings...") ) , _("Open program configuration dialog"), wxITEM_NORMAL );
|
||||
m_menuEdit->Append( m_menuSettings );
|
||||
|
||||
m_menubar->Append( m_menuEdit, _("&Edit") );
|
||||
|
||||
@ -179,12 +169,6 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
|
||||
m_toolSendDecomposed = m_toolbarCompose->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_toolbarCompose->AddSeparator();
|
||||
|
||||
wxArrayString m_toolDecompLanguageChoices;
|
||||
m_toolDecompLanguage = new wxChoice( m_toolbarCompose, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_toolDecompLanguageChoices, 0 );
|
||||
m_toolDecompLanguage->SetSelection( 0 );
|
||||
m_toolbarCompose->AddControl( m_toolDecompLanguage );
|
||||
m_toolbarCompose->Realize();
|
||||
m_mgr.AddPane( m_toolbarCompose, wxAuiPaneInfo().Name( wxT("toolbarCompose") ).Top().Caption( _("Compose") ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
|
||||
|
||||
@ -204,7 +188,6 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
|
||||
this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
|
||||
m_toolDecompLanguage->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnDecompLanguageChoice ), NULL, this );
|
||||
}
|
||||
|
||||
wxZRColaFrameBase::~wxZRColaFrameBase()
|
||||
@ -212,7 +195,6 @@ wxZRColaFrameBase::~wxZRColaFrameBase()
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
|
||||
this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
|
||||
m_toolDecompLanguage->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnDecompLanguageChoice ), NULL, this );
|
||||
|
||||
m_mgr.UnInit();
|
||||
|
||||
@ -652,3 +634,103 @@ wxZRColaCharSelectBase::~wxZRColaCharSelectBase()
|
||||
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaCharSelectBase::OnOKButtonClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
wxZRColaSettingsBase::wxZRColaSettingsBase( 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, wxSize( -1,-1 ) );
|
||||
|
||||
wxBoxSizer* bSizerContent;
|
||||
bSizerContent = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listbook = new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_DEFAULT );
|
||||
m_panelLanguage = new wxPanel( m_listbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerLanguage;
|
||||
bSizerLanguage = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_langLabel = new wxStaticText( m_panelLanguage, wxID_ANY, _("Some character native to specific language you are working with should not decompose to primitives.\nFor optimal decomposition you should set the language correctly."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_langLabel->Wrap( -1 );
|
||||
bSizerLanguage->Add( m_langLabel, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_langAuto = new wxRadioButton( m_panelLanguage, wxID_ANY, _("Select language &automatically according to selected keyboard"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
bSizerLanguage->Add( m_langAuto, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_langManual = new wxRadioButton( m_panelLanguage, wxID_ANY, _("&Manually select the language from the list below:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerLanguage->Add( m_langManual, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_languages = new wxListBox( m_panelLanguage, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
m_languages->SetMinSize( wxSize( -1,150 ) );
|
||||
|
||||
bSizerLanguage->Add( m_languages, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelLanguage->SetSizer( bSizerLanguage );
|
||||
m_panelLanguage->Layout();
|
||||
bSizerLanguage->Fit( m_panelLanguage );
|
||||
m_listbook->AddPage( m_panelLanguage, _("Text Language"), true );
|
||||
m_panelAutoStart = new wxPanel( m_listbook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerAutoStart;
|
||||
bSizerAutoStart = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_autoStartLabel = new wxStaticText( m_panelAutoStart, wxID_ANY, _("ZRCola can be launched every time you log in to your computer.\nIt will be available on the system tray and via registered shortcuts Win+F5 and Win+F6."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_autoStartLabel->Wrap( -1 );
|
||||
bSizerAutoStart->Add( m_autoStartLabel, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_autoStart = new wxCheckBox( m_panelAutoStart, wxID_ANY, _("Start ZRCola &automatically on logon"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerAutoStart->Add( m_autoStart, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelAutoStart->SetSizer( bSizerAutoStart );
|
||||
m_panelAutoStart->Layout();
|
||||
bSizerAutoStart->Fit( m_panelAutoStart );
|
||||
m_listbook->AddPage( m_panelAutoStart, _("Startup"), false );
|
||||
#ifdef __WXGTK__ // Small icon style not supported in GTK
|
||||
wxListView* m_listbookListView = m_listbook->GetListView();
|
||||
long m_listbookFlags = m_listbookListView->GetWindowStyleFlag();
|
||||
if( m_listbookFlags & wxLC_SMALL_ICON )
|
||||
{
|
||||
m_listbookFlags = ( m_listbookFlags & ~wxLC_SMALL_ICON ) | wxLC_ICON;
|
||||
}
|
||||
m_listbookListView->SetWindowStyleFlag( m_listbookFlags );
|
||||
#endif
|
||||
|
||||
bSizerContent->Add( m_listbook, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
bSizerContent->Add( 0, 0, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizerButtons = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
|
||||
m_sdbSizerButtonsApply = new wxButton( this, wxID_APPLY );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsApply );
|
||||
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 );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxZRColaSettingsBase::OnInitDialog ) );
|
||||
m_langAuto->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxZRColaSettingsBase::OnLangAuto ), NULL, this );
|
||||
m_langManual->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxZRColaSettingsBase::OnLangManual ), NULL, this );
|
||||
m_sdbSizerButtonsApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnApplyButtonClick ), NULL, this );
|
||||
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnOKButtonClick ), NULL, this );
|
||||
}
|
||||
|
||||
wxZRColaSettingsBase::~wxZRColaSettingsBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxZRColaSettingsBase::OnInitDialog ) );
|
||||
m_langAuto->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxZRColaSettingsBase::OnLangAuto ), NULL, this );
|
||||
m_langManual->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( wxZRColaSettingsBase::OnLangManual ), NULL, this );
|
||||
m_sdbSizerButtonsApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnApplyButtonClick ), NULL, this );
|
||||
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnOKButtonClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ class wxZRColaCharGrid;
|
||||
#include <wx/settings.h>
|
||||
#include <wx/aui/aui.h>
|
||||
#include <wx/aui/auibar.h>
|
||||
#include <wx/choice.h>
|
||||
class wxZRColaCharacterCatalogPanel;
|
||||
class wxZRColaComposerPanel;
|
||||
#include <wx/statusbr.h>
|
||||
@ -36,12 +35,18 @@ class wxZRColaComposerPanel;
|
||||
#include <wx/panel.h>
|
||||
#include <wx/splitter.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/srchctrl.h>
|
||||
#include <wx/checklst.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/listbook.h>
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -55,12 +60,11 @@ class wxZRColaFrameBase : public wxFrame
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
wxID_AUTOSTART = 1000,
|
||||
wxID_CHARACTER_SELECTOR,
|
||||
wxID_CHARACTER_SELECTOR = 1000,
|
||||
wxID_SEND_COMPOSED,
|
||||
wxID_SEND_DECOMPOSED,
|
||||
wxID_SEND_ABORT,
|
||||
wxID_DECOMP_LANG_AUTO,
|
||||
wxID_SETTINGS,
|
||||
wxID_TOOLBAR_EDIT,
|
||||
wxID_TOOLBAR_COMPOSE,
|
||||
wxID_PANEL_CHRGRPS,
|
||||
@ -70,7 +74,6 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxMenuBar* m_menubar;
|
||||
wxMenu* m_menuProgram;
|
||||
wxMenu* m_menuEdit;
|
||||
wxMenu* m_menuDecompLanguage;
|
||||
wxMenu* m_menuView;
|
||||
wxMenu* m_menuHelp;
|
||||
wxAuiToolBar* m_toolbarEdit;
|
||||
@ -81,14 +84,12 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxAuiToolBarItem* m_toolCharSelect;
|
||||
wxAuiToolBarItem* m_toolSendComposed;
|
||||
wxAuiToolBarItem* m_toolSendDecomposed;
|
||||
wxChoice* m_toolDecompLanguage;
|
||||
wxZRColaCharacterCatalogPanel* m_panelChrCat;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
|
||||
virtual void OnDecompLanguageChoice( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
@ -223,4 +224,41 @@ class wxZRColaCharSelectBase : public wxDialog
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxZRColaSettingsBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxZRColaSettingsBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxListbook* m_listbook;
|
||||
wxPanel* m_panelLanguage;
|
||||
wxStaticText* m_langLabel;
|
||||
wxRadioButton* m_langAuto;
|
||||
wxRadioButton* m_langManual;
|
||||
wxListBox* m_languages;
|
||||
wxPanel* m_panelAutoStart;
|
||||
wxStaticText* m_autoStartLabel;
|
||||
wxCheckBox* m_autoStart;
|
||||
wxStdDialogButtonSizer* m_sdbSizerButtons;
|
||||
wxButton* m_sdbSizerButtonsOK;
|
||||
wxButton* m_sdbSizerButtonsApply;
|
||||
wxButton* m_sdbSizerButtonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnLangAuto( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnLangManual( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnApplyButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxZRColaSettingsBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaSettings") );
|
||||
~wxZRColaSettingsBase();
|
||||
|
||||
};
|
||||
|
||||
#endif //__ZRCOLAGUI_H__
|
||||
|
190
ZRCola/zrcolasettings.cpp
Normal file
190
ZRCola/zrcolasettings.cpp
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// wxZRColaSettings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxZRColaSettings::wxZRColaSettings(wxWindow* parent) :
|
||||
m_lang_auto(true),
|
||||
m_lang(ZRCola::langid_t_blank),
|
||||
wxZRColaSettingsBase(parent)
|
||||
{
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
m_languages->Clear();
|
||||
for (size_t i = 0, n = app->m_lang_db.idxLng.size(); i < n; i++) {
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[i];
|
||||
wxString
|
||||
label(lang.name, lang.name_len),
|
||||
label_tran(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
|
||||
m_languages->Insert(label_tran, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
// Set state of auto-start according to Startup folder shortcut presence.
|
||||
#if defined(__WXMSW__)
|
||||
wxString linkName(wxExpandEnvVars("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\ZRCola.lnk"));
|
||||
m_autoStart->SetValue(wxFileExists(linkName));
|
||||
#else
|
||||
m_autoStart->SetValue(false);
|
||||
m_panelAutoStart->Enable(false);
|
||||
#endif
|
||||
|
||||
m_languages->Enable(!m_lang_auto);
|
||||
(m_lang_auto ? m_langAuto : m_langManual)->SetValue(true);
|
||||
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
char l[sizeof(ZRCola::language_db::language)] = {};
|
||||
((ZRCola::language_db::language*)l)->id = m_lang;
|
||||
ZRCola::language_db::indexLang::size_type start;
|
||||
m_languages->Select(app->m_lang_db.idxLng.find(*(ZRCola::language_db::language*)l, start) ? start : -1);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnLangAuto(wxCommandEvent& event)
|
||||
{
|
||||
m_languages->Enable(!event.IsChecked());
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnLangManual(wxCommandEvent& event)
|
||||
{
|
||||
m_languages->Enable(event.IsChecked());
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnApplyButtonClick(wxCommandEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
wxString linkName(wxExpandEnvVars("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\ZRCola.lnk"));
|
||||
if (m_autoStart->IsChecked()) {
|
||||
// Create the shortcut.
|
||||
IShellLink *sl;
|
||||
HRESULT hr = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&sl);
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Setup ZRCola shortcut.
|
||||
sl->SetPath(wxTheApp->argv[0]);
|
||||
sl->SetDescription(_("Start ZRCola automatically on logon"));
|
||||
sl->SetShowCmd(SW_SHOWMINNOACTIVE);
|
||||
|
||||
// Query IShellLink for the IPersistFile interface, used for saving the
|
||||
// shortcut in persistent storage.
|
||||
IPersistFile *pf;
|
||||
hr = sl->QueryInterface(IID_IPersistFile, (LPVOID*)&pf);
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hr = pf->Save(linkName, TRUE);
|
||||
pf->Release();
|
||||
}
|
||||
|
||||
sl->Release();
|
||||
}
|
||||
} else if (wxFileExists(linkName)) {
|
||||
// The shortcut already exists. Remove it.
|
||||
wxRemoveFile(linkName);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_langAuto->GetValue()) {
|
||||
m_lang_auto = true;
|
||||
#if defined(__WXMSW__)
|
||||
// Set update keyboard language.
|
||||
HKL hkl = ::GetKeyboardLayout(0);
|
||||
ZRCola::LangConvert(LOWORD(hkl), m_lang);
|
||||
#endif
|
||||
} else {
|
||||
m_lang_auto = false;
|
||||
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[m_languages->GetSelection()];
|
||||
|
||||
if (m_lang != lang.id) {
|
||||
m_lang = lang.id;
|
||||
|
||||
// Notify composed text something changed and should re-decompose.
|
||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||
app->m_mainWnd->m_panel->m_composed->ProcessWindowEvent(event2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxZRColaSettings::OnOKButtonClick(wxCommandEvent& event)
|
||||
{
|
||||
wxZRColaSettings::OnApplyButtonClick(event);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// wxPersistentZRColaSettings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxPersistentZRColaSettings::wxPersistentZRColaSettings(wxZRColaSettings *wnd) : wxPersistentDialog(wnd)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void wxPersistentZRColaSettings::Save() const
|
||||
{
|
||||
wxPersistentDialog::Save();
|
||||
|
||||
const wxZRColaSettings * const wnd = static_cast<const wxZRColaSettings*>(GetWindow());
|
||||
|
||||
SaveValue(wxT("langAuto"), wnd->m_lang_auto);
|
||||
SaveValue(wxT("lang" ), wxString::FromAscii(wnd->m_lang.data, _countof(wnd->m_lang.data)));
|
||||
}
|
||||
|
||||
|
||||
bool wxPersistentZRColaSettings::Restore()
|
||||
{
|
||||
wxZRColaSettings * const wnd = static_cast<wxZRColaSettings*>(GetWindow());
|
||||
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
wxString lang;
|
||||
|
||||
// Restore automatic language detection setting first.
|
||||
RestoreValue(wxT("langAuto"), &(wnd->m_lang_auto));
|
||||
if (wnd->m_lang_auto) {
|
||||
#if defined(__WXMSW__)
|
||||
// Set keyboard language.
|
||||
HKL hkl = ::GetKeyboardLayout(0);
|
||||
ZRCola::LangConvert(LOWORD(hkl), wnd->m_lang);
|
||||
#endif
|
||||
} else if (RestoreValue(wxT("lang"), &lang) && lang.Length() == 3) {
|
||||
// The language was read from configuration.
|
||||
wnd->m_lang = lang.c_str();
|
||||
} else if (!app->m_lang_db.idxLng.empty()) {
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[0];
|
||||
wnd->m_lang = lang.id;
|
||||
} else
|
||||
wnd->m_lang = ZRCola::langid_t_blank;
|
||||
|
||||
return wxPersistentDialog::Restore();
|
||||
}
|
72
ZRCola/zrcolasettings.h
Normal file
72
ZRCola/zrcolasettings.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
///
|
||||
/// Forward declarations
|
||||
///
|
||||
class wxZRColaSettings;
|
||||
class wxPersistentZRColaSettings;
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "zrcolagui.h"
|
||||
#include <wxex/persist/dialog.h>
|
||||
|
||||
|
||||
///
|
||||
/// Configuration dialog
|
||||
///
|
||||
class wxZRColaSettings : public wxZRColaSettingsBase
|
||||
{
|
||||
public:
|
||||
wxZRColaSettings(wxWindow* parent);
|
||||
|
||||
friend class wxPersistentZRColaSettings; // Allow saving/restoring window state.
|
||||
|
||||
protected:
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event);
|
||||
virtual void OnLangAuto(wxCommandEvent& event);
|
||||
virtual void OnLangManual(wxCommandEvent& event);
|
||||
virtual void OnApplyButtonClick(wxCommandEvent& event);
|
||||
virtual void OnOKButtonClick(wxCommandEvent& event);
|
||||
|
||||
public:
|
||||
bool m_lang_auto; ///< Is language for decomposing resolved using currently selected keyboard
|
||||
ZRCola::langid_t m_lang; ///< Language for decomposing
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Supports saving/restoring wxZRColaSettings state
|
||||
///
|
||||
class wxPersistentZRColaSettings : public wxPersistentDialog
|
||||
{
|
||||
public:
|
||||
wxPersistentZRColaSettings(wxZRColaSettings *wnd);
|
||||
|
||||
virtual void Save() const;
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
|
||||
inline wxPersistentObject *wxCreatePersistentObject(wxZRColaSettings *wnd)
|
||||
{
|
||||
return new wxPersistentZRColaSettings(wnd);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user