ReactOS  0.4.12-dev-51-ge94618b
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 #include "dialogs.h"
17 
18 /* FUNCTIONS ********************************************************/
19 
20 BOOL
21 zoomTo(int newZoom, int mouseX, int mouseY)
22 {
23  RECT clientRectScrollbox;
24  RECT clientRectImageArea;
25  int x, y, w, h;
26  scrollboxWindow.GetClientRect(&clientRectScrollbox);
27  imageArea.GetClientRect(&clientRectImageArea);
28  w = clientRectImageArea.right * newZoom / toolsModel.GetZoom();
29  h = clientRectImageArea.bottom * newZoom / toolsModel.GetZoom();
30  if (!w || !h)
31  {
32  return FALSE;
33  }
34  w = clientRectImageArea.right * clientRectScrollbox.right / w;
35  h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
36  x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)) * newZoom / toolsModel.GetZoom();
37  y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2)) * newZoom / toolsModel.GetZoom();
38 
39  toolsModel.SetZoom(newZoom);
40 
41  selectionWindow.ShowWindow(SW_HIDE);
43  scrollboxWindow.Invalidate(TRUE);
45 
48  return TRUE;
49 }
50 
52 {
53  int x, y, w, h;
54  RECT clientRect;
55  GetClientRect(&clientRect);
56 
58  {
59  x = 56;
60  w = clientRect.right - 56;
61  }
62  else
63  {
64  x = 0;
65  w = clientRect.right;
66  }
67  if (paletteWindow.IsWindowVisible())
68  {
69  y = 49;
70  h = clientRect.bottom - 49;
71  }
72  else
73  {
74  y = 3;
75  h = clientRect.bottom - 3;
76  }
77 
78  RECT statusBarRect0;
79  SendMessage(hStatusBar, SB_GETRECT, 0, (LPARAM)&statusBarRect0);
80  int statusBarBorders[3];
81  SendMessage(hStatusBar, SB_GETBORDERS, 0, (LPARAM)&statusBarBorders);
82  int statusBarHeight = statusBarRect0.bottom - statusBarRect0.top + statusBarBorders[1];
83 
84  scrollboxWindow.MoveWindow(x, y, w, ::IsWindowVisible(hStatusBar) ? h - statusBarHeight : h, TRUE);
85  paletteWindow.MoveWindow(x, 9, 255, 32, TRUE);
86 }
87 
89 {
90  if (isAFile && overwrite)
91  {
93  }
94  else if (GetSaveFileName(&sfn) != 0)
95  {
98  CString strTitle;
100  SetWindowText(strTitle);
101  isAFile = TRUE;
102  }
103 }
104 
106 {
107  imageModel.Insert(bitmap);
108  CopyMemory(filepathname, newfilepathname, sizeof(filepathname));
109  CPath pathFileName(newfilepathname);
110  pathFileName.StripPath();
111  CString strTitle;
112  strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName);
113  SetWindowText(strTitle);
115  isAFile = TRUE;
116 
117  registrySettings.SetMostRecentFile(newfilepathname);
118 }
119 
121 {
122  int width = GetDIBWidth(bitmap);
123  int height = GetDIBHeight(bitmap);
124  int curWidth = imageModel.GetWidth();
125  int curHeight = imageModel.GetHeight();
126 
127  if (width > curWidth || height > curHeight)
128  {
129  BOOL shouldEnlarge = TRUE;
130 
131  if (askBeforeEnlarging)
132  {
133  TCHAR programname[20];
134  TCHAR shouldEnlargePromptText[100];
135 
136  LoadString(hProgInstance, IDS_PROGRAMNAME, programname, SIZEOF(programname));
137  LoadString(hProgInstance, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, SIZEOF(shouldEnlargePromptText));
138 
139  switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
140  {
141  case IDYES:
142  break;
143  case IDNO:
144  shouldEnlarge = FALSE;
145  break;
146  case IDCANCEL:
147  return;
148  }
149  }
150 
151  if (shouldEnlarge)
152  {
153  if (width > curWidth)
154  curWidth = width;
155 
156  if (height > curHeight)
157  curHeight = height;
158 
159  imageModel.Crop(curWidth, curHeight, 0, 0);
160  }
161  }
162 
166 
169 
170  placeSelWin();
171  selectionWindow.ShowWindow(SW_SHOW);
173 }
174 
176 {
177  HDROP drophandle;
178  TCHAR droppedfile[MAX_PATH];
179  HBITMAP bmNew = NULL;
180  drophandle = (HDROP)wParam;
181  DragQueryFile(drophandle, 0, droppedfile, SIZEOF(droppedfile));
182  DragFinish(drophandle);
183  LoadDIBFromFile(&bmNew, droppedfile, &fileTime, &fileSize, &fileHPPM, &fileVPPM);
184  if (bmNew != NULL)
185  {
186  UpdateApplicationProperties(bmNew, droppedfile);
187  }
188  return 0;
189 }
190 
192 {
195  return 0;
196 }
197 
199 {
201  PostQuitMessage(0); /* send a WM_QUIT to the message queue */
202  return 0;
203 }
204 
206 {
207  if (!imageModel.IsImageSaved())
208  {
209  CString strProgramName;
210  strProgramName.LoadString(IDS_PROGRAMNAME);
211  CPath pathFileName(filepathname);
212  pathFileName.StripPath();
213  CString strSavePromptText;
214  strSavePromptText.Format(IDS_SAVEPROMPTTEXT, (LPCTSTR)pathFileName);
215  switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
216  {
217  case IDNO:
218  DestroyWindow();
219  break;
220  case IDYES:
221  saveImage(FALSE);
222  if (imageModel.IsImageSaved())
223  DestroyWindow();
224  break;
225  }
226  }
227  else
228  {
229  DestroyWindow();
230  }
231  return 0;
232 }
233 
235 {
236  HMENU menu = GetMenu();
237  BOOL trueSelection = (selectionWindow.IsWindowVisible() && ((toolsModel.GetActiveTool() == TOOL_FREESEL) || (toolsModel.GetActiveTool() == TOOL_RECTSEL)));
238  switch (lParam)
239  {
240  case 0: /* File menu */
241  if ((HMENU)wParam != GetSubMenu(menu, 0))
242  break;
251  {
253  CPath pathFile1(registrySettings.strFile1);
254  pathFile1.CompactPathEx(30);
256  {
257  CPath pathFile2(registrySettings.strFile2);
258  pathFile2.CompactPathEx(30);
260  {
261  CPath pathFile3(registrySettings.strFile3);
262  pathFile3.CompactPathEx(30);
264  {
265  CPath pathFile4(registrySettings.strFile4);
266  pathFile4.CompactPathEx(30);
267  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE4, _T("4 ") + pathFile4);
268  }
269  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE3, _T("3 ") + pathFile3);
270  }
271  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE2, _T("2 ") + pathFile2);
272  }
273  InsertMenu((HMENU)wParam, 17, MF_BYPOSITION | MF_STRING, IDM_FILE1, _T("1 ") + pathFile1);
274  }
275  break;
276  case 1: /* Edit menu */
279  EnableMenuItem(menu, IDM_EDITCUT, ENABLED_IF(trueSelection));
280  EnableMenuItem(menu, IDM_EDITCOPY, ENABLED_IF(trueSelection));
281  EnableMenuItem(menu, IDM_EDITDELETESELECTION, ENABLED_IF(trueSelection));
282  EnableMenuItem(menu, IDM_EDITINVERTSELECTION, ENABLED_IF(trueSelection));
283  EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
284  OpenClipboard();
286  CloseClipboard();
287  break;
288  case 2: /* View menu */
290  CheckMenuItem(menu, IDM_VIEWCOLORPALETTE, CHECKED_IF(paletteWindow.IsWindowVisible()));
292  CheckMenuItem(menu, IDM_FORMATICONBAR, CHECKED_IF(textEditWindow.IsWindowVisible()));
294 
297  break;
298  case 3: /* Image menu */
299  EnableMenuItem(menu, IDM_IMAGECROP, ENABLED_IF(selectionWindow.IsWindowVisible()));
301  break;
302  }
303 
311 
314  return 0;
315 }
316 
318 {
319  int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
320  SendMessage(hStatusBar, WM_SIZE, wParam, lParam);
323  Invalidate(TRUE);
324  return 0;
325 }
326 
328 {
329  MINMAXINFO *mm = (LPMINMAXINFO) lParam;
330  mm->ptMinTrackSize.x = 330;
331  mm->ptMinTrackSize.y = 430;
332  return 0;
333 }
334 
336 {
338  bHandled = FALSE;
339  return 0;
340 }
341 
343 {
344  if (wParam == VK_ESCAPE)
345  {
346  HWND hwndCapture = GetCapture();
347  if (hwndCapture)
348  {
349  if (selectionWindow.m_hWnd == hwndCapture ||
350  imageArea.m_hWnd == hwndCapture ||
351  fullscreenWindow.m_hWnd == hwndCapture ||
352  sizeboxLeftTop.m_hWnd == hwndCapture ||
353  sizeboxCenterTop.m_hWnd == hwndCapture ||
354  sizeboxRightTop.m_hWnd == hwndCapture ||
355  sizeboxLeftCenter.m_hWnd == hwndCapture ||
356  sizeboxRightCenter.m_hWnd == hwndCapture ||
357  sizeboxLeftBottom.m_hWnd == hwndCapture ||
358  sizeboxCenterBottom.m_hWnd == hwndCapture ||
359  sizeboxRightBottom.m_hWnd == hwndCapture)
360  {
361  SendMessage(hwndCapture, nMsg, wParam, lParam);
362  }
363  }
364  else
365  {
366  switch (toolsModel.GetActiveTool())
367  {
368  case TOOL_SHAPE: case TOOL_BEZIER:
369  imageArea.SendMessage(nMsg, wParam, lParam);
370  break;
371  }
372  }
373  }
374  return 0;
375 }
376 
378 {
379  /* Redirect message to common controls */
381  SendMessage(hToolbar, WM_SYSCOLORCHANGE, 0, 0);
382  return 0;
383 }
384 
386 {
387  switch (LOWORD(wParam))
388  {
389  case IDM_HELPINFO:
390  {
392  TCHAR infotitle[100];
393  TCHAR infotext[200];
394  LoadString(hProgInstance, IDS_INFOTITLE, infotitle, SIZEOF(infotitle));
395  LoadString(hProgInstance, IDS_INFOTEXT, infotext, SIZEOF(infotext));
396  ShellAbout(m_hWnd, infotitle, infotext, paintIcon);
397  DeleteObject(paintIcon);
398  break;
399  }
400  case IDM_HELPHELPTOPICS:
401  HtmlHelp(m_hWnd, _T("help\\Paint.chm"), 0, 0);
402  break;
403  case IDM_FILEEXIT:
404  SendMessage(WM_CLOSE, wParam, lParam);
405  break;
406  case IDM_FILENEW:
407  {
408  BOOL reset = TRUE;
409  if (!imageModel.IsImageSaved())
410  {
411  CString strProgramName;
412  strProgramName.LoadString(IDS_PROGRAMNAME);
413  CPath pathFileName(filepathname);
414  pathFileName.StripPath();
415  CString strSavePromptText;
416  strSavePromptText.Format(IDS_SAVEPROMPTTEXT, (LPCTSTR)pathFileName);
417  switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION))
418  {
419  case IDNO:
420  imageModel.imageSaved = TRUE; //TODO: move to ImageModel
421  break;
422  case IDYES:
423  saveImage(FALSE);
424  break;
425  case IDCANCEL:
426  reset = FALSE;
427  break;
428  }
429  }
430  if (reset && imageModel.IsImageSaved()) //TODO: move to ImageModel
431  {
432  imageModel.Clear();
434  }
435  break;
436  }
437  case IDM_FILEOPEN:
438  if (GetOpenFileName(&ofn) != 0)
439  {
440  HBITMAP bmNew = NULL;
442  if (bmNew != NULL)
443  {
445  }
446  }
447  break;
448  case IDM_FILESAVE:
449  saveImage(TRUE);
450  break;
451  case IDM_FILESAVEAS:
452  saveImage(FALSE);
453  break;
454  case IDM_FILEPAGESETUP:
455  // DUMMY: Shows the dialog only, no functionality
456  PAGESETUPDLG psd;
457  ZeroMemory(&psd, sizeof(psd));
458  psd.lStructSize = sizeof(psd);
459  psd.hwndOwner = m_hWnd;
460  PageSetupDlg(&psd);
461  break;
462  case IDM_FILEPRINT:
463  // TODO: Test whether it actually works
464  PRINTDLG pd;
465  ZeroMemory(&pd, sizeof(pd));
466  pd.lStructSize = sizeof(pd);
467  pd.hwndOwner = m_hWnd;
468  pd.hDevMode = NULL; // freed by user
469  pd.hDevNames = NULL; // freed by user
471  pd.nCopies = 1;
472  pd.nFromPage = 0xffff;
473  pd.nToPage = 0xffff;
474  pd.nMinPage = 1;
475  pd.nMaxPage = 0xffff;
476  if (PrintDlg(&pd) == TRUE)
477  {
479  DeleteDC(pd.hDC);
480  }
481  if (pd.hDevMode)
482  GlobalFree(pd.hDevMode);
483  if (pd.hDevNames)
484  GlobalFree(pd.hDevNames);
485  break;
488  break;
491  break;
494  break;
495  case IDM_FILE1:
496  {
497  HBITMAP bmNew = NULL;
499  if (bmNew != NULL)
500  {
502  }
503  break;
504  }
505  case IDM_FILE2:
506  {
507  HBITMAP bmNew = NULL;
509  if (bmNew != NULL)
510  {
512  }
513  break;
514  }
515  case IDM_FILE3:
516  {
517  HBITMAP bmNew = NULL;
519  if (bmNew != NULL)
520  {
522  }
523  break;
524  }
525  case IDM_FILE4:
526  {
527  HBITMAP bmNew = NULL;
529  if (bmNew != NULL)
530  {
532  }
533  break;
534  }
535  case IDM_EDITUNDO:
536  imageModel.Undo();
538  break;
539  case IDM_EDITREDO:
540  imageModel.Redo();
542  break;
543  case IDM_EDITCOPY:
544  OpenClipboard();
545  EmptyClipboard();
547  CloseClipboard();
548  break;
549  case IDM_EDITCUT:
550  /* Copy */
552  /* Delete selection */
554  break;
555  case IDM_EDITPASTE:
556  OpenClipboard();
558  {
560  }
561  CloseClipboard();
562  break;
564  {
565  /* remove selection window and already painted content using undo */
566  imageModel.Undo();
567  break;
568  }
569  case IDM_EDITSELECTALL:
570  {
574  //TODO: do this properly
578  break;
579  }
580  case IDM_EDITCOPYTO:
581  if (GetSaveFileName(&ofn) != 0)
583  break;
584  case IDM_EDITPASTEFROM:
585  if (GetOpenFileName(&ofn) != 0)
586  {
587  HBITMAP bmNew = NULL;
588  LoadDIBFromFile(&bmNew, ofn.lpstrFile, &fileTime, &fileSize, &fileHPPM, &fileVPPM);
589  if (bmNew != NULL)
590  {
592  DeleteObject(bmNew);
593  }
594  }
595  break;
597  if (ChooseColor(&choosecolor))
599  break;
602  break;
605  break;
607  {
609  break;
610  }
615  break;
617  switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
618  {
619  case 1: /* flip horizontally */
620  if (selectionWindow.IsWindowVisible())
622  else
624  break;
625  case 2: /* flip vertically */
626  if (selectionWindow.IsWindowVisible())
628  else
630  break;
631  case 3: /* rotate 90 degrees */
632  break;
633  case 4: /* rotate 180 degrees */
634  if (selectionWindow.IsWindowVisible())
636  else
638  break;
639  case 5: /* rotate 270 degrees */
640  break;
641  }
642  break;
643  case IDM_IMAGEATTRIBUTES:
644  {
645  if (attributesDialog.DoModal(mainWindow.m_hWnd))
646  {
648  }
649  break;
650  }
652  {
653  if (stretchSkewDialog.DoModal(mainWindow.m_hWnd))
654  {
657  }
658  break;
659  }
660  case IDM_IMAGEDRAWOPAQUE:
662  break;
663  case IDM_IMAGECROP:
665  break;
666 
667  case IDM_VIEWTOOLBOX:
670  break;
672  paletteWindow.ShowWindow(paletteWindow.IsWindowVisible() ? SW_HIDE : SW_SHOW);
674  break;
675  case IDM_VIEWSTATUSBAR:
678  break;
679  case IDM_FORMATICONBAR:
680  textEditWindow.ShowWindow(textEditWindow.IsWindowVisible() ? SW_HIDE : SW_SHOW);
681  break;
682  case IDM_VIEWSHOWGRID:
683  showGrid = !showGrid;
685  break;
688  miniature.ShowWindow(showMiniature ? SW_SHOW : SW_HIDE);
689  break;
690 
691  case IDM_VIEWZOOM125:
692  zoomTo(125, 0, 0);
693  break;
694  case IDM_VIEWZOOM25:
695  zoomTo(250, 0, 0);
696  break;
697  case IDM_VIEWZOOM50:
698  zoomTo(500, 0, 0);
699  break;
700  case IDM_VIEWZOOM100:
701  zoomTo(1000, 0, 0);
702  break;
703  case IDM_VIEWZOOM200:
704  zoomTo(2000, 0, 0);
705  break;
706  case IDM_VIEWZOOM400:
707  zoomTo(4000, 0, 0);
708  break;
709  case IDM_VIEWZOOM800:
710  zoomTo(8000, 0, 0);
711  break;
712 
713  case IDM_VIEWFULLSCREEN:
714  fullscreenWindow.ShowWindow(SW_SHOW);
715  ShowWindow(SW_HIDE);
716  break;
717  }
718  return 0;
719 }
BOOL isAFile
Definition: main.cpp:53
POINT ptMinTrackSize
Definition: winuser.h:3572
#define IDM_IMAGEROTATEMIRROR
Definition: definitions.h:101
void FlipHorizontally()
Definition: history.cpp:224
int SelectedPalette()
void SaveImage(LPTSTR lpFileName)
Definition: history.cpp:162
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDM_EDITUNDO
Definition: definitions.h:75
GLint GLint GLsizei width
Definition: gl.h:1546
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:45
#define max(a, b)
Definition: svc.c:63
#define IDM_EDITPASTEFROM
Definition: definitions.h:84
static HICON
Definition: imagelist.c:84
#define IDM_IMAGEINVERTCOLORS
Definition: definitions.h:104
#define TRUE
Definition: types.h:120
CToolBox toolBoxContainer
Definition: main.cpp:65
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
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:949
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
WORD nMaxPage
Definition: commdlg.h:474
#define MF_BYCOMMAND
Definition: winuser.h:202
#define HBITMAP
Definition: msvc.h:28
int fileSize
Definition: main.cpp:54
#define IDM_VIEWZOOM125
Definition: definitions.h:90
long y
Definition: polytest.cpp:48
#define TOOL_TEXT
Definition: definitions.h:144
#define PageSetupDlg
Definition: commdlg.h:667
#define IDM_VIEWSHOWGRID
Definition: definitions.h:98
void SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time, int *size, int hRes, int vRes)
Definition: dib.cpp:46
#define IDYES
Definition: winuser.h:829
long x
Definition: polytest.cpp:48
#define IDM_VIEWZOOM400
Definition: definitions.h:95
#define IDM_EDITSELECTALL
Definition: definitions.h:82
#define InsertMenu
Definition: winuser.h:5669
#define ChooseColor
Definition: commdlg.h:661
void endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
Definition: mouse.cpp:218
BOOL showGrid
Definition: main.cpp:59
#define SW_HIDE
Definition: winuser.h:762
#define IDM_EDITCOPY
Definition: definitions.h:78
#define IDS_PROGRAMNAME
Definition: definitions.h:203
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:3915
#define IDM_IMAGECROP
Definition: definitions.h:103
LPWSTR lpstrFile
Definition: commdlg.h:367
#define IDM_VIEWCOLORPALETTE
Definition: definitions.h:87
#define MF_STRING
Definition: winuser.h:138
void StripPath()
Definition: atlpath.h:339
OPENFILENAME ofn
Definition: main.cpp:37
BOOL CompactPathEx(UINT nMaxChars, DWORD dwFlags=0)
Definition: atlpath.h:182
void InvertColors()
Definition: history.cpp:205
#define IDM_EDITCOPYTO
Definition: definitions.h:83
CSizeboxWindow sizeboxRightCenter
Definition: main.cpp:76
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define IDM_COLORSEDITPALETTE
Definition: definitions.h:109
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:668
#define TOOL_SHAPE
Definition: definitions.h:148
WORD nCopies
Definition: commdlg.h:475
CString strFile2
Definition: registry.h:31
int GetDIBHeight(HBITMAP hBitmap)
Definition: dib.cpp:38
#define test
Definition: rosglue.h:37
#define IDM_VIEWSTATUSBAR
Definition: definitions.h:88
SelectionModel selectionModel
Definition: main.cpp:20
#define IDM_COLORSOLDPALETTE
Definition: definitions.h:111
BOOL IsImageSaved()
Definition: history.cpp:168
static void SetWallpaper(LPCTSTR szFileName, WallpaperStyle style)
Definition: registry.cpp:38
#define VK_ESCAPE
Definition: winuser.h:2168
BOOL SetWindowText(LPCTSTR lpszString)
Definition: atlwin.h:1223
BOOL askBeforeEnlarging
Definition: main.cpp:33
LONG right
Definition: windef.h:298
BOOL HasRedoSteps()
Definition: history.cpp:178
void Redo(void)
Definition: history.cpp:75
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:191
COLORREF rgbResult
Definition: commdlg.h:242
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define GetOpenFileName
Definition: commdlg.h:665
WPARAM wParam
Definition: combotst.c:138
#define IDM_IMAGEDELETEIMAGE
Definition: definitions.h:106
void whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
Definition: mouse.cpp:125
#define IDM_FILEPAGESETUP
Definition: definitions.h:58
WORD nMinPage
Definition: commdlg.h:473
LRESULT OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:327
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
int GetZoom()
Definition: toolsmodel.cpp:104
UINT_PTR WPARAM
Definition: windef.h:207
#define ICON_SMALL
Definition: tnclass.cpp:48
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:124
INT INT y
Definition: msvc.h:62
void SetMostRecentFile(LPCTSTR szPathName)
Definition: registry.cpp:144
#define IDM_IMAGEATTRIBUTES
Definition: definitions.h:105
HANDLE hDevNames
Definition: commdlg.h:468
CImgAreaWindow imageArea
Definition: main.cpp:71
#define SB_GETRECT
Definition: commctrl.h:1929
#define GetSaveFileName
Definition: commdlg.h:666
void LoadDIBFromFile(HBITMAP *hBitmap, LPCTSTR name, LPSYSTEMTIME time, int *size, int *hRes, int *vRes)
Definition: dib.cpp:84
int GetDIBWidth(HBITMAP hBitmap)
Definition: dib.cpp:30
#define PrintDlg
Definition: commdlg.h:668
LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:205
#define LR_COPYRETURNORG
Definition: winuser.h:1080
CSizeboxWindow sizeboxCenterTop
Definition: main.cpp:73
#define IDM_FILEPRINT
Definition: definitions.h:59
#define PD_USEDEVMODECOPIESANDCOLLATE
Definition: commdlg.h:166
#define IDM_VIEWZOOM100
Definition: definitions.h:93
CSizeboxWindow sizeboxRightTop
Definition: main.cpp:74
SYSTEMTIME fileTime
Definition: main.cpp:57
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SIZEOF(_ar)
Definition: calc.h:48
CMirrorRotateDialog mirrorRotateDialog
Definition: dialogs.cpp:19
CSizeboxWindow sizeboxCenterBottom
Definition: main.cpp:78
void startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
Definition: mouse.cpp:56
void ClearHistory(void)
Definition: history.cpp:102
#define IDM_FILE1
Definition: definitions.h:68
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:342
#define TOOL_BEZIER
Definition: definitions.h:146
#define IDM_FILEASWALLPAPERCENTERED
Definition: definitions.h:64
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_ENLARGEPROMPTTEXT
Definition: definitions.h:239
void saveImage(BOOL overwrite)
Definition: winproc.cpp:88
#define IDM_VIEWFULLSCREEN
Definition: definitions.h:97
#define MF_BYPOSITION
Definition: winuser.h:203
HDC GetDC()
Definition: history.cpp:219
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:498
HWND WINAPI GetCapture(void)
Definition: message.c:2855
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:98
#define CF_BITMAP
Definition: constants.h:397
#define TOOLBARCLASSNAME
Definition: commctrl.h:916
CMiniatureWindow miniature
Definition: main.cpp:64
WORD nFromPage
Definition: commdlg.h:471
smooth NULL
Definition: ftsmooth.c:416
#define SB_GETBORDERS
Definition: commctrl.h:1926
#define IDM_HELPHELPTOPICS
Definition: definitions.h:113
#define MB_ICONQUESTION
Definition: winuser.h:783
struct tagMINMAXINFO * LPMINMAXINFO
#define SB_THUMBPOSITION
Definition: winuser.h:572
#define MB_YESNOCANCEL
Definition: winuser.h:812
int fileHPPM
Definition: main.cpp:55
#define PD_RETURNDC
Definition: commdlg.h:155
#define IDM_VIEWZOOM25
Definition: definitions.h:91
CSizeboxWindow sizeboxRightBottom
Definition: main.cpp:79
CStretchSkewDialog stretchSkewDialog
Definition: dialogs.cpp:21
DWORD lStructSize
Definition: commdlg.h:433
#define IDS_SAVEPROMPTTEXT
Definition: definitions.h:208
#define SW_SHOW
Definition: winuser.h:769
#define IDS_INFOTEXT
Definition: definitions.h:206
#define IDM_FILE4
Definition: definitions.h:71
void SelectPalette(int nPalette)
void Insert(HBITMAP hbm)
Definition: history.cpp:108
LRESULT OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:175
WINDOWPLACEMENT WindowPlacement
Definition: registry.h:28
#define IDS_INFOTITLE
Definition: definitions.h:205
Definition: uimain.c:88
HMENU GetMenu() const
Definition: atlwin.h:627
char TCHAR
Definition: xmlstorage.h:189
void Clear(COLORREF color=0x00ffffff)
Definition: history.cpp:213
BOOL IsBackgroundTransparent()
Definition: toolsmodel.cpp:93
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define _T(x)
Definition: vfdio.h:22
unsigned int BOOL
Definition: ntddk_ex.h:94
OPENFILENAMEW sfn
Definition: eventvwr.c:118
#define IDM_FILEASWALLPAPERSTRETCHED
Definition: definitions.h:65
#define IDM_FILEMOSTRECENTLYUSEDFILE
Definition: definitions.h:67
#define WM_SIZE
Definition: winuser.h:1593
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
Definition: winproc.cpp:120
BOOL GetWindowPlacement(WINDOWPLACEMENT *lpwndpl) const
Definition: atlwin.h:741
#define ID_RECTSEL
Definition: definitions.h:118
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX=0, int nSkewDegY=0)
Definition: history.cpp:183
#define FindWindowEx
Definition: winuser.h:5644
BOOL OpenClipboard()
Definition: atlwin.h:961
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:26
unsigned int UINT
Definition: ndis.h:50
#define CopyMemory
Definition: winbase.h:1633
void RotateNTimes90Degrees(int iN)
Definition: history.cpp:240
#define IDM_FORMATICONBAR
Definition: definitions.h:89
BOOL imageSaved
Definition: history.h:24
CFullscreenWindow fullscreenWindow
Definition: main.cpp:63
HWND hStatusBar
Definition: main.cpp:35
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ShellAbout
Definition: shellapi.h:678
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL showMiniature
Definition: main.cpp:60
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
void placeSelWin()
Definition: mouse.cpp:16
int GetWidth()
Definition: history.cpp:195
#define IDM_EDITINVERTSELECTION
Definition: definitions.h:81
TCHAR filepathname[1000]
Definition: main.cpp:52
CAttributesDialog attributesDialog
Definition: dialogs.cpp:20
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:317
void alignChildrenToMainWindow()
Definition: winproc.cpp:51
int GetHeight()
Definition: history.cpp:200
#define IDM_VIEWZOOM50
Definition: definitions.h:92
LRESULT OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:198
CSizeboxWindow sizeboxLeftCenter
Definition: main.cpp:75
#define IDM_FILEEXIT
Definition: definitions.h:73
#define TB_CHECKBUTTON
Definition: commctrl.h:1013
#define CHECKED_IF(a)
Definition: definitions.h:25
void SetFgColor(int newColor)
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_FREESEL
Definition: definitions.h:135
HWND m_hWnd
Definition: atlwin.h:259
#define IDM_FILEASWALLPAPERPLANE
Definition: definitions.h:63
#define IDM_EDITCUT
Definition: definitions.h:77
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1716
#define IDM_EDITPASTE
Definition: definitions.h:79
BOOL DestroyWindow()
Definition: atlwin.h:419
static IHTMLWindow2 * window
Definition: events.c:77
CPaletteWindow paletteWindow
Definition: main.cpp:67
BOOL HasUndoSteps()
Definition: history.cpp:173
HINSTANCE hProgInstance
Definition: main.cpp:50
#define IDI_APPICON
Definition: resource.h:166
CString strFile1
Definition: registry.h:30
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:109
#define LoadCursor
Definition: winuser.h:5678
#define TOOL_RECTSEL
Definition: definitions.h:136
#define IDM_IMAGESTRETCHSKEW
Definition: definitions.h:102
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
void ForceRefreshSelectionContents()
Definition: selection.cpp:56
#define IDM_HELPINFO
Definition: definitions.h:114
HWND hwndOwner
Definition: commdlg.h:466
void UpdateApplicationProperties(HBITMAP bitmap, LPCTSTR newfilepathname)
Definition: winproc.cpp:105
CString strFile4
Definition: registry.h:33
#define IDM_IMAGEDRAWOPAQUE
Definition: definitions.h:107
#define IDM_EDITDELETESELECTION
Definition: definitions.h:80
bool IsEmpty() const
Definition: atlsimpstr.h:379
#define IDM_COLORSMODERNPALETTE
Definition: definitions.h:110
#define IDM_EDITREDO
Definition: definitions.h:76
POINT percentage
Definition: dialogs.h:86
#define IDM_FILESAVEAS
Definition: definitions.h:53
GLboolean reset
Definition: glext.h:5666
CSizeboxWindow sizeboxLeftBottom
Definition: main.cpp:77
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1256
#define IDM_FILE2
Definition: definitions.h:69
PaletteModel paletteModel
Definition: main.cpp:28
BOOL WINAPI DeleteDC(_In_ HDC)
#define IDM_FILESAVE
Definition: definitions.h:52
LPSTR lpstrFile
Definition: commdlg.h:336
void InsertFromHBITMAP(HBITMAP hBm)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
INT x
Definition: msvc.h:62
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
int GetActiveTool()
Definition: toolsmodel.cpp:60
#define ENABLED_IF(a)
Definition: definitions.h:27
#define min(a, b)
Definition: monoChain.cc:55
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:385
#define WM_HSCROLL
Definition: winuser.h:1719
#define IMAGE_BITMAP
Definition: winuser.h:211
#define SB_SETPARTS
Definition: commctrl.h:1924
HANDLE WINAPI GetClipboardData(_In_ UINT)
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
CScrollboxWindow scrollboxWindow
Definition: main.cpp:68
#define DragQueryFile
Definition: shellapi.h:672
DWORD lStructSize
Definition: commdlg.h:465
BOOL Invalidate(BOOL bErase=TRUE)
Definition: atlwin.h:819
void Undo(void)
Definition: history.cpp:57
#define IDC_ARROW
Definition: winuser.h:682
void FlipVertically()
Definition: history.cpp:232
WORD nToPage
Definition: commdlg.h:472
CSizeboxWindow sizeboxLeftTop
Definition: main.cpp:72
#define IDM_FILEOPEN
Definition: definitions.h:51
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:21
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:543
#define IDM_FILE3
Definition: definitions.h:70
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:377
#define IDM_VIEWZOOM200
Definition: definitions.h:94
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1039
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:335
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:506
LONG bottom
Definition: windef.h:299
#define IDM_VIEWZOOM800
Definition: definitions.h:96
LRESULT OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: winproc.cpp:234
DWORD Flags
Definition: commdlg.h:470
#define IDM_FILENEW
Definition: definitions.h:50
#define LoadIcon
Definition: winuser.h:5679
#define IDNO
Definition: winuser.h:830
CTextEditWindow textEditWindow
Definition: main.cpp:80
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
int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption=NULL, UINT nType=MB_OK)
Definition: atlwin.h:925
#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 IDS_WINDOWTITLE
Definition: definitions.h:204
#define IDM_VIEWSHOWMINIATURE
Definition: definitions.h:99
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
HANDLE hDevMode
Definition: commdlg.h:467
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define SRCCOPY
Definition: wingdi.h:331
#define LoadString
Definition: winuser.h:5685
int fileVPPM
Definition: main.cpp:56
struct Rect Rect
BOOL IsWindowVisible() const
Definition: atlwin.h:881
CSelectionWindow selectionWindow
Definition: main.cpp:70
#define IDM_VIEWTOOLBOX
Definition: definitions.h:86
#define ICON_BIG
Definition: tnclass.cpp:51
#define WM_VSCROLL
Definition: winuser.h:1720
CMainWindow mainWindow
Definition: main.cpp:62
CString strFile3
Definition: registry.h:32