Compare commits

..

227 Commits

Author SHA1 Message Date
Stanislav Motylkov
f6a71ae59e Update fr-FR.rc 2023-11-26 22:43:06 +03:00
Joachim Henze
373e9d3037 nl-NL.rc readd a fresh FIXME to address Hermes final review-concern 2023-11-26 16:00:56 +00:00
Joachim Henze
7ef396c48d zh-TW: Hermes suggested the chinese colon here (although it is not structurally used everywhere else in this file).
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2023-11-19 22:58:49 +00:00
Joachim Henze
747fe48d1d zh-ZK: Hermes suggested the chinese colon here (although it is not structurally used everywhere else in this file).
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2023-11-19 22:57:48 +00:00
Joachim Henze
27e978a005 zh-CN.rc Hermes suggested the chinese colon here (although it is not structurally used everywhere else in this file).
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2023-11-19 22:56:45 +00:00
Joachim Henze
95a5e81a96 now reactosfanboy-nimize the hermification 2023-11-19 22:52:57 +00:00
Joachim Henze
375973fc3b Hermificate 2nd comment
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2023-11-19 22:51:28 +00:00
Joachim Henze
f6873ce75b Hermificate the comment
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2023-11-19 22:50:24 +00:00
Joachim Henze
4c7222bab3 [TASKMGR] Fix text cutoff statusbar2 CPU%, improve statusbar3 Mem
see attached before-and-after-pics in the PR.

also fix an accelerator collision in nl-NL.rc
2023-11-14 19:06:22 +01:00
Andrei Miloiu
1c56c9cd5f [MSTSC] Update Romanian (ro-RO) translation (#5959) 2023-11-14 14:00:32 +00:00
Andrei Miloiu
3ce9e3b669 [DESK] Update Romanian (ro-RO) translation (#5958) 2023-11-14 13:59:17 +00:00
Joachim Henze
b693eddd74 [TASKMGR] Harmonize and beautify the borders in performance tab (#5949)
- When I started I actually just wanted to make the 2 red lines the same length. see PR-pic
- Ultimately I was able to harmonize all ctrls sizes and position for all rc's.
- This does also fix text truncation and overflows in several rc's.
- Also this prevents the numbers (actual data) in some rc's to be cut off much earlier than in others,
  e.g. hu-HU.rc had IDC_KERNEL_MEMORY_PAGED width just 33 which is very small and will lead to quick truncation.
  Now all languages use width 45 for all data fields and width 57 for all text fields,
  which means if truncation would ever happen with very large numbers in the 64bit era,
  we will see that happen in all rc's at the same moment and not arbitrarily scattered over a century.
  It will happen later after this PR is applied.
- After this PR the two red lines do have the same length. see PR-pic
- After this PR the two green lines do have the same length. see PR-pic
- After this PR the two yellow lines do have the same length. see PR-pic
- After this PR the four brown lines do have the same length. see PR-pic
- After this PR the five cyan lines do have the same length. see PR-pic
2023-11-14 13:57:17 +00:00
Hermès Bélusca-Maïto
161eb5d375 [CRT] dbgrpt.cpp: Fix buffer sizes in the *nprintf functions (#5678)
Sizes are in number of chars; use _countof() instead of hardcoding
them in the functions.
2023-11-14 12:24:00 +01:00
Hermès Bélusca-Maïto
f49e213943 [CRT][MSVCRT] Implement _CrtDbgReport(W)V and redefine _CrtDbgReport(W) around those (#5678)
Also add the internal _VCrtDbgReportA and _VCrtDbgReportW functions listed in
https://learn.microsoft.com/en-us/cpp/c-runtime-library/internal-crt-globals-and-functions?view=msvc-170

CORE-11835, CORE-15517
2023-11-14 12:23:51 +01:00
Serge Gautherie
7901a4c8fe [WIN32KNT_APITEST] w32knapi.c: Update dll name (#5977)
Addendum to commits 7ad21a4 (r70458) and bed6d00 (r76026).
2023-11-14 12:14:39 +01:00
Katayama Hirofumi MZ
91adec683d [SHIMGVW] Add file extension on file save (#5975)
In order to add a filename extension if necessary,
set "png" to OPENFILENAME.lpstrDefExt.
CORE-19222
2023-11-14 19:48:18 +09:00
Serge Gautherie
3fb5957de1 [NTOS:EX][CSRSRV][WIN32K] Make a few #define more explicit/strict (#5907)
- Add parentheses around macro parameters.
- Add casts on return value for the Interlocked*UL ("Unsigned Long") macros.
2023-11-13 20:55:48 +01:00
Whindmar Saksit
e07dbf782c [NETSHELL] Display component icons in list (#5904)
Display the class icons for the installed network components.
Also fixes a bug where the selection change whacked the checkbox of the first item.

Use 0x7fffffff to append the item at the end of the list, as optimization.
2023-11-13 20:51:52 +01:00
Dmitry Borisov
8d7153c8ba [FREELDR] Implement NOSERIALMICE and FASTDETECT options (#5886)
Enable FASTDETECT by default, as done in NT 5+. This is because
the serial mouse is recognized by the serial stack since NT 5.x.
2023-11-13 19:49:41 +01:00
Hermès Bélusca-Maïto
10e7643c80 [FREELDR:NTLDR] Pass boot-time detection options to HwDetect routines.
Will be used for supporting /NOSERIALMICE, /FASTDETECT (NT 5+) switches
(see PR #5886), as well as the undocumented /PCIENUM option.
2023-11-13 19:19:40 +01:00
Whindmar Saksit
413b5a0827 [ADVAPI32] Handle HKEY_CLASSES_ROOT in RegQueryInfoKeyW (#5870)
CORE-8582 , CORE-14676

This fixes the bug where Regedit is unable to show all the keys in HKCR when a key exists in both HKCU and HKLM.
2023-11-13 18:02:41 +01:00
Whindmar Saksit
6eb8a1d0c7 [ADVPACK] Handle ADN_DEL_IF_EMPTY in DelNodeW and DelNodeRunDLL32 (#5821)
- Handling ADN_DEL_IF_EMPTY is critical to avoid data loss.
- SetFileAttributesW failing is not fatal, the delete might still succeed.

NOTE: Not in Wine yet.
2023-11-13 16:42:26 +01:00
Whindmar Saksit
f283a3f9ae [SHELL32][SHELLEXT] IEnumIDList::Next must handle pceltFetched and memory errors correctly (#5820)
- pceltFetched can be NULL if the caller is not requesting multiple items.
- All entries returned in rgelt must be valid, they cannot be NULL.
2023-11-13 16:31:37 +01:00
Hermès Bélusca-Maïto
b4b1c5b9aa [DEVMGR] Fix some bugs spotted by Thomas Faber in PR #5775 (#5790)
- Fix TCHAR/WCHAR mis-usage,
- Fix as a result, a buffer overflow (GlobalAlloc takes the size in
  bytes, but a number of characters was passed to it instead).
- Remove usage of unsafe string function. Now the item text is directly
  retrieved within the allocated buffer.
2023-11-13 16:26:00 +01:00
Whindmar Saksit
7fb91d98f9 [SHELL32] Add support for more registry verb flags and CMF flags (#5785)
- Adds support for registry controlled menu separators and the documented
  values to turn off verbs.
- Adds support for CMF_OPTIMIZEFORINVOKE, CMF_NODEFAULT, CMF_DONOTPICKDEFAULT,
  CMF_EXPLORE and CMF_DISABLEDVERBS.

Bugs fixed:

- A verb with "Extended" set in the registry could cause the menu to invoke
  the incorrect command! This happened because skipping InsertMenuItemW
  caused InvokeCommand to use the wrong index with m_StaticEntries.
- Uses IS_INTRESOURCE instead of HIWORD to check if something is a string
  (only matters on 64-bit).
- TryToBrowse leaking a PIDL when calling ILCombine.

Notes:

- This PR introduces the RosGetProcessEffectiveVersion() helper function
  discussed in chat.
- Relaxed FAILED_UNEXPECTEDLY to FAILED in two places because IContextMenu
  cannot assume that it has a site that leads to IShellBrowser.
2023-11-13 16:21:13 +01:00
Whindmar Saksit
23f31cf7b4 [SHELL32] Support more FOLDERFLAGS in DefView (#5760)
This adds support for more of the FOLDERSETTINGS FOLDERFLAGS.

- Turned on LVS_EX_DOUBLEBUFFER even though there is no setting for it.
  XP has it on for folders but not the desktop and this matches that.
  Vista might turn it on for its shadow labels on the desktop, further
  investigation required.

- Fixes a bug where LVS_EX_SNAPTOGRID was incorrectly assigned where
  the WS_EX flags go.

- LVS_AUTOARRANGE seems to be incorrectly forced on but for compatibility
  I decided to leave it but added a comment. The existing code already
  has the check for FWF_AUTOARRANGE.
2023-11-13 16:13:21 +01:00
Serge Gautherie
bac646f9fe [VMX_SVGA] Demote 3 DPRINT1() and define NDEBUG (#5843)
Addendum to 486e587 (r45778).
2023-11-13 11:11:10 +01:00
Whindmar Saksit
c6ec8d924e [ATL] Added CComPtr.CoCreateInstance helper methods (#5905) 2023-11-13 11:03:05 +01:00
Serge Gautherie
8d54c2d433 [WIN32U_VISTA] .def: Delete this obsolete file (#5931) 2023-11-13 11:01:31 +01:00
Jose Carlos Jesus
357189bdea [USETUP][SHELL32][ACCESS] Improve Portuguese (pt-PT) Translation (#5897) 2023-11-13 10:59:05 +01:00
Andrei Miloiu
6d7cc0d8ad [MORE] Update Romanian (ro-RO) translation (#5941) 2023-11-13 10:57:36 +01:00
Andrei Miloiu
cb8c554c4c [LABEL] Update Romanian (ro-RO) translation (#5939) 2023-11-13 10:55:16 +01:00
Andrei Miloiu
39bec4df92 [ATTRIB] Update Romanian (ro-RO) translation (#5936) 2023-11-13 10:53:36 +01:00
Andrei Miloiu
1d12f6135a [POWERCFG] Update Romanian (ro-RO) translation (#5934) 2023-11-13 10:53:03 +01:00
Andrei Miloiu
e743146a10 [FIND] Update Romanian (ro-RO) translation (#5937) 2023-11-13 10:51:38 +01:00
Joachim Henze
1997c12252 [NETCFGX] 640x480-ify (#5946)
This finishes the 640x480-ification within [NETCFGX]. All dlgs addressed now.

- Allows the final 3 property sheets IDD_TCPIP_ADVIP_DLG, IDD_TCPIP_ADVDNS_DLG and IDD_TCPIP_ADVOPT_DLG to be displayed fine in 640x480 screen resolution by limiting their dlg unit height to 220
- tweaks a bit of the controls vertical positions to look better, e.g. LTEXT "interface metric:" was moved one pix upwards relative to IDC_METRIC to make that look more vertically centered
- IDC_AUTOMETRIC checkbox was moved slightly upwards in relation to the groupbox it was embedded into, which does it make look slightly better
- width of IDC_SUFFIX was enlarged for all languages to the value that was historically chosen for uk-UA.rc. (Only ru-RU.rc continues to do that differently, as it uses even longer text and therefore has to shift 2 controls towards the left to make that fit into the dlg. That part was there also before this PR)
2023-11-13 01:56:38 +00:00
Hermès Bélusca-Maïto
ee11747527 [CRT] Fix "wcsat_s" typo... 2023-11-11 21:30:09 +01:00
Timo Kreuzer
83e1193fb2 [WIN32K] Fix alignment checks in NtUserSetInformationThread
Fixes random failures on x64.
2023-11-10 19:42:13 +02:00
Timo Kreuzer
6ca8eb5c1e [CMAKE] Update baseaddress cmake files 2023-11-10 19:20:24 +02:00
Timo Kreuzer
7377f14339 [GEN_BASEADDRESS] Add handling of 64 bit builds 2023-11-10 19:20:24 +02:00
Timo Kreuzer
9cc4d8994b [CMAKE] Use baseaddress64.cmake for all 64 bit builds
- Rename baseaddress_msvc_x64.cmake to baseaddress64.cmake
- Include it for all compilers and 64 bit architectures
2023-11-10 19:20:24 +02:00
Timo Kreuzer
2b7246fd3c [CMAKE] Add support for "IMAGEBASE default" and use it for test/sample dlls 2023-11-10 19:20:24 +02:00
Timo Kreuzer
58f1201eae [FUSION] Provide baseaddress for fusion_1_1 and fusion_2_0
These DLLs are also named fusion.dll. Give them the same baseaddress as fusion.dll
2023-11-10 19:20:24 +02:00
Timo Kreuzer
2245dd78f5 [ASMPP] Improve handling of rip relative addressing 2023-11-10 19:20:24 +02:00
Timo Kreuzer
a34f1ed03c [CRT] Make ML based asm code GAS compatible
Our transpiler asmpp cannot handle rip relative addressing for "[symbol]".
2023-11-10 19:20:24 +02:00
Timo Kreuzer
d4993c67cd [CRT] Fix parameter check for _memicmp on NT 6+
Fixes a crash in msvcrt_winetest:string
2023-11-10 19:19:22 +02:00
Timo Kreuzer
840dfdc3a1 [CRT] Add parameter check to _mbscmp
Fixes crash in msvcrt_winetest::string
2023-11-10 19:19:22 +02:00
Timo Kreuzer
86f98baaf8 [CRT][MSVCRT] Import _gcvt and _gcvt_s from wine and export _gcvt_s on Vista+
Fixes a crash in msvcrt_winetest string
2023-11-10 19:19:22 +02:00
Timo Kreuzer
a3d22bba1a [RTL_APITEST] Move RtlIntSafe test from kmtest to rtl_apitest 2023-11-10 19:00:41 +02:00
Timo Kreuzer
bdf52a9868 [RTL_APITEST] Add rtl_unittest
First test is RtlCaptureContext
2023-11-10 19:00:41 +02:00
Timo Kreuzer
51b5d846e9 [CRT] Define _NTSYSTEM_ in 2 files to force using import-stubs
This prevents the code from linking to __imp_*, which would pull in the symbol from the import library (e.g. kernel32), which creates problems with the GNU linker, which doesn't like to have the import and a static definition at the same time.
2023-11-10 19:00:41 +02:00
Timo Kreuzer
520cf2294d [APITESTS] Share ok_eq_* macros between apitests and kmtests
This makes it possible to share sources between kmtest and apitests, e.g. for rtl.
2023-11-10 19:00:41 +02:00
Timo Kreuzer
5ecead80e3 [RTL] Add object library rtl_um 2023-11-10 19:00:41 +02:00
Timo Kreuzer
4bd1e81998 [RTL] Get rid of x86 asm version of RtlpGetStackLimits
There is no point in writing this function in asm.
2023-11-10 19:00:41 +02:00
Joachim Henze
393a88a372 [POWERCFG] 640x480-ify and overhaul (#5933)
Main goal was making the dlg display well in 640x480 resolution.
Since the dialogs in that propsheet had very different sizes between the languages
that was a lot of work. Now all of the propsheet-dlgs are harmonized in size to 252x220.
Also I found a way to align some controls in a way that they are more immune
to differing languages lengths for specific strings, so we can currently
to 100% use the same controls dimensions and positions also,
which is a very nice trait. I double-checked all dialogs visually in ResHacker
for all languages (except no-NO.rc for technical reasons), and they do look all
very well like that. The slider for the alarms dlg I enlarged in x,
it has 100 distinct positions, so a larger slider helps the user
not having to position the mouse extremely accurate.
I also fixed various typos, and several places where text cutoff occurred for many languages,
too many to name them all.
Some dummy-strings "unknown" I changed to "?" instead.
That still allows to see its position in a previewer,
but does not lure all the translators into translating that nonsense,
and therefore keeps the rcs better in sync. It also shrinks binary size.
2023-11-09 23:33:17 +00:00
Andrei Miloiu
565bf9e340 [CMD] Update Romanian (ro-RO) translation (#5918) 2023-11-08 20:11:03 +01:00
Andrei Miloiu
3666f2bdbc [IEFRAME] Update Romanian (ro-RO) translation (#5923) 2023-11-08 20:07:04 +01:00
Andrei Miloiu
a575921e93 [LOCALMON] Update Romanian (ro-RO) translation (#5925) 2023-11-08 20:06:16 +01:00
Andrei Miloiu
df24297a10 [INPUT] Update Romanian (ro-RO) translation (#5930) 2023-11-08 20:05:17 +01:00
Andrei Miloiu
dd8029fd0e [SNDREC32] Update Romanian (ro-RO) translation (#5916) 2023-11-08 20:04:46 +01:00
Andrei Miloiu
f1e1ca4ad7 [WORDPAD] Update Romanian (ro-RO) translation (#5917) 2023-11-08 20:04:18 +01:00
Andrei Miloiu
51cc0019f7 [CLIPBRD] Update Romanian (ro-RO) translation (#5909) 2023-11-08 20:01:58 +01:00
Andrei Miloiu
3285d2c769 [MSPAINT] Update Romanian (ro-RO) translation (#5913) 2023-11-08 20:01:21 +01:00
Andrei Miloiu
aca3f92a47 [CONSOLE] Update Romanian (ro-RO) translation (#5919) 2023-11-08 19:59:07 +01:00
Andrei Miloiu
5ee25ee392 [DXDIAG] Update Romanian (ro-RO) translation (#5910) 2023-11-08 19:58:21 +01:00
Andrei Miloiu
328a5d87b0 [HDWWIZ] Update Romanian (ro-RO) translation (#5921) 2023-11-08 19:57:40 +01:00
Andrei Miloiu
c6ed289383 [RASDLG] Update Romanian (ro-RO) translation (#5924) 2023-11-08 19:57:02 +01:00
Joachim Henze
7cd1e606df [OPENGLCFG] 640x480-ify (#5906)
A simple one
2023-11-08 14:44:31 +01:00
Andrei Miloiu
416e6ef814 [MYEVENTPROVIDER_DLL][MC] Update MyEventProvider.mc (#5929) 2023-11-08 11:18:07 +00:00
Andrei Miloiu
d7b7d36721 [NETEVENT][MC] Update neteventmsg.mc (#5928) 2023-11-08 11:16:58 +00:00
Andrei Miloiu
6e9d798833 [NETMSG][MC] Update net_msg.mc (#5927) 2023-11-08 11:14:59 +00:00
Andrei Miloiu
46f67b1970 Update net_msg.mc (#5926) 2023-11-08 11:13:17 +00:00
Andrei Miloiu
ff0b63ff2e [INETCPL] Update Romanian (ro-RO) translation (#5922) 2023-11-08 11:05:06 +00:00
Katayama Hirofumi MZ
c6c7fc1182 [RAPPS] Fix item icons (#5896)
Based on KRosUser's rapps_v2.patch.
ExtractIconW can return (HICON)1.
We check this invalid value.
CORE-19317
2023-11-08 19:53:02 +09:00
Andrei Miloiu
97bf53eeb8 [DESK] Update Romanian (ro-RO) translation (#5920) 2023-11-08 10:43:14 +00:00
Andrei Miloiu
2b910fc1b3 [NOTEPAD] Update Romanian (ro-RO) translation (#5915) 2023-11-08 10:34:25 +00:00
Andrei Miloiu
1795049341 [MSTSC] Update Romanian (ro-RO) translation (#5914) 2023-11-08 10:32:38 +00:00
Andrei Miloiu
692c0141d3 [MMC] Update Romanian (ro-RO) translation (#5912) 2023-11-08 10:26:33 +00:00
Andrei Miloiu
1e1b176493 [SOLITAIRE] Update Romanian (ro-RO) translation (#5911) 2023-11-08 10:24:05 +00:00
Timo Kreuzer
dfcf07b825 [NTOS:KE/x64] Remove GCC vs ML hack 2023-11-07 23:16:50 +02:00
Joachim Henze
adeaba1604 [ACCESS] 640x480-ify (#5903)
The first dlg IDD_PROPPAGEKEYBOARD is the toughest.
All others had plenty of space left.
2023-11-07 12:25:44 +00:00
Joachim Henze
0177b1af45 [NETCFGX] *.rc 640x480-ify IDD_TCPIP_BASIC_DLG and IDD_TCPIP_ALTCF_DLG (#5902)
Both dialogs can easily fit 640x480, like their twins from XPSP3 and 2k3sp2

For IDD_TCPIP_BASIC_DLG we can achieve that by just shrinking the upper groupbox in height by 10 units, and then move all controls below that by 10 units upwards. That doesn't require much brain, only diligence.

For IDD_TCPIP_ALTCF_DLG it is even easier, because the dlgs contents are small enough yet to still fit 640x480, so only the dlg itself must be shrinked for now. Later if more stuff will be added, we can perform pretty easy still by just moving everything a bit upwards. But we can leave that for later.

Fix a common typo in a 3rd dlg regarding a missing space before "(in order)". I decided to put that into this PR, because I didn't touch that dlgs dimensions yet. So the change is not mixed with position changes and therefore the review remains simple.

For ja-JP.rc fix a
-FONT 8, "MS Shell Dlg"
to
+FONT 9, "MS UI Gothic"
2023-11-07 03:17:01 +00:00
Joachim Henze
55563fa891 [NETSHELL] IDD_NETPROPERTIES must fit 640x480 CORE-19284 (#5899)
- adds 3 missing accelerators for zh-CN.rc, zh-HK.rc, zh-TW.rc for IDC_SHOWTASKBAR
- shrinks the dialog in y to fit on a 640x480 screen, like the XPSP3 and 2k3sp2 dlgs do
- for that some controls positions have to be slightly moved up (which cannot lead to text truncation here, guaranteed)
- only 3 controls change in size:
  - IDC_COMPONENTSLIST gets 3 units smaller in height, but is still larger than in XPSP3/2k3sp2. So it is still large enough
  - IDC_NETCARDNAME shrinks a bit in width, but is still larger than in XPSP3/2k3sp2, so what fits there will also fit for us
  - pushbutton IDC_CONFIGURE is slightly increased in width for all languages because that looks better
     except ru-RU.rc (which had the largest width) it is slightly smaller now, but still large enough.
     We can use the same width here now for all rcs!

- strip the lorem ipsum text from IDC_DESCRIPTION, which is never supposed to be displayed. That syncs all rcs in that line and slightly shrinks the binary size and fixes CORE-19284.

- add a FIXME comment for a missing accelerator in sv-SE.rc

*as a consequence all rcs do now use the exact same positions and sizes for all controls again, YIPPIE!*
The only exception that the dlg had before from that rule, was the ru-RU.rc IDC_CONFIGURE was larger in x.
But now that is not needed anymore.
2023-11-06 23:31:37 +00:00
Joachim Henze
561ad3c1d6 [ADVAPI32] Mute frequent taskmgr logspam CORE-18521 (#5888)
George explained that this is supposed to fail like that,
aka "works as designed". So let's at least mute this now,
as it is spammed with every taskmgr refresh cycle
and allows me to reduce logfile-sizes from ~50MB back to ~2MB
when building ros on ros.

err:(dll/win32/advapi32/wine/security.c:309) NtOpenProcessToken failed! Status c0000022.

Fixes CORE-18521

Also strip some EOL-whitespace in the file, and slightly improve the header.
2023-11-05 18:32:13 +01:00
Katayama Hirofumi MZ
0ae6a509b0 [SHLWAPI][SDK] Implement IContextMenu_Invoke (#5856)
- Modify shlwapi.spec.
- Add dll/win32/shlwapi/utils.cpp.
- Implement IContextMenu_Invoke function.
- Add it to <shlwapi_undoc.h>.
CORE-19278
2023-11-05 21:45:08 +09:00
Katayama Hirofumi MZ
43d6fdf2be [ACLUI] Let image list be automatically deleted (#5890)
Based on KRosUser's aclui.patch. The list view will automatically delete the image list.
Don't delete the image list in DestroySecurityPage function.
CORE-19187
2023-11-05 21:36:05 +09:00
Joachim Henze
7f80d5ee79 [CMLIB] Revert previous commit to avoid future merges of other devs
because George is having an open Draft PR since July 2022,
which might also touch this file on master in some years.
And it ofc is easier for me to revert my work now, then for him to
go through the great lengths of merging his work then.
2023-11-05 09:55:03 +01:00
Katayama Hirofumi MZ
1ae6cb7a96 [CALC] Use <winuser.rh> instead of <winuser.h> in resource.rc 2023-11-05 17:21:33 +09:00
Katayama Hirofumi MZ
6691cbe889 [REGEDIT] Use <winuser.rh> instead of <winuser.h> in regedit.rc
CORE-18876
2023-11-05 17:18:07 +09:00
Joachim Henze
f6de3881ca [CMLIB] UNIMPLEMENTED_ONCE less hand-knitted (#5889)
allows to get rid of static var PrintCount, at least visually in the code
2023-11-05 09:12:49 +01:00
Katayama Hirofumi MZ
efb9128c24 [NOTEPAD] Use <winuser.rh> instead of <winuser.h> in rsrc.rc
CORE-18837
2023-11-05 17:11:06 +09:00
Thamatip Chitpong
81ba804b55 [HOTPLUG] Trivial fixes (#5887)
- Update files header and copyright information
- Minor code formatting
2023-11-05 07:02:22 +07:00
Whindmar Saksit
4b03981846 [RAPPS] Improve LicenseType handling (#5809)
Tries now to map the "License" text set to "Freeware" to the
LICENSE_FREEWARE "LicenseType" so it is translated correctly (LoadString).

Fixes the following:

- If only the "License" field is set in the DB, nothing will change
  (this applies to 99% of the current entries in the DB).

- If both "LicenseType" and "License" are set, both will be used
  (no observable change in behavior): "Open Source (GPL v2)" etc.

- If only "LicenseType" is set, it will now display just the type
  "Freeware" instead of "Freeware ()".
  This is done only for "Freeware", because the others (the open source ones)
  have many variations. "OpenSource", "Open Source", "Open Source (GPL)" etc.
2023-11-04 22:08:10 +01:00
Whindmar Saksit
b3c1f652ec [NETSHELL] Register folder attributes as SFGAO_FOLDER, not SFGAO_CANDELETE (#5880)
On Windows the Network connections folder uses a binary value
and someone forgot about Little Endian when converting it to a DWORD.

Addendum to 7eb3fcf1d (r66485). CORE-9276

This issue has not been very visible because of bugs in CRegFolderEnum.
2023-11-04 17:40:22 +03:00
Whindmar Saksit
a6c838299c [NETSHELL] Call ReleaseWriteLock. Fixes CORE-18349 (#5881) 2023-11-04 15:19:10 +01:00
Katayama Hirofumi MZ
fa4b38d902 [MSPAINT] Localize g_ptStart and g_ptEnd into mouse.cpp
And move some ToolsModel code into mouse.cpp
CORE-19094
2023-11-04 23:00:43 +09:00
Katayama Hirofumi MZ
56828b82d9 [MSPAINT] Distinguish between icons and cursors (#5884)
- Convert icons/*_cur.ico to the cursor files (*.cur).
- The hot spot is (16, 16) (default).
- Rename icons/ folder as img/.
- Use LoadCursorW instead of LoadIconW
  for cursors.
- Use CURSOR statements for cursor files
  instead of ICON statements in rsrc.rc.
- I used GIMP to convert the icon files to the PNG files.
- I used RealWorld Cursor Editor to convert the PNG files to the cursor files.
CORE-19297
2023-11-04 22:15:43 +09:00
Katayama Hirofumi MZ
a938d19714 [SHELL32] Commonize CCopyToMenu and CMoveToMenu (#5873)
Reduce code. And correctly do the filename check.
CORE-18909
2023-11-04 21:56:15 +09:00
Katayama Hirofumi MZ
d21def4819 [MSPAINT] Use <winuser.rh> instead of <winuser.h> in rsrc.rc (#5883)
CORE-19094
2023-11-04 21:53:04 +09:00
Thamatip Chitpong
119057800e [HOTPLUG] Add device removal support (#5836) 2023-11-04 13:31:26 +01:00
Katayama Hirofumi MZ
b69a7460db [MSPAINT] Fix filter string UNICODE_NULL problem
Follow-up to #5882.
Some ATL CString do not append the string if there is
a UNICODE_NULL in the middle.
CORE-19094
2023-11-04 19:50:36 +09:00
Katayama Hirofumi MZ
640d67d12a [MSPAINT] Adapt to Unicode and <strsafe.h> (#5882)
- TCHAR --> WCHAR
- LPTSTR --> LPWSTR
- LPCTSTR --> LPCWSTR
- CString --> CStringW
- TEXT("...") --> L"..."
- _T("...") --> L"..."
- ::SendMessage( --> ::SendMessageW(
- ::GetWindowText( --> ::GetWindowTextW(
- ::SetWindowText( --> ::SetWindowTextW(
- Replace _tcscat with StringCchCatW.
- Replace _tcslen with wcslen.
etc. CORE-19094
2023-11-04 19:25:45 +09:00
Katayama Hirofumi MZ
d7e1bd2705 [IMM32] Sort imm32.spec
CORE-19268
2023-11-04 05:59:53 +09:00
Katayama Hirofumi MZ
4aa1bcb72b [IMM32][SDK] Implement software keyboard, Part 1 (#5865)
- Add dll/win32/imm32/softkbd.c source file.
- Half-implement ImmCreateSoftKeyboard function.
- Move ImmShowSoftKeyboard, and ImmDestroySoftKeyboard functions.
- Modify ImmCreateSoftKeyboard prototype.
CORE-19268
2023-11-04 05:58:17 +09:00
Katayama Hirofumi MZ
d7ece626cb [MSPAINT] Fix Copy-To-File feature (#5877)
The Copy-To-File feature had some bugs that the user couldn't save.
- Modify SelectionModel::GetSelectionContents.
- Delete SelectionModel::CopyBitmap, SelectionModel::LockBitmap,
  and SelectionModel::UnlockBitmap functions.
CORE-19186
2023-11-04 05:56:10 +09:00
Katayama Hirofumi MZ
e627c3b00e [W32TIME] Remember date/time sync settings (#5866)
Based on KRosUser's patch.
- In the W32TmServiceMain function, the
  time check loop does check the registry value.
CORE-19292
2023-11-03 22:56:58 +09:00
Katayama Hirofumi MZ
eb4d13c823 [IMM32][SDK] Implement CtfImm(Hide,Restore)ToolbarWnd (#5863)
- Add Imm32GetFn helper function.
- Implement CtfImmHideToolbarWnd and
  CtfImmRestoreToolbarWnd functions.
- Add them to <imm32_undoc.h>.
CORE-19268
2023-11-03 22:45:51 +09:00
Katayama Hirofumi MZ
a114169c4d [MSPAINT] Refactor mouse moving code on canvas (#5878)
Move some mouse moving code to toolsModel.
CORE-19094
2023-11-03 22:41:06 +09:00
Katayama Hirofumi MZ
a6418c848c [MSPAINT] Simplify tool creation (#5876)
Reduce code and binary size. This will reduce 512 bytes in binary.
- Don't use cache for tool creation.
CORE-19094
2023-11-03 16:49:13 +09:00
Katayama Hirofumi MZ
37f56d2448 [MSPAINT] Commonize OnFinishDraw and OnCancelDraw (#5875)
Reduce code and binary size a bit. This will reduce 1024 bytes in binary.
Unify ToolBase::OnFinishDraw and ToolBase::OnCancelDraw to ToolBase::OnEndDraw.
CORE-19094
2023-11-03 16:20:03 +09:00
Joachim Henze
32b883ef2f [NOTEPAD] de-DE.rc: Fix CMD_HELP_ABOUT_NOTEPAD, all rc: strip bloat-spaces before \n and ? 2023-11-03 02:19:34 +01:00
Katayama Hirofumi MZ
17530af261 [MMSYS] Improve Japanese (ja-JP) translation
CORE-18706
2023-11-03 08:53:36 +09:00
Serge Gautherie
c6c6c62cb5 [PORTCLS] Remove meaningless YDEBUG (#5858)
Addendum to b77ebc4 (r54584).
Follow-up of #5818.
2023-11-02 13:14:12 +01:00
Katayama Hirofumi MZ
dabb3f4d61 [IMM32][SDK] Add CtfAImmIsIME, CtfImmSetAppCompatFlags etc. (#5862)
- Add CtfAImmIsIME, CtfImmIsCiceroStartedInThread and CtfImmSetAppCompatFlags functions.
- Implement CtfImmDispatchDefImeMessage function.
- Modify imm32.spec.
- Add the prototypes of ImmGetAppCompatFlags, CtfAImmIsIME, CtfImmIsCiceroStartedInThread,
  CtfImmSetAppCompatFlags, and CtfImmDispatchDefImeMessage into <imm32_undoc.h>.
CORE-19268
2023-11-02 08:16:12 +09:00
Egor Ananyin
64997887eb [NTUSER] Fix system menu mouse handing (#5822)
Add a check for the system menu opened from the app icon.
Fixes CORE-19258
2023-11-01 23:11:46 +00:00
Andrei Miloiu
c1b12b3f46 [SHELL32] Update Romanian (ro-RO) translation (#5838) 2023-11-01 16:56:50 +01:00
Justin Miller
0a951f1112 [BOOTDATA] Add SMP Entry (#5859)
[HALX86] Enable SMP Hal for x86
[BOOTDATA] add livecd and set entrys
2023-11-01 06:43:44 -07:00
Whindmar Saksit
5d1be078f8 [TASKMGR] Hold Shift to bypass MessageBox confirmation (#5845)
Allow the user to hold shift to automatically answer IDYES when killing/debugging a process or changing the priority.
2023-11-01 13:43:33 +01:00
Serge Gautherie
31876ba8c2 [DSOUND_NEW][HDAUDBUS] Replace meaningless YDEBUG (#5857)
and move debug.h after all includes. Addendum to 60b0afc3a (PR #5818)

dsound_new: Addendum to 5974fe1 (r45584).
hdaudbus: Addendum to cf7fc81 (r68311).
2023-11-01 13:39:05 +01:00
Katayama Hirofumi MZ
b3194e320c [IMM32][SDK] Add CtfAImmActivate/Deactivate functions (#5835)
- Add dll/win32/imm32/CtfImeTable.h for CTF
  IME functions.
- Implementing Imm32CheckAndApplyAppCompat,
  Imm32LoadCtfIme, and
  Imm32EnumCreateCtfICProc helper functions.
- Add CtfAImmActivate and CtfAImmDeactivate
  functions.
- s/CI_TFSDISABLED/CI_TSFDISABLED/
CORE-19268
2023-10-31 22:45:28 +09:00
Katayama Hirofumi MZ
25b7447818 [SETUPLIB][NTUSER] Toggle input language/layout on Alt+Shift / Ctrl+Shift (#5839)
- Respect the toggle key settings.
- Change the hot key settings in 
  base/setup/lib/mui.c.
- Revert IntDefWindowProc function about
  Alt+Shift handling.
- Delete some code in
  co_IntProcessKeyboardMessage for Alt+Shift
  handling.
- Add IntGetNextKL, IntLanguageToggle, and
  IntCheckLanguageToggle helper functions.
- Modify ProcessKeyEvent and
  UserGetLanguageToggle functions to
  support [Left Alt]+Shift and Ctrl+Shift.
- Improve WM_INPUTLANGCHANGEREQUEST
  handling.
- Message handling shouldn't access kbswitch
  directly.
CORE-10667
2023-10-31 22:37:49 +09:00
Katayama Hirofumi MZ
8a049d0b68 [SHELL32][SDK] Implement CopyStreamUI (#5848)
- Modify shell32.spec.
- Add CopyStreamUI prototype to <undocshell.h>.
CORE-19278
2023-10-31 22:32:02 +09:00
Serge Gautherie
60b0afc3af [BDASUP][KMIXER][MMIXER][STREAM] Replace meaningless YDEBUG (#5818)
bdasup: Addendum to 40c15ec (r46632).
kmixer: Addendum to 3e489bf (r42143).
mmixer: Addendum to c42d9f2 (r44872).
stream: Addendum to 4a0debf (r41662).
Serge plans a follow up that will remove all other remaining YDEBUG in the source tree.
The ones covered here he considered to be the most trivial ones.
2023-10-31 12:04:24 +00:00
Katayama Hirofumi MZ
6d7aaaade0 [MSPAINT] Delete needless ImageModel::ResetToPrevious
CORE-19094
2023-10-31 11:13:54 +09:00
Katayama Hirofumi MZ
ad12c6cdea [NTUSER] Disable SC_MOVE if WS_MAXIMIZE or WS_MINIMIZE (#5855)
Based on KRosUser's scmove.patch.
- Check also WS_MINIMIZE window style to
  determine to disable SC_MOVE system command.
CORE-19272
2023-10-31 06:50:00 +09:00
Katayama Hirofumi MZ
00f192fa94 [SHELL32] Improve file properties dialog (#5852)
Based on KRosUser's patches.
- Add missing version strings "Comments" and
  "LegalTrademarks".
- Add version strings "PrivateBuild" and
  "SpecialBuild" if necessary.
- Trim the version string for pretty display.
CORE-19270, CORE-19114, CORE-19275
2023-10-30 15:34:03 +09:00
Katayama Hirofumi MZ
87f94aa10c [KBSWITCH] Update layout list on WM_NOTIFYICONMSG
The layout list was not updated correctly.
CORE-10667
2023-10-30 10:40:27 +09:00
Katayama Hirofumi MZ
aed376e00f [MSPAINT] Fix ImageModel::PushImageForUndo bug
CORE-19274
2023-10-30 07:41:57 +09:00
Hermès Bélusca-Maïto
bdae8cf966 [SHLWAPI_APITEST] Fix MSVC compilation warning C4309
SHPropertyBag.cpp(161): warning C4309: 'initializing': truncation of constant value

See https://stackoverflow.com/questions/33333448/warning-c4309-what-does-it-mean-and-can-it-be-ignored-in-this-case
for some details.
2023-10-28 18:19:04 +02:00
Hermès Bélusca-Maïto
46ab34662d [BROWSEUI] Some parenthesizing clarification around "xxx & YYY" expressions in conditionals 2023-10-28 17:56:55 +02:00
Hermès Bélusca-Maïto
64f40e7f30 [BROWSEUI] Fix MSVC compilation warning C4805
internettoolbar.cpp(714): warning C4805: '!=': unsafe mix of type 'bool' and type 'BOOL' in operation
2023-10-28 17:50:26 +02:00
Hermès Bélusca-Maïto
c9c6902f08 [USETUP] Further simplify partition creation UI code (#5837)
- Use the same keypress 'C' to create either primary or logical partitions.
  Their type is automatically determined, whether they are created in
  general unpartitioned space, or space within an extended partition.

- Extensively adapt the translations to reflect these changes.
2023-10-28 17:08:42 +02:00
Hermès Bélusca-Maïto
ebcf3cf38e [USETUP] Blur the boundaries between MBR "Primary" and "Logical" partitions (#5837)
Do not do that yet for extended partitions (containers).

This is possible, because when creating partitions, we do that on
unpartitioned space that is already "tagged" as either being "logical"
or not, and the partition style is inherited from that.

The resulting code is simpler, yet working as it should.
This will also help in the future for supporting other platforms, where
the concept of "primary", "extended" and "logical" partitions do not
exist (basically all platforms except BIOS-based PC-AT).
2023-10-28 17:08:41 +02:00
Hermès Bélusca-Maïto
9ed4bf1ed7 [USETUP] Show the partition description (and its disk) being formatted and checked (#5837)
And improve some strings -- Translations need to be rechecked!
2023-10-28 17:08:40 +02:00
Hermès Bélusca-Maïto
06e4f13653 [USETUP] Simplify partition creation UI code (#5837)
Unify CREATE_{PRIMARY,EXTENDED,LOGICAL}_PARTITION_PAGE
(i.e. Create{Primary,Extended,Logical}PartitionPage() functions)
into a single CREATE_PARTITION_PAGE (i.e. CreatePartitionPage()).

A lot of code was duplicated there (display, size input, etc.) just
for calling ultimately the Create{Primary,Extended,Logical}Partition()
helper functions.

This will also help in the future for supporting other platforms, where
the concept of "primary", "extended" and "logical" partitions do not
exist (basically all platforms except BIOS-based PC-AT).
2023-10-28 17:08:39 +02:00
Hermès Bélusca-Maïto
1899a09399 [USETUP] Simplify display of partitions being formatted (#5837) 2023-10-28 17:08:39 +02:00
Hermès Bélusca-Maïto
3d4f001084 [USETUP] Rename some MUI string identifiers (#5837)
STRING_CHOOSENEWPARTITION --> STRING_CHOOSE_NEW_PARTITION
STRING_FORMATTINGDISK     --> STRING_FORMATTINGPART
STRING_HDDSIZE            --> STRING_HDPARTSIZE
STRING_HDINFOPARTCREATE_1 --> STRING_HDDISK1
STRING_HDINFOPARTDELETE_1 --> STRING_HDDISK2
STRING_HDDINFO_{1,2}      --> STRING_HDDINFO{1,2}

Move STRING_NEWPARTITION just before STRING_PARTFORMAT
and renumber the STRING_* identifiers.
2023-10-28 17:08:38 +02:00
Katayama Hirofumi MZ
128e7f5aea [SHELL32][SDK] Implement SHStartNetConnectionDialogA (#5847)
and add SHStartNetConnectionDialog prototype to <shlobj.h>.
2023-10-28 22:29:05 +09:00
Katayama Hirofumi MZ
a52c713755 [SHELL32][SDK] Follow-up of #5840 (ad5df2d)
Fix the parameters of Activate_RunDLL.
2023-10-28 21:31:11 +09:00
Katayama Hirofumi MZ
ad5df2d199 [SHELL32][SDK] Implement Activate_RunDLL (#5840)
- Add Activate_RunDLL function implementation.
- Add Activate_RunDLL prototype to <undocshell.h>.
2023-10-28 14:56:27 +09:00
Katayama Hirofumi MZ
2ccdd87809 [SHELL32][SDK] Implement ShortSizeFormatW (#5829)
- Implement ShortSizeFormatW.
- Add ShortSizeFormatW prototype into <undocshell.h>.
- Modify shell32.spec.
2023-10-28 14:55:25 +09:00
Katayama Hirofumi MZ
81e936486e [SHELL32] Implement ExtractIconResInfoA (#5846)
- Add ExtractIconResInfoA implementation.
- Add ExtractIconResInfo prototype to <undocshell.h>.
2023-10-28 11:38:29 +09:00
Katayama Hirofumi MZ
9dfb3e8e05 [SHELL32][SDK] Implement PathIsSlowA and SHSetFolderPathA (#5841)
- Implement PathIsSlowA and SHSetFolderPathA functions.
- Add PathIsSlow and SHSetFolderPath prototypes to <shlobj.h>.
- Fix some <shlobj.h>'s bugs.
- Improve SHOpenPropSheetA function.
2023-10-28 09:59:12 +09:00
Katayama Hirofumi MZ
dcc9a2d8f3 [SHELL32][SDK] Implement SHOpenPropSheetA (#5830)
- Add SHOpenPropSheetA and
  SHOpenPropSheetW prototypes to <shlobj.h>.
- Implement SHOpenPropSheetA function.
2023-10-27 19:34:02 +09:00
Katayama Hirofumi MZ
8f6b016963 [SHELL32] Fix copyto/moveto actions of Search Results (#5816)
- Extend CDefView::InvokeContextMenuCommand 2nd parameter to LPCSTR.
- Add CDefView::_DoCopyToMoveToFolder method.
- Use CDefView::_DoCopyToMoveToFolder for FCIDM_SHVIEW_COPYTO
  and FCIDM_SHVIEW_MOVETO command actions.
CORE-18426
2023-10-27 12:34:51 +09:00
Doug Lyons
4eace8d762 [IPHLPAPI] Silence obsolete FIXME in GetAdaptersAddresses (#5834) 2023-10-26 16:45:44 +00:00
Katayama Hirofumi MZ
995f56d1d3 [SHELL32][SDK] Implement IsSuspendAllowed (#5831)
- Add IsShutdownAllowed helper function.
- Add IsSuspendAllowed prototype to
  <undocshell.h>.
- Implement IsSuspendAllowed function.
2023-10-26 23:27:45 +09:00
Katayama Hirofumi MZ
be8a6f8af1 [REGEDIT] Improve error handling (#5833)
- Don't exit the main program on error.
- Improve output_message function.
- Use output_message instead of some
  error_exit function calls.
CORE-19188
2023-10-26 19:57:42 +09:00
Katayama Hirofumi MZ
fea414b9ed [REGEDIT] Use <strsafe.h> functions strictly Part 2 (#5832)
Follow-up to #5825. Use StringCchPrintfW instead of swprintf.
CORE-18876
2023-10-26 10:39:12 +09:00
Katayama Hirofumi MZ
8cef980ab9 [REGEDIT] Use <strsafe.h> functions strictly (#5825)
Use safer functions for buffer manipulation to avoid buffer overflow/overrun.
CORE-18876
2023-10-26 10:09:31 +09:00
Joachim Henze
9360423cc2 [SYSSETUP] syssetup.rc improve URLs (#5810)
Reformat those URLs in a way that allows new lines to be added, or
existing lines to be removed or changed,
without the need to touch any neighbor line.
This will also allow git blame to work much better in the future.

Fix outdated URLs:
http://www.icu-project.org -> http://icu.unicode.org
https://fedorahosted.org/liberation-fonts -> http://pagure.io/liberation-fonts

I checked: all of the URLs do still work as good as before.

* Update ext2fsd links in syssetup.rc and media/doc
2023-10-24 20:59:28 +00:00
Timo Kreuzer
d831bc4fab [NTOS:MM] Add ASSERTs for VAD table locking 2023-10-24 21:45:27 +03:00
Timo Kreuzer
23589e9bf1 [NTOS:MM] Lock kernel address space in MiInitSystemMemoryAreas
This is required to satisfy VAD locking rules.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
07ad8c4c11 [NTOS:MM] Attach to the target process in MmMapViewOfSection
This is required to satisfy VAD locking rules.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
601bb49c0d [NTOS:MM] Fix MmFreeMemoryArea
- Stay attached while deleting the VAD node
- Acquire the appropriate working set lock when deleting a VAD node
- Both are needed for locking correctness
2023-10-24 21:45:27 +03:00
Timo Kreuzer
de3958dc2b Revert "[NTOS:MM/x64] Temporarily release AddressCreationLock in MmCreateVirtualMappingUnsafeEx"
This reverts commit e685b25e35.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
a662bedab8 [NTOS:MM] Fix bugs in MmAccessFault
- Acquire the appropriate working set lock when calling MmLocateMemoryAreaByAddress
- Do not access MemoryArea without holding the lock (otherwise it can be pulled away under our feet)
- Fix range check for paged pool
2023-10-24 21:45:27 +03:00
Timo Kreuzer
84d0586ca4 [NTOS:MM] Handle page table faults in MmArmAccessFault
These faults are handled by ARM³ and we don't need to check for a memory area. They can be recursive faults (e.g. from MiDeleteSystemPageableVm), so we might be holding the WS lock already. Passing it straight to ARM³ allows to acquire the WS lock below to look up the memory area.
2023-10-24 21:45:27 +03:00
Timo Kreuzer
a8b57f0a6b [NTOS:MM] Fix address space locking in MiProtectVirtualMemory 2023-10-24 21:45:27 +03:00
Timo Kreuzer
6d701b4b05 [NTOS:MM] Add ASSERTS to MmLockAddressSpace to guarantee lock ordering 2023-10-24 21:45:27 +03:00
Katayama Hirofumi MZ
ab199cc147 [MSPAINT] Show out-of-memory message (#5817)
- Improve ImageModel::PushImageForUndo.
- Use FormatMessage in newly added
  ShowOutOfMemory function.
- Call ShowOutOfMemory() when out of memory.
CORE-19227, CORE-19094
2023-10-25 02:35:49 +09:00
Hermès Bélusca-Maïto
501c2bdd63 [NTOS:LPC] Fix input parameter for ProbeAndCaptureUnicodeString (#5815)
Addendum to commit b3c55b9e6 (PR #4399).

Passing &CapturedObjectName as pointer to be probed and captured would
fail if e.g. PreviousMode == UserMode, since that pointer is always in
kernel space. Instead, pass the original user-mode pointer.

Bug caught by Timo Kreuzer ;)
2023-10-23 18:18:45 +02:00
Serge Gautherie
5b54477d47 [BDASUP][PORTCLS][SYSAUDIO][USB] Use ExAllocatePoolZero() and ExFreePoolWithTag() (#5811) 2023-10-23 18:16:59 +02:00
Thamatip Chitpong
7f5c59a0b3 [HOTPLUG] Add device properties dialog support (#5812)
Clicking at "Properties" button or right-click menu now opens properties dialog for the selected device.
2023-10-23 18:53:08 +07:00
Katayama Hirofumi MZ
6f86e11aa2 [SHELL32] Revert CDefView change at bc70af4
CORE-18426
2023-10-23 08:13:29 +09:00
Katayama Hirofumi MZ
bc70af4c13 [SHELL32] Use IS_INTRESOURCE in CCopyToMenu/CMoveToMenu::InvokeCommand
CORE-18426
2023-10-23 07:55:24 +09:00
Jesús Sanz del Rey
855008d97b [COMCTL32] Invalidate LVIS_CUT selected items too (#4218)
This fixes icons that should be drawn transparently not showing as such until window gets repainted.
For example, hidden shell folders that are not drawn transparently until the filebrowser window is resized...

CORE-16722
2023-10-21 18:51:54 +02:00
Serge Gautherie
c03b2ed9be [HDAUDBUS][KS][WDMAUD] Use ExAllocatePoolZero() and ExFreePoolWithTag() (#5792)
And promote/fix 2 DPRINTs as well.
2023-10-20 18:09:03 +02:00
Serge Gautherie
1fed9475cc [BOOTDATA] vfatfs.sys is packaged for xbox only (#5805)
Addendum to 14c3936 (0.4.15-dev-5090).
CORE-16373
2023-10-20 13:19:41 +02:00
Joachim Henze
ddd1d19b3f [TASKMGR] Get rid of cplusplus extern c (#5808)
The others in graphctrl.h and graph.h are being handled in the yet-uncommitted PR #5343.
2023-10-20 13:03:59 +02:00
Whindmar Saksit
ded91e310a [SHELL32] Enable Apply button when shortcut show mode is changed (#5807)
Basically this happens when the combobox selection changes.
2023-10-20 13:02:14 +02:00
Joachim Henze
63eaf2bd52 [TASKMGR] *.rc Deduplicate dynamic menu strings (#5772)
Some of the Menu-controls are just dummies in the RC,
because those controls are dynamically replaced at runtime
based on which tab/propsheet is active in taskmgr.
They are replaced by the IDS_MENU_* strings then.

Deduplicating them has many advantages:
1.) It shrinks binary size:
    master taskmgr.exe RosBEWin2.2.2 GCC8.4.0dbg  708.608 -> 696.832 bytes
2.) Translators don't get lured into translating dead stuff,
    assuming they translated the menu properly, while in fact they did not.
    This is *real*. Happened even to me multiple times already, although
    I am actually aware of the design.
3.) Some of them were offsync already between the dummy and the real thing.
4.) It reduces diff between en-US and other rc's.


* Aside of that improve alignment in some languages rcs in the "Shutdown"-menu-section,
* and improve a translation in de-DE, sq-AL, and zh-CN.
* [TASKMGR] id-ID.rc 2 accelerators in the same string is definitely wrong
* [TASKMGR] *.rc, make sure that warning is in all 30 langs, especially in en-US.rc
* [TASKMGR] for several translations add FIXME-comments regarding accelerator collisions
2023-10-19 10:19:20 +00:00
Hermès Bélusca-Maïto
171941ad18 [DESK] Add the current screensaver in the list if it isn't already present (#5766)
- Introduce AddScreenSaver[Item] helpers for adding screensavers in
  the list (either given by file path or by item structure).

- Rename "AddScreenSavers" to "EnumScreenSavers", and
  "ScreenSaverItem" type to "SCREEN_SAVER_ITEM".

- Ensure the stored "SCRNSAVE.EXE" value is NULL-terminated.

- Add the current screensaver, specified by the "SCRNSAVE.EXE" registry
  value, in the list if it isn't already present; otherwise select it
  in the list.

- Make the filename comparison case-insensitive.
2023-10-18 21:46:15 +02:00
Hermès Bélusca-Maïto
b3a25bcf8b [DESK] Reimplement InstallScreenSaverW to behave similarly to Windows' one (#5766)
CORE-6812 ; see also commit ff0951356 (r66688)

This function "just" changes the per-user SCRNSAVE.EXE registry value
to point to the new specified file, changes the SPI values and opens
the desk.cpl "Screensaver" property tab for letting the user change
the new selected screensaver properties.

In particular, it does *NOT* copy the specified file to System32 or
anything else (and doesn't verify that it is a valid PE executable).

Our previous implementation did none of that, and was also relying on
some private setupapi functions.

We now behave closer to Windows' desk.cpl.

Additionally:

- ReactOS-specific feature (compile-time define) disabled by default:
  Verify that the specified file actually exists, before changing
  the screensaver.
- Use NDEBUG, disabling DPRINT by default;
- Improve InstallScreenSaver[A,W] spec entries;
- Remove NUM_APPLETS define and use _countof() instead.
2023-10-18 21:45:39 +02:00
Hermès Bélusca-Maïto
fd1e5d53a5 [DESK] Cleanup some functions. 2023-10-18 21:30:10 +02:00
Stanislav Motylkov
0af84ce12d [NVNET] Remove NdisEqualMemory hack by linking with memcmp library
Fix suggested by Hermès Bélusca-Maïto. CORE-15872
2023-10-18 20:18:02 +03:00
Dmitry Borisov
59d8a77df6 [DC21X4] Add driver for DECchip 21x4-compatible network adapters (#5614)
These adapters were common in DEC Alpha boxes and they are really rare
nowadays. The 21140 chip is emulated in Connectix / Microsoft Virtual PC
and Hyper-V Gen 1 VM.

This is an experimental driver, not yet tested on real hardware.

CORE-8724
2023-10-18 20:12:36 +03:00
Timo Kreuzer
a8e8add0c0 [KERNEL32] Export more Vista functions 2023-10-18 15:55:41 +03:00
Timo Kreuzer
e0545dab15 [CMAKE] Improve configure script to work with newer CMake versions (#5742)
This change allows to properly pass parameters to newer CMake versions. Currently the script passes "VSSolution" and similar on to CMake, which are ignored, but newer CMake will complain. Allows to configure a VSSolution with CMake 3.27.4.
2023-10-17 13:17:35 +03:00
Timo Kreuzer
d9cb169920 [XDK] Fix / improve some definitions 2023-10-17 13:02:30 +03:00
Timo Kreuzer
7b38f80119 [STLPORT] Make stl thread-safe
Define _STLP_THREADS to make stl thread safe.
Also remove defined(__BUILDING_STLPORT) from the preprocessor conditions for which STLPInterlockedExchangePointer is defined, because that function is used in _threads.h, which can get included by apps using the stl through stl headers.
2023-10-17 13:01:24 +03:00
Katayama Hirofumi MZ
97e53c6963 [MSPAINT] Implement mouse middle button dragging (#5804)
- Handle WM_MBUTTONDOWN and
  WM_MBUTTONUP messages.
- Implement dragging by mouse middle button.
- Add IDC_HANDDRAG cursor resource.
CORE-19094
2023-10-17 15:58:34 +09:00
Timo Kreuzer
40d444919e [SDK] Move definition of MyInt128 into stubs.h 2023-10-17 09:41:18 +03:00
Timo Kreuzer
a27b8009e0 [SDK] Do not include windef.h into stubs.h
This prevents pulling in function declarations that are incompatible with the generated stubs.
2023-10-17 09:41:18 +03:00
Timo Kreuzer
3b7c7d8e68 [CMAKE] Don't use precompiled headers for autogenerated stub files 2023-10-17 09:41:18 +03:00
Katayama Hirofumi MZ
f49919ce5d [MSPAINT] Simplify canvas mouse message handling (#5803)
- Unify some mouse message handlers of
  CCanvasWindow.
- Add CCanvasWindow::m_nMouseDownMsg 
  member.
CORE-19094
2023-10-17 13:48:19 +09:00
Katayama Hirofumi MZ
8f1eb03ad2 [MSPAINT] Improve Zoom tool (#5798)
- Delete global zoomTo function.
- Add CCanvasWindow::zoomTo and
  CCanvasWindow::getNewZoomRect functions.
- Rename CCanvasWindow::updateScrollInfo as
  CCanvasWindow::updateScrollRange.
- Rename CCanvasWindow::resetScrollPos as
  CCanvasWindow::updateScrollPos.
- Draw the proper zoom rectangle on mouse move.
- Revert the active tool on click when the tool
  was Zoom.
CORE-19094
2023-10-17 07:25:50 +09:00
Egor Ananyin
e2d3aa7f4a [NTUSER] Remove a wrong check in MENU_MouseMove (#5736)
This check doesn't seem to be correct in modern ReactOS. Furthermore, it
actually hadn't been working for a long time until it was uncovered by
the recent system menu changes.

Reverts a hack introduced in 17a315285 (r72517), fixes CORE-19170.
The initial bug described in CORE-2338 is not observed.
2023-10-16 19:10:52 +03:00
Serge Gautherie
13a145b6d8 [USERENV] SetUserEnvironmentVariable(): Remove use of uninit' ShortName
Addendum to 96fe018 (r72066).
2023-10-16 19:02:27 +03:00
Katayama Hirofumi MZ
8669679499 [ATL][ATL_APITEST] Add some missing CRect methods (#5800)
- Strengthen "atltest.h".
- Strengthen atl_apitest:atltypes testcase.
- Implement some missing CRect methods.
2023-10-16 21:57:57 +09:00
Katayama Hirofumi MZ
d955b9321b [ATL] s/throw()/noexcept/ (#5799)
Mechanically replace throw() with noexcept.
2023-10-16 15:40:17 +09:00
Katayama Hirofumi MZ
fd1e158480 [MSPAINT] Calculate intersection to reduce bits transfer (#5795)
Drawing lines smoothly on big image.
- In CCanvasWindow::DoDraw, calculate the
  intersection to reduce bits transfer.
- Improve SmoothDrawTool in handling Shift key.
CORE-19094, CORE-19237
2023-10-16 09:09:40 +09:00
Hermès Bélusca-Maïto
5c2ec83fa7 [USETUP] Decouple bootloader install choice page from its actual installation (#5786)
This allows to move this choice sooner in the process, thus having all
the user key presses at first, then all the actual installation going
without any key presses needed anymore... (that is, unless you wanted
to install the bootloader on a removable device. Then it will prompt
you there!)

- Additional "cosmetic"/future-proof changes: Rename all instances
  of "floppy" in the bootloader install variables to "RemovableDisk"
  because it would be great to have this install choice later.

- Layout adjustments in the translated bootloader pages.

- Skip bootloader installation on upgrades. The idea here is that if
  we were able to find a ReactOS installation to upgrade, this means
  we were able to find a valid bootloader + boot entry.
  See also PR #5633.

  This logic may be slightly improved in the future to detect whether
  the underlying bootloader is FreeLdr and if so, only update its files.
  But this is for the future.
2023-10-14 16:29:43 +02:00
Katayama Hirofumi MZ
1c4bf2d702 [MSPAINT] Don't include useless <mapicode.h>
CORE-19094
2023-10-13 18:07:55 +09:00
Katayama Hirofumi MZ
1183e797b4 [MSPAINT] Reset scroll position in some situations (#5789)
In some situations, the scroll position should be reset.
- Add CCanvasWindow::resetScrollPos method.
- Reset the scroll position on loading a file.
- Reset the scroll position on mirroring/rotating
  the image.
CORE-19094
2023-10-12 22:59:17 +09:00
Katayama Hirofumi MZ
9a51c8e6c6 [MSPAINT][NOTEPAD][REGEDIT] Don't use CRTDBG for these apps (#5788)
Don't include <crtdbg.h>.
Don't use _CrtSetDbgFlag.
2023-10-12 22:53:02 +09:00
Katayama Hirofumi MZ
70d5c864bc [MSPAINT] Do type-cast (float) for xDpi and yDpi
CORE-19094
2023-10-12 19:43:29 +09:00
Katayama Hirofumi MZ
409df2355e [MSPAINT] Do type-cast (BYTE) for lfItalic and lfUnderline
CORE-19094
2023-10-12 19:38:41 +09:00
Katayama Hirofumi MZ
4306e261ee [MSPAINT] Do type-cast (BOOL) for TB_ISBUTTONCHECKED return
CORE-19094
2023-10-12 19:31:22 +09:00
Katayama Hirofumi MZ
bc28675a44 [MSPAINT] s/WINBOOL/BOOL/
CORE-19094
2023-10-12 19:13:20 +09:00
Justin Miller
ff3dadf89d [FREELDR] Enable UEFI boot for x86 and amd64 (#5267)
Co-authored-by: Stanislav Motylkov <x86corez@gmail.com>
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>

- Allow to boot NT kernel on UEFI systems with our 2 primary supported architectures
- Implement remaining code needed to pass execution to x86 and amd64 kernels

CORE-11954
2023-10-11 12:45:08 -07:00
Oleg Dubinskiy
a6b281c228 [KS] KsRead/WriteFile: finish IRP initialization and properly setup I/O stack location for it (#5784)
- Initialize the rest of IRP data which is not initialized by IoBuildSynchronousFsdRequest.
- Setup an IO_STACK_LOCATION structure for the IRP before calling the driver's read/write routine.
- Do this for both KsReadFile and KsWriteFile functions in our Kernel Streaming driver (ks.sys).
This fixes several problems when calling these functions from outside, so now they are working correctly, as expected.
Discovered during my audio investigations.
CORE-19232
2023-10-10 13:30:00 -07:00
Alexey Strukov
8451230753 [DEVMGR] Allow to copy text from Details page of device properties (#5775)
In driver properties, in details tab, add a "Copy" popup menu for listview.
This will allow to copy driver's information to buffer.
2023-10-10 21:22:54 +02:00
Katayama Hirofumi MZ
62eeb158a5 [MSPAINT] Improve Zoom tool (#5781)
- Delete CCanvasWindow::drawZoomFrame.
- Invalidate the canvas on mouse move when
  the active tool is Zoom tool.
- Add ZoomTool::OnDrawOverlayOnCanvas to
  draw the zoom rectangle without flickering.
- Improve the zoom trackbar position.
- Display the zoom rate on changing the value
  of the zoom trackbar.
- Reverse the direction of the zoom trackbar.
- Don't draw the focus rectangle.
CORE-19215, CORE-19216
2023-10-10 10:59:29 +09:00
Katayama Hirofumi MZ
0c164f081a [MSPAINT] Check out of image in updating status bar (#5779)
Check out of the image by using ::PtInRect and CCanvasWindow::GetImageRect.
If out, then don't show the status bar text.
CORE-19219
2023-10-09 08:39:31 +09:00
Katayama Hirofumi MZ
611d89eb8b [MSPAINT] Add border width to tool box (#5780)
Make tool box pixel-perfect. Add two border widths to the tool box.
CORE-19217
2023-10-09 08:37:31 +09:00
Timo Kreuzer
63aef3e1fc [T2EMBED] Improve spec file
- Only export stdcall annotated functions on x86
- Turn annotated stubs / forwarders into normal exports
- Note: MSVC removes decorated exports / forwarders, as soon as the undecorated version is exported, even when _declspec(dllexport) is used, no idea how to fix that.
2023-10-09 02:34:30 +03:00
Katayama Hirofumi MZ
8d8f4d328c [MSPAINT] Zoom tool shouldn't use undo buffer (#5778)
Remove PushImageForUndo call in Zoom tool. CORE-19214
2023-10-09 08:07:02 +09:00
Hermès Bélusca-Maïto
11b706429c [WSHTCPIP] Remove unneeded headers + Fix bugs.
- Mismatch NTSTATUS/DWORD for win32 errors;
- Close handle returned from openTcpFile() with closeTcpFile().
2023-10-08 17:11:26 +02:00
Hermès Bélusca-Maïto
9021a14f4a [NDK] Fix weird "ntstatus.s" statement (#5771)
Spotted by Serge Gautherie.
2023-10-08 17:11:25 +02:00
Joachim Henze
42c93e3cbb [TASKMGR] *.rc: Fix accelerator collisions &Priority <-> &Properties (#5758)
We had collisions in many languages.
For most languages (which are derived from en-US) we should use
&Priority
P&roperties

We introduced the collisions during 0.4.15-dev'ing when
MENUITEM ID_PROCESS_PAGE_PROPERTIES
and
MENUITEM ID_PROCESS_PAGE_OPENFILELOCATION
were added.


We verified Win7-en and Win2k3-en to behave as proposed in this PR (R for properties, P for priority).
But *french* Windows (I believe Hermes picture was from WinVista-fr or Win7-fr or Win10-fr maybe) does it differently.

the existing de-DE also has been double-checked to exactly match MS with the accelerators in that menu.
2023-10-07 23:03:47 +00:00
Hermès Bélusca-Maïto
ce08851758 [DESK] Use MultiByteToWideChar instead of the private pSetupMultiByteToUnicode function (#5765)
This avoids having desk.cpl depend on a private function that may change
or disappear, and increase the probability of being able to use that CPL
across different Windows versions.

(Note: this pSetupMultiByteToUnicode was one of those whose name changed
between Windows 2000 and XP+)
2023-10-07 22:17:58 +02:00
Hermès Bélusca-Maïto
e4608f7450 [DESK][SHELLBTRFS] Fix typo in WIN32_NO_STATUS 2023-10-07 22:15:12 +02:00
Hermès Bélusca-Maïto
d0b43a399f [NETID] Simplify IsUserAdmin() helper implementation (#5763)
Addendum to commit 8c4b0c914.

Base ourselves on pSetupIsUserAdmin() and other similar functions in our
codebase. Note that what we are actually interested here, is whether the
current thread runs with Administrator privileges.

(As noticed by contributor 'whindsaks', "Not only is this code simpler,
it now will correctly handle deny-only SIDs in the token!")
2023-10-07 21:52:36 +02:00
Timo Kreuzer
e685b25e35 [NTOS:MM/x64] Temporarily release AddressCreationLock in MmCreateVirtualMappingUnsafeEx
This is a hack, because the kernel mode path can incur a recursive page fault with the AddressCreationLock acquired, which would lead to a recursive acquisition, once we do proper locking in MmAccessFault.
To properly fix this the PDE must be made valid, similar to the user mode path, but that is not that simple...
2023-10-07 10:58:30 +03:00
Oleg Dubinskiy
d96b3cd45c [KS] Fix bug in KsStreamIo (#4663)
Properly set output buffer length in IO Stack Location of the current IRP, since it is passed to KsProbeStreamIrp when calling KsStreamIo, so it fails if the length isn't set properly.

Don't set an input buffer length and the buffer itself, since it isn't passed anywhere, so setting it makes no sense. Moreover, MSDN says that for IOCTL_KS_READ/WRITE_STREAM, only output buffer (and its length) is needed to be set, but not an input one. So it indeed is more correct.

It fixes buffer overflow in KsProbeStreamIrp when attempting to perform the streaming via KsStreamIo. I discovered this bug during my audio refactoring from PR #4660.
2023-10-06 12:36:09 +02:00
Hermès Bélusca-Maïto
2a5fd78f1b [APPHELP_APITEST] Fix build, addendum to commit a8755711b 2023-10-05 21:32:38 +02:00
Hermès Bélusca-Maïto
a8755711b9 [APPHELP_APITEST] Deduplicate the IsUserAdmin() helper. 2023-10-05 20:58:57 +02:00
Hermès Bélusca-Maïto
f1cff6ef27 [DESK] Remove deprecated code.
This mostly reverts commit 221f21c62 (r29328), that was a hack for
building with MSVC. We can nowadays correctly link with the shell32
SHCreatePropSheetExtArrayEx() export.
2023-10-05 20:58:28 +02:00
Katayama Hirofumi MZ
1a90009bb9 [MSPAINT] Update scroll info on loading file (#5761)
The scroll info was not updated when the file is loading.
- Rename CCanvasWindow::Update as CCanvasWindow::updateScrollInfo.
- Update scroll info on ImageModel::NotifyImageChanged.
- Improve ImageModel::ClearHistory.
CORE-19094
2023-10-05 20:01:41 +09:00
Katayama Hirofumi MZ
3579ea7888 [MSPAINT] Fix assertion failure on text tool (#5762)
Kill the assertion failure on choosing text tool.
Check whether textEditWindow is not null by using IsWindowVisible.
CORE-19094
2023-10-05 19:51:36 +09:00
George Bișoc
d72025649b [NTOS:SE] Mute the access denied DPRINTs
They can be spammy. Also clarify these debug prints, because some people
think that "failed to grant access rights" means there's something wrong
in the core access check functions.
2023-10-04 18:04:30 +02:00
George Bișoc
09bfd96f3b [NTOS:SE] HACK: Temporarily add the Local group SID to the system token
Temporarily add the local group to the system token so that Virtualbox
GA services can properly set up network drives for shared folders.

What happens is that a security descriptor has a DACL with only one ACE
that grants access to Local SID (presumably coming from Vbox?)
but the client token is that of the service which is a SYSTEM token.
Perhaps we are not impersonating the right user or whatever else.

This is only a temporary placebo, until a proper solution is found.

CORE-18250
2023-10-04 18:04:30 +02:00
George Bișoc
fefb1b7745 [NTDLL_APITEST] Write NtAccessCheck testcase that tests for empty generic mapping scenario
See b79aadd50bb7d5d6f08532284941c0334514c477 for further information.
2023-10-04 18:04:29 +02:00
George Bișoc
4b4638dc55 [NTOS:SE] HACK: Temporarily grant access to the client if empty generic mapping was passed
Certain apps such as AIM installer passes an empty generic mapping (this can
be understood with their generic masks set to 0) and our code tries to map
the access right from an ACE with the mapping provided by AccessCheck.

This can lead to a bug where we would not be able to decode the generic right
from an ACE as we need a proper generic mapping in order to do so. A mask
right that is not decoded it cannot be used to mask out the remaining rights,
further resulting into a denied access right.

What Windows does instead is they are mapping the ACE's rights in another place,
presumably when setting security data to an object, and they are using the
generic mapping passed by the kernel.

What we can do for the time being is to temporarily grant access to the client,
but only if they are an administrator.

CORE-18576
2023-10-04 18:04:29 +02:00
George Bișoc
95c104f29a [TCPIP] Setup a security descriptor for the IP and TCP device objects
Grant access to such objects to system, admins and network services.
2023-10-04 18:04:17 +02:00
Ratin Gao
be5c889cdf [NTDLL:LDR] SAL improvements and fixes
- Convert some notations to SAL2
- "Name" parameter in LdrGetProcedureAddress/LdrpGetProcedureAddress should be optional
- "DllCharacteristics" parameter in LdrGetDllHandle should be optional
2023-10-04 12:26:18 +03:00
723 changed files with 27983 additions and 15790 deletions

View File

@@ -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()

View File

@@ -19,7 +19,7 @@
*/
#include <windef.h>
#include <winuser.h>
#include <winuser.rh>
#include "resource.h"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 "Crea, 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

View File

@@ -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șea 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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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)

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
};

View File

@@ -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);

View File

@@ -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)

View File

@@ -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;

View File

@@ -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

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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;

View File

@@ -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());

View File

@@ -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;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
}
}
}

View File

@@ -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)

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -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);
};

View File

@@ -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

View File

@@ -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"

View File

@@ -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)

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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:

View File

@@ -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;

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