ReactOS  0.4.15-dev-4853-g3a72a52
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 /* INCLUDES *********************************************************/
13 
14 #include "precomp.h"
15 
16 /* FUNCTIONS ********************************************************/
17 
18 BOOL
19 zoomTo(int newZoom, int mouseX, int mouseY)
20 {
21  RECT clientRectScrollbox;
22  RECT clientRectImageArea;
23  int x, y, w, h;
24  scrollboxWindow.GetClientRect(&clientRectScrollbox);
25  imageArea.GetClientRect(&clientRectImageArea);
26  w = clientRectImageArea.right * newZoom / toolsModel.GetZoom();
27  h = clientRectImageArea.bottom * newZoom / toolsModel.GetZoom();
28  if (!w || !h)
29  {
30  return FALSE;
31  }
32  w = clientRectImageArea.right * clientRectScrollbox.right / w;
33  h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
34  x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)) * newZoom / toolsModel.GetZoom();
35  y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2)) * newZoom / toolsModel.GetZoom();
36 
37  toolsModel.SetZoom(newZoom);
38 
40  scrollboxWindow.Invalidate(TRUE);
42 
45  return TRUE;
46 }
47 
49 {
50  int x, y, w, h;
51  RECT clientRect;
52  GetClientRect(&clientRect);
53 
55  {
56  x = 56;
57  w = clientRect.right - 56;
58  }
59  else
60  {
61  x = 0;
62  w = clientRect.right;
63  }
65  {
66  y = 49;
67  h = clientRect.bottom - 49;
68  }
69  else
70  {
71  y = 3;
72  h = clientRect.bottom - 3;
73  }
74 
75  RECT statusBarRect0;
76  int statusBarBorders[3];
77  if (::IsWindow(hStatusBar))
78  {
79  ::SendMessage(hStatusBar, SB_GETRECT, 0, (LPARAM)&statusBarRect0);
80  ::SendMessage(hStatusBar, SB_GETBORDERS, 0, (LPARAM)&statusBarBorders);
81  }
82  int statusBarHeight = statusBarRect0.bottom - statusBarRect0.top + statusBarBorders[1];
83 
84  if (scrollboxWindow.IsWindow())
85  scrollboxWindow.MoveWindow(x, y, w, ::IsWindowVisible(hStatusBar) ? h - statusBarHeight : h, TRUE);
86  if (paletteWindow.IsWindow())
87  paletteWindow.MoveWindow(x, 9, 255, 32, TRUE);
88 }
89 
91 {
93 
94  if (isAFile && overwrite)
95  {
97  }
98  else if (GetSaveFileName(&sfn) != 0)
99  {
102  CString strTitle;
104  SetWindowText(strTitle);
105  isAFile = TRUE;
106  }
107 }
108 
110 {
111  int width = GetDIBWidth(bitmap);
112  int height = GetDIBHeight(bitmap);
113  int curWidth = imageModel.GetWidth();
114  int curHeight = imageModel.GetHeight();
115 
116  if (width > curWidth || height > curHeight)
117  {
118  BOOL shouldEnlarge = TRUE;
119 
120  if (askBeforeEnlarging)
121  {
122  TCHAR programname[20];
123  TCHAR shouldEnlargePromptText[100];
124 
125  LoadString(hProgInstance, IDS_PROGRAMNAME, programname, _countof(programname));
126  LoadString(hProgInstance, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText));
127 
128  switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
129  {
130  case IDYES:
131  break;
132  case IDNO:
133  shouldEnlarge = FALSE;
134  break;
135  case IDCANCEL:
136  return;
137  }
138  }
139 
140  if (shouldEnlarge)
141  {
142  if (width > curWidth)
143  curWidth = width;
144 
145  if (height > curHeight)
146  curHeight = height;
147 
148  imageModel.Crop(curWidth, curHeight, 0, 0);
149  }
150  }
151 
155 
158 
159  placeSelWin();
160  selectionWindow.ShowWindow(SW_SHOW);
162 }
163 
165 {
166  INT zDelta = (SHORT)HIWORD(wParam);
167 
168  if (::GetAsyncKeyState(VK_CONTROL) < 0)
169  {
170  if (zDelta < 0)
171  {
172  if (toolsModel.GetZoom() > MIN_ZOOM)
173  zoomTo(toolsModel.GetZoom() / 2, 0, 0);
174  }
175  else if (zDelta > 0)
176  {
177  if (toolsModel.GetZoom() < MAX_ZOOM)
178  zoomTo(toolsModel.GetZoom() * 2, 0, 0);
179  }
180  }
181  else
182  {
183  UINT nCount = 3;
184  if (::GetAsyncKeyState(VK_SHIFT) < 0)
185  {
186 #ifndef SPI_GETWHEELSCROLLCHARS
187  #define SPI_GETWHEELSCROLLCHARS 0x006C // Needed for pre-NT6 PSDK
188 #endif
190  for (UINT i = 0; i < nCount; ++i)
191  {
192  if (zDelta < 0)
194  else if (zDelta > 0)
196  }
197  }
198  else
199  {
200  SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &nCount, 0);
201  for (UINT i = 0; i < nCount; ++i)
202  {
203  if (zDelta < 0)
205  else if (zDelta > 0)
207  }
208  }
209  }
210 
211  return 0;
212 }
213 
215 {
216  TCHAR droppedfile[MAX_PATH];
217 
218  HDROP hDrop = (HDROP)wParam;
219  DragQueryFile(hDrop, 0, droppedfile, _countof(droppedfile));
220  DragFinish(hDrop);
221 
222  ConfirmSave() && DoLoadImageFile(m_hWnd, droppedfile, TRUE);
223 
224  return 0;
225 }
226 
228 {
231  return 0;
232 }
233 
235 {
237  PostQuitMessage(0); /* send a WM_QUIT to the message queue */
238  return 0;
239 }
240 
242 {
244 
245  if (imageModel.IsImageSaved())
246  return TRUE;
247 
248  CString strProgramName;
249  strProgramName.LoadString(IDS_PROGRAMNAME);
250 
251  CString strSavePromptText;
253 
254  switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
255  {
256  case IDYES:
257  saveImage(TRUE);
258  return imageModel.IsImageSaved();
259  case IDNO:
260  return TRUE;
261  case IDCANCEL:
262  return FALSE;
263  }
264 
265  return TRUE;
266 }
267 
269 {
270  if (ConfirmSave())
271  {
272  DestroyWindow();
273  }
274  return 0;
275 }
276 
278 {
279  HMENU menu = GetMenu();
280  BOOL trueSelection =
283  switch (lParam)
284  {
285  case 0: /* File menu */
286  if ((HMENU)wParam != GetSubMenu(menu, 0))
287  break;
296  {
298  CPath pathFile1(registrySettings.strFile1);
299  pathFile1.CompactPathEx(30);
301  {
302  CPath pathFile2(registrySettings.strFile2);
303  pathFile2.CompactPathEx(30);
305  {
306  CPath pathFile3(registrySettings.strFile3);
307  pathFile3.CompactPathEx(30);
309  {
310  CPath pathFile4(registrySettings.strFile4);
311  pathFile4.CompactPathEx(30);
312  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE4, _T("4 ") + pathFile4);
313  }
314  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE3, _T("3 ") + pathFile3);
315  }
316  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE2, _T("2 ") + pathFile2);
317  }
318  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE1, _T("1 ") + pathFile1);
319  }
320  break;
321  case 1: /* Edit menu */
324  EnableMenuItem(menu, IDM_EDITCUT, ENABLED_IF(trueSelection));
325  EnableMenuItem(menu, IDM_EDITCOPY, ENABLED_IF(trueSelection));
326  EnableMenuItem(menu, IDM_EDITDELETESELECTION, ENABLED_IF(trueSelection));
327  EnableMenuItem(menu, IDM_EDITINVERTSELECTION, ENABLED_IF(trueSelection));
328  EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
329  OpenClipboard();
331  CloseClipboard();
332  break;
333  case 2: /* View menu */
339 
342  break;
343  case 3: /* Image menu */
346  break;
347  }
348 
356 
359  return 0;
360 }
361 
363 {
364  int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
365  if (::IsWindow(hStatusBar))
366  {
369  }
371  Invalidate(TRUE);
372  return 0;
373 }
374 
376 {
378  mm->ptMinTrackSize.x = 330;
379  mm->ptMinTrackSize.y = 430;
380  return 0;
381 }
382 
384 {
386  bHandled = FALSE;
387  return 0;
388 }
389 
391 {
392  if (wParam == VK_ESCAPE)
393  {
394  HWND hwndCapture = GetCapture();
395  if (hwndCapture)
396  {
397  if (selectionWindow.m_hWnd == hwndCapture ||
398  imageArea.m_hWnd == hwndCapture ||
399  fullscreenWindow.m_hWnd == hwndCapture ||
400  sizeboxLeftTop.m_hWnd == hwndCapture ||
401  sizeboxCenterTop.m_hWnd == hwndCapture ||
402  sizeboxRightTop.m_hWnd == hwndCapture ||
403  sizeboxLeftCenter.m_hWnd == hwndCapture ||
404  sizeboxRightCenter.m_hWnd == hwndCapture ||
405  sizeboxLeftBottom.m_hWnd == hwndCapture ||
406  sizeboxCenterBottom.m_hWnd == hwndCapture ||
407  sizeboxRightBottom.m_hWnd == hwndCapture)
408  {
409  SendMessage(hwndCapture, nMsg, wParam, lParam);
410  }
411  }
412  else
413  {
415  }
416  }
417  return 0;
418 }
419 
421 {
422  /* Redirect message to common controls */
424  SendMessage(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
425  return 0;
426 }
427 
429 {
430  // Disable commands while dragging mouse
431  if (imageArea.drawing && ::GetCapture())
432  {
433  ATLTRACE("locking!\n");
434  return 0;
435  }
436 
437  switch (LOWORD(wParam))
438  {
439  case IDM_HELPINFO:
440  {
442  TCHAR infotitle[100];
443  TCHAR infotext[200];
444  LoadString(hProgInstance, IDS_INFOTITLE, infotitle, _countof(infotitle));
445  LoadString(hProgInstance, IDS_INFOTEXT, infotext, _countof(infotext));
446  ShellAbout(m_hWnd, infotitle, infotext, paintIcon);
447  DeleteObject(paintIcon);
448  break;
449  }
450  case IDM_HELPHELPTOPICS:
451  HtmlHelp(m_hWnd, _T("help\\Paint.chm"), 0, 0);
452  break;
453  case IDM_FILEEXIT:
455  break;
456  case IDM_FILENEW:
457  if (ConfirmSave())
458  {
460  }
461  break;
462  case IDM_FILEOPEN:
463  if (ConfirmSave() && GetOpenFileName(&ofn))
464  {
466  }
467  break;
468  case IDM_FILESAVE:
469  saveImage(TRUE);
470  break;
471  case IDM_FILESAVEAS:
472  saveImage(FALSE);
473  break;
474  case IDM_FILEPAGESETUP:
475  // DUMMY: Shows the dialog only, no functionality
476  PAGESETUPDLG psd;
477  ZeroMemory(&psd, sizeof(psd));
478  psd.lStructSize = sizeof(psd);
479  psd.hwndOwner = m_hWnd;
480  PageSetupDlg(&psd);
481  break;
482  case IDM_FILEPRINT:
483  // TODO: Test whether it actually works
484  PRINTDLG pd;
485  ZeroMemory(&pd, sizeof(pd));
486  pd.lStructSize = sizeof(pd);
487  pd.hwndOwner = m_hWnd;
488  pd.hDevMode = NULL; // freed by user
489  pd.hDevNames = NULL; // freed by user
491  pd.nCopies = 1;
492  pd.nFromPage = 0xffff;
493  pd.nToPage = 0xffff;
494  pd.nMinPage = 1;
495  pd.nMaxPage = 0xffff;
496  if (PrintDlg(&pd) == TRUE)
497  {
499  DeleteDC(pd.hDC);
500  }
501  if (pd.hDevMode)
502  GlobalFree(pd.hDevMode);
503  if (pd.hDevNames)
504  GlobalFree(pd.hDevNames);
505  break;
508  break;
511  break;
514  break;
515  case IDM_FILE1:
516  {
518  break;
519  }
520  case IDM_FILE2:
521  {
523  break;
524  }
525  case IDM_FILE3:
526  {
528  break;
529  }
530  case IDM_FILE4:
531  {
533  break;
534  }
535  case IDM_EDITUNDO:
537  break;
538  if (selectionWindow.IsWindowVisible())
539  {
542  {
544  break;
545  }
546  }
547  if (ToolBase::pointSP != 0) // drawing something?
548  {
550  break;
551  }
552  imageModel.Undo();
554  break;
555  case IDM_EDITREDO:
557  break;
558  if (ToolBase::pointSP != 0) // drawing something?
559  {
561  break;
562  }
563  imageModel.Redo();
565  break;
566  case IDM_EDITCOPY:
567  OpenClipboard();
568  EmptyClipboard();
570  CloseClipboard();
571  break;
572  case IDM_EDITCUT:
573  /* Copy */
575  /* Delete selection */
577  break;
578  case IDM_EDITPASTE:
579  OpenClipboard();
581  {
583  }
584  CloseClipboard();
585  break;
587  {
588  switch (toolsModel.GetActiveTool())
589  {
590  case TOOL_FREESEL:
591  case TOOL_RECTSEL:
593  break;
594 
595  case TOOL_TEXT:
597  break;
598  default:
599  break;
600  }
601  break;
602  }
603  case IDM_EDITSELECTALL:
604  {
606  {
607  textEditWindow.SendMessage(EM_SETSEL, 0, -1);
608  break;
609  }
614  break;
615  }
616  case IDM_EDITCOPYTO:
617  if (GetSaveFileName(&ofn))
619  break;
620  case IDM_EDITPASTEFROM:
621  if (GetOpenFileName(&ofn))
622  {
624  if (hbmNew)
625  {
627  DeleteObject(hbmNew);
628  }
629  }
630  break;
632  if (ChooseColor(&choosecolor))
634  break;
637  break;
640  break;
642  {
644  break;
645  }
650  break;
652  switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
653  {
654  case 1: /* flip horizontally */
657  else
659  break;
660  case 2: /* flip vertically */
663  else
665  break;
666  case 3: /* rotate 90 degrees */
669  else
671  break;
672  case 4: /* rotate 180 degrees */
675  else
677  break;
678  case 5: /* rotate 270 degrees */
681  else
683  break;
684  }
685  break;
686  case IDM_IMAGEATTRIBUTES:
687  {
688  if (attributesDialog.DoModal(mainWindow.m_hWnd))
689  {
691  }
692  break;
693  }
695  {
696  if (stretchSkewDialog.DoModal(mainWindow.m_hWnd))
697  {
699  {
702  }
703  else
704  {
707  }
708  }
709  break;
710  }
711  case IDM_IMAGEDRAWOPAQUE:
713  break;
714  case IDM_IMAGECROP:
716  break;
717 
718  case IDM_VIEWTOOLBOX:
721  break;
725  break;
726  case IDM_VIEWSTATUSBAR:
729  break;
730  case IDM_FORMATICONBAR:
732  {
733  if (!fontsDialog.IsWindow())
734  {
735  fontsDialog.Create(mainWindow);
736  }
739  fontsDialog.SendMessage(DM_REPOSITION, 0, 0);
740  }
741  break;
742  case IDM_VIEWSHOWGRID:
743  showGrid = !showGrid;
745  break;
748  miniature.ShowWindow(showMiniature ? SW_SHOW : SW_HIDE);
749  break;
750 
751  case IDM_VIEWZOOM125:
752  zoomTo(125, 0, 0);
753  break;
754  case IDM_VIEWZOOM25:
755  zoomTo(250, 0, 0);
756  break;
757  case IDM_VIEWZOOM50:
758  zoomTo(500, 0, 0);
759  break;
760  case IDM_VIEWZOOM100:
761  zoomTo(1000, 0, 0);
762  break;
763  case IDM_VIEWZOOM200:
764  zoomTo(2000, 0, 0);
765  break;
766  case IDM_VIEWZOOM400:
767  zoomTo(4000, 0, 0);
768  break;
769  case IDM_VIEWZOOM800:
770  zoomTo(8000, 0, 0);
771  break;
772 
773  case IDM_VIEWFULLSCREEN:
774  fullscreenWindow.ShowWindow(SW_SHOW);
776  break;
777  }
778  return 0;
779 }
BOOL isAFile
Definition: main.cpp:53
POINT ptMinTrackSize
Definition: winuser.h:3610
#define IDM_IMAGESTRETCHSKEW
Definition: resource.h:86
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCTSTR name, DWORD dwFileSize, BOOL isFile)
Definition: dib.cpp:109
#define IDM_FILEMOSTRECENTLYUSEDFILE
Definition: resource.h:51
#define IDM_EDITPASTE
Definition: resource.h:63
#define IDM_EDITCUT
Definition: resource.h:61
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
static int Zoomed(int xy)
Definition: common.h:37
void FlipHorizontally()
Definition: history.cpp:244
void SaveImage(LPTSTR lpFileName)
Definition: history.cpp:169
#define MAKEINTRESOURCE
Definition: winuser.h:591
GLint GLint GLsizei width
Definition: gl.h:1546
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1613
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:47
#define max(a, b)
Definition: svc.c:63
static HICON
Definition: imagelist.c:84
CToolBox toolBoxContainer
Definition: main.cpp:66
#define MAKEWPARAM(l, h)
Definition: winuser.h:3989
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
void RotateNTimes90Degrees(int iN)
BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
Definition: atlwin.h:992
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
WORD nMaxPage
Definition: commdlg.h:474
#define IDM_FILEEXIT
Definition: resource.h:57
#define IDM_VIEWTOOLBOX
Definition: resource.h:70
#define MF_BYCOMMAND
Definition: winuser.h:202
long y
Definition: polytest.cpp:48
#define PageSetupDlg
Definition: commdlg.h:667
void SelectPalette(PAL_TYPE nPalette)
void SetFgColor(COLORREF newColor)
#define IDYES
Definition: winuser.h:829
#define IDS_ENLARGEPROMPTTEXT
Definition: resource.h:215
BOOL HasUndoSteps() const
Definition: history.cpp:179
void placeSelWin(void)
Definition: mouse.cpp:20
long x
Definition: polytest.cpp:48
#define InsertMenu
Definition: winuser.h:5783
static HBITMAP CopyDIBImage(HBITMAP hbm, INT cx=0, INT cy=0)
Definition: dib.h:14
#define ChooseColor
Definition: commdlg.h:661
#define IDM_VIEWFULLSCREEN
Definition: resource.h:81
#define MAX_ZOOM
Definition: common.h:15
#define IDM_FILEPAGESETUP
Definition: resource.h:42
#define TRUE
Definition: types.h:120
BOOL showGrid
Definition: main.cpp:60
#define SW_HIDE
Definition: winuser.h:762
void InsertFromHBITMAP(HBITMAP hBm, INT x=0, INT y=0)
#define IDM_FILEASWALLPAPERCENTERED
Definition: resource.h:48
HWND hwndOwner
Definition: commdlg.h:434
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
#define MAKELPARAM(l, h)
Definition: winuser.h:3988
LPWSTR lpstrFile
Definition: commdlg.h:367
#define IDM_IMAGEDELETEIMAGE
Definition: resource.h:90
BOOL IsWindow() const
Definition: atlwin.h:913
#define MF_STRING
Definition: winuser.h:138
#define IDM_VIEWSTATUSBAR
Definition: resource.h:72
LONG top
Definition: windef.h:307
OPENFILENAME ofn
Definition: main.cpp:37
BOOL CompactPathEx(UINT nMaxChars, DWORD dwFlags=0)
Definition: atlpath.h:180
#define IDM_EDITPASTEFROM
Definition: resource.h:68
void InvertColors()
Definition: history.cpp:225
CSizeboxWindow sizeboxRightCenter
Definition: main.cpp:77
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
#define IDM_VIEWZOOM125
Definition: resource.h:74
#define IDM_IMAGEINVERTCOLORS
Definition: resource.h:88
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
WORD nCopies
Definition: commdlg.h:475
CString strFile2
Definition: registry.h:31
#define ATLTRACE(format,...)
Definition: atltrace.h:276
int GetDIBHeight(HBITMAP hBitmap)
Definition: dib.cpp:62
#define test
Definition: rosglue.h:37
UINT_PTR WPARAM
Definition: windef.h:207
SelectionModel selectionModel
Definition: main.cpp:20
#define CHECKED_IF(a)
Definition: common.h:24
#define IDM_VIEWSHOWMINIATURE
Definition: resource.h:83
static void SetWallpaper(LPCTSTR szFileName, WallpaperStyle style)
Definition: registry.cpp:42
#define VK_ESCAPE
Definition: winuser.h:2194
BOOL SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1266
BOOL askBeforeEnlarging
Definition: main.cpp:33
LONG right
Definition: windef.h:308
#define IDM_VIEWSHOWGRID
Definition: resource.h:82
void Redo(void)
Definition: history.cpp:81
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:227
#define IDM_HELPINFO
Definition: resource.h:98
#define IDM_EDITREDO
Definition: resource.h:60
BOOL HasRedoSteps() const
Definition: history.cpp:184
COLORREF rgbResult
Definition: commdlg.h:242
int32_t INT
Definition: typedefs.h:58
#define IDM_FILEASWALLPAPERPLANE
Definition: resource.h:47
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define GetOpenFileName
Definition: commdlg.h:665
WPARAM wParam
Definition: combotst.c:138
COLORREF GetBgColor() const
#define SPI_GETWHEELSCROLLCHARS
WORD nMinPage
Definition: commdlg.h:473
LRESULT OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:375
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define ICON_SMALL
Definition: tnclass.cpp:48
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:131
#define IDM_FILE3
Definition: resource.h:54
CImgAreaWindow imageArea
Definition: main.cpp:72
#define SB_GETRECT
Definition: commctrl.h:1959
#define GetSaveFileName
Definition: commdlg.h:666
int GetDIBWidth(HBITMAP hBitmap)
Definition: dib.cpp:54
#define PrintDlg
Definition: commdlg.h:668
LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:268
CSizeboxWindow sizeboxCenterTop
Definition: main.cpp:74
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
CSizeboxWindow sizeboxRightTop
Definition: main.cpp:75
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define IDS_INFOTITLE
Definition: resource.h:181
CMirrorRotateDialog mirrorRotateDialog
Definition: dialogs.cpp:19
CSizeboxWindow sizeboxCenterBottom
Definition: main.cpp:79
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:390
void saveImage(BOOL overwrite)
Definition: winproc.cpp:90
#define IDM_FORMATICONBAR
Definition: resource.h:73
short SHORT
Definition: pedump.c:59
#define MF_BYPOSITION
Definition: winuser.h:203
HDC GetDC()
Definition: history.cpp:239
#define IDS_SAVEPROMPTTEXT
Definition: resource.h:184
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
HWND WINAPI GetCapture(void)
Definition: message.c:2881
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:140
#define VK_SHIFT
Definition: winuser.h:2182
#define CF_BITMAP
Definition: constants.h:397
#define TOOLBARCLASSNAME
Definition: commctrl.h:946
CMiniatureWindow miniature
Definition: main.cpp:65
WORD nFromPage
Definition: commdlg.h:471
#define SB_GETBORDERS
Definition: commctrl.h:1956
#define ENABLED_IF(a)
Definition: common.h:27
#define MB_ICONQUESTION
Definition: winuser.h:783
struct tagMINMAXINFO * LPMINMAXINFO
#define SB_THUMBPOSITION
Definition: winuser.h:572
#define MB_YESNOCANCEL
Definition: winuser.h:812
LONG_PTR LPARAM
Definition: windef.h:208
#define PD_RETURNDC
Definition: commdlg.h:155
#define IDM_VIEWZOOM400
Definition: resource.h:79
CSizeboxWindow sizeboxRightBottom
Definition: main.cpp:80
CStretchSkewDialog stretchSkewDialog
Definition: dialogs.cpp:21
DWORD lStructSize
Definition: commdlg.h:433
#define IDM_FILEOPEN
Definition: resource.h:35
#define IDM_VIEWZOOM800
Definition: resource.h:80
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: resource.h:49
#define SW_SHOW
Definition: winuser.h:769
void Insert(HBITMAP hbm)
Definition: history.cpp:115
LRESULT OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:214
DWORD ShowTextTool
Definition: registry.h:43
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:28
int GetWidth() const
Definition: history.cpp:215
static INT pointSP
Definition: toolsmodel.h:39
Definition: uimain.c:88
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
HMENU GetMenu() const
Definition: atlwin.h:648
char TCHAR
Definition: xmlstorage.h:189
#define IDM_FILE4
Definition: resource.h:55
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define _T(x)
Definition: vfdio.h:22
void finishDrawing()
Definition: imgarea.cpp:415
#define IDM_FILESAVE
Definition: resource.h:36
OPENFILENAMEW sfn
Definition: eventvwr.c:120
#define WM_SIZE
Definition: winuser.h:1598
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
Definition: winproc.cpp:109
#define _countof(array)
Definition: sndvol32.h:68
BOOL GetWindowPlacement(WINDOWPLACEMENT *lpwndpl) const
Definition: atlwin.h:768
#define ID_RECTSEL
Definition: resource.h:107
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:189
#define FindWindowEx
Definition: winuser.h:5758
#define MIN_ZOOM
Definition: common.h:14
BOOL OpenClipboard()
Definition: atlwin.h:1004
#define WM_CLOSE
Definition: winuser.h:1608
#define IDM_VIEWZOOM25
Definition: resource.h:75
#define IDM_VIEWZOOM200
Definition: resource.h:78
#define MAX_PATH
Definition: compat.h:34
#define EM_SETSEL
Definition: winuser.h:2005
void RotateNTimes90Degrees(int iN)
Definition: history.cpp:260
#define PathFindFileName
Definition: shlwapi.h:911
HGLOBAL hDevMode
Definition: commdlg.h:467
CFullscreenWindow fullscreenWindow
Definition: main.cpp:64
HWND hStatusBar
Definition: main.cpp:35
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ShellAbout
Definition: shellapi.h:690
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL showMiniature
Definition: main.cpp:61
int GetZoom() const
Definition: toolsmodel.cpp:148
#define IDM_FILENEW
Definition: resource.h:34
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define DM_REPOSITION
Definition: winuser.h:2087
void selectAll()
Definition: toolsmodel.cpp:236
#define IDS_WINDOWTITLE
Definition: resource.h:180
TCHAR filepathname[1000]
Definition: main.cpp:52
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:76
#define GRIP_SIZE
Definition: common.h:13
CAttributesDialog attributesDialog
Definition: dialogs.cpp:20
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:362
void alignChildrenToMainWindow()
Definition: winproc.cpp:48
#define IDM_EDITUNDO
Definition: resource.h:59
LRESULT OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:234
CSizeboxWindow sizeboxLeftCenter
Definition: main.cpp:76
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define TB_CHECKBUTTON
Definition: commctrl.h:1043
ImageModel imageModel
Definition: main.cpp:32
HWND m_hWnd
Definition: atlwin.h:267
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1727
BOOL DestroyWindow()
Definition: atlwin.h:428
static IHTMLWindow2 * window
Definition: events.c:77
CPaletteWindow paletteWindow
Definition: main.cpp:68
#define IDM_FILE1
Definition: resource.h:52
HINSTANCE hProgInstance
Definition: main.cpp:50
#define IDI_APPICON
Definition: resource.h:166
CString strFile1
Definition: registry.h:30
BOOL SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC)
Definition: dib.cpp:69
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:153
#define LoadCursor
Definition: winuser.h:5792
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
void ForceRefreshSelectionContents()
Definition: selection.cpp:24
HWND hwndOwner
Definition: commdlg.h:466
CString strFile4
Definition: registry.h:33
#define IDM_VIEWZOOM50
Definition: resource.h:76
bool IsEmpty() const
Definition: atlsimpstr.h:379
#define IDM_FILEPRINT
Definition: resource.h:43
LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:164
POINT percentage
Definition: dialogs.h:86
#define IDM_IMAGEATTRIBUTES
Definition: resource.h:89
#define IDM_IMAGEDRAWOPAQUE
Definition: resource.h:91
CSizeboxWindow sizeboxLeftBottom
Definition: main.cpp:78
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1299
int GetHeight() const
Definition: history.cpp:220
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
PaletteModel paletteModel
Definition: main.cpp:28
BOOL WINAPI DeleteDC(_In_ HDC)
LPSTR lpstrFile
Definition: commdlg.h:336
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
CFontsDialog fontsDialog
Definition: dialogs.cpp:22
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
HGLOBAL hDevNames
Definition: commdlg.h:468
#define IDM_EDITINVERTSELECTION
Definition: resource.h:65
HBITMAP GetBitmap() const
#define IDM_IMAGECROP
Definition: resource.h:87
HBITMAP DoLoadImageFile(HWND hwnd, LPCTSTR name, BOOL fIsMainFile)
Definition: dib.cpp:160
#define IDS_PROGRAMNAME
Definition: resource.h:179
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define SB_LINEDOWN
Definition: winuser.h:565
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:428
#define NULL
Definition: types.h:112
#define WM_HSCROLL
Definition: winuser.h:1730
#define SB_LINEUP
Definition: winuser.h:564
#define IDM_COLORSOLDPALETTE
Definition: resource.h:95
#define SB_SETPARTS
Definition: commctrl.h:1954
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HANDLE WINAPI GetClipboardData(_In_ UINT)
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
#define VK_CONTROL
Definition: winuser.h:2183
BOOL drawing
Definition: imgarea.h:20
CScrollboxWindow scrollboxWindow
Definition: main.cpp:69
void cancelDrawing()
Definition: imgarea.cpp:238
#define DragQueryFile
Definition: shellapi.h:684
DWORD lStructSize
Definition: commdlg.h:465
BOOL Invalidate(BOOL bErase=TRUE)
Definition: atlwin.h:862
#define IDC_ARROW
Definition: winuser.h:682
void FlipVertically()
Definition: history.cpp:252
WORD nToPage
Definition: commdlg.h:472
CSizeboxWindow sizeboxLeftTop
Definition: main.cpp:73
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDM_FILE2
Definition: resource.h:53
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:19
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:538
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:420
#define IDM_EDITSELECTALL
Definition: resource.h:66
#define HIWORD(l)
Definition: typedefs.h:247
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:383
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:591
PAL_TYPE SelectedPalette()
LONG bottom
Definition: windef.h:309
#define IDM_HELPHELPTOPICS
Definition: resource.h:97
#define IDM_COLORSMODERNPALETTE
Definition: resource.h:94
LRESULT OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:277
DWORD Flags
Definition: commdlg.h:470
#define IDM_EDITDELETESELECTION
Definition: resource.h:64
#define IDM_COLORSEDITPALETTE
Definition: resource.h:93
static HBITMAP
Definition: button.c:44
#define IDM_EDITCOPYTO
Definition: resource.h:67
#define LoadIcon
Definition: winuser.h:5793
#define IDNO
Definition: winuser.h:830
CTextEditWindow textEditWindow
Definition: main.cpp:81
void DeleteSelection()
Definition: history.cpp:293
CHOOSECOLOR choosecolor
Definition: main.cpp:36
#define IDCANCEL
Definition: winuser.h:825
RegistrySettings registrySettings
Definition: main.cpp:30
LONG_PTR LRESULT
Definition: windef.h:209
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:60
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
Definition: atlwin.h:968
#define HtmlHelp
Definition: htmlhelp.h:425
HDC hDC
Definition: commdlg.h:469
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define IDM_FILESAVEAS
Definition: resource.h:37
#define IDS_INFOTEXT
Definition: resource.h:182
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDM_EDITCOPY
Definition: resource.h:62
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL ConfirmSave()
Definition: winproc.cpp:241
#define SRCCOPY
Definition: wingdi.h:333
#define LoadString
Definition: winuser.h:5799
#define IDM_VIEWZOOM100
Definition: resource.h:77
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
struct Rect Rect
#define IDM_VIEWCOLORPALETTE
Definition: resource.h:71
BOOL IsWindowVisible() const
Definition: atlwin.h:924
CSelectionWindow selectionWindow
Definition: main.cpp:71
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135
#define ICON_BIG
Definition: tnclass.cpp:51
#define WM_VSCROLL
Definition: winuser.h:1731
CMainWindow mainWindow
Definition: main.cpp:63
BOOL IsImageSaved() const
Definition: history.cpp:174
CString strFile3
Definition: registry.h:32
#define IDM_IMAGEROTATEMIRROR
Definition: resource.h:85