Compare commits
227 Commits
taskmgr_ac
...
rfb/taskmg
Author | SHA1 | Date | |
---|---|---|---|
|
f6a71ae59e | ||
|
373e9d3037 | ||
|
7ef396c48d | ||
|
747fe48d1d | ||
|
27e978a005 | ||
|
95a5e81a96 | ||
|
375973fc3b | ||
|
f6873ce75b | ||
|
4c7222bab3 | ||
|
1c56c9cd5f | ||
|
3ce9e3b669 | ||
|
b693eddd74 | ||
|
161eb5d375 | ||
|
f49e213943 | ||
|
7901a4c8fe | ||
|
91adec683d | ||
|
3fb5957de1 | ||
|
e07dbf782c | ||
|
8d7153c8ba | ||
|
10e7643c80 | ||
|
413b5a0827 | ||
|
6eb8a1d0c7 | ||
|
f283a3f9ae | ||
|
b4b1c5b9aa | ||
|
7fb91d98f9 | ||
|
23f31cf7b4 | ||
|
bac646f9fe | ||
|
c6ec8d924e | ||
|
8d54c2d433 | ||
|
357189bdea | ||
|
6d7cc0d8ad | ||
|
cb8c554c4c | ||
|
39bec4df92 | ||
|
1d12f6135a | ||
|
e743146a10 | ||
|
1997c12252 | ||
|
ee11747527 | ||
|
83e1193fb2 | ||
|
6ca8eb5c1e | ||
|
7377f14339 | ||
|
9cc4d8994b | ||
|
2b7246fd3c | ||
|
58f1201eae | ||
|
2245dd78f5 | ||
|
a34f1ed03c | ||
|
d4993c67cd | ||
|
840dfdc3a1 | ||
|
86f98baaf8 | ||
|
a3d22bba1a | ||
|
bdf52a9868 | ||
|
51b5d846e9 | ||
|
520cf2294d | ||
|
5ecead80e3 | ||
|
4bd1e81998 | ||
|
393a88a372 | ||
|
565bf9e340 | ||
|
3666f2bdbc | ||
|
a575921e93 | ||
|
df24297a10 | ||
|
dd8029fd0e | ||
|
f1e1ca4ad7 | ||
|
51cc0019f7 | ||
|
3285d2c769 | ||
|
aca3f92a47 | ||
|
5ee25ee392 | ||
|
328a5d87b0 | ||
|
c6ed289383 | ||
|
7cd1e606df | ||
|
416e6ef814 | ||
|
d7b7d36721 | ||
|
6e9d798833 | ||
|
46f67b1970 | ||
|
ff0b63ff2e | ||
|
c6c7fc1182 | ||
|
97bf53eeb8 | ||
|
2b910fc1b3 | ||
|
1795049341 | ||
|
692c0141d3 | ||
|
1e1b176493 | ||
|
dfcf07b825 | ||
|
adeaba1604 | ||
|
0177b1af45 | ||
|
55563fa891 | ||
|
561ad3c1d6 | ||
|
0ae6a509b0 | ||
|
43d6fdf2be | ||
|
7f80d5ee79 | ||
|
1ae6cb7a96 | ||
|
6691cbe889 | ||
|
f6de3881ca | ||
|
efb9128c24 | ||
|
81ba804b55 | ||
|
4b03981846 | ||
|
b3c1f652ec | ||
|
a6c838299c | ||
|
fa4b38d902 | ||
|
56828b82d9 | ||
|
a938d19714 | ||
|
d21def4819 | ||
|
119057800e | ||
|
b69a7460db | ||
|
640d67d12a | ||
|
d7e1bd2705 | ||
|
4aa1bcb72b | ||
|
d7ece626cb | ||
|
e627c3b00e | ||
|
eb4d13c823 | ||
|
a114169c4d | ||
|
a6418c848c | ||
|
37f56d2448 | ||
|
32b883ef2f | ||
|
17530af261 | ||
|
c6c6c62cb5 | ||
|
dabb3f4d61 | ||
|
64997887eb | ||
|
c1b12b3f46 | ||
|
0a951f1112 | ||
|
5d1be078f8 | ||
|
31876ba8c2 | ||
|
b3194e320c | ||
|
25b7447818 | ||
|
8a049d0b68 | ||
|
60b0afc3af | ||
|
6d7aaaade0 | ||
|
ad12c6cdea | ||
|
00f192fa94 | ||
|
87f94aa10c | ||
|
aed376e00f | ||
|
bdae8cf966 | ||
|
46ab34662d | ||
|
64f40e7f30 | ||
|
c9c6902f08 | ||
|
ebcf3cf38e | ||
|
9ed4bf1ed7 | ||
|
06e4f13653 | ||
|
1899a09399 | ||
|
3d4f001084 | ||
|
128e7f5aea | ||
|
a52c713755 | ||
|
ad5df2d199 | ||
|
2ccdd87809 | ||
|
81e936486e | ||
|
9dfb3e8e05 | ||
|
dcc9a2d8f3 | ||
|
8f6b016963 | ||
|
4eace8d762 | ||
|
995f56d1d3 | ||
|
be8a6f8af1 | ||
|
fea414b9ed | ||
|
8cef980ab9 | ||
|
9360423cc2 | ||
|
d831bc4fab | ||
|
23589e9bf1 | ||
|
07ad8c4c11 | ||
|
601bb49c0d | ||
|
de3958dc2b | ||
|
a662bedab8 | ||
|
84d0586ca4 | ||
|
a8b57f0a6b | ||
|
6d701b4b05 | ||
|
ab199cc147 | ||
|
501c2bdd63 | ||
|
5b54477d47 | ||
|
7f5c59a0b3 | ||
|
6f86e11aa2 | ||
|
bc70af4c13 | ||
|
855008d97b | ||
|
c03b2ed9be | ||
|
1fed9475cc | ||
|
ddd1d19b3f | ||
|
ded91e310a | ||
|
63eaf2bd52 | ||
|
171941ad18 | ||
|
b3a25bcf8b | ||
|
fd1e5d53a5 | ||
|
0af84ce12d | ||
|
59d8a77df6 | ||
|
a8e8add0c0 | ||
|
e0545dab15 | ||
|
d9cb169920 | ||
|
7b38f80119 | ||
|
97e53c6963 | ||
|
40d444919e | ||
|
a27b8009e0 | ||
|
3b7c7d8e68 | ||
|
f49919ce5d | ||
|
8f1eb03ad2 | ||
|
e2d3aa7f4a | ||
|
13a145b6d8 | ||
|
8669679499 | ||
|
d955b9321b | ||
|
fd1e158480 | ||
|
5c2ec83fa7 | ||
|
1c4bf2d702 | ||
|
1183e797b4 | ||
|
9a51c8e6c6 | ||
|
70d5c864bc | ||
|
409df2355e | ||
|
4306e261ee | ||
|
bc28675a44 | ||
|
ff3dadf89d | ||
|
a6b281c228 | ||
|
8451230753 | ||
|
62eeb158a5 | ||
|
0c164f081a | ||
|
611d89eb8b | ||
|
63aef3e1fc | ||
|
8d8f4d328c | ||
|
11b706429c | ||
|
9021a14f4a | ||
|
42c93e3cbb | ||
|
ce08851758 | ||
|
e4608f7450 | ||
|
d0b43a399f | ||
|
e685b25e35 | ||
|
d96b3cd45c | ||
|
2a5fd78f1b | ||
|
a8755711b9 | ||
|
f1cff6ef27 | ||
|
1a90009bb9 | ||
|
3579ea7888 | ||
|
d72025649b | ||
|
09bfd96f3b | ||
|
fefb1b7745 | ||
|
4b4638dc55 | ||
|
95c104f29a | ||
|
be5c889cdf |
@@ -336,14 +336,12 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
|
||||
add_subdirectory(sdk/include/reactos/mc)
|
||||
add_subdirectory(sdk/include/asm)
|
||||
|
||||
if(NO_ROSSYM)
|
||||
if(ARCH MATCHES "64$")
|
||||
include(sdk/cmake/baseaddress64.cmake)
|
||||
elseif(NO_ROSSYM)
|
||||
include(sdk/cmake/baseaddress_dwarf.cmake)
|
||||
elseif(MSVC)
|
||||
if (ARCH STREQUAL "amd64")
|
||||
include(sdk/cmake/baseaddress_msvc_x64.cmake)
|
||||
else()
|
||||
include(sdk/cmake/baseaddress_msvc.cmake)
|
||||
endif()
|
||||
include(sdk/cmake/baseaddress_msvc.cmake)
|
||||
else()
|
||||
include(sdk/cmake/baseaddress.cmake)
|
||||
endif()
|
||||
|
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <windef.h>
|
||||
#include <winuser.h>
|
||||
#include <winuser.rh>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
@@ -1,4 +1,11 @@
|
||||
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
|
||||
/*
|
||||
* PROJECT: ReactOS Clipboard
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Romanian resource file
|
||||
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
|
||||
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
|
||||
ID_ACCEL ACCELERATORS
|
||||
@@ -11,7 +18,7 @@ BEGIN
|
||||
POPUP "&Fișier"
|
||||
BEGIN
|
||||
MENUITEM "&Deschidere…", CMD_OPEN
|
||||
MENUITEM "Păst&rare ca…", CMD_SAVE_AS
|
||||
MENUITEM "S&alvează ca…", CMD_SAVE_AS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "I&eșire", CMD_EXIT
|
||||
END
|
||||
|
@@ -3,6 +3,7 @@
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Romanian resource file
|
||||
* TRANSLATORS: Copyright 2011-2014 Ștefan Fulea <stefan.fulea@mail.com>
|
||||
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
@@ -23,6 +24,6 @@ ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] fișier ...\n\
|
||||
Tastați ATTRIB fără argumente pentru afișarea atributelor pentru\n\
|
||||
toate fișierele.\n"
|
||||
STRING_CONSOLE_ERROR "Eroare necunoscută: %d\n"
|
||||
STRING_FILE_NOT_FOUND "File not found - '%s'\n"
|
||||
STRING_FILE_NOT_FOUND "Fișierul nu a fost găsit - '%s'\n"
|
||||
STRING_ERROR_INVALID_PARAM_FORMAT "Formatul argumentului este eronat - %s\n"
|
||||
END
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* FILE: base/applications/cmdutils/find/lang/ro-RO.rc
|
||||
* ReactOS Project (https://reactos.org)
|
||||
* TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan)
|
||||
* CHANGE LOG: 2011-08-20 initial translation
|
||||
* 2011-10-17 diacritics change, other minor changes
|
||||
* PROJECT: ReactOS Find Command
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Romanian resource file
|
||||
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
|
||||
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
@@ -16,8 +16,9 @@ FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] ""șir"" [fișier...]\n\
|
||||
/C Numără liniile ce conțin șirul.\n\
|
||||
/N Numără rândurile afișate, începând cu 1.\n\
|
||||
/I Ignoră diferențele între majuscule și minuscule.\n\
|
||||
/OFF[LINE] Do not skip files that have the offline attribute set."
|
||||
/OFF[LINE] Nu omite fișierele care care au configurate atributul\n\
|
||||
offline (deconectat)."
|
||||
IDS_NO_SUCH_FILE "FIND: Fișierul «%s» nu există!\n"
|
||||
IDS_CANNOT_OPEN "FIND: Fișierul «%s» nu poate fi deschis!\n"
|
||||
IDS_INVALID_SWITCH "FIND: Invalid switch\n"
|
||||
IDS_INVALID_SWITCH "FIND: Comutare nevalidă\n"
|
||||
END
|
||||
|
@@ -1,20 +1,26 @@
|
||||
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
|
||||
/*
|
||||
* PROJECT: ReactOS Label Command
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Romanian resource file
|
||||
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
|
||||
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
// STRING_LABEL_HELP "Afișează sau modifică eticheta unei unități (de stocare).\n\nLABEL [unitate:][etichetă]\n"
|
||||
STRING_LABEL_HELP "Creates, changes or deletes the volume label of a disk.\n\n\
|
||||
LABEL [drive:][label]\n\n\
|
||||
drive: Specifies the drive letter of a drive.\n\
|
||||
label Specifies the label of the drive."
|
||||
STRING_LABEL_TEXT1 "Volumul unității %c: este etichetat ca %s\n"
|
||||
STRING_LABEL_TEXT2 "Volumul unității %c: nu este etichetat.\n"
|
||||
STRING_LABEL_HELP "Crează, schimbă sau șterge denumirea unui dispozitiv.\n\n\
|
||||
LABEL [dispozitiv:][denumire]\n\n\
|
||||
dispozitiv: Specifică litera unui dispozitiv.\n\
|
||||
denumire Specifică denumirea unui dispozitiv."
|
||||
STRING_LABEL_TEXT1 "Volumul unității %c: este denumit ca %s\n"
|
||||
STRING_LABEL_TEXT2 "Volumul unității %c: nu este denumit.\n"
|
||||
STRING_LABEL_TEXT3 "Numărul de serie al volumului este %04X-%04X\n"
|
||||
STRING_LABEL_TEXT4 "Introduceți eticheta unității (opțională, de 32 caractere), apoi ENTER "
|
||||
STRING_LABEL_PROMPT "Delete current volume label (Y/N)? "
|
||||
STRING_LABEL_OPTIONS "YN"
|
||||
STRING_LABEL_TEXT4 "Introduceți denumirea unității (opțională, de 32 caractere), apoi ENTER "
|
||||
STRING_LABEL_PROMPT "Ștergeți denumirea actuală a volumului (Da/Nu)? "
|
||||
STRING_LABEL_OPTIONS "DaNu"
|
||||
STRING_ERROR_INVALID_DRIVE "Specificarea unității este eronată\n"
|
||||
STRING_ERROR_INVALID_LABEL "Invalid volume label\n"
|
||||
STRING_ERROR_INVALID_LABEL "Denumirea volumului e nevalidă\n"
|
||||
END
|
||||
|
@@ -1,60 +1,66 @@
|
||||
/*
|
||||
* FILE: base/applications/cmdutils/more/lang/ro-RO.rc
|
||||
* ReactOS Project (https://reactos.org)
|
||||
* TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan)
|
||||
* CHANGE LOG: 2011-08-20 initial translation
|
||||
* 2011-10-17 diacritics change, other minor changes
|
||||
* PROJECT: ReactOS More Command
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Romanian resource file
|
||||
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
|
||||
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_USAGE "Afișează date pe ecran, pagină-cu-pagină.\n\
|
||||
IDS_USAGE "Afișarea datelor pe ecran, pagină cu pagină.\n\
|
||||
\n\
|
||||
MORE [/E [options]] < [drive:][path]filename\n\
|
||||
command | MORE [/E [options]]\n\
|
||||
MORE [/E [opțiuni]] < [dispozitiv:][cale]numele fișierului\n\
|
||||
command | MORE [/E [opțiuni]\n\
|
||||
\n\
|
||||
[drive:][path]filename A file whose contents are to be displayed.\n\
|
||||
command A command whose output is to be displayed.\n\
|
||||
[dispozitiv:][cale]numele fișierului Un fișier al cărui conținut\n\
|
||||
urmează să fie afișat.\n\
|
||||
comandă O comandă a cărei ieșire\n\
|
||||
urmează să fie afișată.\n\
|
||||
\n\
|
||||
When Extended Features are enabled, the following form is supported:\n\
|
||||
MORE [/E] [options] [files]\n\
|
||||
Atunci când opțiunea Caracteristici extinse e activată,\n\
|
||||
următoarea formă este acceptată:\n\
|
||||
MORE [/E] [opțiuni] [fișiere]\n\
|
||||
\n\
|
||||
Options:\n\
|
||||
/E Enable Extended Features.\n\
|
||||
The default state of the Extended Features is controlled by the default\n\
|
||||
registry settings for CMD.EXE. For more details on how to change these\n\
|
||||
settings, see the section ""Command Extensions"" in CMD.EXE help.\n\
|
||||
Opțiuni:\n\
|
||||
/E Activarea opțiunii Caracteristici extinse.\n\
|
||||
Stadiul implicit al Caracteristicilor extinse e controlat de\n\
|
||||
configurațiile implicite de registru pentru programul CMD.EXE. Pentru mai\n\
|
||||
multe detalii legate de cum pot fi schimbate aceste configurații, vedeți\n\
|
||||
secțiunea ""Extensii de comenzi"" în secțiunea de ajutor a programului\n\
|
||||
CMD.EXE.\n\
|
||||
\n\
|
||||
When Extended Features are enabled, the following options are available:\n\
|
||||
/C Clear the screen before displaying a page.\n\
|
||||
/P Expand Form-Feed characters.\n\
|
||||
/S Shrink successive blank lines to a single line.\n\
|
||||
/Tn Expand tabs to n spaces (default: 8).\n\
|
||||
Atunci când opțiunea Caracteristici extinse e activată, sunt disponibile\n\
|
||||
următoarele opțiuni:\n\
|
||||
/C Curățarea ecranului înainte de a se afișa o pagină.\n\
|
||||
/P Extinderea caracterelor Form-Feed (de alimentare de formulare).\n\
|
||||
/S Reducerea liniilor goale succesive la o singură linie.\n\
|
||||
/Tn Extinderea tab-urilor la n spații (implicit: 8).\n\
|
||||
\n\
|
||||
These options can be specified in the MORE environment variable.\n\
|
||||
Aceste opțiuni pot fi specificate în variabila de mediu MORE.\n\
|
||||
\n\
|
||||
+n Start displaying the first file at line n.\n\
|
||||
files List of files to display, separated by blanks.\n\
|
||||
+n Începerea afișării primului fișier la linia n.\n\
|
||||
fișiere Lista fișierelor de afișat, separate prin spații libere.\n\
|
||||
\n\
|
||||
When Extended Features are enabled, the following commands are available\n\
|
||||
at the ""-- Continue --"" prompt:\n\
|
||||
Atunci când opțiunea Caracteristici extinse e activată, sunt disponibile\n\
|
||||
următoarele comenzi la panoul ""-- Continuă --"":\n\
|
||||
\n\
|
||||
P n Display the next n lines.\n\
|
||||
S n Skip the next n lines.\n\
|
||||
F Display the next file.\n\
|
||||
Q Quit.\n\
|
||||
= Show the line number.\n\
|
||||
? Show the help line.\n\
|
||||
<Space> Display the next page.\n\
|
||||
<Enter> Display the next line.\n"
|
||||
P n Afișarea următoarelor n linii.\n\
|
||||
S n Omiterea următoarelor n linii.\n\
|
||||
F Afișarea următorului fișier.\n\
|
||||
Q Ieșire.\n\
|
||||
= Afișarea numărului de linie.\n\
|
||||
? Afișarea liniei de ajutor.\n\
|
||||
<Space> Afișarea următoarei pagini.\n\
|
||||
<Enter> Afișarea următoari linii.\n"
|
||||
|
||||
IDS_BAD_FLAG "Invalid argument - '%s'\n"
|
||||
IDS_BAD_FLAG "Argument nevalid - '%s'\n"
|
||||
IDS_FILE_ACCESS "Fișierul «%s» nu poate fi accesat!\n"
|
||||
IDS_CONTINUE_PROMPT "-- Continuă%1%2%3 --%4"
|
||||
IDS_CONTINUE_PERCENT " (%d%%)"
|
||||
IDS_CONTINUE_LINE_AT " [Line: %d]"
|
||||
IDS_CONTINUE_OPTIONS " [Options: psfq=<Space><Enter>]"
|
||||
IDS_CONTINUE_LINES " Lines: "
|
||||
IDS_CONTINUE_LINE_AT " [Linie: %d]"
|
||||
IDS_CONTINUE_OPTIONS " [Opțiuni: psfq=<Space><Enter>]"
|
||||
IDS_CONTINUE_LINES " Linii: "
|
||||
END
|
||||
|
@@ -1,7 +1,9 @@
|
||||
/*
|
||||
* FILE: base/applications/dxdiag/lang/ro-RO.rc
|
||||
* ReactOS Project (https://reactos.org)
|
||||
* TRANSLATOR: Ștefan Fulea (stefan dot fulea at mail dot com)
|
||||
* PROJECT: ReactOS DX Diagnostic
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Romanian resource file
|
||||
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
|
||||
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
@@ -15,7 +17,7 @@ BEGIN
|
||||
CONTROL "Tab1", IDC_TAB_CONTROL, "SysTabControl32", WS_TABSTOP, 2, 2, 474, 250
|
||||
PUSHBUTTON "&Manual…", IDC_BUTTON_HELP, 2, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
|
||||
DEFPUSHBUTTON "&Următorul compartiment", IDC_BUTTON_NEXT, 187, 260, 120, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
PUSHBUTTON "&Păstrare informații…", IDC_BUTTON_SAVE_INFO, 311, 260, 110, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
|
||||
PUSHBUTTON "S&alvare informații…", IDC_BUTTON_SAVE_INFO, 311, 260, 110, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
|
||||
PUSHBUTTON "Î&nchide", IDC_BUTTON_EXIT, 425, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
END
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PURPOSE: Romanian resource file
|
||||
* TRANSLATORS: Copyright 2009 Petru Dimitriu <petrimetri@gmail.com>
|
||||
* Copyright 2011-2018 Ștefan Fulea <stefan.fulea@mail.com>
|
||||
* Copyright 2022 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
* Copyright 2022-2023 Andrei Miloiu <miloiuandrei@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
@@ -25,7 +25,7 @@ BEGIN
|
||||
AUTORADIOBUTTON "Fă&ră", IDC_OPT_NOSCORE, 107, 45, 60, 10
|
||||
AUTOCHECKBOX "&Afișează timp", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP
|
||||
AUTOCHECKBOX "&Bară de stare", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP
|
||||
AUTOCHECKBOX "&Păstrează scorul", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP
|
||||
AUTOCHECKBOX "Salvea&ză scorul", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP
|
||||
DEFPUSHBUTTON "Con&firmă", IDOK, 35, 97, 50, 14
|
||||
PUSHBUTTON "A&nulează", IDCANCEL, 101, 97, 50, 14
|
||||
END
|
||||
|
@@ -145,16 +145,9 @@ static VOID UpdateLayoutList(HKL hKL OPTIONAL)
|
||||
|
||||
if (!hKL)
|
||||
{
|
||||
if (0 <= (g_nCurrentLayoutNum - 1) && (g_nCurrentLayoutNum - 1) < g_cKLs)
|
||||
{
|
||||
hKL = g_ahKLs[g_nCurrentLayoutNum - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow());
|
||||
DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
|
||||
hKL = GetKeyboardLayout(dwTID);
|
||||
}
|
||||
HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow());
|
||||
DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
|
||||
hKL = GetKeyboardLayout(dwTID);
|
||||
}
|
||||
|
||||
g_cKLs = GetKeyboardLayoutList(ARRAYSIZE(g_ahKLs), g_ahKLs);
|
||||
@@ -737,6 +730,8 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_RBUTTONUP:
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
UpdateLayoutList(NULL);
|
||||
|
||||
GetCursorPos(&pt);
|
||||
SetForegroundWindow(hwnd);
|
||||
|
||||
|
@@ -28,8 +28,8 @@ BEGIN
|
||||
BEGIN
|
||||
MENUITEM "&Nou\tCtrl+N", IDM_FILE_NEW
|
||||
MENUITEM "&Deschide\tCtrl+O", IDM_FILE_OPEN
|
||||
MENUITEM "&Păstrează", IDM_FILE_SAVE
|
||||
MENUITEM "Păst&rare în…", IDM_FILE_SAVEAS
|
||||
MENUITEM "S&alvează", IDM_FILE_SAVE
|
||||
MENUITEM "Sal&vează ca…", IDM_FILE_SAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "I&eșire\tAlt+F4", IDM_FILE_EXIT
|
||||
END
|
||||
|
@@ -28,7 +28,7 @@ list(APPEND SOURCE
|
||||
winproc.cpp
|
||||
precomp.h)
|
||||
|
||||
file(GLOB mspaint_rc_deps icons/*.*)
|
||||
file(GLOB mspaint_rc_deps img/*.*)
|
||||
add_rc_deps(rsrc.rc ${mspaint_rc_deps})
|
||||
add_executable(mspaint ${SOURCE} rsrc.rc)
|
||||
set_module_type(mspaint win32gui UNICODE)
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HRESULT LoadDx(LPCTSTR pszFileName, float *pxDpi, float *pyDpi) throw()
|
||||
HRESULT LoadDx(LPCWSTR pszFileName, float *pxDpi, float *pyDpi) throw()
|
||||
{
|
||||
using namespace Gdiplus;
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
return (status == Ok ? S_OK : E_FAIL);
|
||||
}
|
||||
|
||||
HRESULT SaveDx(LPCTSTR pszFileName, REFGUID guidFileType = GUID_NULL,
|
||||
HRESULT SaveDx(LPCWSTR pszFileName, REFGUID guidFileType = GUID_NULL,
|
||||
float xDpi = 0, float yDpi = 0) throw()
|
||||
{
|
||||
using namespace Gdiplus;
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
CLSID clsid;
|
||||
if (::IsEqualGUID(guidFileType, GUID_NULL))
|
||||
{
|
||||
CString strExt(PathFindExtension(pszFileName));
|
||||
CStringW strExt(PathFindExtensionW(pszFileName));
|
||||
clsid = FindCodecForExtension(strExt, pEncoders, cEncoders);
|
||||
}
|
||||
else
|
||||
@@ -300,23 +300,23 @@ protected:
|
||||
|
||||
// CImage::FindCodecForExtension is private. We have to duplicate it at here...
|
||||
static CLSID
|
||||
FindCodecForExtension(LPCTSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs)
|
||||
FindCodecForExtension(LPCWSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs)
|
||||
{
|
||||
for (UINT i = 0; i < nCodecs; ++i)
|
||||
{
|
||||
CString strSpecs(pCodecs[i].FilenameExtension);
|
||||
CStringW strSpecs(pCodecs[i].FilenameExtension);
|
||||
int ichOld = 0, ichSep;
|
||||
for (;;)
|
||||
{
|
||||
ichSep = strSpecs.Find(TEXT(';'), ichOld);
|
||||
ichSep = strSpecs.Find(L';', ichOld);
|
||||
|
||||
CString strSpec;
|
||||
CStringW strSpec;
|
||||
if (ichSep < 0)
|
||||
strSpec = strSpecs.Mid(ichOld);
|
||||
else
|
||||
strSpec = strSpecs.Mid(ichOld, ichSep - ichOld);
|
||||
|
||||
int ichDot = strSpec.ReverseFind(TEXT('.'));
|
||||
int ichDot = strSpec.ReverseFind(L'.');
|
||||
if (ichDot >= 0)
|
||||
strSpec = strSpec.Mid(ichDot);
|
||||
|
||||
|
@@ -29,18 +29,6 @@ CCanvasWindow::~CCanvasWindow()
|
||||
::DeleteObject(m_ahbmCached[1]);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::drawZoomFrame(INT mouseX, INT mouseY)
|
||||
{
|
||||
// FIXME: Draw the border of the area that is to be zoomed in
|
||||
CRect rc;
|
||||
GetImageRect(rc);
|
||||
ImageToCanvas(rc);
|
||||
|
||||
HDC hdc = GetDC();
|
||||
DrawXorRect(hdc, &rc);
|
||||
ReleaseDC(hdc);
|
||||
}
|
||||
|
||||
RECT CCanvasWindow::GetBaseRect()
|
||||
{
|
||||
CRect rcBase;
|
||||
@@ -101,31 +89,88 @@ HITTEST CCanvasWindow::CanvasHitTest(POINT pt)
|
||||
return getSizeBoxHitTest(pt, &rcBase);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::getNewZoomRect(CRect& rcView, INT newZoom, CPoint ptTarget)
|
||||
{
|
||||
CRect rcImage;
|
||||
GetImageRect(rcImage);
|
||||
ImageToCanvas(rcImage);
|
||||
|
||||
// Calculate the zoom rectangle
|
||||
INT oldZoom = toolsModel.GetZoom();
|
||||
GetClientRect(rcView);
|
||||
LONG cxView = rcView.right * oldZoom / newZoom, cyView = rcView.bottom * oldZoom / newZoom;
|
||||
::SetRect(&rcView, ptTarget.x - cxView / 2, ptTarget.y - cyView / 2,
|
||||
ptTarget.x + cxView / 2, ptTarget.y + cyView / 2);
|
||||
|
||||
// Shift the rectangle if necessary
|
||||
INT dx = 0, dy = 0;
|
||||
if (rcView.left < rcImage.left)
|
||||
dx = rcImage.left - rcView.left;
|
||||
else if (rcImage.right < rcView.right)
|
||||
dx = rcImage.right - rcView.right;
|
||||
if (rcView.top < rcImage.top)
|
||||
dy = rcImage.top - rcView.top;
|
||||
else if (rcImage.bottom < rcView.bottom)
|
||||
dy = rcImage.bottom - rcView.bottom;
|
||||
rcView.OffsetRect(dx, dy);
|
||||
|
||||
rcView.IntersectRect(&rcView, &rcImage);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::zoomTo(INT newZoom, LONG left, LONG top)
|
||||
{
|
||||
POINT pt = { left, top };
|
||||
CanvasToImage(pt);
|
||||
|
||||
toolsModel.SetZoom(newZoom);
|
||||
ImageToCanvas(pt);
|
||||
pt.x += GetScrollPos(SB_HORZ);
|
||||
pt.y += GetScrollPos(SB_VERT);
|
||||
|
||||
updateScrollRange();
|
||||
updateScrollPos(pt.x, pt.y);
|
||||
Invalidate(TRUE);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
|
||||
{
|
||||
// This is the target area we have to draw on
|
||||
CRect rcCanvasDraw;
|
||||
rcCanvasDraw.IntersectRect(&rcClient, &rcPaint);
|
||||
|
||||
// We use a memory bitmap to reduce flickering
|
||||
HDC hdcMem0 = ::CreateCompatibleDC(hDC);
|
||||
m_ahbmCached[0] = CachedBufferDIB(m_ahbmCached[0], rcClient.right, rcClient.bottom);
|
||||
HGDIOBJ hbm0Old = ::SelectObject(hdcMem0, m_ahbmCached[0]);
|
||||
|
||||
// Fill the background on hdcMem0
|
||||
::FillRect(hdcMem0, &rcPaint, (HBRUSH)(COLOR_APPWORKSPACE + 1));
|
||||
::FillRect(hdcMem0, &rcCanvasDraw, (HBRUSH)(COLOR_APPWORKSPACE + 1));
|
||||
|
||||
// Draw the sizeboxes if necessary
|
||||
RECT rcBase = GetBaseRect();
|
||||
if (!selectionModel.m_bShow && !::IsWindowVisible(textEditWindow))
|
||||
drawSizeBoxes(hdcMem0, &rcBase, FALSE, &rcPaint);
|
||||
drawSizeBoxes(hdcMem0, &rcBase, FALSE, &rcCanvasDraw);
|
||||
|
||||
// Calculate image size
|
||||
CRect rcImage;
|
||||
GetImageRect(rcImage);
|
||||
SIZE sizeImage = { imageModel.GetWidth(), imageModel.GetHeight() };
|
||||
|
||||
// Calculate the target area on the image
|
||||
CRect rcImageDraw = rcCanvasDraw;
|
||||
CanvasToImage(rcImageDraw);
|
||||
rcImageDraw.IntersectRect(&rcImageDraw, &rcImage);
|
||||
|
||||
// Consider rounding down by zooming
|
||||
rcImageDraw.right += 1;
|
||||
rcImageDraw.bottom += 1;
|
||||
|
||||
// hdcMem1 <-- imageModel
|
||||
HDC hdcMem1 = ::CreateCompatibleDC(hDC);
|
||||
m_ahbmCached[1] = CachedBufferDIB(m_ahbmCached[1], sizeImage.cx, sizeImage.cy);
|
||||
HGDIOBJ hbm1Old = ::SelectObject(hdcMem1, m_ahbmCached[1]);
|
||||
BitBlt(hdcMem1, 0, 0, sizeImage.cx, sizeImage.cy, imageModel.GetDC(), 0, 0, SRCCOPY);
|
||||
::BitBlt(hdcMem1, rcImageDraw.left, rcImageDraw.top, rcImageDraw.Width(), rcImageDraw.Height(),
|
||||
imageModel.GetDC(), rcImageDraw.left, rcImageDraw.top, SRCCOPY);
|
||||
|
||||
// Draw overlay #1 on hdcMem1
|
||||
toolsModel.OnDrawOverlayOnImage(hdcMem1);
|
||||
@@ -170,17 +215,15 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
|
||||
DrawXorRect(hdcMem0, &m_rcResizing);
|
||||
|
||||
// Transfer the bits (hDC <-- hdcMem0)
|
||||
::BitBlt(hDC,
|
||||
rcPaint.left, rcPaint.top,
|
||||
rcPaint.right - rcPaint.left, rcPaint.bottom - rcPaint.top,
|
||||
hdcMem0, rcPaint.left, rcPaint.top, SRCCOPY);
|
||||
::BitBlt(hDC, rcCanvasDraw.left, rcCanvasDraw.top, rcCanvasDraw.Width(), rcCanvasDraw.Height(),
|
||||
hdcMem0, rcCanvasDraw.left, rcCanvasDraw.top, SRCCOPY);
|
||||
|
||||
// Clean up hdcMem0
|
||||
::SelectObject(hdcMem0, hbm0Old);
|
||||
::DeleteDC(hdcMem0);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::Update(HWND hwndFrom)
|
||||
VOID CCanvasWindow::updateScrollRange()
|
||||
{
|
||||
CRect rcClient;
|
||||
GetClientRect(&rcClient);
|
||||
@@ -211,10 +254,16 @@ VOID CCanvasWindow::Update(HWND hwndFrom)
|
||||
SetScrollInfo(SB_VERT, &si);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::updateScrollPos(INT x, INT y)
|
||||
{
|
||||
SetScrollPos(SB_HORZ, x);
|
||||
SetScrollPos(SB_VERT, y);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_hWnd)
|
||||
Update(m_hWnd);
|
||||
updateScrollRange();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -229,7 +278,7 @@ VOID CCanvasWindow::OnHVScroll(WPARAM wParam, INT fnBar)
|
||||
{
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
si.nPos = HIWORD(wParam);
|
||||
si.nPos = (SHORT)HIWORD(wParam);
|
||||
break;
|
||||
case SB_LINELEFT:
|
||||
si.nPos -= 5;
|
||||
@@ -244,9 +293,9 @@ VOID CCanvasWindow::OnHVScroll(WPARAM wParam, INT fnBar)
|
||||
si.nPos += si.nPage;
|
||||
break;
|
||||
}
|
||||
si.nPos = max(min(si.nPos, si.nMax), si.nMin);
|
||||
SetScrollInfo(fnBar, &si);
|
||||
Update(m_hWnd);
|
||||
Invalidate(FALSE); // FIXME: Flicker
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnHScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
@@ -261,10 +310,21 @@ LRESULT CCanvasWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
|
||||
m_nMouseDownMsg = nMsg;
|
||||
BOOL bLeftButton = (nMsg == WM_LBUTTONDOWN);
|
||||
|
||||
if (nMsg == WM_MBUTTONDOWN)
|
||||
{
|
||||
m_ptOrig = pt;
|
||||
SetCapture();
|
||||
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
HITTEST hitSelection = SelectionHitTest(pt);
|
||||
if (hitSelection != HIT_NONE)
|
||||
{
|
||||
@@ -284,7 +344,7 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
|
||||
}
|
||||
else
|
||||
{
|
||||
canvasWindow.ClientToScreen(&pt);
|
||||
ClientToScreen(&pt);
|
||||
mainWindow.TrackPopupMenu(pt, 0);
|
||||
}
|
||||
return 0;
|
||||
@@ -297,14 +357,14 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
|
||||
{
|
||||
case TOOL_BEZIER:
|
||||
case TOOL_SHAPE:
|
||||
toolsModel.OnCancelDraw();
|
||||
canvasWindow.Invalidate();
|
||||
toolsModel.OnEndDraw(TRUE);
|
||||
Invalidate();
|
||||
break;
|
||||
|
||||
case TOOL_FREESEL:
|
||||
case TOOL_RECTSEL:
|
||||
toolsModel.OnFinishDraw();
|
||||
canvasWindow.Invalidate();
|
||||
toolsModel.OnEndDraw(FALSE);
|
||||
Invalidate();
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -337,45 +397,40 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return OnLRButtonDown(TRUE, nMsg, wParam, lParam, bHandled);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return OnLRButtonDown(FALSE, nMsg, wParam, lParam, bHandled);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnLRButtonDblClk(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
LRESULT CCanvasWindow::OnButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
CanvasToImage(pt);
|
||||
|
||||
m_drawing = FALSE;
|
||||
ReleaseCapture();
|
||||
::ReleaseCapture();
|
||||
m_nMouseDownMsg = 0;
|
||||
|
||||
toolsModel.OnButtonDown(bLeftButton, pt.x, pt.y, TRUE);
|
||||
toolsModel.OnButtonDown(nMsg == WM_LBUTTONDBLCLK, pt.x, pt.y, TRUE);
|
||||
toolsModel.resetTool();
|
||||
Invalidate(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnLButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return OnLRButtonDblClk(TRUE, nMsg, wParam, lParam, bHandled);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return OnLRButtonDblClk(FALSE, nMsg, wParam, lParam, bHandled);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
|
||||
if (m_nMouseDownMsg == WM_MBUTTONDOWN)
|
||||
{
|
||||
INT x = GetScrollPos(SB_HORZ) - (pt.x - m_ptOrig.x);
|
||||
INT y = GetScrollPos(SB_VERT) - (pt.y - m_ptOrig.y);
|
||||
SendMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, x), 0);
|
||||
SendMessage(WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, y), 0);
|
||||
m_ptOrig = pt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
CanvasToImage(pt);
|
||||
|
||||
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
|
||||
Invalidate();
|
||||
|
||||
if (m_hitSelection != HIT_NONE)
|
||||
{
|
||||
SelectionDragging(pt);
|
||||
@@ -384,14 +439,6 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
|
||||
if (!m_drawing || toolsModel.GetActiveTool() <= TOOL_AIRBRUSH)
|
||||
{
|
||||
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
|
||||
{
|
||||
Invalidate(FALSE);
|
||||
UpdateWindow();
|
||||
CanvasToImage(pt);
|
||||
drawZoomFrame(pt.x, pt.y);
|
||||
}
|
||||
|
||||
TRACKMOUSEEVENT tme = { sizeof(tme) };
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = m_hWnd;
|
||||
@@ -400,86 +447,19 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
|
||||
if (!m_drawing)
|
||||
{
|
||||
CString strCoord;
|
||||
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
|
||||
RECT rcImage;
|
||||
GetImageRect(rcImage);
|
||||
|
||||
CStringW strCoord;
|
||||
if (::PtInRect(&rcImage, pt))
|
||||
strCoord.Format(L"%ld, %ld", pt.x, pt.y);
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_drawing)
|
||||
{
|
||||
// values displayed in statusbar
|
||||
LONG xRel = pt.x - g_ptStart.x;
|
||||
LONG yRel = pt.y - g_ptStart.y;
|
||||
|
||||
switch (toolsModel.GetActiveTool())
|
||||
{
|
||||
// freesel, rectsel and text tools always show numbers limited to fit into image area
|
||||
case TOOL_FREESEL:
|
||||
case TOOL_RECTSEL:
|
||||
case TOOL_TEXT:
|
||||
if (xRel < 0)
|
||||
xRel = (pt.x < 0) ? -g_ptStart.x : xRel;
|
||||
else if (pt.x > imageModel.GetWidth())
|
||||
xRel = imageModel.GetWidth() - g_ptStart.x;
|
||||
if (yRel < 0)
|
||||
yRel = (pt.y < 0) ? -g_ptStart.y : yRel;
|
||||
else if (pt.y > imageModel.GetHeight())
|
||||
yRel = imageModel.GetHeight() - g_ptStart.y;
|
||||
break;
|
||||
|
||||
// while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14
|
||||
case TOOL_RUBBER:
|
||||
case TOOL_PEN:
|
||||
case TOOL_BRUSH:
|
||||
case TOOL_AIRBRUSH:
|
||||
case TOOL_SHAPE:
|
||||
{
|
||||
CString strCoord;
|
||||
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// rectsel and shape tools always show non-negative numbers when drawing
|
||||
if (toolsModel.GetActiveTool() == TOOL_RECTSEL || toolsModel.GetActiveTool() == TOOL_SHAPE)
|
||||
{
|
||||
if (xRel < 0)
|
||||
xRel = -xRel;
|
||||
if (yRel < 0)
|
||||
yRel = -yRel;
|
||||
}
|
||||
|
||||
if (wParam & MK_LBUTTON)
|
||||
{
|
||||
toolsModel.OnMouseMove(TRUE, pt.x, pt.y);
|
||||
Invalidate(FALSE);
|
||||
if ((toolsModel.GetActiveTool() >= TOOL_TEXT) || toolsModel.IsSelection())
|
||||
{
|
||||
CString strSize;
|
||||
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
strSize.Format(_T("%ld x %ld"), xRel, yRel);
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (wParam & MK_RBUTTON)
|
||||
{
|
||||
toolsModel.OnMouseMove(FALSE, pt.x, pt.y);
|
||||
Invalidate(FALSE);
|
||||
if (toolsModel.GetActiveTool() >= TOOL_TEXT)
|
||||
{
|
||||
CString strSize;
|
||||
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
strSize.Format(_T("%ld x %ld"), xRel, yRel);
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
}
|
||||
}
|
||||
toolsModel.DrawWithMouseTool(pt, wParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -531,9 +511,9 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
cyImage = min(MAXWORD, cyImage);
|
||||
|
||||
// Display new size
|
||||
CString strSize;
|
||||
strSize.Format(_T("%d x %d"), cxImage, cyImage);
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
CStringW strSize;
|
||||
strSize.Format(L"%d x %d", cxImage, cyImage);
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize);
|
||||
|
||||
// Dragging now... Fix the position...
|
||||
CRect rcResizing = { 0, 0, cxImage, cyImage };
|
||||
@@ -564,19 +544,22 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
LRESULT CCanvasWindow::OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
CanvasToImage(pt);
|
||||
|
||||
::ReleaseCapture();
|
||||
|
||||
BOOL bLeftButton = (m_nMouseDownMsg == WM_LBUTTONDOWN);
|
||||
m_nMouseDownMsg = 0;
|
||||
|
||||
if (m_drawing)
|
||||
{
|
||||
m_drawing = FALSE;
|
||||
toolsModel.OnButtonUp(bLeftButton, pt.x, pt.y);
|
||||
Invalidate(FALSE);
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L"");
|
||||
return 0;
|
||||
}
|
||||
else if (m_hitSelection != HIT_NONE && bLeftButton)
|
||||
@@ -627,21 +610,11 @@ LRESULT CCanvasWindow::OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam,
|
||||
|
||||
m_hitCanvasSizeBox = HIT_NONE;
|
||||
toolsModel.resetTool(); // resets the point-buffer of the polygon and bezier functions
|
||||
Update(NULL);
|
||||
updateScrollRange();
|
||||
Invalidate(TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return OnLRButtonUp(TRUE, nMsg, wParam, lParam, bHandled);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return OnLRButtonUp(FALSE, nMsg, wParam, lParam, bHandled);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (CWaitCursor::IsWaiting())
|
||||
@@ -650,6 +623,12 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_nMouseDownMsg == WM_MBUTTONDOWN)
|
||||
{
|
||||
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
POINT pt;
|
||||
::GetCursorPos(&pt);
|
||||
ScreenToClient(&pt);
|
||||
@@ -667,7 +646,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
if (hitSelection != HIT_NONE)
|
||||
{
|
||||
if (!setCursorOnSizeBox(hitSelection))
|
||||
::SetCursor(::LoadCursor(NULL, IDC_SIZEALL));
|
||||
::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_SIZEALL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -680,22 +659,22 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
switch (toolsModel.GetActiveTool())
|
||||
{
|
||||
case TOOL_FILL:
|
||||
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_FILL)));
|
||||
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_FILL)));
|
||||
break;
|
||||
case TOOL_COLOR:
|
||||
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_COLOR)));
|
||||
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_COLOR)));
|
||||
break;
|
||||
case TOOL_ZOOM:
|
||||
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_ZOOM)));
|
||||
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_ZOOM)));
|
||||
break;
|
||||
case TOOL_PEN:
|
||||
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_PEN)));
|
||||
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_PEN)));
|
||||
break;
|
||||
case TOOL_AIRBRUSH:
|
||||
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_AIRBRUSH)));
|
||||
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_AIRBRUSH)));
|
||||
break;
|
||||
default:
|
||||
::SetCursor(::LoadCursor(NULL, IDC_CROSS));
|
||||
::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_CROSS));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -712,6 +691,7 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||
{
|
||||
// Cancel dragging
|
||||
::ReleaseCapture();
|
||||
m_nMouseDownMsg = 0;
|
||||
m_hitCanvasSizeBox = HIT_NONE;
|
||||
::SetRectEmpty(&m_rcResizing);
|
||||
Invalidate(TRUE);
|
||||
@@ -731,12 +711,12 @@ LRESULT CCanvasWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
|
||||
LRESULT CCanvasWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return ::SendMessage(GetParent(), nMsg, wParam, lParam);
|
||||
return ::SendMessageW(GetParent(), nMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CCanvasWindow::OnCaptureChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L"");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -763,13 +743,13 @@ VOID CCanvasWindow::cancelDrawing()
|
||||
selectionModel.ClearMaskImage();
|
||||
m_hitSelection = HIT_NONE;
|
||||
m_drawing = FALSE;
|
||||
toolsModel.OnCancelDraw();
|
||||
toolsModel.OnEndDraw(TRUE);
|
||||
Invalidate(FALSE);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::finishDrawing()
|
||||
{
|
||||
toolsModel.OnFinishDraw();
|
||||
toolsModel.OnEndDraw(FALSE);
|
||||
m_drawing = FALSE;
|
||||
Invalidate(FALSE);
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
class CCanvasWindow : public CWindowImpl<CCanvasWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("ReactOSPaintCanvas"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
|
||||
DECLARE_WND_CLASS_EX(L"ReactOSPaintCanvas", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
|
||||
COLOR_APPWORKSPACE)
|
||||
|
||||
BEGIN_MSG_MAP(CCanvasWindow)
|
||||
@@ -20,13 +20,15 @@ public:
|
||||
MESSAGE_HANDLER(WM_HSCROLL, OnHScroll)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, OnVScroll)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnRButtonDblClk)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnButtonDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnButtonDown)
|
||||
MESSAGE_HANDLER(WM_MBUTTONDOWN, OnButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnButtonDblClk)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnButtonDblClk)
|
||||
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||
MESSAGE_HANDLER(WM_RBUTTONUP, OnRButtonUp)
|
||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnButtonUp)
|
||||
MESSAGE_HANDLER(WM_RBUTTONUP, OnButtonUp)
|
||||
MESSAGE_HANDLER(WM_MBUTTONUP, OnButtonUp)
|
||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel)
|
||||
MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode)
|
||||
@@ -42,7 +44,8 @@ public:
|
||||
|
||||
VOID cancelDrawing();
|
||||
VOID finishDrawing();
|
||||
VOID Update(HWND hwndFrom);
|
||||
VOID updateScrollRange();
|
||||
VOID updateScrollPos(INT x = 0, INT y = 0);
|
||||
|
||||
VOID ImageToCanvas(POINT& pt);
|
||||
VOID ImageToCanvas(RECT& rc);
|
||||
@@ -50,6 +53,8 @@ public:
|
||||
VOID CanvasToImage(RECT& rc, BOOL bZoomed = FALSE);
|
||||
VOID GetImageRect(RECT& rc);
|
||||
VOID MoveSelection(INT xDelta, INT yDelta);
|
||||
VOID getNewZoomRect(CRect& rcView, INT newZoom, CPoint ptTarget);
|
||||
VOID zoomTo(INT newZoom, LONG left = 0, LONG top = 0);
|
||||
|
||||
protected:
|
||||
HITTEST m_hitSelection;
|
||||
@@ -62,7 +67,6 @@ protected:
|
||||
RECT GetBaseRect();
|
||||
VOID DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint);
|
||||
VOID OnHVScroll(WPARAM wParam, INT fnBar);
|
||||
VOID drawZoomFrame(INT mouseX, INT mouseY);
|
||||
|
||||
HITTEST SelectionHitTest(POINT ptImage);
|
||||
VOID StartSelectionDrag(HITTEST hit, POINT ptImage);
|
||||
@@ -74,14 +78,8 @@ protected:
|
||||
LRESULT OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnEraseBkgnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
@@ -89,7 +87,8 @@ protected:
|
||||
LRESULT OnCtlColorEdit(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnPaletteModelColorChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
|
||||
LRESULT OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLRButtonDblClk(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
UINT m_nMouseDownMsg = 0;
|
||||
LRESULT OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
};
|
||||
|
@@ -43,7 +43,7 @@ enum HITTEST // hit
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
BOOL zoomTo(int newZoom, int mouseX, int mouseY);
|
||||
void ShowOutOfMemory(void);
|
||||
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
|
||||
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);
|
||||
|
||||
|
@@ -113,22 +113,21 @@ LRESULT CAttributesDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam,
|
||||
|
||||
if (g_isAFile)
|
||||
{
|
||||
TCHAR date[100];
|
||||
TCHAR temp[100];
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date));
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp));
|
||||
_tcscat(date, _T(" "));
|
||||
_tcscat(date, temp);
|
||||
CString strSize;
|
||||
WCHAR date[100], temp[100];
|
||||
GetDateFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date));
|
||||
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp));
|
||||
StringCchCatW(date, _countof(date), L" ");
|
||||
StringCchCatW(date, _countof(date), temp);
|
||||
CStringW strSize;
|
||||
strSize.Format(IDS_FILESIZE, g_fileSize);
|
||||
SetDlgItemText(IDD_ATTRIBUTESTEXT6, date);
|
||||
SetDlgItemText(IDD_ATTRIBUTESTEXT7, strSize);
|
||||
}
|
||||
|
||||
CString strUnit;
|
||||
CStringW strUnit;
|
||||
GetDlgItemText(IDD_ATTRIBUTESTEXT8, strUnit);
|
||||
|
||||
CString strRes;
|
||||
CStringW strRes;
|
||||
if (strUnit == L"dpi")
|
||||
strRes.Format(IDS_PRINTRES, ROUND(g_xDpi), ROUND(g_yDpi));
|
||||
else
|
||||
@@ -173,10 +172,10 @@ LRESULT CAttributesDialog::OnRadioButton1(WORD wNotifyCode, WORD wID, HWND hWndC
|
||||
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1) != BST_CHECKED)
|
||||
return 0;
|
||||
|
||||
CString strNum;
|
||||
strNum.Format(_T("%.3lf"), newWidth / g_xDpi);
|
||||
CStringW strNum;
|
||||
strNum.Format(L"%.3lf", newWidth / g_xDpi);
|
||||
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
|
||||
strNum.Format(_T("%.3lf"), newHeight / g_yDpi);
|
||||
strNum.Format(L"%.3lf", newHeight / g_yDpi);
|
||||
SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum);
|
||||
return 0;
|
||||
}
|
||||
@@ -186,10 +185,10 @@ LRESULT CAttributesDialog::OnRadioButton2(WORD wNotifyCode, WORD wID, HWND hWndC
|
||||
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2) != BST_CHECKED)
|
||||
return 0;
|
||||
|
||||
CString strNum;
|
||||
strNum.Format(_T("%.3lf"), newWidth / PpcmFromDpi(g_xDpi));
|
||||
CStringW strNum;
|
||||
strNum.Format(L"%.3lf", newWidth / PpcmFromDpi(g_xDpi));
|
||||
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
|
||||
strNum.Format(_T("%.3lf"), newHeight / PpcmFromDpi(g_yDpi));
|
||||
strNum.Format(L"%.3lf", newHeight / PpcmFromDpi(g_yDpi));
|
||||
SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum);
|
||||
return 0;
|
||||
}
|
||||
@@ -208,21 +207,21 @@ LRESULT CAttributesDialog::OnEdit1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
|
||||
{
|
||||
if (Edit_GetModify(hWndCtl))
|
||||
{
|
||||
TCHAR tempS[100];
|
||||
WCHAR tempS[100];
|
||||
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1))
|
||||
{
|
||||
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
|
||||
newWidth = max(1, (int) (_tcstod(tempS, NULL) * g_xDpi));
|
||||
newWidth = max(1, (int)(wcstod(tempS, NULL) * g_xDpi));
|
||||
}
|
||||
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2))
|
||||
{
|
||||
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
|
||||
newWidth = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_xDpi)));
|
||||
newWidth = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_xDpi)));
|
||||
}
|
||||
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3))
|
||||
{
|
||||
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
|
||||
newWidth = max(1, _tstoi(tempS));
|
||||
newWidth = max(1, _wtoi(tempS));
|
||||
}
|
||||
Edit_SetModify(hWndCtl, FALSE);
|
||||
}
|
||||
@@ -233,21 +232,21 @@ LRESULT CAttributesDialog::OnEdit2(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
|
||||
{
|
||||
if (Edit_GetModify(hWndCtl))
|
||||
{
|
||||
TCHAR tempS[100];
|
||||
WCHAR tempS[100];
|
||||
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1))
|
||||
{
|
||||
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
|
||||
newHeight = max(1, (int) (_tcstod(tempS, NULL) * g_yDpi));
|
||||
newHeight = max(1, (int)(wcstod(tempS, NULL) * g_yDpi));
|
||||
}
|
||||
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2))
|
||||
{
|
||||
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
|
||||
newHeight = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_yDpi)));
|
||||
newHeight = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_yDpi)));
|
||||
}
|
||||
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3))
|
||||
{
|
||||
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
|
||||
newHeight = max(1, _tstoi(tempS));
|
||||
newHeight = max(1, _wtoi(tempS));
|
||||
}
|
||||
Edit_SetModify(hWndCtl, FALSE);
|
||||
}
|
||||
@@ -273,9 +272,7 @@ LRESULT CStretchSkewDialog::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||
|
||||
LRESULT CStretchSkewDialog::OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
||||
{
|
||||
CString strrcIntNumbers;
|
||||
CString strrcPercentage;
|
||||
CString strrcAngle;
|
||||
CStringW strrcIntNumbers, strrcPercentage, strrcAngle;
|
||||
BOOL tr1, tr2, tr3, tr4;
|
||||
|
||||
strrcIntNumbers.LoadString(g_hinstExe, IDS_INTNUMBERS);
|
||||
@@ -305,11 +302,11 @@ LRESULT CStretchSkewDialog::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, B
|
||||
}
|
||||
|
||||
static INT CALLBACK
|
||||
EnumFontFamProc(ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, INT FontType, LPARAM lParam)
|
||||
EnumFontFamProc(ENUMLOGFONTW *lpelf, NEWTEXTMETRICW *lpntm, INT FontType, LPARAM lParam)
|
||||
{
|
||||
CSimpleArray<CString>& arrFontNames = *reinterpret_cast<CSimpleArray<CString>*>(lParam);
|
||||
LPTSTR name = lpelf->elfLogFont.lfFaceName;
|
||||
if (name[0] == TEXT('@')) // Vertical fonts
|
||||
CSimpleArray<CStringW>& arrFontNames = *reinterpret_cast<CSimpleArray<CStringW>*>(lParam);
|
||||
LPWSTR name = lpelf->elfLogFont.lfFaceName;
|
||||
if (name[0] == L'@') // Vertical fonts
|
||||
return TRUE;
|
||||
|
||||
for (INT i = 0; i < arrFontNames.GetSize(); ++i)
|
||||
@@ -331,24 +328,24 @@ CFontsDialog::CFontsDialog()
|
||||
void CFontsDialog::InitFontNames()
|
||||
{
|
||||
// List the fonts
|
||||
CSimpleArray<CString> arrFontNames;
|
||||
CSimpleArray<CStringW> arrFontNames;
|
||||
HDC hDC = CreateCompatibleDC(NULL);
|
||||
if (hDC)
|
||||
{
|
||||
EnumFontFamilies(hDC, NULL, (FONTENUMPROC)EnumFontFamProc,
|
||||
reinterpret_cast<LPARAM>(&arrFontNames));
|
||||
DeleteDC(hDC);
|
||||
EnumFontFamiliesW(hDC, NULL, (FONTENUMPROCW)EnumFontFamProc,
|
||||
reinterpret_cast<LPARAM>(&arrFontNames));
|
||||
::DeleteDC(hDC);
|
||||
}
|
||||
|
||||
// Actually add them to the combobox
|
||||
HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
|
||||
SendMessage(hwndNames, CB_RESETCONTENT, 0, 0);
|
||||
::SendMessageW(hwndNames, CB_RESETCONTENT, 0, 0);
|
||||
for (INT i = 0; i < arrFontNames.GetSize(); ++i)
|
||||
{
|
||||
ComboBox_AddString(hwndNames, arrFontNames[i]);
|
||||
}
|
||||
|
||||
::SetWindowText(hwndNames, registrySettings.strFontName);
|
||||
::SetWindowTextW(hwndNames, registrySettings.strFontName);
|
||||
}
|
||||
|
||||
void CFontsDialog::InitFontSizes()
|
||||
@@ -361,10 +358,10 @@ void CFontsDialog::InitFontSizes()
|
||||
HWND hwndSizes = GetDlgItem(IDD_FONTSSIZES);
|
||||
ComboBox_ResetContent(hwndSizes);
|
||||
|
||||
TCHAR szText[16];
|
||||
WCHAR szText[16];
|
||||
for (UINT i = 0; i < _countof(s_sizes); ++i)
|
||||
{
|
||||
wsprintf(szText, TEXT("%d"), s_sizes[i]);
|
||||
StringCchPrintfW(szText, _countof(szText), L"%d", s_sizes[i]);
|
||||
INT iItem = ComboBox_AddString(hwndSizes, szText);
|
||||
if (s_sizes[i] == (INT)registrySettings.PointSize)
|
||||
ComboBox_SetCurSel(hwndSizes, iItem);
|
||||
@@ -372,27 +369,27 @@ void CFontsDialog::InitFontSizes()
|
||||
|
||||
if (ComboBox_GetCurSel(hwndSizes) == CB_ERR)
|
||||
{
|
||||
wsprintf(szText, TEXT("%d"), (INT)registrySettings.PointSize);
|
||||
::SetWindowText(hwndSizes, szText);
|
||||
StringCchPrintfW(szText, _countof(szText), L"%d", (INT)registrySettings.PointSize);
|
||||
::SetWindowTextW(hwndSizes, szText);
|
||||
}
|
||||
}
|
||||
|
||||
void CFontsDialog::InitToolbar()
|
||||
{
|
||||
HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
|
||||
SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||
SendMessage(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
|
||||
SendMessage(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20));
|
||||
::SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||
::SendMessageW(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
|
||||
::SendMessageW(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20));
|
||||
|
||||
TBADDBITMAP AddBitmap;
|
||||
AddBitmap.hInst = g_hinstExe;
|
||||
AddBitmap.nID = IDB_FONTSTOOLBAR;
|
||||
SendMessage(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap);
|
||||
::SendMessageW(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap);
|
||||
|
||||
HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCE(IDB_FONTSTOOLBAR),
|
||||
HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCEW(IDB_FONTSTOOLBAR),
|
||||
16, 8, RGB(255, 0, 255), IMAGE_BITMAP,
|
||||
LR_CREATEDIBSECTION);
|
||||
SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl);
|
||||
::SendMessageW(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl);
|
||||
|
||||
TBBUTTON buttons[] =
|
||||
{
|
||||
@@ -401,11 +398,11 @@ void CFontsDialog::InitToolbar()
|
||||
{ 2, IDM_UNDERLINE, TBSTATE_ENABLED, TBSTYLE_CHECK },
|
||||
{ 3, IDM_VERTICAL, 0, TBSTYLE_CHECK }, // TODO:
|
||||
};
|
||||
SendMessage(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons);
|
||||
::SendMessageW(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons);
|
||||
|
||||
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold);
|
||||
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic);
|
||||
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline);
|
||||
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold);
|
||||
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic);
|
||||
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline);
|
||||
}
|
||||
|
||||
LRESULT CFontsDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
@@ -441,7 +438,7 @@ void CFontsDialog::OnFontName(UINT codeNotify)
|
||||
HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
|
||||
INT iItem = CB_ERR;
|
||||
UINT cch;
|
||||
TCHAR szText[LF_FACESIZE];
|
||||
WCHAR szText[LF_FACESIZE];
|
||||
|
||||
switch (codeNotify)
|
||||
{
|
||||
@@ -449,9 +446,7 @@ void CFontsDialog::OnFontName(UINT codeNotify)
|
||||
iItem = ComboBox_GetCurSel(hwndNames);
|
||||
cch = ComboBox_GetLBTextLen(hwndNames, iItem);
|
||||
if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
|
||||
{
|
||||
ComboBox_GetLBText(hwndNames, iItem, szText);
|
||||
}
|
||||
break;
|
||||
|
||||
case CBN_EDITCHANGE:
|
||||
@@ -482,13 +477,13 @@ void CFontsDialog::OnFontSize(UINT codeNotify)
|
||||
if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
|
||||
{
|
||||
ComboBox_GetLBText(hwndSizes, iItem, szText);
|
||||
PointSize = _ttoi(szText);
|
||||
PointSize = _wtoi(szText);
|
||||
}
|
||||
break;
|
||||
|
||||
case CBN_EDITCHANGE:
|
||||
::GetWindowText(hwndSizes, szText, _countof(szText));
|
||||
PointSize = _ttoi(szText);
|
||||
::GetWindowTextW(hwndSizes, szText, _countof(szText));
|
||||
PointSize = _wtoi(szText);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -504,7 +499,7 @@ LRESULT CFontsDialog::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
|
||||
UINT id = LOWORD(wParam);
|
||||
UINT codeNotify = HIWORD(wParam);
|
||||
HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
|
||||
BOOL bChecked = ::SendMessage(hwndToolbar, TB_ISBUTTONCHECKED, id, 0);
|
||||
BOOL bChecked = (BOOL)::SendMessageW(hwndToolbar, TB_ISBUTTONCHECKED, id, 0);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
@@ -548,14 +543,14 @@ LRESULT CFontsDialog::OnNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
NMHDR *pnmhdr = reinterpret_cast<NMHDR *>(lParam);
|
||||
if (pnmhdr->code == TTN_NEEDTEXT)
|
||||
{
|
||||
LPTOOLTIPTEXT pToolTip = reinterpret_cast<LPTOOLTIPTEXT>(lParam);
|
||||
LPTOOLTIPTEXTW pToolTip = reinterpret_cast<LPTOOLTIPTEXTW>(lParam);
|
||||
pToolTip->hinst = g_hinstExe;
|
||||
switch (pnmhdr->idFrom)
|
||||
{
|
||||
case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCE(IDS_BOLD); break;
|
||||
case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCE(IDS_ITALIC); break;
|
||||
case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCE(IDS_UNDERLINE); break;
|
||||
case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCE(IDS_VERTICAL); break;
|
||||
case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_BOLD); break;
|
||||
case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_ITALIC); break;
|
||||
case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_UNDERLINE); break;
|
||||
case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_VERTICAL); break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -604,29 +599,29 @@ LRESULT CFontsDialog::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||
if (pDrawItem->itemID == (UINT)-1)
|
||||
return TRUE;
|
||||
|
||||
SetBkMode(pDrawItem->hDC, TRANSPARENT);
|
||||
::SetBkMode(pDrawItem->hDC, TRANSPARENT);
|
||||
|
||||
HWND hwndItem = pDrawItem->hwndItem;
|
||||
RECT rcItem = pDrawItem->rcItem;
|
||||
if (pDrawItem->itemState & ODS_SELECTED)
|
||||
{
|
||||
FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
|
||||
SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
|
||||
::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
}
|
||||
else
|
||||
{
|
||||
FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW));
|
||||
SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT));
|
||||
::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW));
|
||||
::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT));
|
||||
}
|
||||
|
||||
TCHAR szText[LF_FACESIZE];
|
||||
WCHAR szText[LF_FACESIZE];
|
||||
if ((UINT)ComboBox_GetLBTextLen(hwndItem, pDrawItem->itemID) < _countof(szText))
|
||||
{
|
||||
szText[0] = 0;
|
||||
ComboBox_GetLBText(hwndItem, pDrawItem->itemID, szText);
|
||||
|
||||
rcItem.left += 24;
|
||||
DrawText(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||
::DrawTextW(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||
}
|
||||
|
||||
if (pDrawItem->itemState & ODS_FOCUS)
|
||||
|
@@ -87,7 +87,7 @@ CreateColorDIB(int width, int height, COLORREF rgb)
|
||||
HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy)
|
||||
{
|
||||
BITMAP bm;
|
||||
if (!GetObject(hbm, sizeof(bm), &bm))
|
||||
if (!::GetObjectW(hbm, sizeof(bm), &bm))
|
||||
return NULL;
|
||||
|
||||
if (cx == 0 || cy == 0)
|
||||
@@ -96,19 +96,19 @@ HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy)
|
||||
cy = bm.bmHeight;
|
||||
}
|
||||
|
||||
HBITMAP hbmNew = CreateBitmap(cx, cy, 1, 1, NULL);
|
||||
HBITMAP hbmNew = ::CreateBitmap(cx, cy, 1, 1, NULL);
|
||||
if (!hbmNew)
|
||||
return NULL;
|
||||
|
||||
HDC hdc1 = CreateCompatibleDC(NULL);
|
||||
HDC hdc2 = CreateCompatibleDC(NULL);
|
||||
HGDIOBJ hbm1Old = SelectObject(hdc1, hbm);
|
||||
HGDIOBJ hbm2Old = SelectObject(hdc2, hbmNew);
|
||||
StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
|
||||
SelectObject(hdc1, hbm1Old);
|
||||
SelectObject(hdc2, hbm2Old);
|
||||
DeleteDC(hdc1);
|
||||
DeleteDC(hdc2);
|
||||
HDC hdc1 = ::CreateCompatibleDC(NULL);
|
||||
HDC hdc2 = ::CreateCompatibleDC(NULL);
|
||||
HGDIOBJ hbm1Old = ::SelectObject(hdc1, hbm);
|
||||
HGDIOBJ hbm2Old = ::SelectObject(hdc2, hbmNew);
|
||||
::StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
|
||||
::SelectObject(hdc1, hbm1Old);
|
||||
::SelectObject(hdc2, hbm2Old);
|
||||
::DeleteDC(hdc1);
|
||||
::DeleteDC(hdc2);
|
||||
return hbmNew;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ HBITMAP CachedBufferDIB(HBITMAP hbm, int minimalWidth, int minimalHeight)
|
||||
minimalHeight = 1;
|
||||
|
||||
BITMAP bm;
|
||||
if (!GetObject(hbm, sizeof(bm), &bm))
|
||||
if (!GetObjectW(hbm, sizeof(bm), &bm))
|
||||
hbm = NULL;
|
||||
|
||||
if (hbm && minimalWidth <= bm.bmWidth && minimalHeight <= bm.bmHeight)
|
||||
@@ -136,7 +136,7 @@ int
|
||||
GetDIBWidth(HBITMAP hBitmap)
|
||||
{
|
||||
BITMAP bm;
|
||||
GetObject(hBitmap, sizeof(BITMAP), &bm);
|
||||
::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
|
||||
return bm.bmWidth;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ int
|
||||
GetDIBHeight(HBITMAP hBitmap)
|
||||
{
|
||||
BITMAP bm;
|
||||
GetObject(hBitmap, sizeof(BITMAP), &bm);
|
||||
::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
|
||||
return bm.bmHeight;
|
||||
}
|
||||
|
||||
@@ -211,8 +211,8 @@ void SetFileInfo(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isAFile)
|
||||
}
|
||||
|
||||
// set title
|
||||
CString strTitle;
|
||||
strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName));
|
||||
CStringW strTitle;
|
||||
strTitle.Format(IDS_WINDOWTITLE, PathFindFileNameW(g_szFileName));
|
||||
mainWindow.SetWindowText(strTitle);
|
||||
|
||||
// update file info and recent
|
||||
@@ -228,11 +228,14 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
|
||||
COLORREF white = RGB(255, 255, 255);
|
||||
HBITMAP hBitmap = CreateColorDIB(registrySettings.BMPWidth, registrySettings.BMPHeight, white);
|
||||
if (hBitmap == NULL)
|
||||
{
|
||||
ShowOutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HDC hScreenDC = ::GetDC(NULL);
|
||||
g_xDpi = ::GetDeviceCaps(hScreenDC, LOGPIXELSX);
|
||||
g_yDpi = ::GetDeviceCaps(hScreenDC, LOGPIXELSY);
|
||||
g_xDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSX);
|
||||
g_yDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSY);
|
||||
::ReleaseDC(NULL, hScreenDC);
|
||||
|
||||
return SetBitmapAndInfo(hBitmap, name, pFound, isFile);
|
||||
@@ -241,6 +244,7 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
|
||||
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
|
||||
{
|
||||
// update image
|
||||
canvasWindow.updateScrollPos();
|
||||
imageModel.PushImageForUndo(hBitmap);
|
||||
imageModel.ClearHistory();
|
||||
|
||||
@@ -254,7 +258,7 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
|
||||
CWaitCursor waitCursor;
|
||||
|
||||
// find the file
|
||||
WIN32_FIND_DATA find;
|
||||
WIN32_FIND_DATAW find;
|
||||
HANDLE hFind = ::FindFirstFileW(name, &find);
|
||||
if (hFind == INVALID_HANDLE_VALUE) // does not exist
|
||||
{
|
||||
@@ -274,8 +278,14 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
|
||||
CImageDx img;
|
||||
float xDpi = 0, yDpi = 0;
|
||||
HRESULT hr = img.LoadDx(name, &xDpi, &yDpi);
|
||||
if (FAILED(hr) && fIsMainFile)
|
||||
{
|
||||
imageModel.ClearHistory();
|
||||
hr = img.LoadDx(name, &xDpi, &yDpi);
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ATLTRACE("hr: 0x%08lX\n", hr);
|
||||
ShowError(IDS_LOADERRORTEXT, name);
|
||||
return NULL;
|
||||
}
|
||||
@@ -287,8 +297,8 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
|
||||
if (xDpi <= 0 || yDpi <= 0)
|
||||
{
|
||||
HDC hDC = ::GetDC(NULL);
|
||||
xDpi = ::GetDeviceCaps(hDC, LOGPIXELSX);
|
||||
yDpi = ::GetDeviceCaps(hDC, LOGPIXELSY);
|
||||
xDpi = (float)::GetDeviceCaps(hDC, LOGPIXELSX);
|
||||
yDpi = (float)::GetDeviceCaps(hDC, LOGPIXELSY);
|
||||
::ReleaseDC(NULL, hDC);
|
||||
}
|
||||
|
||||
@@ -348,7 +358,7 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
|
||||
const double eTan = tan(abs(nDegree) * M_PI / 180);
|
||||
|
||||
BITMAP bm;
|
||||
GetObjectW(hbm, sizeof(bm), &bm);
|
||||
::GetObjectW(hbm, sizeof(bm), &bm);
|
||||
INT cx = bm.bmWidth, cy = bm.bmHeight, dx = 0, dy = 0;
|
||||
if (bVertical)
|
||||
dy = INT(cx * eTan);
|
||||
@@ -374,9 +384,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
|
||||
{
|
||||
INT delta = INT(x * eTan);
|
||||
if (nDegree > 0)
|
||||
BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY);
|
||||
::BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY);
|
||||
else
|
||||
BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY);
|
||||
::BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -385,9 +395,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
|
||||
{
|
||||
INT delta = INT(y * eTan);
|
||||
if (nDegree > 0)
|
||||
BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY);
|
||||
::BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY);
|
||||
else
|
||||
BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY);
|
||||
::BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,7 +416,7 @@ HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap)
|
||||
CWaitCursor waitCursor;
|
||||
|
||||
BITMAP bm;
|
||||
if (!GetObject(hBitmap, sizeof(BITMAP), &bm))
|
||||
if (!GetObjectW(hBitmap, sizeof(BITMAP), &bm))
|
||||
return NULL;
|
||||
|
||||
BITMAPINFODX bmi;
|
||||
@@ -590,7 +600,7 @@ HBITMAP ConvertToBlackAndWhite(HBITMAP hbm)
|
||||
CWaitCursor waitCursor;
|
||||
|
||||
BITMAP bm;
|
||||
if (!::GetObject(hbm, sizeof(bm), &bm))
|
||||
if (!::GetObjectW(hbm, sizeof(bm), &bm))
|
||||
return NULL;
|
||||
|
||||
BITMAPINFOEX bmi;
|
||||
|
@@ -253,38 +253,37 @@ RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
|
||||
}
|
||||
|
||||
void
|
||||
Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style)
|
||||
Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCWSTR lpchText, HFONT font, LONG style)
|
||||
{
|
||||
INT iSaveDC = SaveDC(hdc); // We will modify the clipping region. Save now.
|
||||
INT iSaveDC = ::SaveDC(hdc); // We will modify the clipping region. Save now.
|
||||
|
||||
RECT rc;
|
||||
SetRect(&rc, x1, y1, x2, y2);
|
||||
::SetRect(&rc, x1, y1, x2, y2);
|
||||
|
||||
if (style == 0) // Transparent
|
||||
{
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
GetBkColor(hdc);
|
||||
::SetBkMode(hdc, TRANSPARENT);
|
||||
}
|
||||
else // Opaque
|
||||
{
|
||||
SetBkMode(hdc, OPAQUE);
|
||||
SetBkColor(hdc, bg);
|
||||
::SetBkMode(hdc, OPAQUE);
|
||||
::SetBkColor(hdc, bg);
|
||||
|
||||
HBRUSH hbr = CreateSolidBrush(bg);
|
||||
FillRect(hdc, &rc, hbr); // Fill the background
|
||||
DeleteObject(hbr);
|
||||
HBRUSH hbr = ::CreateSolidBrush(bg);
|
||||
::FillRect(hdc, &rc, hbr); // Fill the background
|
||||
::DeleteObject(hbr);
|
||||
}
|
||||
|
||||
IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
|
||||
|
||||
HGDIOBJ hFontOld = SelectObject(hdc, font);
|
||||
SetTextColor(hdc, fg);
|
||||
HGDIOBJ hFontOld = ::SelectObject(hdc, font);
|
||||
::SetTextColor(hdc, fg);
|
||||
const UINT uFormat = DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP |
|
||||
DT_EXPANDTABS | DT_WORDBREAK;
|
||||
DrawText(hdc, lpchText, -1, &rc, uFormat);
|
||||
SelectObject(hdc, hFontOld);
|
||||
::DrawTextW(hdc, lpchText, -1, &rc, uFormat);
|
||||
::SelectObject(hdc, hFontOld);
|
||||
|
||||
RestoreDC(hdc, iSaveDC); // Restore
|
||||
::RestoreDC(hdc, iSaveDC); // Restore
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@@ -31,7 +31,7 @@ void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG sty
|
||||
|
||||
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
|
||||
|
||||
void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style);
|
||||
void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCWSTR lpchText, HFONT font, LONG style);
|
||||
|
||||
BOOL
|
||||
ColorKeyedMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
|
||||
|
@@ -22,8 +22,8 @@ HWND CFullscreenWindow::DoCreate()
|
||||
|
||||
LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
|
||||
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
|
||||
SendMessage(WM_SETICON, ICON_BIG, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
|
||||
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
class CFullscreenWindow : public CWindowImpl<CFullscreenWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("FullscreenWindow"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
|
||||
DECLARE_WND_CLASS_EX(L"FullscreenWindow", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
|
||||
COLOR_BACKGROUND)
|
||||
|
||||
BEGIN_MSG_MAP(CFullscreenWindow)
|
||||
|
@@ -11,11 +11,9 @@
|
||||
|
||||
extern BOOL g_askBeforeEnlarging;
|
||||
|
||||
extern POINT g_ptStart, g_ptEnd;
|
||||
|
||||
extern HINSTANCE g_hinstExe;
|
||||
|
||||
extern TCHAR g_szFileName[MAX_LONG_PATH];
|
||||
extern WCHAR g_szFileName[MAX_LONG_PATH];
|
||||
extern BOOL g_isAFile;
|
||||
extern BOOL g_imageSaved;
|
||||
extern BOOL g_showGrid;
|
||||
|
@@ -15,9 +15,13 @@ ImageModel imageModel;
|
||||
void ImageModel::NotifyImageChanged()
|
||||
{
|
||||
if (canvasWindow.IsWindow())
|
||||
canvasWindow.Invalidate(FALSE);
|
||||
{
|
||||
canvasWindow.updateScrollRange();
|
||||
canvasWindow.Invalidate();
|
||||
}
|
||||
|
||||
if (miniature.IsWindow())
|
||||
miniature.Invalidate(FALSE);
|
||||
miniature.Invalidate();
|
||||
}
|
||||
|
||||
ImageModel::ImageModel()
|
||||
@@ -85,31 +89,46 @@ void ImageModel::Redo()
|
||||
NotifyImageChanged();
|
||||
}
|
||||
|
||||
void ImageModel::ResetToPrevious()
|
||||
{
|
||||
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
|
||||
|
||||
// Revert current item with previous item
|
||||
::DeleteObject(m_hBms[m_currInd]);
|
||||
m_hBms[m_currInd] = CopyDIBImage(m_hBms[(m_currInd + HISTORYSIZE - 1) % HISTORYSIZE]);
|
||||
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
|
||||
|
||||
NotifyImageChanged();
|
||||
}
|
||||
|
||||
void ImageModel::ClearHistory()
|
||||
{
|
||||
for (int i = 0; i < HISTORYSIZE; ++i)
|
||||
{
|
||||
if (m_hBms[i] && i != m_currInd)
|
||||
{
|
||||
::DeleteObject(m_hBms[i]);
|
||||
m_hBms[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m_undoSteps = 0;
|
||||
m_redoSteps = 0;
|
||||
}
|
||||
|
||||
void ImageModel::PushImageForUndo()
|
||||
{
|
||||
HBITMAP hbm = CopyBitmap();
|
||||
if (hbm == NULL)
|
||||
{
|
||||
ShowOutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
||||
PushImageForUndo(hbm);
|
||||
}
|
||||
|
||||
void ImageModel::PushImageForUndo(HBITMAP hbm)
|
||||
{
|
||||
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
|
||||
|
||||
if (hbm == NULL)
|
||||
{
|
||||
ShowOutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
||||
// Go to the next item with an HBITMAP or current item
|
||||
::DeleteObject(m_hBms[(m_currInd + 1) % HISTORYSIZE]);
|
||||
m_hBms[(m_currInd + 1) % HISTORYSIZE] = (hbm ? hbm : CopyDIBImage(m_hBms[m_currInd]));
|
||||
m_hBms[(m_currInd + 1) % HISTORYSIZE] = hbm;
|
||||
m_currInd = (m_currInd + 1) % HISTORYSIZE;
|
||||
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
|
||||
|
||||
@@ -132,7 +151,10 @@ void ImageModel::Crop(int nWidth, int nHeight, int nOffsetX, int nOffsetY)
|
||||
// Create an HBITMAP
|
||||
HBITMAP hbmCropped = CreateDIBWithProperties(nWidth, nHeight);
|
||||
if (!hbmCropped)
|
||||
{
|
||||
ShowOutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
||||
// Select the HBITMAP by memory DC
|
||||
HDC hdcMem = ::CreateCompatibleDC(m_hDrawingDC);
|
||||
@@ -157,7 +179,7 @@ void ImageModel::Crop(int nWidth, int nHeight, int nOffsetX, int nOffsetY)
|
||||
NotifyImageChanged();
|
||||
}
|
||||
|
||||
void ImageModel::SaveImage(LPCTSTR lpFileName)
|
||||
void ImageModel::SaveImage(LPCWSTR lpFileName)
|
||||
{
|
||||
SaveDIBToFile(m_hBms[m_currInd], lpFileName, TRUE);
|
||||
}
|
||||
@@ -238,15 +260,14 @@ void ImageModel::RotateNTimes90Degrees(int iN)
|
||||
case 3:
|
||||
{
|
||||
HBITMAP hbm = Rotate90DegreeBlt(m_hDrawingDC, GetWidth(), GetHeight(), iN == 1, FALSE);
|
||||
if (hbm)
|
||||
PushImageForUndo(hbm);
|
||||
PushImageForUndo(hbm);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
PushImageForUndo();
|
||||
StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(),
|
||||
m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY);
|
||||
::StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(),
|
||||
m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -281,8 +302,7 @@ void ImageModel::PushBlackAndWhite()
|
||||
HBITMAP hNewBitmap = ConvertToBlackAndWhite(hBitmap);
|
||||
UnlockBitmap(hBitmap);
|
||||
|
||||
if (hNewBitmap)
|
||||
PushImageForUndo(hNewBitmap);
|
||||
PushImageForUndo(hNewBitmap);
|
||||
}
|
||||
|
||||
HBITMAP ImageModel::LockBitmap()
|
||||
@@ -306,7 +326,7 @@ void ImageModel::SelectionClone(BOOL bUndoable)
|
||||
return;
|
||||
|
||||
if (bUndoable)
|
||||
PushImageForUndo(CopyBitmap());
|
||||
PushImageForUndo();
|
||||
|
||||
selectionModel.DrawSelection(m_hDrawingDC, paletteModel.GetBgColor(),
|
||||
toolsModel.IsBackgroundTransparent());
|
||||
|
@@ -19,13 +19,13 @@ public:
|
||||
HDC GetDC();
|
||||
BOOL CanUndo() const { return m_undoSteps > 0; }
|
||||
BOOL CanRedo() const { return m_redoSteps > 0; }
|
||||
void PushImageForUndo(HBITMAP hbm = NULL);
|
||||
void ResetToPrevious(void);
|
||||
void PushImageForUndo();
|
||||
void PushImageForUndo(HBITMAP hbm);
|
||||
void Undo(BOOL bClearRedo = FALSE);
|
||||
void Redo(void);
|
||||
void ClearHistory(void);
|
||||
void Crop(int nWidth, int nHeight, int nOffsetX = 0, int nOffsetY = 0);
|
||||
void SaveImage(LPCTSTR lpFileName);
|
||||
void SaveImage(LPCWSTR lpFileName);
|
||||
BOOL IsImageSaved() const;
|
||||
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX = 0, int nSkewDegY = 0);
|
||||
int GetWidth() const;
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB |
BIN
base/applications/mspaint/img/airbrush.cur
Normal file
After Width: | Height: | Size: 766 B |
BIN
base/applications/mspaint/img/color.cur
Normal file
After Width: | Height: | Size: 766 B |
BIN
base/applications/mspaint/img/fill.cur
Normal file
After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
base/applications/mspaint/img/handdrag.cur
Normal file
After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
BIN
base/applications/mspaint/img/pen.cur
Normal file
After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
BIN
base/applications/mspaint/img/zoom.cur
Normal file
After Width: | Height: | Size: 766 B |
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-bg-BG.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-bg-BG.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-cs-CZ.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-cs-CZ.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-de-DE.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-de-DE.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-en-GB.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-en-GB.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar.bmp"
|
||||
IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-es-ES.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-es-ES.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_ESTONIAN, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-et-EE.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-et-EE.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_BASQUE, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-eu-ES.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-eu-ES.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-fr-FR.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-fr-FR.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-he-IL.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-he-IL.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-hu-HU.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-hu-HU.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-id-ID.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-id-ID.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-it-IT.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-it-IT.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ja-JP.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ja-JP.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-nl-NL.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-nl-NL.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-no-NO.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-no-NO.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pl-PL.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pl-PL.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-BR.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-BR.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-PT.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-PT.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ro-RO.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ro-RO.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
@@ -17,8 +17,8 @@ BEGIN
|
||||
BEGIN
|
||||
MENUITEM "&Nou\tCtrl+N", IDM_FILENEW
|
||||
MENUITEM "&Deschidere...\tCtrl+O", IDM_FILEOPEN
|
||||
MENUITEM "&Păstrează\tCtrl+S", IDM_FILESAVE
|
||||
MENUITEM "Păst&rare în...", IDM_FILESAVEAS
|
||||
MENUITEM "&Salvează\tCtrl+S", IDM_FILESAVE
|
||||
MENUITEM "Salvea&ză ca...", IDM_FILESAVEAS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Din aparat media...", IDM_FILEFROMSCANNERORCAMERA
|
||||
MENUITEM SEPARATOR
|
||||
@@ -234,7 +234,7 @@ BEGIN
|
||||
IDS_WINDOWTITLE "%s - Pictare"
|
||||
IDS_INFOTITLE "Pictare pentru ReactOS"
|
||||
IDS_INFOTEXT "Disponibilă sub licența GNU Lesser General Public (vedeți www.gnu.org)"
|
||||
IDS_SAVEPROMPTTEXT "Doriți păstrarea modificărilor din %s?"
|
||||
IDS_SAVEPROMPTTEXT "Doriți salvarea modificărilor din %s?"
|
||||
IDS_DEFAULTFILENAME "Fără nume"
|
||||
IDS_MINIATURETITLE "Miniatură"
|
||||
IDS_TOOLTIP1 "Golire selecție"
|
||||
@@ -267,7 +267,7 @@ BEGIN
|
||||
IDS_VERTICAL "Vertical"
|
||||
IDS_PRINTRES "%d x %d pixeli/cm"
|
||||
IDS_CANTPASTE "Nu a putut fi lipit din clipboard. Formatul de date este fie incorect, fie nesuportat."
|
||||
IDS_SAVEERROR "Eșec în păstrarea imaginii bitmap („hartă de biți”) în fișierul:\n\n%s"
|
||||
IDS_SAVEERROR "Eșec în salvarea imaginii bitmap („hartă de biți”) în fișierul:\n\n%s"
|
||||
IDS_CANTSENDMAIL "Eșec în trimiterea unei scrisori."
|
||||
IDS_LOSECOLOR "În această operațiune informațiile legate de culoare vor fi pierdute. Sigur veți continua?"
|
||||
END
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ru-RU.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ru-RU.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sk-SK.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sk-SK.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sq-AL.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sq-AL.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sv-SE.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sv-SE.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-tr-TR.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-tr-TR.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-uk-UA.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-uk-UA.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
LANGUAGE LANG_VIETNAMESE, SUBLANG_VIETNAMESE_VIETNAM
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-vi-VN.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-vi-VN.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-CN.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-CN.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_HONGKONG
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-HK.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-HK.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
|
||||
|
||||
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-TW.bmp"
|
||||
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-TW.bmp"
|
||||
|
||||
ID_MENU MENU
|
||||
BEGIN
|
||||
|
@@ -7,13 +7,12 @@
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include <dlgs.h>
|
||||
#include <mapi.h>
|
||||
#include <mapicode.h>
|
||||
|
||||
POINT g_ptStart, g_ptEnd;
|
||||
BOOL g_askBeforeEnlarging = FALSE; // TODO: initialize from registry
|
||||
HINSTANCE g_hinstExe = NULL;
|
||||
TCHAR g_szFileName[MAX_LONG_PATH] = { 0 };
|
||||
WCHAR g_szFileName[MAX_LONG_PATH] = { 0 };
|
||||
WCHAR g_szMailTempFile[MAX_LONG_PATH] = { 0 };
|
||||
BOOL g_isAFile = FALSE;
|
||||
BOOL g_imageSaved = FALSE;
|
||||
@@ -23,20 +22,32 @@ CMainWindow mainWindow;
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
void ShowOutOfMemory(void)
|
||||
{
|
||||
WCHAR szText[256];
|
||||
::FormatMessageW(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
ERROR_OUTOFMEMORY,
|
||||
0,
|
||||
szText, _countof(szText),
|
||||
NULL);
|
||||
mainWindow.MessageBox(szText, NULL, MB_ICONERROR);
|
||||
}
|
||||
|
||||
// get file name extension from filter string
|
||||
static BOOL
|
||||
FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN)
|
||||
FileExtFromFilter(LPWSTR pExt, OPENFILENAME *pOFN)
|
||||
{
|
||||
LPTSTR pchExt = pExt;
|
||||
LPWSTR pchExt = pExt;
|
||||
*pchExt = 0;
|
||||
|
||||
DWORD nIndex = 1;
|
||||
for (LPCTSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
|
||||
for (LPCWSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
|
||||
{
|
||||
pch += lstrlen(pch) + 1;
|
||||
if (pOFN->nFilterIndex == nIndex)
|
||||
{
|
||||
for (++pch; *pch && *pch != _T(';'); ++pch)
|
||||
for (++pch; *pch && *pch != L';'; ++pch)
|
||||
{
|
||||
*pchExt++ = *pch;
|
||||
}
|
||||
@@ -44,7 +55,7 @@ FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN)
|
||||
CharLower(pExt);
|
||||
return TRUE;
|
||||
}
|
||||
pch += lstrlen(pch) + 1;
|
||||
pch += wcslen(pch) + 1;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -54,19 +65,19 @@ static UINT_PTR APIENTRY
|
||||
OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND hParent;
|
||||
OFNOTIFY *pon;
|
||||
OFNOTIFYW *pon;
|
||||
WCHAR Path[MAX_PATH];
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
pon = (OFNOTIFY *)lParam;
|
||||
pon = (OFNOTIFYW *)lParam;
|
||||
if (pon->hdr.code == CDN_TYPECHANGE)
|
||||
{
|
||||
hParent = GetParent(hwnd);
|
||||
TCHAR Path[MAX_PATH];
|
||||
SendMessage(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path);
|
||||
FileExtFromFilter(PathFindExtension(Path), pon->lpOFN);
|
||||
SendMessage(hParent, CDM_SETCONTROLTEXT, 0x047c, (LPARAM)PathFindFileName(Path));
|
||||
lstrcpyn(pon->lpOFN->lpstrFile, Path, pon->lpOFN->nMaxFile);
|
||||
SendMessageW(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path);
|
||||
FileExtFromFilter(PathFindExtensionW(Path), pon->lpOFN);
|
||||
SendMessageW(hParent, CDM_SETCONTROLTEXT, cmb13, (LPARAM)PathFindFileNameW(Path));
|
||||
StringCchCopyW(pon->lpOFN->lpstrFile, pon->lpOFN->nMaxFile, Path);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -183,21 +194,22 @@ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
|
||||
return FALSE; // Failure
|
||||
}
|
||||
|
||||
BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
|
||||
BOOL CMainWindow::GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
|
||||
{
|
||||
static OPENFILENAME ofn = { 0 };
|
||||
static CString strFilter;
|
||||
static OPENFILENAMEW ofn = { 0 };
|
||||
static CStringW strFilter;
|
||||
|
||||
if (ofn.lStructSize == 0)
|
||||
{
|
||||
// The "All Files" item text
|
||||
CString strAllPictureFiles;
|
||||
CStringW strAllPictureFiles;
|
||||
strAllPictureFiles.LoadString(g_hinstExe, IDS_ALLPICTUREFILES);
|
||||
|
||||
// Get the import filter
|
||||
CSimpleArray<GUID> aguidFileTypesI;
|
||||
CImage::GetImporterFilterString(strFilter, aguidFileTypesI, strAllPictureFiles,
|
||||
CImage::excludeDefaultLoad, _T('\0'));
|
||||
CImage::excludeDefaultLoad, L'|');
|
||||
strFilter.Replace(L'|', UNICODE_NULL);
|
||||
|
||||
// Initializing the OPENFILENAME structure for GetOpenFileName
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
@@ -211,20 +223,21 @@ BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
|
||||
|
||||
ofn.lpstrFile = pszFile;
|
||||
ofn.nMaxFile = cchMaxFile;
|
||||
return ::GetOpenFileName(&ofn);
|
||||
return ::GetOpenFileNameW(&ofn);
|
||||
}
|
||||
|
||||
BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
|
||||
BOOL CMainWindow::GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
|
||||
{
|
||||
static OPENFILENAME sfn = { 0 };
|
||||
static CString strFilter;
|
||||
static OPENFILENAMEW sfn = { 0 };
|
||||
static CStringW strFilter;
|
||||
|
||||
if (sfn.lStructSize == 0)
|
||||
{
|
||||
// Get the export filter
|
||||
CSimpleArray<GUID> aguidFileTypesE;
|
||||
CImage::GetExporterFilterString(strFilter, aguidFileTypesE, NULL,
|
||||
CImage::excludeDefaultSave, _T('\0'));
|
||||
CImage::excludeDefaultSave, L'|');
|
||||
strFilter.Replace(L'|', UNICODE_NULL);
|
||||
|
||||
// Initializing the OPENFILENAME structure for GetSaveFileName
|
||||
ZeroMemory(&sfn, sizeof(sfn));
|
||||
@@ -240,7 +253,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
|
||||
if (*pchDotExt == UNICODE_NULL)
|
||||
{
|
||||
// Choose PNG
|
||||
wcscat(pszFile, L".png");
|
||||
StringCchCatW(pszFile, cchMaxFile, L".png");
|
||||
for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
|
||||
{
|
||||
if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
|
||||
@@ -254,7 +267,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
|
||||
|
||||
sfn.lpstrFile = pszFile;
|
||||
sfn.nMaxFile = cchMaxFile;
|
||||
return ::GetSaveFileName(&sfn);
|
||||
return ::GetSaveFileNameW(&sfn);
|
||||
}
|
||||
|
||||
BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor)
|
||||
@@ -286,9 +299,9 @@ BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor)
|
||||
|
||||
HWND CMainWindow::DoCreate()
|
||||
{
|
||||
::LoadString(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName));
|
||||
::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName));
|
||||
|
||||
CString strTitle;
|
||||
CStringW strTitle;
|
||||
strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName));
|
||||
|
||||
RECT& rc = registrySettings.WindowPlacement.rcNormalPosition;
|
||||
@@ -297,13 +310,8 @@ HWND CMainWindow::DoCreate()
|
||||
|
||||
// entry point
|
||||
INT WINAPI
|
||||
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nCmdShow)
|
||||
wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
// Report any memory leaks on exit
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
#endif
|
||||
|
||||
g_hinstExe = hInstance;
|
||||
|
||||
// Initialize common controls library
|
||||
@@ -318,7 +326,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC
|
||||
// Create the main window
|
||||
if (!mainWindow.DoCreate())
|
||||
{
|
||||
MessageBox(NULL, TEXT("Failed to create main window."), NULL, MB_ICONERROR);
|
||||
MessageBox(NULL, L"Failed to create main window.", NULL, MB_ICONERROR);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -330,7 +338,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC
|
||||
mainWindow.ShowWindow(registrySettings.WindowPlacement.showCmd);
|
||||
|
||||
// Load the access keys
|
||||
HACCEL hAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(800));
|
||||
HACCEL hAccel = ::LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(800));
|
||||
|
||||
// The message loop
|
||||
MSG msg;
|
||||
@@ -339,7 +347,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC
|
||||
if (fontsDialog.IsWindow() && fontsDialog.IsDialogMessage(&msg))
|
||||
continue;
|
||||
|
||||
if (::TranslateAccelerator(mainWindow, hAccel, &msg))
|
||||
if (::TranslateAcceleratorW(mainWindow, hAccel, &msg))
|
||||
continue;
|
||||
|
||||
::TranslateMessage(&msg);
|
||||
|
@@ -36,8 +36,8 @@ HWND CMiniatureWindow::DoCreate(HWND hwndParent)
|
||||
(LONG)(registrySettings.ThumbYPos + registrySettings.ThumbHeight)
|
||||
};
|
||||
|
||||
TCHAR strTitle[100];
|
||||
::LoadString(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle));
|
||||
WCHAR strTitle[100];
|
||||
::LoadStringW(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle));
|
||||
|
||||
DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME;
|
||||
return Create(hwndParent, rc, strTitle, style, WS_EX_PALETTEWINDOW);
|
||||
|
@@ -11,7 +11,7 @@
|
||||
class CMiniatureWindow : public CWindowImpl<CMiniatureWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("MiniatureWindow"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
|
||||
DECLARE_WND_CLASS_EX(L"MiniatureWindow", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
|
||||
COLOR_BTNFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CMiniatureWindow)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
||||
* PURPOSE: Things which should not be in the mouse event handler itself
|
||||
* COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
|
||||
* Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
* Copyright 2021-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
/* INCLUDES *********************************************************/
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
INT ToolBase::s_pointSP = 0;
|
||||
POINT ToolBase::s_pointStack[256] = { { 0 } };
|
||||
static POINT g_ptStart, g_ptEnd;
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
@@ -62,13 +63,7 @@ void ToolBase::reset()
|
||||
}
|
||||
}
|
||||
|
||||
void ToolBase::OnCancelDraw()
|
||||
{
|
||||
reset();
|
||||
imageModel.NotifyImageChanged();
|
||||
}
|
||||
|
||||
void ToolBase::OnFinishDraw()
|
||||
void ToolBase::OnEndDraw(BOOL bCancel)
|
||||
{
|
||||
reset();
|
||||
imageModel.NotifyImageChanged();
|
||||
@@ -175,16 +170,13 @@ struct FreeSelTool : ToolBase
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void OnFinishDraw() override
|
||||
void OnEndDraw(BOOL bCancel) override
|
||||
{
|
||||
selectionModel.Landing();
|
||||
ToolBase::OnFinishDraw();
|
||||
}
|
||||
|
||||
void OnCancelDraw() override
|
||||
{
|
||||
selectionModel.HideSelection();
|
||||
ToolBase::OnCancelDraw();
|
||||
if (bCancel)
|
||||
selectionModel.HideSelection();
|
||||
else
|
||||
selectionModel.Landing();
|
||||
ToolBase::OnEndDraw(bCancel);
|
||||
}
|
||||
|
||||
void OnSpecialTweak(BOOL bMinus) override
|
||||
@@ -260,16 +252,13 @@ struct RectSelTool : ToolBase
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void OnFinishDraw() override
|
||||
void OnEndDraw(BOOL bCancel) override
|
||||
{
|
||||
selectionModel.Landing();
|
||||
ToolBase::OnFinishDraw();
|
||||
}
|
||||
|
||||
void OnCancelDraw() override
|
||||
{
|
||||
selectionModel.HideSelection();
|
||||
ToolBase::OnCancelDraw();
|
||||
if (bCancel)
|
||||
selectionModel.HideSelection();
|
||||
else
|
||||
selectionModel.Landing();
|
||||
ToolBase::OnEndDraw(bCancel);
|
||||
}
|
||||
|
||||
void OnSpecialTweak(BOOL bMinus) override
|
||||
@@ -309,16 +298,10 @@ struct TwoPointDrawTool : ToolBase
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void OnFinishDraw() override
|
||||
void OnEndDraw(BOOL bCancel) override
|
||||
{
|
||||
m_bDrawing = FALSE;
|
||||
ToolBase::OnFinishDraw();
|
||||
}
|
||||
|
||||
void OnCancelDraw() override
|
||||
{
|
||||
m_bDrawing = FALSE;
|
||||
ToolBase::OnCancelDraw();
|
||||
ToolBase::OnEndDraw(bCancel);
|
||||
}
|
||||
|
||||
void OnSpecialTweak(BOOL bMinus) override
|
||||
@@ -421,6 +404,7 @@ RestrictDrawDirection(DIRECTION dir, LONG x0, LONG y0, LONG& x1, LONG& y1)
|
||||
struct SmoothDrawTool : ToolBase
|
||||
{
|
||||
DIRECTION m_direction = NO_DIRECTION;
|
||||
BOOL m_bShiftDown = FALSE;
|
||||
|
||||
SmoothDrawTool(TOOLTYPE type) : ToolBase(type)
|
||||
{
|
||||
@@ -433,11 +417,12 @@ struct SmoothDrawTool : ToolBase
|
||||
m_direction = NO_DIRECTION;
|
||||
imageModel.PushImageForUndo();
|
||||
imageModel.NotifyImageChanged();
|
||||
m_bShiftDown = (::GetKeyState(VK_SHIFT) & 0x8000); // Is Shift key pressed?
|
||||
}
|
||||
|
||||
BOOL OnMouseMove(BOOL bLeftButton, LONG& x, LONG& y) override
|
||||
{
|
||||
if (::GetKeyState(VK_SHIFT) < 0) // Shift key is pressed
|
||||
if (m_bShiftDown)
|
||||
{
|
||||
if (m_direction == NO_DIRECTION)
|
||||
{
|
||||
@@ -450,14 +435,10 @@ struct SmoothDrawTool : ToolBase
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_direction != NO_DIRECTION)
|
||||
{
|
||||
m_direction = NO_DIRECTION;
|
||||
draw(bLeftButton, x, y);
|
||||
g_ptStart.x = g_ptEnd.x = x;
|
||||
g_ptStart.y = g_ptEnd.y = y;
|
||||
return TRUE;
|
||||
}
|
||||
draw(bLeftButton, x, y);
|
||||
g_ptStart.x = g_ptEnd.x = x;
|
||||
g_ptStart.y = g_ptEnd.y = y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
draw(bLeftButton, x, y);
|
||||
@@ -467,27 +448,25 @@ struct SmoothDrawTool : ToolBase
|
||||
|
||||
BOOL OnButtonUp(BOOL bLeftButton, LONG& x, LONG& y) override
|
||||
{
|
||||
if (m_direction != NO_DIRECTION)
|
||||
if (m_bShiftDown && m_direction != NO_DIRECTION)
|
||||
{
|
||||
RestrictDrawDirection(m_direction, g_ptStart.x, g_ptStart.y, x, y);
|
||||
}
|
||||
|
||||
draw(bLeftButton, x, y);
|
||||
OnFinishDraw();
|
||||
OnEndDraw(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void OnFinishDraw() override
|
||||
void OnEndDraw(BOOL bCancel) override
|
||||
{
|
||||
ToolBase::OnFinishDraw();
|
||||
}
|
||||
|
||||
void OnCancelDraw() override
|
||||
{
|
||||
LONG x = 0, y = 0;
|
||||
OnButtonUp(FALSE, x, y);
|
||||
imageModel.Undo(TRUE);
|
||||
ToolBase::OnCancelDraw();
|
||||
if (bCancel)
|
||||
{
|
||||
LONG x = 0, y = 0;
|
||||
OnButtonUp(FALSE, x, y);
|
||||
imageModel.Undo(TRUE);
|
||||
}
|
||||
ToolBase::OnEndDraw(bCancel);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -565,26 +544,67 @@ struct ColorTool : ToolBase
|
||||
// TOOL_ZOOM
|
||||
struct ZoomTool : ToolBase
|
||||
{
|
||||
BOOL m_bZoomed = FALSE;
|
||||
|
||||
ZoomTool() : ToolBase(TOOL_ZOOM)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL getNewZoomRect(CRect& rcView, INT newZoom);
|
||||
|
||||
void OnDrawOverlayOnCanvas(HDC hdc) override
|
||||
{
|
||||
CRect rcView;
|
||||
INT oldZoom = toolsModel.GetZoom();
|
||||
if (oldZoom < MAX_ZOOM && getNewZoomRect(rcView, oldZoom * 2))
|
||||
DrawXorRect(hdc, &rcView);
|
||||
}
|
||||
|
||||
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
|
||||
{
|
||||
imageModel.PushImageForUndo();
|
||||
INT newZoom, oldZoom = toolsModel.GetZoom();
|
||||
if (bLeftButton)
|
||||
{
|
||||
if (toolsModel.GetZoom() < MAX_ZOOM)
|
||||
zoomTo(toolsModel.GetZoom() * 2, x, y);
|
||||
}
|
||||
newZoom = (oldZoom < MAX_ZOOM) ? (oldZoom * 2) : MIN_ZOOM;
|
||||
else
|
||||
newZoom = (oldZoom > MIN_ZOOM) ? (oldZoom / 2) : MAX_ZOOM;
|
||||
|
||||
m_bZoomed = FALSE;
|
||||
|
||||
if (oldZoom != newZoom)
|
||||
{
|
||||
if (toolsModel.GetZoom() > MIN_ZOOM)
|
||||
zoomTo(toolsModel.GetZoom() / 2, x, y);
|
||||
CRect rcView;
|
||||
if (getNewZoomRect(rcView, newZoom))
|
||||
{
|
||||
canvasWindow.zoomTo(newZoom, rcView.left, rcView.top);
|
||||
m_bZoomed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL OnButtonUp(BOOL bLeftButton, LONG& x, LONG& y) override
|
||||
{
|
||||
if (m_bZoomed)
|
||||
toolsModel.SetActiveTool(toolsModel.GetOldActiveTool());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
BOOL ZoomTool::getNewZoomRect(CRect& rcView, INT newZoom)
|
||||
{
|
||||
CPoint pt;
|
||||
::GetCursorPos(&pt);
|
||||
canvasWindow.ScreenToClient(&pt);
|
||||
|
||||
canvasWindow.getNewZoomRect(rcView, newZoom, pt);
|
||||
|
||||
CRect rc;
|
||||
canvasWindow.GetImageRect(rc);
|
||||
canvasWindow.ImageToCanvas(rc);
|
||||
|
||||
return rc.PtInRect(pt);
|
||||
}
|
||||
|
||||
// TOOL_PEN
|
||||
struct PenTool : SmoothDrawTool
|
||||
{
|
||||
@@ -684,7 +704,7 @@ struct TextTool : ToolBase
|
||||
|
||||
void draw(HDC hdc)
|
||||
{
|
||||
CString szText;
|
||||
CStringW szText;
|
||||
textEditWindow.GetWindowText(szText);
|
||||
|
||||
RECT rc;
|
||||
@@ -760,21 +780,19 @@ struct TextTool : ToolBase
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void OnFinishDraw() override
|
||||
void OnEndDraw(BOOL bCancel) override
|
||||
{
|
||||
if (textEditWindow.GetWindowTextLength() > 0)
|
||||
if (!bCancel)
|
||||
{
|
||||
imageModel.PushImageForUndo();
|
||||
draw(m_hdc);
|
||||
if (::IsWindowVisible(textEditWindow) &&
|
||||
textEditWindow.GetWindowTextLength() > 0)
|
||||
{
|
||||
imageModel.PushImageForUndo();
|
||||
draw(m_hdc);
|
||||
}
|
||||
}
|
||||
quit();
|
||||
ToolBase::OnFinishDraw();
|
||||
}
|
||||
|
||||
void OnCancelDraw() override
|
||||
{
|
||||
quit();
|
||||
ToolBase::OnCancelDraw();
|
||||
ToolBase::OnEndDraw(bCancel);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -862,25 +880,22 @@ struct BezierTool : ToolBase
|
||||
s_pointStack[s_pointSP].y = y;
|
||||
if (s_pointSP >= 3)
|
||||
{
|
||||
OnFinishDraw();
|
||||
OnEndDraw(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
imageModel.NotifyImageChanged();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void OnCancelDraw() override
|
||||
void OnEndDraw(BOOL bCancel) override
|
||||
{
|
||||
if (!bCancel)
|
||||
{
|
||||
imageModel.PushImageForUndo();
|
||||
OnDrawOverlayOnImage(m_hdc);
|
||||
}
|
||||
m_bDrawing = FALSE;
|
||||
ToolBase::OnCancelDraw();
|
||||
}
|
||||
|
||||
void OnFinishDraw() override
|
||||
{
|
||||
imageModel.PushImageForUndo();
|
||||
OnDrawOverlayOnImage(m_hdc);
|
||||
m_bDrawing = FALSE;
|
||||
ToolBase::OnFinishDraw();
|
||||
ToolBase::OnEndDraw(bCancel);
|
||||
}
|
||||
|
||||
void OnSpecialTweak(BOOL bMinus) override
|
||||
@@ -943,7 +958,7 @@ struct ShapeTool : ToolBase
|
||||
|
||||
if (s_pointSP && bDoubleClick)
|
||||
{
|
||||
OnFinishDraw();
|
||||
OnEndDraw(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -977,7 +992,7 @@ struct ShapeTool : ToolBase
|
||||
m_bClosed = FALSE;
|
||||
if (nearlyEqualPoints(x, y, s_pointStack[0].x, s_pointStack[0].y))
|
||||
{
|
||||
OnFinishDraw();
|
||||
OnEndDraw(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@@ -994,26 +1009,22 @@ struct ShapeTool : ToolBase
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void OnCancelDraw() override
|
||||
void OnEndDraw(BOOL bCancel) override
|
||||
{
|
||||
ToolBase::OnCancelDraw();
|
||||
}
|
||||
|
||||
void OnFinishDraw() override
|
||||
{
|
||||
if (s_pointSP)
|
||||
if (!bCancel)
|
||||
{
|
||||
--s_pointSP;
|
||||
m_bClosed = TRUE;
|
||||
if (s_pointSP)
|
||||
{
|
||||
--s_pointSP;
|
||||
m_bClosed = TRUE;
|
||||
|
||||
imageModel.PushImageForUndo();
|
||||
OnDrawOverlayOnImage(m_hdc);
|
||||
imageModel.PushImageForUndo();
|
||||
OnDrawOverlayOnImage(m_hdc);
|
||||
}
|
||||
m_bClosed = FALSE;
|
||||
s_pointSP = 0;
|
||||
}
|
||||
|
||||
m_bClosed = FALSE;
|
||||
s_pointSP = 0;
|
||||
|
||||
ToolBase::OnFinishDraw();
|
||||
ToolBase::OnEndDraw(bCancel);
|
||||
}
|
||||
|
||||
void OnSpecialTweak(BOOL bMinus) override
|
||||
@@ -1087,3 +1098,129 @@ ToolBase::createToolObject(TOOLTYPE type)
|
||||
UNREACHABLE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ToolsModel::OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
|
||||
{
|
||||
m_pToolObject->beginEvent();
|
||||
g_ptStart.x = g_ptEnd.x = x;
|
||||
g_ptStart.y = g_ptEnd.y = y;
|
||||
m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick);
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
|
||||
{
|
||||
m_pToolObject->beginEvent();
|
||||
if (m_pToolObject->OnMouseMove(bLeftButton, x, y))
|
||||
{
|
||||
g_ptEnd.x = x;
|
||||
g_ptEnd.y = y;
|
||||
}
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
|
||||
{
|
||||
m_pToolObject->beginEvent();
|
||||
if (m_pToolObject->OnButtonUp(bLeftButton, x, y))
|
||||
{
|
||||
g_ptEnd.x = x;
|
||||
g_ptEnd.y = y;
|
||||
}
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnEndDraw(BOOL bCancel)
|
||||
{
|
||||
ATLTRACE("ToolsModel::OnEndDraw(%d)\n", bCancel);
|
||||
m_pToolObject->beginEvent();
|
||||
m_pToolObject->OnEndDraw(bCancel);
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnDrawOverlayOnImage(HDC hdc)
|
||||
{
|
||||
m_pToolObject->OnDrawOverlayOnImage(hdc);
|
||||
}
|
||||
|
||||
void ToolsModel::OnDrawOverlayOnCanvas(HDC hdc)
|
||||
{
|
||||
m_pToolObject->OnDrawOverlayOnCanvas(hdc);
|
||||
}
|
||||
|
||||
void ToolsModel::SpecialTweak(BOOL bMinus)
|
||||
{
|
||||
m_pToolObject->OnSpecialTweak(bMinus);
|
||||
}
|
||||
|
||||
void ToolsModel::DrawWithMouseTool(POINT pt, WPARAM wParam)
|
||||
{
|
||||
LONG xRel = pt.x - g_ptStart.x, yRel = pt.y - g_ptStart.y;
|
||||
|
||||
switch (m_activeTool)
|
||||
{
|
||||
// freesel, rectsel and text tools always show numbers limited to fit into image area
|
||||
case TOOL_FREESEL:
|
||||
case TOOL_RECTSEL:
|
||||
case TOOL_TEXT:
|
||||
if (xRel < 0)
|
||||
xRel = (pt.x < 0) ? -g_ptStart.x : xRel;
|
||||
else if (pt.x > imageModel.GetWidth())
|
||||
xRel = imageModel.GetWidth() - g_ptStart.x;
|
||||
if (yRel < 0)
|
||||
yRel = (pt.y < 0) ? -g_ptStart.y : yRel;
|
||||
else if (pt.y > imageModel.GetHeight())
|
||||
yRel = imageModel.GetHeight() - g_ptStart.y;
|
||||
break;
|
||||
|
||||
// while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14
|
||||
case TOOL_RUBBER:
|
||||
case TOOL_PEN:
|
||||
case TOOL_BRUSH:
|
||||
case TOOL_AIRBRUSH:
|
||||
case TOOL_SHAPE:
|
||||
{
|
||||
CStringW strCoord;
|
||||
strCoord.Format(L"%ld, %ld", pt.x, pt.y);
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strCoord);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// rectsel and shape tools always show non-negative numbers when drawing
|
||||
if (m_activeTool == TOOL_RECTSEL || m_activeTool == TOOL_SHAPE)
|
||||
{
|
||||
xRel = labs(xRel);
|
||||
yRel = labs(yRel);
|
||||
}
|
||||
|
||||
if (wParam & MK_LBUTTON)
|
||||
{
|
||||
OnMouseMove(TRUE, pt.x, pt.y);
|
||||
canvasWindow.Invalidate(FALSE);
|
||||
if ((m_activeTool >= TOOL_TEXT) || IsSelection())
|
||||
{
|
||||
CStringW strSize;
|
||||
if ((m_activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
strSize.Format(L"%ld x %ld", xRel, yRel);
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (wParam & MK_RBUTTON)
|
||||
{
|
||||
OnMouseMove(FALSE, pt.x, pt.y);
|
||||
canvasWindow.Invalidate(FALSE);
|
||||
if (m_activeTool >= TOOL_TEXT)
|
||||
{
|
||||
CStringW strSize;
|
||||
if ((m_activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
strSize.Format(L"%ld x %ld", xRel, yRel);
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
class CPaletteWindow : public CWindowImpl<CPaletteWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("Palette"), CS_DBLCLKS, COLOR_BTNFACE)
|
||||
DECLARE_WND_CLASS_EX(L"Palette", CS_DBLCLKS, COLOR_BTNFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CPaletteWindow)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
|
||||
|
@@ -25,11 +25,8 @@
|
||||
#include <math.h>
|
||||
#include <shellapi.h>
|
||||
#include <htmlhelp.h>
|
||||
#include <strsafe.h>
|
||||
#include "atlimagedx.h"
|
||||
#ifdef _DEBUG
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
|
@@ -15,18 +15,18 @@ RegistrySettings registrySettings;
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
static void ReadDWORD(CRegKey &key, LPCTSTR lpName, DWORD &dwValue)
|
||||
static void ReadDWORD(CRegKey &key, LPCWSTR lpName, DWORD &dwValue)
|
||||
{
|
||||
DWORD dwTemp;
|
||||
if (key.QueryDWORDValue(lpName, dwTemp) == ERROR_SUCCESS)
|
||||
dwValue = dwTemp;
|
||||
}
|
||||
|
||||
static void ReadString(CRegKey &key, LPCTSTR lpName, CString &strValue, LPCTSTR lpDefault = TEXT(""))
|
||||
static void ReadString(CRegKey &key, LPCWSTR lpName, CStringW &strValue, LPCWSTR lpDefault = L"")
|
||||
{
|
||||
CString strTemp;
|
||||
CStringW strTemp;
|
||||
ULONG nChars = MAX_PATH;
|
||||
LPTSTR psz = strTemp.GetBuffer(nChars);
|
||||
LPWSTR psz = strTemp.GetBuffer(nChars);
|
||||
LONG error = key.QueryStringValue(lpName, psz, &nChars);
|
||||
strTemp.ReleaseBuffer();
|
||||
|
||||
@@ -36,15 +36,15 @@ static void ReadString(CRegKey &key, LPCTSTR lpName, CString &strValue, LPCTSTR
|
||||
strValue = lpDefault;
|
||||
}
|
||||
|
||||
void RegistrySettings::SetWallpaper(LPCTSTR szFileName, RegistrySettings::WallpaperStyle style)
|
||||
void RegistrySettings::SetWallpaper(LPCWSTR szFileName, RegistrySettings::WallpaperStyle style)
|
||||
{
|
||||
CRegKey desktop;
|
||||
if (desktop.Open(HKEY_CURRENT_USER, _T("Control Panel\\Desktop")) == ERROR_SUCCESS)
|
||||
if (desktop.Open(HKEY_CURRENT_USER, L"Control Panel\\Desktop") == ERROR_SUCCESS)
|
||||
{
|
||||
desktop.SetStringValue(_T("Wallpaper"), szFileName);
|
||||
desktop.SetStringValue(L"Wallpaper", szFileName);
|
||||
|
||||
desktop.SetStringValue(_T("WallpaperStyle"), (style == RegistrySettings::STRETCHED) ? _T("2") : _T("0"));
|
||||
desktop.SetStringValue(_T("TileWallpaper"), (style == RegistrySettings::TILED) ? _T("1") : _T("0"));
|
||||
desktop.SetStringValue(L"WallpaperStyle", (style == RegistrySettings::STRETCHED) ? L"2" : L"0");
|
||||
desktop.SetStringValue(L"TileWallpaper", (style == RegistrySettings::TILED) ? L"1" : L"0");
|
||||
}
|
||||
|
||||
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
||||
@@ -77,8 +77,8 @@ void RegistrySettings::LoadPresets(INT nCmdShow)
|
||||
Bar1ID = BAR1ID_TOP;
|
||||
Bar2ID = BAR2ID_LEFT;
|
||||
|
||||
LOGFONT lf;
|
||||
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
|
||||
LOGFONTW lf;
|
||||
::GetObjectW(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
|
||||
strFontName = lf.lfFaceName;
|
||||
|
||||
ZeroMemory(&WindowPlacement, sizeof(WindowPlacement));
|
||||
@@ -94,76 +94,76 @@ void RegistrySettings::Load(INT nCmdShow)
|
||||
LoadPresets(nCmdShow);
|
||||
|
||||
CRegKey paint;
|
||||
if (paint.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint"), KEY_READ) != ERROR_SUCCESS)
|
||||
if (paint.Open(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint", KEY_READ) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
CRegKey view;
|
||||
if (view.Open(paint, _T("View"), KEY_READ) == ERROR_SUCCESS)
|
||||
if (view.Open(paint, L"View", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
ReadDWORD(view, _T("BMPHeight"), BMPHeight);
|
||||
ReadDWORD(view, _T("BMPWidth"), BMPWidth);
|
||||
ReadDWORD(view, _T("GridExtent"), GridExtent);
|
||||
ReadDWORD(view, _T("NoStretching"), NoStretching);
|
||||
ReadDWORD(view, _T("ShowThumbnail"), ShowThumbnail);
|
||||
ReadDWORD(view, _T("SnapToGrid"), SnapToGrid);
|
||||
ReadDWORD(view, _T("ThumbHeight"), ThumbHeight);
|
||||
ReadDWORD(view, _T("ThumbWidth"), ThumbWidth);
|
||||
ReadDWORD(view, _T("ThumbXPos"), ThumbXPos);
|
||||
ReadDWORD(view, _T("ThumbYPos"), ThumbYPos);
|
||||
ReadDWORD(view, _T("UnitSetting"), UnitSetting);
|
||||
ReadDWORD(view, _T("ShowStatusBar"), ShowStatusBar);
|
||||
ReadDWORD(view, L"BMPHeight", BMPHeight);
|
||||
ReadDWORD(view, L"BMPWidth", BMPWidth);
|
||||
ReadDWORD(view, L"GridExtent", GridExtent);
|
||||
ReadDWORD(view, L"NoStretching", NoStretching);
|
||||
ReadDWORD(view, L"ShowThumbnail", ShowThumbnail);
|
||||
ReadDWORD(view, L"SnapToGrid", SnapToGrid);
|
||||
ReadDWORD(view, L"ThumbHeight", ThumbHeight);
|
||||
ReadDWORD(view, L"ThumbWidth", ThumbWidth);
|
||||
ReadDWORD(view, L"ThumbXPos", ThumbXPos);
|
||||
ReadDWORD(view, L"ThumbYPos", ThumbYPos);
|
||||
ReadDWORD(view, L"UnitSetting", UnitSetting);
|
||||
ReadDWORD(view, L"ShowStatusBar", ShowStatusBar);
|
||||
|
||||
ULONG pnBytes = sizeof(WINDOWPLACEMENT);
|
||||
view.QueryBinaryValue(_T("WindowPlacement"), &WindowPlacement, &pnBytes);
|
||||
view.QueryBinaryValue(L"WindowPlacement", &WindowPlacement, &pnBytes);
|
||||
}
|
||||
|
||||
CRegKey files;
|
||||
if (files.Open(paint, _T("Recent File List"), KEY_READ) == ERROR_SUCCESS)
|
||||
if (files.Open(paint, L"Recent File List", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
TCHAR szName[64];
|
||||
WCHAR szName[64];
|
||||
for (INT i = 0; i < MAX_RECENT_FILES; ++i)
|
||||
{
|
||||
wsprintf(szName, _T("File%u"), i + 1);
|
||||
StringCchPrintfW(szName, _countof(szName), L"File%u", i + 1);
|
||||
ReadString(files, szName, strFiles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
CRegKey text;
|
||||
if (text.Open(paint, _T("Text"), KEY_READ) == ERROR_SUCCESS)
|
||||
if (text.Open(paint, L"Text", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
ReadDWORD(text, _T("Bold"), Bold);
|
||||
ReadDWORD(text, _T("Italic"), Italic);
|
||||
ReadDWORD(text, _T("Underline"), Underline);
|
||||
ReadDWORD(text, _T("CharSet"), CharSet);
|
||||
ReadDWORD(text, _T("PointSize"), PointSize);
|
||||
ReadDWORD(text, _T("PositionX"), FontsPositionX);
|
||||
ReadDWORD(text, _T("PositionY"), FontsPositionY);
|
||||
ReadDWORD(text, _T("ShowTextTool"), ShowTextTool);
|
||||
ReadString(text, _T("TypeFaceName"), strFontName, strFontName);
|
||||
ReadDWORD(text, L"Bold", Bold);
|
||||
ReadDWORD(text, L"Italic", Italic);
|
||||
ReadDWORD(text, L"Underline", Underline);
|
||||
ReadDWORD(text, L"CharSet", CharSet);
|
||||
ReadDWORD(text, L"PointSize", PointSize);
|
||||
ReadDWORD(text, L"PositionX", FontsPositionX);
|
||||
ReadDWORD(text, L"PositionY", FontsPositionY);
|
||||
ReadDWORD(text, L"ShowTextTool", ShowTextTool);
|
||||
ReadString(text, L"TypeFaceName", strFontName, strFontName);
|
||||
}
|
||||
|
||||
CRegKey bar1;
|
||||
if (bar1.Open(paint, _T("General-Bar1"), KEY_READ) == ERROR_SUCCESS)
|
||||
if (bar1.Open(paint, L"General-Bar1", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
ReadDWORD(bar1, _T("BarID"), Bar1ID);
|
||||
ReadDWORD(bar1, L"BarID", Bar1ID);
|
||||
}
|
||||
|
||||
CRegKey bar2;
|
||||
if (bar2.Open(paint, _T("General-Bar2"), KEY_READ) == ERROR_SUCCESS)
|
||||
if (bar2.Open(paint, L"General-Bar2", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
ReadDWORD(bar2, _T("BarID"), Bar2ID);
|
||||
ReadDWORD(bar2, L"BarID", Bar2ID);
|
||||
}
|
||||
|
||||
CRegKey bar3;
|
||||
if (bar3.Open(paint, _T("General-Bar3"), KEY_READ) == ERROR_SUCCESS)
|
||||
if (bar3.Open(paint, L"General-Bar3", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
ReadDWORD(bar3, _T("Visible"), ShowToolBox);
|
||||
ReadDWORD(bar3, L"Visible", ShowToolBox);
|
||||
}
|
||||
|
||||
CRegKey bar4;
|
||||
if (bar4.Open(paint, _T("General-Bar4"), KEY_READ) == ERROR_SUCCESS)
|
||||
if (bar4.Open(paint, L"General-Bar4", KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
ReadDWORD(bar4, _T("Visible"), ShowPalette);
|
||||
ReadDWORD(bar4, L"Visible", ShowPalette);
|
||||
}
|
||||
|
||||
// Fix the bitmap size if too large
|
||||
@@ -179,79 +179,79 @@ void RegistrySettings::Store()
|
||||
BMPHeight = imageModel.GetHeight();
|
||||
|
||||
CRegKey paint;
|
||||
if (paint.Create(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint")) != ERROR_SUCCESS)
|
||||
if (paint.Create(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint") != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
CRegKey view;
|
||||
if (view.Create(paint, _T("View")) == ERROR_SUCCESS)
|
||||
if (view.Create(paint, L"View") == ERROR_SUCCESS)
|
||||
{
|
||||
view.SetDWORDValue(_T("BMPHeight"), BMPHeight);
|
||||
view.SetDWORDValue(_T("BMPWidth"), BMPWidth);
|
||||
view.SetDWORDValue(_T("GridExtent"), GridExtent);
|
||||
view.SetDWORDValue(_T("NoStretching"), NoStretching);
|
||||
view.SetDWORDValue(_T("ShowThumbnail"), ShowThumbnail);
|
||||
view.SetDWORDValue(_T("SnapToGrid"), SnapToGrid);
|
||||
view.SetDWORDValue(_T("ThumbHeight"), ThumbHeight);
|
||||
view.SetDWORDValue(_T("ThumbWidth"), ThumbWidth);
|
||||
view.SetDWORDValue(_T("ThumbXPos"), ThumbXPos);
|
||||
view.SetDWORDValue(_T("ThumbYPos"), ThumbYPos);
|
||||
view.SetDWORDValue(_T("UnitSetting"), UnitSetting);
|
||||
view.SetDWORDValue(_T("ShowStatusBar"), ShowStatusBar);
|
||||
view.SetDWORDValue(L"BMPHeight", BMPHeight);
|
||||
view.SetDWORDValue(L"BMPWidth", BMPWidth);
|
||||
view.SetDWORDValue(L"GridExtent", GridExtent);
|
||||
view.SetDWORDValue(L"NoStretching", NoStretching);
|
||||
view.SetDWORDValue(L"ShowThumbnail", ShowThumbnail);
|
||||
view.SetDWORDValue(L"SnapToGrid", SnapToGrid);
|
||||
view.SetDWORDValue(L"ThumbHeight", ThumbHeight);
|
||||
view.SetDWORDValue(L"ThumbWidth", ThumbWidth);
|
||||
view.SetDWORDValue(L"ThumbXPos", ThumbXPos);
|
||||
view.SetDWORDValue(L"ThumbYPos", ThumbYPos);
|
||||
view.SetDWORDValue(L"UnitSetting", UnitSetting);
|
||||
view.SetDWORDValue(L"ShowStatusBar", ShowStatusBar);
|
||||
|
||||
view.SetBinaryValue(_T("WindowPlacement"), &WindowPlacement, sizeof(WINDOWPLACEMENT));
|
||||
view.SetBinaryValue(L"WindowPlacement", &WindowPlacement, sizeof(WINDOWPLACEMENT));
|
||||
}
|
||||
|
||||
CRegKey files;
|
||||
if (files.Create(paint, _T("Recent File List")) == ERROR_SUCCESS)
|
||||
if (files.Create(paint, L"Recent File List") == ERROR_SUCCESS)
|
||||
{
|
||||
TCHAR szName[64];
|
||||
WCHAR szName[64];
|
||||
for (INT iFile = 0; iFile < MAX_RECENT_FILES; ++iFile)
|
||||
{
|
||||
wsprintf(szName, _T("File%u"), iFile + 1);
|
||||
StringCchPrintfW(szName, _countof(szName), L"File%u", iFile + 1);
|
||||
files.SetStringValue(szName, strFiles[iFile]);
|
||||
}
|
||||
}
|
||||
|
||||
CRegKey text;
|
||||
if (text.Create(paint, _T("Text")) == ERROR_SUCCESS)
|
||||
if (text.Create(paint, L"Text") == ERROR_SUCCESS)
|
||||
{
|
||||
text.SetDWORDValue(_T("Bold"), Bold);
|
||||
text.SetDWORDValue(_T("Italic"), Italic);
|
||||
text.SetDWORDValue(_T("Underline"), Underline);
|
||||
text.SetDWORDValue(_T("CharSet"), CharSet);
|
||||
text.SetDWORDValue(_T("PointSize"), PointSize);
|
||||
text.SetDWORDValue(_T("PositionX"), FontsPositionX);
|
||||
text.SetDWORDValue(_T("PositionY"), FontsPositionY);
|
||||
text.SetDWORDValue(_T("ShowTextTool"), ShowTextTool);
|
||||
text.SetStringValue(_T("TypeFaceName"), strFontName);
|
||||
text.SetDWORDValue(L"Bold", Bold);
|
||||
text.SetDWORDValue(L"Italic", Italic);
|
||||
text.SetDWORDValue(L"Underline", Underline);
|
||||
text.SetDWORDValue(L"CharSet", CharSet);
|
||||
text.SetDWORDValue(L"PointSize", PointSize);
|
||||
text.SetDWORDValue(L"PositionX", FontsPositionX);
|
||||
text.SetDWORDValue(L"PositionY", FontsPositionY);
|
||||
text.SetDWORDValue(L"ShowTextTool", ShowTextTool);
|
||||
text.SetStringValue(L"TypeFaceName", strFontName);
|
||||
}
|
||||
|
||||
CRegKey bar1;
|
||||
if (bar1.Create(paint, _T("General-Bar1")) == ERROR_SUCCESS)
|
||||
if (bar1.Create(paint, L"General-Bar1") == ERROR_SUCCESS)
|
||||
{
|
||||
bar1.SetDWORDValue(_T("BarID"), Bar1ID);
|
||||
bar1.SetDWORDValue(L"BarID", Bar1ID);
|
||||
}
|
||||
|
||||
CRegKey bar2;
|
||||
if (bar2.Create(paint, _T("General-Bar2")) == ERROR_SUCCESS)
|
||||
if (bar2.Create(paint, L"General-Bar2") == ERROR_SUCCESS)
|
||||
{
|
||||
bar2.SetDWORDValue(_T("BarID"), Bar2ID);
|
||||
bar2.SetDWORDValue(L"BarID", Bar2ID);
|
||||
}
|
||||
|
||||
CRegKey bar3;
|
||||
if (bar3.Create(paint, _T("General-Bar3")) == ERROR_SUCCESS)
|
||||
if (bar3.Create(paint, L"General-Bar3") == ERROR_SUCCESS)
|
||||
{
|
||||
bar3.SetDWORDValue(_T("Visible"), ShowToolBox);
|
||||
bar3.SetDWORDValue(L"Visible", ShowToolBox);
|
||||
}
|
||||
|
||||
CRegKey bar4;
|
||||
if (bar4.Create(paint, _T("General-Bar4")) == ERROR_SUCCESS)
|
||||
if (bar4.Create(paint, L"General-Bar4") == ERROR_SUCCESS)
|
||||
{
|
||||
bar4.SetDWORDValue(_T("Visible"), ShowPalette);
|
||||
bar4.SetDWORDValue(L"Visible", ShowPalette);
|
||||
}
|
||||
}
|
||||
|
||||
void RegistrySettings::SetMostRecentFile(LPCTSTR szPathName)
|
||||
void RegistrySettings::SetMostRecentFile(LPCWSTR szPathName)
|
||||
{
|
||||
// Register the file to the user's 'Recent' folder
|
||||
if (szPathName && szPathName[0])
|
||||
@@ -265,7 +265,7 @@ void RegistrySettings::SetMostRecentFile(LPCTSTR szPathName)
|
||||
|
||||
if (iFound >= 0)
|
||||
{
|
||||
CString tmp = strFiles[i];
|
||||
CStringW tmp = strFiles[i];
|
||||
strFiles[i] = strFiles[i - 1];
|
||||
strFiles[i - 1] = tmp;
|
||||
}
|
||||
|
@@ -28,9 +28,9 @@ public:
|
||||
DWORD UnitSetting;
|
||||
WINDOWPLACEMENT WindowPlacement;
|
||||
|
||||
CString strFiles[MAX_RECENT_FILES];
|
||||
CStringW strFiles[MAX_RECENT_FILES];
|
||||
|
||||
CString strFontName;
|
||||
CStringW strFontName;
|
||||
DWORD PointSize;
|
||||
DWORD Bold;
|
||||
DWORD Italic;
|
||||
@@ -61,9 +61,9 @@ public:
|
||||
STRETCHED
|
||||
};
|
||||
|
||||
static void SetWallpaper(LPCTSTR szFileName, WallpaperStyle style);
|
||||
static void SetWallpaper(LPCWSTR szFileName, WallpaperStyle style);
|
||||
|
||||
void Load(INT nCmdShow);
|
||||
void Store();
|
||||
void SetMostRecentFile(LPCTSTR szPathName);
|
||||
void SetMostRecentFile(LPCWSTR szPathName);
|
||||
};
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#define IDC_ZOOM 532
|
||||
#define IDC_PEN 533
|
||||
#define IDC_AIRBRUSH 534
|
||||
#define IDC_HANDDRAG 535
|
||||
|
||||
#define IDI_HORZSTRETCH 535
|
||||
#define IDI_VERTSTRETCH 536
|
||||
|
@@ -8,7 +8,7 @@
|
||||
/* INCLUDES *********************************************************/
|
||||
|
||||
#include <windef.h>
|
||||
#include <winuser.h>
|
||||
#include <winuser.rh>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "resource.h"
|
||||
@@ -21,23 +21,24 @@
|
||||
|
||||
/* Icons */
|
||||
|
||||
IDI_APPICON ICON "icons/paint.ico"
|
||||
IDI_APPICON ICON "img/paint.ico"
|
||||
|
||||
IDB_TOOLBARICONS BITMAP "icons/iconbar.bmp"
|
||||
IDB_TOOLBARICONS BITMAP "img/iconbar.bmp"
|
||||
|
||||
IDI_TRANSPARENT ICON "icons/transparent.ico"
|
||||
IDI_NONTRANSPARENT ICON "icons/nontransparent.ico"
|
||||
IDI_TRANSPARENT ICON "img/transparent.ico"
|
||||
IDI_NONTRANSPARENT ICON "img/nontransparent.ico"
|
||||
|
||||
IDC_FILL ICON "icons/fill_cur.ico"
|
||||
IDC_COLOR ICON "icons/color_cur.ico"
|
||||
IDC_ZOOM ICON "icons/zoom_cur.ico"
|
||||
IDC_PEN ICON "icons/pen_cur.ico"
|
||||
IDC_AIRBRUSH ICON "icons/airbrush_cur.ico"
|
||||
IDC_FILL CURSOR "img/fill.cur"
|
||||
IDC_COLOR CURSOR "img/color.cur"
|
||||
IDC_ZOOM CURSOR "img/zoom.cur"
|
||||
IDC_PEN CURSOR "img/pen.cur"
|
||||
IDC_AIRBRUSH CURSOR "img/airbrush.cur"
|
||||
IDC_HANDDRAG CURSOR "img/handdrag.cur"
|
||||
|
||||
IDI_HORZSTRETCH ICON "icons/horzstretch.ico"
|
||||
IDI_VERTSTRETCH ICON "icons/vertstretch.ico"
|
||||
IDI_HORZSKEW ICON "icons/horzskew.ico"
|
||||
IDI_VERTSKEW ICON "icons/vertskew.ico"
|
||||
IDI_HORZSTRETCH ICON "img/horzstretch.ico"
|
||||
IDI_VERTSTRETCH ICON "img/vertstretch.ico"
|
||||
IDI_HORZSKEW ICON "img/horzskew.ico"
|
||||
IDI_VERTSKEW ICON "img/vertskew.ico"
|
||||
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "mspaint.exe.manifest"
|
||||
|
||||
|
@@ -139,7 +139,7 @@ void SelectionModel::DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTranspar
|
||||
return;
|
||||
|
||||
BITMAP bm;
|
||||
if (!GetObject(m_hbmColor, sizeof(BITMAP), &bm))
|
||||
if (!GetObjectW(m_hbmColor, sizeof(BITMAP), &bm))
|
||||
return;
|
||||
|
||||
COLORREF keyColor = (bBgTransparent ? crBg : CLR_INVALID);
|
||||
@@ -152,16 +152,19 @@ void SelectionModel::DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTranspar
|
||||
DeleteDC(hMemDC);
|
||||
}
|
||||
|
||||
void SelectionModel::GetSelectionContents(HDC hDCImage)
|
||||
HBITMAP SelectionModel::GetSelectionContents()
|
||||
{
|
||||
ClearColorImage();
|
||||
if (m_hbmColor)
|
||||
return CopyDIBImage(m_hbmColor, m_rc.Width(), m_rc.Height());
|
||||
|
||||
HDC hMemDC = ::CreateCompatibleDC(NULL);
|
||||
m_hbmColor = CreateColorDIB(m_rc.Width(), m_rc.Height(), RGB(255, 255, 255));
|
||||
HGDIOBJ hbmOld = ::SelectObject(hMemDC, m_hbmColor);
|
||||
::BitBlt(hMemDC, 0, 0, m_rc.Width(), m_rc.Height(), hDCImage, m_rc.left, m_rc.top, SRCCOPY);
|
||||
HBITMAP hBitmap = CreateColorDIB(m_rc.Width(), m_rc.Height(), RGB(255, 255, 255));
|
||||
HGDIOBJ hbmOld = ::SelectObject(hMemDC, hBitmap);
|
||||
::BitBlt(hMemDC, 0, 0, m_rc.Width(), m_rc.Height(), imageModel.GetDC(), m_rc.left, m_rc.top, SRCCOPY);
|
||||
::SelectObject(hMemDC, hbmOld);
|
||||
::DeleteDC(hMemDC);
|
||||
|
||||
return hBitmap;
|
||||
}
|
||||
|
||||
BOOL SelectionModel::IsLanded() const
|
||||
@@ -178,7 +181,8 @@ BOOL SelectionModel::TakeOff()
|
||||
m_rgbBack = paletteModel.GetBgColor();
|
||||
|
||||
// Get the contents of the selection area
|
||||
GetSelectionContents(imageModel.GetDC());
|
||||
ClearColorImage();
|
||||
m_hbmColor = GetSelectionContents();
|
||||
|
||||
// RectSel doesn't need the mask image
|
||||
if (toolsModel.GetActiveTool() == TOOL_RECTSEL)
|
||||
@@ -406,13 +410,6 @@ void SelectionModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int
|
||||
NotifyContentChanged();
|
||||
}
|
||||
|
||||
HBITMAP SelectionModel::CopyBitmap()
|
||||
{
|
||||
if (m_hbmColor == NULL)
|
||||
GetSelectionContents(imageModel.GetDC());
|
||||
return CopyDIBImage(m_hbmColor);
|
||||
}
|
||||
|
||||
int SelectionModel::PtStackSize() const
|
||||
{
|
||||
return m_iPtSP;
|
||||
@@ -519,7 +516,7 @@ void SelectionModel::InvertSelection()
|
||||
TakeOff();
|
||||
|
||||
BITMAP bm;
|
||||
::GetObject(m_hbmColor, sizeof(bm), &bm);
|
||||
::GetObjectW(m_hbmColor, sizeof(bm), &bm);
|
||||
|
||||
HDC hdc = ::CreateCompatibleDC(NULL);
|
||||
HGDIOBJ hbmOld = ::SelectObject(hdc, m_hbmColor);
|
||||
@@ -545,18 +542,6 @@ void SelectionModel::SwapWidthAndHeight()
|
||||
m_rc.bottom = m_rc.top + cx;
|
||||
}
|
||||
|
||||
HBITMAP SelectionModel::LockBitmap()
|
||||
{
|
||||
HBITMAP hbm = m_hbmColor;
|
||||
m_hbmColor = NULL;
|
||||
return hbm;
|
||||
}
|
||||
|
||||
void SelectionModel::UnlockBitmap(HBITMAP hbmLocked)
|
||||
{
|
||||
m_hbmColor = hbmLocked;
|
||||
}
|
||||
|
||||
void SelectionModel::StretchSelection(BOOL bShrink)
|
||||
{
|
||||
if (!m_bShow)
|
||||
|
@@ -40,10 +40,7 @@ public:
|
||||
void HideSelection();
|
||||
void DeleteSelection();
|
||||
|
||||
HBITMAP CopyBitmap();
|
||||
HBITMAP LockBitmap();
|
||||
void UnlockBitmap(HBITMAP hbmLocked);
|
||||
void GetSelectionContents(HDC hDCImage);
|
||||
HBITMAP GetSelectionContents();
|
||||
void DrawFramePoly(HDC hDCImage);
|
||||
void DrawBackground(HDC hDCImage);
|
||||
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg);
|
||||
|
@@ -21,7 +21,7 @@ BOOL setCursorOnSizeBox(HITTEST hit)
|
||||
{
|
||||
if (HIT_UPPER_LEFT <= hit && hit <= HIT_LOWER_RIGHT)
|
||||
{
|
||||
::SetCursor(::LoadCursor(NULL, s_cursor_shapes[hit - HIT_UPPER_LEFT]));
|
||||
::SetCursor(::LoadCursorW(NULL, s_cursor_shapes[hit - HIT_UPPER_LEFT]));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@@ -44,9 +44,9 @@ void CTextEditWindow::DrawGrip(HDC hDC, RECT& rc)
|
||||
drawSizeBoxes(hDC, &rc, TRUE, NULL);
|
||||
}
|
||||
|
||||
void CTextEditWindow::FixEditPos(LPCTSTR pszOldText)
|
||||
void CTextEditWindow::FixEditPos(LPCWSTR pszOldText)
|
||||
{
|
||||
CString szText;
|
||||
CStringW szText;
|
||||
GetWindowText(szText);
|
||||
|
||||
RECT rcParent;
|
||||
@@ -62,10 +62,10 @@ void CTextEditWindow::FixEditPos(LPCTSTR pszOldText)
|
||||
SelectObject(hDC, m_hFontZoomed);
|
||||
TEXTMETRIC tm;
|
||||
GetTextMetrics(hDC, &tm);
|
||||
szText += TEXT("x"); // This is a trick to enable the g_ptEnd newlines
|
||||
szText += L"x"; // This is a trick to enable the g_ptEnd newlines
|
||||
const UINT uFormat = DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP |
|
||||
DT_EXPANDTABS | DT_WORDBREAK;
|
||||
DrawText(hDC, szText, -1, &rcText, uFormat | DT_CALCRECT);
|
||||
DrawTextW(hDC, szText, -1, &rcText, uFormat | DT_CALCRECT);
|
||||
if (tm.tmDescent > 0)
|
||||
rcText.bottom += tm.tmDescent;
|
||||
ReleaseDC(hDC);
|
||||
@@ -91,7 +91,7 @@ LRESULT CTextEditWindow::OnChar(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
|
||||
if (wParam == VK_TAB)
|
||||
return 0; // FIXME: Tabs
|
||||
|
||||
CString szText;
|
||||
CStringW szText;
|
||||
GetWindowText(szText);
|
||||
|
||||
LRESULT ret = DefWindowProc(nMsg, wParam, lParam);
|
||||
@@ -104,11 +104,11 @@ LRESULT CTextEditWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
||||
{
|
||||
if (wParam == VK_ESCAPE)
|
||||
{
|
||||
toolsModel.OnCancelDraw();
|
||||
toolsModel.OnEndDraw(TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CString szText;
|
||||
CStringW szText;
|
||||
GetWindowText(szText);
|
||||
|
||||
LRESULT ret = DefWindowProc(nMsg, wParam, lParam);
|
||||
@@ -135,7 +135,7 @@ LRESULT CTextEditWindow::OnEraseBkGnd(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||
FillRect(hDC, &rc, hbr);
|
||||
DeleteObject(hbr);
|
||||
}
|
||||
SetTextColor(hDC, paletteModel.GetFgColor());
|
||||
::SetTextColor(hDC, paletteModel.GetFgColor());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ LRESULT CTextEditWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
|
||||
UINT nHitTest = LOWORD(lParam);
|
||||
if (nHitTest == HTCAPTION)
|
||||
{
|
||||
::SetCursor(::LoadCursor(NULL, IDC_SIZEALL)); // Enable drag move
|
||||
::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_SIZEALL)); // Enable drag move
|
||||
return FALSE;
|
||||
}
|
||||
return DefWindowProc(nMsg, wParam, lParam);
|
||||
@@ -336,13 +336,13 @@ void CTextEditWindow::UpdateFont()
|
||||
m_hFontZoomed = NULL;
|
||||
}
|
||||
|
||||
LOGFONT lf;
|
||||
LOGFONTW lf;
|
||||
ZeroMemory(&lf, sizeof(lf));
|
||||
lf.lfCharSet = DEFAULT_CHARSET; // registrySettings.CharSet; // Ignore
|
||||
lf.lfWeight = (registrySettings.Bold ? FW_BOLD : FW_NORMAL);
|
||||
lf.lfItalic = registrySettings.Italic;
|
||||
lf.lfUnderline = registrySettings.Underline;
|
||||
lstrcpyn(lf.lfFaceName, registrySettings.strFontName, _countof(lf.lfFaceName));
|
||||
lf.lfItalic = (BYTE)registrySettings.Italic;
|
||||
lf.lfUnderline = (BYTE)registrySettings.Underline;
|
||||
StringCchCopyW(lf.lfFaceName, _countof(lf.lfFaceName), registrySettings.strFontName);
|
||||
|
||||
HDC hdc = GetDC();
|
||||
if (hdc)
|
||||
@@ -493,7 +493,7 @@ LRESULT CTextEditWindow::OnSizing(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||
|
||||
LRESULT CTextEditWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
return ::SendMessage(GetParent(), nMsg, wParam, lParam);
|
||||
return ::SendMessageW(GetParent(), nMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CTextEditWindow::OnCut(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
|
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
HWND Create(HWND hwndParent);
|
||||
void DoFillBack(HWND hwnd, HDC hDC);
|
||||
void FixEditPos(LPCTSTR pszOldText);
|
||||
void FixEditPos(LPCWSTR pszOldText);
|
||||
void InvalidateEditRect();
|
||||
void UpdateFont();
|
||||
BOOL GetEditRect(LPRECT prc) const;
|
||||
|
@@ -20,12 +20,12 @@ CPaintToolBar::ToolBarWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
{
|
||||
// We have to detect clicking on toolbar even if no change of pressed button
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
INT index = (INT)::SendMessage(hwnd, TB_HITTEST, 0, (LPARAM)&pt);
|
||||
INT index = (INT)::SendMessageW(hwnd, TB_HITTEST, 0, (LPARAM)&pt);
|
||||
if (index >= 0)
|
||||
{
|
||||
TBBUTTON button;
|
||||
if (::SendMessage(hwnd, TB_GETBUTTON, index, (LPARAM)&button))
|
||||
::PostMessage(::GetParent(hwnd), WM_COMMAND, button.idCommand, 0);
|
||||
if (::SendMessageW(hwnd, TB_GETBUTTON, index, (LPARAM)&button))
|
||||
::PostMessageW(::GetParent(hwnd), WM_COMMAND, button.idCommand, 0);
|
||||
}
|
||||
}
|
||||
return ::CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
@@ -34,29 +34,34 @@ CPaintToolBar::ToolBarWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
BOOL CPaintToolBar::DoCreate(HWND hwndParent)
|
||||
{
|
||||
// NOTE: The horizontal line above the toolbar is hidden by CCS_NODIVIDER style.
|
||||
RECT toolbarPos = { 0, 0, CX_TOOLBAR, CY_TOOLBAR };
|
||||
RECT toolbarPos =
|
||||
{
|
||||
0, 0,
|
||||
CX_TOOLBAR + 2 * GetSystemMetrics(SM_CXBORDER),
|
||||
CY_TOOLBAR + 2 * GetSystemMetrics(SM_CYBORDER)
|
||||
};
|
||||
DWORD style = WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN | CCS_VERT | CCS_NORESIZE |
|
||||
TBSTYLE_TOOLTIPS | TBSTYLE_FLAT;
|
||||
if (!CWindow::Create(TOOLBARCLASSNAME, hwndParent, toolbarPos, NULL, style))
|
||||
if (!CWindow::Create(TOOLBARCLASSNAMEW, hwndParent, toolbarPos, NULL, style))
|
||||
return FALSE;
|
||||
|
||||
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 16, 0);
|
||||
SendMessage(TB_SETIMAGELIST, 0, (LPARAM)hImageList);
|
||||
|
||||
HBITMAP hbmIcons = (HBITMAP)::LoadImage(g_hinstExe, MAKEINTRESOURCE(IDB_TOOLBARICONS),
|
||||
IMAGE_BITMAP, 256, 16, 0);
|
||||
HBITMAP hbmIcons = (HBITMAP)::LoadImageW(g_hinstExe, MAKEINTRESOURCEW(IDB_TOOLBARICONS),
|
||||
IMAGE_BITMAP, 256, 16, 0);
|
||||
ImageList_AddMasked(hImageList, hbmIcons, RGB(255, 0, 255));
|
||||
::DeleteObject(hbmIcons);
|
||||
|
||||
SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||
|
||||
TCHAR szToolTip[30];
|
||||
WCHAR szToolTip[30];
|
||||
TBBUTTON tbbutton;
|
||||
ZeroMemory(&tbbutton, sizeof(tbbutton));
|
||||
tbbutton.fsStyle = TBSTYLE_CHECKGROUP;
|
||||
for (INT i = 0; i < NUM_TOOLS; i++)
|
||||
{
|
||||
::LoadString(g_hinstExe, IDS_TOOLTIP1 + i, szToolTip, _countof(szToolTip));
|
||||
::LoadStringW(g_hinstExe, IDS_TOOLTIP1 + i, szToolTip, _countof(szToolTip));
|
||||
tbbutton.iString = (INT_PTR)szToolTip;
|
||||
tbbutton.fsState = TBSTATE_ENABLED | ((i % 2 == 1) ? TBSTATE_WRAP : 0);
|
||||
tbbutton.idCommand = ID_FREESEL + i;
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
class CToolBox : public CWindowImpl<CToolBox>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("ToolBox"), CS_DBLCLKS, COLOR_BTNFACE)
|
||||
DECLARE_WND_CLASS_EX(L"ToolBox", CS_DBLCLKS, COLOR_BTNFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CToolBox)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
|
@@ -21,6 +21,10 @@
|
||||
#define MARGIN1 3
|
||||
#define MARGIN2 2
|
||||
|
||||
#define MAX_ZOOM_TRACK 6
|
||||
#define MIN_ZOOM_TRACK 0
|
||||
#define DEFAULT_ZOOM_TRACK 3
|
||||
|
||||
static const BYTE s_AirRadius[4] = { 5, 8, 3, 12 };
|
||||
|
||||
CToolSettingsWindow toolSettingsWindow;
|
||||
@@ -277,18 +281,21 @@ VOID CToolSettingsWindow::drawBox(HDC hdc, LPCRECT prc)
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CToolSettingsWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, WINBOOL& bHandled)
|
||||
LRESULT CToolSettingsWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
/* preloading the draw transparent/nontransparent icons for later use */
|
||||
m_hNontranspIcon = (HICON)LoadImage(g_hinstExe, MAKEINTRESOURCE(IDI_NONTRANSPARENT),
|
||||
IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR);
|
||||
m_hTranspIcon = (HICON)LoadImage(g_hinstExe, MAKEINTRESOURCE(IDI_TRANSPARENT),
|
||||
IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR);
|
||||
m_hNontranspIcon = (HICON)LoadImageW(g_hinstExe, MAKEINTRESOURCEW(IDI_NONTRANSPARENT),
|
||||
IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR);
|
||||
m_hTranspIcon = (HICON)LoadImageW(g_hinstExe, MAKEINTRESOURCEW(IDI_TRANSPARENT),
|
||||
IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR);
|
||||
|
||||
RECT trackbarZoomPos, rect2;
|
||||
calculateTwoBoxes(trackbarZoomPos, rect2);
|
||||
::InflateRect(&trackbarZoomPos, -1, -1);
|
||||
|
||||
RECT trackbarZoomPos = {1, 1, 1 + 40, 1 + 64};
|
||||
trackbarZoom.Create(TRACKBAR_CLASS, m_hWnd, trackbarZoomPos, NULL, WS_CHILD | TBS_VERT | TBS_AUTOTICKS);
|
||||
trackbarZoom.SendMessage(TBM_SETRANGE, (WPARAM) TRUE, MAKELPARAM(0, 6));
|
||||
trackbarZoom.SendMessage(TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 3);
|
||||
trackbarZoom.SendMessage(TBM_SETRANGE, TRUE, MAKELPARAM(MIN_ZOOM_TRACK, MAX_ZOOM_TRACK));
|
||||
trackbarZoom.SendMessage(TBM_SETPOS, TRUE, DEFAULT_ZOOM_TRACK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -301,9 +308,30 @@ LRESULT CToolSettingsWindow::OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam,
|
||||
|
||||
LRESULT CToolSettingsWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (!zoomTo(125 << trackbarZoom.SendMessage(TBM_GETPOS, 0, 0), 0, 0))
|
||||
INT trackPos = MAX_ZOOM_TRACK - (INT)trackbarZoom.SendMessage(TBM_GETPOS, 0, 0);
|
||||
canvasWindow.zoomTo(MIN_ZOOM << trackPos);
|
||||
|
||||
INT zoomRate = toolsModel.GetZoom();
|
||||
|
||||
CStringW strZoom;
|
||||
if (zoomRate % 10 == 0)
|
||||
strZoom.Format(L"%d%%", zoomRate / 10);
|
||||
else
|
||||
strZoom.Format(L"%d.%d%%", zoomRate / 10, zoomRate % 10);
|
||||
|
||||
::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strZoom);
|
||||
|
||||
OnToolsModelZoomChanged(nMsg, wParam, lParam, bHandled);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CToolSettingsWindow::OnNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
NMHDR *pnmhdr = (NMHDR*)lParam;
|
||||
if (pnmhdr->code == NM_CUSTOMDRAW)
|
||||
{
|
||||
OnToolsModelZoomChanged(nMsg, wParam, lParam, bHandled);
|
||||
NMCUSTOMDRAW *pCustomDraw = (NMCUSTOMDRAW*)pnmhdr;
|
||||
pCustomDraw->uItemState &= ~CDIS_FOCUS; // Do not draw the focus
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -330,9 +358,7 @@ LRESULT CToolSettingsWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = BeginPaint(&ps);
|
||||
|
||||
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
|
||||
::DrawEdge(hdc, &rect1, BDR_SUNKENOUTER, BF_RECT);
|
||||
else
|
||||
if (toolsModel.GetActiveTool() != TOOL_ZOOM)
|
||||
::DrawEdge(hdc, &rect1, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
|
||||
|
||||
if (toolsModel.GetActiveTool() >= TOOL_RECT)
|
||||
@@ -458,7 +484,7 @@ LRESULT CToolSettingsWindow::OnToolsModelSettingsChanged(UINT nMsg, WPARAM wPara
|
||||
|
||||
LRESULT CToolSettingsWindow::OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
int tbPos = 0;
|
||||
int tbPos = MIN_ZOOM_TRACK;
|
||||
int tempZoom = toolsModel.GetZoom();
|
||||
|
||||
while (tempZoom > MIN_ZOOM)
|
||||
@@ -466,6 +492,7 @@ LRESULT CToolSettingsWindow::OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, L
|
||||
tbPos++;
|
||||
tempZoom = tempZoom >> 1;
|
||||
}
|
||||
trackbarZoom.SendMessage(TBM_SETPOS, (WPARAM) TRUE, (LPARAM) tbPos);
|
||||
|
||||
trackbarZoom.SendMessage(TBM_SETPOS, TRUE, MAX_ZOOM_TRACK - tbPos);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -10,13 +10,14 @@
|
||||
class CToolSettingsWindow : public CWindowImpl<CToolSettingsWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("ToolSettings"), CS_DBLCLKS, COLOR_BTNFACE)
|
||||
DECLARE_WND_CLASS_EX(L"ToolSettings", CS_DBLCLKS, COLOR_BTNFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CToolSettingsWindow)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, OnVScroll)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
|
||||
MESSAGE_HANDLER(WM_TOOLSMODELTOOLCHANGED, OnToolsModelToolChanged)
|
||||
MESSAGE_HANDLER(WM_TOOLSMODELSETTINGSCHANGED, OnToolsModelSettingsChanged)
|
||||
MESSAGE_HANDLER(WM_TOOLSMODELZOOMCHANGED, OnToolsModelZoomChanged)
|
||||
@@ -43,6 +44,7 @@ private:
|
||||
LRESULT OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnToolsModelToolChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnToolsModelSettingsChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
|
@@ -22,22 +22,20 @@ ToolsModel::ToolsModel()
|
||||
m_rubberRadius = 4;
|
||||
m_transpBg = FALSE;
|
||||
m_zoom = 1000;
|
||||
ZeroMemory(&m_tools, sizeof(m_tools));
|
||||
m_pToolObject = GetOrCreateTool(m_activeTool);
|
||||
}
|
||||
|
||||
ToolsModel::~ToolsModel()
|
||||
{
|
||||
for (size_t i = 0; i < _countof(m_tools); ++i)
|
||||
delete m_tools[i];
|
||||
delete m_pToolObject;
|
||||
m_pToolObject = NULL;
|
||||
}
|
||||
|
||||
ToolBase *ToolsModel::GetOrCreateTool(TOOLTYPE nTool)
|
||||
{
|
||||
if (!m_tools[nTool])
|
||||
m_tools[nTool] = ToolBase::createToolObject(nTool);
|
||||
|
||||
return m_tools[nTool];
|
||||
delete m_pToolObject;
|
||||
m_pToolObject = ToolBase::createToolObject(nTool);
|
||||
return m_pToolObject;
|
||||
}
|
||||
|
||||
BOOL ToolsModel::IsSelection() const
|
||||
@@ -145,7 +143,7 @@ TOOLTYPE ToolsModel::GetOldActiveTool() const
|
||||
|
||||
void ToolsModel::SetActiveTool(TOOLTYPE nActiveTool)
|
||||
{
|
||||
OnFinishDraw();
|
||||
OnEndDraw(FALSE);
|
||||
|
||||
selectionModel.Landing();
|
||||
|
||||
@@ -257,63 +255,6 @@ void ToolsModel::NotifyZoomChanged()
|
||||
canvasWindow.SendMessage(WM_TOOLSMODELZOOMCHANGED);
|
||||
}
|
||||
|
||||
void ToolsModel::OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
|
||||
{
|
||||
m_pToolObject->beginEvent();
|
||||
g_ptStart.x = g_ptEnd.x = x;
|
||||
g_ptStart.y = g_ptEnd.y = y;
|
||||
m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick);
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
|
||||
{
|
||||
m_pToolObject->beginEvent();
|
||||
if (m_pToolObject->OnMouseMove(bLeftButton, x, y))
|
||||
{
|
||||
g_ptEnd.x = x;
|
||||
g_ptEnd.y = y;
|
||||
}
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
|
||||
{
|
||||
m_pToolObject->beginEvent();
|
||||
if (m_pToolObject->OnButtonUp(bLeftButton, x, y))
|
||||
{
|
||||
g_ptEnd.x = x;
|
||||
g_ptEnd.y = y;
|
||||
}
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnCancelDraw()
|
||||
{
|
||||
ATLTRACE("ToolsModel::OnCancelDraw()\n");
|
||||
m_pToolObject->beginEvent();
|
||||
m_pToolObject->OnCancelDraw();
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnFinishDraw()
|
||||
{
|
||||
ATLTRACE("ToolsModel::OnFinishDraw()\n");
|
||||
m_pToolObject->beginEvent();
|
||||
m_pToolObject->OnFinishDraw();
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
void ToolsModel::OnDrawOverlayOnImage(HDC hdc)
|
||||
{
|
||||
m_pToolObject->OnDrawOverlayOnImage(hdc);
|
||||
}
|
||||
|
||||
void ToolsModel::OnDrawOverlayOnCanvas(HDC hdc)
|
||||
{
|
||||
m_pToolObject->OnDrawOverlayOnCanvas(hdc);
|
||||
}
|
||||
|
||||
void ToolsModel::resetTool()
|
||||
{
|
||||
m_pToolObject->reset();
|
||||
@@ -326,8 +267,3 @@ void ToolsModel::selectAll()
|
||||
OnMouseMove(TRUE, imageModel.GetWidth(), imageModel.GetHeight());
|
||||
OnButtonUp(TRUE, imageModel.GetWidth(), imageModel.GetHeight());
|
||||
}
|
||||
|
||||
void ToolsModel::SpecialTweak(BOOL bMinus)
|
||||
{
|
||||
m_pToolObject->OnSpecialTweak(bMinus);
|
||||
}
|
||||
|
@@ -53,14 +53,13 @@ struct ToolBase
|
||||
virtual BOOL OnMouseMove(BOOL bLeftButton, LONG& x, LONG& y) { return TRUE; }
|
||||
virtual BOOL OnButtonUp(BOOL bLeftButton, LONG& x, LONG& y) { return TRUE; }
|
||||
|
||||
virtual void OnCancelDraw();
|
||||
virtual void OnFinishDraw();
|
||||
|
||||
virtual void OnDrawOverlayOnImage(HDC hdc) { }
|
||||
virtual void OnDrawOverlayOnCanvas(HDC hdc) { }
|
||||
|
||||
virtual void OnSpecialTweak(BOOL bMinus) { }
|
||||
|
||||
virtual void OnEndDraw(BOOL bCancel);
|
||||
|
||||
void beginEvent();
|
||||
void endEvent();
|
||||
void reset();
|
||||
@@ -85,7 +84,6 @@ private:
|
||||
int m_rubberRadius;
|
||||
BOOL m_transpBg;
|
||||
int m_zoom;
|
||||
ToolBase* m_tools[TOOL_MAX + 1];
|
||||
ToolBase *m_pToolObject;
|
||||
|
||||
ToolBase *GetOrCreateTool(TOOLTYPE nTool);
|
||||
@@ -135,8 +133,7 @@ public:
|
||||
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick);
|
||||
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y);
|
||||
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y);
|
||||
void OnCancelDraw();
|
||||
void OnFinishDraw();
|
||||
void OnEndDraw(BOOL bCancel);
|
||||
void OnDrawOverlayOnImage(HDC hdc);
|
||||
void OnDrawOverlayOnCanvas(HDC hdc);
|
||||
|
||||
@@ -148,6 +145,8 @@ public:
|
||||
void NotifyZoomChanged();
|
||||
|
||||
void SpecialTweak(BOOL bMinus);
|
||||
|
||||
void DrawWithMouseTool(POINT pt, WPARAM wParam);
|
||||
};
|
||||
|
||||
extern ToolsModel toolsModel;
|
||||
|
@@ -29,7 +29,7 @@ static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_P
|
||||
{
|
||||
// The function loads the system library, not local
|
||||
GetSystemDirectoryW(szPath, _countof(szPath));
|
||||
wcscat(szPath, L"\\hhctrl.ocx");
|
||||
StringCchCatW(szPath, _countof(szPath), L"\\hhctrl.ocx");
|
||||
s_hHHCTRL_OCX = LoadLibraryW(szPath);
|
||||
if (s_hHHCTRL_OCX)
|
||||
s_pHtmlHelpW = (FN_HtmlHelpW)GetProcAddress(s_hHHCTRL_OCX, "HtmlHelpW");
|
||||
@@ -41,37 +41,6 @@ static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_P
|
||||
return s_pHtmlHelpW(hwndCaller, pszFile, uCommand, dwData);
|
||||
}
|
||||
|
||||
BOOL
|
||||
zoomTo(int newZoom, int mouseX, int mouseY)
|
||||
{
|
||||
int x, y, w, h;
|
||||
RECT clientRectScrollbox;
|
||||
canvasWindow.GetClientRect(&clientRectScrollbox);
|
||||
|
||||
RECT clientRectImageArea;
|
||||
::SetRect(&clientRectImageArea, 0, 0, imageModel.GetWidth(), imageModel.GetHeight());
|
||||
Zoomed(clientRectImageArea);
|
||||
|
||||
w = clientRectImageArea.right * newZoom / toolsModel.GetZoom();
|
||||
h = clientRectImageArea.bottom * newZoom / toolsModel.GetZoom();
|
||||
if (!w || !h)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
w = clientRectImageArea.right * clientRectScrollbox.right / w;
|
||||
h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
|
||||
x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)) * newZoom / toolsModel.GetZoom();
|
||||
y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2)) * newZoom / toolsModel.GetZoom();
|
||||
|
||||
toolsModel.SetZoom(newZoom);
|
||||
|
||||
canvasWindow.Invalidate(TRUE);
|
||||
|
||||
canvasWindow.SendMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, x), 0);
|
||||
canvasWindow.SendMessage(WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, y), 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CMainWindow::alignChildrenToMainWindow()
|
||||
{
|
||||
RECT clientRect, rc;
|
||||
@@ -175,11 +144,11 @@ void CMainWindow::InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
|
||||
|
||||
if (g_askBeforeEnlarging)
|
||||
{
|
||||
TCHAR programname[20];
|
||||
TCHAR shouldEnlargePromptText[100];
|
||||
WCHAR programname[20];
|
||||
WCHAR shouldEnlargePromptText[100];
|
||||
|
||||
LoadString(g_hinstExe, IDS_PROGRAMNAME, programname, _countof(programname));
|
||||
LoadString(g_hinstExe, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText));
|
||||
::LoadStringW(g_hinstExe, IDS_PROGRAMNAME, programname, _countof(programname));
|
||||
::LoadStringW(g_hinstExe, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText));
|
||||
|
||||
switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
|
||||
{
|
||||
@@ -216,20 +185,20 @@ LRESULT CMainWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||
{
|
||||
INT zDelta = (SHORT)HIWORD(wParam);
|
||||
|
||||
if (::GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
if (::GetKeyState(VK_CONTROL) < 0) // Ctrl+Wheel
|
||||
{
|
||||
if (zDelta < 0)
|
||||
{
|
||||
if (toolsModel.GetZoom() > MIN_ZOOM)
|
||||
zoomTo(toolsModel.GetZoom() / 2, 0, 0);
|
||||
canvasWindow.zoomTo(toolsModel.GetZoom() / 2);
|
||||
}
|
||||
else if (zDelta > 0)
|
||||
{
|
||||
if (toolsModel.GetZoom() < MAX_ZOOM)
|
||||
zoomTo(toolsModel.GetZoom() * 2, 0, 0);
|
||||
canvasWindow.zoomTo(toolsModel.GetZoom() * 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
else // Wheel only
|
||||
{
|
||||
UINT nCount = 3;
|
||||
if (::GetAsyncKeyState(VK_SHIFT) < 0)
|
||||
@@ -264,7 +233,7 @@ LRESULT CMainWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||
|
||||
LRESULT CMainWindow::OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
TCHAR droppedfile[MAX_PATH];
|
||||
WCHAR droppedfile[MAX_PATH];
|
||||
|
||||
HDROP hDrop = (HDROP)wParam;
|
||||
DragQueryFile(hDrop, 0, droppedfile, _countof(droppedfile));
|
||||
@@ -278,14 +247,14 @@ LRESULT CMainWindow::OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||
LRESULT CMainWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
// Loading and setting the window menu from resource
|
||||
m_hMenu = ::LoadMenu(g_hinstExe, MAKEINTRESOURCE(ID_MENU));
|
||||
m_hMenu = ::LoadMenuW(g_hinstExe, MAKEINTRESOURCEW(ID_MENU));
|
||||
SetMenu(m_hMenu);
|
||||
|
||||
// Create the status bar
|
||||
DWORD style = SBARS_SIZEGRIP | WS_CHILD | (registrySettings.ShowStatusBar ? WS_VISIBLE : 0);
|
||||
g_hStatusBar = ::CreateWindowEx(0, STATUSCLASSNAME, NULL, style, 0, 0, 0, 0, m_hWnd,
|
||||
NULL, g_hinstExe, NULL);
|
||||
::SendMessage(g_hStatusBar, SB_SETMINHEIGHT, 21, 0);
|
||||
g_hStatusBar = ::CreateWindowExW(0, STATUSCLASSNAME, NULL, style, 0, 0, 0, 0, m_hWnd,
|
||||
NULL, g_hinstExe, NULL);
|
||||
::SendMessageW(g_hStatusBar, SB_SETMINHEIGHT, 21, 0);
|
||||
|
||||
// Create the tool box
|
||||
toolBoxContainer.DoCreate(m_hWnd);
|
||||
@@ -307,8 +276,8 @@ LRESULT CMainWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHa
|
||||
}
|
||||
|
||||
// Set icon
|
||||
SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
|
||||
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
|
||||
SendMessage(WM_SETICON, ICON_BIG, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
|
||||
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -345,10 +314,10 @@ BOOL CMainWindow::ConfirmSave()
|
||||
if (imageModel.IsImageSaved())
|
||||
return TRUE;
|
||||
|
||||
CString strProgramName;
|
||||
CStringW strProgramName;
|
||||
strProgramName.LoadString(IDS_PROGRAMNAME);
|
||||
|
||||
CString strSavePromptText;
|
||||
CStringW strSavePromptText;
|
||||
strSavePromptText.Format(IDS_SAVEPROMPTTEXT, PathFindFileName(g_szFileName));
|
||||
|
||||
switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
|
||||
@@ -376,11 +345,11 @@ LRESULT CMainWindow::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHan
|
||||
|
||||
void CMainWindow::ProcessFileMenu(HMENU hPopupMenu)
|
||||
{
|
||||
LPCTSTR dotext = PathFindExtensionW(g_szFileName);
|
||||
LPCWSTR dotext = PathFindExtensionW(g_szFileName);
|
||||
BOOL isBMP = FALSE;
|
||||
if (_tcsicmp(dotext, _T(".bmp")) == 0 ||
|
||||
_tcsicmp(dotext, _T(".dib")) == 0 ||
|
||||
_tcsicmp(dotext, _T(".rle")) == 0)
|
||||
if (_wcsicmp(dotext, L".bmp") == 0 ||
|
||||
_wcsicmp(dotext, L".dib") == 0 ||
|
||||
_wcsicmp(dotext, L".rle") == 0)
|
||||
{
|
||||
isBMP = TRUE;
|
||||
}
|
||||
@@ -402,7 +371,7 @@ void CMainWindow::ProcessFileMenu(HMENU hPopupMenu)
|
||||
|
||||
for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem)
|
||||
{
|
||||
CString& strFile = registrySettings.strFiles[iItem];
|
||||
CStringW& strFile = registrySettings.strFiles[iItem];
|
||||
if (strFile.IsEmpty())
|
||||
break;
|
||||
|
||||
@@ -410,11 +379,11 @@ void CMainWindow::ProcessFileMenu(HMENU hPopupMenu)
|
||||
#define MAX_RECENT_PATHNAME_DISPLAY 30
|
||||
CPath pathFile(strFile);
|
||||
pathFile.CompactPathEx(MAX_RECENT_PATHNAME_DISPLAY);
|
||||
assert(_tcslen((LPCTSTR)pathFile) <= MAX_RECENT_PATHNAME_DISPLAY);
|
||||
assert(wcslen((LPCWSTR)pathFile) <= MAX_RECENT_PATHNAME_DISPLAY);
|
||||
|
||||
// Add an accelerator (by '&') to the item number for quick access
|
||||
TCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1];
|
||||
wsprintf(szText, _T("&%u %s"), iItem + 1, (LPCTSTR)pathFile);
|
||||
WCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1];
|
||||
StringCchPrintfW(szText, _countof(szText), L"&%u %s", iItem + 1, (LPCWSTR)pathFile);
|
||||
|
||||
INT iMenuItem = (cMenuItems - 2) + iItem;
|
||||
InsertMenu(hPopupMenu, iMenuItem, MF_BYPOSITION | MF_STRING, IDM_FILE1 + iItem, szText);
|
||||
@@ -520,8 +489,8 @@ LRESULT CMainWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHand
|
||||
int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
|
||||
if (::IsWindow(g_hStatusBar))
|
||||
{
|
||||
::SendMessage(g_hStatusBar, WM_SIZE, 0, 0);
|
||||
::SendMessage(g_hStatusBar, SB_SETPARTS, 3, (LPARAM)&test);
|
||||
::SendMessageW(g_hStatusBar, WM_SIZE, 0, 0);
|
||||
::SendMessageW(g_hStatusBar, SB_SETPARTS, 3, (LPARAM)&test);
|
||||
}
|
||||
alignChildrenToMainWindow();
|
||||
return 0;
|
||||
@@ -547,7 +516,7 @@ LRESULT CMainWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
if (canvasWindow.m_hWnd == hwndCapture ||
|
||||
fullscreenWindow.m_hWnd == hwndCapture)
|
||||
{
|
||||
::SendMessage(hwndCapture, nMsg, wParam, lParam);
|
||||
::SendMessageW(hwndCapture, nMsg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
else if (selectionModel.m_bShow)
|
||||
@@ -582,7 +551,7 @@ LRESULT CMainWindow::OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||
{
|
||||
/* Redirect message to common controls */
|
||||
HWND hToolbar = FindWindowEx(toolBoxContainer.m_hWnd, NULL, TOOLBARCLASSNAME, NULL);
|
||||
SendMessage(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
|
||||
::SendMessageW(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -600,12 +569,11 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
{
|
||||
case IDM_HELPINFO:
|
||||
{
|
||||
TCHAR infotitle[100];
|
||||
TCHAR infotext[200];
|
||||
LoadString(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle));
|
||||
LoadString(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext));
|
||||
ShellAbout(m_hWnd, infotitle, infotext,
|
||||
LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
|
||||
WCHAR infotitle[100], infotext[200];
|
||||
::LoadStringW(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle));
|
||||
::LoadStringW(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext));
|
||||
::ShellAboutW(m_hWnd, infotitle, infotext,
|
||||
LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
|
||||
break;
|
||||
}
|
||||
case IDM_HELPHELPTOPICS:
|
||||
@@ -622,7 +590,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
break;
|
||||
case IDM_FILEOPEN:
|
||||
{
|
||||
TCHAR szFileName[MAX_LONG_PATH] = _T("");
|
||||
WCHAR szFileName[MAX_LONG_PATH] = L"";
|
||||
if (ConfirmSave() && GetOpenFileName(szFileName, _countof(szFileName)))
|
||||
{
|
||||
DoLoadImageFile(m_hWnd, szFileName, TRUE);
|
||||
@@ -659,7 +627,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
pd.nMaxPage = 0xffff;
|
||||
if (PrintDlg(&pd) == TRUE)
|
||||
{
|
||||
BitBlt(pd.hDC, 0, 0, imageModel.GetWidth(), imageModel.GetHeight(), imageModel.GetDC(), 0, 0, SRCCOPY);
|
||||
::BitBlt(pd.hDC, 0, 0, imageModel.GetWidth(), imageModel.GetHeight(), imageModel.GetDC(), 0, 0, SRCCOPY);
|
||||
DeleteDC(pd.hDC);
|
||||
}
|
||||
if (pd.hDevMode)
|
||||
@@ -751,14 +719,13 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
selectionModel.TakeOff();
|
||||
|
||||
{
|
||||
HBITMAP hbmLocked = selectionModel.LockBitmap();
|
||||
if (hbmLocked)
|
||||
{
|
||||
HGLOBAL hGlobal = BitmapToClipboardDIB(hbmLocked);
|
||||
if (hGlobal)
|
||||
::SetClipboardData(CF_DIB, hGlobal);
|
||||
selectionModel.UnlockBitmap(hbmLocked);
|
||||
}
|
||||
HBITMAP hbmCopy = selectionModel.GetSelectionContents();
|
||||
HGLOBAL hGlobal = BitmapToClipboardDIB(hbmCopy);
|
||||
if (hGlobal)
|
||||
::SetClipboardData(CF_DIB, hGlobal);
|
||||
else
|
||||
ShowOutOfMemory();
|
||||
::DeleteObject(hbmCopy);
|
||||
}
|
||||
|
||||
CloseClipboard();
|
||||
@@ -827,7 +794,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
|
||||
// Failed to paste
|
||||
{
|
||||
CString strText, strTitle;
|
||||
CStringW strText, strTitle;
|
||||
strText.LoadString(IDS_CANTPASTE);
|
||||
strTitle.LoadString(IDS_PROGRAMNAME);
|
||||
MessageBox(strText, strTitle, MB_ICONINFORMATION);
|
||||
@@ -865,19 +832,25 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
break;
|
||||
}
|
||||
HWND hToolbar = FindWindowEx(toolBoxContainer.m_hWnd, NULL, TOOLBARCLASSNAME, NULL);
|
||||
SendMessage(hToolbar, TB_CHECKBUTTON, ID_RECTSEL, MAKELPARAM(TRUE, 0));
|
||||
::SendMessageW(hToolbar, TB_CHECKBUTTON, ID_RECTSEL, MAKELPARAM(TRUE, 0));
|
||||
toolsModel.selectAll();
|
||||
canvasWindow.Invalidate(TRUE);
|
||||
break;
|
||||
}
|
||||
case IDM_EDITCOPYTO:
|
||||
{
|
||||
WCHAR szFileName[MAX_LONG_PATH] = L"*.png";
|
||||
WCHAR szFileName[MAX_LONG_PATH];
|
||||
::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName));
|
||||
if (GetSaveFileName(szFileName, _countof(szFileName)))
|
||||
{
|
||||
HBITMAP hbmLocked = selectionModel.LockBitmap();
|
||||
SaveDIBToFile(hbmLocked, szFileName, FALSE);
|
||||
selectionModel.UnlockBitmap(hbmLocked);
|
||||
HBITMAP hbmSelection = selectionModel.GetSelectionContents();
|
||||
if (!hbmSelection)
|
||||
{
|
||||
ShowOutOfMemory();
|
||||
break;
|
||||
}
|
||||
SaveDIBToFile(hbmSelection, szFileName, FALSE);
|
||||
DeleteObject(hbmSelection);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -921,6 +894,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
case IDM_IMAGEROTATEMIRROR:
|
||||
{
|
||||
CWaitCursor waitCursor;
|
||||
canvasWindow.updateScrollPos();
|
||||
switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
|
||||
{
|
||||
case 1: /* flip horizontally */
|
||||
@@ -973,8 +947,8 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
CWaitCursor waitCursor;
|
||||
if (attributesDialog.m_bBlackAndWhite && !imageModel.IsBlackAndWhite())
|
||||
{
|
||||
CString strText(MAKEINTRESOURCE(IDS_LOSECOLOR));
|
||||
CString strTitle(MAKEINTRESOURCE(IDS_PROGRAMNAME));
|
||||
CStringW strText(MAKEINTRESOURCEW(IDS_LOSECOLOR));
|
||||
CStringW strTitle(MAKEINTRESOURCEW(IDS_PROGRAMNAME));
|
||||
INT id = MessageBox(strText, strTitle, MB_ICONINFORMATION | MB_YESNOCANCEL);
|
||||
if (id != IDYES)
|
||||
break;
|
||||
@@ -1012,9 +986,12 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
toolsModel.SetBackgroundTransparent(!toolsModel.IsBackgroundTransparent());
|
||||
break;
|
||||
case IDM_IMAGECROP:
|
||||
imageModel.PushImageForUndo(selectionModel.CopyBitmap());
|
||||
{
|
||||
HBITMAP hbmCopy = selectionModel.GetSelectionContents();
|
||||
imageModel.PushImageForUndo(hbmCopy);
|
||||
selectionModel.HideSelection();
|
||||
break;
|
||||
}
|
||||
case IDM_VIEWTOOLBOX:
|
||||
registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible();
|
||||
toolBoxContainer.ShowWindow(registrySettings.ShowToolBox ? SW_SHOWNOACTIVATE : SW_HIDE);
|
||||
@@ -1053,25 +1030,25 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||
break;
|
||||
|
||||
case IDM_VIEWZOOM125:
|
||||
zoomTo(125, 0, 0);
|
||||
canvasWindow.zoomTo(125);
|
||||
break;
|
||||
case IDM_VIEWZOOM25:
|
||||
zoomTo(250, 0, 0);
|
||||
canvasWindow.zoomTo(250);
|
||||
break;
|
||||
case IDM_VIEWZOOM50:
|
||||
zoomTo(500, 0, 0);
|
||||
canvasWindow.zoomTo(500);
|
||||
break;
|
||||
case IDM_VIEWZOOM100:
|
||||
zoomTo(1000, 0, 0);
|
||||
canvasWindow.zoomTo(1000);
|
||||
break;
|
||||
case IDM_VIEWZOOM200:
|
||||
zoomTo(2000, 0, 0);
|
||||
canvasWindow.zoomTo(2000);
|
||||
break;
|
||||
case IDM_VIEWZOOM400:
|
||||
zoomTo(4000, 0, 0);
|
||||
canvasWindow.zoomTo(4000);
|
||||
break;
|
||||
case IDM_VIEWZOOM800:
|
||||
zoomTo(8000, 0, 0);
|
||||
canvasWindow.zoomTo(8000);
|
||||
break;
|
||||
|
||||
case IDM_VIEWFULLSCREEN:
|
||||
|
@@ -11,7 +11,7 @@
|
||||
class CMainWindow : public CWindowImpl<CMainWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("MSPaintApp"), CS_DBLCLKS, COLOR_BTNFACE)
|
||||
DECLARE_WND_CLASS_EX(L"MSPaintApp", CS_DBLCLKS, COLOR_BTNFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CMainWindow)
|
||||
MESSAGE_HANDLER(WM_DROPFILES, OnDropFiles)
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
CMainWindow() : m_hMenu(NULL) { }
|
||||
|
||||
HWND DoCreate();
|
||||
BOOL GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile);
|
||||
BOOL GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile);
|
||||
BOOL GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile);
|
||||
BOOL GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile);
|
||||
BOOL ChooseColor(IN OUT COLORREF *prgbColor);
|
||||
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu);
|
||||
BOOL CanUndo() const;
|
||||
|