Compare commits

...

185 Commits

Author SHA1 Message Date
37196ab4f5 Update submodule URLs 2025-07-04 12:13:05 +02:00
e96a627c55 MSICA: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-13 14:16:27 +01:00
7f2c209a06 MSI: Squash INSTALLLEVEL 1,2,3 → 1
Our default used to be INSTALLLEVEL 3, but Microsoft default is 1. By
overriding Microsoft default in Property table, we override the
INSTALLLEVEL user might have specified on the command line.

Since our installations no longer use "Minimal/Typical/Full", we may
squash "Minimal" and "Typical" into Minimal.

Signed-off-by: Simon Rozman <simon@rozman.si>
2025-03-13 14:15:36 +01:00
b1a3eb23c7 Updater: Move Git remote 2024-11-29 16:20:43 +01:00
35b8b389ff MSICA: Move Git remote 2024-11-29 16:10:15 +01:00
d8493554cd stdex: Move Git remote 2024-11-29 16:01:59 +01:00
a40e730bf0 wxExtend: Move Git remote 2024-11-29 15:57:45 +01:00
056b1c3087 MSIBuild: Move Git remote 2024-11-29 15:55:12 +01:00
7127b8ea31 WinStd: Move Git remote 2024-11-29 15:50:21 +01:00
82906899de Make mapping reusable
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-25 15:16:15 +02:00
566d40bd05 Update submodules
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-25 14:52:03 +02:00
6a8cd1ec80 Preset version to 2.7.1
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-25 14:51:30 +02:00
b0db806f5e Update submodules
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-11 15:56:28 +01:00
439dcb35d1 stdex: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 18:49:35 +01:00
ad07539cb6 Fix to compile for Linux
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 13:50:01 +01:00
a7c1481f87 Merge branch 'master' of https://github.com/Amebis/ZRCola
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 12:22:11 +01:00
c7bc2d0aa6 Update submodules
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-08 12:03:15 +01:00
2bbad80235 Set version to 2.7
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-07 19:27:30 +01:00
ffe11b17b5 Update font and database
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-07 19:27:30 +01:00
0daae5af37 Update submodules
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-11-07 19:27:30 +01:00
2f1f6a6c83 stdex: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-09-08 11:41:30 +02:00
f8393e3d77 MSICA: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-09-08 11:38:40 +02:00
40c4d65669 WinStd: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-09-08 11:37:37 +02:00
7d866b183b Update submodules
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-03-15 22:19:56 +01:00
b13f77ce95 ZRColaWS: Stop escaping UTF-8 characters in JSON
JSON is always UTF-8 and there is absolutely no need to escape all non-ASCII
characters in output strings.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-12-14 15:18:14 +01:00
cb324389e4 ZRColaWS: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-12-14 15:09:40 +01:00
2de62b1636 WinStd: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-12-14 15:04:25 +01:00
afb137edee Explicitly clear reused std::vector and u16string after moved from
MSVC C26800 warned us std::vector and std::string are not guaranteed to
be cleared after being moved from in all standard C++ implementations.

As we reuse those objects and rely they are cleared, do an explicit
clear. We could have one-time-use objects and add scopes, but that makes
code ugly.

Reference: https://stackoverflow.com/a/17735913/2071884
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-10-28 13:45:51 +02:00
d4fdd62916 MSICA, WinStd: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-10-28 08:21:10 +02:00
ac63e5a957 Makefile: Move GenRSAKeypair to platform-independent place
GenRSAKeypair is platform independent. When in the MakefilePlat.mak, it
is invoked once per each platform. It was not harmful. Just excessive.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-10-06 16:00:32 +02:00
b8aa592b19 Updater: Move keypair source out of source folder
This allows us to use `git clean` without risking to loose keypair,
as it was .gitignored and not included in the Git repository.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-10-05 19:18:06 +02:00
325b9334b5 Makefile: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-10-05 18:51:48 +02:00
f547fbc601 ZRColaWS: Document build and install step-by-step
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-29 15:07:42 +02:00
0e2678f09e ZRColaWS: Document install
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-20 12:50:11 +02:00
e78bbc9c3b ZRColaWS: Install systemd service
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-20 12:49:25 +02:00
f523d12fa1 ZRColaWS: Set default listen port to 54591
The 8000 is Oat++ sample port.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-20 11:41:39 +02:00
c6f844775f ZRColaWS: Make logging systemd journal friendlier
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-20 11:39:30 +02:00
450c18198a ZRColaWS: Integrate Oat++ building
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-20 10:13:50 +02:00
ad57071515 ZRColaWS: Sync executable name with project
The executable is not really a Linux deamon.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-19 18:26:31 +02:00
f6d0323485 ZRColaWS: Stop setting API server in Swagger UI
Host where the webservice is listening is not the same as host where
clients connect to. Unless localhost, but that limits use of Swagger UI
for internal use only.
And, not to forget: reverse proxy that will typically run in front of
ZRCola web service and will publish it with who knows what public URL.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-19 16:11:08 +02:00
004958f464 ZRColaWS: Rearrange source and provide Swagger-UI documentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-19 15:49:36 +02:00
09117d68a6 ZRColaWS: Add support for gracefull exit 2022-09-19 12:45:19 +02:00
04eea84f8a ZRColaWS: Fix test HTML page
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-19 09:49:32 +02:00
685ffedb53 ZRColaWS: Simplify class and variable names
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-19 09:11:34 +02:00
f74e9930c1 ZRColaWS: Add support for inverse translation
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 14:54:48 +02:00
a05e62f1d3 libZRCola: Add some SAL annotations
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 14:53:25 +02:00
3aba608001 ZRColaWS: Return source->destination index mapping
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 13:54:57 +02:00
fa59e71fe3 ZRColaWS: Rename .h to .hpp and fix indents
Oat++ is using .hpp extension for header files.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 13:53:59 +02:00
839c6fc1e6 Linux: Remove unused code from final binary
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 13:03:34 +02:00
ff509ed6b5 ZRColaWS: Initial working version
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 03:02:16 +02:00
ca3239f0ff libZRCola: Fix typo
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-16 02:57:52 +02:00
eb0911d3c0 ZRColaWS: Split LDFLAGS and LDLIBS
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 22:59:29 +02:00
a7c7a3f40c ZRColaWS: Initial skeleton
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 18:25:43 +02:00
a6f0357ad8 libZRCola: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 18:17:37 +02:00
35eb472e6b Backport gcc changes to MSVC
wchar_t is not char16_t on MSVC, requiring a lot of typecasting when
interfacing ZRCola database strings with GUI.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 15:33:08 +02:00
ba4ff3cd42 libZRCola: Add test
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
9709cc2845 libZRCola: Make UTF-16 explicit
ZRCola is using UTF-16LE strings internally (thanks to Windows).
However, wchar_t and std::wstring are UTF-32 on other platforms.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
f35e49dc8b stdex: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
9a307978b5 libZRCola: Include stdex/idrec.h only after << and >> are overloaded
gcc precompiles templates.  When << and >> operators of our datatypes are
not overloaded at the time <stdex/idrec.h> is #included yet, gcc will
seek/look for currently available << and >> operators when reaching
std::ostream and std::istream templates.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
bd01e250b2 libZRCola: Add standard default "all" make target
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
8bb1049cf0 libZRCola: Resolve some warnings reported by -Wall
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
52391d9a08 libZRCola: Set CFLAGS too and enable debugging on Debug builds
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
823390d28b libZRCola: Make parts of the gcc building reusable
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
eedab7da56 libZRCola: Initial stab at compiling with gcc
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
63fda12c99 Switch integer datatypes to C99
This makes code more portable.

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-09-15 14:36:44 +02:00
5cc005583c MSICA: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-05-09 14:26:16 +02:00
6b856314d0 WinStd: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-05-09 14:25:16 +02:00
b581b7a8b1 MSI: Simplify ProgramFiles(64)Folder property use
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-14 11:39:37 +01:00
0bfa44e6bb stdex: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-07 11:43:53 +01:00
5c05dc6eb6 WinStd: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-07 11:43:53 +01:00
7a2845fef3 MSICA: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-03 16:10:14 +01:00
5b71b776a7 MSIBuild: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-03-02 16:04:11 +01:00
2bd3b4c3b9 MSI: Match row ID with component ID
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-18 10:26:07 +01:00
b90ce09c5e Set version to 2.6
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-17 15:06:50 +01:00
04a1b95372 Pull translations from Transifex
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-17 15:06:50 +01:00
3c65720188 Update translation templates
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-17 15:06:50 +01:00
335fdbf949 wxExtend: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-17 15:06:50 +01:00
5637381ca6 WinStd: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-16 14:36:23 +01:00
082773fdc9 MSI: Discontinue prefixed row IDs in tables
humanSimon, is this really you? 😉

Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-15 13:15:43 +01:00
3c9ace0bbe MSICA, WinStd, stdex: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-04 14:54:07 +01:00
7ea4072724 stdex: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 13:48:16 +01:00
3e9f7d6478 MSICA: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 13:48:16 +01:00
46a3a13311 WinStd: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-02-03 13:45:53 +01:00
47d3884af3 Update Copyright and build year
Signed-off-by: Simon Rozman <simon@rozman.si>
2022-01-07 11:38:32 +01:00
1f498ab916 Clean the localization files
Transifex has issues with .pot files containing translations the Poedit
adds them from TM when updating from source. It remains to be decided,
which one is more brain-dead.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-21 14:51:04 +01:00
e07ce00938 Set version to 2.5.5
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-21 14:22:35 +01:00
7fb29aed80 Introduce bad ZRCola Unicode Composition highlighting
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-21 14:21:28 +01:00
6c3b2635f4 Finish ZRCola » Unicode (de)composition
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-20 20:23:36 +01:00
ad79961c33 Match integer datatypes with Access DB
Integer in Access is short in C/C++.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-20 19:49:29 +01:00
454b02181e Remove translations from transpositions
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-17 14:36:55 +01:00
0b68cdedda Add non-PUA ZRCola translations to ZRCola to Unicode translation
This allows ZRCola to Unicode translation to use precomposed Unicode
characters and provide better coverage for ZRCola to Unicode
translation.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-13 14:37:59 +01:00
a3f0662022 Revert "Make composed text font customizable"
ZRCola composed text depends on the ZRCola font a lot. With the recent
introduction of ZRCola >> Unicode transposition, a non-ZRCola font for
composed text does make sense, but the GUI should change back to ZRCola
font when ZRCola >> Unicode transposition is not in use. This could make
a cumbersome experience for end users, so removed for the time being.

Reverts: 3bda60b3407cc8a1a1e68349b21aa54da0bd4ac8
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-10 15:09:34 +01:00
0e96b03be1 Set version to 2.5.4
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-07 14:30:09 +01:00
0c8c772bcd Simplify ZRCola to Unicode combining character transliteration
The ZRCola >> Unicode transliteration translates ZRCola combining
characters into Unicode combining characters now, rather than
translating exact ZRCola characters only.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-07 14:27:10 +01:00
55b57c8d7b Sync Copyright
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-07 13:03:29 +01:00
204565dd60 Hardcode MSIBUILD_OUTPUT_DIR and MSIBUILD_ROOT
KISS!!!

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-01 13:22:43 +01:00
a7058daf69 Open-code CAB.mak
All other MSI compilations are open-coded but this one.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-01 13:22:43 +01:00
f8e701a572 Hardcode output folder name
KISS!!!

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-01 10:09:25 +01:00
a0cc1221d2 Introduce PDB packaging
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-01 10:05:58 +01:00
ce76950b2d Redirect output files to the output folder
Thou linker can locate the output .lib file of referenced projects
wherever .lib is just fine, this helps us to gather all .pdb files in
the output folder.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-01 08:49:10 +01:00
0d112cd90b Switch to SPDX license notice
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-01 08:48:49 +01:00
e930d96090 Cleanup project files
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-12-01 08:48:49 +01:00
8dc229d0d6 Set version to 2.5.3
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-26 16:51:19 +01:00
3bda60b340 Make composed text font customizable
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-26 16:51:19 +01:00
ed49b3227e Update Russian Translations
Author: Janoš Ježovnik <janos.jezovnik@zrc-sazu.si>
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-26 14:45:16 +01:00
274534a34c Replace <, >, Up and Down with ←, →, ↑ and ↓
Transifex has issues with "<" and ">".

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-19 14:30:16 +01:00
453b78cbb6 Resolve charset .idtx/.idt confusion
NMake inline files are always created using ACP. The "1252" in the .idtx
header has no effect on this. However, we must encode the .idt files
using correct charset/codepage regardless the ACP being used on the
building machine.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-19 14:20:02 +01:00
467fff294c Makefile: Convert to UTF-16
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-19 14:17:51 +01:00
5bb48d899d Unify and localize PUA Warning
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-18 15:49:54 +01:00
feb68ce463 Make ZRCola translation first followed by transliterations
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-18 15:32:44 +01:00
f6b3b4568a Move revised ZRCola=>Unicode transliteration into the database
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-18 12:05:39 +01:00
11924089d3 Updater: bump
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-15 11:54:32 +01:00
1a8884fcab Unify Windows.h inclusion
Windows.h must be included first and must be included with care
regarding WinSock.h and WinSock2.h affair.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-15 11:54:32 +01:00
fc7f9da219 Delay restoring the auto-saved state
Restoring auto-saved state triggers source/destination sync which breaks
in the early stage when wxZRColaComposerPanel is still in its
constructor. The sync uses the application's m_mainWnd to get its
settings, but the application doesn't have the m_mainWnd set yet.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-12 15:35:43 +01:00
980e5c6b2c Silence Code Analysis warnings about unscoped enums
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-10 11:33:20 +01:00
2e68a27d18 Set version to 2.5.2
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-10 09:42:45 +01:00
c16ec014dd MSIBuild: bump
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-10 09:42:45 +01:00
c9f059726e Readme: Fix typos
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-10 09:18:44 +01:00
e173ed8aa2 Upgrade code signing to SHA-256
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-10 09:18:44 +01:00
e54e827a07 Import revised Unicode Composed mapping
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-10 08:57:37 +01:00
3d1a12c335 ZRColaCompile: Generate additional Unicode Composing permutations
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-09 15:34:32 +02:00
e97971ffb0 ZRColaCompile: Fix command line
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-09 15:34:32 +02:00
4995ea5a08 ZRColaCompile: Evaluate Unicode Combining against Times New Roman font
The ZRCola font doesn't stack multiple Unicode Combining characters
properly.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-09 15:34:08 +02:00
dbf3354a1a Set version to 2.5.1
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-02 16:12:50 +02:00
0891f44f33 Updater: bump 2021-04-02 16:12:49 +02:00
771dd9f1f7 MSICA: bump
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-02 16:12:49 +02:00
c4f2726256 Build Unicode Combining Characters evaluation CSV with ZRColaCompile
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-02 15:40:17 +02:00
bc4b6b30d1 Cleanup 2021-04-02 15:40:17 +02:00
34e409ef2f UI: Introduce PUA warning
Private-Use-Area characters are not correctly rendered unless ZRCola
font is used. The PUA characters are now displayed in blue.

This commit also required to upgrade (de)composition text box to use
RichEdit control.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-02 15:40:17 +02:00
e43a5a0ef0 Add support for ZRCola Composed to Unicode transliteration
The initial support compares characters in ZRCola font Private-Use-Area
to the characters obtained using Unicode combining characters. Those
which match sufficiently are arranged into a new transliteration.

As the ZRCola Composed to Unicode transliteration requires to be applied
_after_ ZRCola composition but UI applies additional transliterations
_before_ ZRCola composition, the ZRCola composition was reintroduced as
one of the transliterations. This allows configuring a custom
transliteration sequence.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-02 15:39:24 +02:00
ddc8b00416 UI: Swap translation drop-down and ZRCola (de)composition button
The order of controls now reflect the order transformations are applied
to the text.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-02 12:58:25 +02:00
9f128a96d1 UI: Update ZRCola.fbp
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-04-02 12:58:13 +02:00
74e95b95b5 Cleanup 2021-04-02 12:58:12 +02:00
f3bb513545 Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-03-30 12:03:29 +02:00
72f8b179d7 Introduce Unicode Combining Characters evaluation script
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-03-25 14:43:46 +01:00
fa2fb03cf8 MSIBuild: Bump
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-03-25 08:39:37 +01:00
12c2889ea3 Copyright: Bump year
Signed-off-by: Simon Rozman <simon@rozman.si>
2021-03-25 08:36:00 +01:00
2fce6f06bc Set version to 2.5
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 12:43:09 +01:00
89a33bc0ea Publish MSIs to <version> and _latest folders on the download server
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 12:30:25 +01:00
445e0663e1 Add copyright colophon to .h files
Resource Compiler has an issue with the first line of an UTF-8 .h file.
The workaround is not to begin UTF-8 .h files with anything important.
A blank line would do or a comment.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 11:21:39 +01:00
b837c5204c Add copyright colophon to .rc files
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 11:10:33 +01:00
4dd9461c48 Add UTF-8 BOM markers to documentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 11:00:17 +01:00
c7e29b1862 Add UTF-8 BOM markers
MSVC needs them to use correct charset when Language for non-Unicode
programs is set to Windows-1252 or anything different than UTF-8.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 10:59:54 +01:00
42daea5b5e Bump WinStd
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 10:00:46 +01:00
41ad9cd134 Specify .wsf files encoding
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-11-19 09:58:04 +01:00
435316eb79 Bump sub-modules
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-08-20 12:18:29 +02:00
aa7a8fa484 Re-add UTF-8 BOM markers where required
C files containing non-ASCII characters in strings require UTF-8 BOM for
the MSVC to encode them correctly to the UTF-16 string. (Or switch the
computer we are building on to use UTF-8 for non-Unicode programs.)

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-03-15 00:13:28 +01:00
59493b998e Enable Windows 10 ARM64 support
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-03-14 23:57:41 +01:00
0b586aa141 Upgrade to current MSIBuild
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-03-03 14:44:32 +01:00
04ffd649ec Clean-up
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-03-03 13:49:51 +01:00
0970997ab7 Publish updates to the new catalog file and switch to SHA-256 (phase 2)
Version 2.4 switched to the catalog-0001.xml file. The new catalog file
is using SHA-256 hashes and signatures.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 13:48:10 +01:00
1434c9a2d3 Change UpgradeCode and mark to perform major update from 2.4
Changing the component GUIDs and keeping the same file paths rendered
minor updating broken.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 13:32:48 +01:00
9ebdafa272 Reapply "Unify component GUIDs across platforms"
This reverts commit f0f3ce75d00942bc89d7a3f0e9d7d5485f261401.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 13:32:48 +01:00
ea76dc27b4 Reapply "Unify component GUIDs across languages"
This reverts commit 41c8cc01ed237ed906208d5dca5d28d6ad548942.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 13:32:48 +01:00
7d39d4756c Preset version to 2.4.1
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 13:32:48 +01:00
a6e337a2a1 Switch to new catalog update file and switch to SHA-256 (phase 1)
Versions 2.2 and 2.3 require to update to 2.4 first (to fix Active Setup
issue which works for minor updates only), before updating to 2.5
(requires major update).

The 2.5 and beyond updates will have to be visible to 2.4 version only.
Therefore, we switch the Updater in 2.4 to a new catalog file. While the
2.4 update itself needs to be published to the existing catalog file to
instruct pre-2.4 versions to update to 2.4.

In other words:
- include\UpdaterCfg.h is about checking for future releases
- Makefile publish is about upgrading the past releases

This is also an excellent opportunity to phase out SHA-1.

Updater will treat all hashes as SHA-256 when checking for updates in
the new catalog - the future releases.

While we keep hashing and signing the old catalog file using SHA-1 - for
past releases.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 13:32:48 +01:00
0e1a347b5f Preset version to 2.4
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 09:54:48 +01:00
e28a146a39 Sub-module update
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 08:53:45 +01:00
dfedfc419e Strip excessive custom action identifier prefixes
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 08:53:45 +01:00
9f9e5addcc Fix the Active Setup StubPath issue affected products
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 08:53:45 +01:00
f0f3ce75d0 Revert "Unify component GUIDs across platforms"
This reverts commit 2363016a76a1fdc1bac30e4b4771a4a97f058a81.

Due to Active Setup StubPath bug in already deployed MSI packages we can
fix automatically using minor update only, we cannot change the
component GUIDs just yet.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 08:53:44 +01:00
41c8cc01ed Revert "Unify component GUIDs across languages"
This reverts commit f8f20f3667d0c5d2844f2a926146ab1714d2d1ed.

Due to Active Setup StubPath bug in already deployed MSI packages we can
fix automatically using minor update only, we cannot change the
component GUIDs just yet.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 08:53:44 +01:00
64ef4f5921 Preset version to 2.3.2
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-25 08:53:44 +01:00
d6be99ed59 Stop hiding catalog-0000.xml file
The hidden files cannot be downloaded (404) even when addressed
directly.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-24 09:44:31 +01:00
c00e9cbe1f Update legacy publish path
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-15 19:16:38 +01:00
867ab0f149 Fix upgrading from previous version
As the language and platform-dependent component GUIDs changed and we
wish to retain the original destination folders and filenames the
RemoveExistingProducts custom action is now invoked differently
according to the version of the product we are upgrading.

When we are upgrading an old package with legacy component GUIDs, we're
uninstalling it before installing the new one.

When we will be upgrading a modern package with platform/language
dependent component GUIDs, we will remove the leftover components after
installing the new one.

This should deliver compatible upgrades of existing versions while
providing optimal upgrading in the future.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-15 19:08:00 +01:00
ebdbb84a29 Enable recommended code analysis and address warnings
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-13 13:18:11 +01:00
62702a0194 Remove excessive UTF-8 BOM
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 15:42:11 +01:00
b3702ed237 Extend copyright year
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 15:38:57 +01:00
d3af51adf8 Remove building of unused executables
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 14:54:09 +01:00
2363016a76 Unify component GUIDs across platforms
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 14:54:09 +01:00
f8f20f3667 Unify component GUIDs across languages
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 14:54:09 +01:00
c2b96dbcc1 Automate language-dependent folder property names
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 14:54:09 +01:00
90a53fb139 Unify upgrade GUID across platforms
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 11:46:26 +01:00
ac2c225540 Add missing MSIBUILD_LANG_GUID and MSIBUILD_PLAT_GUID properties
Updated version of wxExtend sub-module requires them.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-11 11:46:05 +01:00
4a0bf118bf Bump stdex
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-10 15:17:22 +01:00
2e04726dd7 Update font and database
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-10 15:05:07 +01:00
9c8ca4d7b1 Make enum wxHexDecodeMode scoped
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-10 14:59:24 +01:00
0800f813ff Rename stdafx.h to pch.h
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-10 14:10:29 +01:00
dffc4bf9af Unify platform designations
.sln uses the same as .vcxproj files

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-02-10 14:03:44 +01:00
91d5c77e02 Clean Makefile
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-12-04 10:20:08 +01:00
94cbed643d Move distribution to CDN server
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-12-04 10:18:01 +01:00
be687497e8 Bump MSICA, WinStd and wxExtend
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-12-04 10:07:00 +01:00
495b490dc2 Remove UTF-8 BOM
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-12-04 10:07:00 +01:00
f54c048b74 Preset version to 2.3.1
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-12-04 10:07:00 +01:00
177 changed files with 9288 additions and 11041 deletions

18
.gitmodules vendored
View File

@ -1,18 +1,24 @@
[submodule "lib/stdex"]
path = lib/stdex
url = https://github.com/Amebis/stdex.git
url = https://git.amebis.si/Amebis/stdex.git
[submodule "lib/WinStd"]
path = lib/WinStd
url = https://github.com/Amebis/WinStd.git
url = https://git.amebis.si/Amebis/WinStd.git
[submodule "lib/wxExtend"]
path = lib/wxExtend
url = https://github.com/Amebis/wxExtend.git
url = https://git.amebis.si/Amebis/wxExtend.git
[submodule "MSI/MSIBuild"]
path = MSI/MSIBuild
url = https://github.com/Amebis/MSIBuild.git
url = https://git.amebis.si/Amebis/MSIBuild.git
[submodule "MSI/MSICA"]
path = MSI/MSICA
url = https://github.com/Amebis/MSICA.git
url = https://git.amebis.si/Amebis/MSICA.git
[submodule "Updater"]
path = Updater
url = https://github.com/Amebis/Updater.git
url = https://git.amebis.si/Amebis/Updater.git
[submodule "lib/oatpp"]
path = lib/oatpp
url = https://github.com/oatpp/oatpp.git
[submodule "lib/oatpp-swagger"]
path = lib/oatpp-swagger
url = https://github.com/oatpp/oatpp-swagger.git

View File

@ -1,4 +1,4 @@
# Localization of ZRCola
# Localization of ZRCola
In order to get ZRCola experience in your language the following resources should be translated:

@ -1 +1 @@
Subproject commit 320f7e9ee5b96610579639a8096b29158b8b2efd
Subproject commit b8364dea81f39b321d726317a9dcbf6b13a455e0

@ -1 +1 @@
Subproject commit c0a5df0800f57087d29687cda49b8900b2c21f78
Subproject commit f989fdc827d8fa731977d1771097cf038a50e145

Binary file not shown.

View File

@ -1,21 +1,5 @@
#
# Copyright 1991-2019 Amebis
#
# This file is part of ZRCola.
#
# ZRCola is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ZRCola is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 1991-2022 Amebis
!INCLUDE "..\..\include\MSIBuildCfg.mak"
!INCLUDE "..\MSIBuild\Makefile"

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
#
# Translators:
# Simon Rozman <simon@rozman.si>, 2018
# Simon Rozman <simon@rozman.si>, 2022
#
#, fuzzy
msgid ""
@ -8,7 +9,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-19 08:59+0200\n"
"PO-Revision-Date: 2018-09-19 07:19+0000\n"
"Last-Translator: Simon Rozman <simon@rozman.si>, 2018\n"
"Last-Translator: Simon Rozman <simon@rozman.si>, 2022\n"
"Language-Team: German (Germany) (https://www.transifex.com/amebis/teams/91592/de_DE/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -3468,8 +3469,8 @@ msgstr ""
#: en_US.Win32.Release.Control-2.idtx:5 en_US.Win32.Release.Control-2.idtx:12
#: en_US.x64.Debug.Control-2.idtx:5 en_US.x64.Debug.Control-2.idtx:12
#: en_US.x64.Release.Control-2.idtx:5 en_US.x64.Release.Control-2.idtx:12
msgid "binUIHeader.bmp"
msgstr "binUIHeader.bmp"
msgid "UIHeader.bmp"
msgstr "UIHeader.bmp"
#: en_US.Win32.Debug.Control-2.idtx:6 en_US.Win32.Release.Control-2.idtx:6
#: en_US.x64.Debug.Control-2.idtx:6 en_US.x64.Release.Control-2.idtx:6
@ -3522,8 +3523,8 @@ msgstr ""
#: en_US.Win32.Debug.Control-2.idtx:14 en_US.Win32.Release.Control-2.idtx:14
#: en_US.x64.Debug.Control-2.idtx:14 en_US.x64.Release.Control-2.idtx:14
msgid "binfontsubst.bmp"
msgstr "binfontsubst.bmp"
msgid "fontsubst.bmp"
msgstr "fontsubst.bmp"
#: en_US.Win32.Debug.Control-2.idtx:15 en_US.Win32.Release.Control-2.idtx:15
#: en_US.x64.Debug.Control-2.idtx:15 en_US.x64.Release.Control-2.idtx:15

View File

@ -1,5 +1,6 @@
#
# Translators:
# Simon Rozman <simon@rozman.si>, 2018
# Simon Rozman <simon@rozman.si>, 2022
#
#, fuzzy
msgid ""
@ -8,7 +9,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-19 08:59+0200\n"
"PO-Revision-Date: 2018-09-19 07:19+0000\n"
"Last-Translator: Simon Rozman <simon@rozman.si>, 2018\n"
"Last-Translator: Simon Rozman <simon@rozman.si>, 2022\n"
"Language-Team: Russian (Russia) (https://www.transifex.com/amebis/teams/91592/ru_RU/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -3468,8 +3469,8 @@ msgstr ""
#: en_US.Win32.Release.Control-2.idtx:5 en_US.Win32.Release.Control-2.idtx:12
#: en_US.x64.Debug.Control-2.idtx:5 en_US.x64.Debug.Control-2.idtx:12
#: en_US.x64.Release.Control-2.idtx:5 en_US.x64.Release.Control-2.idtx:12
msgid "binUIHeader.bmp"
msgstr "binUIHeader.bmp"
msgid "UIHeader.bmp"
msgstr "UIHeader.bmp"
#: en_US.Win32.Debug.Control-2.idtx:6 en_US.Win32.Release.Control-2.idtx:6
#: en_US.x64.Debug.Control-2.idtx:6 en_US.x64.Release.Control-2.idtx:6
@ -3542,8 +3543,8 @@ msgstr "[DlgTitleFont]Шрифт «00 ZRCola» в «ZRCola»"
#: en_US.Win32.Debug.Control-2.idtx:14 en_US.Win32.Release.Control-2.idtx:14
#: en_US.x64.Debug.Control-2.idtx:14 en_US.x64.Release.Control-2.idtx:14
msgid "binfontsubst.bmp"
msgstr "binfontsubst.bmp"
msgid "fontsubst.bmp"
msgstr "fontsubst.bmp"
#: en_US.Win32.Debug.Control-2.idtx:15 en_US.Win32.Release.Control-2.idtx:15
#: en_US.x64.Debug.Control-2.idtx:15 en_US.x64.Release.Control-2.idtx:15

View File

@ -1,5 +1,6 @@
#
# Translators:
# Simon Rozman <simon@rozman.si>, 2018
# Simon Rozman <simon@rozman.si>, 2022
#
#, fuzzy
msgid ""
@ -8,7 +9,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-19 08:59+0200\n"
"PO-Revision-Date: 2018-09-19 07:19+0000\n"
"Last-Translator: Simon Rozman <simon@rozman.si>, 2018\n"
"Last-Translator: Simon Rozman <simon@rozman.si>, 2022\n"
"Language-Team: Slovenian (Slovenia) (https://www.transifex.com/amebis/teams/91592/sl_SI/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -3468,8 +3469,8 @@ msgstr ""
#: en_US.Win32.Release.Control-2.idtx:5 en_US.Win32.Release.Control-2.idtx:12
#: en_US.x64.Debug.Control-2.idtx:5 en_US.x64.Debug.Control-2.idtx:12
#: en_US.x64.Release.Control-2.idtx:5 en_US.x64.Release.Control-2.idtx:12
msgid "binUIHeader.bmp"
msgstr "binUIHeader.bmp"
msgid "UIHeader.bmp"
msgstr "UIHeader.bmp"
#: en_US.Win32.Debug.Control-2.idtx:6 en_US.Win32.Release.Control-2.idtx:6
#: en_US.x64.Debug.Control-2.idtx:6 en_US.x64.Release.Control-2.idtx:6
@ -3503,9 +3504,9 @@ msgstr ""
"Roman;}Times New Roman CE;}}{\\colortbl "
";\\red0\\green0\\blue255;}{\\*\\generator Msftedit "
"5.41.21.2510;}\\viewkind4\\uc1\\pard\\sa200\\sl276\\slmult1\\i\\f0\\fs22 "
"Besedilo je bilo pripravljeno z vna\\'9aalnim sistemom ZRCola (http://zrcola"
".zrc-sazu.si), ki ga je na Znanstvenoraziskovalnem centru SAZU v Ljubljani "
"(http://www.zrc-sazu.si) razvil Peter Weiss.\\i0\\f1\\par}"
"Besedilo je bilo pripravljeno z vna\\'9aalnim sistemom ZRCola "
"(http://zrcola.zrc-sazu.si), ki ga je na Znanstvenoraziskovalnem centru SAZU"
" v Ljubljani (http://www.zrc-sazu.si) razvil Peter Weiss.\\i0\\f1\\par}"
#: en_US.Win32.Debug.Control-2.idtx:9 en_US.Win32.Release.Control-2.idtx:9
#: en_US.x64.Debug.Control-2.idtx:9 en_US.x64.Release.Control-2.idtx:9
@ -3535,8 +3536,8 @@ msgstr "[DlgTitleFont]\"00 ZRCola\" v pisavo \"ZRCola\""
#: en_US.Win32.Debug.Control-2.idtx:14 en_US.Win32.Release.Control-2.idtx:14
#: en_US.x64.Debug.Control-2.idtx:14 en_US.x64.Release.Control-2.idtx:14
msgid "binfontsubst.bmp"
msgstr "binfontsubst.bmp"
msgid "fontsubst.bmp"
msgstr "fontsubst.bmp"
#: en_US.Win32.Debug.Control-2.idtx:15 en_US.Win32.Release.Control-2.idtx:15
#: en_US.x64.Debug.Control-2.idtx:15 en_US.x64.Release.Control-2.idtx:15

BIN
Makefile

Binary file not shown.

Binary file not shown.

BIN
MakefileLangPlat.mak Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@ A Microsoft Windows application for composing texts using a wide range of Slavic
http://zrcola.zrc-sazu.si/en/
## Binaries for Download
https://www.amebis.si/prenos/ZRCola/
https://prenos.amebis.si/ZRCola/
## Building
@ -20,7 +20,7 @@ https://www.amebis.si/prenos/ZRCola/
### wxWidgets
ZRCola is using wxWidgets static libraries. You have to compile static libraries yourself.
#### Compiling wxWidgets x86 static libraries
#### Compiling wxWidgets Win32 static libraries
1. Start _x86 Native Tools Command Prompt for VS 2017_
2. Change working folder to `build\msw`
3. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 COMPILER_VERSION=141`
@ -33,15 +33,15 @@ ZRCola is using wxWidgets static libraries. You have to compile static libraries
4. Run: `nmake /f makefile.vc /ls RUNTIME_LIBS=static SHARED=0 COMPILER_VERSION=141 TARGET_CPU=X64 BUILD=release`
#### Specifying wxWidgets path
ZRCola compilation references wxWidgets libraries using `WXWIN` environment variable. Please set it to wxWidgets folder (i.e. `C:\SDK\wxWidgets`).
ZRCola compilation references wxWidgets libraries using `WXWIN` environment variable. Please set it to wxWidgets folder (e.g. `C:\SDK\wxWidgets`).
### 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.
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, e.g. `f61b973226c502a732d24f41aa85e192b009e7c0`).
- `ManifestTimestampRFC3161Url` - set the value to URL used to perform RFC3161 timestamp signature (e.g. `http://time.certum.pl`). 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.
@ -54,7 +54,11 @@ 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 (e.g. nmake Unregister Clean). Please, see NMAKE reference for further reading.
## Building and installing ZRCola webservice
ZRCola is also available as a Linux web-service. See [ZRColaWS/README.md](ZRColaWS/README.md) for instructions.
## Translating ZRCola
Instructions how to translate ZRCola to your language can be found [here](LOCALIZATION.md).

@ -1 +1 @@
Subproject commit 5ae6dd56c26ef749e328addd3fdb5e487cea9d43
Subproject commit a98ef46c5d38dec796dcb78f48240c17f743e3af

View File

@ -1,13 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2016
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRCola", "ZRCola\ZRCola.vcxproj", "{CD9E4170-92DD-440E-980C-D15F62032249}"
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\wxExtendLib-16.0.vcxproj", "{D3E29951-D9F5-486D-A167-20AE8E90B1FA}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtend", "lib\wxExtend\build\wxExtendLib.vcxproj", "{D3E29951-D9F5-486D-A167-20AE8E90B1FA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CFEBC17E-C840-4507-BDE6-1EF5B52DDCC5}"
ProjectSection(SolutionItems) = preProject
@ -18,106 +18,78 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libZRCola", "lib\libZRCola\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libZRColaUI", "lib\libZRColaUI\build\libZRColaUI.vcxproj", "{C0A84BD2-3870-4CD6-B281-0AB322E3C579}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stdex", "lib\stdex\build\stdex-16.0.vcxproj", "{518777CC-0A59-4415-A12A-82751ED75343}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Updater", "Updater\Updater\build\Updater.vcxproj", "{990D8CF9-4457-4DC0-AA18-4968EF434741}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinStd", "lib\WinStd\build\WinStd-16.0.vcxproj", "{47399D91-7EB9-41DE-B521-514BA5DB0C43}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM64 = Release|ARM64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|ARM64.ActiveCfg = Debug|ARM64
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|ARM64.Build.0 = Debug|ARM64
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.ActiveCfg = Debug|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|Win32.Build.0 = Debug|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|x64.ActiveCfg = Debug|x64
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|x64.Build.0 = Debug|x64
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|x86.ActiveCfg = Debug|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Debug|x86.Build.0 = Debug|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|ARM64.ActiveCfg = Release|ARM64
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|ARM64.Build.0 = Release|ARM64
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|Win32.ActiveCfg = Release|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|Win32.Build.0 = Release|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.ActiveCfg = Release|x64
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|x64.Build.0 = Release|x64
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|x86.ActiveCfg = Release|Win32
{CD9E4170-92DD-440E-980C-D15F62032249}.Release|x86.Build.0 = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|ARM64.ActiveCfg = Debug|ARM64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|ARM64.Build.0 = Debug|ARM64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|Win32.ActiveCfg = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|Win32.Build.0 = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x64.ActiveCfg = Debug|x64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x64.Build.0 = Debug|x64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x86.ActiveCfg = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x86.Build.0 = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|ARM64.ActiveCfg = Release|ARM64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|ARM64.Build.0 = Release|ARM64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|Win32.ActiveCfg = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|Win32.Build.0 = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x64.ActiveCfg = Release|x64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x64.Build.0 = Release|x64
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x86.ActiveCfg = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x86.Build.0 = Release|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|ARM64.ActiveCfg = Debug|ARM64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|ARM64.Build.0 = Debug|ARM64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|Win32.ActiveCfg = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|Win32.Build.0 = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|x64.ActiveCfg = Debug|x64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|x64.Build.0 = Debug|x64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|x86.ActiveCfg = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|x86.Build.0 = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|ARM64.ActiveCfg = Release|ARM64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|ARM64.Build.0 = Release|ARM64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|Win32.ActiveCfg = Release|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|Win32.Build.0 = Release|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|x64.ActiveCfg = Release|x64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|x64.Build.0 = Release|x64
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|x86.ActiveCfg = Release|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|x86.Build.0 = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|ARM64.ActiveCfg = Debug|ARM64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|ARM64.Build.0 = Debug|ARM64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|Win32.ActiveCfg = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|Win32.Build.0 = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|x64.ActiveCfg = Debug|x64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|x64.Build.0 = Debug|x64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|x86.ActiveCfg = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|x86.Build.0 = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|ARM64.ActiveCfg = Release|ARM64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|ARM64.Build.0 = Release|ARM64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|Win32.ActiveCfg = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|Win32.Build.0 = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x64.ActiveCfg = Release|x64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x64.Build.0 = Release|x64
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x86.ActiveCfg = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x86.Build.0 = Release|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|ARM64.ActiveCfg = Debug|ARM64
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|ARM64.Build.0 = Debug|ARM64
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|x64.ActiveCfg = Debug|x64
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|x64.Build.0 = Debug|x64
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|x86.ActiveCfg = Debug|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|x86.Build.0 = Debug|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Release|ARM64.ActiveCfg = Release|ARM64
{518777CC-0A59-4415-A12A-82751ED75343}.Release|ARM64.Build.0 = Release|ARM64
{518777CC-0A59-4415-A12A-82751ED75343}.Release|x64.ActiveCfg = Release|x64
{518777CC-0A59-4415-A12A-82751ED75343}.Release|x64.Build.0 = Release|x64
{518777CC-0A59-4415-A12A-82751ED75343}.Release|x86.ActiveCfg = Release|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Release|x86.Build.0 = Release|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|ARM64.ActiveCfg = Debug|ARM64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|ARM64.Build.0 = Debug|ARM64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|Win32.ActiveCfg = Debug|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|Win32.Build.0 = Debug|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|x64.ActiveCfg = Debug|x64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|x64.Build.0 = Debug|x64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|x86.ActiveCfg = Debug|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Debug|x86.Build.0 = Debug|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|ARM64.ActiveCfg = Release|ARM64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|ARM64.Build.0 = Release|ARM64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|Win32.ActiveCfg = Release|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|Win32.Build.0 = Release|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|x64.ActiveCfg = Release|x64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|x64.Build.0 = Release|x64
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|x86.ActiveCfg = Release|Win32
{990D8CF9-4457-4DC0-AA18-4968EF434741}.Release|x86.Build.0 = Release|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|ARM64.ActiveCfg = Debug|ARM64
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|ARM64.Build.0 = Debug|ARM64
{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}.Debug|x86.ActiveCfg = Debug|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x86.Build.0 = Debug|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|ARM64.ActiveCfg = Release|ARM64
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|ARM64.Build.0 = Release|ARM64
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.ActiveCfg = Release|x64
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.Build.0 = Release|x64
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x86.ActiveCfg = Release|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -126,9 +98,7 @@ Global
{D3E29951-D9F5-486D-A167-20AE8E90B1FA} = {6D85AD6A-69D6-40EB-BF0C-7495479DDCE5}
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8} = {6D85AD6A-69D6-40EB-BF0C-7495479DDCE5}
{C0A84BD2-3870-4CD6-B281-0AB322E3C579} = {6D85AD6A-69D6-40EB-BF0C-7495479DDCE5}
{518777CC-0A59-4415-A12A-82751ED75343} = {6D85AD6A-69D6-40EB-BF0C-7495479DDCE5}
{990D8CF9-4457-4DC0-AA18-4968EF434741} = {6D85AD6A-69D6-40EB-BF0C-7495479DDCE5}
{47399D91-7EB9-41DE-B521-514BA5DB0C43} = {6D85AD6A-69D6-40EB-BF0C-7495479DDCE5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EECB5329-0607-4D77-8BC0-48BD8C08BEF9}

Binary file not shown.

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\Updater\Updater\include;..\lib\stdex\include;..\lib\WinStd\include;..\lib\libZRCola\include;..\lib\libZRColaUI\include</AdditionalIncludeDirectories>
</ClCompile>
<Manifest>
<EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest>
<ResourceCompile>
<AdditionalIncludeDirectories>..\Updater\Updater\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

Binary file not shown.

View File

@ -29,98 +29,47 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{CD9E4170-92DD-440E-980C-D15F62032249}</ProjectGuid>
<RootNamespace>ZRCola</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Debug'">
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Release'">
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PropertyGroup Label="Configuration" Condition="'$(Platform)'=='ARM64'">
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRCola.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRCola.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRCola.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRCola.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRCola.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRCola.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\Updater\Updater\include;..\lib\stdex\include;..\lib\WinStd\include;..\lib\libZRCola\include;..\lib\libZRColaUI\include</AdditionalIncludeDirectories>
</ClCompile>
<Manifest>
<EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest>
<ResourceCompile>
<AdditionalIncludeDirectories>..\Updater\Updater\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Create</PrecompiledHeader>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="zrcolaabout.cpp" />
<ClCompile Include="zrcolaapp.cpp" />
@ -137,7 +86,7 @@
<ClCompile Include="zrcolaupdater.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="zrcolaabout.h" />
<ClInclude Include="zrcolaapp.h" />
<ClInclude Include="zrcolachrcatpnl.h" />
@ -159,10 +108,7 @@
<ProjectReference Include="..\lib\libZRCola\build\libZRCola.vcxproj">
<Project>{3c61929e-7289-4101-8d0a-da22d6e1aea8}</Project>
</ProjectReference>
<ProjectReference Include="..\lib\WinStd\build\WinStd-16.0.vcxproj">
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
</ProjectReference>
<ProjectReference Include="..\lib\wxExtend\build\wxExtendLib-16.0.vcxproj">
<ProjectReference Include="..\lib\wxExtend\build\wxExtendLib.vcxproj">
<Project>{D3E29951-D9F5-486D-A167-20AE8E90B1FA}</Project>
</ProjectReference>
<ProjectReference Include="..\Updater\Updater\build\Updater.vcxproj">

View File

@ -19,7 +19,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="zrcolaapp.cpp">
@ -63,7 +63,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="zrcolaapp.h">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

6
ZRCola/pch.cpp Normal file
View File

@ -0,0 +1,6 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "pch.h"

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#pragma once
@ -39,6 +25,8 @@
#include <wxex/persist/auimanager.h>
#include <wxex/persist/toplevel.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/clipbrd.h>
#include <wx/dcclient.h>
#include <wx/ffile.h>
@ -49,6 +37,7 @@
#include <wx/tokenzr.h>
#include <wx/utils.h>
#include <wx/valtext.h>
#pragma warning(pop)
#include <WinStd/MSI.h>
@ -57,7 +46,7 @@
#include <utility>
#include <vector>
#include <stdex/idrec.h>
#include <zrcola/idrec.h>
#if defined(__WXMSW__)
#include <Msi.h>

File diff suppressed because it is too large Load Diff

BIN
ZRCola/res/warn_pua.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

1690
ZRCola/res/warn_pua.pdf Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 8 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "pch.h"
#include "zrcolachrgrid.h"
@ -133,8 +133,19 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->AppendSeparator();
m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION_MENU, wxString( _("&ZRCola (De)composition") ) , _("Toggle ZRCola character (De)composition"), wxITEM_CHECK );
m_menuEdit->Append( m_menuItemComposition );
wxMenu* m_menuComposition;
m_menuComposition = new wxMenu();
wxMenuItem* m_menuCompositionItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("(De)&composition"), wxEmptyString, wxITEM_NORMAL, m_menuComposition );
m_menuItemCompositionNone = new wxMenuItem( m_menuComposition, wxID_COMPOSITION_NONE, wxString( _("&None") ) , _("No character (De)composition"), wxITEM_RADIO );
m_menuComposition->Append( m_menuItemCompositionNone );
m_menuItemCompositionZRCola = new wxMenuItem( m_menuComposition, wxID_COMPOSITION_ZRCOLA, wxString( _("&ZRCola") ) , _("ZRCola character (De)composition"), wxITEM_RADIO );
m_menuComposition->Append( m_menuItemCompositionZRCola );
m_menuItemCompositionUnicode = new wxMenuItem( m_menuComposition, wxID_COMPOSITION_UNICODE, wxString( _("&Unicode") ) , _("Unicode character (De)composition"), wxITEM_RADIO );
m_menuComposition->Append( m_menuItemCompositionUnicode );
m_menuEdit->Append( m_menuCompositionItem );
m_menuTranslationSeq = new wxMenu();
wxMenuItem* m_menuTranslationSeqItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("Tra&nslation"), wxEmptyString, wxITEM_NORMAL, m_menuTranslationSeq );
@ -142,6 +153,11 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->AppendSeparator();
m_menuItemWarnPUA = new wxMenuItem( m_menuEdit, wxID_WARN_PUA, wxString( _("&PUA Warning") ) , _("Highlight Private Use Area Characters"), wxITEM_CHECK );
m_menuEdit->Append( m_menuItemWarnPUA );
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuSettings;
m_menuSettings = new wxMenuItem( m_menuEdit, wxID_SETTINGS, wxString( _("&Settings...") ) , _("Open program configuration dialog"), wxITEM_NORMAL );
m_menuEdit->Append( m_menuSettings );
@ -211,12 +227,21 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_toolSendSource = m_toolbarTranslate->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_toolComposition = m_toolbarTranslate->AddTool( wxID_COMPOSITION_TOOLBAR, _("ZRCola (De)composition"), wxIcon( wxT("composition.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_CHECK, _("ZRCola (De)composition"), _("Toggle ZRCola character (De)composition"), NULL );
m_toolbarTranslate->AddSeparator();
wxString m_toolCompositionChoices[] = { _("No (De)composition"), _("ZRCola"), _("Unicode") };
int m_toolCompositionNChoices = sizeof( m_toolCompositionChoices ) / sizeof( wxString );
m_toolComposition = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, wxSize( 120,-1 ), m_toolCompositionNChoices, m_toolCompositionChoices, 0 );
m_toolComposition->SetSelection( 0 );
m_toolbarTranslate->AddControl( m_toolComposition );
wxArrayString m_toolTranslationSeqChoices;
m_toolTranslationSeq = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, wxSize( 250,-1 ), m_toolTranslationSeqChoices, 0 );
m_toolTranslationSeq = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, wxSize( 180,-1 ), m_toolTranslationSeqChoices, 0 );
m_toolTranslationSeq->SetSelection( 0 );
m_toolbarTranslate->AddControl( m_toolTranslationSeq );
m_toolbarTranslate->AddSeparator();
m_toolWarnPUA = m_toolbarTranslate->AddTool( wxID_WARN_PUA, _("PUA Warning"), wxIcon( wxT("warn_pua.ico"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24 ), wxNullBitmap, wxITEM_CHECK, _("Highlight Private Use Area Characters"), _("Highlight Private Use Area Characters"), NULL );
m_toolbarTranslate->Realize();
m_mgr.AddPane( m_toolbarTranslate, wxAuiPaneInfo().Name( wxT("toolbarCompose") ).Top().Caption( _("Compose") ).PinButton( true ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
@ -237,6 +262,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxZRColaFrameBase::OnClose ) );
this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
m_toolComposition->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnCompositionChoice ), NULL, this );
m_toolTranslationSeq->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnTranslationSeqChoice ), NULL, this );
}
@ -246,6 +272,7 @@ wxZRColaFrameBase::~wxZRColaFrameBase()
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxZRColaFrameBase::OnClose ) );
this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
m_toolComposition->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnCompositionChoice ), NULL, this );
m_toolTranslationSeq->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnTranslationSeqChoice ), NULL, this );
m_mgr.UnInit();
@ -269,7 +296,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
wxStaticBoxSizer* bSizerSourceEdit2;
bSizerSourceEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelSourceEdit, wxID_ANY, _("Decomposed Text") ), wxVERTICAL );
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
m_source->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_source->SetMinSize( wxSize( 100,25 ) );
@ -316,7 +343,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
wxStaticBoxSizer* bSizerDestinationEdit2;
bSizerDestinationEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDestinationEdit, wxID_ANY, _("Composed Text") ), wxVERTICAL );
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
m_destination->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_destination->SetMinSize( wxSize( 100,25 ) );
@ -405,19 +432,19 @@ wxZRColaCharacterCatalogPanelBase::wxZRColaCharacterCatalogPanelBase( wxWindow*
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( false );
m_grid->SetColLabelSize( 0 );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 0 );
m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_grid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_grid->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_grid->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_grid->SetMinSize( wxSize( 35,35 ) );
bSizer->Add( m_grid, 1, wxALL|wxEXPAND, 5 );
@ -531,18 +558,18 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridResults->EnableDragColMove( false );
m_gridResults->EnableDragColSize( false );
m_gridResults->SetColLabelSize( 0 );
m_gridResults->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridResults->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridResults->EnableDragRowSize( false );
m_gridResults->SetRowLabelSize( 0 );
m_gridResults->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridResults->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridResults->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridResults->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridResults->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridResults->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_gridResults->SetToolTip( _("Character search results") );
m_gridResults->SetMinSize( wxSize( 560,35 ) );
@ -569,18 +596,18 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridRecent->EnableDragColMove( false );
m_gridRecent->EnableDragColSize( false );
m_gridRecent->SetColLabelSize( 0 );
m_gridRecent->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRecent->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridRecent->EnableDragRowSize( false );
m_gridRecent->SetRowLabelSize( 0 );
m_gridRecent->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRecent->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridRecent->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridRecent->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRecent->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridRecent->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_gridRecent->SetToolTip( _("List of recently inserted characters") );
@ -610,7 +637,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
bSizerUnicode->Add( m_unicode, 0, wxALIGN_CENTER|wxBOTTOM|wxRIGHT|wxTOP, 5 );
m_shortcut = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_READONLY );
m_shortcut = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_CENTER );
m_shortcut->SetToolTip( _("Keyboard shortcut in Composer window") );
bSizerUnicode->Add( m_shortcut, 1, wxALL|wxEXPAND, 5 );
@ -632,35 +659,35 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridPreview->EnableDragColMove( false );
m_gridPreview->EnableDragColSize( false );
m_gridPreview->SetColLabelSize( 0 );
m_gridPreview->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridPreview->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridPreview->SetRowSize( 0, 200 );
m_gridPreview->EnableDragRowSize( false );
m_gridPreview->SetRowLabelSize( 0 );
m_gridPreview->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridPreview->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridPreview->SetDefaultCellFont( wxFont( 96, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridPreview->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridPreview->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridPreview->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_gridPreview->SetToolTip( _("Character preview") );
sbSizerPreview->Add( m_gridPreview, 0, wxALL|wxEXPAND, 5 );
m_description = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE|wxTE_READONLY );
m_description = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_CENTER );
m_description->SetToolTip( _("Unicode character description") );
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 = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_CENTER );
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 = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_CENTER );
m_category->SetToolTip( _("Unicode character category") );
sbSizerPreview->Add( m_category, 0, wxALL|wxEXPAND, 5 );
@ -702,18 +729,18 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridRelated->EnableDragColMove( false );
m_gridRelated->EnableDragColSize( false );
m_gridRelated->SetColLabelSize( 0 );
m_gridRelated->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRelated->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridRelated->EnableDragRowSize( false );
m_gridRelated->SetRowLabelSize( 0 );
m_gridRelated->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRelated->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridRelated->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridRelated->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRelated->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridRelated->SetToolTip( _("List of related characters") );
sbSizerRelated->Add( m_gridRelated, 1, wxALL|wxEXPAND, 5 );
@ -1152,10 +1179,10 @@ wxZRColaTranslationSeqBase::wxZRColaTranslationSeqBase( wxWindow* parent, wxWind
wxBoxSizer* bSizerTransSelect;
bSizerTransSelect = new wxBoxSizer( wxVERTICAL );
m_add = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(">"), wxDefaultPosition, wxSize( 32,32 ), 0 );
m_add = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, wxSize( 32,32 ), 0 );
bSizerTransSelect->Add( m_add, 0, wxALL, 5 );
m_remove = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _("<"), wxDefaultPosition, wxSize( 32,32 ), 0 );
m_remove = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, wxSize( 32,32 ), 0 );
bSizerTransSelect->Add( m_remove, 0, wxALL, 5 );
@ -1182,10 +1209,10 @@ wxZRColaTranslationSeqBase::wxZRColaTranslationSeqBase( wxWindow* parent, wxWind
wxBoxSizer* bSizerTransActiveReorder;
bSizerTransActiveReorder = new wxBoxSizer( wxHORIZONTAL );
m_selectedUp = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _("Up"), wxDefaultPosition, wxSize( 70,-1 ), 0 );
m_selectedUp = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, wxSize( 32,32 ), 0 );
bSizerTransActiveReorder->Add( m_selectedUp, 0, wxALL, 5 );
m_selectedDown = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _("Down"), wxDefaultPosition, wxSize( 70,-1 ), 0 );
m_selectedDown = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, wxSize( 32,32 ), 0 );
bSizerTransActiveReorder->Add( m_selectedDown, 0, wxALL, 5 );

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 8 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __ZRCOLAGUI_H__
#define __ZRCOLAGUI_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -68,7 +67,10 @@ class wxZRColaFrameBase : public wxFrame
wxID_SEND_SOURCE,
wxID_COPY_SOURCE_AND_RETURN,
wxID_SEND_ABORT,
wxID_COMPOSITION_MENU,
wxID_COMPOSITION_NONE,
wxID_COMPOSITION_ZRCOLA,
wxID_COMPOSITION_UNICODE,
wxID_WARN_PUA,
wxID_SETTINGS,
wxID_TOOLBAR_EDIT,
wxID_TOOLBAR_TRANSLATE,
@ -76,15 +78,17 @@ class wxZRColaFrameBase : public wxFrame
wxID_HELP_INSTRUCTIONS,
wxID_HELP_SHORTCUTS,
wxID_HELP_REQCHAR,
wxID_HELP_UPDATE,
wxID_COMPOSITION_TOOLBAR
wxID_HELP_UPDATE
};
wxMenuBar* m_menubar;
wxMenu* m_menuProgram;
wxMenu* m_menuEdit;
wxMenuItem* m_menuItemComposition;
wxMenuItem* m_menuItemCompositionNone;
wxMenuItem* m_menuItemCompositionZRCola;
wxMenuItem* m_menuItemCompositionUnicode;
wxMenu* m_menuTranslationSeq;
wxMenuItem* m_menuItemWarnPUA;
wxMenu* m_menuView;
wxMenu* m_menuHelp;
wxAuiToolBar* m_toolbarEdit;
@ -95,8 +99,9 @@ class wxZRColaFrameBase : public wxFrame
wxAuiToolBarItem* m_toolCharSelect;
wxAuiToolBarItem* m_toolSendDestination;
wxAuiToolBarItem* m_toolSendSource;
wxAuiToolBarItem* m_toolComposition;
wxChoice* m_toolComposition;
wxChoice* m_toolTranslationSeq;
wxAuiToolBarItem* m_toolWarnPUA;
wxZRColaCharacterCatalogPanel* m_panelChrCat;
wxStatusBar* m_statusBar;
@ -104,6 +109,7 @@ class wxZRColaFrameBase : public wxFrame
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
virtual void OnCompositionChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTranslationSeqChoice( wxCommandEvent& event ) { event.Skip(); }
@ -414,4 +420,3 @@ class wxZRColaTranslationSeqBase : public wxDialog
};
#endif //__ZRCOLAGUI_H__

View File

@ -1,20 +0,0 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -25,7 +11,11 @@ class wxZRColaAbout;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
///

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
#if defined(__WXMSW__)
#pragma comment(lib, "msi.lib")
#endif
@ -27,11 +13,13 @@
// ZRColaApp
//////////////////////////////////////////////////////////////////////////
#pragma warning(suppress: 28251) // wxWidgets implement WinMain without code analysis annotations.
wxIMPLEMENT_APP(ZRColaApp);
ZRColaApp::ZRColaApp() :
m_mainWnd(NULL),
#pragma warning(suppress: 26812) // wxLanguage is unscoped
m_lang_ui(wxLANGUAGE_DEFAULT),
wxApp()
{
@ -94,7 +82,7 @@ bool ZRColaApp::OnInit()
ZRCola::recordid_t id;
if (!stdex::idrec::read_id(dat, id, size)) break;
if (id == ZRCola::translation_rec::id) {
if (id == ZRCola::translation_rec::id()) {
dat >> ZRCola::translation_rec(m_t_db);
if (dat.good()) {
has_translation_data = true;
@ -102,60 +90,66 @@ bool ZRColaApp::OnInit()
wxFAIL_MSG(wxT("Error reading translation data from ZRCola.zrcdb."));
m_t_db.clear();
}
} else if (id == ZRCola::transet_rec::id) {
} 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::transeq_rec::id) {
} else if (id == ZRCola::transeq_rec::id()) {
dat >> ZRCola::transeq_rec(m_tsq_db);
if (!dat.good()) {
wxFAIL_MSG(wxT("Error reading translation sequence data from ZRCola.zrcdb."));
m_tsq_db.clear();
}
} else if (id == ZRCola::langchar_rec::id) {
} 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.clear();
}
} else if (id == ZRCola::language_rec::id) {
} 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.clear();
}
} else if (id == ZRCola::keyseq_rec::id) {
} 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.clear();
}
} else if (id == ZRCola::character_rec::id) {
} 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.clear();
}
} else if (id == ZRCola::chrcat_rec::id) {
} 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.clear();
}
} else if (id == ZRCola::chrtag_rec::id) {
} 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) {
} 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 if (id == ZRCola::highlight_rec::id()) {
dat >> ZRCola::highlight_rec(m_h_db);
if (!dat.good()) {
wxFAIL_MSG(wxT("Error reading highlight data from ZRCola.zrcdb."));
m_h_db.clear();
}
} else
stdex::idrec::ignore<ZRCola::recordsize_t, ZRCOLA_RECORD_ALIGN>(dat);
}
@ -172,6 +166,7 @@ bool ZRColaApp::OnInit()
wxSocketBase::Initialize();
m_mainWnd = new wxZRColaFrame();
m_mainWnd->m_panel->RestoreFromStateFile();
m_mainWnd->Show();
return true;

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -27,10 +13,15 @@ class ZRColaApp;
#include "zrcolafrm.h"
#include <WinStd/Win.h>
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/app.h>
#include <wx/config.h>
#include <wx/intl.h>
#pragma warning(pop)
#include <zrcola/character.h>
#include <zrcola/highlight.h>
#include <zrcola/language.h>
#include <zrcola/translate.h>
#include <zrcola/tag.h>
@ -82,6 +73,7 @@ public:
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
ZRCola::highlight_db m_h_db; ///< Highlight database
wxZRColaFrame *m_mainWnd; ///< Main window
@ -90,7 +82,7 @@ public:
protected:
#ifdef __WXMSW__
winstd::win_handle<NULL> m_running; ///< Global Win32 event to determine if another instance of ZRCola is already running
winstd::event m_running; ///< Global Win32 event to determine if another instance of ZRCola is already running
#endif
};

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -29,7 +15,9 @@ BEGIN_EVENT_TABLE(wxZRColaCharacterCatalogPanel, wxZRColaCharacterCatalogPanelBa
END_EVENT_TABLE()
wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) : wxZRColaCharacterCatalogPanelBase(parent)
wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) :
m_cg_id(0),
wxZRColaCharacterCatalogPanelBase(parent)
{
std::fstream dat((LPCTSTR)dynamic_cast<ZRColaApp*>(wxTheApp)->GetDatabaseFilePath(), std::ios_base::in | std::ios_base::binary);
if (dat.good()) {
@ -60,7 +48,7 @@ wxZRColaCharacterCatalogPanel::wxZRColaCharacterCatalogPanel(wxWindow* parent) :
wxString
label(cg.name(), cg.name_len()),
label_tran2(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
m_choice->Insert(label_tran2, i);
m_choice->Insert(label_tran2, (unsigned int)i);
}
m_cg_id = m_cg_db.idxRank[0].grp;
m_choice->Select(0);
@ -160,11 +148,11 @@ void wxZRColaCharacterCatalogPanel::Update()
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.chrlst();
const unsigned __int16 *shown = cg.chrshow();
const auto *src = cg.chrlst();
const uint16_t *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) {
for (uint16_t 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.Add(wxString(src + i, len));
@ -216,7 +204,7 @@ bool wxPersistentZRColaCharacterCatalogPanel::Restore()
if (cg.grp == cg_id) {
if (wnd->m_cg_id != cg.grp) {
wnd->m_cg_id = cg.grp;
wnd->m_choice->Select(i);
wnd->m_choice->Select((int)i);
update = true;
}

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -25,9 +11,16 @@ class wxZRColaCharacterCatalogPanel;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include <zrcolaui/chargroup.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/persist/window.h>
#pragma warning(pop)
///

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -124,7 +110,7 @@ wxString wxZRColaCharGrid::GetToolTipText(int idx)
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()]);
std::unique_ptr<ZRCola::keyseq_db::keyseq> ks((ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(ZRCola::char_t)*chr.length()]);
ks->ZRCola::keyseq_db::keyseq::keyseq(NULL, 0, chr.data(), chr.length());
ZRCola::keyseq_db::indexKey::size_type start;
if (app->m_ks_db.idxChr.find(*ks, start)) {
@ -156,13 +142,13 @@ void wxZRColaCharGrid::OnSize(wxSizeEvent& event)
row_height = FromDIP(wxZRColaCharacterGridRowHeight),
width = size.GetWidth() - m_rowLabelWidth - m_extraWidth,
cols = std::max<int>(width / col_width, 1),
rows = std::max<int>((char_count + cols - 1) / cols, 1);
rows = std::max<int>((int)((char_count + cols - 1) / cols), 1);
if (m_colLabelHeight + rows*row_height + 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 / col_width, 1);
rows = std::max<int>((char_count + cols - 1) / cols, 1);
rows = std::max<int>((int)((char_count + cols - 1) / cols), 1);
}
BeginBatch();
@ -242,7 +228,7 @@ void wxZRColaCharGrid::OnMotion(wxMouseEvent& event)
if (col == wxNOT_FOUND || row == wxNOT_FOUND )
return;
size_t toolTipIdx = row*m_numCols + col;
size_t toolTipIdx = (size_t)row*m_numCols + col;
if (toolTipIdx >= m_chars.GetCount()) {
// Index out of range.
m_toolTipIdx = (size_t)-1;
@ -254,7 +240,7 @@ void wxZRColaCharGrid::OnMotion(wxMouseEvent& event)
wxWindow *gridWnd = GetGridWindow();
if (gridWnd->GetToolTip()) {
// The tooltip is already shown. Update it immediately.
gridWnd->SetToolTip(GetToolTipText(m_toolTipIdx));
gridWnd->SetToolTip(GetToolTipText((int)m_toolTipIdx));
} else {
// This must be our initial entry. Schedule tooltip display after 1s.
m_timerToolTip.Start(1000, true);
@ -270,5 +256,5 @@ void wxZRColaCharGrid::OnTooltipTimer(wxTimerEvent& event)
if (m_toolTipIdx >= m_chars.GetCount())
return;
GetGridWindow()->SetToolTip(GetToolTipText(m_toolTipIdx));
GetGridWindow()->SetToolTip(GetToolTipText((int)m_toolTipIdx));
}

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -25,7 +11,11 @@ class wxZRColaCharGrid;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/grid.h>
#pragma warning(pop)
///
@ -96,7 +86,7 @@ public:
if (i >= n)
return wxGridCellCoords(-1, -1);
else if (m_chars[i] == c)
return wxGridCellCoords(i / m_numCols, i % m_numCols);
return wxGridCellCoords((int)(i / m_numCols), i % m_numCols);
}
}

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -26,7 +12,11 @@ class wxPersistentZRColaCharRequest;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include "zrcolakeyhndlr.h"
#include <wxex/persist/toplevel.h>

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////
@ -27,7 +13,7 @@
wxIMPLEMENT_DYNAMIC_CLASS(wxZRColaUTF16CharValidator, wxValidator);
wxZRColaUTF16CharValidator::wxZRColaUTF16CharValidator(wchar_t *val) :
wxZRColaUTF16CharValidator::wxZRColaUTF16CharValidator(ZRCola::char_t *val) :
m_val(val),
wxValidator()
{
@ -72,11 +58,11 @@ bool wxZRColaUTF16CharValidator::TransferFromWindow()
}
bool wxZRColaUTF16CharValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, wchar_t *val_out)
bool wxZRColaUTF16CharValidator::Parse(const wxString &val_in, size_t i_start, size_t i_end, wxTextCtrl *ctrl, wxWindow *parent, ZRCola::char_t *val_out)
{
const wxStringCharType *buf = val_in;
wchar_t chr = 0;
ZRCola::char_t chr = 0;
for (size_t i = i_start;;) {
if (i >= i_end) {
// End of Unicode found.
@ -85,7 +71,7 @@ bool wxZRColaUTF16CharValidator::Parse(const wxString &val_in, size_t i_start, s
} else if (i >= i_start + 4) {
// Maximum characters exceeded.
ctrl->SetFocus();
ctrl->SetSelection(i, i_end);
ctrl->SetSelection((int)i, (int)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')) {
@ -103,7 +89,7 @@ bool wxZRColaUTF16CharValidator::Parse(const wxString &val_in, size_t i_start, s
} else {
// Invalid character found.
ctrl->SetFocus();
ctrl->SetSelection(i, i + 1);
ctrl->SetSelection((long)i, (long)(i + 1));
wxMessageBox(wxString::Format(_("Invalid character in Unicode found: %c"), buf[i]), _("Validation conflict"), wxOK | wxICON_EXCLAMATION, parent);
return false;
}
@ -170,7 +156,7 @@ bool wxZRColaUnicodeDumpValidator::Parse(const wxString &val_in, size_t i_start,
wxString str;
for (size_t i = i_start;;) {
const wxStringCharType *buf_next;
wchar_t chr;
ZRCola::char_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))
@ -202,6 +188,7 @@ wxZRColaCharSelect::wxZRColaCharSelect(wxWindow* parent) :
wxZRColaCharSelectBase(parent)
{
// Set tag lookup locale.
#pragma warning(suppress: 26812) // wxLanguage is unscoped
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);
@ -219,7 +206,7 @@ wxZRColaCharSelect::wxZRColaCharSelect(wxWindow* parent) :
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);
int idx = m_categories->Insert(wxGetTranslation(wxString(cc.name(), cc.name_len()), wxT("ZRCola-zrcdb")), (unsigned int)i);
m_categories->Check(idx);
m_ccOrder.insert(std::make_pair(cc.cat, idx));
}
@ -236,8 +223,10 @@ wxZRColaCharSelect::wxZRColaCharSelect(wxWindow* parent) :
wxZRColaCharSelect::~wxZRColaCharSelect()
{
if (m_searchThread)
if (m_searchThread) {
#pragma warning(suppress: 26812) // wxThreadError is unscoped.
m_searchThread->Delete();
}
Disconnect(wxID_ANY, wxEVT_SEARCH_COMPLETE, wxThreadEventHandler(wxZRColaCharSelect::OnSearchComplete), NULL, this);
}
@ -253,7 +242,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
m_gridPreview->SetCellValue(0, 0, m_char);
std::unique_ptr<ZRCola::character_db::character> ch((ZRCola::character_db::character*)new char[sizeof(ZRCola::character_db::character) + sizeof(wchar_t)*m_char.length()]);
std::unique_ptr<ZRCola::character_db::character> ch((ZRCola::character_db::character*)new char[sizeof(ZRCola::character_db::character) + sizeof(ZRCola::char_t)*m_char.length()]);
ch->ZRCola::character_db::character::character(m_char.data(), m_char.length());
ZRCola::character_db::indexChr::size_type ch_start;
if (app->m_chr_db.idxChr.find(*ch, ch_start)) {
@ -262,7 +251,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
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()]);
std::unique_ptr<ZRCola::keyseq_db::keyseq> ks((ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(ZRCola::char_t)*m_char.length()]);
ks->ZRCola::keyseq_db::keyseq::keyseq(NULL, 0, m_char.data(), m_char.length());
ZRCola::keyseq_db::indexKey::size_type ks_start;
if (app->m_ks_db.idxChr.find(*ks, ks_start)) {
@ -295,7 +284,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
// 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()]);
std::unique_ptr<ZRCola::chrtag_db::chrtag> ct((ZRCola::chrtag_db::chrtag*)new char[sizeof(ZRCola::chrtag_db::chrtag) + sizeof(ZRCola::char_t)*m_char.length()]);
ct->ZRCola::chrtag_db::chrtag::chrtag(m_char.data(), m_char.length());
ZRCola::chrtag_db::indexChr::size_type ct_start, ct_end;
if (app->m_ct_db.idxChr.find(*ct, ct_start, ct_end)) {
@ -312,7 +301,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
// 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)
} else if (ZRCola::tagname_db::tagname::CompareName(m_locale, name->data(), (uint16_t)name->length(), tn.name(), tn.name_len()) == 0)
// Name is already on the list.
break;
}
@ -354,7 +343,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
// Select categories.
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))
if (m_categories->IsChecked((unsigned int)i))
m_searchThread->m_cats.insert(cc.cat);
}
@ -401,7 +390,7 @@ void wxZRColaCharSelect::OnCategoriesAll(wxHyperlinkEvent& event)
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_categories->Check((unsigned int)i, true);
m_searchChanged = true;
}
@ -413,7 +402,7 @@ void wxZRColaCharSelect::OnCategoriesNone(wxHyperlinkEvent& event)
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_categories->Check((unsigned int)i, false);
m_searchChanged = true;
}
@ -425,7 +414,7 @@ void wxZRColaCharSelect::OnCategoriesInvert(wxHyperlinkEvent& event)
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_categories->Check((unsigned int)i, !m_categories->IsChecked((unsigned int)i));
m_searchChanged = true;
}
@ -729,7 +718,7 @@ wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
{
// Search by tags: Get tags with given names. Then, get characters of found tags.
std::map<ZRCola::tagid_t, unsigned __int16> hits_tag;
std::map<ZRCola::tagid_t, uint16_t> 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;
}
@ -777,14 +766,14 @@ wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
int __cdecl wxZRColaCharSelect::SearchThread::CompareHits(const void *a, const void *b)
{
const std::pair<ZRCola::charrank_t, wchar_t> *_a = (const std::pair<ZRCola::charrank_t, wchar_t>*)a;
const std::pair<ZRCola::charrank_t, wchar_t> *_b = (const std::pair<ZRCola::charrank_t, wchar_t>*)b;
const std::pair<ZRCola::charrank_t, ZRCola::char_t> *_a = (const std::pair<ZRCola::charrank_t, ZRCola::char_t>*)a;
const std::pair<ZRCola::charrank_t, ZRCola::char_t> *_b = (const std::pair<ZRCola::charrank_t, ZRCola::char_t>*)b;
if (_a->first > _b->first) return -1;
else if (_a->first < _b->first) return 1;
if (_a->first < _b->first) return 1;
if (_a->second < _b->second) return -1;
else if (_a->second > _b->second) return 1;
if (_a->second > _b->second) return 1;
return 0;
}
@ -835,7 +824,7 @@ void wxPersistentZRColaCharSelect::Save() const
const auto &cc = app->m_cc_db.idxRank[i];
wxString name(wxT("category"));
name.Append(cc.cat.data, _countof(cc.cat.data));
SaveValue(name, wnd->m_categories->IsChecked(i));
SaveValue(name, wnd->m_categories->IsChecked((unsigned int)i));
}
SaveValue(wxT("searchPanel"), wnd->m_search_panel->IsShown());
@ -854,7 +843,7 @@ bool wxPersistentZRColaCharSelect::Restore()
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);
chr += (ZRCola::char_t)_tcstoul(tok_chr.GetNextToken().c_str(), NULL, 16);
val.Add(chr);
}
wnd->m_gridRecent->SetCharacters(val);
@ -872,7 +861,7 @@ bool wxPersistentZRColaCharSelect::Restore()
name.Append(cc.cat.data, _countof(cc.cat.data));
bool val;
if (RestoreValue(name, &val))
wnd->m_categories->Check(i, val);
wnd->m_categories->Check((unsigned int)i, val);
}
bool search_panel;

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -26,12 +12,19 @@ class wxPersistentZRColaCharSelect;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include <zrcola/character.h>
#include <wxex/persist/toplevel.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/validate.h>
#include <wx/event.h>
#include <wx/thread.h>
#pragma warning(pop)
#include <list>
#include <map>
#include <string>
@ -47,7 +40,7 @@ public:
///
/// Construct the validator with a value to store data
///
wxZRColaUTF16CharValidator(wchar_t *val = NULL);
wxZRColaUTF16CharValidator(ZRCola::char_t *val = NULL);
///
/// Copies this validator

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -27,29 +13,53 @@
wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
m_sourceChanged(false),
m_destinationChanged(false),
m_sourceRestyled(false),
m_destinationRestyled(false),
m_styleNormal(*wxBLACK, *wxWHITE, wxFont(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola"))),
m_stylePUA(*wxBLUE, *wxWHITE, wxFont(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola"))),
m_styleZRColaUnicodeComposedIssues(*wxRED, *wxWHITE, wxFont(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola"))),
m_selSource(0, 0),
m_selDestination(0, 0),
wxZRColaComposerPanelBase(parent)
{
m_source->PushEventHandler(&m_keyhandler);
// RichEdit control has no inner margins by default.
m_source->SetMargins(FromDIP(wxPoint(5, 2)));
m_destination->SetMargins(FromDIP(wxPoint(5, 2)));
m_source->PushEventHandler(&m_keyhandler);
}
wxZRColaComposerPanel::~wxZRColaComposerPanel()
{
m_source->PopEventHandler();
// This is a controlled exit. Purge saved state.
wxString fileName(GetStateFileName());
if (wxFileExists(fileName))
wxRemoveFile(fileName);
}
void wxZRColaComposerPanel::RestoreFromStateFile()
{
// Restore the previously saved state (if exists).
wxString fileName(GetStateFileName());
if (wxFileExists(fileName)) {
wxFFile file(fileName, wxT("rb"));
if (file.IsOpened()) {
// Load source text.
unsigned __int64 n;
uint64_t n;
file.Read(&n, sizeof(n));
if (!file.Error()) {
wxString source;
file.Read(wxStringBuffer(source, n), sizeof(wchar_t)*n);
file.Read(wxStringBuffer(source, (size_t)n), sizeof(wchar_t)*(size_t)n);
if (!file.Error()) {
// Load destination text.
file.Read(&n, sizeof(n));
if (!file.Error()) {
wxString destination;
file.Read(wxStringBuffer(destination, n), sizeof(wchar_t)*n);
file.Read(wxStringBuffer(destination, (size_t)n), sizeof(wchar_t)*(size_t)n);
if (!file.Error()) {
// Restore state.
m_source->SetValue(source);
@ -70,17 +80,6 @@ wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
}
wxZRColaComposerPanel::~wxZRColaComposerPanel()
{
m_source->PopEventHandler();
// This is a controlled exit. Purge saved state.
wxString fileName(GetStateFileName());
if (wxFileExists(fileName))
wxRemoveFile(fileName);
}
void wxZRColaComposerPanel::SynchronizePanels()
{
if (m_sourceChanged) {
@ -88,29 +87,33 @@ void wxZRColaComposerPanel::SynchronizePanels()
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
wxString src;
size_t len = GetValue(m_source, src);
wxString src = m_source->GetValue();
size_t len = src.Length();
std::wstring dst(src.data(), len), dst2;
ZRCola::mapping_vector map;
m_mapping.clear();
if (app->m_mainWnd->m_composition) {
// ZRCola decompose first, then re-compose.
app->m_t_db.TranslateInv(app->m_mainWnd->m_composition_id, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map));
map.clear();
app->m_t_db.Translate(app->m_mainWnd->m_composition_id, dst2.data(), dst2.size(), dst, &map);
m_mapping.push_back(std::move(map));
map.clear();
}
// Other translations
const ZRCola::transetid_t *sets_begin, *sets_end;
GetTranslationSeq(sets_begin, sets_end);
for (auto s = sets_begin; s != sets_end; ++s) {
app->m_t_db.Translate(*s, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map));
map.clear();
dst = std::move(dst2);
}
if (app->m_mainWnd->m_composition) {
// ZRCola decompose first, then re-compose.
app->m_t_db.TranslateInv(ZRCOLA_TRANSEQID_DEFAULT, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map));
app->m_t_db.Translate(ZRCOLA_TRANSEQID_DEFAULT, dst2.data(), dst2.size(), dst, &map);
m_mapping.push_back(std::move(map));
dst2.clear();
}
m_source->GetSelection(&m_selSource.first, &m_selSource.second);
@ -121,8 +124,8 @@ void wxZRColaComposerPanel::SynchronizePanels()
// 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));
m_selDestination.first = (long)MapToDestination(m_selSource.first ),
m_selDestination.second = (long)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.
@ -132,31 +135,37 @@ void wxZRColaComposerPanel::SynchronizePanels()
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
wxString src;
size_t len = GetValue(m_destination, src);
wxString src = m_destination->GetValue();
size_t len = src.Length();
std::wstring dst(src.data(), len), dst2;
ZRCola::mapping_vector map;
m_mapping.clear();
if (app->m_mainWnd->m_composition) {
// ZRCola decompose.
app->m_t_db.TranslateInv(ZRCOLA_TRANSEQID_DEFAULT, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map);
dst = std::move(dst2);
map.invert();
m_mapping.push_back(std::move(map));
}
// Other translations
const ZRCola::transetid_t *sets_begin, *sets_end;
GetTranslationSeq(sets_begin, sets_end);
for (auto s = sets_end; (s--) != sets_begin;) {
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), dst2, &map);
dst = std::move(dst2);
dst2.clear();
map.invert();
for (auto& m : map)
m.invert();
m_mapping.push_back(std::move(map));
map.clear();
}
if (app->m_mainWnd->m_composition) {
// ZRCola decompose.
app->m_t_db.TranslateInv(app->m_mainWnd->m_composition_id, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map);
dst = std::move(dst2);
dst2.clear();
for (auto& m : map)
m.invert();
m_mapping.push_back(std::move(map));
map.clear();
}
m_destination->GetSelection(&m_selDestination.first, &m_selDestination.second);
@ -167,8 +176,8 @@ void wxZRColaComposerPanel::SynchronizePanels()
// 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));
m_selSource.first = (long)MapToSource(m_selDestination.first ),
m_selSource.second = (long)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.
@ -180,11 +189,13 @@ void wxZRColaComposerPanel::SynchronizePanels()
}
void wxZRColaComposerPanel::OnSourcePaint(wxPaintEvent& event)
{
event.Skip();
if (m_sourceRestyled)
return;
long from, to;
m_source->GetSelection(&from, &to);
@ -194,16 +205,16 @@ void wxZRColaComposerPanel::OnSourcePaint(wxPaintEvent& event)
m_selSource.second = to;
m_sourceHex->SetSelection(
m_selSourceHex.first = m_mappingSourceHex.to_dst(from),
m_selSourceHex.second = m_mappingSourceHex.to_dst(to ));
m_selSourceHex.first = (long)stdex::src2dst<size_t>(m_mappingSourceHex, from),
m_selSourceHex.second = (long)stdex::src2dst<size_t>(m_mappingSourceHex, to ));
m_destination->SetSelection(
m_selDestination.first = MapToDestination(from),
m_selDestination.second = MapToDestination(to ));
m_selDestination.first = (long)MapToDestination(from),
m_selDestination.second = (long)MapToDestination(to ));
m_destinationHex->SetSelection(
m_selDestinationHex.first = m_mappingDestinationHex.to_dst(m_selDestination.first ),
m_selDestinationHex.second = m_mappingDestinationHex.to_dst(m_selDestination.second));
m_selDestinationHex.first = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.first ),
m_selDestinationHex.second = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.second));
}
}
@ -221,16 +232,16 @@ void wxZRColaComposerPanel::OnSourceHexPaint(wxPaintEvent& event)
m_selSourceHex.second = to;
m_source->SetSelection(
m_selSource.first = m_mappingSourceHex.to_src(from),
m_selSource.second = m_mappingSourceHex.to_src(to ));
m_selSource.first = (long)stdex::dst2src<size_t>(m_mappingSourceHex, from),
m_selSource.second = (long)stdex::dst2src<size_t>(m_mappingSourceHex, to ));
m_destination->SetSelection(
m_selDestination.first = MapToDestination(m_selSource.first ),
m_selDestination.second = MapToDestination(m_selSource.second));
m_selDestination.first = (long)MapToDestination(m_selSource.first ),
m_selDestination.second = (long)MapToDestination(m_selSource.second));
m_destinationHex->SetSelection(
m_selDestinationHex.first = m_mappingDestinationHex.to_dst(m_selDestination.first ),
m_selDestinationHex.second = m_mappingDestinationHex.to_dst(m_selDestination.second));
m_selDestinationHex.first = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.first ),
m_selDestinationHex.second = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.second));
}
}
@ -239,8 +250,15 @@ void wxZRColaComposerPanel::OnSourceText(wxCommandEvent& event)
{
event.Skip();
if (m_sourceRestyled)
return;
// Set the flag the source text changed to trigger idle-time translation.
m_sourceChanged = true;
m_sourceRestyled = true;
m_source->SetStyle(0, GetWindowTextLength(m_source->GetHWND()), m_styleNormal);
m_sourceRestyled = false;
}
@ -248,6 +266,9 @@ void wxZRColaComposerPanel::OnDestinationPaint(wxPaintEvent& event)
{
event.Skip();
if (m_destinationRestyled)
return;
long from, to;
m_destination->GetSelection(&from, &to);
@ -257,16 +278,16 @@ void wxZRColaComposerPanel::OnDestinationPaint(wxPaintEvent& event)
m_selDestination.second = to;
m_destinationHex->SetSelection(
m_selDestinationHex.first = m_mappingDestinationHex.to_dst(from),
m_selDestinationHex.second = m_mappingDestinationHex.to_dst(to ));
m_selDestinationHex.first = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, from),
m_selDestinationHex.second = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, to ));
m_source->SetSelection(
m_selSource.first = MapToSource(from),
m_selSource.second = MapToSource(to ));
m_selSource.first = (long)MapToSource(from),
m_selSource.second = (long)MapToSource(to ));
m_sourceHex->SetSelection(
m_selSourceHex.first = m_mappingSourceHex.to_dst(m_selSource.first ),
m_selSourceHex.second = m_mappingSourceHex.to_dst(m_selSource.second));
m_selSourceHex.first = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.first ),
m_selSourceHex.second = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.second));
}
}
@ -284,16 +305,16 @@ void wxZRColaComposerPanel::OnDestinationHexPaint(wxPaintEvent& event)
m_selDestinationHex.second = to;
m_destination->SetSelection(
m_selDestination.first = m_mappingDestinationHex.to_src(from),
m_selDestination.second = m_mappingDestinationHex.to_src(to ));
m_selDestination.first = (long)stdex::dst2src<size_t>(m_mappingDestinationHex, from),
m_selDestination.second = (long)stdex::dst2src<size_t>(m_mappingDestinationHex, to ));
m_source->SetSelection(
m_selSource.first = MapToSource(m_selDestination.first ),
m_selSource.second = MapToSource(m_selDestination.second));
m_selSource.first = (long)MapToSource(m_selDestination.first ),
m_selSource.second = (long)MapToSource(m_selDestination.second));
m_sourceHex->SetSelection(
m_selSourceHex.first = m_mappingSourceHex.to_dst(m_selSource.first ),
m_selSourceHex.second = m_mappingSourceHex.to_dst(m_selSource.second));
m_selSourceHex.first = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.first ),
m_selSourceHex.second = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.second));
}
}
@ -302,8 +323,34 @@ void wxZRColaComposerPanel::OnDestinationText(wxCommandEvent& event)
{
event.Skip();
if (m_destinationRestyled)
return;
// Set the flag the destination text changed to trigger idle-time inverse translation.
m_destinationChanged = true;
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
m_destinationRestyled = true;
wxString src = m_destination->GetValue();
app->m_h_db.Highlight(src, src.Length(), [this, app, src](ZRCola::hlghtsetid_t set, size_t start, size_t end) {
switch (set) {
case ZRCOLA_HLGHTSETID_ZRCOLA_UNICODE_COMPOSED_ISSUES:
m_destination->SetStyle((long)start, (long)end, m_styleZRColaUnicodeComposedIssues);
break;
default:
if (app->m_mainWnd->m_warnPUA) {
for (size_t i = start, j; i < end;) {
bool pua_i = ZRCola::ispua(src[i]);
for (j = i + 1; j < end && pua_i == ZRCola::ispua(src[j]); j++);
m_destination->SetStyle((long)i, (long)j, pua_i ? m_stylePUA : m_styleNormal);
i = j;
}
} else
m_destination->SetStyle((long)start, (long)end, m_styleNormal);
}
});
m_destinationRestyled = false;
}
@ -312,19 +359,22 @@ void wxZRColaComposerPanel::OnSaveTimer(wxTimerEvent& event)
wxString fileName(GetStateFileName());
wxFFile file(fileName, wxT("wb"));
if (file.IsOpened()) {
wxString text;
size_t len;
{
// Save source text.
len = GetValue(m_source, text);
wxString text = m_source->GetValue();
size_t len = text.Length();
file.Write(&len, sizeof(len));
file.Write((const wchar_t*)text, sizeof(wchar_t)*len);
}
{
// Save destination text.
len = GetValue(m_destination, text);
wxString text = m_destination->GetValue();
size_t len = text.Length();
file.Write(&len, sizeof(len));
file.Write((const wchar_t*)text, sizeof(wchar_t)*len);
}
}
event.Skip();
}
@ -348,31 +398,6 @@ wxString wxZRColaComposerPanel::GetStateFileName()
}
size_t wxZRColaComposerPanel::GetValue(wxTextCtrl *wnd, wxString &text)
{
#ifdef __WINDOWS__
// Use Windows GetWindowText() function to avoid line ending conversion incompletely imposed by wxWidgets.
WXHWND hWnd = wnd->GetHWND();
size_t len = ::GetWindowTextLengthW(hWnd);
if (len < 0x100) {
WCHAR buf[0x100];
::GetWindowTextW(hWnd, buf, len + 1);
text.assign(buf, len);
} else {
LPWSTR buf = new WCHAR[len + 1];
::GetWindowTextW(hWnd, buf, len + 1);
text.assign(buf, len);
delete [] buf;
}
return len;
#else
text = wnd->GetValue();
return text.Length();
#endif
}
void wxZRColaComposerPanel::SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &range, ZRCola::mapping_vector &mapping, const wchar_t *src, size_t len, long from, long to)
{
wxString hex;
@ -381,8 +406,8 @@ void wxZRColaComposerPanel::SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &
mapping.clear();
for (size_t i = 0; i < len && src[i]; i++) {
wchar_t c = src[i];
if (c == L'\n' || c == '\r') {
hex += c;
if (c == L'\n') {
hex += L"\r\n";
first = true;
} else {
hex += wxString::Format(first ? wxT("%04X") : wxT(" %04X"), src[i]);
@ -393,8 +418,8 @@ void wxZRColaComposerPanel::SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &
wnd->SetValue(hex);
wnd->SetSelection(
range.first = mapping.to_dst(from),
range.second = mapping.to_dst(to ));
range.first = (long)stdex::src2dst<size_t>(mapping, from),
range.second = (long)stdex::src2dst<size_t>(mapping, to ));
}

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -25,10 +11,17 @@ class wxZRColaComposerPanel;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include "zrcolakeyhndlr.h"
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/persist/window.h>
#include <wx/timer.h>
#pragma warning(pop)
#include <utility>
#include <vector>
@ -42,6 +35,7 @@ public:
wxZRColaComposerPanel(wxWindow* parent);
virtual ~wxZRColaComposerPanel();
void RestoreFromStateFile();
void SynchronizePanels();
friend class wxPersistentZRColaComposerPanel; // Allow saving/restoring window state.
@ -59,12 +53,18 @@ protected:
inline void GetTranslationSeq(_Out_ const ZRCola::transetid_t *&sets_begin, _Out_ const ZRCola::transetid_t *&sets_end) 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_sourceChanged; ///< Boolean flag to mark source text "dirty" to trigger translation
bool m_destinationChanged; ///< Boolean flag to mark destination text "dirty" to trigger inverse translation
volatile bool
m_sourceRestyled, ///< Boolean flag to mark source text is being restyled
m_destinationRestyled; ///< Boolean flag to mark destination text is being restyled
wxTextAttr
m_styleNormal, ///< Normal text style
m_stylePUA, ///< PUA character text style
m_styleZRColaUnicodeComposedIssues; ///< ZRCola Unicode Composed issues character text style
std::vector<ZRCola::mapping_vector> m_mapping; ///< Character index mapping vector between source and normalized text
std::pair<long, long>
m_selSource, ///< Character index of selected text in source text control
@ -97,7 +97,7 @@ protected:
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);
src = stdex::src2dst(*m, src);
return src;
}
@ -106,7 +106,7 @@ inline size_t wxZRColaComposerPanel::MapToDestination(_In_ size_t src) const
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);
dst = stdex::dst2src(*m, dst);
return dst;
}

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -42,8 +28,10 @@ wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
EVT_MENU (wxID_SEND_SOURCE , wxZRColaFrame::OnSendSource )
EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
EVT_MENU (wxID_COMPOSITION_MENU , wxZRColaFrame::OnCompositionMenu )
EVT_MENU (wxID_COMPOSITION_TOOLBAR , wxZRColaFrame::OnCompositionToolbar )
EVT_MENU (wxID_COMPOSITION_NONE , wxZRColaFrame::OnCompositionNone )
EVT_MENU (wxID_COMPOSITION_ZRCOLA , wxZRColaFrame::OnCompositionZRCola )
EVT_MENU (wxID_COMPOSITION_UNICODE , wxZRColaFrame::OnCompositionUnicode )
EVT_MENU (wxID_WARN_PUA , wxZRColaFrame::OnWarnPUA )
EVT_MENU_RANGE (wxID_TRANSLATION_SEQ_DEFAULT, wxID_TRANSLATION_SEQ_END, wxZRColaFrame::OnTranslationSeqMenu )
EVT_MENU (wxID_SETTINGS , wxZRColaFrame::OnSettings )
@ -75,6 +63,8 @@ wxZRColaFrame::wxZRColaFrame() :
m_settings(NULL),
m_chrReq(NULL),
m_composition(true),
m_composition_id(ZRCOLA_TRANSETID_DEFAULT),
m_warnPUA(false),
m_transeq_id(ZRCOLA_TRANSEQID_DEFAULT),
m_transeq(NULL),
wxZRColaFrameBase(NULL)
@ -101,11 +91,11 @@ wxZRColaFrame::wxZRColaFrame() :
wxString
name(ts.name(), ts.name_len()),
name_tran(wxGetTranslation(name, wxT("ZRCola-zrcdb")));
m_menuTranslationSeq->AppendRadioItem(wxID_TRANSLATION_SEQ_START + i, name_tran);
m_menuTranslationSeq->AppendRadioItem((int)(wxID_TRANSLATION_SEQ_START + i), name_tran);
m_toolTranslationSeq->Append(name_tran, reinterpret_cast<void*>(ts.seq));
} else {
wxString name_tran(_("Custom Translation..."));
m_menuTranslationSeq->AppendRadioItem(wxID_TRANSLATION_SEQ_START + i, name_tran);
m_menuTranslationSeq->AppendRadioItem((int)(wxID_TRANSLATION_SEQ_START + i), name_tran);
m_toolTranslationSeq->Append(name_tran, reinterpret_cast<void*>(ZRCOLA_TRANSEQID_CUSTOM));
break;
}
@ -154,13 +144,14 @@ wxZRColaFrame::wxZRColaFrame() :
// Register notification sink for language detection.
m_ulRefCount = 1;
m_tfSource = NULL;
m_dwCookie = MAXDWORD;
ITfInputProcessorProfiles *pProfiles;
HRESULT hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER, IID_ITfInputProcessorProfiles, (LPVOID*)&pProfiles);
if(SUCCEEDED(hr)) {
hr = pProfiles->QueryInterface(IID_ITfSource, (LPVOID*)&m_tfSource);
if(SUCCEEDED(hr)) {
hr = m_tfSource->AdviseSink(IID_ITfLanguageProfileNotifySink, (ITfLanguageProfileNotifySink*)this, &m_dwCookie);
if (FAILED(hr) || m_dwCookie == -1) {
if (FAILED(hr) || m_dwCookie == MAXDWORD) {
m_tfSource->Release();
m_tfSource = NULL;
}
@ -186,12 +177,23 @@ wxZRColaFrame::wxZRColaFrame() :
persist_mgr.RegisterAndRestore(this, new wxPersistentZRColaFrame(this));
// Update (de)composition selection.
if (m_composition) {
m_menuItemComposition->Check(true);
m_toolComposition->SetState(m_toolComposition->GetState() | wxAUI_BUTTON_STATE_CHECKED);
if (m_composition && m_composition_id == ZRCOLA_TRANSETID_DEFAULT) {
m_menuItemCompositionZRCola->Check(true);
m_toolComposition->Select(1);
} else if (m_composition && m_composition_id == ZRCOLA_TRANSETID_UNICODE) {
m_menuItemCompositionUnicode->Check(true);
m_toolComposition->Select(2);
} else {
m_menuItemComposition->Check(false);
m_toolComposition->SetState(m_toolComposition->GetState() & ~wxAUI_BUTTON_STATE_CHECKED);
m_menuItemCompositionNone->Check(true);
m_toolComposition->Select(0);
}
if (m_warnPUA) {
m_menuItemWarnPUA->Check(true);
m_toolWarnPUA->SetState(m_toolWarnPUA->GetState() | wxAUI_BUTTON_STATE_CHECKED);
} else {
m_menuItemWarnPUA->Check(false);
m_toolWarnPUA->SetState(m_toolWarnPUA->GetState() & ~wxAUI_BUTTON_STATE_CHECKED);
}
// Update translation sequence selection.
@ -342,28 +344,53 @@ void wxZRColaFrame::OnSendAbort(wxCommandEvent& event)
}
void wxZRColaFrame::OnCompositionMenu(wxCommandEvent& event)
void wxZRColaFrame::OnCompositionNone(wxCommandEvent& event)
{
m_composition = m_menuItemComposition->IsChecked();
m_toolComposition->SetState((m_toolComposition->GetState() & ~wxAUI_BUTTON_STATE_CHECKED) | (m_composition ? wxAUI_BUTTON_STATE_CHECKED : 0));
DoSetComposition(false, ZRCOLA_TRANSETID_DEFAULT);
m_toolbarTranslate->Refresh();
// Notify source text something changed and should re-translate.
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
m_panel->m_source->ProcessWindowEvent(event2);
event.Skip();
}
void wxZRColaFrame::OnCompositionToolbar(wxCommandEvent& event)
void wxZRColaFrame::OnCompositionZRCola(wxCommandEvent& event)
{
m_composition = (m_toolComposition->GetState() & wxAUI_BUTTON_STATE_CHECKED) ? true : false;
m_menuItemComposition->Check(m_composition);
DoSetComposition(true, ZRCOLA_TRANSETID_DEFAULT);
m_toolbarTranslate->Refresh();
// Notify source text something changed and should re-translate.
event.Skip();
}
void wxZRColaFrame::OnCompositionUnicode(wxCommandEvent& event)
{
DoSetComposition(true, ZRCOLA_TRANSETID_UNICODE);
m_toolbarTranslate->Refresh();
event.Skip();
}
void wxZRColaFrame::OnCompositionChoice(wxCommandEvent& event)
{
switch (event.GetSelection()) {
case 0: DoSetComposition(false, ZRCOLA_TRANSETID_DEFAULT); break;
case 1: DoSetComposition(true, ZRCOLA_TRANSETID_DEFAULT); break;
case 2: DoSetComposition(true, ZRCOLA_TRANSETID_UNICODE); break;
}
}
void wxZRColaFrame::OnWarnPUA(wxCommandEvent& event)
{
m_warnPUA = !m_warnPUA;
m_menuItemWarnPUA->Check(m_warnPUA);
m_toolWarnPUA->SetState((m_toolWarnPUA->GetState() & ~wxAUI_BUTTON_STATE_CHECKED) | (m_warnPUA ? wxAUI_BUTTON_STATE_CHECKED : 0));
m_toolbarTranslate->Refresh();
// Notify destination text something changed and should re-paint.
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
m_panel->m_source->ProcessWindowEvent(event2);
m_panel->m_destination->ProcessWindowEvent(event2);
event.Skip();
}
@ -493,6 +520,7 @@ void wxZRColaFrame::OnHelpShortcuts(wxCommandEvent& event)
#ifdef __WXMSW__
// Search and try to launch installed PDF.
#pragma warning(suppress: 26812) // INSTALLSTATE is unscoped.
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) &&
@ -594,10 +622,10 @@ void wxZRColaFrame::DoSend(const wxString& str)
{
// Prepare the INPUT table.
wxString::size_type n = str.length();
auto i_str = str.begin();
wxString::const_iterator 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++) {
for (std::vector<INPUT>::size_type i = 0; i < n; i++, ++i_str) {
wxString::char_type c = *i_str;
// Add key down event.
@ -616,7 +644,7 @@ void wxZRColaFrame::DoSend(const wxString& str)
::SetActiveWindow(m_hWndSource);
::SetForegroundWindow(m_hWndSource);
::Sleep(200);
::SendInput(input.size(), input.data(), sizeof(INPUT));
::SendInput((UINT)input.size(), input.data(), sizeof(INPUT));
m_hWndSource = NULL;
// Select all input in source and destination to prepare for the overwrite next time.
@ -644,6 +672,30 @@ void wxZRColaFrame::DoCopyAndReturn(const wxString& str)
}
void wxZRColaFrame::DoSetComposition(bool enable, ZRCola::transetid_t transet_id)
{
if (enable && transet_id == ZRCOLA_TRANSETID_DEFAULT) {
m_composition = true;
m_composition_id = ZRCOLA_TRANSETID_DEFAULT;
m_menuItemCompositionZRCola->Check(true);
m_toolComposition->Select(1);
} else if (enable && transet_id == ZRCOLA_TRANSETID_UNICODE) {
m_composition = true;
m_composition_id = ZRCOLA_TRANSETID_UNICODE;
m_menuItemCompositionUnicode->Check(true);
m_toolComposition->Select(2);
} else {
m_composition = false;
m_menuItemCompositionNone->Check(true);
m_toolComposition->Select(0);
}
// Notify source text something changed and should re-translate.
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
m_panel->m_source->ProcessWindowEvent(event2);
}
void wxZRColaFrame::DoSetTranslationSeq(int idx, ZRCola::transeqid_t transeq_id)
{
if (transeq_id == ZRCOLA_TRANSEQID_CUSTOM) {
@ -744,6 +796,8 @@ void wxPersistentZRColaFrame::Save() const
auto wnd = static_cast<const wxZRColaFrame*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
SaveValue(wxT("composition"), wnd->m_composition);
SaveValue(wxT("compositionId"), static_cast<int>(wnd->m_composition_id));
SaveValue(wxT("warnPUA"), wnd->m_warnPUA);
SaveValue(wxT("transeqId"), static_cast<int>(wnd->m_transeq_id));
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
@ -760,13 +814,19 @@ bool wxPersistentZRColaFrame::Restore()
int num;
if (RestoreValue(wxT("transeqId"), &num))
wnd->m_transeq_id = num;
wnd->m_transeq_id = (ZRCola::transeqid_t)num;
bool b;
if (RestoreValue(wxT("composition"), &b))
wnd->m_composition = b;
else
wnd->m_composition = wnd->m_transeq_id == ZRCOLA_TRANSEQID_DEFAULT;
if (RestoreValue(wxT("compositionId"), &num))
wnd->m_composition_id = (ZRCola::transetid_t)num;
if (RestoreValue(wxT("warnPUA"), &b))
wnd->m_warnPUA = b;
else
wnd->m_warnPUA = false;
int guiLevel;
return RestoreValue(wxT("guiLevel"), &guiLevel) && guiLevel == s_guiLevel ? wxPersistentTLWEx::Restore() : true;

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -26,7 +12,11 @@ class wxPersistentZRColaFrame;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include "zrcolachrslct.h"
#include "zrcolachrreq.h"
#include "zrcolasettings.h"
@ -34,7 +24,10 @@ class wxPersistentZRColaFrame;
#include <zrcola/language.h>
#include <zrcola/translate.h>
#include <wxex/persist/toplevel.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/taskbar.h>
#pragma warning(pop)
#if defined(__WXMSW__)
#include <msctf.h>
#endif
@ -83,8 +76,11 @@ protected:
void OnSendSource(wxCommandEvent& event);
void OnCopySourceAndReturn(wxCommandEvent& event);
void OnSendAbort(wxCommandEvent& event);
void OnCompositionMenu(wxCommandEvent& event);
void OnCompositionToolbar(wxCommandEvent& event);
void OnCompositionNone(wxCommandEvent& event);
void OnCompositionZRCola(wxCommandEvent& event);
void OnCompositionUnicode(wxCommandEvent& event);
virtual void OnCompositionChoice(wxCommandEvent& event);
void OnWarnPUA(wxCommandEvent& event);
void OnSettings(wxCommandEvent& event);
virtual void OnIdle(wxIdleEvent& event);
void OnTaskbarIconClick(wxTaskBarIconEvent& event);
@ -124,6 +120,7 @@ protected:
private:
void DoSend(const wxString& str);
void DoCopyAndReturn(const wxString& str);
void DoSetComposition(bool enable, ZRCola::transetid_t transet_id);
void DoSetTranslationSeq(int idx, ZRCola::transeqid_t transeq_id);
protected:
@ -142,6 +139,8 @@ protected:
wxZRColaCharRequest *m_chrReq; ///< Request a New Character dialog
wxZRColaSettings *m_settings; ///< Configuration dialog
bool m_composition; ///< Is (de)composition enabled?
ZRCola::transetid_t m_composition_id; ///< Which (de)composition is enabled
bool m_warnPUA; ///< Mark Private-Use-Area characters in destination text
ZRCola::transeqid_t m_transeq_id; ///< Translation sequence ID
wxZRColaTranslationSeq *m_transeq; ///< Custom translation sequence dialog
};

View File

@ -1,11 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 8 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "pch.h"
#include "zrcolachrgrid.h"
@ -133,8 +133,19 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->AppendSeparator();
m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION_MENU, wxString( _("&ZRCola (De)composition") ) , _("Toggle ZRCola character (De)composition"), wxITEM_CHECK );
m_menuEdit->Append( m_menuItemComposition );
wxMenu* m_menuComposition;
m_menuComposition = new wxMenu();
wxMenuItem* m_menuCompositionItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("(De)&composition"), wxEmptyString, wxITEM_NORMAL, m_menuComposition );
m_menuItemCompositionNone = new wxMenuItem( m_menuComposition, wxID_COMPOSITION_NONE, wxString( _("&None") ) , _("No character (De)composition"), wxITEM_RADIO );
m_menuComposition->Append( m_menuItemCompositionNone );
m_menuItemCompositionZRCola = new wxMenuItem( m_menuComposition, wxID_COMPOSITION_ZRCOLA, wxString( _("&ZRCola") ) , _("ZRCola character (De)composition"), wxITEM_RADIO );
m_menuComposition->Append( m_menuItemCompositionZRCola );
m_menuItemCompositionUnicode = new wxMenuItem( m_menuComposition, wxID_COMPOSITION_UNICODE, wxString( _("&Unicode") ) , _("Unicode character (De)composition"), wxITEM_RADIO );
m_menuComposition->Append( m_menuItemCompositionUnicode );
m_menuEdit->Append( m_menuCompositionItem );
m_menuTranslationSeq = new wxMenu();
wxMenuItem* m_menuTranslationSeqItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("Tra&nslation"), wxEmptyString, wxITEM_NORMAL, m_menuTranslationSeq );
@ -142,6 +153,11 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->AppendSeparator();
m_menuItemWarnPUA = new wxMenuItem( m_menuEdit, wxID_WARN_PUA, wxString( _("&PUA Warning") ) , _("Highlight Private Use Area Characters"), wxITEM_CHECK );
m_menuEdit->Append( m_menuItemWarnPUA );
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuSettings;
m_menuSettings = new wxMenuItem( m_menuEdit, wxID_SETTINGS, wxString( _("&Settings...") ) , _("Open program configuration dialog"), wxITEM_NORMAL );
m_menuEdit->Append( m_menuSettings );
@ -202,7 +218,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_toolEditPaste = m_toolbarEdit->AddTool( wxID_PASTE, _("Paste"), wxIcon( wxT("edit_paste.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_NORMAL, _("Paste"), _("Paste selection"), NULL );
m_toolbarEdit->Realize();
m_mgr.AddPane( m_toolbarEdit, wxAuiPaneInfo().Name( wxT("toolbarEdit") ).Top().Caption( _("Edit") ).PinButton( true ).Dock().Resizable().FloatingSize( wxDefaultSize ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
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_toolbarTranslate = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT );
m_toolCharSelect = m_toolbarTranslate->AddTool( wxID_CHARACTER_SELECTOR, _("Find Character"), wxIcon( wxT("char_select.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_CHECK, _("Find Character"), _("Toggle character search to select character to insert into text"), NULL );
@ -213,14 +229,21 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_toolbarTranslate->AddSeparator();
m_toolComposition = m_toolbarTranslate->AddTool( wxID_COMPOSITION_TOOLBAR, _("ZRCola (De)composition"), wxIcon( wxT("composition.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_CHECK, _("ZRCola (De)composition"), _("Toggle ZRCola character (De)composition"), NULL );
wxString m_toolCompositionChoices[] = { _("No (De)composition"), _("ZRCola"), _("Unicode") };
int m_toolCompositionNChoices = sizeof( m_toolCompositionChoices ) / sizeof( wxString );
m_toolComposition = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, FromDIP(wxSize( 120,-1 )), m_toolCompositionNChoices, m_toolCompositionChoices, 0 );
m_toolComposition->SetSelection( 0 );
m_toolbarTranslate->AddControl( m_toolComposition );
wxArrayString m_toolTranslationSeqChoices;
m_toolTranslationSeq = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, FromDIP(wxSize( 250,-1 )), m_toolTranslationSeqChoices, 0 );
m_toolTranslationSeq = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, FromDIP(wxSize( 180,-1 )), m_toolTranslationSeqChoices, 0 );
m_toolTranslationSeq->SetSelection( 0 );
m_toolbarTranslate->AddControl( m_toolTranslationSeq );
m_toolbarTranslate->AddSeparator();
m_toolWarnPUA = m_toolbarTranslate->AddTool( wxID_WARN_PUA, _("PUA Warning"), wxIcon( wxT("warn_pua.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_CHECK, _("Highlight Private Use Area Characters"), _("Highlight Private Use Area Characters"), NULL );
m_toolbarTranslate->Realize();
m_mgr.AddPane( m_toolbarTranslate, wxAuiPaneInfo().Name( wxT("toolbarCompose") ).Top().Caption( _("Compose") ).PinButton( true ).Dock().Resizable().FloatingSize( wxDefaultSize ).LeftDockable( false ).RightDockable( false ).Row( 0 ).Layer( 1 ).ToolbarPane() );
m_mgr.AddPane( m_toolbarTranslate, 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 );
@ -239,6 +262,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxZRColaFrameBase::OnClose ) );
this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
m_toolComposition->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnCompositionChoice ), NULL, this );
m_toolTranslationSeq->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnTranslationSeqChoice ), NULL, this );
}
@ -248,6 +272,7 @@ wxZRColaFrameBase::~wxZRColaFrameBase()
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxZRColaFrameBase::OnClose ) );
this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
m_toolComposition->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnCompositionChoice ), NULL, this );
m_toolTranslationSeq->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnTranslationSeqChoice ), NULL, this );
m_mgr.UnInit();
@ -271,7 +296,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
wxStaticBoxSizer* bSizerSourceEdit2;
bSizerSourceEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelSourceEdit, wxID_ANY, _("Decomposed Text") ), wxVERTICAL );
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_source = new wxTextCtrl( bSizerSourceEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
m_source->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_source->SetMinSize( FromDIP(wxSize( 100,25 )) );
@ -318,7 +343,7 @@ wxZRColaComposerPanelBase::wxZRColaComposerPanelBase( wxWindow* parent, wxWindow
wxStaticBoxSizer* bSizerDestinationEdit2;
bSizerDestinationEdit2 = new wxStaticBoxSizer( new wxStaticBox( m_panelDestinationEdit, wxID_ANY, _("Composed Text") ), wxVERTICAL );
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_destination = new wxTextCtrl( bSizerDestinationEdit2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH );
m_destination->SetFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_destination->SetMinSize( FromDIP(wxSize( 100,25 )) );
@ -407,19 +432,19 @@ wxZRColaCharacterCatalogPanelBase::wxZRColaCharacterCatalogPanelBase( wxWindow*
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( false );
m_grid->SetColLabelSize( 0 );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_grid->EnableDragRowSize( false );
m_grid->SetRowLabelSize( 0 );
m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_grid->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_grid->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_grid->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_grid->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_grid->SetMinSize( FromDIP(wxSize( 35,35 )) );
bSizer->Add( m_grid, 1, wxALL|wxEXPAND, FromDIP(5) );
@ -520,7 +545,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
sbSizerSearch->Fit( m_search_panel );
sbSizerBrowse->Add( m_search_panel, 0, wxEXPAND, FromDIP(5) );
m_gridResults = new wxZRColaCharGrid( sbSizerBrowse->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC );
m_gridResults = new wxZRColaCharGrid( sbSizerBrowse->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxBORDER_STATIC );
// Grid
m_gridResults->CreateGrid( 0, 0 );
@ -533,18 +558,18 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridResults->EnableDragColMove( false );
m_gridResults->EnableDragColSize( false );
m_gridResults->SetColLabelSize( 0 );
m_gridResults->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridResults->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridResults->EnableDragRowSize( false );
m_gridResults->SetRowLabelSize( 0 );
m_gridResults->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridResults->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridResults->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridResults->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridResults->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridResults->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_gridResults->SetToolTip( _("Character search results") );
m_gridResults->SetMinSize( FromDIP(wxSize( 560,35 )) );
@ -571,18 +596,18 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridRecent->EnableDragColMove( false );
m_gridRecent->EnableDragColSize( false );
m_gridRecent->SetColLabelSize( 0 );
m_gridRecent->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRecent->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridRecent->EnableDragRowSize( false );
m_gridRecent->SetRowLabelSize( 0 );
m_gridRecent->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRecent->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridRecent->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridRecent->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRecent->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridRecent->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_gridRecent->SetToolTip( _("List of recently inserted characters") );
@ -612,7 +637,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
bSizerUnicode->Add( m_unicode, 0, wxALIGN_CENTER|wxBOTTOM|wxRIGHT|wxTOP, FromDIP(5) );
m_shortcut = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_READONLY );
m_shortcut = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_CENTER );
m_shortcut->SetToolTip( _("Keyboard shortcut in Composer window") );
bSizerUnicode->Add( m_shortcut, 1, wxALL|wxEXPAND, FromDIP(5) );
@ -634,35 +659,35 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridPreview->EnableDragColMove( false );
m_gridPreview->EnableDragColSize( false );
m_gridPreview->SetColLabelSize( 0 );
m_gridPreview->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridPreview->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridPreview->SetRowSize( 0, FromDIP(200) );
m_gridPreview->EnableDragRowSize( false );
m_gridPreview->SetRowLabelSize( 0 );
m_gridPreview->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridPreview->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridPreview->SetDefaultCellFont( wxFont( 96, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridPreview->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridPreview->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridPreview->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_gridPreview->SetToolTip( _("Character preview") );
sbSizerPreview->Add( m_gridPreview, 0, wxALL|wxEXPAND, FromDIP(5) );
m_description = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE|wxTE_READONLY );
m_description = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_CENTER );
m_description->SetToolTip( _("Unicode character description") );
sbSizerPreview->Add( m_description, 1, wxALL|wxEXPAND, FromDIP(5) );
m_tags = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE|wxTE_READONLY );
m_tags = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_CENTER );
m_tags->SetToolTip( _("Character tags") );
sbSizerPreview->Add( m_tags, 1, wxALL|wxEXPAND, FromDIP(5) );
m_category = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_READONLY );
m_category = new wxTextCtrl( sbSizerPreview->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_CENTER );
m_category->SetToolTip( _("Unicode character category") );
sbSizerPreview->Add( m_category, 0, wxALL|wxEXPAND, FromDIP(5) );
@ -691,7 +716,7 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
wxStaticBoxSizer* sbSizerRelated;
sbSizerRelated = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Re&lated") ), wxVERTICAL );
m_gridRelated = new wxZRColaCharGrid( sbSizerRelated->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC );
m_gridRelated = new wxZRColaCharGrid( sbSizerRelated->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxBORDER_STATIC );
// Grid
m_gridRelated->CreateGrid( 0, 0 );
@ -704,18 +729,18 @@ wxZRColaCharSelectBase::wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id,
m_gridRelated->EnableDragColMove( false );
m_gridRelated->EnableDragColSize( false );
m_gridRelated->SetColLabelSize( 0 );
m_gridRelated->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRelated->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridRelated->EnableDragRowSize( false );
m_gridRelated->SetRowLabelSize( 0 );
m_gridRelated->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRelated->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridRelated->SetDefaultCellFont( wxFont( 20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("ZRCola") ) );
m_gridRelated->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_gridRelated->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_gridRelated->SetToolTip( _("List of related characters") );
sbSizerRelated->Add( m_gridRelated, 1, wxALL|wxEXPAND, FromDIP(5) );
@ -802,7 +827,7 @@ wxZRColaCharSelectBase::~wxZRColaCharSelectBase()
wxZRColaSettingsBase::wxZRColaSettingsBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( parent, id, title, pos, size, style, name )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetSizeHints( wxDefaultSize, wxSize( -1,-1 ) );
wxBoxSizer* bSizerContent;
bSizerContent = new wxBoxSizer( wxVERTICAL );
@ -901,7 +926,7 @@ wxZRColaSettingsBase::~wxZRColaSettingsBase()
wxZRColaAboutBase::wxZRColaAboutBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( parent, id, title, pos, size, style, name )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetSizeHints( wxDefaultSize, wxSize( -1,-1 ) );
wxBoxSizer* bSizerContent;
bSizerContent = new wxBoxSizer( wxVERTICAL );
@ -1157,10 +1182,10 @@ wxZRColaTranslationSeqBase::wxZRColaTranslationSeqBase( wxWindow* parent, wxWind
wxBoxSizer* bSizerTransSelect;
bSizerTransSelect = new wxBoxSizer( wxVERTICAL );
m_add = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(">"), wxDefaultPosition, FromDIP(wxSize( 32,32 )), 0 );
m_add = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, FromDIP(wxSize( 32,32 )), 0 );
bSizerTransSelect->Add( m_add, 0, wxALL, FromDIP(5) );
m_remove = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _("<"), wxDefaultPosition, FromDIP(wxSize( 32,32 )), 0 );
m_remove = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, FromDIP(wxSize( 32,32 )), 0 );
bSizerTransSelect->Add( m_remove, 0, wxALL, FromDIP(5) );
@ -1187,10 +1212,10 @@ wxZRColaTranslationSeqBase::wxZRColaTranslationSeqBase( wxWindow* parent, wxWind
wxBoxSizer* bSizerTransActiveReorder;
bSizerTransActiveReorder = new wxBoxSizer( wxHORIZONTAL );
m_selectedUp = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _("Up"), wxDefaultPosition, FromDIP(wxSize( 70,-1 )), 0 );
m_selectedUp = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, FromDIP(wxSize( 32,32 )), 0 );
bSizerTransActiveReorder->Add( m_selectedUp, 0, wxALL, FromDIP(5) );
m_selectedDown = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _("Down"), wxDefaultPosition, FromDIP(wxSize( 70,-1 )), 0 );
m_selectedDown = new wxButton( sbSizerTranslationSet->GetStaticBox(), wxID_ANY, _(""), wxDefaultPosition, FromDIP(wxSize( 32,32 )), 0 );
bSizerTransActiveReorder->Add( m_selectedDown, 0, wxALL, FromDIP(5) );

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 8 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __ZRCOLAGUI_H__
#define __ZRCOLAGUI_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -68,7 +67,10 @@ class wxZRColaFrameBase : public wxFrame
wxID_SEND_SOURCE,
wxID_COPY_SOURCE_AND_RETURN,
wxID_SEND_ABORT,
wxID_COMPOSITION_MENU,
wxID_COMPOSITION_NONE,
wxID_COMPOSITION_ZRCOLA,
wxID_COMPOSITION_UNICODE,
wxID_WARN_PUA,
wxID_SETTINGS,
wxID_TOOLBAR_EDIT,
wxID_TOOLBAR_TRANSLATE,
@ -76,15 +78,17 @@ class wxZRColaFrameBase : public wxFrame
wxID_HELP_INSTRUCTIONS,
wxID_HELP_SHORTCUTS,
wxID_HELP_REQCHAR,
wxID_HELP_UPDATE,
wxID_COMPOSITION_TOOLBAR
wxID_HELP_UPDATE
};
wxMenuBar* m_menubar;
wxMenu* m_menuProgram;
wxMenu* m_menuEdit;
wxMenuItem* m_menuItemComposition;
wxMenuItem* m_menuItemCompositionNone;
wxMenuItem* m_menuItemCompositionZRCola;
wxMenuItem* m_menuItemCompositionUnicode;
wxMenu* m_menuTranslationSeq;
wxMenuItem* m_menuItemWarnPUA;
wxMenu* m_menuView;
wxMenu* m_menuHelp;
wxAuiToolBar* m_toolbarEdit;
@ -95,8 +99,9 @@ class wxZRColaFrameBase : public wxFrame
wxAuiToolBarItem* m_toolCharSelect;
wxAuiToolBarItem* m_toolSendDestination;
wxAuiToolBarItem* m_toolSendSource;
wxAuiToolBarItem* m_toolComposition;
wxChoice* m_toolComposition;
wxChoice* m_toolTranslationSeq;
wxAuiToolBarItem* m_toolWarnPUA;
wxZRColaCharacterCatalogPanel* m_panelChrCat;
wxStatusBar* m_statusBar;
@ -104,6 +109,7 @@ class wxZRColaFrameBase : public wxFrame
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
virtual void OnCompositionChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTranslationSeqChoice( wxCommandEvent& event ) { event.Skip(); }
@ -154,7 +160,7 @@ class wxZRColaComposerPanelBase : public wxPanel
wxTextCtrl* m_source;
wxTextCtrl* m_destination;
wxZRColaComposerPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxT("ZRColaComposerPanel") );
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_splitterSourceOnIdle( wxIdleEvent& )
@ -192,7 +198,7 @@ class wxZRColaCharacterCatalogPanelBase : public wxPanel
public:
wxZRColaCharacterCatalogPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxT("ZRColaCharacterCatalog") );
wxZRColaCharacterCatalogPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxT("ZRColaCharacterCatalog") );
~wxZRColaCharacterCatalogPanelBase();
};
@ -287,7 +293,7 @@ class wxZRColaSettingsBase : public wxDialog
public:
wxZRColaSettingsBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaSettings") );
wxZRColaSettingsBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaSettings") );
~wxZRColaSettingsBase();
};
@ -414,4 +420,3 @@ class wxZRColaTranslationSeqBase : public wxDialog
};
#endif //__ZRCOLAGUI_H__

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -47,7 +33,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
if (!chr) {
int key = e.GetKeyCode();
if (WXK_NUMPAD0 <= key && key <= WXK_NUMPAD9)
chr = '0' + (key - WXK_NUMPAD0);
chr = '0' + (wxChar)(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) {
@ -81,14 +67,14 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
{
// Parse key event and save it at the end of the key sequence.
ZRCola::keyseq_db::keyseq::key_t key;
key.key = e.GetRawKeyCode();
key.key = (wchar_t)e.GetRawKeyCode();
#if defined(__WXMSW__)
// Translate from local keyboard to scan code.
key.key = ::MapVirtualKey(key.key, MAPVK_VK_TO_VSC);
key.key = static_cast<wchar_t>(::MapVirtualKey(key.key, MAPVK_VK_TO_VSC) & 0xffff);
// Translate from scan code to U.S. Keyboard.
static const HKL s_hkl = ::LoadKeyboardLayout(_T("00000409"), 0);
key.key = ::MapVirtualKeyEx(key.key, MAPVK_VSC_TO_VK, s_hkl);
key.key = static_cast<wchar_t>(::MapVirtualKeyEx(key.key, MAPVK_VSC_TO_VK, s_hkl) & 0xffff);
#endif
key.modifiers =
(e.ShiftDown() ? ZRCola::keyseq_db::keyseq::SHIFT : 0) |
@ -147,7 +133,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
if (count) {
// Zero terminate sequence and parse the Unicode value.
m_insert_seq.push_back(0);
wchar_t chr = strtoul(m_insert_seq.data(), NULL, 16);
wchar_t chr = (wchar_t)strtoul(m_insert_seq.data(), NULL, 16);
if (chr) {
wxObject *obj = event.GetEventObject();

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -27,7 +13,11 @@ class wxZRColaKeyHandler;
#include <zrcolaui/keyboard.h>
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/event.h>
#pragma warning(pop)
#include <vector>

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -36,7 +22,7 @@ wxZRColaSettings::wxZRColaSettings(wxWindow* parent) :
wxString
label(lang.name(), lang.name_len()),
label_tran(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
m_languages->Insert(label_tran, i);
m_languages->Insert(label_tran, (unsigned int)i);
}
}
@ -59,7 +45,7 @@ void wxZRColaSettings::OnInitDialog(wxInitDialogEvent& event)
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
ZRCola::language_db::indexLang::size_type start;
m_languages->Select(app->m_lang_db.idxLang.find(ZRCola::language_db::language(m_lang), start) ? start : -1);
m_languages->Select(app->m_lang_db.idxLang.find(ZRCola::language_db::language(m_lang), start) ? (int)start : -1);
}

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -26,7 +12,11 @@ class wxPersistentZRColaSettings;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include <wxex/persist/toplevel.h>
#include <vector>

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -240,7 +226,7 @@ bool wxPersistentZRColaTranslationSeq::Restore()
if (RestoreValue(wxT("transeq"), &str)) {
std::vector<ZRCola::transetid_t> transet;
for (wxStringTokenizer tok(str, wxT("|")); tok.HasMoreTokens(); ) {
unsigned long val = _tcstoul(tok.GetNextToken().c_str(), NULL, 10);
ZRCola::transetid_t val = (ZRCola::transetid_t)_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) {

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -26,7 +12,11 @@ class wxPersistentZRColaTranslationSeq;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include <zrcola/translate.h>
#include <wxex/persist/toplevel.h>
#include <vector>

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
//////////////////////////////////////////////////////////////////////////
@ -41,6 +27,7 @@ wxZRColaUpdater::wxZRColaUpdater(wxWindow* parent) :
// Prepare Updater.
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
#pragma warning(suppress: 26812) // wxLanguage is unscoped.
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!"));
@ -80,7 +67,7 @@ wxZRColaUpdater::~wxZRColaUpdater()
void wxZRColaUpdater::OnIdle(wxIdleEvent& event)
{
if (!m_finished) {
m_buttonUpdate->Enable(m_updater->CheckForUpdate() == wxUpdCheckThread::wxUpdUpdateAvailable);
m_buttonUpdate->Enable(m_updater->CheckForUpdate() == wxUpdCheckThread::wxResult::UpdateAvailable);
m_finished = true;
}
}

View File

@ -1,20 +1,6 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
///
@ -25,11 +11,16 @@ class wxZRColaUpdater;
#pragma once
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include "zrcolagui.h"
#pragma warning(pop)
#include <Updater/chkthread.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/log.h>
#pragma warning(pop)
///

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\lib\WinStd\include;..\lib\stdex\include;..\lib\libZRCola\include;..\lib\libZRColaUI\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

Binary file not shown.

View File

@ -13,51 +13,51 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}</ProjectGuid>
<RootNamespace>ZRColaCompile</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Debug'">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Release'">
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRColaCompile.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
<Import Project="ZRColaCompile.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\lib\wxExtend\include;..\lib\WinStd\include;..\lib\stdex\include;..\lib\libZRCola\include;..\lib\libZRColaUI\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="dbsource.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="parse.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="dbsource.h" />
<ClInclude Include="parse.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\lib\libZRColaUI\build\libZRColaUI.vcxproj">
@ -66,10 +66,7 @@
<ProjectReference Include="..\lib\libZRCola\build\libZRCola.vcxproj">
<Project>{3c61929e-7289-4101-8d0a-da22d6e1aea8}</Project>
</ProjectReference>
<ProjectReference Include="..\lib\WinStd\build\WinStd-16.0.vcxproj">
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
</ProjectReference>
<ProjectReference Include="..\lib\wxExtend\build\wxExtendLib-16.0.vcxproj">
<ProjectReference Include="..\lib\wxExtend\build\wxExtendLib.vcxproj">
<Project>{D3E29951-D9F5-486D-A167-20AE8E90B1FA}</Project>
</ProjectReference>
</ItemGroup>

View File

@ -19,7 +19,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
@ -33,7 +33,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="dbsource.h">

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
using namespace std;
using namespace stdex;
@ -51,12 +37,12 @@ void ZRCola::DBSource::character_bank::build_related()
}
}
delete workers; // This line of code sounds horrible, I know.
delete [] workers; // This line of code sounds horrible, I know.
}
ZRCola::DBSource::character_bank::build_related_worker::build_related_worker(_In_ const character_bank *cb, _In_ iterator from, _In_ iterator to) :
win_handle<INVALID_HANDLE_VALUE>((HANDLE)_beginthreadex(NULL, 0, process, this, CREATE_SUSPENDED, NULL)),
winstd::thread((HANDLE)_beginthreadex(NULL, 0, process, this, CREATE_SUSPENDED, NULL)),
m_heap(HeapCreate(0, 0, 0)),
m_cb(cb),
m_from(from),
@ -134,7 +120,7 @@ unsigned int __stdcall ZRCola::DBSource::character_bank::build_related_worker::p
// ZRCola::DBSource::character_desc_idx
//////////////////////////////////////////////////////////////////////////
void ZRCola::DBSource::character_desc_idx::parse_keywords(const wchar_t *str, set<wstring> &terms)
void ZRCola::DBSource::character_desc_idx::parse_keywords(_In_ const wchar_t *str, _Inout_ set<wstring> &terms)
{
wxASSERT_MSG(str, wxT("string is NULL"));
@ -200,7 +186,7 @@ void ZRCola::DBSource::character_desc_idx::add_keywords(const set<wstring> &term
}
void ZRCola::DBSource::character_desc_idx::save(ZRCola::textindex<wchar_t, wchar_t, unsigned __int32> &idx) const
void ZRCola::DBSource::character_desc_idx::save(ZRCola::textindex<wchar_t, wchar_t, uint32_t> &idx) const
{
idx .clear();
idx.keys .clear();
@ -219,7 +205,7 @@ void ZRCola::DBSource::character_desc_idx::save(ZRCola::textindex<wchar_t, wchar
// Convert the index.
for (const_iterator i = cbegin(), i_end = cend(); i != i_end; ++i) {
ZRCola::mappair_t<unsigned __int32> p = { idx.keys.size(), idx.values.size() };
ZRCola::mappair_t<uint32_t> p = { idx.keys.size(), idx.values.size() };
idx.push_back(p);
idx.keys.insert(idx.keys.end(), i->first.cbegin(), i->first.cend());
idx.values.insert(idx.values.end(), i->second.cbegin(), i->second.cend());
@ -231,7 +217,8 @@ void ZRCola::DBSource::character_desc_idx::save(ZRCola::textindex<wchar_t, wchar
// ZRCola::DBSource
//////////////////////////////////////////////////////////////////////////
ZRCola::DBSource::DBSource()
ZRCola::DBSource::DBSource() :
m_locale(nullptr)
{
// Initialize ignore list.
m_terms_ignore.insert(L"letter");
@ -255,6 +242,8 @@ ZRCola::DBSource::~DBSource()
m_comTranslation.free();
m_pCharacterGroup1.free();
m_comCharacterGroup.free();
m_pHighlight1.free();
m_comHighlight.free();
if (m_db)
m_db->Close();
@ -277,7 +266,10 @@ bool ZRCola::DBSource::Open(LPCTSTR filename)
cn += L"Dbq=";
cn += filename;
cn += L";Uid=;Pwd=;";
#pragma warning(push)
#pragma warning(disable: 6387) // Connection15::Open() declaration is wrong: it defaults username and password parameters to NULL, but annotates them as required non-NULL.
hr = m_db->Open(bstr(cn.c_str()));
#pragma warning(pop)
if (SUCCEEDED(hr)) {
// Database open and ready.
m_filename = filename;
@ -315,7 +307,7 @@ bool ZRCola::DBSource::Open(LPCTSTR filename)
com_obj<ADOParameters> params;
wxVERIFY(SUCCEEDED(m_comTranslation->get_Parameters(&params)));
wxASSERT_MSG(!m_pTranslation1, wxT("ADO command parameter already created"));
wxVERIFY(SUCCEEDED(m_comTranslation->CreateParameter(bstr(L"@Script"), adInteger, adParamInput, 0, variant(DISP_E_PARAMNOTFOUND, VT_ERROR), &m_pTranslation1)));
wxVERIFY(SUCCEEDED(m_comTranslation->CreateParameter(bstr(L"@Script"), adSmallInt, adParamInput, 0, variant(DISP_E_PARAMNOTFOUND, VT_ERROR), &m_pTranslation1)));
wxVERIFY(SUCCEEDED(params->Append(m_pTranslation1)));
}
@ -332,10 +324,27 @@ bool ZRCola::DBSource::Open(LPCTSTR filename)
com_obj<ADOParameters> params;
wxVERIFY(SUCCEEDED(m_comTranslationSets->get_Parameters(&params)));
wxASSERT_MSG(!m_pTranslationSets1, wxT("ADO command parameter already created"));
wxVERIFY(SUCCEEDED(m_comTranslationSets->CreateParameter(bstr(L"@ID"), adInteger, adParamInput, 0, variant(DISP_E_PARAMNOTFOUND, VT_ERROR), &m_pTranslationSets1)));
wxVERIFY(SUCCEEDED(m_comTranslationSets->CreateParameter(bstr(L"@ID"), adSmallInt, adParamInput, 0, variant(DISP_E_PARAMNOTFOUND, VT_ERROR), &m_pTranslationSets1)));
wxVERIFY(SUCCEEDED(params->Append(m_pTranslationSets1)));
}
wxASSERT_MSG(!m_comHighlight, wxT("ADO command already created"));
wxVERIFY(SUCCEEDED(::CoCreateInstance(CLSID_CADOCommand, NULL, CLSCTX_ALL, IID_IADOCommand, (LPVOID*)&m_comHighlight)));
wxVERIFY(SUCCEEDED(m_comHighlight->put_ActiveConnection(variant(m_db))));
wxVERIFY(SUCCEEDED(m_comHighlight->put_CommandType(adCmdText)));
wxVERIFY(SUCCEEDED(m_comHighlight->put_CommandText(bstr(L"SELECT [komb] "
L"FROM [VRS_HighlightChars2] "
L"WHERE [group]=? "
L"ORDER BY [komb]"))));
{
// Create and add command parameters.
com_obj<ADOParameters> params;
wxVERIFY(SUCCEEDED(m_comHighlight->get_Parameters(&params)));
wxASSERT_MSG(!m_pHighlight1, wxT("ADO command parameter already created"));
wxVERIFY(SUCCEEDED(m_comHighlight->CreateParameter(bstr(L"@group"), adSmallInt, adParamInput, 0, variant(DISP_E_PARAMNOTFOUND, VT_ERROR), &m_pHighlight1)));
wxVERIFY(SUCCEEDED(params->Append(m_pHighlight1)));
}
return true;
} else {
_ftprintf(stderr, wxT("%s: error ZCC0011: Could not open database (0x%x).\n"), (LPCTSTR)filename, hr);
@ -396,15 +405,15 @@ bool ZRCola::DBSource::GetValue(const com_obj<ADOField>& f, bool& val) const
}
bool ZRCola::DBSource::GetValue(const com_obj<ADOField>& f, int& val) const
bool ZRCola::DBSource::GetValue(const com_obj<ADOField>& f, short& val) const
{
wxASSERT_MSG(f, wxT("field is empty"));
variant v;
wxVERIFY(SUCCEEDED(f->get_Value(&v)));
wxCHECK(SUCCEEDED(v.change_type(VT_I4)), false);
wxCHECK(SUCCEEDED(v.change_type(VT_I2)), false);
val = V_I4(&v);
val = V_I2(&v);
return true;
}
@ -661,7 +670,7 @@ bool ZRCola::DBSource::GetTagNames(const winstd::com_obj<ADOField>& f, LCID lcid
// Add name to the list.
names.push_back(std::move(name));
break;
} else if (ZRCola::tagname_db::tagname::CompareName(lcid, n->data(), (unsigned __int16)n->length(), name.data(), (unsigned __int16)name.length()) == CSTR_EQUAL) {
} else if (ZRCola::tagname_db::tagname::CompareName(lcid, n->data(), (uint16_t)n->length(), name.data(), (uint16_t)name.length()) == CSTR_EQUAL) {
// Name is already on the list.
break;
}
@ -747,7 +756,7 @@ bool ZRCola::DBSource::SelectTranslations(com_obj<ADORecordset> &rs) const
}
bool ZRCola::DBSource::SelectTranslations(int set, winstd::com_obj<ADORecordset>& rs) const
bool ZRCola::DBSource::SelectTranslations(short set, winstd::com_obj<ADORecordset>& rs) const
{
// Create a new recordset.
rs.free();
@ -933,7 +942,7 @@ bool ZRCola::DBSource::GetTranslationSeq(const com_obj<ADORecordset>& rs, ZRCola
wxVERIFY(SUCCEEDED(flds2->get_Item(variant(L"Script"), &f_set)));
size_t n = 0;
for (VARIANT_BOOL eof = VARIANT_TRUE; SUCCEEDED(rs_chars->get_EOF(&eof)) && !eof; rs_chars->MoveNext(), n++) {
int set;
short set;
wxCHECK(GetValue(f_set, set), false);
ts.sets.push_back(set);
}
@ -977,21 +986,21 @@ bool ZRCola::DBSource::GetKeySequence(const com_obj<ADORecordset>& rs, ZRCola::D
wxCHECK(GetUnicodeString(f, ks.chr), false);
}
int modifiers;
short modifiers;
{
com_obj<ADOField> f;
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"Modifiers"), &f)));
wxCHECK(GetValue(f, modifiers), false);
}
int keycode1;
short keycode1;
{
com_obj<ADOField> f;
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"KeyCodePre"), &f)));
wxCHECK(GetValue(f, keycode1), false);
}
int keycode;
short keycode;
{
com_obj<ADOField> f;
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"KeyCode"), &f)));
@ -1009,18 +1018,18 @@ bool ZRCola::DBSource::GetKeySequence(const com_obj<ADORecordset>& rs, ZRCola::D
if (keycode1) {
// First key in the sequence is complete.
keyseq::keycode kc1 = {
keyseq::keycode::translate_slen(keycode1),
keyseq::keycode::translate_slen(static_cast<wchar_t>(keycode1)),
(modifiers & 0x100) != 0,
(modifiers & 0x200) != 0,
(modifiers & 0x400) != 0 };
ks.seq.push_back(kc1);
keyseq::keycode kc2 = { keyseq::keycode::translate_slen(keycode), shift };
keyseq::keycode kc2 = { keyseq::keycode::translate_slen(static_cast<wchar_t>(keycode)), shift };
ks.seq.push_back(kc2);
} else {
// First key in the sequence is only modifier(s).
keyseq::keycode kc1 = {
keyseq::keycode::translate_slen(keycode),
keyseq::keycode::translate_slen(static_cast<wchar_t>(keycode)),
shift || (modifiers & 0x100) != 0,
(modifiers & 0x200) != 0,
(modifiers & 0x400) != 0 };
@ -1449,3 +1458,41 @@ bool ZRCola::DBSource::GetTagName(const winstd::com_obj<ADORecordset>& rs, tagna
return true;
}
bool ZRCola::DBSource::SelectHighlights(short set, winstd::com_obj<ADORecordset>& rs) const
{
// Create a new recordset.
rs.free();
wxVERIFY(SUCCEEDED(::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_ALL, IID_IADORecordset, (LPVOID*)&rs)));
wxVERIFY(SUCCEEDED(rs->put_CursorLocation(adUseClient)));
wxVERIFY(SUCCEEDED(rs->put_CursorType(adOpenForwardOnly)));
wxVERIFY(SUCCEEDED(rs->put_LockType(adLockReadOnly)));
// Open it.
wxVERIFY(SUCCEEDED(m_pHighlight1->put_Value(variant(set))));
if (FAILED(rs->Open(variant(m_comHighlight), variant(DISP_E_PARAMNOTFOUND, VT_ERROR)))) {
_ftprintf(stderr, wxT("%s: error ZCC0101: Error loading highlights from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
LogErrors();
return false;
}
return true;
}
bool ZRCola::DBSource::GetHighlight(const com_obj<ADORecordset>& rs, ZRCola::DBSource::highlight& h) const
{
wxASSERT_MSG(rs, wxT("recordset is empty"));
com_obj<ADOFields> flds;
wxVERIFY(SUCCEEDED(rs->get_Fields(&flds)));
{
com_obj<ADOField> f;
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"komb"), &f)));
wxCHECK(GetUnicodeString(f, h.chr), false);
}
return true;
}

View File

@ -1,26 +1,12 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#pragma once
#include <zrcola/character.h>
#include <zrcola/common.h>
#include <zrcola/highlight.h>
#include <zrcola/language.h>
#include <zrcola/tag.h>
#include <zrcola/translate.h>
@ -31,7 +17,11 @@
#include <WinStd/COM.h>
#include <WinStd/Win.h>
#include <wxex/common.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/debug.h>
#pragma warning(pop)
#pragma warning(push)
#pragma warning(disable: 4091)
@ -57,26 +47,27 @@ namespace ZRCola {
///
class charseq {
public:
int rank; ///< Sequence rank
short rank; ///< Sequence rank
std::wstring str; ///< Sequence string
inline charseq()
inline charseq() :
rank(0)
{
}
inline charseq(_In_ int _rank, _In_z_ const wchar_t *_str) :
inline charseq(_In_ short _rank, _In_z_ const wchar_t *_str) :
rank(_rank),
str (_str)
{
}
inline charseq(_In_ int _rank, _In_ const std::wstring &_str) :
inline charseq(_In_ short _rank, _In_ const std::wstring &_str) :
rank(_rank),
str (_str)
{
}
inline charseq(_In_ int _rank, _Inout_ std::wstring &&_str) :
inline charseq(_In_ short _rank, _Inout_ std::wstring &&_str) :
rank(_rank),
str (std::move(_str))
{
@ -122,10 +113,12 @@ namespace ZRCola {
///
class translation {
public:
int set; ///< Translation set ID
short set; ///< Translation set ID
charseq src; ///< Source sequence
std::string norm; ///< Normalization footprint
charseq dst; ///< Destination sequence
inline translation() : set((short)ZRCOLA_TRANSETID_DEFAULT) {}
};
@ -134,9 +127,11 @@ namespace ZRCola {
///
class transet {
public:
int set; ///< ID
short set; ///< ID
std::wstring src; ///< Source name
std::wstring dst; ///< Destination name
inline transet() : set((short)ZRCOLA_TRANSETID_DEFAULT) {}
};
@ -145,10 +140,15 @@ namespace ZRCola {
///
class transeq {
public:
int seq; ///< ID
int rank; ///< Rank
short seq; ///< ID
short rank; ///< Rank
std::wstring name; ///< Name
std::vector<int> sets; ///< Sets
std::vector<short> sets; ///< Sets
inline transeq() :
seq(0),
rank(0)
{}
};
@ -200,6 +200,8 @@ namespace ZRCola {
public:
ZRCola::langid_t lang; ///< Language ID
std::wstring name; ///< Name
inline language() : lang(ZRCola::langid_t::blank) {}
};
@ -210,6 +212,8 @@ namespace ZRCola {
public:
std::wstring chr; ///> Character
ZRCola::langid_t lang; ///< Language ID
inline langchar() : lang(ZRCola::langid_t::blank) {}
};
@ -218,11 +222,13 @@ namespace ZRCola {
///
class chrgrp {
public:
int grp; ///< Character group ID
int rank; ///< Rank
short grp; ///< Character group ID
short 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
std::vector<uint16_t> show; ///< Bit vector if particular character from \c chars is displayed initially
inline chrgrp() : grp(0), rank(0) {}
};
@ -269,7 +275,7 @@ namespace ZRCola {
void build_related();
protected:
class build_related_worker : public winstd::win_handle<INVALID_HANDLE_VALUE>
class build_related_worker : public winstd::thread
{
public:
build_related_worker(_In_ const character_bank *cb, _In_ iterator from, _In_ iterator to);
@ -302,19 +308,12 @@ namespace ZRCola {
///
/// Character description index key comparator
///
struct character_desc_idx_less : public std::binary_function<std::wstring, std::wstring, bool>
struct character_desc_idx_less
{
inline bool operator()(const std::wstring& _Left, const std::wstring& _Right) const
{
size_t
_Left_len = _Left .size(),
_Right_len = _Right.size();
int r = _wcsncoll(_Left.c_str(), _Right.c_str(), std::min<size_t>(_Left_len, _Right_len));
if (r != 0 ) return r < 0;
else if (_Left_len < _Right_len) return true;
return false;
auto &coll = std::use_facet<std::collate<wchar_t>>(std::locale());
return coll.compare(&*_Left.cbegin(), &*_Left.cend(), &*_Right.cbegin(), &*_Right.cend()) < 0;
}
};
@ -325,7 +324,7 @@ namespace ZRCola {
class character_desc_idx : public std::map<std::wstring, std::vector<wchar_t>, character_desc_idx_less>
{
public:
static void parse_keywords(const wchar_t *str, std::set<std::wstring> &terms);
static void parse_keywords(_In_ const wchar_t *str, _Inout_ std::set<std::wstring> &terms);
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)
{
@ -334,7 +333,7 @@ namespace ZRCola {
add_keywords(terms, chr, sub);
}
void save(ZRCola::textindex<wchar_t, wchar_t, unsigned __int32> &idx) const;
void save(ZRCola::textindex<wchar_t, wchar_t, uint32_t> &idx) const;
protected:
inline void add_keyword(const std::wstring &term, const std::wstring &chr)
@ -367,8 +366,10 @@ namespace ZRCola {
class chrcat {
public:
ZRCola::chrcatid_t cat; ///> Category ID
int rank; ///< Rank
short rank; ///< Rank
std::wstring name; ///< Name
inline chrcat() : cat(ZRCola::chrcatid_t::blank), rank(0) {}
};
@ -378,7 +379,9 @@ namespace ZRCola {
class chrtag {
public:
std::wstring chr; ///> Character
int tag; ///< Tag ID
short tag; ///< Tag ID
inline chrtag() : tag(0) {}
};
@ -387,8 +390,22 @@ namespace ZRCola {
///
class tagname {
public:
int tag; ///< Tag ID
short tag; ///< Tag ID
std::map<LCID, std::list<std::wstring> > names; ///< Names
inline tagname() : tag(0) {}
};
///
/// Highlight
///
class highlight {
public:
short set; ///< Highlight set ID
std::wstring chr; ///< Character sequence
inline highlight() : set((short)ZRCOLA_HLGHTSETID_DEFAULT) {}
};
@ -440,18 +457,6 @@ namespace ZRCola {
return SUCCEEDED(rs->get_RecordCount(&count)) ? count : (size_t)-1;
}
///
/// Splits string to individual keywords
///
/// \param[in ] str String
/// \param[out] keywords Array of keywords
///
/// \returns
/// - true when successful
/// - false otherwise
///
static bool GetKeywords(const wchar_t *str, std::vector< std::wstring > &keywords);
///
/// Gets boolean from ZRCola.zrc database
///
@ -474,7 +479,7 @@ namespace ZRCola {
/// - true when successful
/// - false otherwise
///
bool GetValue(const winstd::com_obj<ADOField>& f, int& val) const;
bool GetValue(const winstd::com_obj<ADOField>& f, short& val) const;
///
/// Gets string from ZRCola.zrc database
@ -616,7 +621,7 @@ namespace ZRCola {
/// - true when query succeeds
/// - false otherwise
///
bool SelectTranslations(int set, winstd::com_obj<ADORecordset>& rs) const;
bool SelectTranslations(short set, winstd::com_obj<ADORecordset>& rs) const;
///
/// Returns translation data
@ -860,6 +865,30 @@ namespace ZRCola {
///
bool GetTagName(const winstd::com_obj<ADORecordset>& rs, tagname& tn) const;
///
/// Returns character highlights by set
///
/// \param[in ] set Highlight set ID
/// \param[out] rs Recordset with results
///
/// \returns
/// - true when query succeeds
/// - false otherwise
///
bool SelectHighlights(short set, winstd::com_obj<ADORecordset>& rs) const;
///
/// Returns highlight data
///
/// \param[in] rs Recordset with results
/// \param[out] h Highlight
///
/// \returns
/// - true when succeeded
/// - false otherwise
///
bool GetHighlight(const winstd::com_obj<ADORecordset>& rs, highlight& h) const;
protected:
std::basic_string<TCHAR> m_filename; ///< Database filename
winstd::com_obj<ADOConnection> m_db; ///< Database
@ -874,6 +903,9 @@ namespace ZRCola {
winstd::com_obj<ADOCommand> m_comTranslationSets; ///< ADO Command for GetTranslationSeq subquery
winstd::com_obj<ADOParameter> m_pTranslationSets1; ///< \c m_comTranslationSets parameter
winstd::com_obj<ADOCommand> m_comHighlight; ///< ADO Command for SelectHighlights subquery
winstd::com_obj<ADOParameter> m_pHighlight1; ///< \c m_comHighlights parameter
std::set<std::wstring> m_terms_ignore; ///< Terms to ignore when comparing characters
};
};
@ -881,19 +913,16 @@ namespace ZRCola {
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 id 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);
uint32_t idx = db.data.size();
db.data.push_back((uint16_t)rec.set);
db.data.push_back((uint16_t)rec.dst.rank);
db.data.push_back((uint16_t)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);
db.data.push_back((uint16_t)n);
n += rec.src.str.length();
wxASSERT_MSG(n <= 0xffff, wxT("source overflow"));
db.data.push_back((unsigned __int16)n);
db.data.push_back((uint16_t)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);
@ -905,15 +934,14 @@ inline ZRCola::translation_db& operator<<(_Inout_ ZRCola::translation_db &db, _I
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 id out of bounds"));
db.data.push_back((unsigned __int16)rec.set);
uint32_t idx = db.data.size();
db.data.push_back((uint16_t)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);
db.data.push_back((uint16_t)n);
n += rec.dst.length();
wxASSERT_MSG(n <= 0xffff, wxT("translation set destination name overflow"));
db.data.push_back((unsigned __int16)n);
db.data.push_back((uint16_t)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);
@ -924,23 +952,18 @@ inline ZRCola::transet_db& operator<<(_Inout_ ZRCola::transet_db &db, _In_ const
inline ZRCola::transeq_db& operator<<(_Inout_ ZRCola::transeq_db &db, _In_ const ZRCola::DBSource::transeq &rec)
{
unsigned __int32 idx = db.data.size();
wxASSERT_MSG((int)0xffff8000 <= rec.seq && rec.seq <= (int)0x00007fff, wxT("translation sequence id out of bounds"));
db.data.push_back((unsigned __int16)rec.seq);
wxASSERT_MSG((int)0xffff8000 <= rec.rank && rec.rank <= (int)0x00007fff, wxT("translation rank id out of bounds"));
db.data.push_back((unsigned __int16)rec.rank);
uint32_t idx = db.data.size();
db.data.push_back((uint16_t)rec.seq);
db.data.push_back((uint16_t)rec.rank);
std::wstring::size_type n = rec.name.length();
wxASSERT_MSG(n <= 0xffff, wxT("translation sequence name overflow"));
db.data.push_back((unsigned __int16)n);
db.data.push_back((uint16_t)n);
n += rec.sets.size();
wxASSERT_MSG(n <= 0xffff, wxT("translation sequence sets overflow"));
db.data.push_back((unsigned __int16)n);
db.data.push_back((uint16_t)n);
db.data.insert(db.data.end(), rec.name.cbegin(), rec.name.cend());
for (auto s = rec.sets.cbegin(), s_end = rec.sets.cend(); s != s_end; ++s) {
int val = *s;
wxASSERT_MSG(val <= 0xffff, wxT("translation sequence ID overflow"));
db.data.push_back((unsigned __int16)val);
}
for (auto s = rec.sets.cbegin(), s_end = rec.sets.cend(); s != s_end; ++s)
db.data.push_back((uint16_t)*s);
db.idxTranSeq.push_back(idx);
db.idxRank .push_back(idx);
@ -950,13 +973,13 @@ inline ZRCola::transeq_db& operator<<(_Inout_ ZRCola::transeq_db &db, _In_ const
inline ZRCola::keyseq_db& operator<<(_Inout_ ZRCola::keyseq_db &db, _In_ const ZRCola::DBSource::keyseq &rec)
{
unsigned __int32 idx = db.data.size();
uint32_t 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);
db.data.push_back((uint16_t)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.push_back((uint16_t)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);
@ -974,11 +997,11 @@ inline ZRCola::keyseq_db& operator<<(_Inout_ ZRCola::keyseq_db &db, _In_ const Z
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));
uint32_t idx = db.data.size();
db.data.insert(db.data.end(), reinterpret_cast<const uint16_t*>(&rec.lang), reinterpret_cast<const uint16_t*>(&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.push_back((uint16_t)n);
db.data.insert(db.data.end(), rec.name.cbegin(), rec.name.cend());
db.idxLang.push_back(idx);
@ -988,11 +1011,11 @@ inline ZRCola::language_db& operator<<(_Inout_ ZRCola::language_db &db, _In_ con
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));
uint32_t idx = db.data.size();
db.data.insert(db.data.end(), reinterpret_cast<const uint16_t*>(&rec.lang), reinterpret_cast<const uint16_t*>(&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.push_back((uint16_t)n);
db.data.insert(db.data.end(), rec.chr.cbegin(), rec.chr.cend());
db.idxChr .push_back(idx);
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
@ -1005,17 +1028,15 @@ inline ZRCola::langchar_db& operator<<(_Inout_ ZRCola::langchar_db &db, _In_ con
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);
uint32_t idx = db.data.size();
db.data.push_back((uint16_t)rec.grp);
db.data.push_back((uint16_t)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);
db.data.push_back((uint16_t)n);
n += rec.chars.size();
wxASSERT_MSG(n <= 0xffff, wxT("character group characters overflow"));
db.data.push_back((unsigned __int16)n);
db.data.push_back((uint16_t)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());
@ -1027,17 +1048,17 @@ inline ZRCola::chrgrp_db& operator<<(_Inout_ ZRCola::chrgrp_db &db, _In_ const Z
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));
uint32_t idx = db.data.size();
db.data.insert(db.data.end(), reinterpret_cast<const uint16_t*>(&rec.second.cat), reinterpret_cast<const uint16_t*>(&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);
db.data.push_back((uint16_t)n);
n += rec.second.desc.length();
wxASSERT_MSG(n <= 0xffff, wxT("character description overflow"));
db.data.push_back((unsigned __int16)n);
db.data.push_back((uint16_t)n);
n += rec.second.rel.size();
wxASSERT_MSG(n <= 0xffff, wxT("related characters overflow"));
db.data.push_back((unsigned __int16)n);
db.data.push_back((uint16_t)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());
@ -1049,13 +1070,12 @@ inline ZRCola::character_db& operator<<(_Inout_ ZRCola::character_db &db, _In_ c
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);
uint32_t idx = db.data.size();
db.data.insert(db.data.end(), reinterpret_cast<const uint16_t*>(&rec.cat), reinterpret_cast<const uint16_t*>(&rec.cat + 1));
db.data.push_back((uint16_t)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.push_back((uint16_t)n);
db.data.insert(db.data.end(), rec.name.cbegin(), rec.name.cend());
db.idxChrCat.push_back(idx);
db.idxRank .push_back(idx);
@ -1066,12 +1086,11 @@ inline ZRCola::chrcat_db& operator<<(_Inout_ ZRCola::chrcat_db &db, _In_ const Z
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);
uint32_t idx = db.data.size();
db.data.push_back((uint16_t)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.push_back((uint16_t)n);
db.data.insert(db.data.end(), rec.chr.cbegin(), rec.chr.cend());
db.idxChr.push_back(idx);
db.idxTag.push_back(idx);
@ -1084,14 +1103,13 @@ inline ZRCola::tagname_db& operator<<(_Inout_ ZRCola::tagname_db &db, _In_ const
{
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);
uint32_t idx = db.data.size();
db.data.push_back((uint16_t)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.push_back((uint16_t)n);
db.data.insert(db.data.end(), nm->cbegin(), nm->cend());
db.idxName.push_back(idx);
db.idxTag .push_back(idx);
@ -1100,3 +1118,17 @@ inline ZRCola::tagname_db& operator<<(_Inout_ ZRCola::tagname_db &db, _In_ const
return db;
}
inline ZRCola::highlight_db& operator<<(_Inout_ ZRCola::highlight_db &db, _In_ const ZRCola::DBSource::highlight &rec)
{
uint32_t idx = db.data.size();
db.data.push_back((uint16_t)rec.set);
std::wstring::size_type n = rec.chr.length();
wxASSERT_MSG(n <= 0xffff, wxT("character overflow"));
db.data.push_back((uint16_t)n);
db.data.insert(db.data.end(), rec.chr.cbegin(), rec.chr.cend());
db.idxChr.push_back(idx);
return db;
}

View File

@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: ZRColaCompile\n"
"POT-Creation-Date: 2018-09-19 09:00+0200\n"
"POT-Creation-Date: 2022-02-17 13:30+0100\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,25 +10,25 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.1.1\n"
"X-Generator: Poedit 2.4.2\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"
"X-Poedit-SearchPath-0: .\n"
#: main.cpp:251
#: main.cpp:239
msgid "Show this help message"
msgstr ""
#: main.cpp:252
msgid "<input file>"
#: main.cpp:240
msgid "<Input file>"
msgstr ""
#: main.cpp:253
msgid "<output file>"
#: main.cpp:241
msgid "<Output file>"
msgstr ""
#: main.cpp:254
msgid "<output POT catalog>"
#: main.cpp:242
msgid "Output POT catalog"
msgstr ""

View File

@ -1,23 +1,9 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
using namespace std;
using namespace stdex;
@ -30,28 +16,30 @@ using namespace winstd;
class com_translation
{
public:
int rank_src; ///< Source sequence rank
int rank_dst; ///< Destination character rank
short rank_src; ///< Source sequence rank
short rank_dst; ///< Destination character rank
string norm; ///< Normalization footprint
inline com_translation()
inline com_translation() :
rank_src(0),
rank_dst(0)
{
}
inline com_translation(int _rank_src, int _rank_dst) :
inline com_translation(short _rank_src, short _rank_dst) :
rank_src(_rank_src),
rank_dst(_rank_dst)
{
}
inline com_translation(int _rank_src, int _rank_dst, const char *_norm) :
inline com_translation(short _rank_src, short _rank_dst, const char *_norm) :
rank_src(_rank_src),
rank_dst(_rank_dst),
norm (_norm )
{
}
inline com_translation(int _rank_src, int _rank_dst, string &&_norm) :
inline com_translation(short _rank_src, short _rank_dst, string &&_norm) :
rank_src( _rank_src ),
rank_dst( _rank_dst ),
norm (std::move(_norm ))
@ -65,7 +53,7 @@ public:
{
}
inline com_translation(com_translation &&other) :
inline com_translation(com_translation &&other) noexcept :
rank_src( other.rank_src ),
rank_dst( other.rank_dst ),
norm (std::move(other.norm ))
@ -82,7 +70,7 @@ public:
return *this;
}
inline com_translation& operator=(com_translation &&other)
inline com_translation& operator=(com_translation &&other) noexcept
{
if (this != std::addressof(other)) {
rank_src = other.rank_src ;
@ -213,8 +201,8 @@ static inline set<ZRCola::DBSource::charseq> permutate_and_translate_inv(_In_ co
// Secondary permutation inverse translate.
auto res_perm = translate_inv(db_trans, db_np, str_perm.c_str(), path);
for (auto r = res_perm.begin(), r_end = res_perm.end(); r != r_end; ++r)
res.insert(ZRCola::DBSource::charseq(r->rank + 1, std::move(r->str)));
for (auto r = res_perm.cbegin(), r_end = res_perm.cend(); r != r_end; ++r)
res.insert(ZRCola::DBSource::charseq(r->rank + 1, r->str));
}
}
@ -248,10 +236,10 @@ int _tmain(int argc, _TCHAR *argv[])
// Parse command line.
static const wxCmdLineEntryDesc cmdLineDesc[] =
{
{ wxCMD_LINE_SWITCH, "h" , "help", _("Show this help message"), wxCMD_LINE_VAL_NONE , wxCMD_LINE_OPTION_HELP },
{ wxCMD_LINE_PARAM , NULL, NULL , _("<input file>" ), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY },
{ wxCMD_LINE_PARAM , NULL, NULL , _("<output file>" ), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY },
{ wxCMD_LINE_PARAM , NULL, NULL , _("<output POT catalog>" ), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION },
{ wxCMD_LINE_SWITCH, "h" , "help" , _("Show this help message"), wxCMD_LINE_VAL_NONE , wxCMD_LINE_OPTION_HELP },
{ wxCMD_LINE_PARAM , NULL, NULL , _("<Input file>" ), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY },
{ wxCMD_LINE_PARAM , NULL, NULL , _("<Output file>" ), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY },
{ wxCMD_LINE_OPTION, NULL, "pot-cat", _("Output POT catalog" ), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
{ wxCMD_LINE_NONE }
};
@ -294,13 +282,15 @@ int _tmain(int argc, _TCHAR *argv[])
bool has_errors = false;
// Set of strings to translate.
bool build_pot = parser.GetParamCount() > 2;
wxString filenamePot;
bool build_pot = parser.Found("pot-cat", &filenamePot);
set<wstring> pot;
// Open file ID.
streamoff dst_start = idrec::open<ZRCola::recordid_t, ZRCola::recordsize_t>(dst, ZRCOLA_DB_ID);
ZRCola::translation_db db_trans;
ZRCola::transet_db db_transset;
normperm_db db_np;
{
@ -371,34 +361,47 @@ int _tmain(int argc, _TCHAR *argv[])
assert(!res.empty());
// Add translation to temporary database.
for (auto r = res.begin(), r_end = res.end(); r != r_end; ++r) {
for (auto r = res.cbegin(), r_end = res.cend(); r != r_end; ++r) {
translation_db::mapped_type::mapped_type ct(d1->second.rank_src + r->rank, d1->second.rank_dst);
auto hit = t2->second.find(r->str);
if (hit != t2->second.end()) {
hit->second.rank_src = std::min<int>(hit->second.rank_src, ct.rank_src);
hit->second.rank_dst = std::max<int>(hit->second.rank_dst, ct.rank_dst);
hit->second.rank_src = std::min<short>(hit->second.rank_src, ct.rank_src);
hit->second.rank_dst = std::max<short>(hit->second.rank_dst, ct.rank_dst);
} else
t2->second.insert(pair<translation_db::mapped_type::key_type, translation_db::mapped_type::mapped_type>(std::move(r->str), std::move(ct)));
t2->second.insert(pair<translation_db::mapped_type::key_type, translation_db::mapped_type::mapped_type>(r->str, std::move(ct)));
}
}
}
// Preallocate memory.
db_trans.idxSrc.reserve(count);
db_trans.idxDst.reserve(count);
db_trans.data .reserve(count*5);
db_trans.idxSrc.reserve(count*2);
db_trans.idxDst.reserve(count*2);
db_trans.data .reserve(count*2*8);
// 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);
trans.dst.str = t->first;
for (auto d = t->second.cbegin(), d_end = t->second.cend(); d != d_end; ++d) {
trans.set = (short)ZRCOLA_TRANSETID_DEFAULT;
trans.dst.rank = d->second.rank_dst;
trans.src.rank = d->second.rank_src;
trans.src.str = std::move(d->first);
trans.src.str = d->first;
db_trans << trans;
// If destination contains no PUA characters, add it to the ZRCola » Unicode transliteration too.
bool has_pua = false;
for (auto ch = trans.dst.str.cbegin(), ch_end = trans.dst.str.cend(); ch != ch_end; ++ch)
if (ZRCola::ispua(*ch)) {
has_pua = true;
break;
}
if (!has_pua) {
trans.set = (short)ZRCOLA_TRANSETID_UNICODE;
trans.dst.rank += 50;
db_trans << trans;
}
}
}
} else {
@ -411,35 +414,73 @@ int _tmain(int argc, _TCHAR *argv[])
}
}
{
com_obj<ADORecordset> rs_tran;
if (src.SelectTranslations(static_cast<short>(ZRCOLA_TRANSETID_UNICODE), rs_tran)) {
size_t count = src.GetRecordsetCount(rs_tran);
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
// Preallocate memory.
db_trans.idxSrc.reserve(db_trans.idxSrc.size() + count);
db_trans.idxDst.reserve(db_trans.idxDst.size() + count);
db_trans.data .reserve(db_trans.data.size() + count*8);
// Parse translations and build temporary database.
ZRCola::DBSource::translation trans;
trans.set = (short)ZRCOLA_TRANSETID_UNICODE;
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 Unicode 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 Unicode translations from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
has_errors = true;
}
}
{
// 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::transet_db db;
// Preallocate memory.
db.idxTranSet.reserve((count+1));
db.data .reserve((count+1)*4);
db_transset.idxTranSet.reserve((count+1));
db_transset.data .reserve((count+1)*4);
// Parse translation sets and build index and data.
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
// Read translation set from the database.
ZRCola::DBSource::transet ts;
if (src.GetTranslationSet(rs, ts)) {
if (ts.set <= (short)ZRCOLA_TRANSETID_DEFAULT || (short)ZRCOLA_TRANSETID_UNICODE <= ts.set)
continue;
if (build_pot) {
pot.insert(ts.src);
pot.insert(ts.dst);
}
// Add translation set to index and data.
db << ts;
db_transset << ts;
// Get translations.
com_obj<ADORecordset> rs_tran;
if (src.SelectTranslations(ts.set, rs_tran)) {
if (src.GetRecordsetCount(rs_tran) < 0xffffffff) { // 4G check (-1 is reserved for error condition)
count = src.GetRecordsetCount(rs_tran);
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
// Preallocate memory.
db_trans.idxSrc.reserve(db_trans.idxSrc.size() + count);
db_trans.idxDst.reserve(db_trans.idxDst.size() + count);
db_trans.data .reserve(db_trans.data.size() + count*8);
// Parse translations and build temporary database.
ZRCola::DBSource::translation trans;
trans.set = ts.set;
@ -462,12 +503,6 @@ int _tmain(int argc, _TCHAR *argv[])
} 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;
@ -478,11 +513,13 @@ int _tmain(int argc, _TCHAR *argv[])
}
}
// Sort indices.
db_trans.idxSrc.sort();
db_trans.idxDst.sort();
// Write translation sets to file.
db_transset.idxTranSet.sort();
dst << ZRCola::transet_rec(db_transset);
// Write translations to file.
db_trans.idxSrc.sort();
db_trans.idxDst.sort();
dst << ZRCola::translation_rec(db_trans);
{
@ -512,11 +549,9 @@ int _tmain(int argc, _TCHAR *argv[])
has_errors = true;
}
// Sort indices.
// Write translation sequences to file.
db.idxTranSeq.sort();
db.idxRank .sort();
// Write translation sequences to file.
dst << ZRCola::transeq_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0025: Error getting translation sequence count from database or too many translation sequences.\n"), (LPCTSTR)filenameIn.c_str());
@ -611,10 +646,8 @@ int _tmain(int argc, _TCHAR *argv[])
has_errors = true;
}
// Sort indices.
db.idxLang.sort();
// Write languages to file.
db.idxLang.sort();
dst << ZRCola::language_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0009: Error getting language count from database or too many languages.\n"), (LPCTSTR)filenameIn.c_str());
@ -652,13 +685,11 @@ int _tmain(int argc, _TCHAR *argv[])
has_errors = true;
}
// Sort indices.
// Write language characters to file.
db.idxChr .sort();
#ifdef ZRCOLA_LANGCHAR_LANG_IDX
db.idxLang.sort();
#endif
// Write language characters to file.
dst << ZRCola::langchar_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0011: Error getting language characters count from database or too many langchars.\n"), (LPCTSTR)filenameIn.c_str());
@ -701,10 +732,8 @@ int _tmain(int argc, _TCHAR *argv[])
has_errors = true;
}
// Sort indices.
db.idxRank.sort();
// Write character groups to file.
db.idxRank.sort();
dst << ZRCola::chrgrp_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0015: Error getting character group count from database or too many character groups.\n"), (LPCTSTR)filenameIn.c_str());
@ -725,7 +754,6 @@ int _tmain(int argc, _TCHAR *argv[])
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;
// Phase 1: Parse characters and build indexes.
@ -760,14 +788,10 @@ int _tmain(int argc, _TCHAR *argv[])
categories_used.insert(chr->second.cat);
}
// Sort indices.
// Write characters to file.
db.idxChr.sort();
// Save text indices.
idxChrDsc .save(db.idxDsc );
idxChrDscSub.save(db.idxDscSub);
// Write characters to file.
dst << ZRCola::character_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0017: Error getting character count from database or too many characters.\n"), (LPCTSTR)filenameIn.c_str());
@ -811,11 +835,9 @@ int _tmain(int argc, _TCHAR *argv[])
has_errors = true;
}
// Sort indices.
// Write character categories to file.
db.idxChrCat.sort();
db.idxRank .sort();
// Write character categories to file.
dst << ZRCola::chrcat_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0019: Error getting character category count from database or too many character categories.\n"), (LPCTSTR)filenameIn.c_str());
@ -851,11 +873,9 @@ int _tmain(int argc, _TCHAR *argv[])
has_errors = true;
}
// Sort indices.
// Write characters tags to file.
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());
@ -891,11 +911,9 @@ int _tmain(int argc, _TCHAR *argv[])
has_errors = true;
}
// Sort indices.
// Write tags to file.
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());
@ -907,6 +925,43 @@ int _tmain(int argc, _TCHAR *argv[])
}
}
{
// Get highlights.
com_obj<ADORecordset> rs;
if (src.SelectHighlights((short)ZRCOLA_HLGHTSETID_ZRCOLA_UNICODE_COMPOSED_ISSUES, rs)) {
size_t count = src.GetRecordsetCount(rs);
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
ZRCola::DBSource::highlight h;
ZRCola::highlight_db db;
// Preallocate memory.
db.idxChr.reserve(count);
db.data .reserve(count*5);
// Parse highlights and build index and data.
h.set = (short)ZRCOLA_HLGHTSETID_ZRCOLA_UNICODE_COMPOSED_ISSUES;
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
// Read tag name from the database.
if (src.GetHighlight(rs, h)) {
// Add highlight to index and data.
db << h;
} else
has_errors = true;
}
// Write highlights to file.
db.idxChr.sort();
dst << ZRCola::highlight_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0027: Error getting highlight count from database or too many tags.\n"), (LPCTSTR)filenameIn.c_str());
has_errors = true;
}
} else {
_ftprintf(stderr, wxT("%s: error ZCC0026: Error getting highlights 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()) {
@ -915,7 +970,6 @@ int _tmain(int argc, _TCHAR *argv[])
}
if (!has_errors && build_pot) {
const wxString& filenamePot = parser.GetParam(2);
fstream dst_pot((LPCTSTR)filenamePot, ios_base::out | ios_base::trunc);
if (dst_pot.good()) {
dst_pot << "msgid \"\"" << endl
@ -927,10 +981,10 @@ int _tmain(int argc, _TCHAR *argv[])
<< "\"Content-Transfer-Encoding: 8bit\\n\"" << endl
<< "\"X-Generator: ZRColaCompile\\n\"" << endl;
wstring_convert<codecvt_utf8<wchar_t>> conv;
charset_encoder<wchar_t, char> conv(stdex::wchar_t_charset, charset_id::utf8);
for (auto p = pot.cbegin(); p != pot.cend(); ++p) {
// Convert UTF-16 to UTF-8 and escape.
string t(conv.to_bytes(*p)), u;
string t(conv.convert(*p)), u;
for (size_t i = 0, n = t.size(); i < n; i++) {
char c = t[i];
switch (c) {

View File

@ -1,23 +1,9 @@
/*
Copyright 2018 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2018-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
using namespace std;
using namespace stdex;

View File

@ -1,20 +1,6 @@
/*
Copyright 2018 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2018-2022 Amebis
*/
#pragma once

6
ZRColaCompile/pch.cpp Normal file
View File

@ -0,0 +1,6 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "pch.h"

45
ZRColaCompile/pch.h Normal file
View File

@ -0,0 +1,45 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#pragma once
#include "../include/version.h"
#include "dbsource.h"
#include "parse.h"
#include <wxex/common.h>
#include <wxex/comutils.h>
#pragma warning(push)
#pragma warning(disable: WXWIDGETS_CODE_ANALYSIS_WARNINGS)
#include <wx/app.h>
#include <wx/cmdline.h>
#include <wx/config.h>
#include <wx/intl.h>
#pragma warning(pop)
#include <zrcola/idrec.h>
#include <WinStd/Common.h>
#include <initguid.h> // GUID helper to prevent LNK2001 errors (unresolved external symbol IID_IADO...)
#pragma warning(push)
#pragma warning(disable: 4091)
#include <adoint.h>
#include <adoid.h>
#pragma warning(pop)
#include <process.h>
#include <tchar.h>
#include <stdlib.h>
#include <algorithm>
#include <codecvt>
#include <cwctype>
#include <fstream>
#include <memory>
#include <set>
#include <vector>

View File

@ -1,20 +0,0 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"

View File

@ -1,56 +0,0 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "../include/version.h"
#include "dbsource.h"
#include "parse.h"
#include <wx/app.h>
#include <wx/cmdline.h>
#include <wx/config.h>
#include <wx/intl.h>
#include <wxex/common.h>
#include <wxex/comutils.h>
#include <stdex/idrec.h>
#include <WinStd/Common.h>
#include <initguid.h> // GUID helper to prevent LNK2001 errors (unresolved external symbol IID_IADO...)
#pragma warning(push)
#pragma warning(disable: 4091)
#include <adoint.h>
#include <adoid.h>
#pragma warning(pop)
#include <process.h>
#include <tchar.h>
#include <stdlib.h>
#include <algorithm>
#include <codecvt>
#include <cwctype>
#include <fstream>
#include <memory>
#include <set>
#include <vector>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<CompileAsManaged>false</CompileAsManaged>
<BufferSecurityCheck>false</BufferSecurityCheck>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<SmallerTypeCheck>false</SmallerTypeCheck>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZRColaInstall.rc" />
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<Language Condition="'$(Language)'==''">En</Language>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}</ProjectGuid>
<RootNamespace>ZRColaInstall$(Language)</RootNamespace>
<ProjectName>ZRColaInstall$(Language)</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Debug'">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Release'">
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\include\$(Platform).props" />
<Import Project="..\include\$(Configuration).props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="$(Language)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZRColaInstall.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -15,7 +15,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
@ -23,7 +23,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{620D6AC0-C8FF-4185-B820-DB1503ACB95C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ZRColaInstallDe</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="De";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="De";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZRColaInstall.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ZRColaInstallEn</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="En";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="En";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZRColaInstall.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2551B561-5E5B-497E-AE01-11519F91EF19}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ZRColaInstallRu</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="Ru";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="Ru";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ZRColaInstallSl</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="ZRColaInstall.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="Sl";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>ZRCOLA_INSTALL_LANG="Sl";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZRColaInstall.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@ -1,64 +1,62 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "stdafx.h"
#include "pch.h"
///
/// Main function
///
extern "C" void WinMainCRTStartup()
int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)
{
// Load "KERNEL32.DLL".
HMODULE hKernel32 = LoadLibrary(TEXT("KERNEL32.DLL"));
if (!hKernel32)
ExitProcess(1);
UNREFERENCED_PARAMETER(hInstance);
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
// Get IsWow64Process() address.
BOOL (WINAPI *_IsWow64Process)(__in HANDLE hProcess, __out PBOOL Wow64Process) = (BOOL(WINAPI*)(__in HANDLE, __out PBOOL))::GetProcAddress(hKernel32, "IsWow64Process");
TCHAR szArchProc[MAX_PATH];
if (!GetEnvironmentVariable(TEXT("PROCESSOR_ARCHITECTURE"), szArchProc, _countof(szArchProc)))
szArchProc[0] = 0;
szArchProc[_countof(szArchProc) - 1] = 0;
BOOL bIs64Bit;
#ifndef _WIN64
// Determine if this is a 32-bit process under Windows-over-Windows64.
if (_IsWow64Process) {
// See what IsWow64Process() says.
if (!_IsWow64Process(::GetCurrentProcess(), &bIs64Bit)) {
// IsWow64Process() returned an error. Assume not 64-bit Windows.
bIs64Bit = FALSE;
TCHAR szArchWin[MAX_PATH];
if (!GetEnvironmentVariable(TEXT("PROCESSOR_ARCHITEW6432"), szArchWin, _countof(szArchWin)))
szArchWin[0] = 0;
szArchWin[_countof(szArchWin) - 1] = 0;
// If PROCESSOR_ARCHITEW6432 is defined, this is a Windows-on-Windows
// guest of some kind. szArchWin is the host's architecture and szArchProc
// is the current process' architecture.
// If PROCESSOR_ARCHITEW6432 is not defined, then PROCESSOR_ARCHITECTURE
// is both the process and OS architecture.
if (szArchWin[0] == 0)
memcpy_s(szArchWin, sizeof(szArchWin), szArchProc, sizeof(szArchProc));
// If PROCESSOR_ARCHITECTURE is not defined, then either we're running on
// Windows 9x or something is messing with the environment. Make the
// Windows 9x assumption.
if (szArchProc[0] == 0) {
memcpy_s(szArchProc, sizeof(szArchProc), TEXT("x86"), sizeof(TEXT("x86")));
memcpy_s(szArchWin , sizeof(szArchWin ), TEXT("x86"), sizeof(TEXT("x86")));
}
} else {
// This platform does not have IsWow64Process(). Therefore, this is definitely not 64-bit Windows.
bIs64Bit = FALSE;
}
#else
// This is a running 64-bit process. The Windows must be 64 bit then.
bIs64Bit = TRUE;
#endif
FreeLibrary(hKernel32);
LPCTSTR pszPlatSuffix;
if (_tcsicmp(szArchWin, TEXT("amd64")) == 0)
pszPlatSuffix = TEXT("-amd64");
else if (_tcsicmp(szArchWin, TEXT("arm64")) == 0)
pszPlatSuffix = TEXT("-arm64");
else
pszPlatSuffix = TEXT("-x86");
// Get temporary folder path.
static const LPTSTR pszTempFolderDefault = TEXT("");
LPTSTR pszTempFolder;
DWORD dwLength;
if ((dwLength = GetEnvironmentVariable(TEXT("TEMP"), NULL, 0)) != 0 &&
(pszTempFolder = (LPTSTR)LocalAlloc(LMEM_FIXED, (dwLength + 1)*sizeof(TCHAR))) != NULL) // +1 is for trailing backslash when missing!
(pszTempFolder = (LPTSTR)LocalAlloc(LMEM_FIXED, (dwLength + 2)*sizeof(TCHAR))) != NULL) // +1 for trailing backslash when missing, +1 for zero terminator
{
dwLength = ::GetEnvironmentVariable(TEXT("TEMP"), pszTempFolder, dwLength);
@ -74,12 +72,12 @@ extern "C" void WinMainCRTStartup()
LPTSTR pszParams;
DWORD_PTR aArgs[] = {
(DWORD_PTR)TEXT(ZRCOLA_INSTALL_LANG),
(DWORD_PTR)(bIs64Bit ? TEXT("64") : TEXT("32")),
(DWORD_PTR)pszPlatSuffix,
(DWORD_PTR)pszTempFolder,
};
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING,
TEXT("/i \"http://www.amebis.si/prenos/ZRCola/_latest/ZRCola%1%2.msi\" /l* \"%3ZRCola%1%2.log\""),
TEXT("/i \"https://prenos.amebis.si/ZRCola/_latest/ZRCola%1%2.msi\" /l* \"%3ZRCola%1%2.log\""),
0,
0,
(LPTSTR)&pszParams,

6
ZRColaInstall/pch.cpp Normal file
View File

@ -0,0 +1,6 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#include "pch.h"

9
ZRColaInstall/pch.h Normal file
View File

@ -0,0 +1,9 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2015-2022 Amebis
*/
#pragma once
#include <Windows.h>
#include <tchar.h>

View File

@ -1,20 +0,0 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"

View File

@ -1,22 +0,0 @@
/*
Copyright 2015-2019 Amebis
This file is part of ZRCola.
ZRCola is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ZRCola is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ZRCola. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Windows.h>

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2016
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{A7D28E0C-BB96-444D-AAB0-F22A6483FE5F}"
EndProject
@ -14,70 +14,38 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
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\wxExtendLib-16.0.vcxproj", "{D3E29951-D9F5-486D-A167-20AE8E90B1FA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stdex", "lib\stdex\build\stdex-16.0.vcxproj", "{518777CC-0A59-4415-A12A-82751ED75343}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtend", "lib\wxExtend\build\wxExtendLib.vcxproj", "{D3E29951-D9F5-486D-A167-20AE8E90B1FA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libZRColaUI", "lib\libZRColaUI\build\libZRColaUI.vcxproj", "{C0A84BD2-3870-4CD6-B281-0AB322E3C579}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ZRColaInstall", "ZRColaInstall", "{7F5D45A3-B3D2-4B1D-B258-9B83395786E6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaInstallSl", "ZRColaInstall\ZRColaInstallSl.vcxproj", "{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaInstallDe", "ZRColaInstall\ZRColaInstallDe.vcxproj", "{620D6AC0-C8FF-4185-B820-DB1503ACB95C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaInstallEn", "ZRColaInstall\ZRColaInstallEn.vcxproj", "{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}"
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-16.0.vcxproj", "{47399D91-7EB9-41DE-B521-514BA5DB0C43}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaInstall", "ZRColaInstall\ZRColaInstall.vcxproj", "{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|x86.ActiveCfg = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|x86.Build.0 = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|x86.ActiveCfg = Release|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|x86.Build.0 = Release|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Debug|x86.ActiveCfg = Debug|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Debug|x86.Build.0 = Debug|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Release|x86.ActiveCfg = Release|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Release|x86.Build.0 = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x86.ActiveCfg = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x86.Build.0 = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x86.ActiveCfg = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x86.Build.0 = Release|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|x86.ActiveCfg = Debug|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Debug|x86.Build.0 = Debug|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Release|x86.ActiveCfg = Release|Win32
{518777CC-0A59-4415-A12A-82751ED75343}.Release|x86.Build.0 = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|x86.ActiveCfg = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|x86.Build.0 = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x86.ActiveCfg = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x86.Build.0 = Release|Win32
{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Debug|x86.ActiveCfg = Debug|Win32
{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Debug|x86.Build.0 = Debug|Win32
{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Release|x86.ActiveCfg = Release|Win32
{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Release|x86.Build.0 = Release|Win32
{620D6AC0-C8FF-4185-B820-DB1503ACB95C}.Debug|x86.ActiveCfg = Debug|Win32
{620D6AC0-C8FF-4185-B820-DB1503ACB95C}.Debug|x86.Build.0 = Debug|Win32
{620D6AC0-C8FF-4185-B820-DB1503ACB95C}.Release|x86.ActiveCfg = Release|Win32
{620D6AC0-C8FF-4185-B820-DB1503ACB95C}.Release|x86.Build.0 = Release|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Debug|x86.ActiveCfg = Debug|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Debug|x86.Build.0 = Debug|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Release|x86.ActiveCfg = Release|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Release|x86.Build.0 = Release|Win32
{2551B561-5E5B-497E-AE01-11519F91EF19}.Debug|x86.ActiveCfg = Debug|Win32
{2551B561-5E5B-497E-AE01-11519F91EF19}.Debug|x86.Build.0 = Debug|Win32
{2551B561-5E5B-497E-AE01-11519F91EF19}.Release|x86.ActiveCfg = Release|Win32
{2551B561-5E5B-497E-AE01-11519F91EF19}.Release|x86.Build.0 = Release|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x86.ActiveCfg = Debug|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x86.Build.0 = Debug|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x86.ActiveCfg = Release|Win32
{47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x86.Build.0 = Release|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|Win32.ActiveCfg = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Debug|Win32.Build.0 = Debug|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|Win32.ActiveCfg = Release|Win32
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8}.Release|Win32.Build.0 = Release|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Debug|Win32.ActiveCfg = Debug|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Debug|Win32.Build.0 = Debug|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Release|Win32.ActiveCfg = Release|Win32
{87A3ADEC-1BE4-42E4-92B8-B742F3D21BC4}.Release|Win32.Build.0 = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|Win32.ActiveCfg = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|Win32.Build.0 = Debug|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|Win32.ActiveCfg = Release|Win32
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|Win32.Build.0 = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|Win32.ActiveCfg = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Debug|Win32.Build.0 = Debug|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|Win32.ActiveCfg = Release|Win32
{C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|Win32.Build.0 = Release|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Debug|Win32.ActiveCfg = Debug|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Debug|Win32.Build.0 = Debug|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Release|Win32.ActiveCfg = Release|Win32
{5BD95B95-38B0-4C7D-9471-F99CA1203DF4}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -85,13 +53,7 @@ Global
GlobalSection(NestedProjects) = preSolution
{3C61929E-7289-4101-8D0A-DA22D6E1AEA8} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F}
{D3E29951-D9F5-486D-A167-20AE8E90B1FA} = {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}
{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}
{2551B561-5E5B-497E-AE01-11519F91EF19} = {7F5D45A3-B3D2-4B1D-B258-9B83395786E6}
{47399D91-7EB9-41DE-B521-514BA5DB0C43} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {22B0355E-423C-4ACC-81F8-DAD72A8BEC0E}

3
ZRColaWS/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/*.d
/*.o
/zrcolaws

91
ZRColaWS/Makefile Normal file
View File

@ -0,0 +1,91 @@
CPPFLAGS := $(CPPFLAGS) -I../lib/libZRCola/include -I../lib/stdex/include -I../lib/oatpp-swagger/src -I../lib/oatpp/src
LDFLAGS := $(LDFLAGS) -L../lib/libZRCola/lib -L../lib/oatpp-swagger/build/src -L../lib/oatpp/build/src
LDLIBS := $(LDLIBS) -lZRCola -loatpp-swagger -loatpp -lstdc++
SRCS := zrcolaws.cpp
include ../include/props.mak
.PHONY: all
all: zrcolaws
zrcolaws: \
../lib/oatpp/build/src/liboatpp.a \
../lib/oatpp-swagger/build/src/liboatpp-swagger.a \
../lib/libZRCola/lib/libZRCola.a \
$(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -o $@ $(LDLIBS)
../lib/oatpp/build/src/liboatpp.a: ../lib/oatpp/build/Makefile
$(MAKE) $(MFLAGS) -C ../lib/oatpp/build
../lib/oatpp/build/Makefile: ../lib/oatpp/CMakeLists.txt
cmake -D OATPP_INSTALL=OFF -D OATPP_BUILD_TESTS=OFF -D OATPP_LINK_TEST_LIBRARY=OFF -S ../lib/oatpp -B ../lib/oatpp/build
../lib/oatpp-swagger/build/src/liboatpp-swagger.a: ../lib/oatpp-swagger/build/Makefile
$(MAKE) $(MFLAGS) -C ../lib/oatpp-swagger/build
../lib/oatpp-swagger/build/Makefile: ../lib/oatpp-swagger/CMakeLists.txt
cmake -D OATPP_INSTALL=OFF -D OATPP_BUILD_TESTS=OFF -D OATPP_MODULES_LOCATION=CUSTOM -D OATPP_DIR_SRC=${CURDIR}/../lib/oatpp/src -D OATPP_DIR_LIB=${CURDIR}/../lib/oatpp/build/src -S ../lib/oatpp-swagger -B ../lib/oatpp-swagger/build
../lib/libZRCola/lib/libZRCola.a:
$(MAKE) $(MFLAGS) -C ../lib/libZRCola/build
.PHONY: install
install: zrcolaws ../output/data/ZRCola.zrcdb
install -d $(PREFIX)/bin/
install -m 755 zrcolaws $(PREFIX)/bin/
install -d $(PREFIX)/share/zrcola/
install -m 644 ../output/data/ZRCola.zrcdb $(PREFIX)/share/zrcola/
install -d $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/favicon-16x16.png $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/favicon-32x32.png $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/index.html $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/oauth2-redirect.html $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-bundle.js $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-bundle.js.map $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-es-bundle-core.js $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-es-bundle-core.js.map $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-es-bundle.js $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-es-bundle.js.map $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-standalone-preset.js $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui-standalone-preset.js.map $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui.css $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui.css.map $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui.js $(PREFIX)/share/zrcola/res/
install -m 644 ../lib/oatpp-swagger/res/swagger-ui.js.map $(PREFIX)/share/zrcola/res/
install -d $(PREFIX)/etc/sysconfig/
{ echo '#!/bin/sh'; \
echo ''; \
echo '# Interface to listen on. Default: localhost'; \
echo '#HOST=0.0.0.0'; \
echo ''; \
echo '# Port to listen on. Default: 54591'; \
echo '#PORT=54591'; \
echo ''; \
echo '# Additional zrcolaws command line options'; \
echo '#OPTIONS=-4'; \
} > $(PREFIX)/etc/sysconfig/zrcolaws
install -d $(PREFIX)/lib/systemd/system/
{ echo '[Unit]'; \
echo 'Description=ZRCola Web Service'; \
echo 'After=network.target'; \
echo ''; \
echo '[Service]'; \
echo 'Environment="HOST=localhost" "PORT=54591"'; \
echo 'EnvironmentFile=-$(PREFIX)/etc/sysconfig/zrcolaws'; \
echo 'DynamicUser=yes'; \
echo 'ExecStart=/usr/local/bin/zrcolaws --host $$HOST --port $$PORT $$OPTIONS'; \
echo 'Type=exec'; \
echo 'Restart=always'; \
echo ''; \
echo '[Install]'; \
echo 'WantedBy=multi-user.target'; \
echo 'RequiredBy=network.target'; \
} > $(PREFIX)/lib/systemd/system/zrcolaws.service
.PHONY: clean
clean:
-rm -r *.{d,o} zrcolaws
include ../include/targets.mak
-include $(DEPS)

23
ZRColaWS/README.md Normal file
View File

@ -0,0 +1,23 @@
# ZRCola Web Service
## Building and Installation
1. Install prerequisites: `sudo dnf install git cmake gcc gcc-c++ make libatomic`
2. Clone this Git repository: `git clone --recursive https://github.com/Amebis/ZRCola.git`
3. Build ZRColaWS: `make -C ZRCola/ZRColaWS`
4. Install ZRColaWS: `sudo make -C ZRCola/ZRColaWS install`
5. Configure ZRColaWS by editing _/usr/local/etc/sysconfig/zrcolaws_
6. Start ZRColaWS: `sudo systemctl start zrcolaws.service`
7. Configure ZRColaWS for auto-start: `sudo systemctl enable zrcolaws.service`
8. Remember to open webservice port in firewall, should the service require external access.
## Usage
Web service API documentation is available at _http://host:port/swagger/ui_.

73
ZRColaWS/appcomponent.hpp Normal file
View File

@ -0,0 +1,73 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2022 Amebis
*/
#pragma once
#include "../include/version.h"
#include "controller.hpp"
#include <oatpp-swagger/Model.hpp>
#include <oatpp-swagger/Resources.hpp>
#include <oatpp/core/base/CommandLineArguments.hpp>
#include <oatpp/core/macro/component.hpp>
#include <oatpp/network/Server.hpp>
#include <oatpp/network/tcp/server/ConnectionProvider.hpp>
#include <oatpp/parser/json/mapping/ObjectMapper.hpp>
#include <oatpp/web/server/HttpConnectionHandler.hpp>
class AppComponent
{
protected:
oatpp::network::Address m_address;
public:
AppComponent(const oatpp::network::Address& address) : m_address(address) {}
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([this] {
return oatpp::network::tcp::server::ConnectionProvider::createShared({m_address.host, m_address.port, m_address.family});
}());
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, httpRouter)([] {
return oatpp::web::server::HttpRouter::createShared();
}());
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, serverConnectionHandler)([] {
OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router);
return oatpp::web::server::HttpConnectionHandler::createShared(router);
}());
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, apiObjectMapper)([] {
auto serializerConfig = oatpp::parser::json::mapping::Serializer::Config::createShared();
serializerConfig->escapeFlags &= ~oatpp::parser::json::Utils::FLAG_ESCAPE_UTF8CHAR;
return oatpp::parser::json::mapping::ObjectMapper::createShared(
serializerConfig,
oatpp::parser::json::mapping::Deserializer::Config::createShared());
}());
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::Server>, server)([] {
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, connectionProvider);
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, connectionHandler);
return oatpp::network::Server::createShared(connectionProvider, connectionHandler);
}());
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::swagger::DocumentInfo>, swaggerDocumentInfo)([] {
oatpp::swagger::DocumentInfo::Builder builder;
builder
.setTitle("ZRCola Web Service")
.setDescription(
"ZRCola is an input system designed mainly, although not exclusively, for linguistic use. "
"It allows the user to combine basic letters with any diacritic marks and insert the resulting complex characters into the texts with ease.")
.setVersion(PRODUCT_VERSION_STR)
.setContactName("ZRCola")
.setContactUrl("https://zrcola.zrc-sazu.si/en/")
.setLicenseName("GNU General Public License, Version 3")
.setLicenseUrl("https://www.gnu.org/licenses/gpl-3.0.en.html");
return builder.build();
}());
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::swagger::Resources>, swaggerResources)([] {
return oatpp::swagger::Resources::loadResources(PREFIX "/share/zrcola/res");
}());
};

243
ZRColaWS/controller.hpp Normal file
View File

@ -0,0 +1,243 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2022 Amebis
*/
#pragma once
#include "../include/version.h"
#include "dto.hpp"
#include "iconverter.hpp"
#include "zrcolaws.hpp"
#include <zrcola/translate.h>
#include <oatpp/core/macro/codegen.hpp>
#include <oatpp/core/macro/component.hpp>
#include <oatpp/web/server/api/ApiController.hpp>
#include OATPP_CODEGEN_BEGIN(ApiController)
class Controller : public oatpp::web::server::api::ApiController
{
public:
Controller(const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& defaultObjectMapper, const oatpp::String &routerPrefix = nullptr) :
oatpp::web::server::api::ApiController(defaultObjectMapper, routerPrefix)
{}
ADD_CORS(getAbout)
ENDPOINT_INFO(getAbout) {
info->summary = "Returns service information";
info->addResponse<Object<dto::About>>(Status::CODE_200, "application/json");
}
ENDPOINT("GET", "/about", getAbout)
{
auto dto = dto::About::createShared();
dto->vendor = PRODUCT_CFG_VENDOR;
dto->application = PRODUCT_CFG_APPLICATION;
dto->version = PRODUCT_VERSION_STR;
return createDtoResponse(Status::CODE_200, dto);
}
ADD_CORS(getTranset)
ENDPOINT_INFO(getTranset) {
info->summary = "Lists supported translation sets";
info->description = "Each translation set describes a set of replacements that are performed to translate text from one script or encoding to another. ";
info->addResponse<oatpp::Vector<oatpp::Object<dto::TranSet>>>(Status::CODE_200, "application/json");
}
ENDPOINT("GET", "/transet", getTranset)
{
try {
utf16toutf8 c;
auto result = oatpp::Vector<oatpp::Object<dto::TranSet>>::createShared();
auto dto = dto::TranSet::createShared();
dto->set = ZRCOLA_TRANSETID_DEFAULT;
dto->src = "ZRCola Decomposed";
dto->dst = "ZRCola Composed";
result->push_back(dto);
for (size_t i = 0, n = ts_db.idxTranSet.size(); i < n; i++) {
const auto &ts = ts_db.idxTranSet[i];
dto = dto::TranSet::createShared();
dto->set = ts.set;
dto->src = c.convert(ts.src(), ts.src_len());
dto->dst = c.convert(ts.dst(), ts.dst_len());
result->push_back(dto);
}
dto = dto::TranSet::createShared();
dto->set = ZRCOLA_TRANSETID_UNICODE;
dto->src = "ZRCola Decomposed";
dto->dst = "Unicode";
result->push_back(dto);
return createDtoResponse(Status::CODE_200, result);
} catch (std::exception &ex) {
OATPP_LOGE(__FUNCTION__, "%s: %s", typeid(ex).name(), ex.what());
return ResponseFactory::createResponse(Status::CODE_500, ex.what());
}
}
ADD_CORS(getLanguage)
ENDPOINT_INFO(getLanguage) {
info->summary = "Lists supported languages";
info->description = "Each language describes a set of special characters that are specific to that language (e.g. č, š, ž in Slovenian, or ä, ö, ü in German).";
info->addResponse<oatpp::Vector<oatpp::Object<dto::Language>>>(Status::CODE_200, "application/json");
}
ENDPOINT("GET", "/language", getLanguage)
{
try {
utf16toutf8 c;
auto result = oatpp::Vector<oatpp::Object<dto::Language>>::createShared();
for (size_t i = 0, n = lang_db.idxLang.size(); i < n; i++) {
const auto &lang = lang_db.idxLang[i];
auto dto = dto::Language::createShared();
dto->lang = std::string(&lang.lang.data[0], strnlen(lang.lang.data, std::size(lang.lang.data)));
dto->name = c.convert(lang.name(), lang.name_len());
result->push_back(dto);
}
return createDtoResponse(Status::CODE_200, result);
} catch (std::exception &ex) {
OATPP_LOGE(__FUNCTION__, "%s: %s", typeid(ex).name(), ex.what());
return ResponseFactory::createResponse(Status::CODE_500, ex.what());
}
}
ADD_CORS(postTranslate)
ENDPOINT_INFO(postTranslate) {
info->summary = "Translate text";
info->description =
"Performs any number of supported translations (see /transet) on a given input text in a sequence. "
"Together with the output text, it also returns character index mapping between input and output texts.";
auto transet = oatpp::Vector<UInt16>::createShared();
transet->push_back(ZRCOLA_TRANSETID_DEFAULT);
auto dto = dto::TranslateIn::createShared();
dto->transet = transet;
dto->text = "To je test.";
info->addConsumes<Object<dto::TranslateIn>>("application/json")
.addExample("Perform ZRCola composition", dto);
info->addResponse<Object<dto::TranslateOut>>(Status::CODE_200, "application/json");
}
ENDPOINT("POST", "/translate", postTranslate, BODY_DTO(Object<dto::TranslateIn>, input))
{
try {
utf8toutf16 cIn;
std::u16string dst, dst2;
if (input->text)
dst = cIn.convert(*input->text);
size_t src_len = dst.size();
std::vector<ZRCola::mapping_vector> mapping;
if (input->transet) {
ZRCola::mapping_vector map;
const auto ts_end = input->transet->cend();
for (auto ts = input->transet->cbegin(); ts != ts_end; ++ts) {
switch (*ts) {
case ZRCOLA_TRANSETID_DEFAULT:
case ZRCOLA_TRANSETID_UNICODE:
// Decompose first, then re-compose.
t_db.TranslateInv(*ts, dst.data(), dst.size(), dst2, &map);
mapping.push_back(std::move(map));
map.clear();
t_db.Translate(*ts, dst2.data(), dst2.size(), dst, &map);
mapping.push_back(std::move(map));
map.clear();
break;
default:
t_db.Translate(*ts, dst.data(), dst.size(), dst2, &map);
mapping.push_back(std::move(map));
map.clear();
dst = std::move(dst2);
dst2.clear();
}
}
}
utf16toutf8 cOut;
auto dto = dto::TranslateOut::createShared();
dto->text = cOut.convert(dst);
auto map = oatpp::Vector<oatpp::UInt32>::createShared();
auto m_end = mapping.cend();
for (size_t i = 0; i < src_len; ++i) {
auto j = i;
for (auto m = mapping.cbegin(); m != m_end; ++m)
j = m->to_dst(j);
map->push_back(j);
}
dto->map = map;
return createDtoResponse(Status::CODE_200, dto);
} catch (std::exception &ex) {
OATPP_LOGE(__FUNCTION__, "%s: %s", typeid(ex).name(), ex.what());
return ResponseFactory::createResponse(Status::CODE_500, ex.what());
}
}
ADD_CORS(postTranslateInv)
ENDPOINT_INFO(postTranslateInv) {
info->summary = "Inverse translate text";
info->description =
"Performs any number of supported translations (see /transet) on a given input text in a sequence in reverse. "
"Together with the output text, it also returns character index mapping between input and output texts.";
auto transet = oatpp::Vector<UInt16>::createShared();
transet->push_back(ZRCOLA_TRANSETID_DEFAULT);
auto dto = dto::TranslateIn::createShared();
dto->transet = transet;
dto->text = "T  ťᵉⓢṭ.";
dto->lang = "slv";
info->addConsumes<Object<dto::TranslateIn>>("application/json")
.addExample("Perform ZRCola decomposition", dto);
info->addResponse<Object<dto::TranslateOut>>(Status::CODE_200, "application/json");
}
ENDPOINT("POST", "/translateInv", postTranslateInv, BODY_DTO(Object<dto::TranslateIn>, input))
{
try {
utf8toutf16 cIn;
std::u16string dst, dst2;
ZRCola::langid_t lang;
if (input->text)
dst = cIn.convert(*input->text);
lang = input->lang->c_str();
size_t src_len = dst.size();
std::vector<ZRCola::mapping_vector> mapping;
if (input->transet) {
ZRCola::mapping_vector map;
const auto ts_begin = input->transet->cbegin();
for (auto ts = input->transet->cend(); (ts--) != ts_begin; ) {
switch (*ts) {
case ZRCOLA_TRANSETID_DEFAULT:
case ZRCOLA_TRANSETID_UNICODE:
t_db.TranslateInv(*ts, dst.data(), dst.size(), &lc_db, lang, dst2, &map);
dst = std::move(dst2);
dst2.clear();
map.invert();
mapping.push_back(std::move(map));
map.clear();
break;
default:
t_db.TranslateInv(*ts, dst.data(), dst.size(), dst2, &map);
dst = std::move(dst2);
dst2.clear();
map.invert();
mapping.push_back(std::move(map));
map.clear();
}
}
}
utf16toutf8 cOut;
auto dto = dto::TranslateOut::createShared();
dto->text = cOut.convert(dst);
auto map = oatpp::Vector<oatpp::UInt32>::createShared();
auto m_end = mapping.crend();
for (size_t i = 0; i < src_len; ++i) {
auto j = i;
for (auto m = mapping.crbegin(); m != m_end; ++m)
j = m->to_src(j);
map->push_back(j);
}
dto->map = map;
return createDtoResponse(Status::CODE_200, dto);
} catch (std::exception &ex) {
OATPP_LOGE(__FUNCTION__, "%s: %s", typeid(ex).name(), ex.what());
return ResponseFactory::createResponse(Status::CODE_500, ex.what());
}
}
};
#include OATPP_CODEGEN_END(ApiController)

90
ZRColaWS/dto.hpp Normal file
View File

@ -0,0 +1,90 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2022 Amebis
*/
#pragma once
#include <oatpp/core/data/mapping/type/Object.hpp>
#include <oatpp/core/macro/codegen.hpp>
#include <oatpp/core/Types.hpp>
#include OATPP_CODEGEN_BEGIN(DTO)
namespace dto {
class About : public oatpp::DTO
{
DTO_INIT(About, DTO)
DTO_FIELD_INFO(vendor) { info->description = "Application vendor"; }
DTO_FIELD(String, vendor);
DTO_FIELD_INFO(application) { info->description = "Application name"; }
DTO_FIELD(String, application);
DTO_FIELD_INFO(version) { info->description = "Application version"; }
DTO_FIELD(String, version);
};
class TranSet : public oatpp::DTO
{
DTO_INIT(TranSet, DTO)
DTO_FIELD_INFO(set) { info->description = "Translation set ID"; }
DTO_FIELD(UInt16, set);
DTO_FIELD_INFO(src) { info->description = "Input transcript name in English"; }
DTO_FIELD(String, src);
DTO_FIELD_INFO(dst) { info->description = "Output transcript name in English"; }
DTO_FIELD(String, dst);
};
class Language : public oatpp::DTO
{
DTO_INIT(Language, DTO)
DTO_FIELD_INFO(lang) { info->description = "Language ID"; }
DTO_FIELD(String, lang);
DTO_FIELD_INFO(name) { info->description = "Language name in English"; }
DTO_FIELD(String, name);
};
class TranslateIn : public oatpp::DTO
{
DTO_INIT(TranslateIn, DTO)
DTO_FIELD_INFO(transet) {
info->description = "Array of one or multiple translation set IDs to perform translation on the text. When inverse translating, the translation sets are read in reverse order listed in this array. Use /transet to get IDs of all supported translation sets.";
info->required = true;
}
DTO_FIELD(Vector<UInt16>, transet);
DTO_FIELD_INFO(text) {
info->description = "Text to be translated";
info->required = true;
}
DTO_FIELD(String, text);
DTO_FIELD_INFO(lang) {
info->description = "Language ID of the text to be translated. This is used on inverse translating to skip decomposing language-specific common characters (e.g. č, š, ž in Slovenian, or ä, ö, ü in German). Use /language to get IDs of all supported languages.";
}
DTO_FIELD(String, lang) = "slv";
};
class TranslateOut : public oatpp::DTO
{
DTO_INIT(TranslateOut, DTO)
DTO_FIELD_INFO(text) { info->description = "Translated text"; }
DTO_FIELD(String, text);
DTO_FIELD_INFO(map) { info->description = "Character index mapping between input and translated text. The map[i] value represents the index of the beginning of a character (in translated text) that translated from the character (in the input text) beginning at index i. All input indexes are measured in characters after input string is translated to UTF-16, and all output indexes are measured in characters before output string is translated from UTF-16."; }
DTO_FIELD(Vector<UInt32>, map);
};
}
#include OATPP_CODEGEN_END(DTO)

75
ZRColaWS/iconverter.hpp Normal file
View File

@ -0,0 +1,75 @@
/*
SPDX-License-Identifier: GPL-3.0-or-later
Copyright © 2022 Amebis
*/
#pragma once
#include <stdex/compat.hpp>
#include <iconv.h>
#include <cstring>
#include <stdexcept>
#include <string>
inline static std::runtime_error errno_error(_In_z_ const char *file, _In_ int line, _In_z_ const char *func)
{
int _errno = errno;
return std::runtime_error(
std::string(file) + ":" + std::to_string(line) +
std::string(func) + " error " + std::to_string(_errno) + ": " +
std::strerror(_errno));
}
template <typename T_from, typename T_to>
class iconverter
{
public:
iconverter(_In_z_ const char* from, _In_z_ const char* to)
{
m_handle = iconv_open(to, from);
if (m_handle == (iconv_t)-1)
throw errno_error(__FILE__, __LINE__, __FUNCTION__);
}
~iconverter()
{
iconv_close(m_handle);
}
std::basic_string<T_to> convert(_In_z_count_(count) const T_from* input, _In_ size_t count) const
{
T_to buf[0x100];
std::basic_string<T_to> result;
size_t inSize = sizeof(T_from) * count;
do {
T_to* output = &buf[0];
size_t outSize = sizeof(buf);
errno = 0;
iconv(m_handle, (char**)&input, &inSize, (char**)&output, &outSize);
if (errno)
throw errno_error(__FILE__, __LINE__, __FUNCTION__);
result.insert(result.end(), buf, (T_to*)((char*)buf + sizeof(buf) - outSize));
} while (inSize);
return result;
}
std::basic_string<T_to> convert(_In_ const std::basic_string<T_from>& input)
{
return convert(input.c_str(), input.length());
}
protected:
iconv_t m_handle;
};
class utf16toutf8 : public iconverter<char16_t, char>
{
public:
utf16toutf8() : iconverter("UTF-16LE", "UTF-8") {}
};
class utf8toutf16 : public iconverter<char, char16_t>
{
public:
utf8toutf16() : iconverter("UTF-8", "UTF-16LE") {}
};

Some files were not shown because too many files have changed in this diff Show More