ReactOS 0.4.16-dev-329-g9223134
main.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4 * PURPOSE: The main window and wWinMain etc.
5 * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
6 * Copyright 2017-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
7 * Copyright 2018 Stanislav Motylkov <x86corez@gmail.com>
8 */
9
10#include "precomp.h"
11
12#include <dlgs.h>
13#include <mapi.h>
14#include <assert.h>
15
16BOOL g_askBeforeEnlarging = FALSE; // TODO: initialize from registry
24
26
28
29static HINSTANCE s_hHHCTRL_OCX = NULL; // HtmlHelpW needs "hhctrl.ocx"
31
32/* FUNCTIONS ********************************************************/
33
35{
36 WCHAR szText[256];
38 NULL,
40 0,
41 szText, _countof(szText),
42 NULL);
44}
45
46// get file name extension from filter string
47static BOOL
49{
50 LPWSTR pchExt = pExt;
51 *pchExt = 0;
52
53 DWORD nIndex = 1;
54 for (LPCWSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
55 {
56 pch += lstrlen(pch) + 1;
57 if (pOFN->nFilterIndex == nIndex)
58 {
59 for (++pch; *pch && *pch != L';'; ++pch)
60 {
61 *pchExt++ = *pch;
62 }
63 *pchExt = 0;
64 CharLower(pExt);
65 return TRUE;
66 }
67 pch += wcslen(pch) + 1;
68 }
69 return FALSE;
70}
71
72// Hook procedure for OPENFILENAME to change the file name extension
73static UINT_PTR APIENTRY
75{
76 HWND hParent;
77 OFNOTIFYW *pon;
79 switch (uMsg)
80 {
81 case WM_NOTIFY:
82 pon = (OFNOTIFYW *)lParam;
83 if (pon->hdr.code == CDN_TYPECHANGE)
84 {
85 hParent = GetParent(hwnd);
90 }
91 break;
92 }
93 return 0;
94}
95
98
100{
101 // Delete the temporary file if any
102 if (g_szMailTempFile[0])
103 {
106 }
107
108 CStringW strFileTitle;
109 if (PathFileExistsW(pszPathName) && imageModel.IsImageSaved())
110 {
111 strFileTitle = PathFindFileNameW(pszPathName);
112 }
113 else // Not existing or not saved
114 {
115 // Get the name of a temporary file
116 WCHAR szTempDir[MAX_PATH];
117 ::GetTempPathW(_countof(szTempDir), szTempDir);
118 if (!::GetTempFileNameW(szTempDir, L"afx", 0, g_szMailTempFile))
119 return FALSE; // Failure
120
122 {
123 // Set file title
124 strFileTitle = PathFindFileNameW(g_szFileName);
125
126 // Copy to the temporary file
128 {
130 return FALSE; // Failure
131 }
132 }
133 else
134 {
135 // Set file title
136 strFileTitle.LoadString(IDS_DEFAULTFILENAME);
137 strFileTitle += L".png";
138
139 // Save it to the temporary file
140 HBITMAP hbmLocked = imageModel.LockBitmap();
141 BOOL ret = SaveDIBToFile(hbmLocked, g_szMailTempFile, FALSE, Gdiplus::ImageFormatPNG);
142 imageModel.UnlockBitmap(hbmLocked);
143 if (!ret)
144 {
146 return FALSE; // Failure
147 }
148 }
149
150 // Use the temporary file
151 pszPathName = g_szMailTempFile;
152 }
153
154 // Load "mapi32.dll"
155 HINSTANCE hMAPI = LoadLibraryW(L"mapi32.dll");
156 if (!hMAPI)
157 return FALSE; // Failure
158
159 // Attachment
160 MapiFileDescW attachmentW = { 0 };
161 attachmentW.nPosition = (ULONG)-1;
162 attachmentW.lpszPathName = (LPWSTR)pszPathName;
163 attachmentW.lpszFileName = (LPWSTR)(LPCWSTR)strFileTitle;
164
165 // Message with attachment
166 MapiMessageW messageW = { 0 };
167 messageW.lpszSubject = NULL;
168 messageW.nFileCount = 1;
169 messageW.lpFiles = &attachmentW;
170
171 // First, try to open the mailer by the function of Unicode version
172 FN_MAPISendMailW pMAPISendMailW = (FN_MAPISendMailW)::GetProcAddress(hMAPI, "MAPISendMailW");
173 if (pMAPISendMailW)
174 {
175 pMAPISendMailW(0, (ULONG_PTR)hWnd, &messageW, MAPI_DIALOG | MAPI_LOGON_UI, 0);
176 ::FreeLibrary(hMAPI);
177 return TRUE; // MAPISendMailW will show an error message on failure
178 }
179
180 // Convert to ANSI strings
181 CStringA szPathNameA(pszPathName), szFileTitleA(strFileTitle);
182
183 MapiFileDesc attachment = { 0 };
185 attachment.lpszPathName = (LPSTR)(LPCSTR)szPathNameA;
186 attachment.lpszFileName = (LPSTR)(LPCSTR)szFileTitleA;
187
188 MapiMessage message = { 0 };
189 message.lpszSubject = NULL;
190 message.nFileCount = 1;
191 message.lpFiles = &attachment;
192
193 // Try again but in ANSI version
194 FN_MAPISendMail pMAPISendMail = (FN_MAPISendMail)::GetProcAddress(hMAPI, "MAPISendMail");
195 if (pMAPISendMail)
196 {
197 pMAPISendMail(0, (ULONG_PTR)hWnd, &message, MAPI_DIALOG | MAPI_LOGON_UI, 0);
198 ::FreeLibrary(hMAPI);
199 return TRUE; // MAPISendMail will show an error message on failure
200 }
201
202 ::FreeLibrary(hMAPI);
203 return FALSE; // Failure
204}
205
207{
208 static OPENFILENAMEW ofn = { 0 };
209 static CStringW strFilter;
210
211 if (ofn.lStructSize == 0)
212 {
213 // The "All Files" item text
214 CStringW strAllPictureFiles;
215 strAllPictureFiles.LoadString(g_hinstExe, IDS_ALLPICTUREFILES);
216
217 // Get the import filter
218 CSimpleArray<GUID> aguidFileTypesI;
219 CImage::GetImporterFilterString(strFilter, aguidFileTypesI, strAllPictureFiles,
221 strFilter.Replace(L'|', UNICODE_NULL);
222
223 // Initializing the OPENFILENAME structure for GetOpenFileName
224 ZeroMemory(&ofn, sizeof(ofn));
225 ofn.lStructSize = sizeof(ofn);
228 ofn.lpstrFilter = strFilter;
230 ofn.lpstrDefExt = L"png";
231 }
232
233 ofn.lpstrFile = pszFile;
234 ofn.nMaxFile = cchMaxFile;
235 return ::GetOpenFileNameW(&ofn);
236}
237
239{
240 static OPENFILENAMEW sfn = { 0 };
241 static CStringW strFilter;
242
243 if (sfn.lStructSize == 0)
244 {
245 // Get the export filter
246 CSimpleArray<GUID> aguidFileTypesE;
247 CImage::GetExporterFilterString(strFilter, aguidFileTypesE, NULL,
249 strFilter.Replace(L'|', UNICODE_NULL);
250
251 // Initializing the OPENFILENAME structure for GetSaveFileName
252 ZeroMemory(&sfn, sizeof(sfn));
253 sfn.lStructSize = sizeof(sfn);
256 sfn.lpstrFilter = strFilter;
259 sfn.lpstrDefExt = L"png";
260
261 LPWSTR pchDotExt = PathFindExtensionW(pszFile);
262 if (*pchDotExt == UNICODE_NULL)
263 {
264 // Choose PNG
265 StringCchCatW(pszFile, cchMaxFile, L".png");
266 for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
267 {
268 if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
269 {
270 sfn.nFilterIndex = i + 1;
271 break;
272 }
273 }
274 }
275 }
276
277 sfn.lpstrFile = pszFile;
278 sfn.nMaxFile = cchMaxFile;
279 return ::GetSaveFileNameW(&sfn);
280}
281
283{
284 static CHOOSECOLOR choosecolor = { 0 };
285 static COLORREF custColors[16] =
286 {
287 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
288 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff
289 };
290
291 if (choosecolor.lStructSize == 0)
292 {
293 // Initializing the CHOOSECOLOR structure for ChooseColor
294 ZeroMemory(&choosecolor, sizeof(choosecolor));
295 choosecolor.lStructSize = sizeof(choosecolor);
296 choosecolor.hwndOwner = m_hWnd;
297 choosecolor.lpCustColors = custColors;
298 }
299
300 choosecolor.Flags = CC_RGBINIT;
301 choosecolor.rgbResult = *prgbColor;
302 if (!::ChooseColor(&choosecolor))
303 return FALSE;
304
305 *prgbColor = choosecolor.rgbResult;
306 return TRUE;
307}
308
310{
312
313 CStringW strTitle;
315
318}
319
320// A wrapper function for HtmlHelpW
321static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData)
322{
324
325 if (!s_hHHCTRL_OCX && (uCommand != HH_CLOSE_ALL))
326 {
327 // The function loads the system library, not local
329 StringCchCatW(szPath, _countof(szPath), L"\\hhctrl.ocx");
331 if (s_hHHCTRL_OCX)
333 }
334
335 if (!s_pHtmlHelpW)
336 return NULL;
337
338 return s_pHtmlHelpW(hwndCaller, pszFile, uCommand, dwData);
339}
340
342{
343 RECT clientRect, rc;
344 GetClientRect(&clientRect);
345 RECT rcSpace = clientRect;
347
349 {
351 rcSpace.bottom -= rc.bottom - rc.top;
352 }
353
354 HDWP hDWP = ::BeginDeferWindowPos(3);
355
357 {
359 {
361 rcSpace.right - CX_TOOLBAR, rcSpace.top,
362 CX_TOOLBAR, rcSpace.bottom - rcSpace.top,
363 uFlags);
364 rcSpace.right -= CX_TOOLBAR;
365 }
366 else
367 {
369 rcSpace.left, rcSpace.top,
370 CX_TOOLBAR, rcSpace.bottom - rcSpace.top,
371 uFlags);
372 rcSpace.left += CX_TOOLBAR;
373 }
374 }
375
377 {
379 {
380 hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL,
381 rcSpace.left, rcSpace.bottom - CY_PALETTE,
382 rcSpace.right - rcSpace.left, CY_PALETTE,
383 uFlags);
384 rcSpace.bottom -= CY_PALETTE;
385 }
386 else
387 {
388 hDWP = ::DeferWindowPos(hDWP, paletteWindow, NULL,
389 rcSpace.left, rcSpace.top,
390 rcSpace.right - rcSpace.left, CY_PALETTE,
391 uFlags);
392 rcSpace.top += CY_PALETTE;
393 }
394 }
395
396 if (canvasWindow.IsWindow())
397 {
398 hDWP = ::DeferWindowPos(hDWP, canvasWindow, NULL,
399 rcSpace.left, rcSpace.top,
400 rcSpace.right - rcSpace.left, rcSpace.bottom - rcSpace.top,
401 uFlags);
402 }
403
405}
406
408{
410
411 // Is the extension not supported?
413 if (pchDotExt && *pchDotExt && !CImageDx::IsExtensionSupported(pchDotExt))
414 {
415 // Remove the extension
417 // No overwrite
418 overwrite = FALSE;
419 }
420
421 if (g_isAFile && overwrite)
422 {
424 }
426 {
428 }
429}
430
432{
433 int width = GetDIBWidth(bitmap);
435 int curWidth = imageModel.GetWidth();
436 int curHeight = imageModel.GetHeight();
437
438 if (width > curWidth || height > curHeight)
439 {
440 BOOL shouldEnlarge = TRUE;
441
443 {
444 WCHAR programname[20];
445 WCHAR shouldEnlargePromptText[100];
446
447 ::LoadStringW(g_hinstExe, IDS_PROGRAMNAME, programname, _countof(programname));
448 ::LoadStringW(g_hinstExe, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText));
449
450 switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
451 {
452 case IDYES:
453 break;
454 case IDNO:
455 shouldEnlarge = FALSE;
456 break;
457 case IDCANCEL:
458 return;
459 }
460 }
461
462 if (shouldEnlarge)
463 {
464 if (width > curWidth)
465 curWidth = width;
466
467 if (height > curHeight)
468 curHeight = height;
469
470 imageModel.Crop(curWidth, curHeight, 0, 0);
471 }
472 }
473
475
479}
480
482{
483 INT zDelta = (SHORT)HIWORD(wParam);
484
485 if (::GetKeyState(VK_CONTROL) < 0) // Ctrl+Wheel
486 {
487 if (zDelta < 0)
488 {
491 }
492 else if (zDelta > 0)
493 {
496 }
497 }
498 else // Wheel only
499 {
500 UINT nCount = 3;
502 {
503#ifndef SPI_GETWHEELSCROLLCHARS
504 #define SPI_GETWHEELSCROLLCHARS 0x006C // Needed for pre-NT6 PSDK
505#endif
507 for (UINT i = 0; i < nCount; ++i)
508 {
509 if (zDelta < 0)
511 else if (zDelta > 0)
513 }
514 }
515 else
516 {
517 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &nCount, 0);
518 for (UINT i = 0; i < nCount; ++i)
519 {
520 if (zDelta < 0)
522 else if (zDelta > 0)
524 }
525 }
526 }
527
528 return 0;
529}
530
532{
533 WCHAR droppedfile[MAX_PATH];
534
535 HDROP hDrop = (HDROP)wParam;
536 DragQueryFile(hDrop, 0, droppedfile, _countof(droppedfile));
537 DragFinish(hDrop);
538
539 ConfirmSave() && DoLoadImageFile(m_hWnd, droppedfile, TRUE);
540
541 return 0;
542}
543
545{
546 // Loading and setting the window menu from resource
549
550 // Create the status bar
555
556 // Create the tool box
558
559 // Create the palette window
560 RECT rcEmpty = { 0, 0, 0, 0 }; // Rely on WM_SIZE
562 paletteWindow.Create(m_hWnd, rcEmpty, NULL, style, WS_EX_STATICEDGE);
563
564 // Create the canvas
566 canvasWindow.Create(m_hWnd, rcEmpty, NULL, style, WS_EX_CLIENTEDGE);
567
568 // Create and show the miniature if necessary
570 {
572 miniature.ShowWindow(SW_SHOWNOACTIVATE);
573 }
574
575 // Set icon
578
579 return 0;
580}
581
583{
586
588
589 if (s_hHHCTRL_OCX)
590 {
594 }
595
596 SetMenu(NULL);
597 if (m_hMenu)
598 {
600 m_hMenu = NULL;
601 }
602
603 PostQuitMessage(0); /* send a WM_QUIT to the message queue */
604 return 0;
605}
606
608{
610
612 return TRUE;
613
614 CStringW strProgramName;
615 strProgramName.LoadString(IDS_PROGRAMNAME);
616
617 CStringW strSavePromptText;
619
620 switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
621 {
622 case IDYES:
624 return imageModel.IsImageSaved();
625 case IDNO:
626 return TRUE;
627 case IDCANCEL:
628 return FALSE;
629 }
630
631 return TRUE;
632}
633
635{
636 if (ConfirmSave())
637 {
639 }
640 return 0;
641}
642
644{
645 for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem)
646 RemoveMenu(hPopupMenu, IDM_FILE1 + iItem, MF_BYCOMMAND);
647
649 return;
650
652
653 INT cMenuItems = GetMenuItemCount(hPopupMenu);
654
655 for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem)
656 {
657 CStringW& strFile = registrySettings.strFiles[iItem];
658 if (strFile.IsEmpty())
659 break;
660
661 // Condense the lengthy pathname by using '...'
662#define MAX_RECENT_PATHNAME_DISPLAY 30
663 CPath pathFile(strFile);
666
667 // Add an accelerator (by '&') to the item number for quick access
668 WCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1];
669 StringCchPrintfW(szText, _countof(szText), L"&%u %s", iItem + 1, (LPCWSTR)pathFile);
670
671 INT iMenuItem = (cMenuItems - 2) + iItem;
672 InsertMenu(hPopupMenu, iMenuItem, MF_BYPOSITION | MF_STRING, IDM_FILE1 + iItem, szText);
673 }
674}
675
677{
679 return (BOOL)textEditWindow.SendMessage(EM_CANUNDO);
681 return TRUE;
682 return imageModel.CanUndo();
683}
684
686{
688 return FALSE; // There is no "WM_REDO" in EDIT control
689 return imageModel.CanRedo();
690}
691
693{
695 return ::IsClipboardFormatAvailable(CF_UNICODETEXT);
696
700}
701
703{
704 HMENU menu = (HMENU)wParam;
705 BOOL trueSelection = (selectionModel.m_bShow && toolsModel.IsSelection());
707 DWORD dwStart = 0, dwEnd = 0;
708 if (textShown)
709 textEditWindow.SendMessage(EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
710 BOOL hasTextSel = (dwStart < dwEnd);
711
712 //
713 // File menu
714 //
715 if (::GetSubMenu(GetMenu(), 0) == menu)
716 {
717 ProcessFileMenu(menu);
718 }
719
720 //
721 // Edit menu
722 //
725 EnableMenuItem(menu, IDM_EDITCUT, ENABLED_IF(textShown ? hasTextSel : trueSelection));
726 EnableMenuItem(menu, IDM_EDITCOPY, ENABLED_IF(textShown ? hasTextSel : trueSelection));
728 ENABLED_IF(textShown ? hasTextSel : trueSelection));
730 EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
732 EnableMenuItem(menu, IDM_CROPSELECTION, ENABLED_IF(trueSelection));
733
734 //
735 // View menu
736 //
751
752 //
753 // Image menu
754 //
758
759 //
760 // Palette menu
761 //
764 return 0;
765}
766
768{
769 int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
771 {
774 }
776 return 0;
777}
778
780{
782 mm->ptMinTrackSize = { 330, 360 };
783 return 0;
784}
785
787{
788 switch (wParam)
789 {
790 case VK_ESCAPE:
791 canvasWindow.PostMessage(nMsg, wParam, lParam);
792 break;
793 case VK_LEFT:
795 break;
796 case VK_RIGHT:
798 break;
799 case VK_UP:
801 break;
802 case VK_DOWN:
804 break;
805 default:
806 break;
807 }
808 return 0;
809}
810
812{
813 /* Redirect message to common controls */
815 ::SendMessageW(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
816 return 0;
817}
818
820{
821 // Disable commands while dragging mouse
823 {
824 ATLTRACE("locking!\n");
825 return 0;
826 }
827
829 switch (LOWORD(wParam))
830 {
831 case IDM_HELPINFO:
832 {
833 WCHAR infotitle[100], infotext[200];
834 ::LoadStringW(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle));
835 ::LoadStringW(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext));
836 ::ShellAboutW(m_hWnd, infotitle, infotext,
838 break;
839 }
841 DoHtmlHelpW(m_hWnd, L"%SystemRoot%\\Help\\mspaint.chm", HH_DISPLAY_TOPIC, 0);
842 break;
843 case IDM_FILEEXIT:
845 break;
846 case IDM_FILENEW:
847 if (ConfirmSave())
848 {
850 }
851 break;
852 case IDM_FILEOPEN:
853 {
854 WCHAR szFileName[MAX_LONG_PATH] = L"";
855 if (ConfirmSave() && GetOpenFileName(szFileName, _countof(szFileName)))
856 {
857 DoLoadImageFile(m_hWnd, szFileName, TRUE);
858 }
859 break;
860 }
861 case IDM_FILESAVE:
863 break;
864 case IDM_FILESAVEAS:
866 break;
868 // DUMMY: Shows the dialog only, no functionality
869 PAGESETUPDLG psd;
870 ZeroMemory(&psd, sizeof(psd));
871 psd.lStructSize = sizeof(psd);
872 psd.hwndOwner = m_hWnd;
873 PageSetupDlg(&psd);
874 break;
875 case IDM_FILEPRINT:
876 // TODO: Test whether it actually works
877 PRINTDLG pd;
878 ZeroMemory(&pd, sizeof(pd));
879 pd.lStructSize = sizeof(pd);
880 pd.hwndOwner = m_hWnd;
881 pd.hDevMode = NULL; // freed by user
882 pd.hDevNames = NULL; // freed by user
884 pd.nCopies = 1;
885 pd.nFromPage = 0xffff;
886 pd.nToPage = 0xffff;
887 pd.nMinPage = 1;
888 pd.nMaxPage = 0xffff;
889 if (PrintDlg(&pd) == TRUE)
890 {
892 DeleteDC(pd.hDC);
893 }
894 if (pd.hDevMode)
896 if (pd.hDevNames)
898 break;
899 case IDM_FILESEND:
902 {
904 }
905 break;
908 break;
911 break;
914 break;
915 case IDM_FILE1:
916 case IDM_FILE2:
917 case IDM_FILE3:
918 case IDM_FILE4:
919 {
921 if (ConfirmSave())
923 break;
924 }
925 case IDM_EDITUNDO:
926 if (textShown)
927 {
928 textEditWindow.PostMessage(WM_UNDO, 0, 0);
929 break;
930 }
933 break;
934 case IDM_EDITREDO:
935 if (textShown)
936 {
937 // There is no "WM_REDO" in EDIT control
938 break;
939 }
942 break;
943 case IDM_EDITCOPY:
944 if (textShown)
945 {
946 textEditWindow.SendMessage(WM_COPY);
947 break;
948 }
950 break;
951
953
955
956 {
958 HGLOBAL hGlobal = BitmapToClipboardDIB(hbmCopy);
959 if (hGlobal)
960 ::SetClipboardData(CF_DIB, hGlobal);
961 else
963 ::DeleteObject(hbmCopy);
964 }
965
967 break;
968 case IDM_EDITCUT:
969 if (textShown)
970 {
971 textEditWindow.SendMessage(WM_CUT);
972 break;
973 }
974 /* Copy */
976 /* Delete selection */
978 break;
979 case IDM_EDITPASTE:
980 if (textShown)
981 {
982 textEditWindow.SendMessage(WM_PASTE);
983 break;
984 }
985
986 if (!OpenClipboard())
987 break;
988
989 // In many cases, CF_ENHMETAFILE provides a better image than CF_DIB
991 {
992 HENHMETAFILE hEMF = (HENHMETAFILE)::GetClipboardData(CF_ENHMETAFILE);
993 if (hEMF)
994 {
995 HBITMAP hbm = BitmapFromHEMF(hEMF);
997 if (hbm)
998 {
1001 break;
1002 }
1003 }
1004 }
1005
1006 // In many cases, CF_DIB provides a better image than CF_BITMAP
1008 {
1010 if (hbm)
1011 {
1014 break;
1015 }
1016 }
1017
1018 // The last resort
1020 {
1022 if (hbm)
1023 {
1026 break;
1027 }
1028 }
1029
1030 // Failed to paste
1031 {
1032 CStringW strText, strTitle;
1033 strText.LoadString(IDS_CANTPASTE);
1034 strTitle.LoadString(IDS_PROGRAMNAME);
1035 MessageBox(strText, strTitle, MB_ICONINFORMATION);
1036 }
1037
1039 break;
1040 case IDM_CROPSELECTION:
1041 {
1043 if (hbmSelection)
1044 {
1045 imageModel.PushImageForUndo(hbmSelection);
1048 }
1049 break;
1050 }
1052 {
1053 if (textShown)
1054 {
1055 textEditWindow.SendMessage(WM_CLEAR);
1056 break;
1057 }
1058 switch (toolsModel.GetActiveTool())
1059 {
1060 case TOOL_FREESEL:
1061 case TOOL_RECTSEL:
1063 break;
1064
1065 case TOOL_TEXT:
1067 break;
1068 default:
1069 break;
1070 }
1071 break;
1072 }
1073 case IDM_EDITSELECTALL:
1074 {
1075 if (textShown)
1076 {
1077 textEditWindow.SendMessage(EM_SETSEL, 0, -1);
1078 break;
1079 }
1083 canvasWindow.Invalidate(TRUE);
1084 break;
1085 }
1086 case IDM_EDITCOPYTO:
1087 {
1088 WCHAR szFileName[MAX_LONG_PATH];
1089 ::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName));
1090 if (GetSaveFileName(szFileName, _countof(szFileName)))
1091 {
1093 if (!hbmSelection)
1094 {
1096 break;
1097 }
1098 SaveDIBToFile(hbmSelection, szFileName, FALSE);
1099 DeleteObject(hbmSelection);
1100 }
1101 break;
1102 }
1103 case IDM_EDITPASTEFROM:
1104 {
1105 WCHAR szFileName[MAX_LONG_PATH] = L"";
1106 if (GetOpenFileName(szFileName, _countof(szFileName)))
1107 {
1108 HBITMAP hbmNew = DoLoadImageFile(m_hWnd, szFileName, FALSE);
1109 if (hbmNew)
1111 }
1112 break;
1113 }
1115 {
1116 COLORREF rgbColor = paletteModel.GetFgColor();
1117 if (ChooseColor(&rgbColor))
1118 paletteModel.SetFgColor(rgbColor);
1119 break;
1120 }
1123 break;
1126 break;
1128 {
1131 else
1133 break;
1134 }
1139 break;
1141 {
1142 CWaitCursor waitCursor;
1144 switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
1145 {
1146 case 1: /* flip horizontally */
1147 {
1150 else
1152 break;
1153 }
1154 case 2: /* flip vertically */
1155 {
1158 else
1160 break;
1161 }
1162 case 3: /* rotate 90 degrees */
1163 {
1166 else
1168 break;
1169 }
1170 case 4: /* rotate 180 degrees */
1171 {
1174 else
1176 break;
1177 }
1178 case 5: /* rotate 270 degrees */
1179 {
1182 else
1184 break;
1185 }
1186 }
1187 }
1188 break;
1190 {
1191 if (attributesDialog.DoModal(mainWindow.m_hWnd))
1192 {
1193 CWaitCursor waitCursor;
1195 {
1198 INT id = MessageBox(strText, strTitle, MB_ICONINFORMATION | MB_YESNOCANCEL);
1199 if (id != IDYES)
1200 break;
1201
1203 }
1204
1207 {
1209 }
1210 }
1211 break;
1212 }
1214 {
1215 if (stretchSkewDialog.DoModal(mainWindow.m_hWnd))
1216 {
1217 CWaitCursor waitCursor;
1219 {
1222 }
1223 else
1224 {
1227 }
1228 }
1229 break;
1230 }
1233 break;
1234 case IDM_IMAGECROP:
1235 {
1239 break;
1240 }
1241 case IDM_VIEWTOOLBOX:
1242 registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible();
1245 break;
1247 registrySettings.ShowPalette = !paletteWindow.IsWindowVisible();
1250 break;
1251 case IDM_VIEWSTATUSBAR:
1255 break;
1256 case IDM_FORMATICONBAR:
1258 {
1259 if (!fontsDialog.IsWindow())
1260 {
1261 fontsDialog.Create(mainWindow);
1262 }
1265 fontsDialog.SendMessage(DM_REPOSITION, 0, 0);
1266 }
1267 break;
1268 case IDM_VIEWSHOWGRID:
1270 canvasWindow.Invalidate(FALSE);
1271 break;
1276 break;
1277
1278 case IDM_VIEWZOOM125:
1279 canvasWindow.zoomTo(125);
1280 break;
1281 case IDM_VIEWZOOM25:
1282 canvasWindow.zoomTo(250);
1283 break;
1284 case IDM_VIEWZOOM50:
1285 canvasWindow.zoomTo(500);
1286 break;
1287 case IDM_VIEWZOOM100:
1288 canvasWindow.zoomTo(1000);
1289 break;
1290 case IDM_VIEWZOOM200:
1291 canvasWindow.zoomTo(2000);
1292 break;
1293 case IDM_VIEWZOOM400:
1294 canvasWindow.zoomTo(4000);
1295 break;
1296 case IDM_VIEWZOOM800:
1297 canvasWindow.zoomTo(8000);
1298 break;
1299
1300 case IDM_VIEWFULLSCREEN:
1301 // Create and show the fullscreen window
1302 fullscreenWindow.DoCreate();
1304 break;
1305
1306 case IDM_CTRL_PLUS:
1308 break;
1309 case IDM_CTRL_MINUS:
1311 break;
1312 }
1313 return 0;
1314}
1315
1317{
1319 HMENU hSubMenu = ::GetSubMenu(hMenu, iSubMenu);
1320
1323 ptScreen.x, ptScreen.y, 0, m_hWnd, NULL);
1325 if (id != 0)
1327
1328 ::DestroyMenu(hMenu);
1329}
1330
1331// entry point
1332INT WINAPI
1333wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
1334{
1336
1337 // Initialize common controls library
1339 iccx.dwSize = sizeof(iccx);
1341 InitCommonControlsEx(&iccx);
1342
1343 // Load settings from registry
1344 registrySettings.Load(nCmdShow);
1345
1346 // Create the main window
1347 if (!mainWindow.DoCreate())
1348 {
1349 MessageBox(NULL, L"Failed to create main window.", NULL, MB_ICONERROR);
1350 return 1;
1351 }
1352
1353 // Initialize imageModel
1354 if (__argc < 2 || !DoLoadImageFile(mainWindow, __targv[1], TRUE))
1356
1357 // Make the window visible on the screen
1359
1360 // Load the access keys
1362
1363 // The message loop
1364 MSG msg;
1365 while (::GetMessage(&msg, NULL, 0, 0))
1366 {
1367 if (fontsDialog.IsWindow() && fontsDialog.IsDialogMessage(&msg))
1368 continue;
1369
1371 continue;
1372
1375 }
1376
1377 // Unload the access keys
1379
1380 // Write back settings to registry
1382
1383 if (g_szMailTempFile[0])
1385
1386 // Return the value that PostQuitMessage() gave
1387 return (INT)msg.wParam;
1388}
PRTL_UNICODE_STRING_BUFFER Path
Arabic default style
Definition: afstyles.h:94
#define ATLTRACE(format,...)
Definition: atltrace.h:269
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define IDI_APPICON
Definition: resource.h:166
VOID ShowError(DWORD dwLastError)
Definition: progress.c:29
CAttributesDialog attributesDialog
Definition: dialogs.cpp:14
CFontsDialog fontsDialog
Definition: dialogs.cpp:16
CStretchSkewDialog stretchSkewDialog
Definition: dialogs.cpp:15
CMirrorRotateDialog mirrorRotateDialog
Definition: dialogs.cpp:13
ULONG(WINAPI * FN_MAPISendMail)(LHANDLE, ULONG_PTR, lpMapiMessage, FLAGS, ULONG)
Definition: main.cpp:96
HWND g_hStatusBar
Definition: main.cpp:23
BOOL g_imageSaved
Definition: main.cpp:21
WCHAR g_szMailTempFile[MAX_LONG_PATH]
Definition: main.cpp:19
BOOL g_askBeforeEnlarging
Definition: main.cpp:16
WCHAR g_szFileName[MAX_LONG_PATH]
Definition: main.cpp:18
BOOL g_showGrid
Definition: main.cpp:22
HWND(WINAPI * FN_HtmlHelpW)(HWND, LPCWSTR, UINT, DWORD_PTR)
Definition: main.cpp:27
#define MAX_RECENT_PATHNAME_DISPLAY
static UINT_PTR APIENTRY OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: main.cpp:74
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
Definition: main.cpp:99
static HINSTANCE s_hHHCTRL_OCX
Definition: main.cpp:29
ULONG(WINAPI * FN_MAPISendMailW)(LHANDLE, ULONG_PTR, lpMapiMessageW, FLAGS, ULONG)
Definition: main.cpp:97
CMainWindow mainWindow
Definition: main.cpp:25
void ShowOutOfMemory(void)
Definition: main.cpp:34
static FN_HtmlHelpW s_pHtmlHelpW
Definition: main.cpp:30
BOOL g_isAFile
Definition: main.cpp:20
static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData)
Definition: main.cpp:321
HINSTANCE g_hinstExe
Definition: main.cpp:17
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
Definition: main.cpp:1333
#define SPI_GETWHEELSCROLLCHARS
static BOOL FileExtFromFilter(LPWSTR pExt, OPENFILENAME *pOFN)
Definition: main.cpp:48
#define CY_PALETTE
Definition: palette.h:12
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
RegistrySettings registrySettings
Definition: registry.cpp:14
#define MAX_ZOOM
Definition: precomp.h:45
#define MIN_ZOOM
Definition: precomp.h:44
SelectionModel selectionModel
CToolBox toolBoxContainer
Definition: toolbox.cpp:11
#define CHECKED_IF(bChecked)
Definition: precomp.h:80
#define MAX_LONG_PATH
Definition: precomp.h:47
CTextEditWindow textEditWindow
Definition: textedit.cpp:12
#define ENABLED_IF(bEnabled)
Definition: precomp.h:84
#define MAX_RECENT_FILES
Definition: registry.h:10
#define BAR1ID_BOTTOM
Definition: registry.h:51
#define BAR2ID_RIGHT
Definition: registry.h:56
#define ID_MENU
Definition: resource.h:32
#define IDS_SAVEPROMPTTEXT
Definition: resource.h:191
#define IDM_EDITSELECTALL
Definition: resource.h:67
#define IDM_VIEWSTATUSBAR
Definition: resource.h:73
#define IDS_DEFAULTFILENAME
Definition: resource.h:192
#define IDS_INFOTEXT
Definition: resource.h:189
#define IDS_INFOTITLE
Definition: resource.h:188
#define IDM_EDITCOPYTO
Definition: resource.h:68
#define IDM_FILESEND
Definition: resource.h:46
#define IDM_EDITDELETESELECTION
Definition: resource.h:65
#define IDM_FILEEXIT
Definition: resource.h:58
#define IDM_COLORSOLDPALETTE
Definition: resource.h:96
#define IDM_FILEPAGESETUP
Definition: resource.h:43
#define IDM_COLORSEDITPALETTE
Definition: resource.h:94
#define IDM_EDITCUT
Definition: resource.h:62
#define IDM_IMAGECROP
Definition: resource.h:88
#define IDM_VIEWZOOM800
Definition: resource.h:81
#define IDM_COLORSMODERNPALETTE
Definition: resource.h:95
#define IDM_FILE1
Definition: resource.h:53
#define IDM_FILESAVE
Definition: resource.h:37
#define IDM_EDITPASTEFROM
Definition: resource.h:69
#define IDM_EDITUNDO
Definition: resource.h:60
#define IDM_FILESAVEAS
Definition: resource.h:38
#define IDM_VIEWSHOWMINIATURE
Definition: resource.h:84
#define IDM_FILEASWALLPAPERPLANE
Definition: resource.h:48
#define IDM_CTRL_MINUS
Definition: resource.h:107
#define IDM_EDITCOPY
Definition: resource.h:63
#define IDM_FORMATICONBAR
Definition: resource.h:74
#define IDM_FILE2
Definition: resource.h:54
#define IDM_FILE4
Definition: resource.h:56
#define IDM_EDITREDO
Definition: resource.h:61
#define IDS_PROGRAMNAME
Definition: resource.h:186
#define IDM_EDITINVERTSELECTION
Definition: resource.h:66
#define IDM_VIEWZOOM25
Definition: resource.h:76
#define IDS_CANTPASTE
Definition: resource.h:228
#define IDM_IMAGEINVERTCOLORS
Definition: resource.h:89
#define IDM_VIEWTOOLBOX
Definition: resource.h:71
#define IDM_IMAGEATTRIBUTES
Definition: resource.h:90
#define ID_POPUPMENU
Definition: resource.h:33
#define IDM_FILEMOSTRECENTLYUSEDFILE
Definition: resource.h:52
#define IDM_HELPINFO
Definition: resource.h:99
#define IDS_LOSECOLOR
Definition: resource.h:231
#define IDM_VIEWFULLSCREEN
Definition: resource.h:82
#define IDM_IMAGESTRETCHSKEW
Definition: resource.h:87
#define IDM_EDITPASTE
Definition: resource.h:64
#define IDM_FILEASWALLPAPERCENTERED
Definition: resource.h:49
#define IDM_HELPHELPTOPICS
Definition: resource.h:98
#define IDM_VIEWSHOWGRID
Definition: resource.h:83
#define IDM_IMAGEDRAWOPAQUE
Definition: resource.h:92
#define IDM_VIEWZOOM200
Definition: resource.h:79
#define IDS_WINDOWTITLE
Definition: resource.h:187
#define IDM_FILE3
Definition: resource.h:55
#define IDM_FILENEW
Definition: resource.h:35
#define IDM_VIEWCOLORPALETTE
Definition: resource.h:72
#define IDS_CANTSENDMAIL
Definition: resource.h:230
#define IDM_VIEWZOOM400
Definition: resource.h:80
#define IDM_VIEWZOOM50
Definition: resource.h:77
#define IDM_FILEPRINT
Definition: resource.h:44
#define IDM_IMAGEDELETEIMAGE
Definition: resource.h:91
#define IDM_CROPSELECTION
Definition: resource.h:109
#define IDM_VIEWZOOM125
Definition: resource.h:75
#define IDS_ALLPICTUREFILES
Definition: resource.h:213
#define ID_RECTSEL
Definition: resource.h:113
#define IDS_ENLARGEPROMPTTEXT
Definition: resource.h:221
#define IDM_VIEWZOOM100
Definition: resource.h:78
#define IDM_IMAGEROTATEMIRROR
Definition: resource.h:86
#define IDM_CTRL_PLUS
Definition: resource.h:106
#define IDM_FILEOPEN
Definition: resource.h:36
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: resource.h:50
#define CF_UNICODETEXT
Definition: constants.h:408
#define CF_BITMAP
Definition: constants.h:397
#define CF_ENHMETAFILE
Definition: constants.h:409
#define CF_DIB
Definition: constants.h:403
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
HINSTANCE hInstance
Definition: charmap.c:19
static HRESULT GetImporterFilterString(CSimpleString &strImporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultLoad, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:794
static HRESULT GetExporterFilterString(CSimpleString &strExporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultSave, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:817
@ excludeDefaultLoad
Definition: atlimage.h:702
@ excludeDefaultSave
Definition: atlimage.h:703
BOOL CompactPathEx(UINT nMaxChars, DWORD dwFlags=0)
Definition: atlpath.h:180
int GetSize() const
Definition: atlsimpcoll.h:104
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:886
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:639
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
BOOL OpenClipboard()
Definition: atlwin.h:1038
BOOL DestroyWindow()
Definition: atlwin.h:462
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
Definition: atlwin.h:1002
HMENU GetMenu() const
Definition: atlwin.h:682
BOOL IsWindowVisible() const
Definition: atlwin.h:958
HWND m_hWnd
Definition: atlwin.h:273
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1333
BOOL IsWindow() const
Definition: atlwin.h:947
BOOL m_bBlackAndWhite
Definition: dialogs.h:67
BOOL m_drawing
Definition: canvas.h:43
VOID OnEndDraw(BOOL bCancel)
Definition: canvas.cpp:701
VOID updateScrollPos(INT x=0, INT y=0)
Definition: canvas.cpp:244
VOID zoomTo(INT newZoom, LONG left=0, LONG top=0)
Definition: canvas.cpp:107
static BOOL IsExtensionSupported(PWCHAR pchDotExt)
Definition: atlimagedx.h:165
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:811
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
Definition: main.cpp:431
void alignChildrenToMainWindow()
Definition: main.cpp:341
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:786
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu)
Definition: main.cpp:1316
HMENU m_hMenu
Definition: main.h:42
BOOL GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
Definition: main.cpp:238
LRESULT OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:531
void ProcessFileMenu(HMENU hPopupMenu)
Definition: main.cpp:643
BOOL CanUndo() const
Definition: main.cpp:676
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:767
LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:634
BOOL ConfirmSave()
Definition: main.cpp:607
BOOL GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
Definition: main.cpp:206
LRESULT OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:702
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:819
LRESULT OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:779
LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:481
void saveImage(BOOL overwrite)
Definition: main.cpp:407
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:544
BOOL CanRedo() const
Definition: main.cpp:685
BOOL CanPaste() const
Definition: main.cpp:692
HWND Create()
Definition: gui.cpp:763
LRESULT OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:582
BOOL ChooseColor(IN OUT COLORREF *prgbColor)
Definition: main.cpp:282
HWND DoCreate()
Definition: main.cpp:309
HWND DoCreate(HWND hwndParent)
Definition: miniature.cpp:27
POINT percentage
Definition: dialogs.h:88
BOOL DoCreate(HWND hwndParent)
Definition: toolbox.cpp:80
int GetWidth() const
Definition: history.cpp:253
HBITMAP LockBitmap()
Definition: history.cpp:345
BOOL CanUndo() const
Definition: history.h:29
void FlipVertically()
Definition: history.cpp:284
void FlipHorizontally()
Definition: history.cpp:276
BOOL CanRedo() const
Definition: history.h:30
void PushBlackAndWhite()
Definition: history.cpp:336
void InvertColors()
Definition: history.cpp:263
BOOL IsImageSaved() const
Definition: history.cpp:224
void Redo(void)
Definition: history.cpp:96
void PushImageForUndo()
Definition: history.cpp:127
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:74
void NotifyImageChanged()
Definition: history.cpp:23
void RotateNTimes90Degrees(int iN)
Definition: history.cpp:292
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:191
void UnlockBitmap(HBITMAP hbmLocked)
Definition: history.cpp:354
int GetHeight() const
Definition: history.cpp:258
HDC GetDC()
Definition: history.cpp:271
void SaveImage(LPCWSTR lpFileName)
Definition: history.cpp:219
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:229
BOOL IsBlackAndWhite()
Definition: history.cpp:328
PAL_TYPE SelectedPalette()
COLORREF GetBgColor() const
void SetFgColor(COLORREF newColor)
void SelectPalette(PAL_TYPE nPalette)
COLORREF GetFgColor() const
DWORD ShowTextTool
Definition: registry.h:41
DWORD ShowToolBox
Definition: registry.h:44
DWORD ShowPalette
Definition: registry.h:43
DWORD ShowThumbnail
Definition: registry.h:22
DWORD ShowStatusBar
Definition: registry.h:42
CStringW strFiles[MAX_RECENT_FILES]
Definition: registry.h:31
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:29
void Load(INT nCmdShow)
Definition: registry.cpp:115
static void SetWallpaper(LPCWSTR szFileName, WallpaperStyle style)
Definition: registry.cpp:39
void RotateNTimes90Degrees(int iN)
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY)
HBITMAP GetSelectionContents()
void InsertFromHBITMAP(HBITMAP hbmColor, INT x=0, INT y=0, HBITMAP hbmMask=NULL)
void moveSelection(INT xDelta, INT yDelta)
int GetZoom() const
Definition: toolsmodel.cpp:261
BOOL IsSelection() const
Definition: toolsmodel.cpp:41
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:144
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:249
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:254
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:134
void SpecialTweak(BOOL bMinus)
Definition: mouse.cpp:1196
void selectAll()
Definition: toolsmodel.cpp:307
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:900
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define GetSaveFileName
Definition: commdlg.h:666
#define CDM_SETCONTROLTEXT
Definition: commdlg.h:47
#define OFN_EXPLORER
Definition: commdlg.h:104
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
#define PrintDlg
Definition: commdlg.h:668
#define PD_RETURNDC
Definition: commdlg.h:155
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define CC_RGBINIT
Definition: commdlg.h:50
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define ChooseColor
Definition: commdlg.h:661
#define CDM_GETFILEPATH
Definition: commdlg.h:44
#define CDN_TYPECHANGE
Definition: commdlg.h:39
#define PageSetupDlg
Definition: commdlg.h:667
#define GetOpenFileName
Definition: commdlg.h:665
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
Definition: dib.cpp:226
BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile, REFGUID guidFileType)
Definition: dib.cpp:151
HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap)
Definition: dib.cpp:447
HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF)
Definition: dib.cpp:557
HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal)
Definition: dib.cpp:510
HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
Definition: dib.cpp:256
int GetDIBHeight(HBITMAP hBitmap)
Definition: dib.cpp:144
int GetDIBWidth(HBITMAP hBitmap)
Definition: dib.cpp:136
#define cmb13
Definition: dlgs.h:60
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
UINT uFlags
Definition: api.c:59
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
#define LoadLibraryW(x)
Definition: compat.h:747
static const WCHAR messageW[]
Definition: error.c:33
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:538
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777
#define assert(x)
Definition: debug.h:53
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define ULONG_PTR
Definition: config.h:101
OPENFILENAMEW sfn
Definition: eventvwr.c:101
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
CFullscreenWindow fullscreenWindow
Definition: fullscreen.cpp:10
pKey DeleteObject()
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum attachment
Definition: glext.h:6295
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
ImageModel imageModel
Definition: history.cpp:11
#define HH_DISPLAY_TOPIC
Definition: htmlhelp.h:22
#define HH_CLOSE_ALL
Definition: htmlhelp.h:41
_CRTIMP int __argc
Definition: getargs.c:21
#define __targv
Definition: tchar.h:504
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define MAPI_DIALOG
Definition: mapi.h:177
struct MapiMessageW * lpMapiMessageW
Definition: mapi.h:237
struct MapiMessage * lpMapiMessage
Definition: mapi.h:217
ULONG_PTR LHANDLE
Definition: mapi.h:30
#define MAPI_LOGON_UI
Definition: mapi.h:159
ULONG FLAGS
Definition: mapi.h:36
CMiniatureWindow miniature
Definition: miniature.cpp:12
#define pch(ap)
Definition: match.c:418
HACCEL hAccel
Definition: main.c:47
LPCWSTR szPath
Definition: env.c:37
static HBITMAP
Definition: button.c:44
static HANDLE ULONG_PTR dwData
Definition: file.c:35
static IHTMLWindow2 * window
Definition: events.c:77
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define UNICODE_NULL
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define L(x)
Definition: ntvdm.h:50
CPaletteWindow paletteWindow
Definition: palette.cpp:19
PaletteModel paletteModel
@ PAL_MODERN
Definition: palettemodel.h:14
@ PAL_OLDTYPE
Definition: palettemodel.h:15
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
#define WS_GROUP
Definition: pedump.c:633
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
short SHORT
Definition: pedump.c:59
#define WS_HSCROLL
Definition: pedump.c:628
#define ICC_USEREX_CLASSES
Definition: commctrl.h:68
#define TB_CHECKBUTTON
Definition: commctrl.h:1043
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define SB_SETMINHEIGHT
Definition: commctrl.h:1962
#define TOOLBARCLASSNAME
Definition: commctrl.h:946
#define SB_SETPARTS
Definition: commctrl.h:1959
#define SBARS_SIZEGRIP
Definition: commctrl.h:1928
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define STATUSCLASSNAME
Definition: commctrl.h:1944
#define WM_NOTIFY
Definition: richedit.h:61
#define test
Definition: rosglue.h:37
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
#define DragQueryFile
Definition: shellapi.h:687
#define PathFindFileName
Definition: shlwapi.h:937
OPENFILENAME ofn
Definition: sndrec32.cpp:56
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
ULONG nPosition
Definition: mapi.h:54
PWSTR lpszPathName
Definition: mapi.h:55
PWSTR lpszFileName
Definition: mapi.h:56
ULONG nPosition
Definition: mapi.h:44
NMHDR hdr
Definition: commdlg.h:411
LPOPENFILENAMEW lpOFN
Definition: commdlg.h:412
RECT rcNormalPosition
Definition: winuser.h:3298
Definition: uimain.c:89
Definition: tftpd.h:60
COLORREF rgbResult
Definition: commdlg.h:242
HWND hwndOwner
Definition: commdlg.h:240
COLORREF * lpCustColors
Definition: commdlg.h:243
DWORD lStructSize
Definition: commdlg.h:239
POINT ptMinTrackSize
Definition: winuser.h:3633
UINT code
Definition: winuser.h:3162
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nFilterIndex
Definition: commdlg.h:335
HWND hwndOwner
Definition: commdlg.h:330
HINSTANCE hInstance
Definition: commdlg.h:331
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
HINSTANCE hInstance
Definition: commdlg.h:362
HWND hwndOwner
Definition: commdlg.h:361
DWORD Flags
Definition: commdlg.h:373
LPWSTR lpstrFile
Definition: commdlg.h:367
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:368
LPCWSTR lpstrFilter
Definition: commdlg.h:363
DWORD nFilterIndex
Definition: commdlg.h:366
WORD nMaxPage
Definition: commdlg.h:474
HDC hDC
Definition: commdlg.h:469
DWORD Flags
Definition: commdlg.h:470
WORD nCopies
Definition: commdlg.h:475
WORD nFromPage
Definition: commdlg.h:471
HGLOBAL hDevMode
Definition: commdlg.h:467
WORD nToPage
Definition: commdlg.h:472
WORD nMinPage
Definition: commdlg.h:473
HGLOBAL hDevNames
Definition: commdlg.h:468
HWND hwndOwner
Definition: commdlg.h:466
DWORD lStructSize
Definition: commdlg.h:465
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
DWORD lStructSize
Definition: commdlg.h:433
HWND hwndOwner
Definition: commdlg.h:434
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define CX_TOOLBAR
Definition: toolbox.h:14
@ TOOL_TEXT
Definition: toolsmodel.h:21
@ TOOL_FREESEL
Definition: toolsmodel.h:12
@ TOOL_RECTSEL
Definition: toolsmodel.h:13
#define DWORD_PTR
Definition: treelist.c:76
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t DWORD_PTR
Definition: typedefs.h:65
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define OUT
Definition: typedefs.h:40
int ret
#define ZeroMemory
Definition: winbase.h:1737
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:446
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:449
#define lstrlen
Definition: winbase.h:3901
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
#define SRCCOPY
Definition: wingdi.h:333
BOOL WINAPI DeleteDC(_In_ HDC)
#define SW_SHOWMAXIMIZED
Definition: winuser.h:776
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define SW_HIDE
Definition: winuser.h:771
#define WM_CLOSE
Definition: winuser.h:1624
#define SWP_NOACTIVATE
Definition: winuser.h:1245
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SWP_NOREPOSITION
Definition: winuser.h:1253
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1746
#define WM_PASTE
Definition: winuser.h:1866
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define IDCANCEL
Definition: winuser.h:834
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_VSCROLL
Definition: winuser.h:1747
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
#define TPM_RIGHTBUTTON
Definition: winuser.h:2383
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define EM_GETSEL
Definition: winuser.h:2000
#define CharLower
Definition: winuser.h:5749
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1614
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1743
#define MF_STRING
Definition: winuser.h:138
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define VK_CONTROL
Definition: winuser.h:2206
#define VK_UP
Definition: winuser.h:2228
#define SW_SHOWNOACTIVATE
Definition: winuser.h:777
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_CUT
Definition: winuser.h:1864
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define FindWindowEx
Definition: winuser.h:5790
#define WM_UNDO
Definition: winuser.h:1868
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define HWND_DESKTOP
Definition: winuser.h:1212
#define MB_ICONERROR
Definition: winuser.h:790
#define EM_CANUNDO
Definition: winuser.h:1986
#define GetMessage
Definition: winuser.h:5802
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define SWP_NOCOPYBITS
Definition: winuser.h:1246
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MF_BYPOSITION
Definition: winuser.h:203
#define IDNO
Definition: winuser.h:839
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define WM_NULL
Definition: winuser.h:1610
#define SendMessage
Definition: winuser.h:5855
#define SB_LINEDOWN
Definition: winuser.h:565
#define EM_SETSEL
Definition: winuser.h:2021
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define PostMessage
Definition: winuser.h:5844
HWND WINAPI GetParent(_In_ HWND)
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define VK_LEFT
Definition: winuser.h:2227
#define VK_RIGHT
Definition: winuser.h:2229
#define MB_ICONQUESTION
Definition: winuser.h:792
#define VK_DOWN
Definition: winuser.h:2230
#define MessageBox
Definition: winuser.h:5834
#define MB_ICONINFORMATION
Definition: winuser.h:805
#define WM_COPY
Definition: winuser.h:1865
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
#define VK_SHIFT
Definition: winuser.h:2205
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SW_SHOW
Definition: winuser.h:778
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_CLEAR
Definition: winuser.h:1867
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define DispatchMessage
Definition: winuser.h:5777
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define IDYES
Definition: winuser.h:838
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
#define TPM_RETURNCMD
Definition: winuser.h:2390
#define SWP_NOZORDER
Definition: winuser.h:1250
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define DM_REPOSITION
Definition: winuser.h:2103
#define InsertMenu
Definition: winuser.h:5815
#define VK_ESCAPE
Definition: winuser.h:2217
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MB_YESNOCANCEL
Definition: winuser.h:821
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SHORT WINAPI GetKeyState(_In_ int)
HDWP WINAPI BeginDeferWindowPos(_In_ int)
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185