ReactOS 0.4.15-dev-5853-gcb454ef
winproc.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL
4 * FILE: base/applications/mspaint/winproc.cpp
5 * PURPOSE: Window procedure of the main window and all children apart from
6 * hPalWin, hToolSettings and hSelection
7 * PROGRAMMERS: Benedikt Freisen
8 * Katayama Hirofumi MZ
9 * Stanislav Motylkov
10 */
11
12#include "precomp.h"
13#include <assert.h>
14
16
17static HINSTANCE s_hHHCTRL_OCX = NULL; // HtmlHelpW needs "hhctrl.ocx"
19
20/* FUNCTIONS ********************************************************/
21
22// A wrapper function for HtmlHelpW
23static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData)
24{
26
27 if (!s_hHHCTRL_OCX && (uCommand != HH_CLOSE_ALL))
28 {
29 // The function loads the system library, not local
31 wcscat(szPath, L"\\hhctrl.ocx");
33 if (s_hHHCTRL_OCX)
35 }
36
37 if (!s_pHtmlHelpW)
38 return NULL;
39
40 return s_pHtmlHelpW(hwndCaller, pszFile, uCommand, dwData);
41}
42
43BOOL
44zoomTo(int newZoom, int mouseX, int mouseY)
45{
46 RECT clientRectScrollbox;
47 RECT clientRectImageArea;
48 int x, y, w, h;
49 canvasWindow.GetClientRect(&clientRectScrollbox);
50 imageArea.GetClientRect(&clientRectImageArea);
51 w = clientRectImageArea.right * newZoom / toolsModel.GetZoom();
52 h = clientRectImageArea.bottom * newZoom / toolsModel.GetZoom();
53 if (!w || !h)
54 {
55 return FALSE;
56 }
57 w = clientRectImageArea.right * clientRectScrollbox.right / w;
58 h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
59 x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)) * newZoom / toolsModel.GetZoom();
60 y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2)) * newZoom / toolsModel.GetZoom();
61
62 toolsModel.SetZoom(newZoom);
63
65 canvasWindow.Invalidate(TRUE);
66 imageArea.Invalidate(FALSE);
67
70 return TRUE;
71}
72
74{
75 RECT clientRect, rc;
76 GetClientRect(&clientRect);
77 RECT rcSpace = clientRect;
78
80 {
82 rcSpace.bottom -= rc.bottom - rc.top;
83 }
84
85 HDWP hDWP = ::BeginDeferWindowPos(3);
86
88 {
90 rcSpace.left, rcSpace.top,
91 CX_TOOLBAR, rcSpace.bottom - rcSpace.top,
93 rcSpace.left += CX_TOOLBAR;
94 }
95
97 {
99 rcSpace.left, rcSpace.top,
100 rcSpace.right - rcSpace.left, CY_PALETTE,
102 rcSpace.top += CY_PALETTE;
103 }
104
105 if (canvasWindow.IsWindow())
106 {
107 hDWP = ::DeferWindowPos(hDWP, canvasWindow, NULL,
108 rcSpace.left, rcSpace.top,
109 rcSpace.right - rcSpace.left, rcSpace.bottom - rcSpace.top,
111 }
112
114}
115
117{
119
120 if (isAFile && overwrite)
121 {
123 }
124 else if (GetSaveFileName(&sfn) != 0)
125 {
128 CString strTitle;
130 SetWindowText(strTitle);
131 isAFile = TRUE;
132 }
133}
134
136{
137 int width = GetDIBWidth(bitmap);
139 int curWidth = imageModel.GetWidth();
140 int curHeight = imageModel.GetHeight();
141
142 if (width > curWidth || height > curHeight)
143 {
144 BOOL shouldEnlarge = TRUE;
145
147 {
148 TCHAR programname[20];
149 TCHAR shouldEnlargePromptText[100];
150
151 LoadString(hProgInstance, IDS_PROGRAMNAME, programname, _countof(programname));
152 LoadString(hProgInstance, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText));
153
154 switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
155 {
156 case IDYES:
157 break;
158 case IDNO:
159 shouldEnlarge = FALSE;
160 break;
161 case IDCANCEL:
162 return;
163 }
164 }
165
166 if (shouldEnlarge)
167 {
168 if (width > curWidth)
169 curWidth = width;
170
171 if (height > curHeight)
172 curHeight = height;
173
174 imageModel.Crop(curWidth, curHeight, 0, 0);
175 }
176 }
177
181
184
185 placeSelWin();
186 selectionWindow.ShowWindow(SW_SHOW);
188}
189
191{
192 INT zDelta = (SHORT)HIWORD(wParam);
193
195 {
196 if (zDelta < 0)
197 {
199 zoomTo(toolsModel.GetZoom() / 2, 0, 0);
200 }
201 else if (zDelta > 0)
202 {
204 zoomTo(toolsModel.GetZoom() * 2, 0, 0);
205 }
206 }
207 else
208 {
209 UINT nCount = 3;
211 {
212#ifndef SPI_GETWHEELSCROLLCHARS
213 #define SPI_GETWHEELSCROLLCHARS 0x006C // Needed for pre-NT6 PSDK
214#endif
216 for (UINT i = 0; i < nCount; ++i)
217 {
218 if (zDelta < 0)
220 else if (zDelta > 0)
222 }
223 }
224 else
225 {
226 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &nCount, 0);
227 for (UINT i = 0; i < nCount; ++i)
228 {
229 if (zDelta < 0)
231 else if (zDelta > 0)
233 }
234 }
235 }
236
237 return 0;
238}
239
241{
242 TCHAR droppedfile[MAX_PATH];
243
244 HDROP hDrop = (HDROP)wParam;
245 DragQueryFile(hDrop, 0, droppedfile, _countof(droppedfile));
246 DragFinish(hDrop);
247
248 ConfirmSave() && DoLoadImageFile(m_hWnd, droppedfile, TRUE);
249
250 return 0;
251}
252
254{
257 return 0;
258}
259
261{
264
266
267 if (s_hHHCTRL_OCX)
268 {
272 }
273
274 PostQuitMessage(0); /* send a WM_QUIT to the message queue */
275 return 0;
276}
277
279{
281
283 return TRUE;
284
285 CString strProgramName;
286 strProgramName.LoadString(IDS_PROGRAMNAME);
287
288 CString strSavePromptText;
290
291 switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
292 {
293 case IDYES:
295 return imageModel.IsImageSaved();
296 case IDNO:
297 return TRUE;
298 case IDCANCEL:
299 return FALSE;
300 }
301
302 return TRUE;
303}
304
306{
307 if (ConfirmSave())
308 {
310 }
311 return 0;
312}
313
315{
317 BOOL isBMP = FALSE;
318 if (_tcsicmp(dotext, _T(".bmp")) == 0 ||
319 _tcsicmp(dotext, _T(".dib")) == 0 ||
320 _tcsicmp(dotext, _T(".rle")) == 0)
321 {
322 isBMP = TRUE;
323 }
324
328
329 for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem)
330 RemoveMenu(hPopupMenu, IDM_FILE1 + iItem, MF_BYCOMMAND);
331
333 return;
334
336
337 INT cMenuItems = GetMenuItemCount(hPopupMenu);
338
339 for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem)
340 {
341 CString& strFile = registrySettings.strFiles[iItem];
342 if (strFile.IsEmpty())
343 break;
344
345 // Condense the lengthy pathname by using '...'
346#define MAX_RECENT_PATHNAME_DISPLAY 30
347 CPath pathFile(strFile);
350
351 // Add an accelerator (by '&') to the item number for quick access
352 TCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1];
353 wsprintf(szText, _T("&%u %s"), iItem + 1, (LPCTSTR)pathFile);
354
355 INT iMenuItem = (cMenuItems - 2) + iItem;
356 InsertMenu(hPopupMenu, iMenuItem, MF_BYPOSITION | MF_STRING, IDM_FILE1 + iItem, szText);
357 }
358}
359
361{
362 HMENU menu = GetMenu();
363 BOOL trueSelection =
366
367 switch (lParam)
368 {
369 case 0: /* File menu */
371 break;
372 case 1: /* Edit menu */
375 EnableMenuItem(menu, IDM_EDITCUT, ENABLED_IF(trueSelection));
376 EnableMenuItem(menu, IDM_EDITCOPY, ENABLED_IF(trueSelection));
379 EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
383 break;
384 case 2: /* View menu */
390
393 break;
394 case 3: /* Image menu */
397 break;
398 }
399
407
410 return 0;
411}
412
414{
415 int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
417 {
420 }
422 return 0;
423}
424
426{
428 mm->ptMinTrackSize.x = 330;
429 mm->ptMinTrackSize.y = 360;
430 return 0;
431}
432
434{
435 if (wParam == VK_ESCAPE)
436 {
437 HWND hwndCapture = GetCapture();
438 if (hwndCapture)
439 {
440 if (canvasWindow.m_hWnd == hwndCapture ||
441 selectionWindow.m_hWnd == hwndCapture ||
442 imageArea.m_hWnd == hwndCapture ||
443 fullscreenWindow.m_hWnd == hwndCapture)
444 {
445 SendMessage(hwndCapture, nMsg, wParam, lParam);
446 }
447 }
448 else
449 {
450 imageArea.SendMessage(nMsg, wParam, lParam);
451 }
452 }
453 return 0;
454}
455
457{
458 /* Redirect message to common controls */
460 SendMessage(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
461 return 0;
462}
463
465{
466 // Disable commands while dragging mouse
468 {
469 ATLTRACE("locking!\n");
470 return 0;
471 }
472
473 switch (LOWORD(wParam))
474 {
475 case IDM_HELPINFO:
476 {
478 TCHAR infotitle[100];
479 TCHAR infotext[200];
480 LoadString(hProgInstance, IDS_INFOTITLE, infotitle, _countof(infotitle));
481 LoadString(hProgInstance, IDS_INFOTEXT, infotext, _countof(infotext));
482 ShellAbout(m_hWnd, infotitle, infotext, paintIcon);
483 DeleteObject(paintIcon);
484 break;
485 }
487 DoHtmlHelpW(m_hWnd, L"%SystemRoot%\\Help\\mspaint.chm", HH_DISPLAY_TOPIC, 0);
488 break;
489 case IDM_FILEEXIT:
491 break;
492 case IDM_FILENEW:
493 if (ConfirmSave())
494 {
496 }
497 break;
498 case IDM_FILEOPEN:
500 {
502 }
503 break;
504 case IDM_FILESAVE:
506 break;
507 case IDM_FILESAVEAS:
509 break;
511 // DUMMY: Shows the dialog only, no functionality
512 PAGESETUPDLG psd;
513 ZeroMemory(&psd, sizeof(psd));
514 psd.lStructSize = sizeof(psd);
515 psd.hwndOwner = m_hWnd;
516 PageSetupDlg(&psd);
517 break;
518 case IDM_FILEPRINT:
519 // TODO: Test whether it actually works
520 PRINTDLG pd;
521 ZeroMemory(&pd, sizeof(pd));
522 pd.lStructSize = sizeof(pd);
523 pd.hwndOwner = m_hWnd;
524 pd.hDevMode = NULL; // freed by user
525 pd.hDevNames = NULL; // freed by user
527 pd.nCopies = 1;
528 pd.nFromPage = 0xffff;
529 pd.nToPage = 0xffff;
530 pd.nMinPage = 1;
531 pd.nMaxPage = 0xffff;
532 if (PrintDlg(&pd) == TRUE)
533 {
535 DeleteDC(pd.hDC);
536 }
537 if (pd.hDevMode)
539 if (pd.hDevNames)
541 break;
544 break;
547 break;
550 break;
551 case IDM_FILE1:
552 case IDM_FILE2:
553 case IDM_FILE3:
554 case IDM_FILE4:
555 {
557 if (ConfirmSave())
559 break;
560 }
561 case IDM_EDITUNDO:
563 break;
564 if (selectionWindow.IsWindowVisible())
565 {
568 {
570 break;
571 }
572 }
573 if (ToolBase::pointSP != 0) // drawing something?
574 {
576 break;
577 }
579 imageArea.Invalidate(FALSE);
580 break;
581 case IDM_EDITREDO:
583 break;
584 if (ToolBase::pointSP != 0) // drawing something?
585 {
587 break;
588 }
590 imageArea.Invalidate(FALSE);
591 break;
592 case IDM_EDITCOPY:
597 break;
598 case IDM_EDITCUT:
599 /* Copy */
601 /* Delete selection */
603 break;
604 case IDM_EDITPASTE:
607 {
609 }
611 break;
613 {
614 switch (toolsModel.GetActiveTool())
615 {
616 case TOOL_FREESEL:
617 case TOOL_RECTSEL:
619 break;
620
621 case TOOL_TEXT:
623 break;
624 default:
625 break;
626 }
627 break;
628 }
630 {
632 {
633 textEditWindow.SendMessage(EM_SETSEL, 0, -1);
634 break;
635 }
639 imageArea.Invalidate(TRUE);
640 break;
641 }
642 case IDM_EDITCOPYTO:
643 if (GetSaveFileName(&ofn))
645 break;
647 if (GetOpenFileName(&ofn))
648 {
650 if (hbmNew)
651 {
653 DeleteObject(hbmNew);
654 }
655 }
656 break;
660 break;
663 break;
666 break;
668 {
670 break;
671 }
675 imageArea.Invalidate(FALSE);
676 break;
678 switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
679 {
680 case 1: /* flip horizontally */
683 else
685 break;
686 case 2: /* flip vertically */
689 else
691 break;
692 case 3: /* rotate 90 degrees */
695 else
697 break;
698 case 4: /* rotate 180 degrees */
701 else
703 break;
704 case 5: /* rotate 270 degrees */
707 else
709 break;
710 }
711 break;
713 {
715 {
717 }
718 break;
719 }
721 {
723 {
725 {
728 }
729 else
730 {
733 }
734 }
735 break;
736 }
739 break;
740 case IDM_IMAGECROP:
742 break;
743
744 case IDM_VIEWTOOLBOX:
745 registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible();
748 break;
750 registrySettings.ShowPalette = !paletteWindow.IsWindowVisible();
753 break;
758 break;
761 {
762 if (!fontsDialog.IsWindow())
763 {
764 fontsDialog.Create(mainWindow);
765 }
768 fontsDialog.SendMessage(DM_REPOSITION, 0, 0);
769 }
770 break;
771 case IDM_VIEWSHOWGRID:
773 imageArea.Invalidate(FALSE);
774 break;
777 miniature.ShowWindow(showMiniature ? SW_SHOW : SW_HIDE);
778 break;
779
780 case IDM_VIEWZOOM125:
781 zoomTo(125, 0, 0);
782 break;
783 case IDM_VIEWZOOM25:
784 zoomTo(250, 0, 0);
785 break;
786 case IDM_VIEWZOOM50:
787 zoomTo(500, 0, 0);
788 break;
789 case IDM_VIEWZOOM100:
790 zoomTo(1000, 0, 0);
791 break;
792 case IDM_VIEWZOOM200:
793 zoomTo(2000, 0, 0);
794 break;
795 case IDM_VIEWZOOM400:
796 zoomTo(4000, 0, 0);
797 break;
798 case IDM_VIEWZOOM800:
799 zoomTo(8000, 0, 0);
800 break;
801
803 fullscreenWindow.ShowWindow(SW_SHOW);
805 break;
806 }
807 return 0;
808}
#define ATLTRACE(format,...)
Definition: atltrace.h:276
#define IDI_APPICON
Definition: resource.h:166
void placeSelWin(void)
Definition: mouse.cpp:20
#define CHECKED_IF(a)
Definition: common.h:24
#define GRIP_SIZE
Definition: common.h:13
#define MAX_ZOOM
Definition: common.h:15
#define MIN_ZOOM
Definition: common.h:14
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:44
#define ENABLED_IF(a)
Definition: common.h:27
static int Zoomed(int xy)
Definition: common.h:37
CAttributesDialog attributesDialog
Definition: dialogs.cpp:20
CFontsDialog fontsDialog
Definition: dialogs.cpp:22
CStretchSkewDialog stretchSkewDialog
Definition: dialogs.cpp:21
CMirrorRotateDialog mirrorRotateDialog
Definition: dialogs.cpp:19
static HBITMAP CopyDIBImage(HBITMAP hbm, INT cx=0, INT cy=0)
Definition: dib.h:14
#define CY_PALETTE
Definition: palette.h:13
#define MAX_RECENT_FILES
Definition: registry.h:11
#define IDS_SAVEPROMPTTEXT
Definition: resource.h:185
#define IDM_EDITSELECTALL
Definition: resource.h:66
#define IDM_VIEWSTATUSBAR
Definition: resource.h:72
#define IDS_INFOTEXT
Definition: resource.h:183
#define IDS_INFOTITLE
Definition: resource.h:182
#define IDM_EDITCOPYTO
Definition: resource.h:67
#define IDM_EDITDELETESELECTION
Definition: resource.h:64
#define IDM_FILEEXIT
Definition: resource.h:57
#define IDM_COLORSOLDPALETTE
Definition: resource.h:95
#define IDM_FILEPAGESETUP
Definition: resource.h:42
#define IDM_COLORSEDITPALETTE
Definition: resource.h:93
#define IDM_EDITCUT
Definition: resource.h:61
#define IDM_IMAGECROP
Definition: resource.h:87
#define IDM_VIEWZOOM800
Definition: resource.h:80
#define IDM_COLORSMODERNPALETTE
Definition: resource.h:94
#define IDM_FILE1
Definition: resource.h:52
#define IDM_FILESAVE
Definition: resource.h:36
#define IDM_EDITPASTEFROM
Definition: resource.h:68
#define IDM_EDITUNDO
Definition: resource.h:59
#define IDM_FILESAVEAS
Definition: resource.h:37
#define IDM_VIEWSHOWMINIATURE
Definition: resource.h:83
#define IDM_FILEASWALLPAPERPLANE
Definition: resource.h:47
#define IDM_EDITCOPY
Definition: resource.h:62
#define IDM_FORMATICONBAR
Definition: resource.h:73
#define IDM_FILE2
Definition: resource.h:53
#define IDM_FILE4
Definition: resource.h:55
#define IDM_EDITREDO
Definition: resource.h:60
#define IDS_PROGRAMNAME
Definition: resource.h:180
#define IDM_EDITINVERTSELECTION
Definition: resource.h:65
#define IDM_VIEWZOOM25
Definition: resource.h:75
#define IDM_IMAGEINVERTCOLORS
Definition: resource.h:88
#define IDM_VIEWTOOLBOX
Definition: resource.h:70
#define IDM_IMAGEATTRIBUTES
Definition: resource.h:89
#define IDM_FILEMOSTRECENTLYUSEDFILE
Definition: resource.h:51
#define IDM_HELPINFO
Definition: resource.h:98
#define IDM_VIEWFULLSCREEN
Definition: resource.h:81
#define IDM_IMAGESTRETCHSKEW
Definition: resource.h:86
#define IDM_EDITPASTE
Definition: resource.h:63
#define IDM_FILEASWALLPAPERCENTERED
Definition: resource.h:48
#define IDM_HELPHELPTOPICS
Definition: resource.h:97
#define IDM_VIEWSHOWGRID
Definition: resource.h:82
#define IDM_IMAGEDRAWOPAQUE
Definition: resource.h:91
#define IDM_VIEWZOOM200
Definition: resource.h:78
#define IDS_WINDOWTITLE
Definition: resource.h:181
#define IDM_FILE3
Definition: resource.h:54
#define IDM_FILENEW
Definition: resource.h:34
#define IDM_VIEWCOLORPALETTE
Definition: resource.h:71
#define IDM_VIEWZOOM400
Definition: resource.h:79
#define IDM_VIEWZOOM50
Definition: resource.h:76
#define IDM_FILEPRINT
Definition: resource.h:43
#define IDM_IMAGEDELETEIMAGE
Definition: resource.h:90
#define IDM_VIEWZOOM125
Definition: resource.h:74
#define ID_RECTSEL
Definition: resource.h:107
#define IDS_ENLARGEPROMPTTEXT
Definition: resource.h:216
#define IDM_VIEWZOOM100
Definition: resource.h:77
#define IDM_IMAGEROTATEMIRROR
Definition: resource.h:85
#define IDM_FILEOPEN
Definition: resource.h:35
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: resource.h:49
#define CF_BITMAP
Definition: constants.h:397
BOOL CompactPathEx(UINT nMaxChars, DWORD dwFlags=0)
Definition: atlpath.h:180
bool IsEmpty() const
Definition: atlsimpstr.h:379
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:591
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
BOOL OpenClipboard()
Definition: atlwin.h:1032
BOOL DestroyWindow()
Definition: atlwin.h:456
HMENU GetMenu() const
Definition: atlwin.h:676
BOOL IsWindowVisible() const
Definition: atlwin.h:952
HWND m_hWnd
Definition: atlwin.h:267
BOOL IsWindow() const
Definition: atlwin.h:941
void cancelDrawing()
Definition: imgarea.cpp:203
BOOL drawing
Definition: imgarea.h:20
void finishDrawing()
Definition: imgarea.cpp:380
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:456
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
Definition: winproc.cpp:135
void alignChildrenToMainWindow()
Definition: winproc.cpp:73
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:433
LRESULT OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:240
void ProcessFileMenu(HMENU hPopupMenu)
Definition: winproc.cpp:314
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:413
LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:305
BOOL ConfirmSave()
Definition: winproc.cpp:278
LRESULT OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:360
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:464
LRESULT OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:425
LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:190
void saveImage(BOOL overwrite)
Definition: winproc.cpp:116
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:253
LRESULT OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:260
void ForceRefreshSelectionContents()
Definition: selection.cpp:24
POINT percentage
Definition: dialogs.h:86
BOOL HasRedoSteps() const
Definition: history.cpp:184
int GetWidth() const
Definition: history.cpp:215
void FlipVertically()
Definition: history.cpp:252
void CopyPrevious(void)
Definition: history.cpp:47
void FlipHorizontally()
Definition: history.cpp:244
void DeleteSelection()
Definition: history.cpp:293
BOOL HasUndoSteps() const
Definition: history.cpp:179
void SaveImage(LPTSTR lpFileName)
Definition: history.cpp:169
void Insert(HBITMAP hbm)
Definition: history.cpp:115
void InvertColors()
Definition: history.cpp:225
BOOL IsImageSaved() const
Definition: history.cpp:174
void Redo(void)
Definition: history.cpp:81
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:60
void RotateNTimes90Degrees(int iN)
Definition: history.cpp:260
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:131
int GetHeight() const
Definition: history.cpp:220
HDC GetDC()
Definition: history.cpp:239
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:189
PAL_TYPE SelectedPalette()
COLORREF GetBgColor() const
void SetFgColor(COLORREF newColor)
void SelectPalette(PAL_TYPE nPalette)
DWORD ShowTextTool
Definition: registry.h:42
DWORD ShowToolBox
Definition: registry.h:45
DWORD ShowPalette
Definition: registry.h:44
static void SetWallpaper(LPCTSTR szFileName, WallpaperStyle style)
Definition: registry.cpp:39
DWORD ShowStatusBar
Definition: registry.h:43
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:30
CString strFiles[MAX_RECENT_FILES]
Definition: registry.h:32
void InsertFromHBITMAP(HBITMAP hBm, INT x=0, INT y=0)
void RotateNTimes90Degrees(int iN)
HBITMAP GetBitmap() const
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
int GetZoom() const
Definition: toolsmodel.cpp:148
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:153
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:140
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:76
void selectAll()
Definition: toolsmodel.cpp:236
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define GetSaveFileName
Definition: commdlg.h:666
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
#define PrintDlg
Definition: commdlg.h:668
#define PD_RETURNDC
Definition: commdlg.h:155
#define ChooseColor
Definition: commdlg.h:661
#define PageSetupDlg
Definition: commdlg.h:667
#define GetOpenFileName
Definition: commdlg.h:665
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCTSTR name, DWORD dwFileSize, BOOL isFile)
Definition: dib.cpp:109
BOOL SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC)
Definition: dib.cpp:69
int GetDIBHeight(HBITMAP hBitmap)
Definition: dib.cpp:62
HBITMAP DoLoadImageFile(HWND hwnd, LPCTSTR name, BOOL fIsMainFile)
Definition: dib.cpp:159
int GetDIBWidth(HBITMAP hBitmap)
Definition: dib.cpp:54
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:538
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define assert(x)
Definition: debug.h:53
static VOID NTAPI 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:49
OPENFILENAMEW sfn
Definition: eventvwr.c:101
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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
ToolsModel toolsModel
Definition: main.cpp:16
CMiniatureWindow miniature
Definition: main.cpp:49
CSelectionWindow selectionWindow
Definition: main.cpp:54
CHOOSECOLOR choosecolor
Definition: main.cpp:28
ImageModel imageModel
Definition: main.cpp:24
RegistrySettings registrySettings
Definition: main.cpp:22
CPaletteWindow paletteWindow
Definition: main.cpp:52
CFullscreenWindow fullscreenWindow
Definition: main.cpp:48
HINSTANCE hProgInstance
Definition: main.cpp:34
SelectionModel selectionModel
Definition: main.cpp:18
CToolBox toolBoxContainer
Definition: main.cpp:50
BOOL askBeforeEnlarging
Definition: main.cpp:25
CImgAreaWindow imageArea
Definition: main.cpp:55
TCHAR filepathname[1000]
Definition: main.cpp:36
CCanvasWindow canvasWindow
Definition: main.cpp:53
BOOL showMiniature
Definition: main.cpp:45
OPENFILENAME ofn
Definition: main.cpp:29
BOOL showGrid
Definition: main.cpp:44
CMainWindow mainWindow
Definition: main.cpp:47
CTextEditWindow textEditWindow
Definition: main.cpp:56
PaletteModel paletteModel
Definition: main.cpp:20
BOOL isAFile
Definition: main.cpp:37
HWND hStatusBar
Definition: main.cpp:27
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define HH_DISPLAY_TOPIC
Definition: htmlhelp.h:22
#define HH_CLOSE_ALL
Definition: htmlhelp.h:41
#define _tcsncpy
Definition: tchar.h:1410
LPCWSTR szPath
Definition: env.c:37
static HBITMAP
Definition: button.c:44
static HICON
Definition: imagelist.c:84
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:60
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
@ PAL_MODERN
Definition: palettemodel.h:15
@ PAL_OLDTYPE
Definition: palettemodel.h:16
#define LOWORD(l)
Definition: pedump.c:82
short SHORT
Definition: pedump.c:59
#define TB_CHECKBUTTON
Definition: commctrl.h:1043
#define TOOLBARCLASSNAME
Definition: commctrl.h:946
#define SB_SETPARTS
Definition: commctrl.h:1954
#define test
Definition: rosglue.h:37
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define DragQueryFile
Definition: shellapi.h:683
#define ShellAbout
Definition: shellapi.h:689
#define PathFindFileName
Definition: shlwapi.h:911
#define _countof(array)
Definition: sndvol32.h:68
static INT pointSP
Definition: toolsmodel.h:39
Definition: uimain.c:89
COLORREF rgbResult
Definition: commdlg.h:242
POINT ptMinTrackSize
Definition: winuser.h:3620
LPSTR lpstrFile
Definition: commdlg.h:336
LPWSTR lpstrFile
Definition: commdlg.h:367
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
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 max(a, b)
Definition: svc.c:63
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define CX_TOOLBAR
Definition: toolbox.h:15
@ TOOL_TEXT
Definition: toolsmodel.h:22
@ TOOL_FREESEL
Definition: toolsmodel.h:13
@ TOOL_RECTSEL
Definition: toolsmodel.h:14
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define _T(x)
Definition: vfdio.h:22
#define ZeroMemory
Definition: winbase.h:1670
_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
#define WINAPI
Definition: msvc.h:6
#define SRCCOPY
Definition: wingdi.h:333
BOOL WINAPI DeleteDC(_In_ HDC)
HWND(WINAPI * FN_HtmlHelpW)(HWND, LPCWSTR, UINT, DWORD_PTR)
Definition: winproc.cpp:15
#define MAX_RECENT_PATHNAME_DISPLAY
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:44
static HINSTANCE s_hHHCTRL_OCX
Definition: winproc.cpp:17
static FN_HtmlHelpW s_pHtmlHelpW
Definition: winproc.cpp:18
static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData)
Definition: winproc.cpp:23
#define SPI_GETWHEELSCROLLCHARS
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999
#define SW_HIDE
Definition: winuser.h:762
#define WM_CLOSE
Definition: winuser.h:1611
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SWP_NOREPOSITION
Definition: winuser.h:1240
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1733
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define IDCANCEL
Definition: winuser.h:825
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_VSCROLL
Definition: winuser.h:1734
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1601
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define WM_COMMAND
Definition: winuser.h:1730
#define MF_STRING
Definition: winuser.h:138
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define VK_CONTROL
Definition: winuser.h:2193
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
HWND WINAPI GetCapture(void)
Definition: message.c:2881
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define FindWindowEx
Definition: winuser.h:5768
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define MF_BYPOSITION
Definition: winuser.h:203
#define IDNO
Definition: winuser.h:830
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define LoadIcon
Definition: winuser.h:5803
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define SendMessage
Definition: winuser.h:5833
#define SB_LINEDOWN
Definition: winuser.h:565
#define EM_SETSEL
Definition: winuser.h:2008
#define wsprintf
Definition: winuser.h:5855
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define LoadString
Definition: winuser.h:5809
#define MB_ICONQUESTION
Definition: winuser.h:783
#define MessageBox
Definition: winuser.h:5812
struct tagMINMAXINFO * LPMINMAXINFO
#define VK_SHIFT
Definition: winuser.h:2192
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:769
#define SetWindowText
Definition: winuser.h:5847
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define IDYES
Definition: winuser.h:829
#define SWP_NOZORDER
Definition: winuser.h:1237
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define DM_REPOSITION
Definition: winuser.h:2090
#define InsertMenu
Definition: winuser.h:5793
#define VK_ESCAPE
Definition: winuser.h:2204
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define MB_YESNOCANCEL
Definition: winuser.h:812
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define SB_THUMBPOSITION
Definition: winuser.h:572
char TCHAR
Definition: xmlstorage.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define _tcslen
Definition: xmlstorage.h:198
#define _tcsicmp
Definition: xmlstorage.h:205