ReactOS 0.4.17-dev-243-g1369312
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{
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 {
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));
733
734 //
735 // View menu
736 //
751
752 //
753 // Image menu
754 //
758
759 //
760 // Palette menu
761 //
766 return 0;
767}
768
770{
771 int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
773 {
776 }
778 return 0;
779}
780
782{
784 mm->ptMinTrackSize = { 330, 360 };
785 return 0;
786}
787
789{
790 switch (wParam)
791 {
792 case VK_ESCAPE:
793 canvasWindow.PostMessage(nMsg, wParam, lParam);
794 break;
795 case VK_LEFT:
797 break;
798 case VK_RIGHT:
800 break;
801 case VK_UP:
803 break;
804 case VK_DOWN:
806 break;
807 default:
808 break;
809 }
810 return 0;
811}
812
814{
815 /* Redirect message to common controls */
817 ::SendMessageW(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
818 return 0;
819}
820
822{
823 // Disable commands while dragging mouse
825 {
826 ATLTRACE("locking!\n");
827 return 0;
828 }
829
831 switch (LOWORD(wParam))
832 {
833 case IDM_HELPINFO:
834 {
835 WCHAR infotitle[100], infotext[200];
836 ::LoadStringW(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle));
837 ::LoadStringW(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext));
838 ::ShellAboutW(m_hWnd, infotitle, infotext,
840 break;
841 }
843 DoHtmlHelpW(m_hWnd, L"%SystemRoot%\\Help\\mspaint.chm", HH_DISPLAY_TOPIC, 0);
844 break;
845 case IDM_FILEEXIT:
847 break;
848 case IDM_FILENEW:
849 if (ConfirmSave())
850 {
852 }
853 break;
854 case IDM_FILEOPEN:
855 {
856 WCHAR szFileName[MAX_LONG_PATH] = L"";
857 if (ConfirmSave() && GetOpenFileName(szFileName, _countof(szFileName)))
858 {
859 DoLoadImageFile(m_hWnd, szFileName, TRUE);
860 }
861 break;
862 }
863 case IDM_FILESAVE:
865 break;
866 case IDM_FILESAVEAS:
868 break;
870 // DUMMY: Shows the dialog only, no functionality
871 PAGESETUPDLG psd;
872 ZeroMemory(&psd, sizeof(psd));
873 psd.lStructSize = sizeof(psd);
874 psd.hwndOwner = m_hWnd;
875 PageSetupDlg(&psd);
876 break;
877 case IDM_FILEPRINT:
878 // TODO: Test whether it actually works
879 PRINTDLG pd;
880 ZeroMemory(&pd, sizeof(pd));
881 pd.lStructSize = sizeof(pd);
882 pd.hwndOwner = m_hWnd;
883 pd.hDevMode = NULL; // freed by user
884 pd.hDevNames = NULL; // freed by user
886 pd.nCopies = 1;
887 pd.nFromPage = 0xffff;
888 pd.nToPage = 0xffff;
889 pd.nMinPage = 1;
890 pd.nMaxPage = 0xffff;
891 if (PrintDlg(&pd) == TRUE)
892 {
894 DeleteDC(pd.hDC);
895 }
896 if (pd.hDevMode)
898 if (pd.hDevNames)
900 break;
901 case IDM_FILESEND:
904 {
906 }
907 break;
910 break;
913 break;
916 break;
917 case IDM_FILE1:
918 case IDM_FILE2:
919 case IDM_FILE3:
920 case IDM_FILE4:
921 {
923 if (ConfirmSave())
925 break;
926 }
927 case IDM_EDITUNDO:
928 if (textShown)
929 {
930 textEditWindow.PostMessage(WM_UNDO, 0, 0);
931 break;
932 }
935 break;
936 case IDM_EDITREDO:
937 if (textShown)
938 {
939 // There is no "WM_REDO" in EDIT control
940 break;
941 }
944 break;
945 case IDM_EDITCOPY:
946 if (textShown)
947 {
948 textEditWindow.SendMessage(WM_COPY);
949 break;
950 }
952 break;
953
955
957
958 {
960 HGLOBAL hGlobal = BitmapToClipboardDIB(hbmCopy);
961 if (hGlobal)
962 {
963 ::SetClipboardData(CF_DIB, hGlobal);
964 }
965 else
966 {
969 }
970 ::DeleteObject(hbmCopy);
971 }
972
974 break;
975 case IDM_EDITCUT:
976 if (textShown)
977 {
978 textEditWindow.SendMessage(WM_CUT);
979 break;
980 }
981 /* Copy */
983 /* Delete selection */
985 break;
986 case IDM_EDITPASTE:
987 if (textShown)
988 {
989 textEditWindow.SendMessage(WM_PASTE);
990 break;
991 }
992
993 if (!OpenClipboard())
994 break;
995
996 // In many cases, CF_ENHMETAFILE provides a better image than CF_DIB
998 {
999 HENHMETAFILE hEMF = (HENHMETAFILE)::GetClipboardData(CF_ENHMETAFILE);
1000 if (hEMF)
1001 {
1002 HBITMAP hbm = BitmapFromHEMF(hEMF);
1003 ::DeleteEnhMetaFile(hEMF);
1004 if (hbm)
1005 {
1008 break;
1009 }
1010 }
1011 }
1012
1013 // In many cases, CF_DIB provides a better image than CF_BITMAP
1015 {
1017 if (hbm)
1018 {
1021 break;
1022 }
1023 }
1024
1025 // The last resort
1027 {
1029 if (hbm)
1030 {
1033 break;
1034 }
1035 }
1036
1037 // Failed to paste
1038 {
1039 CStringW strText, strTitle;
1040 strText.LoadString(IDS_CANTPASTE);
1041 strTitle.LoadString(IDS_PROGRAMNAME);
1042 MessageBox(strText, strTitle, MB_ICONINFORMATION);
1043 }
1044
1046 break;
1047 case IDM_CROPSELECTION:
1048 {
1050 if (hbmSelection)
1051 {
1052 imageModel.PushImageForUndo(hbmSelection);
1055 }
1056 break;
1057 }
1059 {
1060 if (textShown)
1061 {
1062 textEditWindow.SendMessage(WM_CLEAR);
1063 break;
1064 }
1065 switch (toolsModel.GetActiveTool())
1066 {
1067 case TOOL_FREESEL:
1068 case TOOL_RECTSEL:
1070 break;
1071
1072 case TOOL_TEXT:
1074 break;
1075 default:
1076 break;
1077 }
1078 break;
1079 }
1080 case IDM_EDITSELECTALL:
1081 {
1082 if (textShown)
1083 {
1084 textEditWindow.SendMessage(EM_SETSEL, 0, -1);
1085 break;
1086 }
1090 canvasWindow.Invalidate(TRUE);
1091 break;
1092 }
1093 case IDM_EDITCOPYTO:
1094 {
1095 WCHAR szFileName[MAX_LONG_PATH];
1096 ::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName));
1097 if (GetSaveFileName(szFileName, _countof(szFileName)))
1098 {
1100 if (!hbmSelection)
1101 {
1104 break;
1105 }
1106 SaveDIBToFile(hbmSelection, szFileName, FALSE);
1107 DeleteObject(hbmSelection);
1108 }
1109 break;
1110 }
1111 case IDM_EDITPASTEFROM:
1112 {
1113 WCHAR szFileName[MAX_LONG_PATH] = L"";
1114 if (GetOpenFileName(szFileName, _countof(szFileName)))
1115 {
1116 HBITMAP hbmNew = DoLoadImageFile(m_hWnd, szFileName, FALSE);
1117 if (hbmNew)
1119 }
1120 break;
1121 }
1123 {
1124 COLORREF rgbColor = paletteModel.GetFgColor();
1125 if (ChooseColor(&rgbColor))
1126 paletteModel.SetFgColor(rgbColor);
1127 break;
1128 }
1131 break;
1134 break;
1137 break;
1140 break;
1142 {
1145 else
1147 break;
1148 }
1153 break;
1155 {
1156 CWaitCursor waitCursor;
1158 switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
1159 {
1160 case 1: /* flip horizontally */
1161 {
1164 else
1166 break;
1167 }
1168 case 2: /* flip vertically */
1169 {
1172 else
1174 break;
1175 }
1176 case 3: /* rotate 90 degrees */
1177 {
1180 else
1182 break;
1183 }
1184 case 4: /* rotate 180 degrees */
1185 {
1188 else
1190 break;
1191 }
1192 case 5: /* rotate 270 degrees */
1193 {
1196 else
1198 break;
1199 }
1200 }
1201 }
1202 break;
1204 {
1205 if (attributesDialog.DoModal(mainWindow.m_hWnd))
1206 {
1207 CWaitCursor waitCursor;
1209 {
1212 INT id = MessageBox(strText, strTitle, MB_ICONINFORMATION | MB_YESNOCANCEL);
1213 if (id != IDYES)
1214 break;
1215
1217 }
1218
1221 {
1223 }
1224 }
1225 break;
1226 }
1228 {
1229 if (stretchSkewDialog.DoModal(mainWindow.m_hWnd))
1230 {
1231 CWaitCursor waitCursor;
1233 {
1236 }
1237 else
1238 {
1241 }
1242 }
1243 break;
1244 }
1247 break;
1248 case IDM_IMAGECROP:
1249 {
1253 break;
1254 }
1255 case IDM_VIEWTOOLBOX:
1256 registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible();
1259 break;
1261 registrySettings.ShowPalette = !paletteWindow.IsWindowVisible();
1264 break;
1265 case IDM_VIEWSTATUSBAR:
1269 break;
1270 case IDM_FORMATICONBAR:
1272 {
1273 if (!fontsDialog.IsWindow())
1274 {
1275 fontsDialog.Create(mainWindow);
1276 }
1279 fontsDialog.SendMessage(DM_REPOSITION, 0, 0);
1280 }
1281 break;
1282 case IDM_VIEWSHOWGRID:
1284 canvasWindow.Invalidate(FALSE);
1285 break;
1290 break;
1291
1292 case IDM_VIEWZOOM125:
1293 canvasWindow.zoomTo(125);
1294 break;
1295 case IDM_VIEWZOOM25:
1296 canvasWindow.zoomTo(250);
1297 break;
1298 case IDM_VIEWZOOM50:
1299 canvasWindow.zoomTo(500);
1300 break;
1301 case IDM_VIEWZOOM100:
1302 canvasWindow.zoomTo(1000);
1303 break;
1304 case IDM_VIEWZOOM200:
1305 canvasWindow.zoomTo(2000);
1306 break;
1307 case IDM_VIEWZOOM400:
1308 canvasWindow.zoomTo(4000);
1309 break;
1310 case IDM_VIEWZOOM800:
1311 canvasWindow.zoomTo(8000);
1312 break;
1313
1314 case IDM_VIEWFULLSCREEN:
1315 // Create and show the fullscreen window
1316 fullscreenWindow.DoCreate();
1318 break;
1319
1320 case IDM_CTRL_PLUS:
1322 break;
1323 case IDM_CTRL_MINUS:
1325 break;
1326 }
1327 return 0;
1328}
1329
1331{
1333 HMENU hSubMenu = ::GetSubMenu(hMenu, iSubMenu);
1334
1337 ptScreen.x, ptScreen.y, 0, m_hWnd, NULL);
1339 if (id != 0)
1341
1342 ::DestroyMenu(hMenu);
1343}
1344
1345// entry point
1346INT WINAPI
1347wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
1348{
1350
1351 // Initialize common controls library
1353 iccx.dwSize = sizeof(iccx);
1355 InitCommonControlsEx(&iccx);
1356
1357 // Load settings from registry
1358 registrySettings.Load(nCmdShow);
1359
1360 // Create the main window
1361 if (!mainWindow.DoCreate())
1362 {
1363 MessageBox(NULL, L"Failed to create main window.", NULL, MB_ICONERROR);
1364 return 1;
1365 }
1366
1367 // Initialize imageModel
1368 if (__argc < 2 || !DoLoadImageFile(mainWindow, __targv[1], TRUE))
1370
1371 // Make the window visible on the screen
1373
1374 // Load the access keys
1376
1377 // The message loop
1378 MSG msg;
1379 while (::GetMessage(&msg, NULL, 0, 0))
1380 {
1381 if (fontsDialog.IsWindow() && fontsDialog.IsDialogMessage(&msg))
1382 continue;
1383
1385 continue;
1386
1389 }
1390
1391 // Unload the access keys
1393
1394 // Write back settings to registry
1396
1397 if (g_szMailTempFile[0])
1399
1400 // Return the value that PostQuitMessage() gave
1401 return (INT)msg.wParam;
1402}
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:1347
#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:193
#define IDM_EDITSELECTALL
Definition: resource.h:67
#define IDM_VIEWSTATUSBAR
Definition: resource.h:73
#define IDS_DEFAULTFILENAME
Definition: resource.h:194
#define IDS_INFOTEXT
Definition: resource.h:191
#define IDS_INFOTITLE
Definition: resource.h:190
#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:109
#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:188
#define IDM_EDITINVERTSELECTION
Definition: resource.h:66
#define IDM_VIEWZOOM25
Definition: resource.h:76
#define IDS_CANTPASTE
Definition: resource.h:230
#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:101
#define IDS_LOSECOLOR
Definition: resource.h:233
#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:100
#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:189
#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:232
#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:111
#define IDM_VIEWZOOM125
Definition: resource.h:75
#define IDS_ALLPICTUREFILES
Definition: resource.h:215
#define ID_RECTSEL
Definition: resource.h:115
#define IDS_ENLARGEPROMPTTEXT
Definition: resource.h:223
#define IDM_VIEWZOOM100
Definition: resource.h:78
#define IDM_IMAGEROTATEMIRROR
Definition: resource.h:86
#define IDM_CTRL_PLUS
Definition: resource.h:108
#define IDM_FILEOPEN
Definition: resource.h:36
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: resource.h:50
#define IDM_COLORSGRAYSCALE
Definition: resource.h:97
#define IDM_COLORSMONOCHROME
Definition: resource.h:98
#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:11
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:75
VOID OnEndDraw(BOOL bCancel)
Definition: canvas.cpp:868
VOID updateScrollPos(INT x=0, INT y=0)
Definition: canvas.cpp:383
VOID zoomTo(INT newZoom, LONG left=0, LONG top=0)
Definition: canvas.cpp:234
static BOOL IsExtensionSupported(PWCHAR pchDotExt)
Definition: atlimagedx.h:165
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:813
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:788
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu)
Definition: main.cpp:1330
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:769
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:821
LRESULT OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: main.cpp:781
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:797
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:254
HBITMAP LockBitmap()
Definition: history.cpp:346
BOOL CanUndo() const
Definition: history.h:29
void FlipVertically()
Definition: history.cpp:285
void FlipHorizontally()
Definition: history.cpp:277
BOOL CanRedo() const
Definition: history.h:30
void PushBlackAndWhite()
Definition: history.cpp:337
void InvertColors()
Definition: history.cpp:264
BOOL IsImageSaved() const
Definition: history.cpp:225
void Redo(void)
Definition: history.cpp:94
void PushImageForUndo()
Definition: history.cpp:125
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:72
void NotifyImageChanged()
Definition: history.cpp:23
void RotateNTimes90Degrees(int iN)
Definition: history.cpp:293
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:191
void UnlockBitmap(HBITMAP hbmLocked)
Definition: history.cpp:355
int GetHeight() const
Definition: history.cpp:259
HDC GetDC()
Definition: history.cpp:272
void SaveImage(LPCWSTR lpFileName)
Definition: history.cpp:220
void ClearHistory(void)
Definition: history.cpp:114
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:230
BOOL IsBlackAndWhite()
Definition: history.cpp:329
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:270
BOOL IsSelection() const
Definition: toolsmodel.cpp:41
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:152
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:258
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:263
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:142
void SpecialTweak(BOOL bMinus)
Definition: mouse.cpp:1196
void selectAll()
Definition: toolsmodel.cpp:316
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
#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:448
HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF)
Definition: dib.cpp:558
HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal)
Definition: dib.cpp:511
HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
Definition: dib.cpp:257
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
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HANDLE HWND
Definition: compat.h:19
#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:365
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:1999
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2232
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 PathRemoveExtensionW(WCHAR *path)
Definition: path.c:1946
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1701
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1274
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2607
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:582
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#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
#define __targv
Definition: tchar.h:504
#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 ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#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 IHTMLWindow2 * window
Definition: events.c:77
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define menu
Definition: input.c:3282
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define UNICODE_NULL
static HANDLE ULONG_PTR dwData
Definition: pipe.c:111
CPaletteWindow paletteWindow
Definition: palette.cpp:19
PaletteModel paletteModel
@ PAL_MONOCHROME
Definition: palettemodel.h:17
@ PAL_GRAYSCALE
Definition: palettemodel.h:16
@ 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
short WCHAR
Definition: pedump.c:58
#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
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define PathFindFileName
Definition: shlwapi.h:469
#define WM_NOTIFY
Definition: richedit.h:61
#define test
Definition: rosglue.h:37
#define __argc
Definition: stdlib.h:1153
#define LoadStringW
Definition: utils.h:64
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
#define DragQueryFile
Definition: shellapi.h:731
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:3403
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:3738
UINT code
Definition: winuser.h:3267
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:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#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
const char * LPCSTR
Definition: typedefs.h:52
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
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
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:397
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400
#define lstrlen
Definition: winbase.h:3625
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
DWORD COLORREF
Definition: windef.h:100
#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:784
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define SW_HIDE
Definition: winuser.h:779
#define WM_CLOSE
Definition: winuser.h:1649
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SWP_NOREPOSITION
Definition: winuser.h:1261
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1771
#define WM_PASTE
Definition: winuser.h:1891
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define IDCANCEL
Definition: winuser.h:842
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_VSCROLL
Definition: winuser.h:1772
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
#define TPM_RIGHTBUTTON
Definition: winuser.h:2416
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define EM_GETSEL
Definition: winuser.h:2026
#define CharLower
Definition: winuser.h:5903
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1639
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1768
#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:2239
#define VK_UP
Definition: winuser.h:2261
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_CUT
Definition: winuser.h:1889
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define FindWindowEx
Definition: winuser.h:5944
#define WM_UNDO
Definition: winuser.h:1893
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define HWND_DESKTOP
Definition: winuser.h:1220
#define MB_ICONERROR
Definition: winuser.h:798
#define EM_CANUNDO
Definition: winuser.h:2012
#define GetMessage
Definition: winuser.h:5956
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define SWP_NOCOPYBITS
Definition: winuser.h:1254
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:847
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define WM_NULL
Definition: winuser.h:1635
#define SendMessage
Definition: winuser.h:6009
#define SB_LINEDOWN
Definition: winuser.h:565
#define EM_SETSEL
Definition: winuser.h:2047
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define PostMessage
Definition: winuser.h:5998
HWND WINAPI GetParent(_In_ HWND)
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define VK_LEFT
Definition: winuser.h:2260
#define VK_RIGHT
Definition: winuser.h:2262
#define MB_ICONQUESTION
Definition: winuser.h:800
#define VK_DOWN
Definition: winuser.h:2263
#define MessageBox
Definition: winuser.h:5988
#define MB_ICONINFORMATION
Definition: winuser.h:813
#define WM_COPY
Definition: winuser.h:1890
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
#define VK_SHIFT
Definition: winuser.h:2238
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:786
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_CLEAR
Definition: winuser.h:1892
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define DispatchMessage
Definition: winuser.h:5931
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define IDYES
Definition: winuser.h:846
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
#define TPM_RETURNCMD
Definition: winuser.h:2423
#define SWP_NOZORDER
Definition: winuser.h:1258
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define DM_REPOSITION
Definition: winuser.h:2136
#define InsertMenu
Definition: winuser.h:5969
#define VK_ESCAPE
Definition: winuser.h:2250
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MB_YESNOCANCEL
Definition: winuser.h:829
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444
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)