Compare commits
131 Commits
ver/2.0-be
...
ver/2.1-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4aacc4abc5 | ||
|
|
2f6c789fdf | ||
|
|
57ceeadbe7 | ||
|
|
3b297c8427 | ||
|
|
92374e57a8 | ||
|
|
ace7551281 | ||
|
|
15e5f2d9e2 | ||
|
|
08397415c4 | ||
|
|
6dff6eed4f | ||
|
|
acbae76737 | ||
|
|
cc4a150501 | ||
|
|
186dbee443 | ||
|
|
716dde0a84 | ||
|
|
155642a3f9 | ||
|
|
7cb0317544 | ||
|
|
87a2828ce0 | ||
|
|
806aa550a5 | ||
|
|
ca306345c2 | ||
|
|
03ff056898 | ||
|
|
9f083bb521 | ||
|
|
a224454b3c | ||
|
|
bd0fdba435 | ||
|
|
87814981db | ||
|
|
acf86e2ce0 | ||
|
|
1016d5f738 | ||
|
|
4d53785af7 | ||
|
|
8e2a3860e3 | ||
|
|
0c2e666d0f | ||
|
|
d6075327ef | ||
|
|
14e665fdf2 | ||
|
|
55e2ee8c4d | ||
|
|
f444355d6d | ||
|
|
feb3c7c150 | ||
|
|
f65634e285 | ||
|
|
62a67b6be7 | ||
|
|
5304402ec5 | ||
|
|
f14fa2911d | ||
|
|
db391d7023 | ||
|
|
0b5a6a7016 | ||
|
|
5cc72a6a96 | ||
|
|
4138f6a5a3 | ||
|
|
2b2b2656b3 | ||
|
|
6253f2c267 | ||
|
|
c9779c3772 | ||
|
|
f6019e361c | ||
|
|
3fd0aef27d | ||
|
|
49c9d33b97 | ||
|
|
b01d1c5409 | ||
|
|
b0b434fec2 | ||
|
|
d46557a367 | ||
|
|
0180cb6306 | ||
|
|
4ce3213b1a | ||
|
|
75b2758797 | ||
|
|
2e14bcf1ec | ||
|
|
cf49e3e401 | ||
|
|
0ed0cf8c49 | ||
|
|
38a77ca51b | ||
|
|
891bd624fc | ||
|
|
affe7b06a2 | ||
|
|
f51c4dbbec | ||
|
|
650ad13a30 | ||
|
|
f53779dbad | ||
|
|
a45115d5e7 | ||
|
|
b5ba1290f9 | ||
|
|
52689653d0 | ||
|
|
8d9af61d5e | ||
|
|
5f339d0d51 | ||
|
|
641d178248 | ||
|
|
67d3c6f3ac | ||
|
|
060ed729b3 | ||
|
|
f8eead6835 | ||
|
|
15693f643f | ||
|
|
916b466909 | ||
|
|
a112a46755 | ||
|
|
fba2181b32 | ||
|
|
d9bf31897e | ||
|
|
65b92f017b | ||
|
|
dddc2d5794 | ||
|
|
e4e8609a00 | ||
|
|
cee1ea7dbc | ||
|
|
87c41451ab | ||
|
|
ecefcecfd8 | ||
|
|
ba8254c097 | ||
|
|
dacca1409e | ||
|
|
8a3a539d5b | ||
|
|
bb2e5e256b | ||
|
|
6828887308 | ||
|
|
186bc61723 | ||
|
|
19a9d9c26d | ||
|
|
cca084be7d | ||
|
|
6710e0a21c | ||
|
|
b5cc0b8f2c | ||
|
|
ded987e4f8 | ||
|
|
957d530801 | ||
|
|
4c716f2ba3 | ||
|
|
7e3cf0bce7 | ||
|
|
7f97a20ba0 | ||
|
|
4b4bc1b371 | ||
|
|
f0b573f1a8 | ||
|
|
c2887f77b0 | ||
|
|
f056a4b0ec | ||
|
|
181778c981 | ||
|
|
ffb887b306 | ||
|
|
515a994ece | ||
|
|
ab28678227 | ||
|
|
b90ff2977f | ||
|
|
eab7bcb35f | ||
|
|
a7c6f2967f | ||
|
|
2316e5906c | ||
|
|
1866ace76f | ||
|
|
48d97742b1 | ||
|
|
96bde4740f | ||
|
|
333a415a66 | ||
|
|
26e81ac0a0 | ||
|
|
2b610e2804 | ||
|
|
ea4f85223c | ||
|
|
aff96d1efe | ||
|
|
f5eaf3c74b | ||
|
|
6e167b7344 | ||
|
|
acaae141de | ||
|
|
4a32a4b40c | ||
|
|
902fcf92a4 | ||
|
|
424a6762f7 | ||
|
|
41aa04abad | ||
|
|
8ae98bfb12 | ||
|
|
41dfe0c892 | ||
|
|
5cd454a757 | ||
|
|
a75b649f8b | ||
|
|
174f117770 | ||
|
|
19d1daf099 | ||
|
|
c4fe7c4370 |
24
.gitmodules
vendored
@@ -1,24 +1,24 @@
|
||||
[submodule "lib/wxExtend"]
|
||||
path = lib/wxExtend
|
||||
url = https://github.com/Amebis/wxExtend.git
|
||||
[submodule "lib/stdex"]
|
||||
path = lib/stdex
|
||||
url = https://github.com/Amebis/stdex.git
|
||||
[submodule "MSI/MSIBuild"]
|
||||
path = MSI/MSIBuild
|
||||
url = https://github.com/Amebis/MSIBuild.git
|
||||
[submodule "MSI/MSICA"]
|
||||
path = MSI/MSICA
|
||||
url = https://github.com/Amebis/MSICA.git
|
||||
[submodule "lib/atlex"]
|
||||
path = lib/atlex
|
||||
url = https://github.com/Amebis/atlex.git
|
||||
[submodule "lib/MSICALib"]
|
||||
path = lib/MSICALib
|
||||
url = https://github.com/Amebis/MSICALib.git
|
||||
[submodule "lib/stdex"]
|
||||
path = lib/stdex
|
||||
url = https://github.com/Amebis/stdex.git
|
||||
[submodule "lib/WinStd"]
|
||||
path = lib/WinStd
|
||||
url = https://github.com/Amebis/WinStd.git
|
||||
[submodule "lib/wxExtend"]
|
||||
path = lib/wxExtend
|
||||
url = https://github.com/Amebis/wxExtend.git
|
||||
[submodule "MSI/MSIBuild"]
|
||||
path = MSI/MSIBuild
|
||||
url = https://github.com/Amebis/MSIBuild.git
|
||||
[submodule "MSI/MSICA"]
|
||||
path = MSI/MSICA
|
||||
url = https://github.com/Amebis/MSICA.git
|
||||
[submodule "Updater"]
|
||||
path = Updater
|
||||
url = https://github.com/Amebis/Updater.git
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featUpdCheck
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
[splosno]
|
||||
jezik=0
|
||||
deli=featZRCola
|
||||
deli=featZRCola featUpdCheck
|
||||
|
||||
[parametri]
|
||||
|
||||
BIN
MSI/ZRCola/Main/Binary/fontsubst.bmp
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
MSI/ZRCola/Main/Binary/fontsubst.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
MSILocal.mak
Normal file
440
Makefile
@@ -36,16 +36,6 @@ Clean ::
|
||||
cd "MSI\MSIBuild\Version"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean
|
||||
cd "$(MAKEDIR)"
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=En PLAT=Win32 CFG=Release
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=En PLAT=Win32 CFG=Debug
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=En PLAT=x64 CFG=Release
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=En PLAT=x64 CFG=Debug
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=Sl PLAT=Win32 CFG=Release
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=Sl PLAT=Win32 CFG=Debug
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=Sl PLAT=x64 CFG=Release
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) Clean LANG=Sl PLAT=x64 CFG=Debug
|
||||
cd "$(MAKEDIR)"
|
||||
devenv.com "ZRCola.sln" /clean "Release|Win32"
|
||||
devenv.com "ZRCola.sln" /clean "Debug|Win32"
|
||||
devenv.com "ZRCola.sln" /clean "Release|x64"
|
||||
@@ -60,15 +50,29 @@ Clean ::
|
||||
devenv.com "Updater\Updater.sln" /clean "Debug|Win32"
|
||||
devenv.com "Updater\Updater.sln" /clean "Release|x64"
|
||||
devenv.com "Updater\Updater.sln" /clean "Debug|x64"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaEn32.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaEn32.msi"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaEn32D.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaEn32D.msi"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaEn64.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaEn64.msi"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaEn64D.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaEn64D.msi"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaSl32.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaSl32.msi"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaSl32D.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaSl32D.msi"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaSl64.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaSl64.msi"
|
||||
-if exist "$(OUTPUT_DIR)\Setup\ZRColaSl64D.msi" del /f /q "$(OUTPUT_DIR)\Setup\ZRColaSl64D.msi"
|
||||
-if exist "$(OUTPUT_DIR)\catalog.xml" del /f /q "$(OUTPUT_DIR)\catalog.xml"
|
||||
-if exist "$(OUTPUT_DIR)\locale\de_DE\wxstd.mo" del /f /q "$(OUTPUT_DIR)\locale\de_DE\wxstd.mo"
|
||||
-if exist "$(OUTPUT_DIR)\locale\ru_RU\wxstd.mo" del /f /q "$(OUTPUT_DIR)\locale\ru_RU\wxstd.mo"
|
||||
-if exist "$(OUTPUT_DIR)\locale\sl_SI\wxstd.mo" del /f /q "$(OUTPUT_DIR)\locale\sl_SI\wxstd.mo"
|
||||
-if exist "$(OUTPUT_DIR)\locale\de_DE\ZRCola-zrcdb.mo" del /f /q "$(OUTPUT_DIR)\locale\de_DE\ZRCola-zrcdb.mo"
|
||||
-if exist "$(OUTPUT_DIR)\locale\ru_RU\ZRCola-zrcdb.mo" del /f /q "$(OUTPUT_DIR)\locale\ru_RU\ZRCola-zrcdb.mo"
|
||||
-if exist "$(OUTPUT_DIR)\locale\sl_SI\ZRCola-zrcdb.mo" del /f /q "$(OUTPUT_DIR)\locale\sl_SI\ZRCola-zrcdb.mo"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32.ddf" del /f /q "$(OUTPUT_DIR)\ZRCola32.ddf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32D.ddf" del /f /q "$(OUTPUT_DIR)\ZRCola32D.ddf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64.ddf" del /f /q "$(OUTPUT_DIR)\ZRCola64.ddf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64D.ddf" del /f /q "$(OUTPUT_DIR)\ZRCola64D.ddf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32.cab" del /f /q "$(OUTPUT_DIR)\ZRCola32.cab"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32.inf" del /f /q "$(OUTPUT_DIR)\ZRCola32.inf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32.rpt" del /f /q "$(OUTPUT_DIR)\ZRCola32.rpt"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32D.cab" del /f /q "$(OUTPUT_DIR)\ZRCola32D.cab"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32D.inf" del /f /q "$(OUTPUT_DIR)\ZRCola32D.inf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola32D.rpt" del /f /q "$(OUTPUT_DIR)\ZRCola32D.rpt"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64.cab" del /f /q "$(OUTPUT_DIR)\ZRCola64.cab"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64.inf" del /f /q "$(OUTPUT_DIR)\ZRCola64.inf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64.rpt" del /f /q "$(OUTPUT_DIR)\ZRCola64.rpt"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64D.cab" del /f /q "$(OUTPUT_DIR)\ZRCola64D.cab"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64D.inf" del /f /q "$(OUTPUT_DIR)\ZRCola64D.inf"
|
||||
-if exist "$(OUTPUT_DIR)\ZRCola64D.rpt" del /f /q "$(OUTPUT_DIR)\ZRCola64D.rpt"
|
||||
-if exist "$(OUTPUT_DIR)\catalog.xml" del /f /q "$(OUTPUT_DIR)\catalog.xml"
|
||||
|
||||
!IFNDEF HAS_VERSION
|
||||
|
||||
@@ -82,6 +86,7 @@ Setup \
|
||||
SetupDebug \
|
||||
Register \
|
||||
Unregister \
|
||||
Localization \
|
||||
PublishPre \
|
||||
Publish :: "MSI\MSIBuild\Version\Version.mak"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) HAS_VERSION=1 $@
|
||||
@@ -104,12 +109,6 @@ Publish :: "MSI\MSIBuild\Version\Version.mak"
|
||||
PUBLISH_PACKAGE_DIR=$(PUBLISH_DIR)\$(MSIBUILD_VERSION_STR)
|
||||
PUBLISH_PACKAGE_URL=http://www.amebis.si/prenos/ZRCola/$(MSIBUILD_VERSION_STR)
|
||||
|
||||
REDIST_EN_WIN32="$(PUBLISH_PACKAGE_DIR)\ZRColaEn32.msi"
|
||||
REDIST_EN_X64="$(PUBLISH_PACKAGE_DIR)\ZRColaEn64.msi"
|
||||
REDIST_SL_WIN32="$(PUBLISH_PACKAGE_DIR)\ZRColaSl32.msi"
|
||||
REDIST_SL_X64="$(PUBLISH_PACKAGE_DIR)\ZRColaSl64.msi"
|
||||
|
||||
|
||||
######################################################################
|
||||
# Main targets
|
||||
######################################################################
|
||||
@@ -118,18 +117,54 @@ All :: \
|
||||
Setup
|
||||
|
||||
Setup :: \
|
||||
"$(OUTPUT_DIR)\Setup" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn32.msi" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn64.msi" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl32.msi" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl64.msi"
|
||||
# "$(OUTPUT_DIR)\ZRColaDe32.msi" \
|
||||
# "$(OUTPUT_DIR)\ZRColaDe64.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn32.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn64.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaRu32.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaRu64.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64.msi"
|
||||
|
||||
SetupDebug :: \
|
||||
"$(OUTPUT_DIR)\Setup" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn32D.msi" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn64D.msi" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl32D.msi" \
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl64D.msi"
|
||||
# "$(OUTPUT_DIR)\ZRColaDe32D.msi" \
|
||||
# "$(OUTPUT_DIR)\ZRColaDe64D.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn32D.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn64D.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaRu32D.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaRu64D.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32D.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64D.msi"
|
||||
|
||||
|
||||
######################################################################
|
||||
# Publishing
|
||||
######################################################################
|
||||
|
||||
PublishPre :: \
|
||||
"$(PUBLISH_PACKAGE_DIR)" \
|
||||
# "$(PUBLISH_PACKAGE_DIR)\ZRColaDe32.msi" \
|
||||
# "$(PUBLISH_PACKAGE_DIR)\ZRColaDe64.msi" \
|
||||
"$(PUBLISH_PACKAGE_DIR)\ZRColaEn32.msi" \
|
||||
"$(PUBLISH_PACKAGE_DIR)\ZRColaEn64.msi" \
|
||||
"$(PUBLISH_PACKAGE_DIR)\ZRColaRu32.msi" \
|
||||
"$(PUBLISH_PACKAGE_DIR)\ZRColaRu64.msi" \
|
||||
"$(PUBLISH_PACKAGE_DIR)\ZRColaSl32.msi" \
|
||||
"$(PUBLISH_PACKAGE_DIR)\ZRColaSl64.msi" \
|
||||
"$(PUBLISH_DIR)" \
|
||||
# "$(PUBLISH_DIR)\ZRColaInstallDe.exe" \
|
||||
"$(PUBLISH_DIR)\ZRColaInstallEn.exe" \
|
||||
"$(PUBLISH_DIR)\ZRColaInstallRu.exe" \
|
||||
"$(PUBLISH_DIR)\ZRColaInstallSl.exe"
|
||||
|
||||
Publish :: \
|
||||
PublishPre \
|
||||
"$(PUBLISH_DIR)\catalog-0000.xml"
|
||||
|
||||
|
||||
######################################################################
|
||||
# Registration
|
||||
######################################################################
|
||||
|
||||
Register :: \
|
||||
RegisterSettings \
|
||||
@@ -158,24 +193,26 @@ UnregisterSettings ::
|
||||
!ENDIF
|
||||
|
||||
InstallFonts :: \
|
||||
"$(WINDIR)\Fonts\00_ZRCola_Re.otf" \
|
||||
"$(WINDIR)\Fonts\00_ZRCola_It.otf" \
|
||||
"$(WINDIR)\Fonts\00_ZRCola_Bd.otf" \
|
||||
"$(WINDIR)\Fonts\00_ZRCola_BI.otf"
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola (TrueType)" /t REG_SZ /d "00_ZRCola_Re.otf" $(REG_FLAGS) > NUL
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola Italic (TrueType)" /t REG_SZ /d "00_ZRCola_It.otf" $(REG_FLAGS) > NUL
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola Bold (TrueType)" /t REG_SZ /d "00_ZRCola_Bd.otf" $(REG_FLAGS) > NUL
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola Bold Italic (TrueType)" /t REG_SZ /d "00_ZRCola_BI.otf" $(REG_FLAGS) > NUL
|
||||
"$(WINDIR)\Fonts\ZRCola_Re.otf" \
|
||||
"$(WINDIR)\Fonts\ZRCola_It.otf" \
|
||||
"$(WINDIR)\Fonts\ZRCola_Bd.otf" \
|
||||
"$(WINDIR)\Fonts\ZRCola_BI.otf"
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola (TrueType)" /t REG_SZ /d "ZRCola_Re.otf" $(REG_FLAGS) > NUL
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola Italic (TrueType)" /t REG_SZ /d "ZRCola_It.otf" $(REG_FLAGS) > NUL
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola Bold (TrueType)" /t REG_SZ /d "ZRCola_Bd.otf" $(REG_FLAGS) > NUL
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola Bold Italic (TrueType)" /t REG_SZ /d "ZRCola_BI.otf" $(REG_FLAGS) > NUL
|
||||
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes" /v "00 ZRCola" /t REG_SZ /d "ZRCola" $(REG_FLAGS) > NUL
|
||||
|
||||
UninstallFonts::
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola (TrueType)" $(REG_FLAGS) > NUL
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola Italic (TrueType)" $(REG_FLAGS) > NUL
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola Bold (TrueType)" $(REG_FLAGS) > NUL
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "00 ZRCola Bold Italic (TrueType)" $(REG_FLAGS) > NUL
|
||||
-if exist "$(WINDIR)\Fonts\00_ZRCola_Re.otf" rd /s /q "$(WINDIR)\Fonts\00_ZRCola_Re.otf"
|
||||
-if exist "$(WINDIR)\Fonts\00_ZRCola_It.otf" rd /s /q "$(WINDIR)\Fonts\00_ZRCola_It.otf"
|
||||
-if exist "$(WINDIR)\Fonts\00_ZRCola_Bd.otf" rd /s /q "$(WINDIR)\Fonts\00_ZRCola_Bd.otf"
|
||||
-if exist "$(WINDIR)\Fonts\00_ZRCola_BI.otf" rd /s /q "$(WINDIR)\Fonts\00_ZRCola_BI.otf"
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola (TrueType)" $(REG_FLAGS) > NUL
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola Italic (TrueType)" $(REG_FLAGS) > NUL
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola Bold (TrueType)" $(REG_FLAGS) > NUL
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "ZRCola Bold Italic (TrueType)" $(REG_FLAGS) > NUL
|
||||
-reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes" /v "00 ZRCola" $(REG_FLAGS) > NUL
|
||||
-if exist "$(WINDIR)\Fonts\ZRCola_Re.otf" rd /s /q "$(WINDIR)\Fonts\ZRCola_Re.otf"
|
||||
-if exist "$(WINDIR)\Fonts\ZRCola_It.otf" rd /s /q "$(WINDIR)\Fonts\ZRCola_It.otf"
|
||||
-if exist "$(WINDIR)\Fonts\ZRCola_Bd.otf" rd /s /q "$(WINDIR)\Fonts\ZRCola_Bd.otf"
|
||||
-if exist "$(WINDIR)\Fonts\ZRCola_BI.otf" rd /s /q "$(WINDIR)\Fonts\ZRCola_BI.otf"
|
||||
|
||||
RegisterShortcuts :: \
|
||||
"$(PROGRAMDATA)\Microsoft\Windows\Start Menu\Programs\ZRCola" \
|
||||
@@ -184,21 +221,20 @@ RegisterShortcuts :: \
|
||||
UnregisterShortcuts ::
|
||||
-if exist "$(PROGRAMDATA)\Microsoft\Windows\Start Menu\Programs\ZRCola" rd /s /q "$(PROGRAMDATA)\Microsoft\Windows\Start Menu\Programs\ZRCola"
|
||||
|
||||
PublishPre :: \
|
||||
"$(PUBLISH_PACKAGE_DIR)" \
|
||||
$(REDIST_EN_WIN32) \
|
||||
$(REDIST_EN_X64) \
|
||||
$(REDIST_SL_WIN32) \
|
||||
$(REDIST_SL_X64) \
|
||||
"$(PUBLISH_DIR)" \
|
||||
"$(PUBLISH_DIR)\ZRColaInstallDe.exe" \
|
||||
"$(PUBLISH_DIR)\ZRColaInstallEn.exe" \
|
||||
"$(PUBLISH_DIR)\ZRColaInstallRu.exe" \
|
||||
"$(PUBLISH_DIR)\ZRColaInstallSl.exe"
|
||||
######################################################################
|
||||
# Localization
|
||||
######################################################################
|
||||
|
||||
Publish :: \
|
||||
PublishPre \
|
||||
"$(PUBLISH_DIR)\catalog-0000.xml"
|
||||
Localization :: \
|
||||
"$(OUTPUT_DIR)\locale\de_DE" \
|
||||
"$(OUTPUT_DIR)\locale\de_DE\wxstd.mo" \
|
||||
"$(OUTPUT_DIR)\locale\de_DE\ZRCola-zrcdb.mo" \
|
||||
"$(OUTPUT_DIR)\locale\ru_RU" \
|
||||
"$(OUTPUT_DIR)\locale\ru_RU\wxstd.mo" \
|
||||
"$(OUTPUT_DIR)\locale\ru_RU\ZRCola-zrcdb.mo" \
|
||||
"$(OUTPUT_DIR)\locale\sl_SI" \
|
||||
"$(OUTPUT_DIR)\locale\sl_SI\wxstd.mo" \
|
||||
"$(OUTPUT_DIR)\locale\sl_SI\ZRCola-zrcdb.mo"
|
||||
|
||||
|
||||
######################################################################
|
||||
@@ -207,14 +243,21 @@ Publish :: \
|
||||
|
||||
"$(OUTPUT_DIR)" \
|
||||
"$(OUTPUT_DIR)\Keys" \
|
||||
"$(OUTPUT_DIR)\Setup" \
|
||||
"$(OUTPUT_DIR)\locale" \
|
||||
"$(OUTPUT_DIR)\locale\de_DE" \
|
||||
"$(OUTPUT_DIR)\locale\ru_RU" \
|
||||
"$(OUTPUT_DIR)\locale\sl_SI" \
|
||||
"$(PUBLISH_DIR)" \
|
||||
"$(PUBLISH_PACKAGE_DIR)" \
|
||||
"$(PROGRAMDATA)\Microsoft\Windows\Start Menu\Programs\ZRCola" :
|
||||
if not exist $@ md $@
|
||||
|
||||
"$(OUTPUT_DIR)\Keys" \
|
||||
"$(OUTPUT_DIR)\Setup" : "$(OUTPUT_DIR)"
|
||||
"$(OUTPUT_DIR)\locale" : "$(OUTPUT_DIR)"
|
||||
|
||||
"$(OUTPUT_DIR)\locale\de_DE" \
|
||||
"$(OUTPUT_DIR)\locale\ru_RU" \
|
||||
"$(OUTPUT_DIR)\locale\sl_SI" : "$(OUTPUT_DIR)\locale"
|
||||
|
||||
"$(PUBLISH_PACKAGE_DIR)" : "$(PUBLISH_DIR)"
|
||||
|
||||
@@ -223,56 +266,16 @@ Publish :: \
|
||||
# File copy
|
||||
######################################################################
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn32.msi" \
|
||||
$(REDIST_EN_WIN32) : "$(OUTPUT_DIR)\ZRColaEn32.3.msi"
|
||||
"$(WINDIR)\Fonts\ZRCola_Re.otf" : "$(OUTPUT_DIR)\ZRCola_Re.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn32D.msi" : "$(OUTPUT_DIR)\ZRColaEn32D.3.msi"
|
||||
"$(WINDIR)\Fonts\ZRCola_It.otf" : "$(OUTPUT_DIR)\ZRCola_It.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn64.msi" \
|
||||
$(REDIST_EN_X64) : "$(OUTPUT_DIR)\ZRColaEn64.3.msi"
|
||||
"$(WINDIR)\Fonts\ZRCola_Bd.otf" : "$(OUTPUT_DIR)\ZRCola_Bd.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaEn64D.msi" : "$(OUTPUT_DIR)\ZRColaEn64D.3.msi"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl32.msi" \
|
||||
$(REDIST_SL_WIN32) : "$(OUTPUT_DIR)\ZRColaSl32.3.msi"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl32D.msi" : "$(OUTPUT_DIR)\ZRColaSl32D.3.msi"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl64.msi" \
|
||||
$(REDIST_SL_X64) : "$(OUTPUT_DIR)\ZRColaSl64.3.msi"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Setup\ZRColaSl64D.msi" : "$(OUTPUT_DIR)\ZRColaSl64D.3.msi"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(WINDIR)\Fonts\00_ZRCola_Re.otf" : "$(OUTPUT_DIR)\00_ZRCola_Re.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(WINDIR)\Fonts\00_ZRCola_It.otf" : "$(OUTPUT_DIR)\00_ZRCola_It.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(WINDIR)\Fonts\00_ZRCola_Bd.otf" : "$(OUTPUT_DIR)\00_ZRCola_Bd.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(WINDIR)\Fonts\00_ZRCola_BI.otf" : "$(OUTPUT_DIR)\00_ZRCola_BI.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(PUBLISH_DIR)\ZRColaInstallDe.exe" : "$(OUTPUT_DIR)\Win32.Release\ZRColaInstallDe.exe"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(PUBLISH_DIR)\ZRColaInstallEn.exe" : "$(OUTPUT_DIR)\Win32.Release\ZRColaInstallEn.exe"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(PUBLISH_DIR)\ZRColaInstallRu.exe" : "$(OUTPUT_DIR)\Win32.Release\ZRColaInstallRu.exe"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"$(PUBLISH_DIR)\ZRColaInstallSl.exe" : "$(OUTPUT_DIR)\Win32.Release\ZRColaInstallSl.exe"
|
||||
"$(WINDIR)\Fonts\ZRCola_BI.otf" : "$(OUTPUT_DIR)\ZRCola_BI.otf"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
|
||||
@@ -288,130 +291,177 @@ $(REDIST_SL_X64) : "$(OUTPUT_DIR)\ZRColaSl64.3.msi"
|
||||
# Building
|
||||
######################################################################
|
||||
|
||||
"$(OUTPUT_DIR)\locale\de_DE\wxstd.mo" : "$(WXWIN)\locale\de.po"
|
||||
msgfmt.exe --output-file=$@ --alignment=1 --endianness=little $**
|
||||
|
||||
"$(OUTPUT_DIR)\locale\ru_RU\wxstd.mo" : "$(WXWIN)\locale\ru.po"
|
||||
msgfmt.exe --output-file=$@ --alignment=1 --endianness=little $**
|
||||
|
||||
"$(OUTPUT_DIR)\locale\sl_SI\wxstd.mo" : "$(WXWIN)\locale\sl.po"
|
||||
msgfmt.exe --output-file=$@ --alignment=1 --endianness=little $**
|
||||
|
||||
"$(OUTPUT_DIR)\locale\de_DE\ZRCola-zrcdb.mo" : "$(OUTPUT_DIR)\locale\de_DE\ZRCola-zrcdb.po"
|
||||
msgfmt.exe --output-file=$@ --alignment=1 --endianness=little $**
|
||||
|
||||
"$(OUTPUT_DIR)\locale\ru_RU\ZRCola-zrcdb.mo" : "$(OUTPUT_DIR)\locale\ru_RU\ZRCola-zrcdb.po"
|
||||
msgfmt.exe --output-file=$@ --alignment=1 --endianness=little $**
|
||||
|
||||
"$(OUTPUT_DIR)\locale\sl_SI\ZRCola-zrcdb.mo" : "$(OUTPUT_DIR)\locale\sl_SI\ZRCola-zrcdb.po"
|
||||
msgfmt.exe --output-file=$@ --alignment=1 --endianness=little $**
|
||||
|
||||
"$(OUTPUT_DIR)\Win32.Release\libZRCola10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\libZRColaUI10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\stdex10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\wxExtend10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\ZRCola.exe" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn32.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32.3.msi" ::
|
||||
"$(OUTPUT_DIR)\Win32.Release\ZRCola.exe" :: Localization
|
||||
|
||||
"$(OUTPUT_DIR)\Win32.Debug\libZRCola10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\libZRColaUI10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\stdex10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\wxExtend10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\ZRCola.exe" :: Localization
|
||||
|
||||
"$(OUTPUT_DIR)\x64.Release\libZRCola10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\libZRColaUI10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\stdex10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\wxExtend10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\ZRCola.exe" :: Localization
|
||||
|
||||
"$(OUTPUT_DIR)\x64.Debug\libZRCola10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\libZRColaUI10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\stdex10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\wxExtend10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\ZRCola.exe" :: Localization
|
||||
|
||||
"$(OUTPUT_DIR)\Win32.Release\libZRCola10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\libZRColaUI10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\stdex10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\wxExtend10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\ZRCola.exe" ::
|
||||
devenv.com "ZRCola.sln" /build "Release|Win32"
|
||||
|
||||
"$(OUTPUT_DIR)\Win32.Debug\libZRCola10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\libZRColaUI10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\stdex10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\wxExtend10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\ZRCola.exe" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn32D.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32D.3.msi" ::
|
||||
"$(OUTPUT_DIR)\Win32.Debug\ZRCola.exe" ::
|
||||
devenv.com "ZRCola.sln" /build "Debug|Win32"
|
||||
|
||||
"$(OUTPUT_DIR)\x64.Release\libZRCola10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\libZRColaUI10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\stdex10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\wxExtend10u_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Release\ZRCola.exe" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn64.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64.3.msi" ::
|
||||
"$(OUTPUT_DIR)\x64.Release\ZRCola.exe" ::
|
||||
devenv.com "ZRCola.sln" /build "Release|x64"
|
||||
|
||||
"$(OUTPUT_DIR)\x64.Debug\libZRCola10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\libZRColaUI10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\stdex10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\wxExtend10ud_vc100.dll" \
|
||||
"$(OUTPUT_DIR)\x64.Debug\ZRCola.exe" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn64D.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64D.3.msi" ::
|
||||
"$(OUTPUT_DIR)\x64.Debug\ZRCola.exe" ::
|
||||
devenv.com "ZRCola.sln" /build "Debug|x64"
|
||||
|
||||
"$(OUTPUT_DIR)\Win32.Release\ZRColaInstallDe.exe" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\ZRColaInstallEn.exe" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\ZRColaInstallRu.exe" \
|
||||
"$(OUTPUT_DIR)\Win32.Release\ZRColaInstallSl.exe" ::
|
||||
devenv.com "ZRColaUtils.sln" /build "Release|Win32"
|
||||
"$(OUTPUT_DIR)\ZRCola32.ddf" : \
|
||||
# "$(OUTPUT_DIR)\ZRCola.de_DE.32.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.en_US.32.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.ru_RU.32.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.sl_SI.32.2.msi"
|
||||
-if exist $@ del /f /q $@
|
||||
-if exist "$(@:"=).tmp" del /f /q "$(@:"=).tmp"
|
||||
cscript.exe "MSI\MSIBuild\MSI.wsf" //Job:MakeDDF //Nologo "$(@:"=).tmp" $** /O:"$(OUTPUT_DIR)\ZRCola32" /C:LZX
|
||||
move /y "$(@:"=).tmp" $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\Win32.Debug\ZRColaInstallDe.exe" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\ZRColaInstallEn.exe" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\ZRColaInstallRu.exe" \
|
||||
"$(OUTPUT_DIR)\Win32.Debug\ZRColaInstallSl.exe" ::
|
||||
devenv.com "ZRColaUtils.sln" /build "Debug|Win32"
|
||||
"$(OUTPUT_DIR)\ZRCola32D.ddf" : \
|
||||
# "$(OUTPUT_DIR)\ZRCola.de_DE.32D.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.en_US.32D.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.ru_RU.32D.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.sl_SI.32D.2.msi"
|
||||
-if exist $@ del /f /q $@
|
||||
-if exist "$(@:"=).tmp" del /f /q "$(@:"=).tmp"
|
||||
cscript.exe "MSI\MSIBuild\MSI.wsf" //Job:MakeDDF //Nologo "$(@:"=).tmp" $** /O:"$(OUTPUT_DIR)\ZRCola32D" /C:LZX
|
||||
move /y "$(@:"=).tmp" $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn32.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32.3.msi" ::
|
||||
devenv.com "MSI\MSICA\MSICA.sln" /build "Release|Win32"
|
||||
devenv.com "Updater\Updater.sln" /build "Release|Win32"
|
||||
"$(OUTPUT_DIR)\ZRCola64.ddf" : \
|
||||
# "$(OUTPUT_DIR)\ZRCola.de_DE.64.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.en_US.64.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.ru_RU.64.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.sl_SI.64.2.msi"
|
||||
-if exist $@ del /f /q $@
|
||||
-if exist "$(@:"=).tmp" del /f /q "$(@:"=).tmp"
|
||||
cscript.exe "MSI\MSIBuild\MSI.wsf" //Job:MakeDDF //Nologo "$(@:"=).tmp" $** /O:"$(OUTPUT_DIR)\ZRCola64" /C:LZX
|
||||
move /y "$(@:"=).tmp" $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn32D.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32D.3.msi" ::
|
||||
devenv.com "MSI\MSICA\MSICA.sln" /build "Debug|Win32"
|
||||
devenv.com "Updater\Updater.sln" /build "Debug|Win32"
|
||||
"$(OUTPUT_DIR)\ZRCola64D.ddf" : \
|
||||
# "$(OUTPUT_DIR)\ZRCola.de_DE.64D.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.en_US.64D.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.ru_RU.64D.2.msi" \
|
||||
"$(OUTPUT_DIR)\ZRCola.sl_SI.64D.2.msi"
|
||||
-if exist $@ del /f /q $@
|
||||
-if exist "$(@:"=).tmp" del /f /q "$(@:"=).tmp"
|
||||
cscript.exe "MSI\MSIBuild\MSI.wsf" //Job:MakeDDF //Nologo "$(@:"=).tmp" $** /O:"$(OUTPUT_DIR)\ZRCola64D" /C:LZX
|
||||
move /y "$(@:"=).tmp" $@ > NUL
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn64.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64.3.msi" ::
|
||||
devenv.com "MSI\MSICA\MSICA.sln" /build "Release|x64"
|
||||
devenv.com "Updater\Updater.sln" /build "Release|x64"
|
||||
"$(OUTPUT_DIR)\ZRCola32.cab" \
|
||||
"$(OUTPUT_DIR)\ZRCola32.inf" \
|
||||
"$(OUTPUT_DIR)\ZRCola32.rpt" : "$(OUTPUT_DIR)\ZRCola32.ddf"
|
||||
makecab.exe /F $**
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn64D.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64D.3.msi" ::
|
||||
devenv.com "MSI\MSICA\MSICA.sln" /build "Debug|x64"
|
||||
devenv.com "Updater\Updater.sln" /build "Debug|x64"
|
||||
"$(OUTPUT_DIR)\ZRCola32D.cab" \
|
||||
"$(OUTPUT_DIR)\ZRCola32D.inf" \
|
||||
"$(OUTPUT_DIR)\ZRCola32D.rpt" : "$(OUTPUT_DIR)\ZRCola32D.ddf"
|
||||
makecab.exe /F $**
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn32.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=En PLAT=Win32 CFG=Release
|
||||
cd "$(MAKEDIR)"
|
||||
"$(OUTPUT_DIR)\ZRCola64.cab" \
|
||||
"$(OUTPUT_DIR)\ZRCola64.inf" \
|
||||
"$(OUTPUT_DIR)\ZRCola64.rpt" : "$(OUTPUT_DIR)\ZRCola64.ddf"
|
||||
makecab.exe /F $**
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn32D.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=En PLAT=Win32 CFG=Debug
|
||||
cd "$(MAKEDIR)"
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn64.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=En PLAT=x64 CFG=Release
|
||||
cd "$(MAKEDIR)"
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaEn64D.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=En PLAT=x64 CFG=Debug
|
||||
cd "$(MAKEDIR)"
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaSl32.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=Sl PLAT=Win32 CFG=Release
|
||||
cd "$(MAKEDIR)"
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaSl32D.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=Sl PLAT=Win32 CFG=Debug
|
||||
cd "$(MAKEDIR)"
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaSl64.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=Sl PLAT=x64 CFG=Release
|
||||
cd "$(MAKEDIR)"
|
||||
|
||||
"$(OUTPUT_DIR)\ZRColaSl64D.3.msi" ::
|
||||
cd "MSI\ZRCola"
|
||||
$(MAKE) /f "Makefile" /$(MAKEFLAGS) LANG=Sl PLAT=x64 CFG=Debug
|
||||
cd "$(MAKEDIR)"
|
||||
"$(OUTPUT_DIR)\ZRCola64D.cab" \
|
||||
"$(OUTPUT_DIR)\ZRCola64D.inf" \
|
||||
"$(OUTPUT_DIR)\ZRCola64D.rpt" : "$(OUTPUT_DIR)\ZRCola64D.ddf"
|
||||
makecab.exe /F $**
|
||||
|
||||
"$(PUBLISH_DIR)\catalog-0000.xml" : "$(OUTPUT_DIR)\catalog.xml"
|
||||
if exist $@ del /f /q $@
|
||||
output\$(PLAT).Release\UpdSignXML.exe $** $@
|
||||
|
||||
"$(OUTPUT_DIR)\catalog.xml" : \
|
||||
"$(OUTPUT_DIR)\ZRColaEn32.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn64.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32.3.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64.3.msi"
|
||||
# "$(OUTPUT_DIR)\ZRColaDe32.msi" \
|
||||
# "$(OUTPUT_DIR)\ZRColaDe64.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn32.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaEn64.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaRu32.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaRu64.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl32.msi" \
|
||||
"$(OUTPUT_DIR)\ZRColaSl64.msi"
|
||||
-if exist $@ del /f /q $@
|
||||
-if exist "$(@:"=).tmp" del /f /q "$(@:"=).tmp"
|
||||
copy /y "$(PUBLISH_DIR)\catalog-0000.xml" "$(@:"=).tmp" > NUL
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-x86 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn32.msi" -f "$(OUTPUT_DIR)\ZRColaEn32.3.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn64.msi" -f "$(OUTPUT_DIR)\ZRColaEn64.3.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-x86 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl32.msi" -f "$(OUTPUT_DIR)\ZRColaSl32.3.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl64.msi" -f "$(OUTPUT_DIR)\ZRColaSl64.3.msi"
|
||||
# output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-x86 de_DE "$(PUBLISH_PACKAGE_URL)/ZRColaDe32.msi" -f "$(OUTPUT_DIR)\ZRColaDe32.msi"
|
||||
# output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 de_DE "$(PUBLISH_PACKAGE_URL)/ZRColaDe64.msi" -f "$(OUTPUT_DIR)\ZRColaDe64.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-x86 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn32.msi" -f "$(OUTPUT_DIR)\ZRColaEn32.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn64.msi" -f "$(OUTPUT_DIR)\ZRColaEn64.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-x86 ru_RU "$(PUBLISH_PACKAGE_URL)/ZRColaRu32.msi" -f "$(OUTPUT_DIR)\ZRColaRu32.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 ru_RU "$(PUBLISH_PACKAGE_URL)/ZRColaRu64.msi" -f "$(OUTPUT_DIR)\ZRColaRu64.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-x86 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl32.msi" -f "$(OUTPUT_DIR)\ZRColaSl32.msi"
|
||||
output\$(PLAT).Release\UpdPublish.exe "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl64.msi" -f "$(OUTPUT_DIR)\ZRColaSl64.msi"
|
||||
move /y "$(@:"=).tmp" $@ > NUL
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
#LANG=de_DE
|
||||
#LANG_OUT=De
|
||||
#!INCLUDE "MSILocal.mak"
|
||||
|
||||
LANG=en_US
|
||||
LANG_OUT=En
|
||||
!INCLUDE "MSILocal.mak"
|
||||
|
||||
LANG=ru_RU
|
||||
LANG_OUT=Ru
|
||||
!INCLUDE "MSILocal.mak"
|
||||
|
||||
LANG=sl_SI
|
||||
LANG_OUT=Sl
|
||||
!INCLUDE "MSILocal.mak"
|
||||
|
||||
12
README.md
@@ -3,7 +3,7 @@
|
||||
A Microsoft Windows application for composing texts using a wide range of Slavic (and general) letters from or beyond Unicode.
|
||||
|
||||
## Project Website
|
||||
http://zrcola-2.amebis.si/en/ (Development version)
|
||||
http://zrcola.zrc-sazu.si/en/
|
||||
|
||||
## Binaries for Download
|
||||
https://www.amebis.si/prenos/ZRCola/
|
||||
@@ -15,15 +15,15 @@ https://www.amebis.si/prenos/ZRCola/
|
||||
- Microsoft Visual Studio 2010 SP1
|
||||
- _sed.exe_ and _grep.exe_
|
||||
- Command line utilities from Microsoft Windows SDK Bin folder: distributed with Visual Studio, add Bin folder to path manually.
|
||||
- Additional command line utilities from project’s bin folder: add bin folder to path. The source code is provided on request.
|
||||
- Additional command line utilities from project's bin folder: add bin folder to path. The source code is provided on request.
|
||||
|
||||
### Digital Signing of Build Outputs
|
||||
In order to have the build process digitally sign output files, one should provide the following:
|
||||
|
||||
1. A signing certificate installed in the current user’s certificate store.
|
||||
1. A signing certificate installed in the current user's certificate store.
|
||||
2. The following variables in the environment:
|
||||
- `ManifestCertificateThumbprint` - set the value to certificate’s SHA1 thumbprint (hexadecimal, without spaces, i.e. `bc0d8da45f9eeefcbe4e334e1fc262804df88d7e`).
|
||||
- `ManifestTimestampUrl` - set the value to URL used to perform timestamp signature (i.e. `http://timestamp.verisign.com/scripts/timstamp.dll`). In order to perform timestamp signing successfully, the computer running the build should be online and able to access this URL.
|
||||
- `ManifestCertificateThumbprint` - set the value to certificate's SHA1 thumbprint (hexadecimal, without spaces, i.e. `bc0d8da45f9eeefcbe4e334e1fc262804df88d7e`).
|
||||
- `ManifestTimestampUrl` - set the value to URL used to perform timestamp signature (i.e. `http://timestamp.verisign.com/scripts/timstamp.dll`). In order to perform timestamp signing successfully, the computer running the build should be online and able to access this URL.
|
||||
|
||||
Please note that only Release builds are configured for timestamp signing. Debug configurations do not attempt to timestamp sign the resulting DLL and EXE files in order to speed up the building process and enable offline building.
|
||||
|
||||
@@ -36,7 +36,7 @@ Use Microsoft NMAKE to build the project. The resulting files can be found in ou
|
||||
- `nmake Register` Build a debug version of project, install fonts (reboot required), and Start Menu shortcuts. For development purposes only!
|
||||
- `nmake Unregister` Remove Start Menu shortcuts, and fonts. For development purposes only!
|
||||
|
||||
The `/ls` flag can be appended to the commands above to reduce NMAKE’s verbosity. You can combine multiple targets (i.e. nmake Unregister Clean). Please, see NMAKE reference for further reading.
|
||||
The `/ls` flag can be appended to the commands above to reduce NMAKE's verbosity. You can combine multiple targets (i.e. nmake Unregister Clean). Please, see NMAKE reference for further reading.
|
||||
|
||||
## Contact Information
|
||||
Please contact the following addressee for further information and help:
|
||||
|
||||
2
Updater
@@ -5,11 +5,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRCola", "ZRCola\ZRCola.vcx
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{6D85AD6A-69D6-40EB-BF0C-7495479DDCE5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtend", "lib\wxExtend\build\wxExtend.vcxproj", "{A3A36689-AC35-4026-93DA-A3BA0C0E767C}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtend", "lib\wxExtend\build\wxExtendDll.vcxproj", "{A3A36689-AC35-4026-93DA-A3BA0C0E767C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CFEBC17E-C840-4507-BDE6-1EF5B52DDCC5}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
include\zrcola.h = include\zrcola.h
|
||||
include\version.h = include\version.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libZRCola", "lib\libZRCola\build\libZRCola.vcxproj", "{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}"
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
|
||||
!INCLUDE "..\..\include\MSIBuildCfg.mak"
|
||||
|
||||
!IFNDEF MSIBUILD_LANGID
|
||||
!ERROR Parameter MSIBUILD_LANGID is undefined.
|
||||
!ENDIF
|
||||
|
||||
MSIBUILD_IS_LOCALIZEABLE=1
|
||||
|
||||
|
||||
@@ -104,7 +108,10 @@ compZRCola.exe.Win32 {F30B6545-6203-4B7D-8575-85245A0F90E5} ZRCOLABINDIR 0 file
|
||||
!IF "$(PLAT)" == "x64"
|
||||
compZRCola.exe.x64 {D45B105D-2303-459A-AF4B-52AC3AAD5510} ZRCOLABINDIR 256 fileZRCola.exe.x64
|
||||
!ENDIF
|
||||
!IF "$(LANG)" == "Sl"
|
||||
!IF "$(LANG)" == "ru_RU"
|
||||
compZRCola.mo.ru_RU {DEA5D11C-2B0E-4B85-ACE3-D76334866F50} ZRCOLALOCRURUDIR $(MSIBUILD_COMPONENT_ATTRIB_FILE) fileZRCola.mo.ru_RU
|
||||
!ENDIF
|
||||
!IF "$(LANG)" == "sl_SI"
|
||||
compZRCola.mo.sl_SI {7FF95C71-D8DE-4D2B-A26D-FEB5A1F54D63} ZRCOLALOCSLSIDIR $(MSIBUILD_COMPONENT_ATTRIB_FILE) fileZRCola.mo.sl_SI
|
||||
!ENDIF
|
||||
<<NOKEEP
|
||||
@@ -115,7 +122,7 @@ compZRCola.mo.sl_SI {7FF95C71-D8DE-4D2B-A26D-FEB5A1F54D63} ZRCOLALOCSLSIDIR $(MS
|
||||
|
||||
All :: "$(LANG).$(PLAT).$(CFG).Control-2.idt"
|
||||
|
||||
"En.$(PLAT).$(CFG).Control-2.idtx" : "Makefile" "..\..\include\MSIBuildCfg.mak"
|
||||
"en_US.$(PLAT).$(CFG).Control-2.idtx" : "Makefile" "..\..\include\MSIBuildCfg.mak"
|
||||
-if exist $@ del /f /q $@
|
||||
move /y << $@ > NUL
|
||||
Dialog_ Control Type X Y Width Height Attributes Property Text Control_Next Help
|
||||
@@ -139,17 +146,13 @@ dlgTutorial3 ctlText1 Text 15 177 370 24 196611 Characters can be entered using
|
||||
dlgTutorial3 ctlContinue PushButton 325 265 60 20 3 &Continue ctlBannerBitmap
|
||||
<<NOKEEP
|
||||
|
||||
"De.$(PLAT).$(CFG).Control-2.idt" : "En.$(PLAT).$(CFG).Control-2.idtx" "..\locale\de_DE.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
|
||||
"En.$(PLAT).$(CFG).Control-2.idt" : "En.$(PLAT).$(CFG).Control-2.idtx"
|
||||
!IF "$(LANG)" == "en_US"
|
||||
"en_US.$(PLAT).$(CFG).Control-2.idt" : "en_US.$(PLAT).$(CFG).Control-2.idtx"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"It.$(PLAT).$(CFG).Control-2.idt" : "En.$(PLAT).$(CFG).Control-2.idtx" "..\locale\it_IT.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
|
||||
"Sl.$(PLAT).$(CFG).Control-2.idt" : "En.$(PLAT).$(CFG).Control-2.idtx" "..\locale\sl_SI.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
!ELSE
|
||||
"$(LANG).$(PLAT).$(CFG).Control-2.idt" : "en_US.$(PLAT).$(CFG).Control-2.idtx" "..\locale\$(LANG).po"
|
||||
cscript.exe "..\..\MSI\MSIBuild\MSI.wsf" //Job:IDTTranslate //Nologo $@ $** /CP:$(MSIBUILD_CODEPAGE)
|
||||
!ENDIF
|
||||
|
||||
|
||||
######################################################################
|
||||
@@ -197,9 +200,9 @@ All :: "$(LANG).$(PLAT).$(CFG).InstallUISequence-1.idt"
|
||||
Action Condition Sequence
|
||||
s$(MSIBUILD_LENGTH_ID) S255 I2
|
||||
InstallUISequence Action
|
||||
dlgTutorial1 NOT Installed 1400
|
||||
dlgTutorial2 NOT Installed 1401
|
||||
dlgTutorial3 NOT Installed 1402
|
||||
dlgTutorial1 NOT Installed AND &featZRCola>=3 1400
|
||||
dlgTutorial2 NOT Installed AND &featZRCola>=3 1401
|
||||
dlgTutorial3 NOT Installed AND &featZRCola>=3 1402
|
||||
<<NOKEEP
|
||||
|
||||
|
||||
@@ -208,7 +211,7 @@ dlgTutorial3 NOT Installed 1402
|
||||
|
||||
All :: "$(LANG).$(PLAT).$(CFG).Feature-2.idt"
|
||||
|
||||
"En.$(PLAT).$(CFG).Feature-2.idtx" : "Makefile" "..\..\include\MSIBuildCfg.mak"
|
||||
"en_US.$(PLAT).$(CFG).Feature-2.idtx" : "Makefile" "..\..\include\MSIBuildCfg.mak"
|
||||
-if exist $@ del /f /q $@
|
||||
move /y << $@ > NUL
|
||||
Feature Feature_Parent Title Description Display Level Directory_ Attributes
|
||||
@@ -217,17 +220,13 @@ s$(MSIBUILD_LENGTH_ID) S$(MSIBUILD_LENGTH_ID) L64 L255 I2 i2 S$(MSIBUILD_LENGTH_
|
||||
featZRCola ZRCola Input system for linguistic use 1 1 ZRCOLADIR 8
|
||||
<<NOKEEP
|
||||
|
||||
"De.$(PLAT).$(CFG).Feature-2.idt" : "En.$(PLAT).$(CFG).Feature-2.idtx" "..\locale\de_DE.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
|
||||
"En.$(PLAT).$(CFG).Feature-2.idt" : "En.$(PLAT).$(CFG).Feature-2.idtx"
|
||||
!IF "$(LANG)" == "en_US"
|
||||
"en_US.$(PLAT).$(CFG).Feature-2.idt" : "en_US.$(PLAT).$(CFG).Feature-2.idtx"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"It.$(PLAT).$(CFG).Feature-2.idt" : "En.$(PLAT).$(CFG).Feature-2.idtx" "..\locale\it_IT.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
|
||||
"Sl.$(PLAT).$(CFG).Feature-2.idt" : "En.$(PLAT).$(CFG).Feature-2.idtx" "..\locale\sl_SI.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
!ELSE
|
||||
"$(LANG).$(PLAT).$(CFG).Feature-2.idt" : "en_US.$(PLAT).$(CFG).Feature-2.idtx" "..\locale\$(LANG).po"
|
||||
cscript.exe "..\..\MSI\MSIBuild\MSI.wsf" //Job:IDTTranslate //Nologo $@ $** /CP:$(MSIBUILD_CODEPAGE)
|
||||
!ENDIF
|
||||
|
||||
|
||||
######################################################################
|
||||
@@ -250,14 +249,14 @@ featZRCola compLocalizationRepositoryPath
|
||||
featZRCola compLanguage
|
||||
featZRCola compDatabasePath
|
||||
featZRCola compZRCola.zrcdb
|
||||
featZRCola comp00_ZRCola_Re.otf
|
||||
!IF "$(LANG)" == "Sl"
|
||||
featZRCola compZRCola.mo.sl_SI
|
||||
featZRCola compZRCola.zrcdb.mo.sl_SI
|
||||
featZRCola complibZRColaUI.mo.sl_SI
|
||||
featZRCola compwxExtend.mo.sl_SI
|
||||
featZRCola compUpdater.mo.sl_SI
|
||||
featZRCola compwxstd.mo.sl_SI
|
||||
featZRCola compZRCola_Re.otf
|
||||
!IF "$(LANG)" != "en_US"
|
||||
featZRCola compZRCola.mo.$(LANG)
|
||||
featZRCola compZRCola.zrcdb.mo.$(LANG)
|
||||
featZRCola complibZRColaUI.mo.$(LANG)
|
||||
featZRCola compwxExtend.mo.$(LANG)
|
||||
featZRCola compUpdater.mo.$(LANG)
|
||||
featZRCola compwxstd.mo.$(LANG)
|
||||
!ENDIF
|
||||
<<NOKEEP
|
||||
|
||||
@@ -274,8 +273,8 @@ File Component_ FileName FileSize Version Language Attributes Sequence
|
||||
s$(MSIBUILD_LENGTH_ID) s$(MSIBUILD_LENGTH_ID) l255 i4 S$(MSIBUILD_LENGTH_ID) S20 I2 i2
|
||||
File File
|
||||
fileZRCola.exe.$(PLAT) compZRCola.exe.$(PLAT) ZRCola.exe 0 0 1536 1
|
||||
!IF "$(LANG)" == "Sl"
|
||||
fileZRCola.mo.sl_SI compZRCola.mo.sl_SI ZRCola.mo 0 1060 0 1
|
||||
!IF "$(LANG)" != "en_US"
|
||||
fileZRCola.mo.$(LANG) compZRCola.mo.$(LANG) ZRCola.mo 0 $(MSIBUILD_LANGID) 0 1
|
||||
!ENDIF
|
||||
<<NOKEEP
|
||||
|
||||
@@ -320,7 +319,7 @@ rmfiZRCola compZRCola.exe.$(PLAT) ZRColaShortcutDir 2
|
||||
|
||||
All :: "$(LANG).$(PLAT).$(CFG).Shortcut-2.idt"
|
||||
|
||||
"En.$(PLAT).$(CFG).Shortcut-2.idtx" : "Makefile" "..\..\include\MSIBuildCfg.mak"
|
||||
"en_US.$(PLAT).$(CFG).Shortcut-2.idtx" : "Makefile" "..\..\include\MSIBuildCfg.mak"
|
||||
-if exist $@ del /f /q $@
|
||||
move /y << $@ > NUL
|
||||
Shortcut Directory_ Name Component_ Target Arguments Description Hotkey Icon_ IconIndex ShowCmd WkDir
|
||||
@@ -329,17 +328,13 @@ s$(MSIBUILD_LENGTH_ID) s$(MSIBUILD_LENGTH_ID) l128 s$(MSIBUILD_LENGTH_ID) s$(MSI
|
||||
shctZRCola ZRColaShortcutDir ZRCola compZRCola.exe.$(PLAT) featZRCola Input system for linguistic use iconZRCola.ico ZRCOLABINDIR
|
||||
<<NOKEEP
|
||||
|
||||
"De.$(PLAT).$(CFG).Shortcut-2.idt" : "En.$(PLAT).$(CFG).Shortcut-2.idtx" "..\locale\de_DE.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
|
||||
"En.$(PLAT).$(CFG).Shortcut-2.idt" : "En.$(PLAT).$(CFG).Shortcut-2.idtx"
|
||||
!IF "$(LANG)" == "en_US"
|
||||
"en_US.$(PLAT).$(CFG).Shortcut-2.idt" : "en_US.$(PLAT).$(CFG).Shortcut-2.idtx"
|
||||
copy /y $** $@ > NUL
|
||||
|
||||
"It.$(PLAT).$(CFG).Shortcut-2.idt" : "En.$(PLAT).$(CFG).Shortcut-2.idtx" "..\locale\it_IT.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
|
||||
"Sl.$(PLAT).$(CFG).Shortcut-2.idt" : "En.$(PLAT).$(CFG).Shortcut-2.idtx" "..\locale\sl_SI.po"
|
||||
rcxgettext.exe idtp $@ $**
|
||||
!ELSE
|
||||
"$(LANG).$(PLAT).$(CFG).Shortcut-2.idt" : "en_US.$(PLAT).$(CFG).Shortcut-2.idtx" "..\locale\$(LANG).po"
|
||||
cscript.exe "..\..\MSI\MSIBuild\MSI.wsf" //Job:IDTTranslate //Nologo $@ $** /CP:$(MSIBUILD_CODEPAGE)
|
||||
!ENDIF
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
1174
ZRCola/ZRCola.fbp
BIN
ZRCola/ZRCola.rc
@@ -115,7 +115,10 @@
|
||||
<ProjectReference Include="..\lib\libZRCola\build\libZRCola.vcxproj">
|
||||
<Project>{3c61929e-7289-4101-8d0a-da22d6e1aea8}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lib\wxExtend\build\wxExtend.vcxproj">
|
||||
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lib\wxExtend\build\wxExtendDll.vcxproj">
|
||||
<Project>{a3a36689-ac35-4026-93da-a3ba0c0e767c}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Updater\Updater\build\Updater.vcxproj">
|
||||
@@ -125,6 +128,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="locale\ZRCola.pot" />
|
||||
<None Include="res\char_select.ico" />
|
||||
<None Include="res\copy_composed_and_return.ico" />
|
||||
<None Include="res\copy_decomposed_and_return.ico" />
|
||||
<None Include="res\edit_copy.ico" />
|
||||
<None Include="res\edit_cut.ico" />
|
||||
<None Include="res\edit_paste.ico" />
|
||||
|
||||
@@ -137,6 +137,12 @@
|
||||
<None Include="res\navigate_forward.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\copy_composed_and_return.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\copy_decomposed_and_return.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ZRCola.rc">
|
||||
|
||||
BIN
ZRCola/res/copy_destination_and_return.ico
Normal file
|
After Width: | Height: | Size: 52 KiB |
1698
ZRCola/res/copy_destination_and_return.pdf
Normal file
BIN
ZRCola/res/copy_source_and_return.ico
Normal file
|
After Width: | Height: | Size: 52 KiB |
1718
ZRCola/res/copy_source_and_return.pdf
Normal file
4
ZRCola/res/desktop.ini
Normal file
@@ -0,0 +1,4 @@
|
||||
[ViewState]
|
||||
Mode=
|
||||
Vid=
|
||||
FolderType=Pictures
|
||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
1783
ZRCola/res/send_destination.pdf
Normal file
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
1891
ZRCola/res/send_source.pdf
Normal file
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../include/zrcola.h"
|
||||
#include "../include/version.h"
|
||||
#include "zrcolaabout.h"
|
||||
#include "zrcolaapp.h"
|
||||
#include "zrcolachrcatpnl.h"
|
||||
@@ -37,13 +37,15 @@
|
||||
#include <wxex/url.h>
|
||||
#include <wxex/persist/auimanager.h>
|
||||
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/persist.h>
|
||||
#include <wx/persist/toplevel.h>
|
||||
#include <wx/socket.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/utils.h>
|
||||
#include <wx/valtext.h>
|
||||
#include <wx/socket.h>
|
||||
|
||||
#include <WinStd/MSI.h>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
wxZRColaAbout::wxZRColaAbout(wxWindow* parent) : wxZRColaAboutBase(parent)
|
||||
{
|
||||
m_staticTextVersion->SetLabelText(wxT(ZRCOLA_VERSION_STR));
|
||||
m_staticTextVersion->SetLabelText(wxT(PRODUCT_VERSION_STR));
|
||||
|
||||
m_staticTextCopyright->SetLabelText(wxString::Format(_("© 2004-%s ZRC SAZU"), wxT(ZRCOLA_BUILD_YEAR_STR)));
|
||||
m_staticTextCopyright->SetLabelText(wxString::Format(_("© 2004-%s ZRC SAZU"), wxT(PRODUCT_BUILD_YEAR_STR)));
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ wxIMPLEMENT_APP(ZRColaApp);
|
||||
|
||||
ZRColaApp::ZRColaApp() :
|
||||
m_mainWnd(NULL),
|
||||
#ifdef __WXMSW__
|
||||
m_running(NULL),
|
||||
#endif
|
||||
m_lang_ui(wxLANGUAGE_DEFAULT),
|
||||
wxApp()
|
||||
{
|
||||
}
|
||||
@@ -46,25 +44,21 @@ bool ZRColaApp::OnInit()
|
||||
// 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"));
|
||||
if (::MsiQueryFeatureState(_T(PRODUCT_VERSION_GUID), _T("featZRCola")) != INSTALLSTATE_UNKNOWN)
|
||||
::MsiUseFeature(_T(PRODUCT_VERSION_GUID), _T("featZRCola"));
|
||||
#endif
|
||||
|
||||
wxConfigBase *cfgPrev = wxConfigBase::Set(new wxConfig(wxT(ZRCOLA_CFG_APPLICATION), wxT(ZRCOLA_CFG_VENDOR)));
|
||||
// Initialize configuration.
|
||||
wxConfigBase *cfgPrev = wxConfigBase::Set(new wxConfig(wxT(PRODUCT_CFG_APPLICATION), wxT(PRODUCT_CFG_VENDOR)));
|
||||
if (cfgPrev) wxDELETE(cfgPrev);
|
||||
|
||||
if (!wxApp::OnInit())
|
||||
return false;
|
||||
|
||||
// Set desired locale.
|
||||
wxLanguage language = (wxLanguage)wxConfigBase::Get()->Read(wxT("Language"), wxLANGUAGE_DEFAULT);
|
||||
if (wxLocale::IsAvailable(language)) {
|
||||
wxString sPath;
|
||||
if (wxConfigBase::Get()->Read(wxT("LocalizationRepositoryPath"), &sPath))
|
||||
m_locale.AddCatalogLookupPathPrefix(sPath);
|
||||
wxVERIFY(m_locale.Init(language));
|
||||
// Initialize locale.
|
||||
if (wxInitializeLocale(m_locale, &m_lang_ui)) {
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("Updater") wxT(wxUpdaterVersion)));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("UpdaterZRCola")));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("libZRColaUI")));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("ZRCola")));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("ZRCola-zrcdb")));
|
||||
@@ -72,8 +66,7 @@ bool ZRColaApp::OnInit()
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Create global event.
|
||||
m_running = ::CreateEvent(NULL, FALSE, FALSE, _T(ZRCOLA_CFG_APPLICATION) _T("{BBDE7AAD-29B6-4B83-ADA1-92AFA81A0883}"));
|
||||
wxASSERT(m_running);
|
||||
m_running.attach(::CreateEvent(NULL, FALSE, FALSE, _T(PRODUCT_CFG_APPLICATION) _T("{BBDE7AAD-29B6-4B83-ADA1-92AFA81A0883}")));
|
||||
if (::GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||
// ZRCola is already running. Find its window.
|
||||
HWND okno = ::FindWindow(_T("wxWindowNR"), _("ZRCola"));
|
||||
@@ -107,49 +100,55 @@ bool ZRColaApp::OnInit()
|
||||
has_translation_data = true;
|
||||
} else {
|
||||
wxFAIL_MSG(wxT("Error reading translation data from ZRCola.zrcdb."));
|
||||
m_t_db.idxComp .clear();
|
||||
m_t_db.idxDecomp.clear();
|
||||
m_t_db.data .clear();
|
||||
m_t_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::transet_rec::id) {
|
||||
dat >> ZRCola::transet_rec(m_ts_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading translation set data from ZRCola.zrcdb."));
|
||||
m_ts_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::langchar_rec::id) {
|
||||
dat >> ZRCola::langchar_rec(m_lc_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading language character data from ZRCola.zrcdb."));
|
||||
m_lc_db.idxChr.clear();
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
m_lc_db.idxLng.clear();
|
||||
#endif
|
||||
m_lc_db.data .clear();
|
||||
m_lc_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::language_rec::id) {
|
||||
dat >> ZRCola::language_rec(m_lang_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading language character data from ZRCola.zrcdb."));
|
||||
m_lang_db.idxLng.clear();
|
||||
m_lang_db.data .clear();
|
||||
m_lang_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::keyseq_rec::id) {
|
||||
dat >> ZRCola::keyseq_rec(m_ks_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading key sequences data from ZRCola.zrcdb."));
|
||||
m_ks_db.idxChr.clear();
|
||||
m_ks_db.idxKey.clear();
|
||||
m_ks_db.data .clear();
|
||||
m_ks_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::character_rec::id) {
|
||||
dat >> ZRCola::character_rec(m_chr_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading character data from ZRCola.zrcdb."));
|
||||
m_chr_db.idxChr.clear();
|
||||
m_chr_db.data .clear();
|
||||
m_chr_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::chrcat_rec::id) {
|
||||
dat >> ZRCola::chrcat_rec(m_cc_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading character category data from ZRCola.zrcdb."));
|
||||
m_cc_db.idxChrCat.clear();
|
||||
m_cc_db.idxRnk .clear();
|
||||
m_cc_db.data .clear();
|
||||
m_cc_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::chrtag_rec::id) {
|
||||
dat >> ZRCola::chrtag_rec(m_ct_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading character tag data from ZRCola.zrcdb."));
|
||||
m_ct_db.clear();
|
||||
}
|
||||
} else if (id == ZRCola::tagname_rec::id) {
|
||||
dat >> ZRCola::tagname_rec(m_tn_db);
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading tag name data from ZRCola.zrcdb."));
|
||||
m_tn_db.clear();
|
||||
}
|
||||
} else
|
||||
stdex::idrec::ignore<ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>(dat);
|
||||
@@ -180,10 +179,7 @@ int ZRColaApp::OnExit()
|
||||
int res = wxApp::OnExit();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if (m_running) {
|
||||
wxVERIFY(::CloseHandle(m_running));
|
||||
m_running = NULL;
|
||||
}
|
||||
m_running.free();
|
||||
#endif
|
||||
|
||||
return res;
|
||||
|
||||
@@ -26,12 +26,14 @@ class ZRColaApp;
|
||||
#pragma once
|
||||
|
||||
#include "zrcolafrm.h"
|
||||
#include <WinStd/Win.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/intl.h>
|
||||
#include <zrcola/character.h>
|
||||
#include <zrcola/language.h>
|
||||
#include <zrcola/translate.h>
|
||||
#include <zrcola/tag.h>
|
||||
#include <zrcolaui/keyboard.h>
|
||||
|
||||
|
||||
@@ -71,19 +73,23 @@ public:
|
||||
|
||||
public:
|
||||
ZRCola::translation_db m_t_db; ///< Translation database
|
||||
ZRCola::transet_db m_ts_db; ///< Translation set database
|
||||
ZRCola::langchar_db m_lc_db; ///< Language character database
|
||||
ZRCola::language_db m_lang_db; ///< Language database
|
||||
ZRCola::keyseq_db m_ks_db; ///< Key sequence database
|
||||
ZRCola::character_db m_chr_db; ///< Character database
|
||||
ZRCola::chrcat_db m_cc_db; ///< Characted category database
|
||||
ZRCola::chrtag_db m_ct_db; ///< Character tag database
|
||||
ZRCola::tagname_db m_tn_db; ///< Tag name database
|
||||
|
||||
wxZRColaFrame *m_mainWnd; ///< Main window
|
||||
|
||||
wxLocale m_locale; ///< Current locale
|
||||
wxLanguage m_lang_ui; ///< Translation language (language of User Interface, wxLANGUAGE_DEFAULT = English)
|
||||
|
||||
protected:
|
||||
#ifdef __WXMSW__
|
||||
HANDLE m_running; ///< Global Win32 event to determine if another instance of ZRCola is already running
|
||||
winstd::win_handle m_running; ///< Global Win32 event to determine if another instance of ZRCola is already running
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BEGIN_EVENT_TABLE(wxZRColaCharacterCatalogPanel, wxZRColaCharacterCatalogPanelBase)
|
||||
EVT_MENU(wxZRColaCharacterCatalogPanel::wxID_FOCUS_DECOMPOSED, wxZRColaCharacterCatalogPanel::OnFocusDecomposed)
|
||||
EVT_MENU(wxZRColaCharacterCatalogPanel::wxID_FOCUS_SOURCE, wxZRColaCharacterCatalogPanel::OnFocusSource)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) : wxZRColaCharacterCatalogPanelBase(parent)
|
||||
{
|
||||
std::fstream dat((LPCTSTR)((ZRColaApp*)wxTheApp)->GetDatabaseFilePath(), std::ios_base::in | std::ios_base::binary);
|
||||
std::fstream dat((LPCTSTR)dynamic_cast<ZRColaApp*>(wxTheApp)->GetDatabaseFilePath(), std::ios_base::in | std::ios_base::binary);
|
||||
if (dat.good()) {
|
||||
if (stdex::idrec::find<ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>(dat, ZRCOLA_DB_ID, sizeof(ZRCola::recordid_t))) {
|
||||
ZRCola::recordsize_t size;
|
||||
@@ -42,8 +42,8 @@ wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) :
|
||||
dat >> rec;
|
||||
if (!dat.good()) {
|
||||
wxFAIL_MSG(wxT("Error reading character group data from ZRCola.zrcdb."));
|
||||
m_cg_db.idxRnk.clear();
|
||||
m_cg_db.data .clear();
|
||||
m_cg_db.idxRank.clear();
|
||||
m_cg_db.data .clear();
|
||||
}
|
||||
} else
|
||||
wxFAIL_MSG(wxT("ZRCola.zrcdb has no character group data."));
|
||||
@@ -52,16 +52,16 @@ wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) :
|
||||
wxFAIL_MSG(wxT("ZRCola.zrcdb is not a valid ZRCola database."));
|
||||
}
|
||||
|
||||
if (!m_cg_db.idxRnk.empty()) {
|
||||
if (!m_cg_db.idxRank.empty()) {
|
||||
// Populate character group list.
|
||||
for (size_t i = 0, n = m_cg_db.idxRnk.size(); i < n; i++) {
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = m_cg_db.idxRnk[i];
|
||||
for (size_t i = 0, n = m_cg_db.idxRank.size(); i < n; i++) {
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = m_cg_db.idxRank[i];
|
||||
wxString
|
||||
label(cg.data, cg.name_len),
|
||||
label(cg.name(), cg.name_len()),
|
||||
label_tran2(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
|
||||
m_choice->Insert(label_tran2, i);
|
||||
}
|
||||
m_cg_id = m_cg_db.idxRnk[0].id;
|
||||
m_cg_id = m_cg_db.idxRank[0].grp;
|
||||
m_choice->Select(0);
|
||||
|
||||
Update();
|
||||
@@ -70,7 +70,7 @@ wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) :
|
||||
// Register frame specific hotkey(s).
|
||||
{
|
||||
wxAcceleratorEntry entries[1];
|
||||
entries[0].Set(wxACCEL_NORMAL, WXK_ESCAPE, wxID_FOCUS_DECOMPOSED);
|
||||
entries[0].Set(wxACCEL_NORMAL, WXK_ESCAPE, wxID_FOCUS_SOURCE);
|
||||
SetAcceleratorTable(wxAcceleratorTable(_countof(entries), entries));
|
||||
}
|
||||
}
|
||||
@@ -83,10 +83,10 @@ wxZRColaCharacterCatalogPanel::~wxZRColaCharacterCatalogPanel()
|
||||
|
||||
void wxZRColaCharacterCatalogPanel::OnChoice(wxCommandEvent& event)
|
||||
{
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = m_cg_db.idxRnk[event.GetSelection()];
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = m_cg_db.idxRank[event.GetSelection()];
|
||||
|
||||
if (m_cg_id != cg.id) {
|
||||
m_cg_id = cg.id;
|
||||
if (m_cg_id != cg.grp) {
|
||||
m_cg_id = cg.grp;
|
||||
Update();
|
||||
}
|
||||
|
||||
@@ -96,10 +96,10 @@ void wxZRColaCharacterCatalogPanel::OnChoice(wxCommandEvent& event)
|
||||
|
||||
void wxZRColaCharacterCatalogPanel::OnGridClick(wxGridEvent& event)
|
||||
{
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
if (app->m_mainWnd) {
|
||||
app->m_mainWnd->m_panel->m_decomposed->WriteText(m_grid->GetCellValue(event.GetRow(), event.GetCol()));
|
||||
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
||||
app->m_mainWnd->m_panel->m_source->WriteText(m_grid->GetCellValue(event.GetRow(), event.GetCol()));
|
||||
app->m_mainWnd->m_panel->m_source->SetFocus();
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
@@ -111,10 +111,10 @@ void wxZRColaCharacterCatalogPanel::OnGridKeyDown(wxKeyEvent& event)
|
||||
switch (event.GetKeyCode()) {
|
||||
case WXK_RETURN:
|
||||
case WXK_NUMPAD_ENTER:
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
if (app->m_mainWnd) {
|
||||
app->m_mainWnd->m_panel->m_decomposed->WriteText(m_grid->GetCellValue(m_grid->GetCursorRow(), m_grid->GetCursorColumn()));
|
||||
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
||||
app->m_mainWnd->m_panel->m_source->WriteText(m_grid->GetCellValue(m_grid->GetCursorRow(), m_grid->GetCursorColumn()));
|
||||
app->m_mainWnd->m_panel->m_source->SetFocus();
|
||||
|
||||
event.StopPropagation();
|
||||
return;
|
||||
@@ -135,11 +135,11 @@ void wxZRColaCharacterCatalogPanel::OnShowAll(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaCharacterCatalogPanel::OnFocusDecomposed(wxCommandEvent& event)
|
||||
void wxZRColaCharacterCatalogPanel::OnFocusSource(wxCommandEvent& event)
|
||||
{
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
if (app->m_mainWnd) {
|
||||
app->m_mainWnd->m_panel->m_decomposed->SetFocus();
|
||||
app->m_mainWnd->m_panel->m_source->SetFocus();
|
||||
|
||||
event.StopPropagation();
|
||||
return;
|
||||
@@ -151,21 +151,23 @@ void wxZRColaCharacterCatalogPanel::OnFocusDecomposed(wxCommandEvent& event)
|
||||
|
||||
void wxZRColaCharacterCatalogPanel::Update()
|
||||
{
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = m_cg_db.idxRnk[m_choice->GetSelection()];
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = m_cg_db.idxRank[m_choice->GetSelection()];
|
||||
|
||||
if (m_show_all->GetValue()) {
|
||||
m_grid->SetCharacters(
|
||||
wxString(cg.get_chars(), cg.char_len),
|
||||
wxArrayShort((const short*)cg.get_char_shown(), (const short*)cg.get_char_shown() + (cg.char_len + 15)/16));
|
||||
wxString(cg.chrlst(), cg.chrlst_end()),
|
||||
wxArrayShort(reinterpret_cast<const short*>(cg.chrshow()), reinterpret_cast<const short*>(cg.chrshow_end())));
|
||||
} else {
|
||||
// Select frequently used characters only.
|
||||
const wchar_t *src = cg.get_chars();
|
||||
const unsigned __int16 *shown = cg.get_char_shown();
|
||||
wxString chars;
|
||||
for (unsigned __int16 i = 0, j = 0; i < cg.char_len; j++) {
|
||||
for (unsigned __int16 k = 0, mask = shown[j]; k < 16 && i < cg.char_len; k++, mask >>= 1, i++) {
|
||||
const wchar_t *src = cg.chrlst();
|
||||
const unsigned __int16 *shown = cg.chrshow();
|
||||
wxArrayString chars;
|
||||
for (size_t i = 0, i_end = cg.chrlst_len(), j = 0; i < i_end; j++) {
|
||||
for (unsigned __int16 k = 0, mask = shown[j]; k < 16 && i < i_end; k++, mask >>= 1) {
|
||||
size_t len = wcsnlen(src + i, i_end - i);
|
||||
if (mask & 1)
|
||||
chars += src[i];
|
||||
chars.Add(wxString(src + i, len));
|
||||
i += len + 1;
|
||||
}
|
||||
}
|
||||
m_grid->SetCharacters(chars);
|
||||
@@ -193,7 +195,7 @@ wxString wxPersistentZRColaCharacterCatalogPanel::GetKind() const
|
||||
|
||||
void wxPersistentZRColaCharacterCatalogPanel::Save() const
|
||||
{
|
||||
const wxZRColaCharacterCatalogPanel * const wnd = static_cast<const wxZRColaCharacterCatalogPanel*>(GetWindow());
|
||||
auto wnd = static_cast<const wxZRColaCharacterCatalogPanel*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||
|
||||
SaveValue(wxT("charGroup"), wnd->m_cg_id);
|
||||
SaveValue(wxT("showAll" ), wnd->m_show_all->GetValue());
|
||||
@@ -202,18 +204,17 @@ void wxPersistentZRColaCharacterCatalogPanel::Save() const
|
||||
|
||||
bool wxPersistentZRColaCharacterCatalogPanel::Restore()
|
||||
{
|
||||
wxZRColaCharacterCatalogPanel * const wnd = static_cast<wxZRColaCharacterCatalogPanel*>(GetWindow());
|
||||
|
||||
auto wnd = dynamic_cast<wxZRColaCharacterCatalogPanel*>(GetWindow());
|
||||
bool update = false;
|
||||
|
||||
// Restore selected character group.
|
||||
int cg_id;
|
||||
if (RestoreValue(wxT("charGroup"), &cg_id)) {
|
||||
for (size_t i = 0, n = wnd->m_cg_db.idxRnk.size(); i < n; i++) {
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = wnd->m_cg_db.idxRnk[i];
|
||||
if (cg.id == cg_id) {
|
||||
if (wnd->m_cg_id != cg.id) {
|
||||
wnd->m_cg_id = cg.id;
|
||||
for (size_t i = 0, n = wnd->m_cg_db.idxRank.size(); i < n; i++) {
|
||||
const ZRCola::chrgrp_db::chrgrp &cg = wnd->m_cg_db.idxRank[i];
|
||||
if (cg.grp == cg_id) {
|
||||
if (wnd->m_cg_id != cg.grp) {
|
||||
wnd->m_cg_id = cg.grp;
|
||||
wnd->m_choice->Select(i);
|
||||
update = true;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class wxZRColaCharacterCatalogPanel : public wxZRColaCharacterCatalogPanelBase
|
||||
public:
|
||||
enum
|
||||
{
|
||||
wxID_FOCUS_DECOMPOSED = 6000,
|
||||
wxID_FOCUS_SOURCE = 6000,
|
||||
};
|
||||
|
||||
wxZRColaCharacterCatalogPanel(wxWindow* parent);
|
||||
@@ -51,7 +51,7 @@ protected:
|
||||
virtual void OnGridClick(wxGridEvent& event);
|
||||
virtual void OnGridKeyDown(wxKeyEvent& event);
|
||||
virtual void OnShowAll(wxCommandEvent& event);
|
||||
void OnFocusDecomposed(wxCommandEvent& event);
|
||||
void OnFocusSource(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void Update();
|
||||
|
||||
@@ -68,6 +68,24 @@ void wxZRColaCharGrid::Init()
|
||||
|
||||
|
||||
void wxZRColaCharGrid::SetCharacters(const wxString &chars)
|
||||
{
|
||||
m_chars.Clear();
|
||||
const wxCStrData chr = chars.GetData();
|
||||
for (size_t i = 0, i_end = chars.Length(), i_next; i < i_end; i = i_next + 1) {
|
||||
i_next = i + _tcsnlen(chr + i, i_end - i);
|
||||
m_chars.Add(wxString(chr + i, chr + i_next));
|
||||
};
|
||||
m_relevance.Clear();
|
||||
m_regenerate = true;
|
||||
|
||||
// Invoke OnSize(), which will populate the grid.
|
||||
wxSizeEvent e(GetSize(), m_windowId);
|
||||
e.SetEventObject(this);
|
||||
HandleWindowEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaCharGrid::SetCharacters(const wxArrayString &chars)
|
||||
{
|
||||
m_chars = chars;
|
||||
m_relevance.Clear();
|
||||
@@ -82,7 +100,12 @@ void wxZRColaCharGrid::SetCharacters(const wxString &chars)
|
||||
|
||||
void wxZRColaCharGrid::SetCharacters(const wxString &chars, const wxArrayShort &relevance)
|
||||
{
|
||||
m_chars = chars;
|
||||
m_chars.Clear();
|
||||
const wxCStrData chr = chars.GetData();
|
||||
for (size_t i = 0, i_end = chars.Length(), i_next; i < i_end; i = i_next + 1) {
|
||||
i_next = i + _tcsnlen(chr + i, i_end - i);
|
||||
m_chars.Add(wxString(chr + i, chr + i_next));
|
||||
};
|
||||
m_relevance = relevance;
|
||||
m_regenerate = true;
|
||||
|
||||
@@ -95,25 +118,23 @@ void wxZRColaCharGrid::SetCharacters(const wxString &chars, const wxArrayShort &
|
||||
|
||||
wxString wxZRColaCharGrid::GetToolTipText(int idx)
|
||||
{
|
||||
wxASSERT_MSG(idx < (int)m_chars.Length(), wxT("index out of bounds"));
|
||||
wxASSERT_MSG(idx < (int)m_chars.GetCount(), wxT("index out of bounds"));
|
||||
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
const auto &chr = m_chars[idx];
|
||||
|
||||
// See if this character has a key sequence registered.
|
||||
std::unique_ptr<ZRCola::keyseq_db::keyseq> ks((ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(wchar_t)*chr.length()]);
|
||||
ks->ZRCola::keyseq_db::keyseq::keyseq(NULL, 0, chr.data(), chr.length());
|
||||
ZRCola::keyseq_db::indexKey::size_type start;
|
||||
bool found;
|
||||
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) {
|
||||
if (app->m_ks_db.idxChr.find(*ks, start)) {
|
||||
ZRCola::keyseq_db::keyseq &seq = app->m_ks_db.idxChr[start];
|
||||
wxString ks_str;
|
||||
if (ZRCola::keyseq_db::GetSequenceAsText(seq.seq, seq.seq_len, ks_str))
|
||||
return wxString::Format(wxT("U+%04X (%s)"), (int)m_chars[idx], ks_str.c_str());
|
||||
if (ZRCola::keyseq_db::GetSequenceAsText(seq.seq(), seq.seq_len(), ks_str))
|
||||
return wxString::Format(wxT("U+%s (%s)"), ZRCola::GetUnicodeDump(chr.data(), chr.length(), _T("+")).c_str(), ks_str.c_str());
|
||||
}
|
||||
|
||||
return wxString::Format(wxT("U+%04X"), (int)m_chars[idx]);
|
||||
return wxString::Format(wxT("U+%s"), ZRCola::GetUnicodeDump(chr.data(), chr.length(), _T("+")).c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -129,17 +150,17 @@ void wxZRColaCharGrid::OnSize(wxSizeEvent& event)
|
||||
// Calculate initial estimate of columns and rows.
|
||||
wxSize size(event.GetSize());
|
||||
size_t
|
||||
char_len = m_chars.Length();
|
||||
char_count = m_chars.GetCount();
|
||||
int
|
||||
width = size.GetWidth() - m_rowLabelWidth - m_extraWidth,
|
||||
cols = std::max<int>(width / wxZRColaCharacterGridColumnWidth, 1),
|
||||
rows = std::max<int>((char_len + cols - 1) / cols, 1);
|
||||
width = size.GetWidth() - m_rowLabelWidth - m_extraWidth,
|
||||
cols = std::max<int>(width / wxZRColaCharacterGridColumnWidth, 1),
|
||||
rows = std::max<int>((char_count + cols - 1) / cols, 1);
|
||||
|
||||
if (m_colLabelHeight + rows*wxZRColaCharacterGridRowHeight + m_extraHeight > size.GetHeight()) {
|
||||
// Vertical scrollbar will be shown. Adjust the width and recalculate layout to avoid horizontal scrollbar.
|
||||
width = std::max<int>(width - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X, this), 0);
|
||||
cols = std::max<int>(width / wxZRColaCharacterGridColumnWidth, 1);
|
||||
rows = std::max<int>((char_len + cols - 1) / cols, 1);
|
||||
rows = std::max<int>((char_count + cols - 1) / cols, 1);
|
||||
}
|
||||
|
||||
BeginBatch();
|
||||
@@ -149,14 +170,14 @@ void wxZRColaCharGrid::OnSize(wxSizeEvent& event)
|
||||
wxGridStringTable *table = new wxGridStringTable(rows, cols);
|
||||
for (int r = 0, i = 0; r < rows; r++)
|
||||
for (int c = 0; c < cols; c++, i++)
|
||||
table->SetValue(r, c, i < (int)char_len ? wxString(1, m_chars[i]) : wxEmptyString);
|
||||
table->SetValue(r, c, i < (int)char_count ? m_chars[i] : wxEmptyString);
|
||||
SetTable(table, true);
|
||||
if (!m_relevance.IsEmpty()) {
|
||||
const wxColour colour_def;
|
||||
const wxColour colour_irr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT);
|
||||
for (int r = 0, i = 0; r < rows; r++)
|
||||
for (int c = 0; c < cols; c++, i++)
|
||||
SetCellBackgroundColour(r, c, i >= (int)char_len || ((unsigned short)(m_relevance[i/16]) & (1<<(i%16))) ? colour_def : colour_irr);
|
||||
SetCellBackgroundColour(r, c, i >= (int)char_count || ((unsigned short)(m_relevance[i/16]) & (1<<(i%16))) ? colour_def : colour_irr);
|
||||
} else {
|
||||
for (int r = 0, i = 0; r < rows; r++)
|
||||
for (int c = 0; c < cols; c++, i++)
|
||||
@@ -220,7 +241,7 @@ void wxZRColaCharGrid::OnMotion(wxMouseEvent& event)
|
||||
return;
|
||||
|
||||
size_t toolTipIdx = row*m_numCols + col;
|
||||
if (toolTipIdx >= m_chars.Length()) {
|
||||
if (toolTipIdx >= m_chars.GetCount()) {
|
||||
// Index out of range.
|
||||
m_toolTipIdx = (size_t)-1;
|
||||
m_timerToolTip.Stop();
|
||||
@@ -244,7 +265,7 @@ void wxZRColaCharGrid::OnTooltipTimer(wxTimerEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
if (m_toolTipIdx >= m_chars.Length())
|
||||
if (m_toolTipIdx >= m_chars.GetCount())
|
||||
return;
|
||||
|
||||
GetGridWindow()->SetToolTip(GetToolTipText(m_toolTipIdx));
|
||||
|
||||
@@ -54,14 +54,21 @@ public:
|
||||
///
|
||||
/// Sets new array of characters to display
|
||||
///
|
||||
/// \param[in] chars The string containing characters to display
|
||||
/// \param[in] chars The string containing characters to display (zero delimited)
|
||||
///
|
||||
void SetCharacters(const wxString &chars);
|
||||
|
||||
///
|
||||
/// Sets new array of characters to display
|
||||
///
|
||||
/// \param[in] chars The string containing characters to display
|
||||
/// \param[in] chars The array of characters to display
|
||||
///
|
||||
void SetCharacters(const wxArrayString &chars);
|
||||
|
||||
///
|
||||
/// Sets new array of characters to display
|
||||
///
|
||||
/// \param[in] chars The string containing characters to display (zero delimited)
|
||||
/// \param[in] relevance Bit-array of \p chars relevance (1=more relevant, 0=less relevant)
|
||||
///
|
||||
void SetCharacters(const wxString &chars, const wxArrayShort &relevance);
|
||||
@@ -71,7 +78,7 @@ public:
|
||||
///
|
||||
/// \returns The string containing displayed characters
|
||||
///
|
||||
inline wxString GetCharacters() const
|
||||
inline const wxArrayString& GetCharacters() const
|
||||
{
|
||||
return m_chars;
|
||||
}
|
||||
@@ -83,10 +90,14 @@ public:
|
||||
///
|
||||
/// \returns Grid coordinates of selected character or (-1, -1) if character not found.
|
||||
///
|
||||
inline wxGridCellCoords GetCharacterCoords(wchar_t c) const
|
||||
inline wxGridCellCoords GetCharacterCoords(const wxString &c) const
|
||||
{
|
||||
int i = m_chars.Find(c);
|
||||
return i != wxNOT_FOUND ? wxGridCellCoords(i / m_numCols, i % m_numCols) : wxGridCellCoords(-1, -1);
|
||||
for (size_t i = 0, n = m_chars.GetCount(); ; i++) {
|
||||
if (i >= n)
|
||||
return wxGridCellCoords(-1, -1);
|
||||
else if (m_chars[i] == c)
|
||||
return wxGridCellCoords(i / m_numCols, i % m_numCols);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -102,7 +113,7 @@ private:
|
||||
void Init(); // common part of all ctors
|
||||
|
||||
protected:
|
||||
wxString m_chars; ///< Array of Unicode characters to display in the grid
|
||||
wxArrayString m_chars; ///< Array of Unicode characters to display in the grid
|
||||
wxArrayShort m_relevance; ///< Bit-array of `m_chars` relevance
|
||||
|
||||
private:
|
||||
|
||||
@@ -80,7 +80,7 @@ void wxPersistentZRColaCharRequest::Save() const
|
||||
{
|
||||
wxPersistentDialog::Save();
|
||||
|
||||
const wxZRColaCharRequest * const wnd = static_cast<const wxZRColaCharRequest*>(GetWindow());
|
||||
auto wnd = static_cast<const wxZRColaCharRequest*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||
|
||||
SaveValue(wxT("character"), wnd->m_character->GetValue());
|
||||
SaveValue(wxT("context"), wnd->m_context->GetValue());
|
||||
@@ -89,7 +89,7 @@ void wxPersistentZRColaCharRequest::Save() const
|
||||
|
||||
bool wxPersistentZRColaCharRequest::Restore()
|
||||
{
|
||||
wxZRColaCharRequest * const wnd = static_cast<wxZRColaCharRequest*>(GetWindow());
|
||||
auto wnd = dynamic_cast<wxZRColaCharRequest*>(GetWindow());
|
||||
|
||||
wxString str;
|
||||
if (RestoreValue(wxT("character"), &str))
|
||||
|
||||
@@ -20,6 +20,174 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxZRColaUTF16CharValidator
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxZRColaUTF16CharValidator, wxValidator);
|
||||
|
||||
|
||||
wxZRColaUTF16CharValidator::wxZRColaUTF16CharValidator(wchar_t *val) :
|
||||
m_val(val),
|
||||
wxValidator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxObject* wxZRColaUTF16CharValidator::Clone() const
|
||||
{
|
||||
return new wxZRColaUTF16CharValidator(*this);
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUTF16CharValidator::Validate(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
if (!ctrl->IsEnabled()) return true;
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, parent);
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUTF16CharValidator::TransferToWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
|
||||
if (m_val)
|
||||
((wxTextCtrl*)GetWindow())->SetValue(wxString::Format(wxT("%04X"), *m_val));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUTF16CharValidator::TransferFromWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, NULL, m_val);
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUTF16CharValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, wchar_t *val_out)
|
||||
{
|
||||
const wxStringCharType *buf = val_in;
|
||||
|
||||
wchar_t chr = 0;
|
||||
for (size_t i = i_start;;) {
|
||||
if (i >= i_end) {
|
||||
// End of Unicode found.
|
||||
if (val_out) *val_out = chr;
|
||||
return true;
|
||||
} else if (i >= i_start + 4) {
|
||||
// Maximum characters exceeded.
|
||||
ctrl->SetFocus();
|
||||
ctrl->SetSelection(i, i_end);
|
||||
wxMessageBox(_("Too many digits in Unicode."), _("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent);
|
||||
return false;
|
||||
} else if (_T('0') <= buf[i] && buf[i] <= _T('9')) {
|
||||
// Digit found.
|
||||
chr = (chr << 4) | (buf[i] - _T('0'));
|
||||
i++;
|
||||
} else if (_T('A') <= buf[i] && buf[i] <= _T('F')) {
|
||||
// Capital letter found.
|
||||
chr = (chr << 4) | (buf[i] - _T('A') + 10);
|
||||
i++;
|
||||
} else if (_T('a') <= buf[i] && buf[i] <= _T('f')) {
|
||||
// Lower letter found.
|
||||
chr = (chr << 4) | (buf[i] - _T('a') + 10);
|
||||
i++;
|
||||
} else {
|
||||
// Invalid character found.
|
||||
ctrl->SetFocus();
|
||||
ctrl->SetSelection(i, i + 1);
|
||||
wxMessageBox(wxString::Format(_("Invalid character in Unicode found: %c"), buf[i]), _("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxZRColaUnicodeDumpValidator
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxZRColaUnicodeDumpValidator, wxValidator);
|
||||
|
||||
|
||||
wxZRColaUnicodeDumpValidator::wxZRColaUnicodeDumpValidator(wxString *val) :
|
||||
m_val(val),
|
||||
wxValidator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
wxObject* wxZRColaUnicodeDumpValidator::Clone() const
|
||||
{
|
||||
return new wxZRColaUnicodeDumpValidator(*this);
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUnicodeDumpValidator::Validate(wxWindow *parent)
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
if (!ctrl->IsEnabled()) return true;
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, parent);
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUnicodeDumpValidator::TransferToWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
|
||||
if (m_val)
|
||||
((wxTextCtrl*)GetWindow())->SetValue(ZRCola::GetUnicodeDumpW(m_val->c_str(), m_val->length(), L"+"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUnicodeDumpValidator::TransferFromWindow()
|
||||
{
|
||||
wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxTextCtrl)));
|
||||
wxTextCtrl *ctrl = (wxTextCtrl*)GetWindow();
|
||||
|
||||
wxString val(ctrl->GetValue());
|
||||
return Parse(val, 0, val.Length(), ctrl, NULL, m_val);
|
||||
}
|
||||
|
||||
|
||||
bool wxZRColaUnicodeDumpValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, wxString *val_out)
|
||||
{
|
||||
const wxStringCharType *buf = val_in;
|
||||
|
||||
wxString str;
|
||||
for (size_t i = i_start;;) {
|
||||
const wxStringCharType *buf_next;
|
||||
wchar_t chr;
|
||||
if ((buf_next = wmemchr(buf + i, L'+', i_end - i)) != NULL) {
|
||||
// Unicode dump separator found.
|
||||
if (!wxZRColaUTF16CharValidator::Parse(val_in, i, buf_next - buf, ctrl, parent, &chr))
|
||||
return false;
|
||||
str += chr;
|
||||
i = buf_next - buf + 1;
|
||||
} else if (wxZRColaUTF16CharValidator::Parse(val_in, i, i_end, ctrl, parent, &chr)) {
|
||||
// The rest of the FQDN parsed succesfully.
|
||||
if (chr) str += chr;
|
||||
if (val_out) *val_out = str;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// wxZRColaCharSelect
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -30,23 +198,30 @@ wxDEFINE_EVENT(wxEVT_SEARCH_COMPLETE, wxThreadEvent);
|
||||
wxZRColaCharSelect::wxZRColaCharSelect(wxWindow* parent) :
|
||||
m_searchChanged(false),
|
||||
m_unicodeChanged(false),
|
||||
m_char(0),
|
||||
m_searchThread(NULL),
|
||||
wxZRColaCharSelectBase(parent)
|
||||
{
|
||||
// Set tag lookup locale.
|
||||
wxLanguage language = dynamic_cast<ZRColaApp*>(wxTheApp)->m_lang_ui;
|
||||
if (wxLANGUAGE_DEFAULT == language ||
|
||||
wxLANGUAGE_ENGLISH <= language && language <= wxLANGUAGE_ENGLISH_ZIMBABWE) m_locale = MAKELCID(MAKELANGID(LANG_ENGLISH , SUBLANG_DEFAULT), SORT_DEFAULT);
|
||||
else if (wxLANGUAGE_RUSSIAN <= language && language <= wxLANGUAGE_RUSSIAN_UKRAINE ) m_locale = MAKELCID(MAKELANGID(LANG_RUSSIAN , SUBLANG_DEFAULT), SORT_DEFAULT);
|
||||
else if (wxLANGUAGE_SLOVENIAN == language ) m_locale = MAKELCID(MAKELANGID(LANG_SLOVENIAN, SUBLANG_DEFAULT), SORT_DEFAULT);
|
||||
else m_locale = MAKELCID(MAKELANGID(LANG_ENGLISH , SUBLANG_DEFAULT), SORT_DEFAULT);
|
||||
|
||||
Connect(wxID_ANY, wxEVT_SEARCH_COMPLETE, wxThreadEventHandler(wxZRColaCharSelect::OnSearchComplete), NULL, this);
|
||||
|
||||
m_search_more->SetLabel(_(L"▸ Search Options"));
|
||||
|
||||
m_unicode->SetValidator(wxHexValidator<wchar_t>(&m_char, wxNUM_VAL_DEFAULT, 4));
|
||||
m_unicode->SetValidator(wxZRColaUnicodeDumpValidator(&m_char));
|
||||
|
||||
// Fill categories.
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
||||
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i];
|
||||
int idx = m_categories->Insert(wxGetTranslation(wxString(cc.name, cc.name_len), wxT("ZRCola-zrcdb")), i);
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRank.size(); i < n; i++) {
|
||||
const auto &cc = app->m_cc_db.idxRank[i];
|
||||
int idx = m_categories->Insert(wxGetTranslation(wxString(cc.name(), cc.name_len()), wxT("ZRCola-zrcdb")), i);
|
||||
m_categories->Check(idx);
|
||||
m_ccOrder.insert(std::make_pair(cc.id, idx));
|
||||
m_ccOrder.insert(std::make_pair(cc.cat, idx));
|
||||
}
|
||||
|
||||
ResetResults();
|
||||
@@ -74,26 +249,26 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
||||
|
||||
if (m_unicodeChanged) {
|
||||
if (m_unicode->GetValidator()->TransferFromWindow()) {
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
|
||||
m_gridPreview->SetCellValue(wxString(1, m_char), 0, 0);
|
||||
m_gridPreview->SetCellValue(m_char, 0, 0);
|
||||
|
||||
char chr[sizeof(ZRCola::character_db::character)] = {};
|
||||
((ZRCola::character_db::character*)chr)->chr = m_char;
|
||||
std::unique_ptr<ZRCola::character_db::character> chr((ZRCola::character_db::character*)new char[sizeof(ZRCola::character_db::character) + sizeof(wchar_t)*m_char.length()]);
|
||||
chr->ZRCola::character_db::character::character(m_char.data(), m_char.length());
|
||||
size_t 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];
|
||||
// Update characted description.
|
||||
m_description->SetValue(wxString(chr.data, chr.desc_len));
|
||||
if (app->m_chr_db.idxChr.find(*chr, start)) {
|
||||
const auto &chr = app->m_chr_db.idxChr[start];
|
||||
// Update character description.
|
||||
m_description->SetValue(wxString(chr.desc(), chr.desc_len()));
|
||||
{
|
||||
// See if this character has a key sequence registered.
|
||||
std::unique_ptr<ZRCola::keyseq_db::keyseq> ks((ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(wchar_t)*m_char.length()]);
|
||||
ks->ZRCola::keyseq_db::keyseq::keyseq(NULL, 0, m_char.data(), m_char.length());
|
||||
ZRCola::keyseq_db::indexKey::size_type start;
|
||||
char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {};
|
||||
((ZRCola::keyseq_db::keyseq*)ks)->chr = m_char;
|
||||
if (app->m_ks_db.idxChr.find(*(ZRCola::keyseq_db::keyseq*)ks, start)) {
|
||||
if (app->m_ks_db.idxChr.find(*ks, start)) {
|
||||
ZRCola::keyseq_db::keyseq &seq = app->m_ks_db.idxChr[start];
|
||||
wxString ks_str;
|
||||
if (ZRCola::keyseq_db::GetSequenceAsText(seq.seq, seq.seq_len, ks_str))
|
||||
if (ZRCola::keyseq_db::GetSequenceAsText(seq.seq(), seq.seq_len(), ks_str))
|
||||
m_shortcut->SetValue(ks_str);
|
||||
else
|
||||
m_shortcut->SetValue(wxEmptyString);
|
||||
@@ -101,18 +276,16 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
||||
m_shortcut->SetValue(wxEmptyString);
|
||||
}
|
||||
{
|
||||
char cc[sizeof(ZRCola::chrcat_db::chrcat)] = {};
|
||||
((ZRCola::chrcat_db::chrcat*)cc)->id = chr.cat;
|
||||
size_t start;
|
||||
// Update character category.
|
||||
if (app->m_cc_db.idxChrCat.find(*((ZRCola::chrcat_db::chrcat*)cc), start)) {
|
||||
const ZRCola::chrcat_db::chrcat &cat = app->m_cc_db.idxChrCat[start];
|
||||
m_category->SetValue(wxGetTranslation(wxString(cat.name, cat.name_len), wxT("ZRCola-zrcdb")));
|
||||
if (app->m_cc_db.idxChrCat.find(ZRCola::chrcat_db::chrcat(chr.cat), start)) {
|
||||
const auto &cat = app->m_cc_db.idxChrCat[start];
|
||||
m_category->SetValue(wxGetTranslation(wxString(cat.name(), cat.name_len()), wxT("ZRCola-zrcdb")));
|
||||
} else
|
||||
m_category->SetValue(wxEmptyString);
|
||||
}
|
||||
// Update related characters.
|
||||
m_gridRelated->SetCharacters(wxString(chr.data + chr.desc_len, chr.rel_len));
|
||||
m_gridRelated->SetCharacters(wxString(chr.rel(), chr.rel_end()));
|
||||
} else {
|
||||
m_description->SetValue(wxEmptyString);
|
||||
m_shortcut->SetValue(wxEmptyString);
|
||||
@@ -120,6 +293,43 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
||||
m_gridRelated->ClearGrid();
|
||||
}
|
||||
|
||||
// Find character tags.
|
||||
std::list<std::wstring> tag_names;
|
||||
std::unique_ptr<ZRCola::chrtag_db::chrtag> ct((ZRCola::chrtag_db::chrtag*)new char[sizeof(ZRCola::chrtag_db::chrtag) + sizeof(wchar_t)*m_char.length()]);
|
||||
ct->ZRCola::chrtag_db::chrtag::chrtag(m_char.data(), m_char.length());
|
||||
size_t end;
|
||||
if (app->m_ct_db.idxChr.find(*ct, start, end)) {
|
||||
for (size_t i = start; i < end; i++) {
|
||||
const ZRCola::chrtag_db::chrtag &ct = app->m_ct_db.idxChr[i];
|
||||
|
||||
// Find tag names.
|
||||
size_t start, end;
|
||||
if (app->m_tn_db.idxTag.find(ZRCola::tagname_db::tagname(ct.tag, m_locale), start, end)) {
|
||||
for (size_t i = start; i < end; i++) {
|
||||
const ZRCola::tagname_db::tagname &tn = app->m_tn_db.idxTag[i];
|
||||
|
||||
// Add tag name to the list (prevent duplicates).
|
||||
for (auto name = tag_names.cbegin(), name_end = tag_names.cend();; ++name) {
|
||||
if (name == name_end) {
|
||||
// Add name to the list.
|
||||
tag_names.push_back(std::wstring(tn.name(), tn.name_end()));
|
||||
break;
|
||||
} else if (ZRCola::tagname_db::tagname::CompareName(m_locale, name->data(), (unsigned __int16)name->length(), tn.name(), tn.name_len()) == 0)
|
||||
// Name is already on the list.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
wxString tags;
|
||||
for (auto name = tag_names.cbegin(), name_end = tag_names.cend(); name != name_end; ++name) {
|
||||
if (!tags.empty())
|
||||
tags += _(", ");
|
||||
tags += *name;
|
||||
}
|
||||
m_tags->SetValue(tags);
|
||||
|
||||
m_gridRelated->GoToCell(m_historyCursor->m_related.m_selected);
|
||||
|
||||
wxGridCellCoords coord(m_gridResults->GetCharacterCoords(m_char));
|
||||
@@ -137,17 +347,17 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
|
||||
|
||||
wxString val(m_search->GetValue());
|
||||
if (!val.IsEmpty()) {
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
|
||||
m_searchThread = new SearchThread(this);
|
||||
|
||||
m_searchThread->m_search.assign(val.c_str(), val.Length());
|
||||
|
||||
// Select categories.
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
||||
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i];
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRank.size(); i < n; i++) {
|
||||
const auto &cc = app->m_cc_db.idxRank[i];
|
||||
if (m_categories->IsChecked(i))
|
||||
m_searchThread->m_cats.insert(cc.id);
|
||||
m_searchThread->m_cats.insert(cc.cat);
|
||||
}
|
||||
|
||||
if (m_searchThread->Run() != wxTHREAD_NO_ERROR) {
|
||||
@@ -191,8 +401,8 @@ void wxZRColaCharSelect::OnCategoriesAll(wxHyperlinkEvent& event)
|
||||
{
|
||||
event.StopPropagation();
|
||||
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRank.size(); i < n; i++)
|
||||
m_categories->Check(i, true);
|
||||
|
||||
m_searchChanged = true;
|
||||
@@ -203,8 +413,8 @@ void wxZRColaCharSelect::OnCategoriesNone(wxHyperlinkEvent& event)
|
||||
{
|
||||
event.StopPropagation();
|
||||
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRank.size(); i < n; i++)
|
||||
m_categories->Check(i, false);
|
||||
|
||||
m_searchChanged = true;
|
||||
@@ -215,8 +425,8 @@ void wxZRColaCharSelect::OnCategoriesInvert(wxHyperlinkEvent& event)
|
||||
{
|
||||
event.StopPropagation();
|
||||
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++)
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRank.size(); i < n; i++)
|
||||
m_categories->Check(i, !m_categories->IsChecked(i));
|
||||
|
||||
m_searchChanged = true;
|
||||
@@ -237,10 +447,10 @@ void wxZRColaCharSelect::OnSearchComplete(wxThreadEvent& event)
|
||||
|
||||
if (m_searchThread) {
|
||||
// Display results.
|
||||
wxString chars;
|
||||
wxArrayString chars;
|
||||
chars.reserve(m_searchThread->m_hits.size());
|
||||
for (std::vector<std::pair<ZRCola::charrank_t, wchar_t> >::const_iterator i = m_searchThread->m_hits.cbegin(), i_end = m_searchThread->m_hits.cend(); i != i_end; ++i)
|
||||
chars += i->second;
|
||||
for (auto i = m_searchThread->m_hits.cbegin(), i_end = m_searchThread->m_hits.cend(); i != i_end; ++i)
|
||||
chars.Add(i->second);
|
||||
m_gridResults->SetCharacters(chars);
|
||||
|
||||
m_searchThread->Delete();
|
||||
@@ -257,7 +467,7 @@ void wxZRColaCharSelect::OnResultSelectCell(wxGridEvent& event)
|
||||
|
||||
wxString val(m_gridResults->GetCellValue(event.GetRow(), event.GetCol()));
|
||||
if (!val.IsEmpty())
|
||||
NavigateTo(val[0]);
|
||||
NavigateTo(val);
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +477,7 @@ void wxZRColaCharSelect::OnResultCellDClick(wxGridEvent& event)
|
||||
|
||||
wxString val(m_gridResults->GetCellValue(event.GetRow(), event.GetCol()));
|
||||
if (!val.IsEmpty()) {
|
||||
NavigateTo(val[0]);
|
||||
NavigateTo(val);
|
||||
wxCommandEvent e(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
||||
m_sdbSizerButtonsOK->GetEventHandler()->ProcessEvent(e);
|
||||
}
|
||||
@@ -281,7 +491,7 @@ void wxZRColaCharSelect::OnResultsKeyDown(wxKeyEvent& event)
|
||||
case WXK_NUMPAD_ENTER:
|
||||
wxString val(m_gridResults->GetCellValue(m_gridResults->GetCursorRow(), m_gridResults->GetCursorColumn()));
|
||||
if (!val.IsEmpty()) {
|
||||
NavigateTo(val[0]);
|
||||
NavigateTo(val);
|
||||
wxCommandEvent e(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
||||
m_sdbSizerButtonsOK->GetEventHandler()->ProcessEvent(e);
|
||||
|
||||
@@ -300,7 +510,7 @@ void wxZRColaCharSelect::OnRecentSelectCell(wxGridEvent& event)
|
||||
|
||||
wxString val(m_gridRecent->GetCellValue(event.GetRow(), event.GetCol()));
|
||||
if (!val.IsEmpty())
|
||||
NavigateTo(val[0]);
|
||||
NavigateTo(val);
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +520,7 @@ void wxZRColaCharSelect::OnRecentCellDClick(wxGridEvent& event)
|
||||
|
||||
wxString val(m_gridRecent->GetCellValue(event.GetRow(), event.GetCol()));
|
||||
if (!val.IsEmpty()) {
|
||||
NavigateTo(val[0]);
|
||||
NavigateTo(val);
|
||||
wxCommandEvent e(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
||||
m_sdbSizerButtonsOK->GetEventHandler()->ProcessEvent(e);
|
||||
}
|
||||
@@ -324,7 +534,7 @@ void wxZRColaCharSelect::OnRecentKeyDown(wxKeyEvent& event)
|
||||
case WXK_NUMPAD_ENTER:
|
||||
wxString val(m_gridRecent->GetCellValue(m_gridRecent->GetCursorRow(), m_gridRecent->GetCursorColumn()));
|
||||
if (!val.IsEmpty()) {
|
||||
NavigateTo(val[0]);
|
||||
NavigateTo(val);
|
||||
wxCommandEvent e(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
|
||||
m_sdbSizerButtonsOK->GetEventHandler()->ProcessEvent(e);
|
||||
|
||||
@@ -384,7 +594,7 @@ void wxZRColaCharSelect::OnRelatedSelectCell(wxGridEvent& event)
|
||||
|
||||
wxString val(m_gridRelated->GetCellValue(event.GetRow(), event.GetCol()));
|
||||
if (!val.IsEmpty())
|
||||
NavigateTo(val[0]);
|
||||
NavigateTo(val);
|
||||
}
|
||||
|
||||
|
||||
@@ -392,15 +602,15 @@ void wxZRColaCharSelect::OnOKButtonClick(wxCommandEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
wxString
|
||||
recent(m_gridRecent->GetCharacters()),
|
||||
val(1, m_char);
|
||||
for (size_t i = 0, n = recent.Length(); i < n; i++) {
|
||||
const wxStringCharType c = recent[i];
|
||||
const wxArrayString &recent = m_gridRecent->GetCharacters();
|
||||
wxArrayString val;
|
||||
val.reserve(recent.GetCount() + 1);
|
||||
val.Add(m_char);
|
||||
for (size_t i = 0, n = recent.GetCount(); i < n; i++) {
|
||||
const wxString &c = recent[i];
|
||||
if (c != m_char)
|
||||
val += c;
|
||||
val.Add(c);
|
||||
}
|
||||
|
||||
m_gridRecent->SetCharacters(val);
|
||||
}
|
||||
|
||||
@@ -408,15 +618,15 @@ void wxZRColaCharSelect::OnOKButtonClick(wxCommandEvent& event)
|
||||
void wxZRColaCharSelect::ResetResults()
|
||||
{
|
||||
// Fill the results.
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
size_t i, n = app->m_chr_db.idxChr.size();
|
||||
wxString val;
|
||||
wxArrayString val;
|
||||
val.reserve(n);
|
||||
for (i = 0; i < n; i++) {
|
||||
const ZRCola::character_db::character &chr = app->m_chr_db.idxChr[i];
|
||||
std::map<ZRCola::chrcatid_t, int>::const_iterator idx = m_ccOrder.find(chr.cat);
|
||||
const auto &chr = app->m_chr_db.idxChr[i];
|
||||
auto idx = m_ccOrder.find(chr.cat);
|
||||
if (idx == m_ccOrder.end() || m_categories->IsChecked(idx->second))
|
||||
val += chr.chr;
|
||||
val.Add(wxString(chr.chr(), chr.chr_len()));
|
||||
}
|
||||
m_gridResults->SetCharacters(val);
|
||||
}
|
||||
@@ -450,7 +660,7 @@ void wxZRColaCharSelect::NavigateBy(int offset)
|
||||
}
|
||||
|
||||
m_navigateBack->Enable(m_historyCursor != m_history.begin());
|
||||
std::list<NavigationState>::iterator cursor_next(m_historyCursor);
|
||||
auto cursor_next = m_historyCursor;
|
||||
++cursor_next;
|
||||
m_navigateForward->Enable(cursor_next != m_history.end());
|
||||
|
||||
@@ -460,7 +670,7 @@ void wxZRColaCharSelect::NavigateBy(int offset)
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaCharSelect::NavigateTo(wchar_t c)
|
||||
void wxZRColaCharSelect::NavigateTo(const wxString &c)
|
||||
{
|
||||
if (m_char != c) {
|
||||
// Update history state
|
||||
@@ -477,7 +687,7 @@ void wxZRColaCharSelect::NavigateTo(wchar_t c)
|
||||
m_historyCursor = m_history.insert(m_historyCursor, state);
|
||||
|
||||
// Purge the history's tail.
|
||||
std::list<NavigationState>::iterator cursor_next(m_historyCursor);
|
||||
auto cursor_next = m_historyCursor;
|
||||
++cursor_next;
|
||||
m_history.erase(cursor_next, m_history.end());
|
||||
|
||||
@@ -500,18 +710,25 @@ wxZRColaCharSelect::SearchThread::SearchThread(wxZRColaCharSelect *parent) :
|
||||
|
||||
wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
|
||||
{
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
std::map<wchar_t, ZRCola::charrank_t> hits;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
std::map<std::wstring, ZRCola::charrank_t> hits;
|
||||
|
||||
if (TestDestroy()) return (wxThread::ExitCode)1;
|
||||
|
||||
{
|
||||
// Search by indexes and merge results.
|
||||
std::map<wchar_t, ZRCola::charrank_t> hits_sub;
|
||||
// Search by tags: Get tags with given names. Then, get characters of found tags.
|
||||
std::map<ZRCola::tagid_t, unsigned __int16> hits_tag;
|
||||
if (!app->m_tn_db.Search(m_search.c_str(), m_parent->m_locale, hits_tag, TestDestroyS, this)) return (wxThread::ExitCode)1;
|
||||
if (!app->m_ct_db.Search(hits_tag, app->m_chr_db, m_cats, hits, TestDestroyS, this)) return (wxThread::ExitCode)1;
|
||||
}
|
||||
|
||||
{
|
||||
// Search by description and merge results.
|
||||
std::map<std::wstring, ZRCola::charrank_t> hits_sub;
|
||||
if (!app->m_chr_db.Search(m_search.c_str(), m_cats, hits, hits_sub, TestDestroyS, this)) return (wxThread::ExitCode)1;
|
||||
for (std::map<wchar_t, ZRCola::charrank_t>::const_iterator i = hits_sub.cbegin(), i_end = hits_sub.cend(); i != i_end; ++i) {
|
||||
for (auto i = hits_sub.cbegin(), i_end = hits_sub.cend(); i != i_end; ++i) {
|
||||
if (TestDestroy()) return (wxThread::ExitCode)1;
|
||||
std::map<wchar_t, ZRCola::charrank_t>::iterator idx = hits.find(i->first);
|
||||
auto idx = hits.find(i->first);
|
||||
if (idx == hits.end())
|
||||
hits.insert(std::make_pair(i->first, i->second / 4));
|
||||
else
|
||||
@@ -521,7 +738,7 @@ wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
|
||||
|
||||
// Get best rank.
|
||||
ZRCola::charrank_t rank_ref = 0;
|
||||
for (std::map<wchar_t, ZRCola::charrank_t>::const_iterator i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) {
|
||||
for (auto i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) {
|
||||
if (TestDestroy()) return (wxThread::ExitCode)1;
|
||||
if (i->second > rank_ref)
|
||||
rank_ref = i->second;
|
||||
@@ -530,12 +747,12 @@ wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
|
||||
// Now sort the characters by rank (taking only top 3/4 by rank).
|
||||
ZRCola::charrank_t rank_threshold = rank_ref*3/4;
|
||||
m_hits.reserve(hits.size());
|
||||
for (std::map<wchar_t, ZRCola::charrank_t>::const_iterator i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) {
|
||||
for (auto i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) {
|
||||
if (TestDestroy()) return (wxThread::ExitCode)1;
|
||||
if (i->second > rank_threshold)
|
||||
m_hits.push_back(std::make_pair(i->second, i->first));
|
||||
}
|
||||
std::qsort(m_hits.data(), m_hits.size(), sizeof(std::pair<ZRCola::charrank_t, wchar_t>), CompareHits);
|
||||
std::qsort(m_hits.data(), m_hits.size(), sizeof(std::pair<ZRCola::charrank_t, std::wstring>), CompareHits);
|
||||
|
||||
// Signal the event handler that this thread is going to be destroyed.
|
||||
// NOTE: here we assume that using the m_parent pointer is safe,
|
||||
@@ -580,15 +797,28 @@ void wxPersistentZRColaCharSelect::Save() const
|
||||
{
|
||||
wxPersistentDialog::Save();
|
||||
|
||||
const wxZRColaCharSelect * const wnd = static_cast<const wxZRColaCharSelect*>(GetWindow());
|
||||
auto wnd = static_cast<const wxZRColaCharSelect*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
|
||||
SaveValue(wxT("recentChars"), wnd->m_gridRecent->GetCharacters());
|
||||
wxString str, str2;
|
||||
auto &recent = wnd->m_gridRecent->GetCharacters();
|
||||
for (size_t i = 0, n = recent.GetCount(); i < n; i++) {
|
||||
if (i) str2 += wxT('|');
|
||||
auto &chr = recent[i];
|
||||
for (size_t j = 0, m = chr.Length(); j < m; j++) {
|
||||
if (j) str2 += wxT('+');
|
||||
str2 += wxString::Format(wxT("%04X"), chr[j]);
|
||||
}
|
||||
if (chr.Length() == 1)
|
||||
str += chr[0];
|
||||
}
|
||||
SaveValue(wxT("recentChars" ), str ); // Save in legacy format for backward compatibility.
|
||||
SaveValue(wxT("recentChars2"), str2); // Save in native format
|
||||
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
||||
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i];
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRank.size(); i < n; i++) {
|
||||
const auto &cc = app->m_cc_db.idxRank[i];
|
||||
wxString name(wxT("category"));
|
||||
name.Append(cc.id.data, _countof(cc.id.data));
|
||||
name.Append(cc.cat.data, _countof(cc.cat.data));
|
||||
SaveValue(name, wnd->m_categories->IsChecked(i));
|
||||
}
|
||||
|
||||
@@ -598,17 +828,32 @@ void wxPersistentZRColaCharSelect::Save() const
|
||||
|
||||
bool wxPersistentZRColaCharSelect::Restore()
|
||||
{
|
||||
wxZRColaCharSelect * const wnd = static_cast<wxZRColaCharSelect*>(GetWindow());
|
||||
auto wnd = dynamic_cast<wxZRColaCharSelect*>(GetWindow());
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
|
||||
wxString recent;
|
||||
if (RestoreValue(wxT("recentChars"), &recent))
|
||||
wnd->m_gridRecent->SetCharacters(recent);
|
||||
wxString str;
|
||||
if (RestoreValue(wxT("recentChars2"), &str)) {
|
||||
// Native format found.
|
||||
wxArrayString val;
|
||||
for (wxStringTokenizer tok(str, wxT("|")); tok.HasMoreTokens(); ) {
|
||||
wxString chr;
|
||||
for (wxStringTokenizer tok_chr(tok.GetNextToken(), wxT("+")); tok_chr.HasMoreTokens(); )
|
||||
chr += (wchar_t)_tcstoul(tok_chr.GetNextToken().c_str(), NULL, 16);
|
||||
val.Add(chr);
|
||||
}
|
||||
wnd->m_gridRecent->SetCharacters(val);
|
||||
} else if (RestoreValue(wxT("recentChars"), &str)) {
|
||||
// Legacy value found.
|
||||
wxArrayString val;
|
||||
for (size_t i = 0, n = str.Length(); i < n; i++)
|
||||
val.Add(wxString(1, str[i]));
|
||||
wnd->m_gridRecent->SetCharacters(val);
|
||||
}
|
||||
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
|
||||
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i];
|
||||
for (size_t i = 0, n = app->m_cc_db.idxRank.size(); i < n; i++) {
|
||||
const auto &cc = app->m_cc_db.idxRank[i];
|
||||
wxString name(wxT("category"));
|
||||
name.Append(cc.id.data, _countof(cc.id.data));
|
||||
name.Append(cc.cat.data, _countof(cc.cat.data));
|
||||
bool val;
|
||||
if (RestoreValue(name, &val))
|
||||
wnd->m_categories->Check(i, val);
|
||||
|
||||
@@ -28,15 +28,106 @@ class wxPersistentZRColaCharSelect;
|
||||
|
||||
#include "zrcolagui.h"
|
||||
#include <zrcola/character.h>
|
||||
#include <wxex/valhex.h>
|
||||
#include <wx/validate.h>
|
||||
#include <wxex/persist/dialog.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/thread.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
///
|
||||
/// Validator for Unicode character
|
||||
///
|
||||
class WXEXTEND_API wxZRColaUTF16CharValidator : public wxValidator
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Construct the validator with a value to store data
|
||||
///
|
||||
wxZRColaUTF16CharValidator(wchar_t *val = NULL);
|
||||
|
||||
///
|
||||
/// Copies this validator
|
||||
///
|
||||
virtual wxObject* Clone() const;
|
||||
|
||||
///
|
||||
/// Validates the value
|
||||
///
|
||||
virtual bool Validate(wxWindow *parent);
|
||||
|
||||
///
|
||||
/// Transfers the value to the window
|
||||
///
|
||||
virtual bool TransferToWindow();
|
||||
|
||||
///
|
||||
/// Transfers the value from the window
|
||||
///
|
||||
virtual bool TransferFromWindow();
|
||||
|
||||
///
|
||||
/// Parses FQDN value
|
||||
///
|
||||
static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, wchar_t *val_out = NULL);
|
||||
|
||||
protected:
|
||||
wchar_t *m_val; ///< Pointer to variable to receive control's parsed value
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxZRColaUTF16CharValidator);
|
||||
wxDECLARE_NO_ASSIGN_CLASS(wxZRColaUTF16CharValidator);
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Validator for Unicode dump
|
||||
///
|
||||
class wxZRColaUnicodeDumpValidator : public wxValidator
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Construct the validator with a value to store data
|
||||
///
|
||||
wxZRColaUnicodeDumpValidator(wxString *val = NULL);
|
||||
|
||||
///
|
||||
/// Copies this validator
|
||||
///
|
||||
virtual wxObject* Clone() const;
|
||||
|
||||
///
|
||||
/// Validates the value
|
||||
///
|
||||
virtual bool Validate(wxWindow *parent);
|
||||
|
||||
///
|
||||
/// Transfers the value to the window
|
||||
///
|
||||
virtual bool TransferToWindow();
|
||||
|
||||
///
|
||||
/// Transfers the value from the window
|
||||
///
|
||||
virtual bool TransferFromWindow();
|
||||
|
||||
///
|
||||
/// Parses Unicode dump value
|
||||
///
|
||||
static bool Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, wxString *val_out = NULL);
|
||||
|
||||
protected:
|
||||
wxString *m_val; ///< Pointer to variable to receive control's parsed value
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxZRColaUnicodeDumpValidator);
|
||||
wxDECLARE_NO_ASSIGN_CLASS(wxZRColaUnicodeDumpValidator);
|
||||
};
|
||||
|
||||
|
||||
wxDECLARE_EVENT(wxEVT_SEARCH_COMPLETE, wxThreadEvent);
|
||||
|
||||
|
||||
@@ -76,12 +167,13 @@ protected:
|
||||
|
||||
void ResetResults();
|
||||
void NavigateBy(int offset);
|
||||
void NavigateTo(wchar_t c);
|
||||
void NavigateTo(const wxString &c);
|
||||
|
||||
public:
|
||||
wchar_t m_char; ///< Currently selected character (0 when none)
|
||||
wxString m_char; ///< Currently selected character (empty when none)
|
||||
|
||||
protected:
|
||||
LCID m_locale; ///< Locale for tag lookup
|
||||
bool m_searchChanged; ///< Did Search field or category selection change?
|
||||
std::map<ZRCola::chrcatid_t, int> m_ccOrder; ///< Character category order
|
||||
bool m_unicodeChanged; ///< Did Unicode field change?
|
||||
@@ -103,7 +195,7 @@ protected:
|
||||
public:
|
||||
std::wstring m_search; ///< Search phrase
|
||||
std::set<ZRCola::chrcatid_t> m_cats; ///< Search categories
|
||||
std::vector<std::pair<ZRCola::charrank_t, wchar_t> > m_hits; ///< Search results
|
||||
std::vector<std::pair<ZRCola::charrank_t, std::wstring> > m_hits; ///< Search results
|
||||
|
||||
protected:
|
||||
wxZRColaCharSelect *m_parent; ///< Thread owner
|
||||
@@ -115,7 +207,7 @@ protected:
|
||||
///
|
||||
struct NavigationState
|
||||
{
|
||||
wchar_t m_char;
|
||||
std::wstring m_char;
|
||||
struct {
|
||||
wxGridCellCoords m_selected;
|
||||
} m_related;
|
||||
|
||||
@@ -25,42 +25,42 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
|
||||
m_decomposedChanged(false),
|
||||
m_composedChanged(false),
|
||||
m_selDecomposed(0, 0),
|
||||
m_selComposed(0, 0),
|
||||
m_sourceChanged(false),
|
||||
m_destinationChanged(false),
|
||||
m_selSource(0, 0),
|
||||
m_selDestination(0, 0),
|
||||
wxZRColaComposerPanelBase(parent)
|
||||
{
|
||||
m_decomposed->PushEventHandler(&m_keyhandler);
|
||||
m_source->PushEventHandler(&m_keyhandler);
|
||||
|
||||
// Restore the previously saved state (if exists).
|
||||
wxString fileName(GetStateFileName());
|
||||
if (wxFileExists(fileName)) {
|
||||
wxFFile file(fileName, wxT("rb"));
|
||||
if (file.IsOpened()) {
|
||||
// Load decomposed text.
|
||||
// Load source text.
|
||||
unsigned __int64 n;
|
||||
file.Read(&n, sizeof(n));
|
||||
if (!file.Error()) {
|
||||
wxString decomposed;
|
||||
file.Read(wxStringBuffer(decomposed, n), sizeof(wchar_t)*n);
|
||||
wxString source;
|
||||
file.Read(wxStringBuffer(source, n), sizeof(wchar_t)*n);
|
||||
if (!file.Error()) {
|
||||
// Load composed text.
|
||||
// Load destination text.
|
||||
file.Read(&n, sizeof(n));
|
||||
if (!file.Error()) {
|
||||
wxString composed;
|
||||
file.Read(wxStringBuffer(composed, n), sizeof(wchar_t)*n);
|
||||
wxString destination;
|
||||
file.Read(wxStringBuffer(destination, n), sizeof(wchar_t)*n);
|
||||
if (!file.Error()) {
|
||||
// Restore state.
|
||||
m_decomposed->SetValue(decomposed);
|
||||
m_decomposed->GetSelection(&m_selDecomposed.first, &m_selDecomposed.second);
|
||||
SetHexValue(m_decomposedHex, m_selDecomposedHex, m_mappingDecomposedHex, decomposed.GetData(), decomposed.Length(), m_selDecomposed.first, m_selDecomposed.second);
|
||||
m_decomposedChanged = false;
|
||||
m_source->SetValue(source);
|
||||
m_source->GetSelection(&m_selSource.first, &m_selSource.second);
|
||||
SetHexValue(m_sourceHex, m_selSourceHex, m_mappingSourceHex, source.GetData(), source.Length(), m_selSource.first, m_selSource.second);
|
||||
m_sourceChanged = false;
|
||||
|
||||
m_composed->SetValue(composed);
|
||||
m_composed->GetSelection(&m_selComposed.first, &m_selComposed.second);
|
||||
SetHexValue(m_composedHex, m_selComposedHex, m_mappingComposedHex, composed.GetData(), composed.Length(), m_selComposed.first, m_selComposed.second);
|
||||
m_composedChanged = false;
|
||||
m_destination->SetValue(destination);
|
||||
m_destination->GetSelection(&m_selDestination.first, &m_selDestination.second);
|
||||
SetHexValue(m_destinationHex, m_selDestinationHex, m_mappingDestinationHex, destination.GetData(), destination.Length(), m_selDestination.first, m_selDestination.second);
|
||||
m_destinationChanged = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
|
||||
|
||||
wxZRColaComposerPanel::~wxZRColaComposerPanel()
|
||||
{
|
||||
m_decomposed->PopEventHandler();
|
||||
m_source->PopEventHandler();
|
||||
|
||||
// This is a controlled exit. Purge saved state.
|
||||
wxString fileName(GetStateFileName());
|
||||
@@ -83,194 +83,221 @@ wxZRColaComposerPanel::~wxZRColaComposerPanel()
|
||||
|
||||
void wxZRColaComposerPanel::SynchronizePanels()
|
||||
{
|
||||
if (m_decomposedChanged) {
|
||||
if (m_sourceChanged) {
|
||||
m_timerSave.Stop();
|
||||
|
||||
wxString src;
|
||||
size_t len = GetValue(m_decomposed, src);
|
||||
|
||||
std::wstring norm;
|
||||
((ZRColaApp*)wxTheApp)->m_t_db.Decompose(src.data(), len, norm, &m_mapping1);
|
||||
|
||||
std::wstring dst;
|
||||
((ZRColaApp*)wxTheApp)->m_t_db.Compose(norm.data(), norm.size(), dst, &m_mapping2);
|
||||
|
||||
m_decomposed->GetSelection(&m_selDecomposed.first, &m_selDecomposed.second);
|
||||
|
||||
// Update decomposed HEX dump.
|
||||
SetHexValue(m_decomposedHex, m_selDecomposedHex, m_mappingDecomposedHex, src.data(), len, m_selDecomposed.first, m_selDecomposed.second);
|
||||
|
||||
// Update composed text, and its HEX dump.
|
||||
m_composed->SetValue(dst);
|
||||
m_composed->SetSelection(
|
||||
m_selComposed.first = m_mapping2.to_dst(m_mapping1.to_dst(m_selDecomposed.first )),
|
||||
m_selComposed.second = m_mapping2.to_dst(m_mapping1.to_dst(m_selDecomposed.second)));
|
||||
SetHexValue(m_composedHex, m_selComposedHex, m_mappingComposedHex, dst.data(), dst.length(), m_selComposed.first, m_selComposed.second);
|
||||
|
||||
// Schedule state save after 3s.
|
||||
m_timerSave.Start(3000, true);
|
||||
} else if (m_composedChanged) {
|
||||
m_timerSave.Stop();
|
||||
|
||||
wxString src;
|
||||
size_t len = GetValue(m_composed, src);
|
||||
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
std::wstring dst;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
wxZRColaFrame *mainWnd = dynamic_cast<wxZRColaFrame*>(wxGetActiveWindow());
|
||||
if (mainWnd)
|
||||
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);
|
||||
wxASSERT_MSG(mainWnd, "main window missing");
|
||||
|
||||
m_mapping1.clear();
|
||||
m_mapping2.invert();
|
||||
wxString src;
|
||||
size_t len = GetValue(m_source, src);
|
||||
std::wstring dst(src.data(), len), dst2;
|
||||
ZRCola::mapping_vector map;
|
||||
|
||||
m_composed->GetSelection(&m_selComposed.first, &m_selComposed.second);
|
||||
m_mapping.clear();
|
||||
for (auto s = mainWnd->m_settings->m_transeq.cbegin(), s_end = mainWnd->m_settings->m_transeq.cend(); s != s_end; ++s) {
|
||||
if (*s == 0) {
|
||||
// ZRCola Decomposed => ZRCola Composed should decompose first.
|
||||
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), dst2, &map);
|
||||
m_mapping.push_back(std::move(map));
|
||||
|
||||
// Update composed HEX dump.
|
||||
SetHexValue(m_composedHex, m_selComposedHex, m_mappingComposedHex, src.data(), len, m_selComposed.first, m_selComposed.second);
|
||||
app->m_t_db.Translate(*s, dst2.data(), dst2.size(), dst, &map);
|
||||
m_mapping.push_back(std::move(map));
|
||||
} else {
|
||||
// Other transforms
|
||||
app->m_t_db.Translate(*s, dst.data(), dst.size(), dst2, &map);
|
||||
m_mapping.push_back(std::move(map));
|
||||
dst = std::move(dst2);
|
||||
}
|
||||
}
|
||||
|
||||
// Update decomposed text, and its HEX dump.
|
||||
m_decomposed->SetValue(dst);
|
||||
m_decomposed->SetSelection(
|
||||
m_selDecomposed.first = m_mapping1.to_src(m_mapping2.to_src(m_selComposed.first )),
|
||||
m_selDecomposed.second = m_mapping1.to_src(m_mapping2.to_src(m_selComposed.second)));
|
||||
SetHexValue(m_decomposedHex, m_selDecomposedHex, m_mappingDecomposedHex, dst.data(), dst.length(), m_selDecomposed.first, m_selDecomposed.second);
|
||||
m_source->GetSelection(&m_selSource.first, &m_selSource.second);
|
||||
|
||||
// Update source HEX dump.
|
||||
SetHexValue(m_sourceHex, m_selSourceHex, m_mappingSourceHex, src.data(), len, m_selSource.first, m_selSource.second);
|
||||
|
||||
// Update destination text, and its HEX dump.
|
||||
m_destination->SetValue(dst);
|
||||
m_destination->SetSelection(
|
||||
m_selDestination.first = MapToDestination(m_selSource.first ),
|
||||
m_selDestination.second = MapToDestination(m_selSource.second));
|
||||
SetHexValue(m_destinationHex, m_selDestinationHex, m_mappingDestinationHex, dst.data(), dst.length(), m_selDestination.first, m_selDestination.second);
|
||||
|
||||
// Schedule state save after 3s.
|
||||
m_timerSave.Start(3000, true);
|
||||
} else if (m_destinationChanged) {
|
||||
m_timerSave.Stop();
|
||||
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
wxZRColaFrame *mainWnd = dynamic_cast<wxZRColaFrame*>(wxGetActiveWindow());
|
||||
wxASSERT_MSG(mainWnd, "main window missing");
|
||||
|
||||
wxString src;
|
||||
size_t len = GetValue(m_destination, src);
|
||||
std::wstring dst(src.data(), len), dst2;
|
||||
ZRCola::mapping_vector map;
|
||||
|
||||
m_mapping.clear();
|
||||
for (auto s = mainWnd->m_settings->m_transeq.crbegin(), s_end = mainWnd->m_settings->m_transeq.crend(); s != s_end; ++s) {
|
||||
if (*s) {
|
||||
// ZRCola Decomposed => ZRCola Composed
|
||||
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), &app->m_lc_db, mainWnd->m_settings->m_lang, dst2, &map);
|
||||
} else {
|
||||
// Other transforms
|
||||
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), dst2, &map);
|
||||
}
|
||||
dst = std::move(dst2);
|
||||
|
||||
map.invert();
|
||||
m_mapping.push_back(std::move(map));
|
||||
}
|
||||
|
||||
m_destination->GetSelection(&m_selDestination.first, &m_selDestination.second);
|
||||
|
||||
// Update destination HEX dump.
|
||||
SetHexValue(m_destinationHex, m_selDestinationHex, m_mappingDestinationHex, src.data(), len, m_selDestination.first, m_selDestination.second);
|
||||
|
||||
// Update source text, and its HEX dump.
|
||||
m_source->SetValue(dst);
|
||||
m_source->SetSelection(
|
||||
m_selSource.first = MapToSource(m_selDestination.first ),
|
||||
m_selSource.second = MapToSource(m_selDestination.second));
|
||||
SetHexValue(m_sourceHex, m_selSourceHex, m_mappingSourceHex, dst.data(), dst.length(), m_selSource.first, m_selSource.second);
|
||||
|
||||
// Schedule state save after 3s.
|
||||
m_timerSave.Start(3000, true);
|
||||
}
|
||||
|
||||
m_decomposedChanged = false;
|
||||
m_composedChanged = false;
|
||||
m_sourceChanged = false;
|
||||
m_destinationChanged = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::OnDecomposedPaint(wxPaintEvent& event)
|
||||
void wxZRColaComposerPanel::OnSourcePaint(wxPaintEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
long from, to;
|
||||
m_decomposed->GetSelection(&from, &to);
|
||||
m_source->GetSelection(&from, &to);
|
||||
|
||||
if (m_selDecomposed.first != from || m_selDecomposed.second != to) {
|
||||
if (m_selSource.first != from || m_selSource.second != to) {
|
||||
// Save new selection first, to avoid loop.
|
||||
m_selDecomposed.first = from;
|
||||
m_selDecomposed.second = to;
|
||||
m_selSource.first = from;
|
||||
m_selSource.second = to;
|
||||
|
||||
m_decomposedHex->SetSelection(
|
||||
m_selDecomposedHex.first = m_mappingDecomposedHex.to_dst(from),
|
||||
m_selDecomposedHex.second = m_mappingDecomposedHex.to_dst(to ));
|
||||
m_sourceHex->SetSelection(
|
||||
m_selSourceHex.first = m_mappingSourceHex.to_dst(from),
|
||||
m_selSourceHex.second = m_mappingSourceHex.to_dst(to ));
|
||||
|
||||
m_composed->SetSelection(
|
||||
m_selComposed.first = m_mapping2.to_dst(m_mapping1.to_dst(from)),
|
||||
m_selComposed.second = m_mapping2.to_dst(m_mapping1.to_dst(to )));
|
||||
m_destination->SetSelection(
|
||||
m_selDestination.first = MapToDestination(from),
|
||||
m_selDestination.second = MapToDestination(to ));
|
||||
|
||||
m_composedHex->SetSelection(
|
||||
m_selComposedHex.first = m_mappingComposedHex.to_dst(m_selComposed.first ),
|
||||
m_selComposedHex.second = m_mappingComposedHex.to_dst(m_selComposed.second));
|
||||
m_destinationHex->SetSelection(
|
||||
m_selDestinationHex.first = m_mappingDestinationHex.to_dst(m_selDestination.first ),
|
||||
m_selDestinationHex.second = m_mappingDestinationHex.to_dst(m_selDestination.second));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::OnDecomposedHexPaint(wxPaintEvent& event)
|
||||
void wxZRColaComposerPanel::OnSourceHexPaint(wxPaintEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
long from, to;
|
||||
m_decomposedHex->GetSelection(&from, &to);
|
||||
m_sourceHex->GetSelection(&from, &to);
|
||||
|
||||
if (m_selDecomposedHex.first != from || m_selDecomposedHex.second != to) {
|
||||
if (m_selSourceHex.first != from || m_selSourceHex.second != to) {
|
||||
// Save new selection first, to avoid loop.
|
||||
m_selDecomposedHex.first = from;
|
||||
m_selDecomposedHex.second = to;
|
||||
m_selSourceHex.first = from;
|
||||
m_selSourceHex.second = to;
|
||||
|
||||
m_decomposed->SetSelection(
|
||||
m_selDecomposed.first = m_mappingDecomposedHex.to_src(from),
|
||||
m_selDecomposed.second = m_mappingDecomposedHex.to_src(to ));
|
||||
m_source->SetSelection(
|
||||
m_selSource.first = m_mappingSourceHex.to_src(from),
|
||||
m_selSource.second = m_mappingSourceHex.to_src(to ));
|
||||
|
||||
m_composed->SetSelection(
|
||||
m_selComposed.first = m_mapping2.to_dst(m_mapping1.to_dst(m_selDecomposed.first )),
|
||||
m_selComposed.second = m_mapping2.to_dst(m_mapping1.to_dst(m_selDecomposed.second)));
|
||||
m_destination->SetSelection(
|
||||
m_selDestination.first = MapToDestination(m_selSource.first ),
|
||||
m_selDestination.second = MapToDestination(m_selSource.second));
|
||||
|
||||
m_composedHex->SetSelection(
|
||||
m_selComposedHex.first = m_mappingComposedHex.to_dst(m_selComposed.first ),
|
||||
m_selComposedHex.second = m_mappingComposedHex.to_dst(m_selComposed.second));
|
||||
m_destinationHex->SetSelection(
|
||||
m_selDestinationHex.first = m_mappingDestinationHex.to_dst(m_selDestination.first ),
|
||||
m_selDestinationHex.second = m_mappingDestinationHex.to_dst(m_selDestination.second));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::OnDecomposedText(wxCommandEvent& event)
|
||||
void wxZRColaComposerPanel::OnSourceText(wxCommandEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
// Set the flag the decomposed text changed to trigger idle-time composition.
|
||||
m_decomposedChanged = true;
|
||||
// Set the flag the source text changed to trigger idle-time transformation.
|
||||
m_sourceChanged = true;
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::OnComposedPaint(wxPaintEvent& event)
|
||||
void wxZRColaComposerPanel::OnDestinationPaint(wxPaintEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
long from, to;
|
||||
m_composed->GetSelection(&from, &to);
|
||||
m_destination->GetSelection(&from, &to);
|
||||
|
||||
if (m_selComposed.first != from || m_selComposed.second != to) {
|
||||
if (m_selDestination.first != from || m_selDestination.second != to) {
|
||||
// Save new selection first, to avoid loop.
|
||||
m_selComposed.first = from;
|
||||
m_selComposed.second = to;
|
||||
m_selDestination.first = from;
|
||||
m_selDestination.second = to;
|
||||
|
||||
m_composedHex->SetSelection(
|
||||
m_selComposedHex.first = m_mappingComposedHex.to_dst(from),
|
||||
m_selComposedHex.second = m_mappingComposedHex.to_dst(to ));
|
||||
m_destinationHex->SetSelection(
|
||||
m_selDestinationHex.first = m_mappingDestinationHex.to_dst(from),
|
||||
m_selDestinationHex.second = m_mappingDestinationHex.to_dst(to ));
|
||||
|
||||
m_decomposed->SetSelection(
|
||||
m_selDecomposed.first = m_mapping1.to_src(m_mapping2.to_src(from)),
|
||||
m_selDecomposed.second = m_mapping1.to_src(m_mapping2.to_src(to )));
|
||||
m_source->SetSelection(
|
||||
m_selSource.first = MapToSource(from),
|
||||
m_selSource.second = MapToSource(to ));
|
||||
|
||||
m_decomposedHex->SetSelection(
|
||||
m_selDecomposedHex.first = m_mappingDecomposedHex.to_dst(m_selDecomposed.first ),
|
||||
m_selDecomposedHex.second = m_mappingDecomposedHex.to_dst(m_selDecomposed.second));
|
||||
m_sourceHex->SetSelection(
|
||||
m_selSourceHex.first = m_mappingSourceHex.to_dst(m_selSource.first ),
|
||||
m_selSourceHex.second = m_mappingSourceHex.to_dst(m_selSource.second));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::OnComposedHexPaint(wxPaintEvent& event)
|
||||
void wxZRColaComposerPanel::OnDestinationHexPaint(wxPaintEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
long from, to;
|
||||
m_composedHex->GetSelection(&from, &to);
|
||||
m_destinationHex->GetSelection(&from, &to);
|
||||
|
||||
if (m_selComposedHex.first != from || m_selComposedHex.second != to) {
|
||||
if (m_selDestinationHex.first != from || m_selDestinationHex.second != to) {
|
||||
// Save new selection first, to avoid loop.
|
||||
m_selComposedHex.first = from;
|
||||
m_selComposedHex.second = to;
|
||||
m_selDestinationHex.first = from;
|
||||
m_selDestinationHex.second = to;
|
||||
|
||||
m_composed->SetSelection(
|
||||
m_selComposed.first = m_mappingComposedHex.to_src(from),
|
||||
m_selComposed.second = m_mappingComposedHex.to_src(to ));
|
||||
m_destination->SetSelection(
|
||||
m_selDestination.first = m_mappingDestinationHex.to_src(from),
|
||||
m_selDestination.second = m_mappingDestinationHex.to_src(to ));
|
||||
|
||||
m_decomposed->SetSelection(
|
||||
m_selDecomposed.first = m_mapping1.to_src(m_mapping2.to_src(m_selComposed.first )),
|
||||
m_selDecomposed.second = m_mapping1.to_src(m_mapping2.to_src(m_selComposed.second)));
|
||||
m_source->SetSelection(
|
||||
m_selSource.first = MapToSource(m_selDestination.first ),
|
||||
m_selSource.second = MapToSource(m_selDestination.second));
|
||||
|
||||
m_decomposedHex->SetSelection(
|
||||
m_selDecomposedHex.first = m_mappingDecomposedHex.to_dst(m_selDecomposed.first ),
|
||||
m_selDecomposedHex.second = m_mappingDecomposedHex.to_dst(m_selDecomposed.second));
|
||||
m_sourceHex->SetSelection(
|
||||
m_selSourceHex.first = m_mappingSourceHex.to_dst(m_selSource.first ),
|
||||
m_selSourceHex.second = m_mappingSourceHex.to_dst(m_selSource.second));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::OnComposedText(wxCommandEvent& event)
|
||||
void wxZRColaComposerPanel::OnDestinationText(wxCommandEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
// Set the flag the composed text changed to trigger idle-time decomposition.
|
||||
m_composedChanged = true;
|
||||
// Set the flag the destination text changed to trigger idle-time inverse transformation.
|
||||
m_destinationChanged = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -282,13 +309,13 @@ void wxZRColaComposerPanel::OnSaveTimer(wxTimerEvent& event)
|
||||
wxString text;
|
||||
size_t len;
|
||||
|
||||
// Save decomposed text.
|
||||
len = GetValue(m_decomposed, text);
|
||||
// Save source text.
|
||||
len = GetValue(m_source, text);
|
||||
file.Write(&len, sizeof(len));
|
||||
file.Write((const wchar_t*)text, sizeof(wchar_t)*len);
|
||||
|
||||
// Save composed text.
|
||||
len = GetValue(m_composed, text);
|
||||
// Save destination text.
|
||||
len = GetValue(m_destination, text);
|
||||
file.Write(&len, sizeof(len));
|
||||
file.Write((const wchar_t*)text, sizeof(wchar_t)*len);
|
||||
}
|
||||
@@ -382,29 +409,29 @@ wxString wxPersistentZRColaComposerPanel::GetKind() const
|
||||
|
||||
void wxPersistentZRColaComposerPanel::Save() const
|
||||
{
|
||||
const wxZRColaComposerPanel * const wnd = static_cast<const wxZRColaComposerPanel*>(GetWindow());
|
||||
auto const wnd = static_cast<const wxZRColaComposerPanel*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||
|
||||
SaveValue(wxT("splitDecomposed"), wnd->m_splitterDecomposed->GetSashPosition());
|
||||
SaveValue(wxT("splitComposed" ), wnd->m_splitterComposed ->GetSashPosition());
|
||||
SaveValue(wxT("splitDecomposed"), wnd->m_splitterSource->GetSashPosition());
|
||||
SaveValue(wxT("splitComposed" ), wnd->m_splitterDestination ->GetSashPosition());
|
||||
}
|
||||
|
||||
|
||||
bool wxPersistentZRColaComposerPanel::Restore()
|
||||
{
|
||||
wxZRColaComposerPanel * const wnd = static_cast<wxZRColaComposerPanel*>(GetWindow());
|
||||
auto wnd = dynamic_cast<wxZRColaComposerPanel*>(GetWindow());
|
||||
|
||||
int sashVal;
|
||||
|
||||
if (RestoreValue(wxT("splitDecomposed"), &sashVal)) {
|
||||
// wxFormBuilder sets initial splitter stash in idle event handler after GUI settles. Overriding our loaded value. Disconnect it's idle event handler.
|
||||
wnd->m_splitterDecomposed->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterDecomposedOnIdle ), NULL, wnd );
|
||||
wnd->m_splitterDecomposed->SetSashPosition(sashVal);
|
||||
wnd->m_splitterSource->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterSourceOnIdle ), NULL, wnd );
|
||||
wnd->m_splitterSource->SetSashPosition(sashVal);
|
||||
}
|
||||
|
||||
if (RestoreValue(wxT("splitComposed"), &sashVal)) {
|
||||
// wxFormBuilder sets initial splitter stash in idle event handler after GUI settles. Overriding our loaded value. Disconnect it's idle event handler.
|
||||
wnd->m_splitterComposed->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterComposedOnIdle ), NULL, wnd );
|
||||
wnd->m_splitterComposed->SetSashPosition(sashVal);
|
||||
wnd->m_splitterDestination->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterDestinationOnIdle ), NULL, wnd );
|
||||
wnd->m_splitterDestination->SetSashPosition(sashVal);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -30,6 +30,7 @@ class wxZRColaComposerPanel;
|
||||
#include <wx/persist/window.h>
|
||||
#include <wx/timer.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
///
|
||||
@@ -46,31 +47,32 @@ public:
|
||||
friend class wxPersistentZRColaComposerPanel; // Allow saving/restoring window state.
|
||||
|
||||
protected:
|
||||
virtual void OnDecomposedPaint(wxPaintEvent& event);
|
||||
virtual void OnDecomposedHexPaint(wxPaintEvent& event);
|
||||
virtual void OnDecomposedText(wxCommandEvent& event);
|
||||
virtual void OnComposedPaint(wxPaintEvent& event);
|
||||
virtual void OnComposedHexPaint(wxPaintEvent& event);
|
||||
virtual void OnComposedText(wxCommandEvent& event);
|
||||
virtual void OnSourcePaint(wxPaintEvent& event);
|
||||
virtual void OnSourceHexPaint(wxPaintEvent& event);
|
||||
virtual void OnSourceText(wxCommandEvent& event);
|
||||
virtual void OnDestinationPaint(wxPaintEvent& event);
|
||||
virtual void OnDestinationHexPaint(wxPaintEvent& event);
|
||||
virtual void OnDestinationText(wxCommandEvent& event);
|
||||
virtual void OnSaveTimer(wxTimerEvent& event);
|
||||
inline size_t MapToDestination(_In_ size_t src) const;
|
||||
inline size_t MapToSource(_In_ size_t dst) const;
|
||||
|
||||
static wxString GetStateFileName();
|
||||
static size_t GetValue(wxTextCtrl *wnd, wxString &text);
|
||||
static void SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &range, ZRCola::mapping_vector &mapping, const wchar_t *src, size_t len, long from, long to);
|
||||
|
||||
protected:
|
||||
bool m_decomposedChanged; ///< Boolean flag to mark decomposed text "dirty" to trigger composition
|
||||
bool m_composedChanged; ///< Boolean flag to mark composed text "dirty" to trigger decomposition
|
||||
ZRCola::mapping_vector m_mapping1; ///< Character index mapping vector between decomposed and normalized text
|
||||
ZRCola::mapping_vector m_mapping2; ///< Character index mapping vector between normalized and composed text
|
||||
bool m_sourceChanged; ///< Boolean flag to mark source text "dirty" to trigger transformation
|
||||
bool m_destinationChanged; ///< Boolean flag to mark destination text "dirty" to trigger inverse transformation
|
||||
std::vector<ZRCola::mapping_vector> m_mapping; ///< Character index mapping vector between source and normalized text
|
||||
std::pair<long, long>
|
||||
m_selDecomposed, ///< Character index of selected text in decomposed text control
|
||||
m_selDecomposedHex, ///< Character index of selected text in decomposed HEX dump text control
|
||||
m_selComposed, ///< Character index of selected text in composed text control
|
||||
m_selComposedHex; ///< Character index of selected text in composed HEX dump text control
|
||||
wxZRColaKeyHandler m_keyhandler; ///< Key handler for decomposed window
|
||||
ZRCola::mapping_vector m_mappingDecomposedHex; ///< Character index mapping vector between decomposed text and its HEX dump
|
||||
ZRCola::mapping_vector m_mappingComposedHex; ///< Character index mapping vector between composed text and its HEX dump
|
||||
m_selSource, ///< Character index of selected text in source text control
|
||||
m_selSourceHex, ///< Character index of selected text in source HEX dump text control
|
||||
m_selDestination, ///< Character index of selected text in destination text control
|
||||
m_selDestinationHex; ///< Character index of selected text in destination HEX dump text control
|
||||
wxZRColaKeyHandler m_keyhandler; ///< Key handler for source window
|
||||
ZRCola::mapping_vector m_mappingSourceHex; ///< Character index mapping vector between source text and its HEX dump
|
||||
ZRCola::mapping_vector m_mappingDestinationHex; ///< Character index mapping vector between destination text and its HEX dump
|
||||
};
|
||||
|
||||
|
||||
@@ -88,6 +90,24 @@ public:
|
||||
};
|
||||
|
||||
|
||||
inline size_t wxZRColaComposerPanel::MapToDestination(_In_ size_t src) const
|
||||
{
|
||||
for (auto m = m_mapping.cbegin(), m_end = m_mapping.cend(); m != m_end; ++m)
|
||||
src = m->to_dst(src);
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
|
||||
inline size_t wxZRColaComposerPanel::MapToSource(_In_ size_t dst) const
|
||||
{
|
||||
for (auto m = m_mapping.crbegin(), m_end = m_mapping.crend(); m != m_end; ++m)
|
||||
dst = m->to_src(dst);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
inline wxPersistentObject *wxCreatePersistentObject(wxZRColaComposerPanel *wnd)
|
||||
{
|
||||
return new wxPersistentZRColaComposerPanel(wnd);
|
||||
|
||||
@@ -34,17 +34,19 @@ wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
|
||||
|
||||
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_UPDATE_UI_RANGE(wxID_SEND_DESTINATION , wxID_SEND_ABORT, wxZRColaFrame::OnSendUpdate )
|
||||
EVT_MENU (wxID_COPY_DESTINATION_AND_RETURN , wxZRColaFrame::OnCopyDestinationAndReturn )
|
||||
EVT_MENU (wxID_SEND_DESTINATION , wxZRColaFrame::OnSendDestination )
|
||||
EVT_MENU (wxID_COPY_SOURCE_AND_RETURN , wxZRColaFrame::OnCopySourceAndReturn )
|
||||
EVT_MENU (wxID_SEND_SOURCE , wxZRColaFrame::OnSendSource )
|
||||
EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
|
||||
|
||||
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_TOOLBAR_TRANSFORM , wxZRColaFrame::OnToolbarTransformUpdate )
|
||||
EVT_MENU (wxID_TOOLBAR_TRANSFORM , wxZRColaFrame::OnToolbarTransform )
|
||||
EVT_UPDATE_UI (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalogUpdate)
|
||||
EVT_MENU (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalog )
|
||||
EVT_MENU (wxID_FOCUS_CHARACTER_CATALOG , wxZRColaFrame::OnPanelCharacterCatalogFocus )
|
||||
@@ -67,10 +69,10 @@ wxZRColaFrame::wxZRColaFrame() :
|
||||
{
|
||||
{
|
||||
// wxFrameBuilder 3.5 does not support wxAUI_TB_HORIZONTAL flag. Add it manually.
|
||||
wxAuiPaneInfo &paneInfo = m_mgr.GetPane(m_toolbarCompose);
|
||||
wxAuiPaneInfo &paneInfo = m_mgr.GetPane(m_toolbarTransform);
|
||||
paneInfo.LeftDockable(false);
|
||||
paneInfo.RightDockable(false);
|
||||
m_toolbarCompose->SetWindowStyleFlag(m_toolbarCompose->GetWindowStyleFlag() | wxAUI_TB_HORIZONTAL);
|
||||
m_toolbarTransform->SetWindowStyleFlag(m_toolbarTransform->GetWindowStyleFlag() | wxAUI_TB_HORIZONTAL);
|
||||
}
|
||||
|
||||
// Load main window icons.
|
||||
@@ -104,7 +106,7 @@ wxZRColaFrame::wxZRColaFrame() :
|
||||
wxPersistentRegisterAndRestore<wxZRColaCharRequest>(m_chrReq);
|
||||
|
||||
// Set focus.
|
||||
m_panel->m_decomposed->SetFocus();
|
||||
m_panel->m_source->SetFocus();
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
// Register notification sink for language detection.
|
||||
@@ -137,9 +139,9 @@ wxZRColaFrame::wxZRColaFrame() :
|
||||
wxPersistentAuiManager(&m_mgr).Restore();
|
||||
|
||||
// Register global hotkey(s).
|
||||
if (!RegisterHotKey(wxZRColaHKID_INVOKE_COMPOSE, wxMOD_WIN, VK_F5))
|
||||
if (!RegisterHotKey(wxZRColaHKID_INVOKE_TRANSFORM, wxMOD_WIN, VK_F5))
|
||||
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_TRANSFORM_INV, wxMOD_WIN, VK_F6))
|
||||
wxMessageBox(_("ZRCola keyboard shortcut Win+F6 could not be registered. Some functionality will not be available."), _("Warning"), wxOK | wxICON_WARNING);
|
||||
}
|
||||
|
||||
@@ -147,8 +149,8 @@ wxZRColaFrame::wxZRColaFrame() :
|
||||
wxZRColaFrame::~wxZRColaFrame()
|
||||
{
|
||||
// Unregister global hotkey(s).
|
||||
UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
|
||||
UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);
|
||||
UnregisterHotKey(wxZRColaHKID_INVOKE_TRANSFORM_INV);
|
||||
UnregisterHotKey(wxZRColaHKID_INVOKE_TRANSFORM );
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
if (m_tfSource) {
|
||||
@@ -157,15 +159,6 @@ wxZRColaFrame::~wxZRColaFrame()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_chrReq)
|
||||
delete m_chrReq;
|
||||
|
||||
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;
|
||||
@@ -211,9 +204,9 @@ void wxZRColaFrame::OnForwardEvent(wxCommandEvent& event)
|
||||
|
||||
void wxZRColaFrame::OnInsertCharacter(wxCommandEvent& event)
|
||||
{
|
||||
if (m_chrSelect->ShowModal() == wxID_OK && m_chrSelect->m_char) {
|
||||
m_panel->m_decomposed->WriteText(m_chrSelect->m_char);
|
||||
m_panel->m_decomposed->SetFocus();
|
||||
if (m_chrSelect->ShowModal() == wxID_OK && !m_chrSelect->m_char.empty()) {
|
||||
m_panel->m_source->WriteText(m_chrSelect->m_char);
|
||||
m_panel->m_source->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,19 +217,37 @@ void wxZRColaFrame::OnSendUpdate(wxUpdateUIEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnSendComposed(wxCommandEvent& event)
|
||||
void wxZRColaFrame::OnSendDestination(wxCommandEvent& event)
|
||||
{
|
||||
if (m_hWndSource)
|
||||
DoSend(m_panel->m_composed->GetValue());
|
||||
DoSend(m_panel->m_destination->GetValue());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnSendDecomposed(wxCommandEvent& event)
|
||||
void wxZRColaFrame::OnCopyDestinationAndReturn(wxCommandEvent& event)
|
||||
{
|
||||
if (m_hWndSource)
|
||||
DoSend(m_panel->m_decomposed->GetValue());
|
||||
DoCopyAndReturn(m_panel->m_destination->GetValue());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnSendSource(wxCommandEvent& event)
|
||||
{
|
||||
if (m_hWndSource)
|
||||
DoSend(m_panel->m_source->GetValue());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnCopySourceAndReturn(wxCommandEvent& event)
|
||||
{
|
||||
if (m_hWndSource)
|
||||
DoCopyAndReturn(m_panel->m_source->GetValue());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
@@ -252,8 +263,8 @@ void wxZRColaFrame::OnSendAbort(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
// Select all input in composer to prepare for the overwrite next time.
|
||||
m_panel->m_decomposed->SelectAll();
|
||||
m_panel->m_composed->SelectAll();
|
||||
m_panel->m_source ->SelectAll();
|
||||
m_panel->m_destination->SelectAll();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
@@ -306,15 +317,15 @@ void wxZRColaFrame::OnToolbarEdit(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnToolbarComposeUpdate(wxUpdateUIEvent& event)
|
||||
void wxZRColaFrame::OnToolbarTransformUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Check(m_mgr.GetPane(m_toolbarCompose).IsShown());
|
||||
event.Check(m_mgr.GetPane(m_toolbarTransform).IsShown());
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::OnToolbarCompose(wxCommandEvent& event)
|
||||
void wxZRColaFrame::OnToolbarTransform(wxCommandEvent& event)
|
||||
{
|
||||
wxAuiPaneInfo &paneInfo = m_mgr.GetPane(m_toolbarCompose);
|
||||
wxAuiPaneInfo &paneInfo = m_mgr.GetPane(m_toolbarTransform);
|
||||
paneInfo.Show(!paneInfo.IsShown());
|
||||
m_mgr.Update();
|
||||
}
|
||||
@@ -348,7 +359,7 @@ void wxZRColaFrame::OnPanelCharacterCatalogFocus(wxCommandEvent& event)
|
||||
|
||||
void wxZRColaFrame::OnHelpInstructions(wxCommandEvent& event)
|
||||
{
|
||||
wxLaunchDefaultBrowser(_("http://zrcola-2.amebis.si/en/info/instructions/"));
|
||||
wxLaunchDefaultBrowser(_("http://zrcola.zrc-sazu.si/en/info/instructions/"));
|
||||
}
|
||||
|
||||
|
||||
@@ -358,21 +369,21 @@ void wxZRColaFrame::OnHelpShortcuts(wxCommandEvent& event)
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Search and try to launch installed PDF.
|
||||
INSTALLSTATE pdf_is = ::MsiGetComponentPath(_T(ZRCOLA_VERSION_GUID), _T("{68AC2C38-10E2-41A3-B92C-844C03FFDF6A}"), pdf_path);
|
||||
INSTALLSTATE pdf_is = ::MsiGetComponentPath(_T(PRODUCT_VERSION_GUID), _T("{68AC2C38-10E2-41A3-B92C-844C03FFDF6A}"), pdf_path);
|
||||
if ((pdf_is == INSTALLSTATE_LOCAL || pdf_is == INSTALLSTATE_SOURCE) &&
|
||||
wxFileExists(pdf_path) &&
|
||||
(int)::ShellExecute(GetHWND(), NULL, pdf_path.c_str(), NULL, NULL, SW_SHOWNORMAL) > 32) return;
|
||||
#endif
|
||||
|
||||
// Search and try to launch local PDF copy.
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
pdf_path = app->GetDatabasePath();
|
||||
pdf_path += _T("ZRCola_keyboard.pdf");
|
||||
if (wxFileExists(pdf_path) &&
|
||||
(int)::ShellExecute(GetHWND(), NULL, pdf_path.c_str(), NULL, NULL, SW_SHOWNORMAL) > 32) return;
|
||||
|
||||
// When everything else fail, try the online version.
|
||||
wxLaunchDefaultBrowser(_("http://zrcola-2.amebis.si/wp-content/uploads/2016/04/5_ZRCola-Tipkovnica_2009-06-21.pdf"));
|
||||
wxLaunchDefaultBrowser(_("http://zrcola.zrc-sazu.si/wp-content/uploads/2016/06/ZRCola_tipkovnica_Jun2016.pdf"));
|
||||
}
|
||||
|
||||
|
||||
@@ -459,7 +470,7 @@ void wxZRColaFrame::DoSend(const wxString& str)
|
||||
{
|
||||
// Prepare the INPUT table.
|
||||
wxString::size_type n = str.length();
|
||||
wxString::const_iterator i_str = str.begin();
|
||||
auto i_str = str.begin();
|
||||
std::vector<INPUT> input;
|
||||
input.reserve(n*2);
|
||||
for (std::vector<INPUT>::size_type i = 0; i < n; i++, i_str++) {
|
||||
@@ -483,9 +494,27 @@ void wxZRColaFrame::DoSend(const wxString& str)
|
||||
::SendInput(input.size(), input.data(), sizeof(INPUT));
|
||||
m_hWndSource = NULL;
|
||||
|
||||
// Select all input in composer and decomposed to prepare for the overwrite next time.
|
||||
m_panel->m_decomposed->SelectAll();
|
||||
m_panel->m_composed->SelectAll();
|
||||
// Select all input in source and destination to prepare for the overwrite next time.
|
||||
m_panel->m_source ->SelectAll();
|
||||
m_panel->m_destination->SelectAll();
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaFrame::DoCopyAndReturn(const wxString& str)
|
||||
{
|
||||
if (wxTheClipboard->Open()) {
|
||||
wxTheClipboard->SetData(new wxTextDataObject(str));
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
|
||||
// Return focus to the source window.
|
||||
::SetActiveWindow(m_hWndSource);
|
||||
::SetForegroundWindow(m_hWndSource);
|
||||
m_hWndSource = NULL;
|
||||
|
||||
// Select all input in composer and source to prepare for the overwrite next time.
|
||||
m_panel->m_source ->SelectAll();
|
||||
m_panel->m_destination->SelectAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -498,8 +527,8 @@ WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM
|
||||
WXHWND hWndSource = ::GetForegroundWindow();
|
||||
|
||||
switch (wParam) {
|
||||
case wxZRColaHKID_INVOKE_COMPOSE : m_panel->m_decomposed->SetFocus(); break;
|
||||
case wxZRColaHKID_INVOKE_DECOMPOSE: m_panel->m_composed ->SetFocus(); break;
|
||||
case wxZRColaHKID_INVOKE_TRANSFORM : m_panel->m_source ->SetFocus(); break;
|
||||
case wxZRColaHKID_INVOKE_TRANSFORM_INV: m_panel->m_destination->SetFocus(); break;
|
||||
default:
|
||||
wxFAIL_MSG(wxT("not our registered shortcut"));
|
||||
return wxZRColaFrameBase::MSWWindowProc(message, wParam, lParam);
|
||||
@@ -549,23 +578,21 @@ wxPersistentZRColaFrame::wxPersistentZRColaFrame(wxZRColaFrame *wnd) : wxPersist
|
||||
|
||||
void wxPersistentZRColaFrame::Save() const
|
||||
{
|
||||
const wxZRColaFrame * const wnd = static_cast<const wxZRColaFrame*>(GetWindow());
|
||||
wxPersistentTLW::Save();
|
||||
|
||||
auto wnd = static_cast<const wxZRColaFrame*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||
|
||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
|
||||
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Save();
|
||||
|
||||
wxPersistentTLW::Save();
|
||||
}
|
||||
|
||||
|
||||
bool wxPersistentZRColaFrame::Restore()
|
||||
{
|
||||
const bool r = wxPersistentTLW::Restore();
|
||||
|
||||
wxZRColaFrame * const wnd = static_cast<wxZRColaFrame*>(GetWindow());
|
||||
auto wnd = dynamic_cast<wxZRColaFrame*>(GetWindow());
|
||||
|
||||
wxPersistentZRColaCharacterCatalogPanel(wnd->m_panelChrCat).Restore();
|
||||
wxPersistentZRColaComposerPanel(wnd->m_panel).Restore();
|
||||
|
||||
return r;
|
||||
return wxPersistentTLW::Restore();
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ class wxZRColaFrame;
|
||||
///
|
||||
/// Global hotkey message identifiers
|
||||
///
|
||||
#define wxZRColaHKID_INVOKE_COMPOSE 0
|
||||
#define wxZRColaHKID_INVOKE_DECOMPOSE 1
|
||||
#define wxZRColaHKID_INVOKE_TRANSFORM 0
|
||||
#define wxZRColaHKID_INVOKE_TRANSFORM_INV 1
|
||||
|
||||
|
||||
///
|
||||
@@ -72,8 +72,10 @@ protected:
|
||||
void OnForwardEvent(wxCommandEvent& event);
|
||||
void OnInsertCharacter(wxCommandEvent& event);
|
||||
void OnSendUpdate(wxUpdateUIEvent& event);
|
||||
void OnSendComposed(wxCommandEvent& event);
|
||||
void OnSendDecomposed(wxCommandEvent& event);
|
||||
void OnSendDestination(wxCommandEvent& event);
|
||||
void OnCopyDestinationAndReturn(wxCommandEvent& event);
|
||||
void OnSendSource(wxCommandEvent& event);
|
||||
void OnCopySourceAndReturn(wxCommandEvent& event);
|
||||
void OnSendAbort(wxCommandEvent& event);
|
||||
void OnSettings(wxCommandEvent& event);
|
||||
virtual void OnIdle(wxIdleEvent& event);
|
||||
@@ -81,8 +83,8 @@ protected:
|
||||
virtual void OnIconize(wxIconizeEvent& event);
|
||||
void OnToolbarEditUpdate(wxUpdateUIEvent& event);
|
||||
void OnToolbarEdit(wxCommandEvent& event);
|
||||
void OnToolbarComposeUpdate(wxUpdateUIEvent& event);
|
||||
void OnToolbarCompose(wxCommandEvent& event);
|
||||
void OnToolbarTransformUpdate(wxUpdateUIEvent& event);
|
||||
void OnToolbarTransform(wxCommandEvent& event);
|
||||
void OnPanelCharacterCatalogUpdate(wxUpdateUIEvent& event);
|
||||
void OnPanelCharacterCatalog(wxCommandEvent& event);
|
||||
void OnPanelCharacterCatalogFocus(wxCommandEvent& event);
|
||||
@@ -111,6 +113,7 @@ protected:
|
||||
|
||||
private:
|
||||
void DoSend(const wxString& str);
|
||||
void DoCopyAndReturn(const wxString& str);
|
||||
|
||||
protected:
|
||||
#ifdef __WXMSW__
|
||||
|
||||
@@ -85,23 +85,41 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
|
||||
m_menuEdit->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuItemSendComposed;
|
||||
m_menuItemSendComposed = new wxMenuItem( m_menuEdit, wxID_SEND_COMPOSED, wxString( _("&Send Composed") ) + wxT('\t') + wxT("F5"), _("Send composed text to source window"), wxITEM_NORMAL );
|
||||
wxMenuItem* m_menuItemSendDestination;
|
||||
m_menuItemSendDestination = new wxMenuItem( m_menuEdit, wxID_SEND_DESTINATION, 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 ) );
|
||||
m_menuItemSendDestination->SetBitmaps( wxIcon( wxT("send_destination.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
|
||||
m_menuItemSendComposed->SetBitmap( wxIcon( wxT("send_composed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
m_menuItemSendDestination->SetBitmap( wxIcon( wxT("send_destination.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#endif
|
||||
m_menuEdit->Append( m_menuItemSendComposed );
|
||||
m_menuEdit->Append( m_menuItemSendDestination );
|
||||
|
||||
wxMenuItem* m_menuItemSendDecomposed;
|
||||
m_menuItemSendDecomposed = new wxMenuItem( m_menuEdit, wxID_SEND_DECOMPOSED, wxString( _("Send &Decomposed") ) + wxT('\t') + wxT("F6"), _("Send decomposed text to source window"), wxITEM_NORMAL );
|
||||
wxMenuItem* m_menuItemCopyDestinationAndReturn;
|
||||
m_menuItemCopyDestinationAndReturn = new wxMenuItem( m_menuEdit, wxID_COPY_DESTINATION_AND_RETURN, wxString( _("Copy Composed and &Return") ) + wxT('\t') + wxT("Ctrl+F5"), _("Copy composed text to clipboard and return focus to source window"), wxITEM_NORMAL );
|
||||
#ifdef __WXMSW__
|
||||
m_menuItemSendDecomposed->SetBitmaps( wxIcon( wxT("send_decomposed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
m_menuItemCopyDestinationAndReturn->SetBitmaps( wxIcon( wxT("copy_destination_and_return.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
|
||||
m_menuItemSendDecomposed->SetBitmap( wxIcon( wxT("send_decomposed.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
m_menuItemCopyDestinationAndReturn->SetBitmap( wxIcon( wxT("copy_destination_and_return.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#endif
|
||||
m_menuEdit->Append( m_menuItemSendDecomposed );
|
||||
m_menuEdit->Append( m_menuItemCopyDestinationAndReturn );
|
||||
|
||||
wxMenuItem* m_menuItemSendSource;
|
||||
m_menuItemSendSource = new wxMenuItem( m_menuEdit, wxID_SEND_SOURCE, wxString( _("Send &Decomposed") ) + wxT('\t') + wxT("F6"), _("Send decomposed text to source window"), wxITEM_NORMAL );
|
||||
#ifdef __WXMSW__
|
||||
m_menuItemSendSource->SetBitmaps( wxIcon( wxT("send_source.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
|
||||
m_menuItemSendSource->SetBitmap( wxIcon( wxT("send_source.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#endif
|
||||
m_menuEdit->Append( m_menuItemSendSource );
|
||||
|
||||
wxMenuItem* m_menuItemCopySourceAndReturn;
|
||||
m_menuItemCopySourceAndReturn = new wxMenuItem( m_menuEdit, wxID_COPY_SOURCE_AND_RETURN, wxString( _("Copy Decomposed and Re&turn") ) + wxT('\t') + wxT("Ctrl+F6"), _("Copy decomposed text to clipboard and return focus to source window"), wxITEM_NORMAL );
|
||||
#ifdef __WXMSW__
|
||||
m_menuItemCopySourceAndReturn->SetBitmaps( wxIcon( wxT("copy_source_and_return.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
|
||||
m_menuItemCopySourceAndReturn->SetBitmap( wxIcon( wxT("copy_source_and_return.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 ) );
|
||||
#endif
|
||||
m_menuEdit->Append( m_menuItemCopySourceAndReturn );
|
||||
|
||||
wxMenuItem* m_menuItemSendAbort;
|
||||
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 );
|
||||
@@ -126,7 +144,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_menuView->Append( m_menuItemToolbarEdit );
|
||||
|
||||
wxMenuItem* m_menuItemToolbarCompose;
|
||||
m_menuItemToolbarCompose = new wxMenuItem( m_menuView, wxID_TOOLBAR_COMPOSE, wxString( _("&Compose Toolbar") ) , _("Toggle compose toolbar"), wxITEM_CHECK );
|
||||
m_menuItemToolbarCompose = new wxMenuItem( m_menuView, wxID_TOOLBAR_TRANSFORM, wxString( _("&Compose Toolbar") ) , _("Toggle compose toolbar"), wxITEM_CHECK );
|
||||
m_menuView->Append( m_menuItemToolbarCompose );
|
||||
|
||||
m_menuView->AppendSeparator();
|
||||
@@ -159,7 +177,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_menuHelp->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuHelpAbout;
|
||||
m_menuHelpAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( wxEmptyString ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuHelpAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuHelp->Append( m_menuHelpAbout );
|
||||
|
||||
m_menubar->Append( m_menuHelp, _("&Help") );
|
||||
@@ -176,15 +194,15 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_toolbarEdit->Realize();
|
||||
m_mgr.AddPane( m_toolbarEdit, wxAuiPaneInfo().Name( wxT("toolbarEdit") ).Top().Caption( _("Edit") ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
|
||||
|
||||
m_toolbarCompose = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT );
|
||||
m_toolCharSelect = m_toolbarCompose->AddTool( wxID_CHARACTER_SELECTOR, _("Find Character"), wxIcon( wxT("char_select.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Find Character"), _("Display character search to select character to insert into text"), NULL );
|
||||
m_toolbarTransform = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT );
|
||||
m_toolCharSelect = m_toolbarTransform->AddTool( wxID_CHARACTER_SELECTOR, _("Find Character"), wxIcon( wxT("char_select.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Find Character"), _("Display character search to select character to insert into text"), NULL );
|
||||
|
||||
m_toolSendComposed = m_toolbarCompose->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_toolSendDestination = m_toolbarTransform->AddTool( wxID_SEND_DESTINATION, _("Send Composed"), wxIcon( wxT("send_destination.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Send Composed"), _("Send composed text to source window"), NULL );
|
||||
|
||||
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_toolSendSource = m_toolbarTransform->AddTool( wxID_SEND_SOURCE, _("Send Decomposed"), wxIcon( wxT("send_source.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_NORMAL, _("Send Decomposed"), _("Send decomposed text to source window"), NULL );
|
||||
|
||||
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() );
|
||||
m_toolbarTransform->Realize();
|
||||
m_mgr.AddPane( m_toolbarTransform, wxAuiPaneInfo().Name( wxT("toolbarCompose") ).Top().Caption( _("Compose") ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
|
||||
|
||||
m_panelChrCat = new wxZRColaCharacterCatalogPanel( this );
|
||||
|
||||
@@ -221,99 +239,99 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_splitterDecomposed = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_LIVE_UPDATE );
|
||||
m_splitterDecomposed->SetSashGravity( 1 );
|
||||
m_splitterDecomposed->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterDecomposedOnIdle ), NULL, this );
|
||||
m_splitterDecomposed->SetMinimumPaneSize( 5 );
|
||||
m_splitterSource = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_LIVE_UPDATE );
|
||||
m_splitterSource->SetSashGravity( 1 );
|
||||
m_splitterSource->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterSourceOnIdle ), NULL, this );
|
||||
m_splitterSource->SetMinimumPaneSize( 5 );
|
||||
|
||||
m_panelDecomposedEdit = new wxPanel( m_splitterDecomposed, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerDecomposedEdit;
|
||||
bSizerDecomposedEdit = new wxBoxSizer( wxVERTICAL );
|
||||
m_panelSourceEdit = new wxPanel( m_splitterSource, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerSourceEdit;
|
||||
bSizerSourceEdit = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* bSizerDecomposedEdit2;
|
||||
bSizerDecomposedEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDecomposedEdit, wxID_ANY, _("Decomposed Text") ), wxVERTICAL );
|
||||
wxStaticBoxSizer* bSizerSourceEdit2;
|
||||
bSizerSourceEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelSourceEdit, wxID_ANY, _("Decomposed Text") ), wxVERTICAL );
|
||||
|
||||
m_decomposed = new wxTextCtrl( bSizerDecomposedEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_decomposed->SetFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_decomposed->SetMinSize( wxSize( 100,25 ) );
|
||||
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_source->SetFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_source->SetMinSize( wxSize( 100,25 ) );
|
||||
|
||||
bSizerDecomposedEdit2->Add( m_decomposed, 1, wxEXPAND, 5 );
|
||||
bSizerSourceEdit2->Add( m_source, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerDecomposedEdit->Add( bSizerDecomposedEdit2, 1, wxEXPAND, 5 );
|
||||
bSizerSourceEdit->Add( bSizerSourceEdit2, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelDecomposedEdit->SetSizer( bSizerDecomposedEdit );
|
||||
m_panelDecomposedEdit->Layout();
|
||||
bSizerDecomposedEdit->Fit( m_panelDecomposedEdit );
|
||||
m_panelDecomposedHex = new wxPanel( m_splitterDecomposed, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerDecomposedHex;
|
||||
bSizerDecomposedHex = new wxBoxSizer( wxVERTICAL );
|
||||
m_panelSourceEdit->SetSizer( bSizerSourceEdit );
|
||||
m_panelSourceEdit->Layout();
|
||||
bSizerSourceEdit->Fit( m_panelSourceEdit );
|
||||
m_panelSourceHex = new wxPanel( m_splitterSource, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerSourceHex;
|
||||
bSizerSourceHex = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* bSizerDecomposedHex2;
|
||||
bSizerDecomposedHex2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDecomposedHex, wxID_ANY, _("Decomposed Unicode Dump") ), wxVERTICAL );
|
||||
wxStaticBoxSizer* bSizerSourceHex2;
|
||||
bSizerSourceHex2 = new wxStaticBoxSizer( new wxStaticBox( m_panelSourceHex, wxID_ANY, _("Decomposed Unicode Dump") ), wxVERTICAL );
|
||||
|
||||
m_decomposedHex = new wxTextCtrl( bSizerDecomposedHex2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_decomposedHex->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 76, 90, 90, false, wxEmptyString ) );
|
||||
m_sourceHex = new wxTextCtrl( bSizerSourceHex2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_sourceHex->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 76, 90, 90, false, wxEmptyString ) );
|
||||
|
||||
bSizerDecomposedHex2->Add( m_decomposedHex, 1, wxEXPAND, 5 );
|
||||
bSizerSourceHex2->Add( m_sourceHex, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerDecomposedHex->Add( bSizerDecomposedHex2, 1, wxEXPAND, 5 );
|
||||
bSizerSourceHex->Add( bSizerSourceHex2, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelDecomposedHex->SetSizer( bSizerDecomposedHex );
|
||||
m_panelDecomposedHex->Layout();
|
||||
bSizerDecomposedHex->Fit( m_panelDecomposedHex );
|
||||
m_splitterDecomposed->SplitVertically( m_panelDecomposedEdit, m_panelDecomposedHex, -5 );
|
||||
bSizerMain->Add( m_splitterDecomposed, 50, wxALL|wxEXPAND, 5 );
|
||||
m_panelSourceHex->SetSizer( bSizerSourceHex );
|
||||
m_panelSourceHex->Layout();
|
||||
bSizerSourceHex->Fit( m_panelSourceHex );
|
||||
m_splitterSource->SplitVertically( m_panelSourceEdit, m_panelSourceHex, -5 );
|
||||
bSizerMain->Add( m_splitterSource, 50, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_splitterComposed = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_LIVE_UPDATE );
|
||||
m_splitterComposed->SetSashGravity( 1 );
|
||||
m_splitterComposed->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterComposedOnIdle ), NULL, this );
|
||||
m_splitterComposed->SetMinimumPaneSize( 5 );
|
||||
m_splitterDestination = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_LIVE_UPDATE );
|
||||
m_splitterDestination->SetSashGravity( 1 );
|
||||
m_splitterDestination->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterDestinationOnIdle ), NULL, this );
|
||||
m_splitterDestination->SetMinimumPaneSize( 5 );
|
||||
|
||||
m_panelComposedEdit = new wxPanel( m_splitterComposed, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerComposedEdit;
|
||||
bSizerComposedEdit = new wxBoxSizer( wxVERTICAL );
|
||||
m_panelDestinationEdit = new wxPanel( m_splitterDestination, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerDestinationEdit;
|
||||
bSizerDestinationEdit = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* bSizerComposedEdit2;
|
||||
bSizerComposedEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelComposedEdit, wxID_ANY, _("Composed Text") ), wxVERTICAL );
|
||||
wxStaticBoxSizer* bSizerDestinationEdit2;
|
||||
bSizerDestinationEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDestinationEdit, wxID_ANY, _("Composed Text") ), wxVERTICAL );
|
||||
|
||||
m_composed = new wxTextCtrl( bSizerComposedEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_composed->SetFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_composed->SetMinSize( wxSize( 100,25 ) );
|
||||
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_destination->SetFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_destination->SetMinSize( wxSize( 100,25 ) );
|
||||
|
||||
bSizerComposedEdit2->Add( m_composed, 1, wxEXPAND, 5 );
|
||||
bSizerDestinationEdit2->Add( m_destination, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerComposedEdit->Add( bSizerComposedEdit2, 1, wxEXPAND, 5 );
|
||||
bSizerDestinationEdit->Add( bSizerDestinationEdit2, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelComposedEdit->SetSizer( bSizerComposedEdit );
|
||||
m_panelComposedEdit->Layout();
|
||||
bSizerComposedEdit->Fit( m_panelComposedEdit );
|
||||
m_panelComposedHex = new wxPanel( m_splitterComposed, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerComposedHex;
|
||||
bSizerComposedHex = new wxBoxSizer( wxVERTICAL );
|
||||
m_panelDestinationEdit->SetSizer( bSizerDestinationEdit );
|
||||
m_panelDestinationEdit->Layout();
|
||||
bSizerDestinationEdit->Fit( m_panelDestinationEdit );
|
||||
m_panelDestinationHex = new wxPanel( m_splitterDestination, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerDestinationHex;
|
||||
bSizerDestinationHex = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* bSizerComposedHex2;
|
||||
bSizerComposedHex2 = new wxStaticBoxSizer( new wxStaticBox( m_panelComposedHex, wxID_ANY, _("Composed Unicode Dump") ), wxVERTICAL );
|
||||
wxStaticBoxSizer* bSizerDestinationHex2;
|
||||
bSizerDestinationHex2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDestinationHex, wxID_ANY, _("Composed Unicode Dump") ), wxVERTICAL );
|
||||
|
||||
m_composedHex = new wxTextCtrl( bSizerComposedHex2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_composedHex->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 76, 90, 90, false, wxEmptyString ) );
|
||||
m_destinationHex = new wxTextCtrl( bSizerDestinationHex2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_destinationHex->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 76, 90, 90, false, wxEmptyString ) );
|
||||
|
||||
bSizerComposedHex2->Add( m_composedHex, 1, wxEXPAND, 5 );
|
||||
bSizerDestinationHex2->Add( m_destinationHex, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerComposedHex->Add( bSizerComposedHex2, 1, wxEXPAND, 5 );
|
||||
bSizerDestinationHex->Add( bSizerDestinationHex2, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelComposedHex->SetSizer( bSizerComposedHex );
|
||||
m_panelComposedHex->Layout();
|
||||
bSizerComposedHex->Fit( m_panelComposedHex );
|
||||
m_splitterComposed->SplitVertically( m_panelComposedEdit, m_panelComposedHex, -5 );
|
||||
bSizerMain->Add( m_splitterComposed, 50, wxALL|wxEXPAND, 5 );
|
||||
m_panelDestinationHex->SetSizer( bSizerDestinationHex );
|
||||
m_panelDestinationHex->Layout();
|
||||
bSizerDestinationHex->Fit( m_panelDestinationHex );
|
||||
m_splitterDestination->SplitVertically( m_panelDestinationEdit, m_panelDestinationHex, -5 );
|
||||
bSizerMain->Add( m_splitterDestination, 50, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
@@ -322,24 +340,24 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
|
||||
m_timerSave.SetOwner( this, wxID_TIMER_SAVE );
|
||||
|
||||
// Connect Events
|
||||
m_decomposed->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDecomposedPaint ), NULL, this );
|
||||
m_decomposed->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnDecomposedText ), NULL, this );
|
||||
m_decomposedHex->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDecomposedHexPaint ), NULL, this );
|
||||
m_composed->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnComposedPaint ), NULL, this );
|
||||
m_composed->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnComposedText ), NULL, this );
|
||||
m_composedHex->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnComposedHexPaint ), NULL, this );
|
||||
m_source->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnSourcePaint ), NULL, this );
|
||||
m_source->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnSourceText ), NULL, this );
|
||||
m_sourceHex->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnSourceHexPaint ), NULL, this );
|
||||
m_destination->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDestinationPaint ), NULL, this );
|
||||
m_destination->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnDestinationText ), NULL, this );
|
||||
m_destinationHex->Connect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDestinationHexPaint ), NULL, this );
|
||||
this->Connect( wxID_TIMER_SAVE, wxEVT_TIMER, wxTimerEventHandler( wxZRColaComposerPanelBase::OnSaveTimer ) );
|
||||
}
|
||||
|
||||
wxZRColaComposerPanelBase::~wxZRColaComposerPanelBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_decomposed->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDecomposedPaint ), NULL, this );
|
||||
m_decomposed->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnDecomposedText ), NULL, this );
|
||||
m_decomposedHex->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDecomposedHexPaint ), NULL, this );
|
||||
m_composed->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnComposedPaint ), NULL, this );
|
||||
m_composed->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnComposedText ), NULL, this );
|
||||
m_composedHex->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnComposedHexPaint ), NULL, this );
|
||||
m_source->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnSourcePaint ), NULL, this );
|
||||
m_source->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnSourceText ), NULL, this );
|
||||
m_sourceHex->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnSourceHexPaint ), NULL, this );
|
||||
m_destination->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDestinationPaint ), NULL, this );
|
||||
m_destination->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxZRColaComposerPanelBase::OnDestinationText ), NULL, this );
|
||||
m_destinationHex->Disconnect( wxEVT_PAINT, wxPaintEventHandler( wxZRColaComposerPanelBase::OnDestinationHexPaint ), NULL, this );
|
||||
this->Disconnect( wxID_TIMER_SAVE, wxEVT_TIMER, wxTimerEventHandler( wxZRColaComposerPanelBase::OnSaveTimer ) );
|
||||
|
||||
}
|
||||
@@ -380,7 +398,7 @@ wxZRColaCharacterCatalogPanelBase::wxZRColaCharacterCatalogPanelBase( wxWindow*
|
||||
|
||||
// Cell Defaults
|
||||
m_grid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
|
||||
m_grid->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_grid->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_grid->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
m_grid->SetMinSize( wxSize( 35,35 ) );
|
||||
|
||||
@@ -505,7 +523,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_gridResults->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_gridResults->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_gridResults->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
m_gridResults->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
|
||||
m_gridResults->SetToolTip( _("Character search results") );
|
||||
@@ -543,7 +561,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_gridRecent->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_gridRecent->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_gridRecent->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
m_gridRecent->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
|
||||
m_gridRecent->SetToolTip( _("List of recently inserted characters") );
|
||||
@@ -607,7 +625,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_gridPreview->SetDefaultCellFont( wxFont( 96, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_gridPreview->SetDefaultCellFont( wxFont( 96, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_gridPreview->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
m_gridPreview->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
|
||||
m_gridPreview->SetToolTip( _("Character preview") );
|
||||
@@ -619,6 +637,11 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
|
||||
|
||||
sbSizerPreview->Add( m_description, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_tags = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_tags->SetToolTip( _("Character tags") );
|
||||
|
||||
sbSizerPreview->Add( m_tags, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_category = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_READONLY );
|
||||
m_category->SetToolTip( _("Unicode character category") );
|
||||
|
||||
@@ -671,7 +694,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_gridRelated->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_gridRelated->SetDefaultCellFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_gridRelated->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
m_gridRelated->SetToolTip( _("List of related characters") );
|
||||
|
||||
@@ -758,12 +781,12 @@ wxZRColaSettingsBase::wxZRColaSettingsBase( wxWindow* parent, wxWindowID id, con
|
||||
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 );
|
||||
m_panelLanguage = new wxPanel( m_listbook, wxID_ANY, wxDefaultPosition, wxSize( 500,-1 ), 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 );
|
||||
m_langLabel->Wrap( 490 );
|
||||
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 );
|
||||
@@ -780,14 +803,86 @@ wxZRColaSettingsBase::wxZRColaSettingsBase( wxWindow* parent, wxWindowID id, con
|
||||
|
||||
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 );
|
||||
m_panelTransformation = new wxPanel( m_listbook, wxID_ANY, wxDefaultPosition, wxSize( 500,-1 ), wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerTransformation;
|
||||
bSizerTransformation = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_transLabel = new wxStaticText( m_panelTransformation, wxID_ANY, _("ZRCola offers multiple text transformations that can be arranged in a sequence.\nPlease select desired transformations and the order they are applied."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_transLabel->Wrap( 490 );
|
||||
bSizerTransformation->Add( m_transLabel, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizerTransformation;
|
||||
fgSizerTransformation = new wxFlexGridSizer( 2, 3, 0, 0 );
|
||||
fgSizerTransformation->AddGrowableCol( 0 );
|
||||
fgSizerTransformation->AddGrowableCol( 2 );
|
||||
fgSizerTransformation->AddGrowableRow( 0 );
|
||||
fgSizerTransformation->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerTransformation->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
wxBoxSizer* bSizerTransAvailable;
|
||||
bSizerTransAvailable = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_transAvailableLabel = new wxStaticText( m_panelTransformation, wxID_ANY, _("A&vailable:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_transAvailableLabel->Wrap( -1 );
|
||||
bSizerTransAvailable->Add( m_transAvailableLabel, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_transAvailable = new wxListBox( m_panelTransformation, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_SORT );
|
||||
bSizerTransAvailable->Add( m_transAvailable, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizerTransformation->Add( bSizerTransAvailable, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerTransActivate;
|
||||
bSizerTransActivate = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_transActivate = new wxButton( m_panelTransformation, wxID_ANY, _(">"), wxDefaultPosition, wxSize( 32,32 ), 0 );
|
||||
bSizerTransActivate->Add( m_transActivate, 0, wxALL, 5 );
|
||||
|
||||
m_transDeactivate = new wxButton( m_panelTransformation, wxID_ANY, _("<"), wxDefaultPosition, wxSize( 32,32 ), 0 );
|
||||
bSizerTransActivate->Add( m_transDeactivate, 0, wxALL, 5 );
|
||||
|
||||
|
||||
fgSizerTransformation->Add( bSizerTransActivate, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxBoxSizer* bSizerTransActive;
|
||||
bSizerTransActive = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_transActiveLabel = new wxStaticText( m_panelTransformation, wxID_ANY, _("&Active:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_transActiveLabel->Wrap( -1 );
|
||||
bSizerTransActive->Add( m_transActiveLabel, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_transActive = new wxListBox( m_panelTransformation, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE );
|
||||
bSizerTransActive->Add( m_transActive, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizerTransformation->Add( bSizerTransActive, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerTransformation->Add( fgSizerTransformation, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerTransActiveReorder;
|
||||
bSizerTransActiveReorder = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_transActiveUp = new wxButton( m_panelTransformation, wxID_ANY, _("Up"), wxDefaultPosition, wxSize( 70,-1 ), 0 );
|
||||
bSizerTransActiveReorder->Add( m_transActiveUp, 0, wxALL, 5 );
|
||||
|
||||
m_transActiveDown = new wxButton( m_panelTransformation, wxID_ANY, _("Down"), wxDefaultPosition, wxSize( 70,-1 ), 0 );
|
||||
bSizerTransActiveReorder->Add( m_transActiveDown, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerTransformation->Add( bSizerTransActiveReorder, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
m_panelTransformation->SetSizer( bSizerTransformation );
|
||||
m_panelTransformation->Layout();
|
||||
m_listbook->AddPage( m_panelTransformation, _("Transformation"), false );
|
||||
m_panelAutoStart = new wxPanel( m_listbook, wxID_ANY, wxDefaultPosition, wxSize( 500,-1 ), 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 );
|
||||
m_autoStartLabel->Wrap( 490 );
|
||||
bSizerAutoStart->Add( m_autoStartLabel, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_autoStart = new wxCheckBox( m_panelAutoStart, wxID_ANY, _("Start ZRCola &automatically on logon"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
@@ -796,7 +891,6 @@ wxZRColaSettingsBase::wxZRColaSettingsBase( wxWindow* parent, wxWindowID id, con
|
||||
|
||||
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();
|
||||
@@ -808,7 +902,7 @@ wxZRColaSettingsBase::wxZRColaSettingsBase( wxWindow* parent, wxWindowID id, con
|
||||
m_listbookListView->SetWindowStyleFlag( m_listbookFlags );
|
||||
#endif
|
||||
|
||||
bSizerContent->Add( m_listbook, 1, wxEXPAND | wxALL, 5 );
|
||||
bSizerContent->Add( m_listbook, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerContent->Add( 0, 0, 0, wxALL|wxEXPAND, 5 );
|
||||
@@ -833,8 +927,12 @@ wxZRColaSettingsBase::wxZRColaSettingsBase( wxWindow* parent, wxWindowID id, con
|
||||
|
||||
// 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_panelLanguage->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxZRColaSettingsBase::OnLanguageUpdate ), NULL, this );
|
||||
m_panelTransformation->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxZRColaSettingsBase::OnTransformationUpdate ), NULL, this );
|
||||
m_transActivate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransActivate ), NULL, this );
|
||||
m_transDeactivate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransDeactivate ), NULL, this );
|
||||
m_transActiveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransActiveUp ), NULL, this );
|
||||
m_transActiveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransActiveDown ), 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 );
|
||||
}
|
||||
@@ -843,8 +941,12 @@ 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_panelLanguage->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxZRColaSettingsBase::OnLanguageUpdate ), NULL, this );
|
||||
m_panelTransformation->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxZRColaSettingsBase::OnTransformationUpdate ), NULL, this );
|
||||
m_transActivate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransActivate ), NULL, this );
|
||||
m_transDeactivate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransDeactivate ), NULL, this );
|
||||
m_transActiveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransActiveUp ), NULL, this );
|
||||
m_transActiveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxZRColaSettingsBase::OnTransActiveDown ), 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 );
|
||||
|
||||
@@ -868,7 +970,8 @@ wxZRColaAboutBase::wxZRColaAboutBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
|
||||
m_staticTextZRCola = new wxStaticText( this, wxID_ANY, _("ZRCola"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextZRCola->Wrap( -1 );
|
||||
m_staticTextZRCola->SetFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_staticTextZRCola->SetFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_staticTextZRCola->SetMaxSize( wxSize( 400,-1 ) );
|
||||
|
||||
bSizerText->Add( m_staticTextZRCola, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
@@ -876,8 +979,8 @@ wxZRColaAboutBase::wxZRColaAboutBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
m_staticTextVersion->Wrap( -1 );
|
||||
bSizerText->Add( m_staticTextVersion, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticTextColophone = new wxStaticText( this, wxID_ANY, _("Program and Website Editor: Janoš Ježovnik\nDevelopment: Amebis, d. o. o., Kamnik\nDevelopment and maintenance (2004-2015): dr. Peter Weiss"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextColophone->Wrap( -1 );
|
||||
m_staticTextColophone = new wxStaticText( this, wxID_ANY, _("Program and Website Editor: Janoš Ježovnik\nDevelopment: Amebis, d. o. o., Kamnik\nTranslation into English: Janoš Ježovnik\nTranslation into Russian language: Domen Krvina, Silvo Torkar, Anastasia Plotnikova\nDevelopment and maintenance of the original program (2004–2015): Peter Weiss"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextColophone->Wrap( 400 );
|
||||
bSizerText->Add( m_staticTextColophone, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticTextCopyright = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
@@ -890,11 +993,11 @@ wxZRColaAboutBase::wxZRColaAboutBase( wxWindow* parent, wxWindowID id, const wxS
|
||||
|
||||
bSizerText->Add( 0, 0, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticTextDeclaration = new wxStaticText( this, wxID_ANY, _("Texts made using ZRCola have to include in the colophon, foreword, footnote or some other appropriate part of the publication the note below:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDeclaration = new wxStaticText( this, wxID_ANY, _("Texts made using ZRCola have to include in a footnote or some other appropriate part of the publication the note below:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDeclaration->Wrap( 400 );
|
||||
bSizerText->Add( m_staticTextDeclaration, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_declaration = new wxTextCtrl( this, wxID_ANY, _("This text was written using the ZRCola input system (http://zrcola.zrc-sazu.si), developed at the Science and Research Centre of SAZU in Ljubljana (http://www.zrc-sazu.si) by Dr. Peter Weiss."), wxDefaultPosition, wxSize( -1,80 ), wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_declaration = new wxTextCtrl( this, wxID_ANY, _("This text was written using the ZRCola input system (http://zrcola.zrc-sazu.si), developed at the Science and Research Centre of SAZU in Ljubljana (http://www.zrc-sazu.si) by Peter Weiss."), wxDefaultPosition, wxSize( -1,80 ), wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_declaration->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 93, 90, false, wxEmptyString ) );
|
||||
|
||||
bSizerText->Add( m_declaration, 0, wxALL|wxEXPAND, 5 );
|
||||
@@ -1003,7 +1106,7 @@ wxZRColaCharRequestBase::wxZRColaCharRequestBase( wxWindow* parent, wxWindowID i
|
||||
|
||||
m_character = new wxTextCtrl( sbSizerCharacter->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_character->SetMaxLength( 20 );
|
||||
m_character->SetFont( wxFont( 20, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_character->SetFont( wxFont( 20, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_character->SetToolTip( _("Decomposed character to request") );
|
||||
|
||||
sbSizerCharacter->Add( m_character, 0, wxALL|wxEXPAND, 5 );
|
||||
@@ -1018,12 +1121,12 @@ wxZRColaCharRequestBase::wxZRColaCharRequestBase( wxWindow* parent, wxWindowID i
|
||||
wxStaticBoxSizer* sbSizerContext;
|
||||
sbSizerContext = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Context") ), wxVERTICAL );
|
||||
|
||||
m_contextLbl = new wxStaticText( sbSizerContext->GetStaticBox(), wxID_ANY, _("The &context, examples or short description why and where the character is required:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_contextLbl = new wxStaticText( sbSizerContext->GetStaticBox(), wxID_ANY, _("The &context, examples or description why and where the character is required:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_contextLbl->Wrap( 400 );
|
||||
sbSizerContext->Add( m_contextLbl, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_context = new wxTextCtrl( sbSizerContext->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
m_context->SetFont( wxFont( 16, 70, 90, 90, false, wxT("00 ZRCola") ) );
|
||||
m_context->SetFont( wxFont( 16, 70, 90, 90, false, wxT("ZRCola") ) );
|
||||
m_context->SetToolTip( _("Additional notes for character request") );
|
||||
|
||||
sbSizerContext->Add( m_context, 1, wxALL|wxEXPAND, 5 );
|
||||
@@ -1031,7 +1134,7 @@ wxZRColaCharRequestBase::wxZRColaCharRequestBase( wxWindow* parent, wxWindowID i
|
||||
|
||||
bSizerContent->Add( sbSizerContext, 60, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_note = new wxStaticText( this, wxID_ANY, _("After clicking OK button, your e-mail application should open allowing you to submit the new character request to ZRCola Editor.\nYour e-mail application might not display all the characters correctly, but we'll encode the necessarry information so the Editor will be able to read it correctly."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_note = new wxStaticText( this, wxID_ANY, _("After clicking OK button, your e-mail application should open allowing you to submit the new character request to ZRCola Editor.\nYour e-mail application might not display all the characters correctly, but the Editor will be able to read them correctly anyway."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_note->Wrap( 400 );
|
||||
bSizerContent->Add( m_note, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
@@ -63,12 +63,14 @@ class wxZRColaFrameBase : public wxFrame
|
||||
enum
|
||||
{
|
||||
wxID_CHARACTER_SELECTOR = 1000,
|
||||
wxID_SEND_COMPOSED,
|
||||
wxID_SEND_DECOMPOSED,
|
||||
wxID_SEND_DESTINATION,
|
||||
wxID_COPY_DESTINATION_AND_RETURN,
|
||||
wxID_SEND_SOURCE,
|
||||
wxID_COPY_SOURCE_AND_RETURN,
|
||||
wxID_SEND_ABORT,
|
||||
wxID_SETTINGS,
|
||||
wxID_TOOLBAR_EDIT,
|
||||
wxID_TOOLBAR_COMPOSE,
|
||||
wxID_TOOLBAR_TRANSFORM,
|
||||
wxID_PANEL_CHRGRPS,
|
||||
wxID_HELP_INSTRUCTIONS,
|
||||
wxID_HELP_SHORTCUTS,
|
||||
@@ -85,10 +87,10 @@ class wxZRColaFrameBase : public wxFrame
|
||||
wxAuiToolBarItem* m_toolEditCut;
|
||||
wxAuiToolBarItem* m_toolEditCopy;
|
||||
wxAuiToolBarItem* m_toolEditPaste;
|
||||
wxAuiToolBar* m_toolbarCompose;
|
||||
wxAuiToolBar* m_toolbarTransform;
|
||||
wxAuiToolBarItem* m_toolCharSelect;
|
||||
wxAuiToolBarItem* m_toolSendComposed;
|
||||
wxAuiToolBarItem* m_toolSendDecomposed;
|
||||
wxAuiToolBarItem* m_toolSendDestination;
|
||||
wxAuiToolBarItem* m_toolSendSource;
|
||||
wxZRColaCharacterCatalogPanel* m_panelChrCat;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
@@ -121,43 +123,43 @@ class wxZRColaComposerPanelBase : public wxPanel
|
||||
wxID_TIMER_SAVE = 1000
|
||||
};
|
||||
|
||||
wxSplitterWindow* m_splitterDecomposed;
|
||||
wxPanel* m_panelDecomposedEdit;
|
||||
wxPanel* m_panelDecomposedHex;
|
||||
wxTextCtrl* m_decomposedHex;
|
||||
wxSplitterWindow* m_splitterComposed;
|
||||
wxPanel* m_panelComposedEdit;
|
||||
wxPanel* m_panelComposedHex;
|
||||
wxTextCtrl* m_composedHex;
|
||||
wxSplitterWindow* m_splitterSource;
|
||||
wxPanel* m_panelSourceEdit;
|
||||
wxPanel* m_panelSourceHex;
|
||||
wxTextCtrl* m_sourceHex;
|
||||
wxSplitterWindow* m_splitterDestination;
|
||||
wxPanel* m_panelDestinationEdit;
|
||||
wxPanel* m_panelDestinationHex;
|
||||
wxTextCtrl* m_destinationHex;
|
||||
wxTimer m_timerSave;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnDecomposedPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnDecomposedText( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnDecomposedHexPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnComposedPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnComposedText( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnComposedHexPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnSourcePaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnSourceText( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSourceHexPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnDestinationPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnDestinationText( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnDestinationHexPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnSaveTimer( wxTimerEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxTextCtrl* m_decomposed;
|
||||
wxTextCtrl* m_composed;
|
||||
wxTextCtrl* m_source;
|
||||
wxTextCtrl* m_destination;
|
||||
|
||||
wxZRColaComposerPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxT("ZRColaComposerPanel") );
|
||||
~wxZRColaComposerPanelBase();
|
||||
|
||||
void m_splitterDecomposedOnIdle( wxIdleEvent& )
|
||||
void m_splitterSourceOnIdle( wxIdleEvent& )
|
||||
{
|
||||
m_splitterDecomposed->SetSashPosition( -5 );
|
||||
m_splitterDecomposed->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterDecomposedOnIdle ), NULL, this );
|
||||
m_splitterSource->SetSashPosition( -5 );
|
||||
m_splitterSource->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterSourceOnIdle ), NULL, this );
|
||||
}
|
||||
|
||||
void m_splitterComposedOnIdle( wxIdleEvent& )
|
||||
void m_splitterDestinationOnIdle( wxIdleEvent& )
|
||||
{
|
||||
m_splitterComposed->SetSashPosition( -5 );
|
||||
m_splitterComposed->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterComposedOnIdle ), NULL, this );
|
||||
m_splitterDestination->SetSashPosition( -5 );
|
||||
m_splitterDestination->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterDestinationOnIdle ), NULL, this );
|
||||
}
|
||||
|
||||
};
|
||||
@@ -210,6 +212,7 @@ class wxZRColaCharSelectBase : public wxDialog
|
||||
wxTextCtrl* m_shortcut;
|
||||
wxGrid* m_gridPreview;
|
||||
wxTextCtrl* m_description;
|
||||
wxTextCtrl* m_tags;
|
||||
wxTextCtrl* m_category;
|
||||
wxHyperlinkCtrl* m_navigateBack;
|
||||
wxHyperlinkCtrl* m_navigateForward;
|
||||
@@ -261,6 +264,16 @@ class wxZRColaSettingsBase : public wxDialog
|
||||
wxRadioButton* m_langAuto;
|
||||
wxRadioButton* m_langManual;
|
||||
wxListBox* m_languages;
|
||||
wxPanel* m_panelTransformation;
|
||||
wxStaticText* m_transLabel;
|
||||
wxStaticText* m_transAvailableLabel;
|
||||
wxListBox* m_transAvailable;
|
||||
wxButton* m_transActivate;
|
||||
wxButton* m_transDeactivate;
|
||||
wxStaticText* m_transActiveLabel;
|
||||
wxListBox* m_transActive;
|
||||
wxButton* m_transActiveUp;
|
||||
wxButton* m_transActiveDown;
|
||||
wxPanel* m_panelAutoStart;
|
||||
wxStaticText* m_autoStartLabel;
|
||||
wxCheckBox* m_autoStart;
|
||||
@@ -271,8 +284,12 @@ class wxZRColaSettingsBase : public wxDialog
|
||||
|
||||
// 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 OnLanguageUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnTransformationUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnTransActivate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTransDeactivate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTransActiveUp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTransActiveDown( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnApplyButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
@@ -39,12 +39,17 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
||||
if (e.GetKeyCode() == WXK_INSERT) {
|
||||
// Insert key has been pressed.
|
||||
m_is_insert = true;
|
||||
wxFrame *pFrame = wxDynamicCast(((ZRColaApp*)wxTheApp)->m_mainWnd, wxFrame);
|
||||
wxFrame *pFrame = wxDynamicCast(dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd, wxFrame);
|
||||
if (pFrame && pFrame->GetStatusBar())
|
||||
pFrame->SetStatusText(_("INS key is pressed. Type the Unicode code of desired character now (up to four hexadecimal digits: 0-9, A-F), then release INS."));
|
||||
} else if (m_is_insert) {
|
||||
wxChar chr = e.GetUnicodeKey();
|
||||
wxFrame *pFrame = wxDynamicCast(((ZRColaApp*)wxTheApp)->m_mainWnd, wxFrame);
|
||||
if (!chr) {
|
||||
int key = e.GetKeyCode();
|
||||
if (WXK_NUMPAD0 <= key && key <= WXK_NUMPAD9)
|
||||
chr = '0' + (key - WXK_NUMPAD0);
|
||||
}
|
||||
wxFrame *pFrame = wxDynamicCast(dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd, wxFrame);
|
||||
if (('0' <= chr && chr <= '9' || 'A' <= chr && chr <= 'F') && m_insert_seq.size() < 4) {
|
||||
// A hex-digit pressed. Save it.
|
||||
m_insert_seq.push_back((char)chr);
|
||||
@@ -68,7 +73,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
ZRCola::keyseq_db::indexKey::size_type start;
|
||||
bool found;
|
||||
wxFrame *pFrame = wxDynamicCast(app->m_mainWnd, wxFrame);
|
||||
@@ -91,13 +96,9 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
||||
(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);
|
||||
std::unique_ptr<ZRCola::keyseq_db::keyseq> ks((ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(ZRCola::keyseq_db::keyseq::key_t)*m_seq.size()]);
|
||||
ks->ZRCola::keyseq_db::keyseq::keyseq(m_seq.data(), m_seq.size());
|
||||
found = app->m_ks_db.idxKey.find(*ks, start);
|
||||
delete ks;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
@@ -111,14 +112,14 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
||||
wxObject *obj = event.GetEventObject();
|
||||
if (obj && obj->IsKindOf(wxCLASSINFO(wxTextCtrl))) {
|
||||
// Push text to source control.
|
||||
((wxTextCtrl*)obj)->WriteText(ks.chr);
|
||||
((wxTextCtrl*)obj)->WriteText(wxString(ks.chr(), ks.chr_len()));
|
||||
|
||||
// Event is fully processed now.
|
||||
event.StopPropagation();
|
||||
return true;
|
||||
}
|
||||
} else if (start < app->m_ks_db.idxKey.size() &&
|
||||
ZRCola::keyseq_db::keyseq::CompareSequence(m_seq.data(), m_seq.size(), app->m_ks_db.idxKey[start].seq, std::min<unsigned __int16>(app->m_ks_db.idxKey[start].seq_len, m_seq.size())) == 0)
|
||||
ZRCola::keyseq_db::keyseq::CompareSequence(m_seq.data(), m_seq.size(), app->m_ks_db.idxKey[start].seq(), std::min<size_t>(app->m_ks_db.idxKey[start].seq_len(), m_seq.size())) == 0)
|
||||
{
|
||||
// The sequence is a partial match. Continue watching.
|
||||
if (pFrame && pFrame->GetStatusBar())
|
||||
@@ -138,11 +139,11 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
|
||||
wxKeyEvent &e = (wxKeyEvent&)event;
|
||||
if (m_is_insert && e.GetKeyCode() == WXK_INSERT) {
|
||||
// Insert key has been depressed.
|
||||
wxFrame *pFrame = wxDynamicCast(((ZRColaApp*)wxTheApp)->m_mainWnd, wxFrame);
|
||||
wxFrame *pFrame = wxDynamicCast(dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd, wxFrame);
|
||||
if (pFrame && pFrame->GetStatusBar())
|
||||
pFrame->SetStatusText(wxEmptyString);
|
||||
|
||||
std::vector<char>::size_type count = m_insert_seq.size();
|
||||
auto count = m_insert_seq.size();
|
||||
if (count) {
|
||||
// Zero terminate sequence and parse the Unicode value.
|
||||
m_insert_seq.push_back(0);
|
||||
|
||||
@@ -26,18 +26,31 @@
|
||||
|
||||
wxZRColaSettings::wxZRColaSettings(wxWindow* parent) :
|
||||
m_lang_auto(true),
|
||||
m_lang(ZRCola::langid_t_blank),
|
||||
m_lang(ZRCola::langid_t::blank),
|
||||
m_transeq(1, 0), // By default use translation set 0 (ZRCola Decomposed >> ZRCola Composed)
|
||||
wxZRColaSettingsBase(parent)
|
||||
{
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
auto app = dynamic_cast<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];
|
||||
for (size_t i = 0, n = app->m_lang_db.idxLang.size(); i < n; i++) {
|
||||
const auto &lang = app->m_lang_db.idxLang[i];
|
||||
wxString
|
||||
label(lang.name, lang.name_len),
|
||||
label(lang.name(), lang.name_len()),
|
||||
label_tran(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
|
||||
m_languages->Insert(label_tran, i);
|
||||
}
|
||||
|
||||
m_transAvailable->Clear();
|
||||
for (size_t i = 0, n = app->m_ts_db.idxTranSet.size(); i < n; i++) {
|
||||
const ZRCola::transet_db::transet &ts = app->m_ts_db.idxTranSet[i];
|
||||
wxString
|
||||
src(ts.src(), ts.src_len()),
|
||||
dst(ts.dst(), ts.dst_len()),
|
||||
src_tran(wxGetTranslation(src, wxT("ZRCola-zrcdb"))),
|
||||
dst_tran(wxGetTranslation(dst, wxT("ZRCola-zrcdb"))),
|
||||
label_tran(wxString::Format(wxT("%s \x00bb %s"), src_tran.c_str(), dst_tran.c_str()));
|
||||
m_transAvailable->Append(label_tran, (void*)ts.set);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,23 +70,98 @@ void wxZRColaSettings::OnInitDialog(wxInitDialogEvent& event)
|
||||
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;
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
ZRCola::language_db::indexLang::size_type start;
|
||||
m_languages->Select(app->m_lang_db.idxLng.find(*(ZRCola::language_db::language*)l, start) ? start : -1);
|
||||
m_languages->Select(app->m_lang_db.idxLang.find(ZRCola::language_db::language(m_lang), start) ? start : -1);
|
||||
|
||||
m_transActive->Clear();
|
||||
for (auto s = m_transeq.cbegin(), s_end = m_transeq.cend(); s != s_end; ++s) {
|
||||
ZRCola::transet_db::indexTranSet::size_type start;
|
||||
if (app->m_ts_db.idxTranSet.find(ZRCola::transet_db::transet(*s), start)) {
|
||||
const ZRCola::transet_db::transet &ts = app->m_ts_db.idxTranSet[start];
|
||||
wxString
|
||||
src(ts.src(), ts.src_len()),
|
||||
dst(ts.dst(), ts.dst_len()),
|
||||
src_tran(wxGetTranslation(src, wxT("ZRCola-zrcdb"))),
|
||||
dst_tran(wxGetTranslation(dst, wxT("ZRCola-zrcdb"))),
|
||||
label_tran(wxString::Format(wxT("%s \x00bb %s"), src_tran.c_str(), dst_tran.c_str()));
|
||||
m_transActive->Append(label_tran, (void*)ts.set);
|
||||
} else {
|
||||
wxString label_tran(wxString::Format(_("Unknown transformation (%u)"), (unsigned int)*s));
|
||||
m_transActive->Append(label_tran, (void*)*s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnLangAuto(wxCommandEvent& event)
|
||||
void wxZRColaSettings::OnLanguageUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
m_languages->Enable(!event.IsChecked());
|
||||
m_languages->Enable(m_langManual->GetValue());
|
||||
|
||||
wxZRColaSettingsBase::OnLanguageUpdate(event);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnLangManual(wxCommandEvent& event)
|
||||
void wxZRColaSettings::OnTransformationUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
m_languages->Enable(event.IsChecked());
|
||||
m_transActivate->Enable(m_transAvailable->GetSelection() != wxNOT_FOUND);
|
||||
|
||||
int idx = m_transActive->GetSelection();
|
||||
m_transDeactivate->Enable(idx != wxNOT_FOUND);
|
||||
m_transActiveUp ->Enable(idx != wxNOT_FOUND && (unsigned int)idx > 0);
|
||||
m_transActiveDown->Enable(idx != wxNOT_FOUND && (unsigned int)idx < m_transActive->GetCount() - 1);
|
||||
|
||||
wxZRColaSettingsBase::OnTransformationUpdate(event);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnTransActivate(wxCommandEvent& event)
|
||||
{
|
||||
int idx = m_transAvailable->GetSelection();
|
||||
wxASSERT_MSG(idx != wxNOT_FOUND, wxT("no available transformation selected"));
|
||||
m_transActive->Append(
|
||||
m_transAvailable->GetString(idx),
|
||||
m_transAvailable->GetClientData(idx));
|
||||
|
||||
wxZRColaSettingsBase::OnTransActivate(event);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnTransDeactivate(wxCommandEvent& event)
|
||||
{
|
||||
int idx = m_transActive->GetSelection();
|
||||
wxASSERT_MSG(idx != wxNOT_FOUND, wxT("no active transformation selected"));
|
||||
m_transActive->Delete(idx);
|
||||
|
||||
wxZRColaSettingsBase::OnTransDeactivate(event);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnTransActiveUp(wxCommandEvent& event)
|
||||
{
|
||||
int idx = m_transActive->GetSelection();
|
||||
wxASSERT_MSG(idx != wxNOT_FOUND && (unsigned int)idx > 0, wxT("no or first active transformation selected"));
|
||||
wxString label = m_transActive->GetString(idx);
|
||||
void *data = m_transActive->GetClientData(idx);
|
||||
m_transActive->Delete(idx);
|
||||
m_transActive->Insert(label, idx - 1, data);
|
||||
m_transActive->Select(idx - 1);
|
||||
|
||||
wxZRColaSettingsBase::OnTransActiveUp(event);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaSettings::OnTransActiveDown(wxCommandEvent& event)
|
||||
{
|
||||
int idx = m_transActive->GetSelection();
|
||||
wxASSERT_MSG(idx != wxNOT_FOUND && (unsigned int)idx < m_transActive->GetCount() - 1, wxT("no or last active transformation selected"));
|
||||
wxString label = m_transActive->GetString(idx);
|
||||
void *data = m_transActive->GetClientData(idx);
|
||||
m_transActive->Delete(idx);
|
||||
m_transActive->Insert(label, idx + 1, data);
|
||||
m_transActive->Select(idx + 1);
|
||||
|
||||
wxZRColaSettingsBase::OnTransActiveDown(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,17 +209,21 @@ void wxZRColaSettings::OnApplyButtonClick(wxCommandEvent& event)
|
||||
} else {
|
||||
m_lang_auto = false;
|
||||
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[m_languages->GetSelection()];
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
const auto &lang = app->m_lang_db.idxLang[m_languages->GetSelection()];
|
||||
|
||||
if (m_lang != lang.id) {
|
||||
m_lang = lang.id;
|
||||
if (m_lang != lang.lang) {
|
||||
m_lang = lang.lang;
|
||||
|
||||
// Notify composed text something changed and should re-decompose.
|
||||
// Notify destination text something changed and should re-inverse transform.
|
||||
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
|
||||
app->m_mainWnd->m_panel->m_composed->ProcessWindowEvent(event2);
|
||||
app->m_mainWnd->m_panel->m_destination->ProcessWindowEvent(event2);
|
||||
}
|
||||
}
|
||||
|
||||
m_transeq.clear();
|
||||
for (unsigned int i = 0, n = m_transActive->GetCount(); i < n; i++)
|
||||
m_transeq.push_back((ZRCola::transetid_t)m_transActive->GetClientData(i));
|
||||
}
|
||||
|
||||
|
||||
@@ -155,18 +247,23 @@ void wxPersistentZRColaSettings::Save() const
|
||||
{
|
||||
wxPersistentDialog::Save();
|
||||
|
||||
const wxZRColaSettings * const wnd = static_cast<const wxZRColaSettings*>(GetWindow());
|
||||
auto wnd = static_cast<const wxZRColaSettings*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
|
||||
|
||||
SaveValue(wxT("langAuto"), wnd->m_lang_auto);
|
||||
SaveValue(wxT("lang" ), wxString::FromAscii(wnd->m_lang.data, _countof(wnd->m_lang.data)));
|
||||
|
||||
wxString str;
|
||||
bool first = true;
|
||||
for (auto s = wnd->m_transeq.cbegin(), s_end = wnd->m_transeq.cend(); s != s_end; ++s, first = false)
|
||||
str += wxString::Format(first ? wxT("%u") : wxT("|%u"), *s);
|
||||
SaveValue(wxT("transeq"), str);
|
||||
}
|
||||
|
||||
|
||||
bool wxPersistentZRColaSettings::Restore()
|
||||
{
|
||||
wxZRColaSettings * const wnd = static_cast<wxZRColaSettings*>(GetWindow());
|
||||
|
||||
ZRColaApp *app = ((ZRColaApp*)wxTheApp);
|
||||
auto wnd = dynamic_cast<wxZRColaSettings*>(GetWindow());
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
wxString lang;
|
||||
|
||||
// Restore automatic language detection setting first.
|
||||
@@ -180,11 +277,28 @@ bool wxPersistentZRColaSettings::Restore()
|
||||
} 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 if (!app->m_lang_db.idxLang.empty()) {
|
||||
const auto &lang = app->m_lang_db.idxLang[0];
|
||||
wnd->m_lang = lang.lang;
|
||||
} else
|
||||
wnd->m_lang = ZRCola::langid_t_blank;
|
||||
wnd->m_lang = ZRCola::langid_t::blank;
|
||||
|
||||
wxString str;
|
||||
if (RestoreValue(wxT("transeq"), &str)) {
|
||||
std::vector<ZRCola::transetid_t> transeq;
|
||||
for (wxStringTokenizer tok(str, wxT("|")); tok.HasMoreTokens(); ) {
|
||||
unsigned long val = _tcstoul(tok.GetNextToken().c_str(), NULL, 10);
|
||||
for (size_t i = 0, n = app->m_ts_db.idxTranSet.size(); i < n; i++) {
|
||||
const ZRCola::transet_db::transet &cg = app->m_ts_db.idxTranSet[i];
|
||||
if (cg.set == val) {
|
||||
transeq.push_back(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!transeq.empty())
|
||||
wnd->m_transeq = std::move(transeq);
|
||||
}
|
||||
|
||||
return wxPersistentDialog::Restore();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class wxPersistentZRColaSettings;
|
||||
#pragma once
|
||||
|
||||
#include "zrcolagui.h"
|
||||
#include <zrcola/translate.h>
|
||||
#include <wxex/persist/dialog.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
///
|
||||
@@ -42,14 +44,19 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void OnInitDialog(wxInitDialogEvent& event);
|
||||
virtual void OnLangAuto(wxCommandEvent& event);
|
||||
virtual void OnLangManual(wxCommandEvent& event);
|
||||
virtual void OnLanguageUpdate(wxUpdateUIEvent& event);
|
||||
virtual void OnTransformationUpdate(wxUpdateUIEvent& event);
|
||||
virtual void OnTransActivate(wxCommandEvent& event);
|
||||
virtual void OnTransDeactivate(wxCommandEvent& event);
|
||||
virtual void OnTransActiveUp(wxCommandEvent& event);
|
||||
virtual void OnTransActiveDown(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
|
||||
bool m_lang_auto; ///< Is language for inverse translation resolved using currently selected keyboard
|
||||
ZRCola::langid_t m_lang; ///< Language for inverse translation
|
||||
std::vector<ZRCola::transetid_t> m_transeq; ///< Transformation set sequence
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ wxZRColaUpdater::wxZRColaUpdater(wxWindow* parent) :
|
||||
//Connect(wxID_ANY, wxEVT_UPDATER_CHECK_COMPLETE, wxThreadEventHandler(wxZRColaUpdater::OnCheckComplete), NULL, this);
|
||||
|
||||
// Prepare Updater.
|
||||
ZRColaApp *app = (ZRColaApp*)wxTheApp;
|
||||
m_updater = new wxUpdCheckThread(app->m_locale.GetCanonicalName(), this);
|
||||
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
|
||||
m_updater = new wxUpdCheckThread(app->m_lang_ui == wxLANGUAGE_DEFAULT ? wxT("en_US") : wxLocale::GetLanguageCanonicalName(app->m_lang_ui), this);
|
||||
//if (m_updater->Run() != wxTHREAD_NO_ERROR) {
|
||||
// wxFAIL_MSG(wxT("Can't create the thread!"));
|
||||
// delete m_updater;
|
||||
@@ -95,7 +95,7 @@ void wxZRColaUpdater::OnUpdate(wxCommandEvent& event)
|
||||
m_updater->LaunchUpdate();
|
||||
|
||||
Close(true);
|
||||
((ZRColaApp*)wxTheApp)->m_mainWnd->Close();
|
||||
dynamic_cast<ZRColaApp*>(wxTheApp)->m_mainWnd->Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\lib\stdex\include;..\lib\libZRCola\include;..\lib\libZRColaUI\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\lib\WinStd\include;..\lib\stdex\include;..\lib\libZRCola\include;..\lib\libZRColaUI\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
||||
@@ -19,14 +19,12 @@
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfAtl>Dynamic</UseOfAtl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfAtl>Dynamic</UseOfAtl>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
@@ -63,7 +61,10 @@
|
||||
<ProjectReference Include="..\lib\libZRCola\build\libZRCola.vcxproj">
|
||||
<Project>{3c61929e-7289-4101-8d0a-da22d6e1aea8}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lib\wxExtend\build\wxExtend.vcxproj">
|
||||
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lib\wxExtend\build\wxExtendDll.vcxproj">
|
||||
<Project>{a3a36689-ac35-4026-93da-a3ba0c0e767c}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -21,9 +21,20 @@
|
||||
|
||||
#include <zrcola/character.h>
|
||||
#include <zrcola/common.h>
|
||||
#include <zrcola/language.h>
|
||||
#include <zrcola/tag.h>
|
||||
#include <zrcola/translate.h>
|
||||
|
||||
#include <zrcolaui/chargroup.h>
|
||||
#include <zrcolaui/keyboard.h>
|
||||
|
||||
#include <WinStd/COM.h>
|
||||
#include <WinStd/Win.h>
|
||||
|
||||
#include <wx/debug.h>
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <adoint.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
@@ -38,14 +49,45 @@ namespace ZRCola {
|
||||
class DBSource
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Character sequence
|
||||
///
|
||||
class charseq {
|
||||
public:
|
||||
int rank; ///< Sequence rank
|
||||
std::wstring str; ///< Sequence string
|
||||
|
||||
inline charseq()
|
||||
{
|
||||
}
|
||||
|
||||
inline charseq(_In_ int _rank, _In_z_ const wchar_t *_str) :
|
||||
rank(_rank),
|
||||
str (_str)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Translation
|
||||
///
|
||||
class translation {
|
||||
public:
|
||||
wchar_t chr; ///< Composed character
|
||||
std::wstring str; ///< Decomposed string
|
||||
int rank; ///< Decomposition rank
|
||||
int set; ///< Translation set ID
|
||||
charseq src; ///< Source sequence
|
||||
charseq dst; ///< Destination sequence
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Translation set
|
||||
///
|
||||
class transet {
|
||||
public:
|
||||
int set; ///< ID
|
||||
std::wstring src; ///< Source name
|
||||
std::wstring dst; ///< Destination name
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +121,7 @@ namespace ZRCola {
|
||||
};
|
||||
|
||||
public:
|
||||
wchar_t chr; ///< Character
|
||||
std::wstring chr; ///< Character
|
||||
std::vector<keycode> seq; ///< Key sequence
|
||||
};
|
||||
|
||||
@@ -89,8 +131,8 @@ namespace ZRCola {
|
||||
///
|
||||
class language {
|
||||
public:
|
||||
ZRCola::langid_t id; ///< Language ID
|
||||
std::wstring name; ///< Language name
|
||||
ZRCola::langid_t lang; ///< Language ID
|
||||
std::wstring name; ///< Name
|
||||
};
|
||||
|
||||
|
||||
@@ -99,7 +141,7 @@ namespace ZRCola {
|
||||
///
|
||||
class langchar {
|
||||
public:
|
||||
wchar_t chr; ///> Character
|
||||
std::wstring chr; ///> Character
|
||||
ZRCola::langid_t lang; ///< Language ID
|
||||
};
|
||||
|
||||
@@ -109,82 +151,66 @@ namespace ZRCola {
|
||||
///
|
||||
class chrgrp {
|
||||
public:
|
||||
int id; ///< Character group ID
|
||||
int rank; ///< Character group rank
|
||||
std::wstring name; ///< Character group name
|
||||
std::wstring chars; ///< Character group characters
|
||||
std::vector<unsigned __int16> show; ///< Bit vector if particular character is displayed initially
|
||||
int grp; ///< Character group ID
|
||||
int rank; ///< Rank
|
||||
std::wstring name; ///< Name
|
||||
std::vector<wchar_t> chars; ///< Characters (zero-delimited)
|
||||
std::vector<unsigned __int16> show; ///< Bit vector if particular character from \c chars is displayed initially
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Character data
|
||||
///
|
||||
class character_data {
|
||||
public:
|
||||
inline character_data()
|
||||
{
|
||||
cat.data[0] = 0;
|
||||
cat.data[1] = 0;
|
||||
}
|
||||
|
||||
inline character_data(_In_ const character_data &othr) :
|
||||
cat (othr.cat),
|
||||
desc (othr.desc),
|
||||
terms (othr.terms),
|
||||
terms_rel(othr.terms_rel),
|
||||
rel (othr.rel)
|
||||
{
|
||||
}
|
||||
|
||||
ZRCola::chrcatid_t cat; ///< Category ID
|
||||
std::wstring desc; ///< Character description
|
||||
std::set<std::wstring> terms; ///< Search terms
|
||||
std::set<std::wstring> terms_rel; ///< Relevant terms for relating characters
|
||||
std::vector<wchar_t> rel; ///< Related characters (zero-delimited)
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Character
|
||||
///
|
||||
class character {
|
||||
public:
|
||||
inline character()
|
||||
{
|
||||
chr = 0;
|
||||
cat.data[0] = 0;
|
||||
cat.data[1] = 0;
|
||||
}
|
||||
|
||||
inline character(_In_ const character &othr) :
|
||||
chr (othr.chr),
|
||||
cat (othr.cat),
|
||||
desc (othr.desc),
|
||||
terms(othr.terms),
|
||||
rel (othr.rel)
|
||||
{
|
||||
}
|
||||
|
||||
inline bool operator==(_In_ const character &othr) const
|
||||
{
|
||||
return
|
||||
chr == othr.chr &&
|
||||
cat == othr.cat &&
|
||||
desc == othr.desc &&
|
||||
terms == othr.terms &&
|
||||
rel == othr.rel;
|
||||
}
|
||||
|
||||
inline bool operator!=(_In_ const character &othr) const
|
||||
{
|
||||
return !operator==(othr);
|
||||
}
|
||||
|
||||
wchar_t chr; ///< Character
|
||||
ZRCola::chrcatid_t cat; ///< Category ID
|
||||
std::wstring desc; ///< Character description
|
||||
std::set<std::wstring> terms; ///< Search terms
|
||||
std::wstring rel; ///< Related characters
|
||||
};
|
||||
typedef std::pair<std::wstring, character_data> character;
|
||||
|
||||
|
||||
///
|
||||
/// Character bank
|
||||
///
|
||||
class character_bank : public std::vector<std::unique_ptr<character> >
|
||||
class character_bank : public std::map<std::wstring, character_data>
|
||||
{
|
||||
public:
|
||||
character_bank();
|
||||
void build_related();
|
||||
|
||||
protected:
|
||||
class build_related_worker : public std::unique_ptr<void, stdex::CloseHandle_delete<void> >
|
||||
class build_related_worker : public winstd::win_handle
|
||||
{
|
||||
public:
|
||||
typedef std::unique_ptr<void, stdex::CloseHandle_delete<void> > thread_type;
|
||||
|
||||
public:
|
||||
build_related_worker(_In_ const character_bank *cb, _In_ size_type from, _In_ size_type to);
|
||||
virtual ~build_related_worker();
|
||||
build_related_worker(_In_ const character_bank *cb, _In_ iterator from, _In_ iterator to);
|
||||
|
||||
inline void join()
|
||||
{
|
||||
HANDLE h = get();
|
||||
if (h)
|
||||
WaitForSingleObject(h, INFINITE);
|
||||
if (m_h)
|
||||
WaitForSingleObject(m_h, INFINITE);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -200,12 +226,9 @@ namespace ZRCola {
|
||||
|
||||
protected:
|
||||
const character_bank *m_cb;
|
||||
size_type m_from, m_to;
|
||||
HANDLE m_heap;
|
||||
iterator m_from, m_to;
|
||||
winstd::heap m_heap;
|
||||
};
|
||||
|
||||
protected:
|
||||
std::set<std::wstring> m_ignore;
|
||||
};
|
||||
|
||||
|
||||
@@ -236,8 +259,8 @@ namespace ZRCola {
|
||||
{
|
||||
public:
|
||||
static void parse_keywords(const wchar_t *str, std::set<std::wstring> &terms);
|
||||
void add_keywords(const std::set<std::wstring> &terms, wchar_t chr, size_t sub = 0);
|
||||
inline void add_keywords(const wchar_t *str, wchar_t chr, size_t sub = 0)
|
||||
void add_keywords(const std::set<std::wstring> &terms, const std::wstring &chr, size_t sub = 0);
|
||||
inline void add_keywords(const wchar_t *str, const std::wstring &chr, size_t sub = 0)
|
||||
{
|
||||
std::set<std::wstring> terms;
|
||||
parse_keywords(str, terms);
|
||||
@@ -247,21 +270,21 @@ namespace ZRCola {
|
||||
void save(ZRCola::textindex<wchar_t, wchar_t, unsigned __int32> &idx) const;
|
||||
|
||||
protected:
|
||||
inline void add_keyword(const std::wstring &term, wchar_t chr)
|
||||
inline void add_keyword(const std::wstring &term, const std::wstring &chr)
|
||||
{
|
||||
iterator idx = find(term);
|
||||
if (idx == end()) {
|
||||
// New keyword.
|
||||
insert(std::make_pair(term, std::vector<wchar_t>(1, chr)));
|
||||
insert(std::make_pair(term, mapped_type(chr.data(), chr.data() + chr.length() + 1)));
|
||||
} else {
|
||||
// Append to existing keyword.
|
||||
std::vector<wchar_t> &val = idx->second;
|
||||
for (std::vector<wchar_t>::iterator i = val.begin(), i_end = val.end(); ; ++i) {
|
||||
if (i == i_end) {
|
||||
auto &val = idx->second;
|
||||
for (mapped_type::size_type i = 0, n = val.size(); ; i += wcsnlen(val.data() + i, n - i) + 1) {
|
||||
if (i >= n) {
|
||||
// End-of-values reached. Append character.
|
||||
val.push_back(chr);
|
||||
val.insert(val.end(), chr.data(), chr.data() + chr.length() + 1);
|
||||
break;
|
||||
} else if (*i == chr) {
|
||||
} else if (chr.compare(val.data() + i) == 0) {
|
||||
// Character already among the values.
|
||||
break;
|
||||
}
|
||||
@@ -276,9 +299,29 @@ namespace ZRCola {
|
||||
///
|
||||
class chrcat {
|
||||
public:
|
||||
ZRCola::chrcatid_t id; ///> Category ID
|
||||
int rank; ///< Character category rank
|
||||
std::wstring name; ///< Character category name
|
||||
ZRCola::chrcatid_t cat; ///> Category ID
|
||||
int rank; ///< Rank
|
||||
std::wstring name; ///< Name
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Character tag
|
||||
///
|
||||
class chrtag {
|
||||
public:
|
||||
std::wstring chr; ///> Character
|
||||
int tag; ///< Tag ID
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Tag name
|
||||
///
|
||||
class tagname {
|
||||
public:
|
||||
int tag; ///< Tag ID
|
||||
std::map<LCID, std::list<std::wstring> > names; ///< Names
|
||||
};
|
||||
|
||||
|
||||
@@ -286,7 +329,6 @@ namespace ZRCola {
|
||||
DBSource();
|
||||
virtual ~DBSource();
|
||||
|
||||
|
||||
///
|
||||
/// Opens the database
|
||||
///
|
||||
@@ -298,13 +340,11 @@ namespace ZRCola {
|
||||
///
|
||||
bool Open(LPCTSTR filename);
|
||||
|
||||
|
||||
///
|
||||
/// Logs errors in database connections
|
||||
///
|
||||
void LogErrors() const;
|
||||
|
||||
|
||||
///
|
||||
/// Is recordset at end
|
||||
///
|
||||
@@ -314,13 +354,12 @@ namespace ZRCola {
|
||||
/// - true when at end
|
||||
/// - false otherwise
|
||||
///
|
||||
static inline bool IsEOF(const ATL::CComPtr<ADORecordset>& rs)
|
||||
static inline bool IsEOF(const winstd::com_obj<ADORecordset>& rs)
|
||||
{
|
||||
VARIANT_BOOL eof = VARIANT_TRUE;
|
||||
return FAILED(rs->get_EOF(&eof)) || eof ? true : false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Gets number of records in a recordset
|
||||
///
|
||||
@@ -328,13 +367,12 @@ namespace ZRCola {
|
||||
///
|
||||
/// \returns Number of records
|
||||
///
|
||||
static inline size_t GetRecordsetCount(const ATL::CComPtr<ADORecordset>& rs)
|
||||
static inline size_t GetRecordsetCount(const winstd::com_obj<ADORecordset>& rs)
|
||||
{
|
||||
ADO_LONGPTR count;
|
||||
return SUCCEEDED(rs->get_RecordCount(&count)) ? count : (size_t)-1;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Splits string to individual keywords
|
||||
///
|
||||
@@ -347,7 +385,6 @@ namespace ZRCola {
|
||||
///
|
||||
static bool GetKeywords(const wchar_t *str, std::vector< std::wstring > &keywords);
|
||||
|
||||
|
||||
///
|
||||
/// Gets boolean from ZRCola.zrc database
|
||||
///
|
||||
@@ -358,8 +395,7 @@ namespace ZRCola {
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetValue(const ATL::CComPtr<ADOField>& f, bool& val) const;
|
||||
|
||||
bool GetValue(const winstd::com_obj<ADOField>& f, bool& val) const;
|
||||
|
||||
///
|
||||
/// Gets integer from ZRCola.zrc database
|
||||
@@ -371,8 +407,7 @@ namespace ZRCola {
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetValue(const ATL::CComPtr<ADOField>& f, int& val) const;
|
||||
|
||||
bool GetValue(const winstd::com_obj<ADOField>& f, int& val) const;
|
||||
|
||||
///
|
||||
/// Gets string from ZRCola.zrc database
|
||||
@@ -384,8 +419,7 @@ namespace ZRCola {
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetValue(const ATL::CComPtr<ADOField>& f, std::wstring& val) const;
|
||||
|
||||
bool GetValue(const winstd::com_obj<ADOField>& f, std::wstring& val) const;
|
||||
|
||||
///
|
||||
/// Gets encoded Unicode character from ZRCola.zrc database
|
||||
@@ -397,8 +431,7 @@ namespace ZRCola {
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetUnicodeCharacter(const ATL::CComPtr<ADOField>& f, wchar_t& chr) const;
|
||||
|
||||
bool GetUnicodeCharacter(const winstd::com_obj<ADOField>& f, wchar_t& chr) const;
|
||||
|
||||
///
|
||||
/// Gets encoded Unicode string from ZRCola.zrc database
|
||||
@@ -410,8 +443,7 @@ namespace ZRCola {
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetUnicodeString(const ATL::CComPtr<ADOField>& f, std::wstring& str) const;
|
||||
|
||||
bool GetUnicodeString(const winstd::com_obj<ADOField>& f, std::wstring& str) const;
|
||||
|
||||
///
|
||||
/// Gets language ID from ZRCola.zrc database
|
||||
@@ -423,8 +455,7 @@ namespace ZRCola {
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetLanguage(const ATL::CComPtr<ADOField>& f, langid_t& lang) const;
|
||||
|
||||
bool GetLanguage(const winstd::com_obj<ADOField>& f, langid_t& lang) const;
|
||||
|
||||
///
|
||||
/// Gets character category ID from ZRCola.zrc database
|
||||
@@ -436,8 +467,19 @@ namespace ZRCola {
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetChrCat(const ATL::CComPtr<ADOField>& f, chrcatid_t& cc) const;
|
||||
bool GetChrCat(const winstd::com_obj<ADOField>& f, chrcatid_t& cc) const;
|
||||
|
||||
///
|
||||
/// Gets tag names from ZRCola.zrc database
|
||||
///
|
||||
/// \param[in] f Data field
|
||||
/// \param[out] names Output names
|
||||
///
|
||||
/// \returns
|
||||
/// - true when successful
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetTagNames(const winstd::com_obj<ADOField>& f, LCID lcid, std::list<std::wstring>& names) const;
|
||||
|
||||
///
|
||||
/// Returns character translations
|
||||
@@ -448,8 +490,19 @@ namespace ZRCola {
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectTranslations(ATL::CComPtr<ADORecordset>& rs) const;
|
||||
bool SelectTranslations(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns character translations by set
|
||||
///
|
||||
/// \param[in ] set Translation set ID
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectTranslations(int set, winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns translation data
|
||||
@@ -461,8 +514,30 @@ namespace ZRCola {
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetTranslation(const ATL::CComPtr<ADORecordset>& rs, translation& t) const;
|
||||
bool GetTranslation(const winstd::com_obj<ADORecordset>& rs, translation& t) const;
|
||||
|
||||
///
|
||||
/// Returns translation sets
|
||||
///
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectTranlationSets(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns translation set data
|
||||
///
|
||||
/// \param[in] rs Recordset with results
|
||||
/// \param[out] lang Language
|
||||
///
|
||||
/// \returns
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetTranslationSet(const winstd::com_obj<ADORecordset>& rs, transet& ts) const;
|
||||
|
||||
///
|
||||
/// Returns key sequences
|
||||
@@ -473,8 +548,7 @@ namespace ZRCola {
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectKeySequences(ATL::CComPtr<ADORecordset>& rs) const;
|
||||
|
||||
bool SelectKeySequences(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns key sequence data
|
||||
@@ -486,8 +560,7 @@ namespace ZRCola {
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetKeySequence(const ATL::CComPtr<ADORecordset>& rs, keyseq& ks) const;
|
||||
|
||||
bool GetKeySequence(const winstd::com_obj<ADORecordset>& rs, keyseq& ks) const;
|
||||
|
||||
///
|
||||
/// Returns languages
|
||||
@@ -498,8 +571,7 @@ namespace ZRCola {
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectLanguages(ATL::CComPtr<ADORecordset>& rs) const;
|
||||
|
||||
bool SelectLanguages(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns language data
|
||||
@@ -511,8 +583,7 @@ namespace ZRCola {
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetLanguage(const ATL::CComPtr<ADORecordset>& rs, language& lang) const;
|
||||
|
||||
bool GetLanguage(const winstd::com_obj<ADORecordset>& rs, language& lang) const;
|
||||
|
||||
///
|
||||
/// Returns language character
|
||||
@@ -523,8 +594,7 @@ namespace ZRCola {
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectLanguageCharacters(ATL::CComPtr<ADORecordset>& rs) const;
|
||||
|
||||
bool SelectLanguageCharacters(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns language character data
|
||||
@@ -536,8 +606,7 @@ namespace ZRCola {
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetLanguageCharacter(const ATL::CComPtr<ADORecordset>& rs, langchar& lc) const;
|
||||
|
||||
bool GetLanguageCharacter(const winstd::com_obj<ADORecordset>& rs, langchar& lc) const;
|
||||
|
||||
///
|
||||
/// Returns character groups
|
||||
@@ -548,8 +617,7 @@ namespace ZRCola {
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectCharacterGroups(ATL::CComPtr<ADORecordset>& rs) const;
|
||||
|
||||
bool SelectCharacterGroups(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns character group data
|
||||
@@ -561,7 +629,7 @@ namespace ZRCola {
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetCharacterGroup(const ATL::CComPtr<ADORecordset>& rs, chrgrp& cg) const;
|
||||
bool GetCharacterGroup(const winstd::com_obj<ADORecordset>& rs, chrgrp& cg) const;
|
||||
|
||||
///
|
||||
/// Returns characters
|
||||
@@ -572,8 +640,7 @@ namespace ZRCola {
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectCharacters(ATL::CComPtr<ADORecordset>& rs) const;
|
||||
|
||||
bool SelectCharacters(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns character data
|
||||
@@ -585,7 +652,7 @@ namespace ZRCola {
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetCharacter(const ATL::CComPtr<ADORecordset>& rs, character& chr) const;
|
||||
bool GetCharacter(const winstd::com_obj<ADORecordset>& rs, character& chr) const;
|
||||
|
||||
///
|
||||
/// Returns character categories
|
||||
@@ -596,8 +663,7 @@ namespace ZRCola {
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectCharacterCategories(ATL::CComPtr<ADORecordset>& rs) const;
|
||||
|
||||
bool SelectCharacterCategories(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns character category data
|
||||
@@ -609,14 +675,262 @@ namespace ZRCola {
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetCharacterCategory(const ATL::CComPtr<ADORecordset>& rs, chrcat& cc) const;
|
||||
bool GetCharacterCategory(const winstd::com_obj<ADORecordset>& rs, chrcat& cc) const;
|
||||
|
||||
///
|
||||
/// Returns character tags
|
||||
///
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectCharacterTags(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns character tag data
|
||||
///
|
||||
/// \param[in] rs Recordset with results
|
||||
/// \param[out] cc Character tag
|
||||
///
|
||||
/// \returns
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetCharacterTag(const winstd::com_obj<ADORecordset>& rs, chrtag& tc) const;
|
||||
|
||||
///
|
||||
/// Returns tag names
|
||||
///
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectTagNames(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns tag name data
|
||||
///
|
||||
/// \param[in] rs Recordset with results
|
||||
/// \param[out] tn Tag name
|
||||
///
|
||||
/// \returns
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetTagName(const winstd::com_obj<ADORecordset>& rs, tagname& tn) const;
|
||||
|
||||
protected:
|
||||
std::basic_string<TCHAR> m_filename; ///< Database filename
|
||||
ATL::CComPtr<ADOConnection> m_db; ///< Database
|
||||
winstd::com_obj<ADOConnection> m_db; ///< Database
|
||||
_locale_t m_locale; ///< Database locale
|
||||
|
||||
ATL::CComPtr<ADOCommand> m_comCharacterGroup; ///< ADO Command for GetCharacterGroup subquery
|
||||
ATL::CComPtr<ADOParameter> m_pCharacterGroup1; ///< \c m_comCharacterGroup parameter
|
||||
winstd::com_obj<ADOCommand> m_comCharacterGroup; ///< ADO Command for GetCharacterGroup subquery
|
||||
winstd::com_obj<ADOParameter> m_pCharacterGroup1; ///< \c m_comCharacterGroup parameter
|
||||
|
||||
winstd::com_obj<ADOCommand> m_comTranslation; ///< ADO Command for SelectTranslations subquery
|
||||
winstd::com_obj<ADOParameter> m_pTranslation1; ///< \c m_comTranslations parameter
|
||||
|
||||
std::set<std::wstring> m_terms_ignore; ///< Terms to ignore when comparing characters
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
inline ZRCola::translation_db& operator<<(_Inout_ ZRCola::translation_db &db, _In_ const ZRCola::DBSource::translation &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.set && rec.set <= (int)0x00007fff, wxT("translation set index out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.set);
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.dst.rank && rec.dst.rank <= (int)0x00007fff, wxT("destination character rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.dst.rank);
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.src.rank && rec.src.rank <= (int)0x00007fff, wxT("source character rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.src.rank);
|
||||
std::wstring::size_type n = rec.dst.str.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("destination overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += rec.src.str.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("source overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.dst.str.cbegin(), rec.dst.str.cend());
|
||||
db.data.insert(db.data.end(), rec.src.str.cbegin(), rec.src.str.cend());
|
||||
db.idxSrc.push_back(idx);
|
||||
db.idxDst.push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::transet_db& operator<<(_Inout_ ZRCola::transet_db &db, _In_ const ZRCola::DBSource::transet &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.set && rec.set <= (int)0x00007fff, wxT("translation set index out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.set);
|
||||
std::wstring::size_type n = rec.src.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation set source name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += rec.dst.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation set destination name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.src.cbegin(), rec.src.cend());
|
||||
db.data.insert(db.data.end(), rec.dst.cbegin(), rec.dst.cend());
|
||||
db.idxTranSet.push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::keyseq_db& operator<<(_Inout_ ZRCola::keyseq_db &db, _In_ const ZRCola::DBSource::keyseq &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
std::wstring::size_type n = rec.chr.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += rec.seq.size() * sizeof(ZRCola::keyseq_db::keyseq::key_t) / sizeof(wchar_t);
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("key sequence overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.chr.cbegin(), rec.chr.cend());
|
||||
for (auto kc = rec.seq.cbegin(), kc_end = rec.seq.cend(); kc != kc_end; ++kc) {
|
||||
db.data.push_back(kc->key);
|
||||
db.data.push_back(
|
||||
(kc->shift ? ZRCola::keyseq_db::keyseq::SHIFT : 0) |
|
||||
(kc->ctrl ? ZRCola::keyseq_db::keyseq::CTRL : 0) |
|
||||
(kc->alt ? ZRCola::keyseq_db::keyseq::ALT : 0));
|
||||
}
|
||||
db.idxChr.push_back(idx);
|
||||
db.idxKey.push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::language_db& operator<<(_Inout_ ZRCola::language_db &db, _In_ const ZRCola::DBSource::language &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.insert(db.data.end(), reinterpret_cast<const unsigned __int16*>(&rec.lang), reinterpret_cast<const unsigned __int16*>(&rec.lang + 1));
|
||||
std::wstring::size_type n = rec.name.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("language name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.name.cbegin(), rec.name.cend());
|
||||
db.idxLang.push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::langchar_db& operator<<(_Inout_ ZRCola::langchar_db &db, _In_ const ZRCola::DBSource::langchar &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.insert(db.data.end(), reinterpret_cast<const unsigned __int16*>(&rec.lang), reinterpret_cast<const unsigned __int16*>(&rec.lang + 1));
|
||||
std::wstring::size_type n = rec.chr.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.chr.cbegin(), rec.chr.cend());
|
||||
db.idxChr .push_back(idx);
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
db.idxLang.push_back(idx);
|
||||
#endif
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::chrgrp_db& operator<<(_Inout_ ZRCola::chrgrp_db &db, _In_ const ZRCola::DBSource::chrgrp &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.grp && rec.grp <= (int)0x00007fff, wxT("character group ID out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.grp);
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.rank && rec.rank <= (int)0x00007fff, wxT("character group rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.rank);
|
||||
std::wstring::size_type n = rec.name.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character group name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += rec.chars.size();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character group characters overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.name .cbegin(), rec.name .cend());
|
||||
db.data.insert(db.data.end(), rec.chars.cbegin(), rec.chars.cend());
|
||||
db.data.insert(db.data.end(), rec.show .cbegin(), rec.show .cend());
|
||||
db.idxRank.push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::character_db& operator<<(_Inout_ ZRCola::character_db &db, _In_ const ZRCola::DBSource::character &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.insert(db.data.end(), reinterpret_cast<const unsigned __int16*>(&rec.second.cat), reinterpret_cast<const unsigned __int16*>(&rec.second.cat + 1));
|
||||
std::wstring::size_type n = rec.first.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += rec.second.desc.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character description overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += rec.second.rel.size();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("related characters overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.first .cbegin(), rec.first .cend());
|
||||
db.data.insert(db.data.end(), rec.second.desc.cbegin(), rec.second.desc.cend());
|
||||
db.data.insert(db.data.end(), rec.second.rel .cbegin(), rec.second.rel .cend());
|
||||
db.idxChr.push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::chrcat_db& operator<<(_Inout_ ZRCola::chrcat_db &db, _In_ const ZRCola::DBSource::chrcat &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.insert(db.data.end(), reinterpret_cast<const unsigned __int16*>(&rec.cat), reinterpret_cast<const unsigned __int16*>(&rec.cat + 1));
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.rank && rec.rank <= (int)0x00007fff, wxT("character category rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.rank);
|
||||
std::wstring::size_type n = rec.name.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character category name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.name.cbegin(), rec.name.cend());
|
||||
db.idxChrCat.push_back(idx);
|
||||
db.idxRank .push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::chrtag_db& operator<<(_Inout_ ZRCola::chrtag_db &db, _In_ const ZRCola::DBSource::chrtag &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.tag && rec.tag <= (int)0x00007fff, wxT("tag out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.tag);
|
||||
std::wstring::size_type n = rec.chr.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("character overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.chr.cbegin(), rec.chr.cend());
|
||||
db.idxChr.push_back(idx);
|
||||
db.idxTag.push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::tagname_db& operator<<(_Inout_ ZRCola::tagname_db &db, _In_ const ZRCola::DBSource::tagname &rec)
|
||||
{
|
||||
for (auto ln = rec.names.cbegin(), ln_end = rec.names.cend(); ln != ln_end; ++ln) {
|
||||
for (auto nm = ln->second.cbegin(), nm_end = ln->second.cend(); nm != nm_end; ++nm) {
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.tag && rec.tag <= (int)0x00007fff, wxT("tag out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.tag);
|
||||
db.data.push_back(LOWORD(ln->first));
|
||||
db.data.push_back(HIWORD(ln->first));
|
||||
std::wstring::size_type n = nm->length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("tag name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), nm->cbegin(), nm->cend());
|
||||
db.idxName.push_back(idx);
|
||||
db.idxTag .push_back(idx);
|
||||
}
|
||||
}
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ZRColaCompile\n"
|
||||
"POT-Creation-Date: 2016-05-13 20:00+0200\n"
|
||||
"POT-Creation-Date: 2016-10-13 11:49+0200\n"
|
||||
"PO-Revision-Date: 2016-04-13 18:11+0200\n"
|
||||
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||
@@ -10,7 +10,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.7\n"
|
||||
"X-Generator: Poedit 1.8.9\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
|
||||
"%100==4 ? 2 : 3);\n"
|
||||
@@ -18,22 +18,18 @@ msgstr ""
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
|
||||
#: main.cpp:53
|
||||
#, fuzzy
|
||||
#: main.cpp:102
|
||||
msgid "Show this help message"
|
||||
msgstr "Pokaži to sporočilo pomoči"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:54
|
||||
#, fuzzy
|
||||
#: main.cpp:103
|
||||
msgid "<input file>"
|
||||
msgstr "<vhodna datoteka>"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:55
|
||||
#, fuzzy
|
||||
#: main.cpp:104
|
||||
msgid "<output file>"
|
||||
msgstr "<izhodna datoteka>"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:56
|
||||
#, fuzzy
|
||||
#: main.cpp:105
|
||||
msgid "<output POT catalog>"
|
||||
msgstr "<izhodni katalog POT>"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,33 +1,32 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ZRColaCompile\n"
|
||||
"POT-Creation-Date: 2016-05-13 20:01+0200\n"
|
||||
"PO-Revision-Date: 2016-05-13 20:01+0200\n"
|
||||
"POT-Creation-Date: 2016-10-05 10:59+0200\n"
|
||||
"PO-Revision-Date: 2016-10-05 10:59+0200\n"
|
||||
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||
"Language: de_DE\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.7\n"
|
||||
"X-Generator: Poedit 1.8.9\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
|
||||
#: main.cpp:53
|
||||
#, fuzzy
|
||||
#: main.cpp:56
|
||||
msgid "Show this help message"
|
||||
msgstr "Zeige diesen Hilfstext"
|
||||
|
||||
#: main.cpp:54
|
||||
#: main.cpp:57
|
||||
msgid "<input file>"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:55
|
||||
#: main.cpp:58
|
||||
msgid "<output file>"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:56
|
||||
#: main.cpp:59
|
||||
msgid "<output POT catalog>"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ZRColaCompile\n"
|
||||
"POT-Creation-Date: 2016-05-13 20:01+0200\n"
|
||||
"PO-Revision-Date: 2016-05-13 20:01+0200\n"
|
||||
"POT-Creation-Date: 2016-10-05 11:00+0200\n"
|
||||
"PO-Revision-Date: 2016-10-05 11:00+0200\n"
|
||||
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||
"Language: ru_RU\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.7\n"
|
||||
"X-Generator: Poedit 1.8.9\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
||||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
|
||||
#: main.cpp:53
|
||||
#: main.cpp:56
|
||||
msgid "Show this help message"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:54
|
||||
#: main.cpp:57
|
||||
msgid "<input file>"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:55
|
||||
#: main.cpp:58
|
||||
msgid "<output file>"
|
||||
msgstr ""
|
||||
|
||||
#: main.cpp:56
|
||||
#: main.cpp:59
|
||||
msgid "<output POT catalog>"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ZRColaCompile\n"
|
||||
"POT-Creation-Date: 2016-05-13 20:00+0200\n"
|
||||
"PO-Revision-Date: 2016-05-13 20:00+0200\n"
|
||||
"POT-Creation-Date: 2016-10-05 10:59+0200\n"
|
||||
"PO-Revision-Date: 2016-10-05 11:00+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"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.7\n"
|
||||
"X-Generator: Poedit 1.8.9\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
|
||||
"%100==4 ? 2 : 3);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
|
||||
#: main.cpp:53
|
||||
#: main.cpp:56
|
||||
msgid "Show this help message"
|
||||
msgstr "Pokaži to sporočilo pomoči"
|
||||
|
||||
#: main.cpp:54
|
||||
#: main.cpp:57
|
||||
msgid "<input file>"
|
||||
msgstr "<vhodna datoteka>"
|
||||
|
||||
#: main.cpp:55
|
||||
#: main.cpp:58
|
||||
msgid "<output file>"
|
||||
msgstr "<izhodna datoteka>"
|
||||
|
||||
#: main.cpp:56
|
||||
#: main.cpp:59
|
||||
msgid "<output POT catalog>"
|
||||
msgstr "<izhodni katalog POT>"
|
||||
|
||||
@@ -21,6 +21,79 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace stdex;
|
||||
using namespace winstd;
|
||||
|
||||
|
||||
///
|
||||
/// (destination character rank, (source character rank, source character)) data holder
|
||||
///
|
||||
typedef pair<int, ZRCola::DBSource::charseq> com_translation;
|
||||
|
||||
|
||||
///
|
||||
/// Functor to compare two translations
|
||||
///
|
||||
struct translation_set_less {
|
||||
inline bool operator()(_In_ const com_translation& a, _In_ const com_translation& b) const
|
||||
{
|
||||
if (a.first < b.first ) return true;
|
||||
else if (a.first > b.first ) return false;
|
||||
else if (a.second.rank < b.second.rank) return true;
|
||||
else if (a.second.rank > b.second.rank) return false;
|
||||
else if (a.second.str < b.second.str ) return true;
|
||||
else return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
typedef map<wstring, set<com_translation, translation_set_less> > translation_db;
|
||||
|
||||
|
||||
static set<wstring> translate_inv(_In_ const translation_db &db, _In_z_ const wchar_t *str, _Inout_ set<translation_db::key_type> &path)
|
||||
{
|
||||
set<wstring> res;
|
||||
|
||||
if (*str) {
|
||||
// Inverse translate remainder first.
|
||||
auto rem = translate_inv(db, str + 1, path);
|
||||
if (rem.empty())
|
||||
return res;
|
||||
|
||||
translation_db::key_type _str(1, *str);
|
||||
auto const t = db.find(_str);
|
||||
if (t != db.end()) {
|
||||
// Current characted inverse translated. Iterate all possible inverse translations and combine them with the remainder.
|
||||
auto p = path.insert(_str);
|
||||
if (!p.second) {
|
||||
// Path already contains this character: Cycle detected!
|
||||
return res;
|
||||
}
|
||||
for (auto d = t->second.cbegin(), d_end = t->second.cend(); d != d_end; ++d) {
|
||||
auto src = translate_inv(db, d->second.str.c_str(), path);
|
||||
if (!src.empty()) {
|
||||
for (auto dd = src.cbegin(), dd_end = src.cend(); dd != dd_end; ++dd) {
|
||||
for (auto r = rem.cbegin(), r_end = rem.cend(); r != r_end; ++r)
|
||||
res.insert(*dd + *r);
|
||||
}
|
||||
} else {
|
||||
// Cycle detected. Do not continue inverse translation.
|
||||
for (auto r = rem.cbegin(), r_end = rem.cend(); r != r_end; ++r)
|
||||
res.insert(_str + *r);
|
||||
}
|
||||
}
|
||||
path.erase(p.first);
|
||||
} else {
|
||||
// Current character is non-inverse translatable. Combine it with the remainder(s).
|
||||
for (auto r = rem.cbegin(), r_end = rem.cend(); r != r_end; ++r)
|
||||
res.insert(_str + *r);
|
||||
}
|
||||
} else {
|
||||
// Empty string results in empty inverse translation.
|
||||
res.insert(L"");
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
@@ -30,25 +103,21 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
{
|
||||
wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program");
|
||||
|
||||
// Inizialize wxWidgets.
|
||||
// Initialize wxWidgets.
|
||||
wxInitializer initializer;
|
||||
if (!initializer) {
|
||||
_ftprintf(stderr, wxT("Failed to initialize the wxWidgets library, aborting.\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxConfig config(wxT(ZRCOLA_CFG_APPLICATION), wxT(ZRCOLA_CFG_VENDOR));
|
||||
// Initialize configuration.
|
||||
wxConfigBase *cfgPrev = wxConfigBase::Set(new wxConfig(wxT(PRODUCT_CFG_APPLICATION), wxT(PRODUCT_CFG_VENDOR)));
|
||||
if (cfgPrev) wxDELETE(cfgPrev);
|
||||
|
||||
// Set desired locale.
|
||||
// Initialize locale.
|
||||
wxLocale locale;
|
||||
wxLanguage language = (wxLanguage)config.Read(wxT("Language"), wxLANGUAGE_DEFAULT);
|
||||
if (wxLocale::IsAvailable(language)) {
|
||||
wxString sPath;
|
||||
if (config.Read(wxT("LocalizationRepositoryPath"), &sPath))
|
||||
locale.AddCatalogLookupPathPrefix(sPath);
|
||||
wxVERIFY(locale.Init(language));
|
||||
if (wxInitializeLocale(locale))
|
||||
wxVERIFY(locale.AddCatalog(wxT("ZRColaCompile")));
|
||||
}
|
||||
|
||||
// Parse command line.
|
||||
static const wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
@@ -105,46 +174,74 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
// Open file ID.
|
||||
streamoff dst_start = idrec::open<ZRCola::recordid_t, ZRCola::recordsize_t>(dst, ZRCOLA_DB_ID);
|
||||
|
||||
ZRCola::translation_db db_trans;
|
||||
|
||||
{
|
||||
// Get translations.
|
||||
ATL::CComPtr<ADORecordset> rs;
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectTranslations(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
ZRCola::DBSource::translation trans;
|
||||
ZRCola::translation_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxComp .reserve(count);
|
||||
db.idxDecomp.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Parse translations and build index and data.
|
||||
// Parse translations and build temporary database.
|
||||
translation_db db_temp1;
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read translation from the database.
|
||||
ZRCola::DBSource::translation trans;
|
||||
if (src.GetTranslation(rs, trans)) {
|
||||
// Add translation to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.push_back(trans.chr);
|
||||
wxASSERT_MSG((int)0xffff8000 <= trans.rank && trans.rank <= (int)0x00007fff, wxT("transformation rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)trans.rank);
|
||||
wstring::size_type n = trans.str.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("transformation string too long"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
for (wstring::size_type i = 0; i < n; i++)
|
||||
db.data.push_back(trans.str[i]);
|
||||
db.idxComp .push_back(idx);
|
||||
db.idxDecomp.push_back(idx);
|
||||
// Add translation to temporary database.
|
||||
auto const t = db_temp1.find(trans.dst.str);
|
||||
if (t != db_temp1.end())
|
||||
t->second.insert(com_translation(trans.dst.rank, std::move(trans.src)));
|
||||
else {
|
||||
translation_db::mapped_type d;
|
||||
d.insert(com_translation(trans.dst.rank, std::move(trans.src)));
|
||||
db_temp1.insert(std::move(pair<translation_db::key_type, translation_db::mapped_type>(trans.dst.str, std::move(d))));
|
||||
}
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxComp .sort();
|
||||
db.idxDecomp.sort();
|
||||
// Inverse translate source sequences down to non-inverse translatable characters.
|
||||
translation_db db_temp2;
|
||||
for (auto t1 = db_temp1.cbegin(), t1_end = db_temp1.cend(); t1 != t1_end; ++t1) {
|
||||
for (auto d1 = t1->second.cbegin(), d1_end = t1->second.cend(); d1 != d1_end; ++d1) {
|
||||
set<translation_db::key_type> path;
|
||||
path.insert(t1->first);
|
||||
auto str = translate_inv(db_temp1, d1->second.str.c_str(), path);
|
||||
assert(!str.empty());
|
||||
|
||||
// Write translations to file.
|
||||
dst << ZRCola::translation_rec(db);
|
||||
// Add translation to temporary database.
|
||||
auto const t2 = db_temp2.find(t1->first);
|
||||
if (t2 != db_temp2.end()) {
|
||||
for (auto s = str.cbegin(), s_end = str.cend(); s != s_end; ++s)
|
||||
t2->second.insert(com_translation(d1->first, std::move(ZRCola::DBSource::charseq(d1->second.rank, s->c_str()))));
|
||||
} else {
|
||||
translation_db::mapped_type d2;
|
||||
for (auto s = str.cbegin(), s_end = str.cend(); s != s_end; ++s)
|
||||
d2.insert(com_translation(d1->first, std::move(ZRCola::DBSource::charseq(d1->second.rank, s->c_str()))));
|
||||
db_temp2.insert(std::move(pair<translation_db::key_type, translation_db::mapped_type>(t1->first, std::move(d2))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Preallocate memory.
|
||||
db_trans.idxSrc.reserve(count);
|
||||
db_trans.idxDst.reserve(count);
|
||||
db_trans.data .reserve(count*5);
|
||||
|
||||
// Parse translations and build index and data.
|
||||
ZRCola::DBSource::translation trans;
|
||||
trans.set = 0;
|
||||
for (auto t = db_temp2.cbegin(), t_end = db_temp2.cend(); t != t_end; ++t) {
|
||||
// Add translation to index and data.
|
||||
trans.dst.str = std::move(t->first);
|
||||
for (auto d = t->second.cbegin(), d_end = t->second.cend(); d != d_end; ++d) {
|
||||
trans.dst.rank = d->first;
|
||||
trans.src.rank = d->second.rank;
|
||||
trans.src.str = std::move(d->second.str);
|
||||
db_trans << trans;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0004: Error getting translation count from database or too many translations.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
@@ -155,9 +252,94 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Get translation sets.
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectTranlationSets(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
ZRCola::DBSource::transet ts;
|
||||
ZRCola::transet_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxTranSet.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Add (de)composing translation set to index and data.
|
||||
ts.set = 0;
|
||||
ts.src = L"ZRCola Decomposed";
|
||||
ts.dst = L"ZRCola Composed";
|
||||
db << ts;
|
||||
if (build_pot) {
|
||||
pot.insert(ts.src);
|
||||
pot.insert(ts.dst);
|
||||
}
|
||||
|
||||
// Parse translation sets and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read translation set from the database.
|
||||
if (src.GetTranslationSet(rs, ts)) {
|
||||
if (build_pot) {
|
||||
pot.insert(ts.src);
|
||||
pot.insert(ts.dst);
|
||||
}
|
||||
|
||||
// Add translation set to index and data.
|
||||
db << ts;
|
||||
|
||||
// Get translations.
|
||||
com_obj<ADORecordset> rs_tran;
|
||||
if (src.SelectTranslations(ts.set, rs_tran)) {
|
||||
size_t count = src.GetRecordsetCount(rs_tran);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
// Parse translations and build temporary database.
|
||||
ZRCola::DBSource::translation trans;
|
||||
trans.set = ts.set;
|
||||
for (; !ZRCola::DBSource::IsEOF(rs_tran); rs_tran->MoveNext()) {
|
||||
// Read translation from the database.
|
||||
if (src.GetTranslation(rs_tran, trans)) {
|
||||
// Add translation to index and data.
|
||||
db_trans << trans;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0004: Error getting translation count from database or too many translations.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0003: Error getting translations from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxTranSet.sort();
|
||||
|
||||
// Write translation sets to file.
|
||||
dst << ZRCola::transet_rec(db);
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0009: Error getting translation set count from database or too many translation sets.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0008: Error getting translation sets from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db_trans.idxSrc.sort();
|
||||
db_trans.idxDst.sort();
|
||||
|
||||
// Write translations to file.
|
||||
dst << ZRCola::translation_rec(db_trans);
|
||||
|
||||
{
|
||||
// Get key sequences.
|
||||
ATL::CComPtr<ADORecordset> rs;
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectKeySequences(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
@@ -174,21 +356,7 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
// Read key sequence from the database.
|
||||
if (src.GetKeySequence(rs, ks)) {
|
||||
// Add key sequence to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.push_back(ks.chr);
|
||||
vector<ZRCola::DBSource::keyseq::keycode>::size_type n = ks.seq.size();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("key sequence too long"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
for (vector<ZRCola::DBSource::keyseq::keycode>::size_type i = 0; i < n; i++) {
|
||||
const ZRCola::DBSource::keyseq::keycode &kc = ks.seq[i];
|
||||
db.data.push_back(kc.key);
|
||||
db.data.push_back(
|
||||
(kc.shift ? ZRCola::keyseq_db::keyseq::SHIFT : 0) |
|
||||
(kc.ctrl ? ZRCola::keyseq_db::keyseq::CTRL : 0) |
|
||||
(kc.alt ? ZRCola::keyseq_db::keyseq::ALT : 0));
|
||||
}
|
||||
db.idxChr.push_back(idx);
|
||||
db.idxKey.push_back(idx);
|
||||
db << ks;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
@@ -203,10 +371,14 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
&ks1 = db.idxKey[i - 1],
|
||||
&ks2 = db.idxKey[i ];
|
||||
|
||||
if (ZRCola::keyseq_db::keyseq::CompareSequence(ks1.seq, ks1.seq_len, ks2.seq, ks2.seq_len) == 0) {
|
||||
if (ZRCola::keyseq_db::keyseq::CompareSequence(ks1.seq(), ks1.seq_len(), ks2.seq(), ks2.seq_len()) == 0) {
|
||||
wxString seq_str;
|
||||
ZRCola::keyseq_db::GetSequenceAsText(ks1.seq, ks1.seq_len, seq_str);
|
||||
_ftprintf(stderr, wxT("%s: warning ZCC0007: Duplicate key sequence (%ls => %04X or %04X). The keyboard behaviour will be unpredictable.\n"), (LPCTSTR)filenameIn.c_str(), seq_str.c_str(), ks1.chr, ks2.chr);
|
||||
ZRCola::keyseq_db::GetSequenceAsText(ks1.seq(), ks1.seq_len(), seq_str);
|
||||
_ftprintf(stderr, wxT("%s: warning ZCC0007: Duplicate key sequence (%ls => %s or %s). The keyboard behaviour will be unpredictable.\n"),
|
||||
(LPCTSTR)filenameIn.c_str(),
|
||||
seq_str.c_str(),
|
||||
ZRCola::GetUnicodeDump(ks1.chr(), ks1.chr_len()).c_str(),
|
||||
ZRCola::GetUnicodeDump(ks2.chr(), ks2.chr_len()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +396,7 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
|
||||
{
|
||||
// Get languages.
|
||||
ATL::CComPtr<ADORecordset> rs;
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectLanguages(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
@@ -232,8 +404,8 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
ZRCola::language_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxLng.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
db.idxLang.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Parse languages and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
@@ -243,21 +415,13 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
pot.insert(lang.name);
|
||||
|
||||
// Add language to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
for (wstring::size_type i = 0; i < sizeof(ZRCola::langid_t)/sizeof(unsigned __int16); i++)
|
||||
db.data.push_back(((const unsigned __int16*)lang.id.data)[i]);
|
||||
wstring::size_type n = lang.name.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("language name too long"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
for (wstring::size_type i = 0; i < n; i++)
|
||||
db.data.push_back(lang.name[i]);
|
||||
db.idxLng.push_back(idx);
|
||||
db << lang;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxLng.sort();
|
||||
db.idxLang.sort();
|
||||
|
||||
// Write languages to file.
|
||||
dst << ZRCola::language_rec(db);
|
||||
@@ -273,7 +437,7 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
|
||||
{
|
||||
// Get language characters.
|
||||
ATL::CComPtr<ADORecordset> rs;
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectLanguageCharacters(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
@@ -281,25 +445,18 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
ZRCola::langchar_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxChr.reserve(count);
|
||||
db.idxChr .reserve(count);
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
db.idxLng.reserve(count);
|
||||
db.idxLang.reserve(count);
|
||||
#endif
|
||||
db.data .reserve(count*4);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Parse language characters and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read language characters from the database.
|
||||
if (src.GetLanguageCharacter(rs, lc)) {
|
||||
// Add language characters to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.push_back(lc.chr);
|
||||
for (wstring::size_type i = 0; i < sizeof(ZRCola::langid_t)/sizeof(unsigned __int16); i++)
|
||||
db.data.push_back(((const unsigned __int16*)lc.lang.data)[i]);
|
||||
db.idxChr.push_back(idx);
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
db.idxLng.push_back(idx);
|
||||
#endif
|
||||
db << lc;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
@@ -307,7 +464,7 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
// Sort indices.
|
||||
db.idxChr .sort();
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
db.idxLng.sort();
|
||||
db.idxLang.sort();
|
||||
#endif
|
||||
|
||||
// Write language characters to file.
|
||||
@@ -324,7 +481,7 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
|
||||
{
|
||||
// Get character groups.
|
||||
ATL::CComPtr<ADORecordset> rs;
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectCharacterGroups(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
@@ -332,8 +489,8 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
ZRCola::chrgrp_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxRnk.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
db.idxRank.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Parse character groups and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
@@ -348,30 +505,13 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
}
|
||||
|
||||
// Add character group to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= cg.id && cg.id <= (int)0x00007fff, wxT("character group ID out of bounds"));
|
||||
db.data.push_back((unsigned __int16)cg.id);
|
||||
wxASSERT_MSG((int)0xffff8000 <= cg.rank && cg.rank <= (int)0x00007fff, wxT("character group rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)cg.rank);
|
||||
wstring::size_type n_name = cg.name.length();
|
||||
wxASSERT_MSG(n_name <= 0xffff, wxT("character group name too long"));
|
||||
db.data.push_back((unsigned __int16)n_name);
|
||||
wstring::size_type n_char = cg.chars.length();
|
||||
wxASSERT_MSG(n_char <= 0xffff, wxT("too many character group characters"));
|
||||
db.data.push_back((unsigned __int16)n_char);
|
||||
for (wstring::size_type i = 0; i < n_name; i++)
|
||||
db.data.push_back(cg.name[i]);
|
||||
for (wstring::size_type i = 0; i < n_char; i++)
|
||||
db.data.push_back(cg.chars[i]);
|
||||
for (std::vector<unsigned __int16>::size_type i = 0, n = cg.show.size(); i < n; i++)
|
||||
db.data.push_back(cg.show[i]);
|
||||
db.idxRnk.push_back(idx);
|
||||
db << cg;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxRnk.sort();
|
||||
db.idxRank.sort();
|
||||
|
||||
// Write character groups to file.
|
||||
dst << ZRCola::chrgrp_rec(db);
|
||||
@@ -389,22 +529,21 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
|
||||
{
|
||||
// Get characters.
|
||||
ATL::CComPtr<ADORecordset> rs;
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectCharacters(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
ZRCola::DBSource::character_desc_idx idxChrDsc, idxChrDscSub;
|
||||
|
||||
ZRCola::DBSource::character_bank chrs;
|
||||
ZRCola::DBSource::character chr;
|
||||
|
||||
// Phase 1: Parse characters and build indexes.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read character from the database.
|
||||
unique_ptr<ZRCola::DBSource::character> c(new ZRCola::DBSource::character);
|
||||
if (src.GetCharacter(rs, *c)) {
|
||||
const ZRCola::DBSource::character &chr = *c.get();
|
||||
chrs[chr.chr].swap(c);
|
||||
} else
|
||||
if (src.GetCharacter(rs, chr))
|
||||
chrs[chr.first] = std::move(chr.second);
|
||||
else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
@@ -418,33 +557,16 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Phase 3: Parse characters and build index and data.
|
||||
for (size_t i = 0, i_end = chrs.size(); i < i_end; i++) {
|
||||
const ZRCola::DBSource::character &chr = *(chrs[i].get());
|
||||
if (&chr == NULL) continue;
|
||||
|
||||
for (auto chr = chrs.cbegin(), chr_end = chrs.cend(); chr != chr_end; ++chr) {
|
||||
// Add character to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
db.data.push_back((unsigned __int16)chr.chr);
|
||||
for (wstring::size_type i = 0; i < sizeof(ZRCola::chrcatid_t)/sizeof(unsigned __int16); i++)
|
||||
db.data.push_back(((const unsigned __int16*)chr.cat.data)[i]);
|
||||
wstring::size_type n_desc = chr.desc.length();
|
||||
wxASSERT_MSG(n_desc <= 0xffff, wxT("character description too long"));
|
||||
db.data.push_back((unsigned __int16)n_desc);
|
||||
wstring::size_type n_rel = chr.rel.length();
|
||||
wxASSERT_MSG(n_rel <= 0xffff, wxT("too many related characters"));
|
||||
db.data.push_back((unsigned __int16)n_rel);
|
||||
for (wstring::size_type i = 0; i < n_desc; i++)
|
||||
db.data.push_back(chr.desc[i]);
|
||||
for (wstring::size_type i = 0; i < n_rel; i++)
|
||||
db.data.push_back(chr.rel[i]);
|
||||
db.idxChr.push_back(idx);
|
||||
db << *chr;
|
||||
|
||||
// Add description (and keywords) to index.
|
||||
idxChrDsc .add_keywords(chr.terms, chr.chr, 0);
|
||||
idxChrDscSub.add_keywords(chr.terms, chr.chr, 3);
|
||||
idxChrDsc .add_keywords(chr->second.terms, chr->first, 0);
|
||||
idxChrDscSub.add_keywords(chr->second.terms, chr->first, 3);
|
||||
|
||||
// Mark category used.
|
||||
categories_used.insert(chr.cat);
|
||||
categories_used.insert(chr->second.cat);
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
@@ -468,7 +590,7 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
|
||||
{
|
||||
// Get character categories.
|
||||
ATL::CComPtr<ADORecordset> rs;
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectCharacterCategories(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
@@ -477,7 +599,7 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxChrCat.reserve(count);
|
||||
db.idxRnk .reserve(count);
|
||||
db.idxRank .reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Parse character categories and build index and data.
|
||||
@@ -487,31 +609,20 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
if (build_pot)
|
||||
pot.insert(cc.name);
|
||||
|
||||
if (categories_used.find(cc.id) == categories_used.end()) {
|
||||
if (categories_used.find(cc.cat) == categories_used.end()) {
|
||||
// Skip empty character categories.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add character category to index and data.
|
||||
unsigned __int32 idx = db.data.size();
|
||||
for (wstring::size_type i = 0; i < sizeof(ZRCola::chrcatid_t)/sizeof(unsigned __int16); i++)
|
||||
db.data.push_back(((const unsigned __int16*)cc.id.data)[i]);
|
||||
wxASSERT_MSG((int)0xffff8000 <= cc.rank && cc.rank <= (int)0x00007fff, wxT("character category rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)cc.rank);
|
||||
wstring::size_type n_name = cc.name.length();
|
||||
wxASSERT_MSG(n_name <= 0xffff, wxT("character category name too long"));
|
||||
db.data.push_back((unsigned __int16)n_name);
|
||||
for (wstring::size_type i = 0; i < n_name; i++)
|
||||
db.data.push_back(cc.name[i]);
|
||||
db.idxChrCat.push_back(idx);
|
||||
db.idxRnk .push_back(idx);
|
||||
db << cc;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxChrCat.sort();
|
||||
db.idxRnk .sort();
|
||||
db.idxRank .sort();
|
||||
|
||||
// Write character categories to file.
|
||||
dst << ZRCola::chrcat_rec(db);
|
||||
@@ -525,6 +636,86 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Get characters tags.
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectCharacterTags(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
ZRCola::DBSource::chrtag ct;
|
||||
ZRCola::chrtag_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxChr.reserve(count);
|
||||
db.idxTag.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
|
||||
// Parse characters tags and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read characters tags from the database.
|
||||
if (src.GetCharacterTag(rs, ct)) {
|
||||
// Add characters tags to index and data.
|
||||
db << ct;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxChr.sort();
|
||||
db.idxTag.sort();
|
||||
|
||||
// Write characters tags to file.
|
||||
dst << ZRCola::chrtag_rec(db);
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0021: Error getting characters tags count from database or too many character tags.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0020: Error getting characters tags from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Get tag names.
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectTagNames(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
ZRCola::DBSource::tagname tn;
|
||||
ZRCola::tagname_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxName.reserve(count*3);
|
||||
db.idxTag .reserve(count*3);
|
||||
db.data .reserve(count*3*4);
|
||||
|
||||
// Parse tags and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read tag name from the database.
|
||||
if (src.GetTagName(rs, tn)) {
|
||||
// Add tag name to index and data.
|
||||
db << tn;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxName.sort();
|
||||
db.idxTag .sort();
|
||||
|
||||
// Write tags to file.
|
||||
dst << ZRCola::tagname_rec(db);
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0023: Error getting tag name count from database or too many tags.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0022: Error getting tags from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
idrec::close<ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>(dst, dst_start);
|
||||
|
||||
if (dst.fail()) {
|
||||
@@ -543,10 +734,10 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
<< "\"MIME-Version: 1.0\\n\"" << endl
|
||||
<< "\"Content-Type: text/plain; charset=UTF-8\\n\"" << endl
|
||||
<< "\"Content-Transfer-Encoding: 8bit\\n\"" << endl
|
||||
<< "\"X-Generator: ZRColaCompile " << ZRCOLA_VERSION_STR << "\\n\"" << endl;
|
||||
<< "\"X-Generator: ZRColaCompile\\n\"" << endl;
|
||||
|
||||
wstring_convert<codecvt_utf8<wchar_t>> conv;
|
||||
for (set<wstring>::const_iterator i = pot.cbegin(); i != pot.cend(); ++i) {
|
||||
for (auto i = pot.cbegin(); i != pot.cend(); ++i) {
|
||||
// Convert UTF-16 to UTF-8 and escape.
|
||||
string t(conv.to_bytes(*i)), u;
|
||||
for (size_t i = 0, n = t.size(); i < n; i++) {
|
||||
|
||||
@@ -19,16 +19,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define _ATL_NO_AUTOMATIC_NAMESPACE
|
||||
|
||||
#include "../include/zrcola.h"
|
||||
#include "../include/version.h"
|
||||
#include "dbsource.h"
|
||||
|
||||
#include <zrcola/language.h>
|
||||
#include <zrcola/translate.h>
|
||||
#include <zrcolaui/chargroup.h>
|
||||
#include <zrcolaui/keyboard.h>
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/config.h>
|
||||
@@ -39,11 +32,13 @@
|
||||
|
||||
#include <stdex/idrec.h>
|
||||
|
||||
#include <WinStd/Common.h>
|
||||
|
||||
#include <initguid.h> // GUID helper to prevent LNK2001 errors (unresolved external symbol IID_IADO...)
|
||||
#include <adoint.h>
|
||||
#include <adoid.h>
|
||||
#include <atlcomcli.h>
|
||||
|
||||
#include <process.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -7,12 +7,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libZRCola", "lib\libZRCola\
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ECE3F336-FFD2-41EE-AD8F-17BD7472BDCB}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
include\zrcola.h = include\zrcola.h
|
||||
include\version.h = include\version.h
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaCompile", "ZRColaCompile\ZRColaCompile.vcxproj", "{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtend", "lib\wxExtend\build\wxExtend.vcxproj", "{A3A36689-AC35-4026-93DA-A3BA0C0E767C}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtend", "lib\wxExtend\build\wxExtendDll.vcxproj", "{A3A36689-AC35-4026-93DA-A3BA0C0E767C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stdex", "lib\stdex\build\stdex.vcxproj", "{518777CC-0A59-4415-A12A-82751ED75343}"
|
||||
EndProject
|
||||
@@ -28,6 +28,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaInstallEn", "ZRColaIn
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaInstallRu", "ZRColaInstall\ZRColaInstallRu.vcxproj", "{2551B561-5E5B-497E-AE01-11519F91EF19}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinStd", "lib\WinStd\build\WinStd.vcxproj", "{47399D91-7EB9-41DE-B521-514BA5DB0C43}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -98,6 +100,14 @@ Global
|
||||
{2551B561-5E5B-497E-AE01-11519F91EF19}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2551B561-5E5B-497E-AE01-11519F91EF19}.Release|Win32.Build.0 = Release|Win32
|
||||
{2551B561-5E5B-497E-AE01-11519F91EF19}.Release|x64.ActiveCfg = Release|Win32
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x64.Build.0 = Debug|x64
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|Win32.Build.0 = Release|Win32
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.ActiveCfg = Release|x64
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -107,6 +117,7 @@ Global
|
||||
{A3A36689-AC35-4026-93DA-A3BA0C0E767C} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F}
|
||||
{518777CC-0A59-4415-A12A-82751ED75343} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F}
|
||||
{C0A84BD2-3870-4CD6-B281-0AB322E3C579} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F}
|
||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F}
|
||||
{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A} = {7F5D45A3-B3D2-4B1D-B258-9B83395786E6}
|
||||
{620D6AC0-C8FF-4185-B820-DB1503ACB95C} = {7F5D45A3-B3D2-4B1D-B258-9B83395786E6}
|
||||
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4} = {7F5D45A3-B3D2-4B1D-B258-9B83395786E6}
|
||||
|
||||
3541
bin/ZRCUpdate.wsf
@@ -26,30 +26,10 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "zrcola.h"
|
||||
#include "version.h"
|
||||
|
||||
//
|
||||
// Update server(s)
|
||||
@@ -15,22 +15,3 @@
|
||||
// Update server catalog location
|
||||
//
|
||||
#define UPDATER_HTTP_PATH "/prenos/ZRCola/catalog-0000.xml"
|
||||
|
||||
|
||||
//
|
||||
// The product vendor and application name for configuration keeping.
|
||||
//
|
||||
#define UPDATER_CFG_VENDOR "Amebis"
|
||||
#define UPDATER_CFG_APPLICATION "ZRCola"
|
||||
|
||||
|
||||
//
|
||||
// Product version as a single DWORD
|
||||
// Note: Used for version comparison within C/C++ code.
|
||||
//
|
||||
#define UPDATER_PRODUCT_VERSION ZRCOLA_VERSION
|
||||
|
||||
//
|
||||
// Human readable product version and build year for UI
|
||||
//
|
||||
#define UPDATER_PRODUCT_VERSION_STR ZRCOLA_VERSION_STR
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="xgettext.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<UpdaterVersion>ZRCola</UpdaterVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IntDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
||||
<_PropertySheetDisplayName>ZRCola Common</_PropertySheetDisplayName>
|
||||
<OutDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</OutDir>
|
||||
<IntDir>temp\$(MSBuildProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
||||
<OutDir>temp\$(MSBuildProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</OutDir>
|
||||
<IncludePath>$(WXWIN)\include\msvc;$(WXWIN)\include;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(WXWIN)\src\aui;$(WXWIN)\src\cocoa;$(WXWIN)\src\common;$(WXWIN)\src\dfb;$(WXWIN)\src\expat;$(WXWIN)\src\generic;$(WXWIN)\src\gtk;$(WXWIN)\src\gtk1;$(WXWIN)\src\html;$(WXWIN)\src\jpeg;$(WXWIN)\src\motif;$(WXWIN)\src\msdos;$(WXWIN)\src\msw;$(WXWIN)\src\os2;$(WXWIN)\src\osx;$(WXWIN)\src\png;$(WXWIN)\src\propgrid;$(WXWIN)\src\regex;$(WXWIN)\src\ribbon;$(WXWIN)\src\richtext;$(WXWIN)\src\stc;$(WXWIN)\src\tiff;$(WXWIN)\src\univ;$(WXWIN)\src\unix;$(WXWIN)\src\x11;$(WXWIN)\src\xml;$(WXWIN)\src\xrc;$(WXWIN)\src\zlib;$(SourcePath)</SourcePath>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// Product version as a single DWORD
|
||||
// Note: Used for version comparison within C/C++ code.
|
||||
//
|
||||
#define ZRCOLA_VERSION 0x01ff0f00
|
||||
#define PRODUCT_VERSION 0x02000100
|
||||
|
||||
//
|
||||
// Product version by components
|
||||
@@ -31,31 +31,31 @@
|
||||
// thus we need to specify major, minor and other version components
|
||||
// separately.
|
||||
//
|
||||
#define ZRCOLA_VERSION_MAJ 1
|
||||
#define ZRCOLA_VERSION_MIN 255
|
||||
#define ZRCOLA_VERSION_REV 15
|
||||
#define ZRCOLA_VERSION_BUILD 0
|
||||
#define PRODUCT_VERSION_MAJ 2
|
||||
#define PRODUCT_VERSION_MIN 0
|
||||
#define PRODUCT_VERSION_REV 1
|
||||
#define PRODUCT_VERSION_BUILD 0
|
||||
|
||||
//
|
||||
// Human readable product version and build year for UI
|
||||
//
|
||||
#define ZRCOLA_VERSION_STR "2.0-beta7"
|
||||
#define ZRCOLA_BUILD_YEAR_STR "2016"
|
||||
#define PRODUCT_VERSION_STR "2.1-beta1"
|
||||
#define PRODUCT_BUILD_YEAR_STR "2017"
|
||||
|
||||
//
|
||||
// Numerical version presentation for ProductVersion propery in
|
||||
// MSI packages (syntax: N.N[.N[.N]])
|
||||
//
|
||||
#define ZRCOLA_VERSION_INST "1.255.15"
|
||||
#define PRODUCT_VERSION_INST "2.0.1"
|
||||
|
||||
//
|
||||
// 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 "{6FD2DCFC-2044-44E6-B9A1-CBCAA9A187F2}"
|
||||
#define PRODUCT_VERSION_GUID "{8ABE00FD-2325-4FD1-ADDE-FCF996B31636}"
|
||||
|
||||
//
|
||||
// The product vendor and application name for configuration keeping.
|
||||
//
|
||||
#define ZRCOLA_CFG_VENDOR "Amebis"
|
||||
#define ZRCOLA_CFG_APPLICATION "ZRCola"
|
||||
#define PRODUCT_CFG_VENDOR "Amebis"
|
||||
#define PRODUCT_CFG_APPLICATION "ZRCola"
|
||||
@@ -38,7 +38,7 @@
|
||||
<ItemGroup Condition="'@(SelectedFiles)' != ''">
|
||||
<POCompile Remove="@(POCompile)" Condition="'%(Identity)' != '@(SelectedFiles)'" />
|
||||
</ItemGroup>
|
||||
<Message Text="Compiling localization catalogues..." />
|
||||
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName('%(POCompile.OutputFile)'))"/>
|
||||
<POCompile
|
||||
Condition="'@(POCompile)' != '' and '%(POCompile.ExcludedFromBuild)' != 'true'"
|
||||
Inputs="@(POCompile)"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\character.cpp" />
|
||||
<ClCompile Include="..\src\common.cpp" />
|
||||
<ClCompile Include="..\src\language.cpp" />
|
||||
<ClCompile Include="..\src\mapping.cpp" />
|
||||
<ClCompile Include="..\src\normalize.cpp" />
|
||||
@@ -29,6 +30,7 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\tag.cpp" />
|
||||
<ClCompile Include="..\src\translate.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -36,6 +38,7 @@
|
||||
<ClInclude Include="..\include\zrcola\common.h" />
|
||||
<ClInclude Include="..\include\zrcola\language.h" />
|
||||
<ClInclude Include="..\include\zrcola\normalize.h" />
|
||||
<ClInclude Include="..\include\zrcola\tag.h" />
|
||||
<ClInclude Include="..\include\zrcola\translate.h" />
|
||||
<ClInclude Include="..\src\stdafx.h" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
<ClCompile Include="..\src\character.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\common.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\tag.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\stdafx.h">
|
||||
@@ -53,6 +59,9 @@
|
||||
<ClInclude Include="..\include\zrcola\character.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\zrcola\tag.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\res\libZRCola.rc">
|
||||
|
||||
@@ -41,11 +41,13 @@ namespace ZRCola {
|
||||
///
|
||||
typedef double charrank_t;
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(2)
|
||||
///
|
||||
/// Character category ID type
|
||||
/// Two letter abbreviation, non-terminated
|
||||
///
|
||||
struct chrcatid_t {
|
||||
struct ZRCOLA_API chrcatid_t {
|
||||
char data[2];
|
||||
|
||||
inline chrcatid_t& operator=(const chrcatid_t &src)
|
||||
@@ -60,13 +62,13 @@ namespace ZRCola {
|
||||
data[1] = (data[0] = src[0]) != 0 ? src[1] : 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
///
|
||||
/// Blank character category
|
||||
///
|
||||
static const chrcatid_t blank;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Blank character category
|
||||
///
|
||||
const chrcatid_t chrcatid_t_blank = {};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
///
|
||||
@@ -181,18 +183,73 @@ namespace ZRCola {
|
||||
/// Character data
|
||||
///
|
||||
struct character {
|
||||
wchar_t chr; ///> Character
|
||||
chrcatid_t cat; ///> Category ID
|
||||
unsigned __int16 desc_len; ///< Character description length in \c data
|
||||
unsigned __int16 rel_len; ///< Related character count in \c data
|
||||
wchar_t data[]; ///< Character description and list of related characters
|
||||
public:
|
||||
chrcatid_t cat; ///> Character category ID
|
||||
|
||||
protected:
|
||||
unsigned __int16 chr_to; ///< Character end in \c data
|
||||
unsigned __int16 desc_to; ///< Character description end in \c data
|
||||
unsigned __int16 rel_to; ///< Related characters end in \c data
|
||||
wchar_t data[]; ///< Character, character description
|
||||
|
||||
private:
|
||||
inline character(_In_ const character &other);
|
||||
inline character& operator=(_In_ const character &other);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs the character
|
||||
///
|
||||
/// \param[in] chr Character
|
||||
/// \param[in] chr_len Number of UTF-16 characters in \p chr
|
||||
/// \param[in] cat Category
|
||||
/// \param[in] desc Description
|
||||
/// \param[in] desc_len Number of UTF-16 characters in \p desc
|
||||
/// \param[in] rel Related characters list (zero delimited)
|
||||
/// \param[in] rel_len Number of UTF-16 characters in \p rel (including zero delimiters)
|
||||
///
|
||||
inline character(
|
||||
_In_opt_z_count_(chr_len) const wchar_t *chr = NULL,
|
||||
_In_opt_ size_t chr_len = 0,
|
||||
_In_opt_ chrcatid_t cat = chrcatid_t::blank,
|
||||
_In_opt_z_count_(desc_len) const wchar_t *desc = NULL,
|
||||
_In_opt_ size_t desc_len = 0,
|
||||
_In_opt_z_count_(rel_len) const wchar_t *rel = NULL,
|
||||
_In_opt_ size_t rel_len = 0)
|
||||
{
|
||||
this->cat = cat;
|
||||
this->chr_to = static_cast<unsigned __int16>(chr_len);
|
||||
if (chr_len) memcpy(this->data, chr, sizeof(wchar_t)*chr_len);
|
||||
this->desc_to = static_cast<unsigned __int16>(this->chr_to + desc_len);
|
||||
if (desc_len) memcpy(this->data + this->chr_to, desc, sizeof(wchar_t)*desc_len);
|
||||
this->rel_to = static_cast<unsigned __int16>(this->desc_to + rel_len);
|
||||
if (rel_len) memcpy(this->data + this->desc_to, rel, sizeof(wchar_t)*rel_len);
|
||||
}
|
||||
|
||||
inline const wchar_t* chr () const { return data; };
|
||||
inline wchar_t* chr () { return data; };
|
||||
inline const wchar_t* chr_end() const { return data + chr_to; };
|
||||
inline wchar_t* chr_end() { return data + chr_to; };
|
||||
inline unsigned __int16 chr_len() const { return chr_to; };
|
||||
|
||||
inline const wchar_t* desc () const { return data + chr_to; };
|
||||
inline wchar_t* desc () { return data + chr_to; };
|
||||
inline const wchar_t* desc_end() const { return data + desc_to; };
|
||||
inline wchar_t* desc_end() { return data + desc_to; };
|
||||
inline unsigned __int16 desc_len() const { return desc_to - chr_to; };
|
||||
|
||||
inline const wchar_t* rel () const { return data + desc_to; };
|
||||
inline wchar_t* rel () { return data + desc_to; };
|
||||
inline const wchar_t* rel_end() const { return data + rel_to; };
|
||||
inline wchar_t* rel_end() { return data + rel_to; };
|
||||
inline unsigned __int16 rel_len() const { return rel_to - desc_to; };
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
///
|
||||
/// Character index
|
||||
///
|
||||
class indexChar : public index<unsigned __int16, unsigned __int32, character>
|
||||
class indexChr : public index<unsigned __int16, unsigned __int32, character>
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -200,7 +257,7 @@ namespace ZRCola {
|
||||
///
|
||||
/// \param[in] h Reference to vector holding the data
|
||||
///
|
||||
indexChar(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, character>(h) {}
|
||||
indexChr(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, character>(h) {}
|
||||
|
||||
///
|
||||
/// Compares two characters by ID (for searching)
|
||||
@@ -215,8 +272,8 @@ namespace ZRCola {
|
||||
///
|
||||
virtual int compare(_In_ const character &a, _In_ const character &b) const
|
||||
{
|
||||
if (a.chr < b.chr) return -1;
|
||||
else if (a.chr > b.chr) return 1;
|
||||
int r = ZRCola::CompareString(a.chr(), a.chr_len(), b.chr(), b.chr_len());
|
||||
if (r != 0) return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -232,6 +289,17 @@ namespace ZRCola {
|
||||
///
|
||||
inline character_db() : idxChr(data) {}
|
||||
|
||||
///
|
||||
/// Clears the database
|
||||
///
|
||||
inline void clear()
|
||||
{
|
||||
idxChr .clear();
|
||||
idxDsc .clear();
|
||||
idxDscSub.clear();
|
||||
data .clear();
|
||||
}
|
||||
|
||||
///
|
||||
/// Search for characters by description in given categories
|
||||
///
|
||||
@@ -239,26 +307,28 @@ namespace ZRCola {
|
||||
/// \param[in ] cats Set of categories, character must be a part of
|
||||
/// \param[inout] hits (character, count) map to append full-word hits to
|
||||
/// \param[inout] hits_sub (character, count) map to append partial-word hits to
|
||||
/// \param[in] fn_abort Pointer to function to periodically test for search cancellation
|
||||
/// \param[in] cookie Cookie for \p fn_abort call
|
||||
/// \param[in ] fn_abort Pointer to function to periodically test for search cancellation
|
||||
/// \param[in ] cookie Cookie for \p fn_abort call
|
||||
///
|
||||
bool Search(_In_z_ const wchar_t *str, _In_ const std::set<chrcatid_t> &cats, _Inout_ std::map<wchar_t, charrank_t> &hits, _Inout_ std::map<wchar_t, charrank_t> &hits_sub, _In_opt_ bool (__cdecl *fn_abort)(void *cookie) = NULL, _In_opt_ void *cookie = NULL) const;
|
||||
bool Search(_In_z_ const wchar_t *str, _In_ const std::set<chrcatid_t> &cats, _Inout_ std::map<std::wstring, charrank_t> &hits, _Inout_ std::map<std::wstring, charrank_t> &hits_sub, _In_opt_ bool (__cdecl *fn_abort)(void *cookie) = NULL, _In_opt_ void *cookie = NULL) const;
|
||||
|
||||
///
|
||||
/// Get character category
|
||||
///
|
||||
/// \param[in] c Character
|
||||
/// \param[in] chr Character
|
||||
/// \param[in] len Number of UTF-16 characters in \p chr
|
||||
///
|
||||
/// \returns
|
||||
/// - Character category if character found
|
||||
/// - `ZRCola::chrcatid_t_blank` otherwise
|
||||
/// - `ZRCola::chrcatid_t::blank` otherwise
|
||||
///
|
||||
inline chrcatid_t GetCharCat(wchar_t c) const
|
||||
inline chrcatid_t GetCharCat(_In_z_count_(len) const wchar_t *chr, _In_ const size_t len) const
|
||||
{
|
||||
char _chr[sizeof(character)];
|
||||
((character *)_chr)->chr = c;
|
||||
indexChar::size_type start;
|
||||
return idxChr.find(*((character *)_chr), start) ? idxChr[start].cat : chrcatid_t_blank;
|
||||
assert(len <= 0xffff);
|
||||
std::unique_ptr<character> c((character*)new char[sizeof(character) + sizeof(wchar_t)*len]);
|
||||
c->character::character(chr, len);
|
||||
indexChr::size_type start;
|
||||
return idxChr.find(*c, start) ? idxChr[start].cat : chrcatid_t::blank;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -277,10 +347,44 @@ namespace ZRCola {
|
||||
/// Character category data
|
||||
///
|
||||
struct chrcat {
|
||||
chrcatid_t id; ///< Character category ID
|
||||
unsigned __int16 rank; ///< Character category rank
|
||||
unsigned __int16 name_len; ///< \c name length (in characters)
|
||||
wchar_t name[]; ///< Character category name
|
||||
public:
|
||||
chrcatid_t cat; ///< Character category ID
|
||||
unsigned __int16 rank; ///< Character category rank
|
||||
|
||||
protected:
|
||||
unsigned __int16 name_to; ///< Character category name end in \c data
|
||||
wchar_t data[]; ///< Character category name
|
||||
|
||||
private:
|
||||
inline chrcat(_In_ const chrcat &other);
|
||||
inline chrcat& operator=(_In_ const chrcat &other);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs the character category
|
||||
///
|
||||
/// \param[in] cat Character category ID
|
||||
/// \param[in] rank Character category rank
|
||||
/// \param[in] name Character category name
|
||||
/// \param[in] name_len Number of UTF-16 characters in \p name
|
||||
///
|
||||
inline chrcat(
|
||||
_In_opt_ chrcatid_t cat = chrcatid_t::blank,
|
||||
_In_opt_ unsigned __int16 rank = 0,
|
||||
_In_opt_z_count_(name_len) const wchar_t *name = NULL,
|
||||
_In_opt_ size_t name_len = 0)
|
||||
{
|
||||
this->cat = cat;
|
||||
this->rank = rank;
|
||||
this->name_to = static_cast<unsigned __int16>(name_len);
|
||||
if (name_len) memcpy(this->data, name, sizeof(wchar_t)*name_len);
|
||||
}
|
||||
|
||||
inline const wchar_t* name () const { return data; };
|
||||
inline wchar_t* name () { return data; };
|
||||
inline const wchar_t* name_end() const { return data + name_to; };
|
||||
inline wchar_t* name_end() { return data + name_to; };
|
||||
inline unsigned __int16 name_len() const { return name_to; };
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -310,11 +414,12 @@ namespace ZRCola {
|
||||
///
|
||||
virtual int compare(_In_ const chrcat &a, _In_ const chrcat &b) const
|
||||
{
|
||||
if (a.id < b.id) return -1;
|
||||
else if (a.id > b.id) return 1;
|
||||
else return 0;
|
||||
if (a.cat < b.cat) return -1;
|
||||
else if (a.cat > b.cat) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
} idxChrCat; ///< Character category index
|
||||
} idxChrCat; ///< Character category index
|
||||
|
||||
///
|
||||
/// Rank index
|
||||
@@ -364,14 +469,17 @@ namespace ZRCola {
|
||||
if (a.rank < b.rank) return -1;
|
||||
else if (a.rank > b.rank) return +1;
|
||||
|
||||
int r = _wcsncoll(a.name, b.name, std::min<unsigned __int16>(a.name_len, b.name_len));
|
||||
unsigned __int16
|
||||
a_name_len = a.name_len(),
|
||||
b_name_len = b.name_len();
|
||||
int r = _wcsncoll(a.name(), b.name(), std::min<unsigned __int16>(a_name_len, b_name_len));
|
||||
if (r != 0) return r;
|
||||
if (a.name_len < b.name_len) return -1;
|
||||
else if (a.name_len > b.name_len) return +1;
|
||||
if (a_name_len < b_name_len) return -1;
|
||||
else if (a_name_len > b_name_len) return +1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
} idxRnk; ///< Rank index
|
||||
} idxRank; ///< Rank index
|
||||
|
||||
std::vector<unsigned __int16> data; ///< Character category data
|
||||
|
||||
@@ -379,7 +487,17 @@ namespace ZRCola {
|
||||
///
|
||||
/// Constructs the database
|
||||
///
|
||||
inline chrcat_db() : idxChrCat(data), idxRnk(data) {}
|
||||
inline chrcat_db() : idxChrCat(data), idxRank(data) {}
|
||||
|
||||
///
|
||||
/// Clears the database
|
||||
///
|
||||
inline void clear()
|
||||
{
|
||||
idxChrCat.clear();
|
||||
idxRank .clear();
|
||||
data .clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -387,8 +505,8 @@ namespace ZRCola {
|
||||
};
|
||||
|
||||
|
||||
const ZRCola::recordid_t stdex::idrec::record<ZRCola::character_db, ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>::id = *(ZRCola::recordid_t*)"CHR";
|
||||
const ZRCola::recordid_t stdex::idrec::record<ZRCola::chrcat_db, ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>::id = *(ZRCola::recordid_t*)"CCT";
|
||||
const ZRCola::recordid_t ZRCola::character_rec::id = *(ZRCola::recordid_t*)"CHR";
|
||||
const ZRCola::recordid_t ZRCola::chrcat_rec ::id = *(ZRCola::recordid_t*)"CCT";
|
||||
|
||||
|
||||
///
|
||||
@@ -452,7 +570,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::c
|
||||
stream << db.idxDscSub;
|
||||
|
||||
// Write data count.
|
||||
std::vector<unsigned __int16>::size_type data_count = db.data.size();
|
||||
auto data_count = db.data.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (data_count > 0xffffffff) {
|
||||
@@ -488,10 +606,10 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::c
|
||||
|
||||
// Write rank index.
|
||||
if (stream.fail()) return stream;
|
||||
stream << db.idxRnk;
|
||||
stream << db.idxRank;
|
||||
|
||||
// Write data count.
|
||||
std::vector<unsigned __int16>::size_type data_count = db.data.size();
|
||||
auto data_count = db.data.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (data_count > 0xffffffff) {
|
||||
@@ -526,7 +644,7 @@ inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::chrcat
|
||||
if (!stream.good()) return stream;
|
||||
|
||||
// Read rank index.
|
||||
stream >> db.idxRnk;
|
||||
stream >> db.idxRank;
|
||||
if (!stream.good()) return stream;
|
||||
|
||||
// Read data count.
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sal.h>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <utility>
|
||||
@@ -58,11 +59,11 @@ namespace ZRCola {
|
||||
typedef unsigned __int32 recordsize_t;
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(2)
|
||||
///
|
||||
/// Key-value index pair for mappings
|
||||
///
|
||||
#pragma pack(push)
|
||||
#pragma pack(2)
|
||||
template <class T>
|
||||
struct mappair_t
|
||||
{
|
||||
@@ -72,11 +73,13 @@ namespace ZRCola {
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(2)
|
||||
///
|
||||
/// Language ID type
|
||||
/// Three letter abbreviation, zero terminated
|
||||
///
|
||||
struct langid_t {
|
||||
struct ZRCOLA_API langid_t {
|
||||
char data[4];
|
||||
|
||||
inline langid_t& operator=(const langid_t &src)
|
||||
@@ -99,13 +102,13 @@ namespace ZRCola {
|
||||
src[3] : 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
///
|
||||
/// Blank language ID
|
||||
///
|
||||
static const langid_t blank;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Blank language ID
|
||||
///
|
||||
const langid_t langid_t_blank = {};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
///
|
||||
@@ -229,11 +232,11 @@ namespace ZRCola {
|
||||
///
|
||||
/// Memory index
|
||||
///
|
||||
template <class T, class T_idx = unsigned __int32, class T_data = T>
|
||||
template <class T_data, class T_idx = unsigned __int32, class T_el = T_data>
|
||||
class index : public std::vector<T_idx>
|
||||
{
|
||||
protected:
|
||||
std::vector<T> &host; ///< Reference to host data
|
||||
std::vector<T_data> &host; ///< Reference to host data
|
||||
|
||||
public:
|
||||
///
|
||||
@@ -241,7 +244,7 @@ namespace ZRCola {
|
||||
///
|
||||
/// \param[in] h Reference to vector holding the data
|
||||
///
|
||||
index(_In_ std::vector<T> &h) : host(h) {}
|
||||
index(_In_ std::vector<T_data> &h) : host(h) {}
|
||||
|
||||
|
||||
///
|
||||
@@ -251,9 +254,9 @@ namespace ZRCola {
|
||||
///
|
||||
/// \returns Data reference
|
||||
///
|
||||
inline const T_data& at(size_type pos) const
|
||||
inline const T_el& at(size_type pos) const
|
||||
{
|
||||
return (const T_data&)host.at(std::vector<T_idx>::at(pos));
|
||||
return *reinterpret_cast<const T_el*>(&host[std::vector<T_idx>::at(pos)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -264,9 +267,9 @@ namespace ZRCola {
|
||||
///
|
||||
/// \returns Data reference
|
||||
///
|
||||
inline T_data& at(size_type pos)
|
||||
inline T_el& at(size_type pos)
|
||||
{
|
||||
return (T_data&)host.at(std::vector<T_idx>::at(pos));
|
||||
return *reinterpret_cast<T_el*>(&host[std::vector<T_idx>::at(pos)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -277,9 +280,9 @@ namespace ZRCola {
|
||||
///
|
||||
/// \returns Data reference
|
||||
///
|
||||
inline const T_data& operator[](size_type pos) const
|
||||
inline const T_el& operator[](size_type pos) const
|
||||
{
|
||||
return (const T_data&)host[std::vector<T_idx>::at(pos)];
|
||||
return *reinterpret_cast<const T_el*>(&host[std::vector<T_idx>::operator[](pos)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -290,9 +293,9 @@ namespace ZRCola {
|
||||
///
|
||||
/// \returns Data reference
|
||||
///
|
||||
inline T_data& operator[](size_type pos)
|
||||
inline T_el& operator[](size_type pos)
|
||||
{
|
||||
return (T_data&)host[std::vector<T_idx>::at(pos)];
|
||||
return *reinterpret_cast<T_el*>(&host[std::vector<T_idx>::operator[](pos)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -316,7 +319,7 @@ namespace ZRCola {
|
||||
/// - =0 when a == b
|
||||
/// - >0 when a > b
|
||||
///
|
||||
virtual int compare(_In_ const T_data &a, _In_ const T_data &b) const = 0;
|
||||
virtual int compare(_In_ const T_el &a, _In_ const T_el &b) const = 0;
|
||||
|
||||
|
||||
///
|
||||
@@ -330,7 +333,7 @@ namespace ZRCola {
|
||||
/// - =0 when a == b
|
||||
/// - >0 when a > b
|
||||
///
|
||||
virtual int compare_sort(_In_ const T_data &a, _In_ const T_data &b) const
|
||||
virtual int compare_sort(_In_ const T_el &a, _In_ const T_el &b) const
|
||||
{
|
||||
// Revert to `compare()` by default.
|
||||
return compare(a, b);
|
||||
@@ -349,7 +352,7 @@ namespace ZRCola {
|
||||
/// - \c true if found
|
||||
/// - \c false otherwise
|
||||
///
|
||||
bool find(_In_ const T_data &el, _Out_ size_type &start, _Out_ size_type &end) const
|
||||
bool find(_In_ const T_el &el, _Out_ size_type &start, _Out_ size_type &end) const
|
||||
{
|
||||
// Start with the full search area.
|
||||
for (start = 0, end = size(); start < end; ) {
|
||||
@@ -389,7 +392,7 @@ namespace ZRCola {
|
||||
/// - \c true if found
|
||||
/// - \c false otherwise
|
||||
///
|
||||
bool find(_In_ const T_data &el, _Out_ size_type &start) const
|
||||
bool find(_In_ const T_el &el, _Out_ size_type &start) const
|
||||
{
|
||||
// Start with the full search area.
|
||||
size_t end;
|
||||
@@ -416,8 +419,11 @@ namespace ZRCola {
|
||||
private:
|
||||
static int __cdecl compare_s(void *p, const void *a, const void *b)
|
||||
{
|
||||
const index<T, T_idx, T_data> *t = (const index<T, T_idx, T_data>*)p;
|
||||
return t->compare_sort((const T_data&)t->host[*(const T_idx*)a], (const T_data&)t->host[*(const T_idx*)b]);
|
||||
const index<T_data, T_idx, T_el> *_this = reinterpret_cast<const index<T_data, T_idx, T_el>*>(p);
|
||||
const T_data *data = _this->host.data();
|
||||
return _this->compare_sort(
|
||||
*reinterpret_cast<const T_el*>(data + *reinterpret_cast<const T_idx*>(a)),
|
||||
*reinterpret_cast<const T_el*>(data + *reinterpret_cast<const T_idx*>(b)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -440,6 +446,17 @@ namespace ZRCola {
|
||||
textindex() {}
|
||||
|
||||
|
||||
///
|
||||
/// Clears the index
|
||||
///
|
||||
inline void clear()
|
||||
{
|
||||
std::vector< mappair_t<T_idx> >::clear();
|
||||
keys .clear();
|
||||
values.clear();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Finds data for given key
|
||||
///
|
||||
@@ -511,7 +528,7 @@ namespace ZRCola {
|
||||
|
||||
|
||||
///
|
||||
/// A vector for composed-decomposed index transformation mapping
|
||||
/// A vector for destination-source index transformation mapping
|
||||
///
|
||||
class ZRCOLA_API mapping_vector : public std::vector<mapping> {
|
||||
public:
|
||||
@@ -542,6 +559,86 @@ namespace ZRCola {
|
||||
i->invert();
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// Binary compares two strings
|
||||
///
|
||||
/// \param[in] str_a First string
|
||||
/// \param[in] count_a Number of characters in string \p str_a
|
||||
/// \param[in] str_b Second string
|
||||
/// \param[in] count_b Number of characters in string \p str_b
|
||||
///
|
||||
/// \returns
|
||||
/// - <0 when str_a < str_b
|
||||
/// - =0 when str_a == str_b
|
||||
/// - >0 when str_a > str_b
|
||||
///
|
||||
/// \note
|
||||
/// The function does not treat \\0 characters as terminators for performance reasons.
|
||||
/// Therefore \p count_a and \p count_b must represent exact string lengths.
|
||||
///
|
||||
inline int CompareString(_In_ const wchar_t *str_a, _In_ size_t count_a, _In_ const wchar_t *str_b, _In_ size_t count_b)
|
||||
{
|
||||
for (size_t i = 0; ; i++) {
|
||||
if (i >= count_a && i >= count_b) return 0;
|
||||
else if (i >= count_a && i < count_b) return -1;
|
||||
else if (i < count_a && i >= count_b) return +1;
|
||||
else if (str_a[i] < str_b[i]) return -1;
|
||||
else if (str_a[i] > str_b[i]) return +1;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Generates and returns Unicode representation of the string using hexadecimal codes.
|
||||
///
|
||||
/// \param[in] str Unicode string
|
||||
/// \param[in] count Number of characters in string \p str
|
||||
/// \param[in] sep Separator
|
||||
///
|
||||
inline std::string GetUnicodeDumpA(_In_ const wchar_t *str, _In_ size_t count, _In_opt_z_ const char *sep = "+")
|
||||
{
|
||||
std::string out;
|
||||
size_t dump_len_max = strlen(sep) + 4 + 1;
|
||||
char *dump;
|
||||
std::unique_ptr<char> dump_obj(dump = new char[dump_len_max]);
|
||||
if (count && str[0]) {
|
||||
size_t i = 0;
|
||||
out.insert(out.end(), dump, dump + _snprintf(dump, dump_len_max, "%04X", str[i++]));
|
||||
while (i < count && str[i])
|
||||
out.insert(out.end(), dump, dump + _snprintf(dump, dump_len_max, "%s%04X", sep, str[i++]));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
///
|
||||
/// Generates and returns Unicode representation of the string using hexadecimal codes.
|
||||
///
|
||||
/// \param[in] str Unicode string
|
||||
/// \param[in] count Number of characters in string \p str
|
||||
/// \param[in] sep Separator
|
||||
///
|
||||
inline std::wstring GetUnicodeDumpW(_In_ const wchar_t *str, _In_ size_t count, _In_opt_z_ const wchar_t *sep = L"+")
|
||||
{
|
||||
std::wstring out;
|
||||
size_t dump_len_max = wcslen(sep) + 4 + 1;
|
||||
wchar_t *dump;
|
||||
std::unique_ptr<wchar_t> dump_obj(dump = new wchar_t[dump_len_max]);
|
||||
if (count && str[0]) {
|
||||
size_t i = 0;
|
||||
out.insert(out.end(), dump, dump + _snwprintf(dump, dump_len_max, L"%04X", str[i++]));
|
||||
while (i < count && str[i])
|
||||
out.insert(out.end(), dump, dump + _snwprintf(dump, dump_len_max, L"%s%04X", sep, str[i++]));
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define GetUnicodeDump GetUnicodeDumpW
|
||||
#else
|
||||
#define GetUnicodeDump GetUnicodeDumpA
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -553,11 +650,11 @@ namespace ZRCola {
|
||||
///
|
||||
/// \returns The stream \p stream
|
||||
///
|
||||
template <class T, class T_idx, class T_data>
|
||||
inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::index<T, T_idx, T_data> &idx)
|
||||
template <class T_data, class T_idx, class T_el>
|
||||
inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::index<T_data, T_idx, T_el> &idx)
|
||||
{
|
||||
// Write index count.
|
||||
ZRCola::index<T, T_idx, T_data>::size_type idx_count = idx.size();
|
||||
auto idx_count = idx.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (idx_count > 0xffffffff) {
|
||||
@@ -585,8 +682,8 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::i
|
||||
///
|
||||
/// \returns The stream \p stream
|
||||
///
|
||||
template <class T, class T_idx, class T_data>
|
||||
inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::index<T, T_idx, T_data> &idx)
|
||||
template <class T_data, class T_idx, class T_el>
|
||||
inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::index<T_data, T_idx, T_el> &idx)
|
||||
{
|
||||
unsigned __int32 count;
|
||||
|
||||
@@ -619,7 +716,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::t
|
||||
unsigned __int32 count;
|
||||
|
||||
// Write index count.
|
||||
ZRCola::textindex<T_key, T_val, T_idx>::size_type idx_count = idx.size();
|
||||
auto idx_count = idx.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (idx_count > 0xffffffff) {
|
||||
@@ -636,7 +733,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::t
|
||||
stream.write((const char*)idx.data(), sizeof(ZRCola::textindex<T_key, T_val, T_idx>::value_type)*count);
|
||||
|
||||
// Write key count.
|
||||
std::vector<T_key>::size_type key_count = idx.keys.size();
|
||||
auto key_count = idx.keys.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (idx_count > 0xffffffff) {
|
||||
@@ -653,7 +750,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::t
|
||||
stream.write((const char*)idx.keys.data(), sizeof(std::vector<T_key>::value_type)*count);
|
||||
|
||||
// Write value count.
|
||||
std::vector<T_val>::size_type value_count = idx.values.size();
|
||||
auto value_count = idx.values.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (idx_count > 0xffffffff) {
|
||||
|
||||
@@ -45,15 +45,47 @@ namespace ZRCola {
|
||||
/// Character data
|
||||
///
|
||||
struct langchar {
|
||||
wchar_t chr; ///> Character
|
||||
public:
|
||||
langid_t lang; ///< Language ID
|
||||
|
||||
protected:
|
||||
unsigned __int16 chr_to; ///< Character end in \c data
|
||||
wchar_t data[]; ///< Character
|
||||
|
||||
private:
|
||||
inline langchar(_In_ const langchar &other);
|
||||
inline langchar& operator=(_In_ const langchar &other);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs the language character
|
||||
///
|
||||
/// \param[in] lang Character language
|
||||
/// \param[in] chr Character
|
||||
/// \param[in] chr_len Number of UTF-16 characters in \p chr
|
||||
///
|
||||
inline langchar(
|
||||
_In_opt_ langid_t lang = langid_t::blank,
|
||||
_In_opt_z_count_(chr_len) const wchar_t *chr = NULL,
|
||||
_In_opt_ size_t chr_len = 0)
|
||||
{
|
||||
this->lang = lang;
|
||||
this->chr_to = static_cast<unsigned __int16>(chr_len);
|
||||
if (chr_len) memcpy(this->data, chr, sizeof(wchar_t)*chr_len);
|
||||
}
|
||||
|
||||
inline const wchar_t* chr () const { return data; };
|
||||
inline wchar_t* chr () { return data; };
|
||||
inline const wchar_t* chr_end() const { return data + chr_to; };
|
||||
inline wchar_t* chr_end() { return data + chr_to; };
|
||||
inline unsigned __int16 chr_len() const { return chr_to; };
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
///
|
||||
/// Character index
|
||||
///
|
||||
class indexChar : public index<unsigned __int16, unsigned __int32, langchar>
|
||||
class indexChr : public index<unsigned __int16, unsigned __int32, langchar>
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -61,7 +93,7 @@ namespace ZRCola {
|
||||
///
|
||||
/// \param[in] h Reference to vector holding the data
|
||||
///
|
||||
indexChar(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, langchar>(h) {}
|
||||
indexChr(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, langchar>(h) {}
|
||||
|
||||
///
|
||||
/// Compares two characters by ID (for searching)
|
||||
@@ -76,27 +108,8 @@ namespace ZRCola {
|
||||
///
|
||||
virtual int compare(_In_ const langchar &a, _In_ const langchar &b) const
|
||||
{
|
||||
if (a.chr < b.chr) return -1;
|
||||
else if (a.chr > b.chr) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///
|
||||
/// Compares two characters by ID (for sorting)
|
||||
///
|
||||
/// \param[in] a Pointer to first element
|
||||
/// \param[in] b Pointer to second element
|
||||
///
|
||||
/// \returns
|
||||
/// - <0 when a < b
|
||||
/// - =0 when a == b
|
||||
/// - >0 when a > b
|
||||
///
|
||||
virtual int compare_sort(_In_ const langchar &a, _In_ const langchar &b) const
|
||||
{
|
||||
if (a.chr < b.chr) return -1;
|
||||
else if (a.chr > b.chr) return 1;
|
||||
int r = ZRCola::CompareString(a.chr(), a.chr_len(), b.chr(), b.chr_len());
|
||||
if (r != 0) return r;
|
||||
|
||||
if (a.lang < b.lang) return -1;
|
||||
else if (a.lang > b.lang) return 1;
|
||||
@@ -108,9 +121,9 @@ namespace ZRCola {
|
||||
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
///
|
||||
/// Character Language Index
|
||||
/// Language Index
|
||||
///
|
||||
class indexCharLang : public index<unsigned __int16, unsigned __int32, langchar>
|
||||
class indexLang : public index<unsigned __int16, unsigned __int32, langchar>
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -118,7 +131,7 @@ namespace ZRCola {
|
||||
///
|
||||
/// \param[in] h Reference to vector holding the data
|
||||
///
|
||||
indexCharLang(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, langchar>(h) {}
|
||||
indexLang(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, langchar>(h) {}
|
||||
|
||||
///
|
||||
/// Compares two languages by ID (for searching)
|
||||
@@ -133,34 +146,15 @@ namespace ZRCola {
|
||||
///
|
||||
virtual int compare(_In_ const langchar &a, _In_ const langchar &b) const
|
||||
{
|
||||
int r = memcmp(a.lang, b.lang, sizeof(langid_t));
|
||||
if (a.lang < b.lang) return -1;
|
||||
else if (a.lang > b.lang) return 1;
|
||||
|
||||
int r = ZRCola::CompareString(a.chr, a.chr_len(), b.chr(), b.chr_len());
|
||||
if (r != 0) return r;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///
|
||||
/// Compares two languages by ID (for sorting)
|
||||
///
|
||||
/// \param[in] a Pointer to first element
|
||||
/// \param[in] b Pointer to second element
|
||||
///
|
||||
/// \returns
|
||||
/// - <0 when a < b
|
||||
/// - =0 when a == b
|
||||
/// - >0 when a > b
|
||||
///
|
||||
virtual int compare_sort(_In_ const langchar &a, _In_ const langchar &b) const
|
||||
{
|
||||
int r = memcmp(a.lang, b.lang, sizeof(langid_t));
|
||||
if (r != 0) return r;
|
||||
|
||||
if (a.chr < b.chr) return -1;
|
||||
else if (a.chr > b.chr) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
} idxLng; ///< Character language index
|
||||
} idxLang; ///< Language index
|
||||
#endif
|
||||
|
||||
std::vector<unsigned __int16> data; ///< Character data
|
||||
@@ -171,20 +165,33 @@ namespace ZRCola {
|
||||
///
|
||||
inline langchar_db() : idxChr(data)
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
, idxLng(data)
|
||||
, idxLang(data)
|
||||
#endif
|
||||
{}
|
||||
|
||||
///
|
||||
/// Clears the database
|
||||
///
|
||||
inline void clear()
|
||||
{
|
||||
idxChr .clear();
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
idxLang.clear();
|
||||
#endif
|
||||
data .clear();
|
||||
}
|
||||
|
||||
///
|
||||
/// Tests presence of character in the given language
|
||||
///
|
||||
/// \param[in] chr Character (UTF-16)
|
||||
/// \param[in] lang Language
|
||||
/// \param[in] chr Pointer to character
|
||||
/// \param[in] chr_end Pointer to character end
|
||||
/// \param[in] lang Language
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true when character is used in language
|
||||
/// - \c false otherwise
|
||||
bool IsLocalCharacter(_In_ wchar_t chr, _In_ langid_t lang) const;
|
||||
bool IsLocalCharacter(_In_ const wchar_t *chr, _In_ const wchar_t *chr_end, _In_ langid_t lang) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -202,9 +209,40 @@ namespace ZRCola {
|
||||
/// Language data
|
||||
///
|
||||
struct language {
|
||||
langid_t id; ///< Language ID
|
||||
unsigned __int16 name_len; ///< \c name length (in characters)
|
||||
wchar_t name[]; ///< Language name
|
||||
public:
|
||||
langid_t lang; ///< Language ID
|
||||
|
||||
protected:
|
||||
unsigned __int16 name_to; ///< Language name end in \c data
|
||||
wchar_t data[]; ///< Language name
|
||||
|
||||
private:
|
||||
inline language(_In_ const language &other);
|
||||
inline language& operator=(_In_ const language &other);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs the language
|
||||
///
|
||||
/// \param[in] lang Language ID
|
||||
/// \param[in] name Language name
|
||||
/// \param[in] name_len Number of UTF-16 characters in \p name
|
||||
///
|
||||
inline language(
|
||||
_In_opt_ langid_t lang = langid_t::blank,
|
||||
_In_opt_z_count_(name_len) const wchar_t *name = NULL,
|
||||
_In_opt_ size_t name_len = 0)
|
||||
{
|
||||
this->lang = lang;
|
||||
this->name_to = static_cast<unsigned __int16>(name_len);
|
||||
if (name_len) memcpy(this->data, name, sizeof(wchar_t)*name_len);
|
||||
}
|
||||
|
||||
inline const wchar_t* name () const { return data; };
|
||||
inline wchar_t* name () { return data; };
|
||||
inline const wchar_t* name_end() const { return data + name_to; };
|
||||
inline wchar_t* name_end() { return data + name_to; };
|
||||
inline unsigned __int16 name_len() const { return name_to; };
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -234,12 +272,12 @@ namespace ZRCola {
|
||||
///
|
||||
virtual int compare(_In_ const language &a, _In_ const language &b) const
|
||||
{
|
||||
if (a.id < b.id) return -1;
|
||||
else if (a.id > b.id) return 1;
|
||||
if (a.lang < b.lang) return -1;
|
||||
else if (a.lang > b.lang) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
} idxLng; ///< Language index
|
||||
} idxLang; ///< Language index
|
||||
|
||||
std::vector<unsigned __int16> data; ///< Language data
|
||||
|
||||
@@ -247,7 +285,16 @@ namespace ZRCola {
|
||||
///
|
||||
/// Constructs the database
|
||||
///
|
||||
inline language_db() : idxLng(data) {}
|
||||
inline language_db() : idxLang(data) {}
|
||||
|
||||
///
|
||||
/// Clears the database
|
||||
///
|
||||
inline void clear()
|
||||
{
|
||||
idxLang.clear();
|
||||
data .clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -255,8 +302,8 @@ namespace ZRCola {
|
||||
};
|
||||
|
||||
|
||||
const ZRCola::recordid_t stdex::idrec::record<ZRCola::langchar_db, ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>::id = *(ZRCola::recordid_t*)"L-C";
|
||||
const ZRCola::recordid_t stdex::idrec::record<ZRCola::language_db, ZRCola::recordid_t, ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>::id = *(ZRCola::recordid_t*)"LNG";
|
||||
const ZRCola::recordid_t ZRCola::langchar_rec::id = *(ZRCola::recordid_t*)"L-C";
|
||||
const ZRCola::recordid_t ZRCola::language_rec::id = *(ZRCola::recordid_t*)"LNG";
|
||||
|
||||
|
||||
///
|
||||
@@ -276,11 +323,11 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::l
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
// Write language index.
|
||||
if (stream.fail()) return stream;
|
||||
stream << db.idxLng;
|
||||
stream << db.idxLang;
|
||||
#endif
|
||||
|
||||
// Write data count.
|
||||
std::vector<unsigned __int16>::size_type data_count = db.data.size();
|
||||
auto data_count = db.data.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (data_count > 0xffffffff) {
|
||||
@@ -316,7 +363,7 @@ inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::langch
|
||||
|
||||
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
|
||||
// Read language index.
|
||||
stream >> db.idxLng;
|
||||
stream >> db.idxLang;
|
||||
if (!stream.good()) return stream;
|
||||
#endif
|
||||
|
||||
@@ -348,10 +395,10 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::l
|
||||
{
|
||||
// Write language index.
|
||||
if (stream.fail()) return stream;
|
||||
stream << db.idxLng;
|
||||
stream << db.idxLang;
|
||||
|
||||
// Write data count.
|
||||
std::vector<unsigned __int16>::size_type data_count = db.data.size();
|
||||
auto data_count = db.data.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (data_count > 0xffffffff) {
|
||||
@@ -382,7 +429,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::l
|
||||
inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::language_db &db)
|
||||
{
|
||||
// Read language index.
|
||||
stream >> db.idxLng;
|
||||
stream >> db.idxLang;
|
||||
if (!stream.good()) return stream;
|
||||
|
||||
// Read data count.
|
||||
|
||||