2 * PROJECT: PAINT for ReactOS
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
12 /* INCLUDES *********************************************************/
18 /* FUNCTIONS ********************************************************/
21 zoomTo(int newZoom
, int mouseX
, int mouseY
)
23 RECT clientRectScrollbox
;
24 RECT clientRectImageArea
;
26 scrollboxWindow
.GetClientRect(&clientRectScrollbox
);
27 imageArea
.GetClientRect(&clientRectImageArea
);
28 w
= clientRectImageArea
.right
* newZoom
/ toolsModel
.GetZoom();
29 h
= clientRectImageArea
.bottom
* newZoom
/ toolsModel
.GetZoom();
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();
39 toolsModel
.SetZoom(newZoom
);
41 selectionWindow
.ShowWindow(SW_HIDE
);
42 imageArea
.MoveWindow(3, 3, imageModel
.GetWidth() * toolsModel
.GetZoom() / 1000, imageModel
.GetHeight() * toolsModel
.GetZoom() / 1000, FALSE
);
43 scrollboxWindow
.Invalidate(TRUE
);
44 imageArea
.Invalidate(FALSE
);
46 scrollboxWindow
.SendMessage(WM_HSCROLL
, MAKEWPARAM(SB_THUMBPOSITION
, x
), 0);
47 scrollboxWindow
.SendMessage(WM_VSCROLL
, MAKEWPARAM(SB_THUMBPOSITION
, y
), 0);
51 void CMainWindow::alignChildrenToMainWindow()
55 GetClientRect(&clientRect
);
57 if (toolBoxContainer
.IsWindowVisible())
60 w
= clientRect
.right
- 56;
67 if (paletteWindow
.IsWindowVisible())
70 h
= clientRect
.bottom
- 49;
75 h
= clientRect
.bottom
- 3;
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];
84 scrollboxWindow
.MoveWindow(x
, y
, w
, ::IsWindowVisible(hStatusBar
) ? h
- statusBarHeight
: h
, TRUE
);
85 paletteWindow
.MoveWindow(x
, 9, 255, 32, TRUE
);
88 void CMainWindow::saveImage(BOOL overwrite
)
90 if (isAFile
&& overwrite
)
92 imageModel
.SaveImage(filepathname
);
94 else if (GetSaveFileName(&sfn
) != 0)
96 imageModel
.SaveImage(sfn
.lpstrFile
);
97 _tcsncpy(filepathname
, sfn
.lpstrFile
, SIZEOF(filepathname
));
99 strTitle
.Format(IDS_WINDOWTITLE
, (LPCTSTR
)sfn
.lpstrFileTitle
);
100 SetWindowText(strTitle
);
105 void CMainWindow::InsertSelectionFromHBITMAP(HBITMAP bitmap
, HWND window
)
107 int width
= GetDIBWidth(bitmap
);
108 int height
= GetDIBHeight(bitmap
);
109 int curWidth
= imageModel
.GetWidth();
110 int curHeight
= imageModel
.GetHeight();
112 if (width
> curWidth
|| height
> curHeight
)
114 BOOL shouldEnlarge
= TRUE
;
116 if (askBeforeEnlarging
)
118 TCHAR programname
[20];
119 TCHAR shouldEnlargePromptText
[100];
121 LoadString(hProgInstance
, IDS_PROGRAMNAME
, programname
, SIZEOF(programname
));
122 LoadString(hProgInstance
, IDS_ENLARGEPROMPTTEXT
, shouldEnlargePromptText
, SIZEOF(shouldEnlargePromptText
));
124 switch (MessageBox(shouldEnlargePromptText
, programname
, MB_YESNOCANCEL
| MB_ICONQUESTION
))
129 shouldEnlarge
= FALSE
;
138 if (width
> curWidth
)
141 if (height
> curHeight
)
144 imageModel
.Crop(curWidth
, curHeight
, 0, 0);
148 HWND hToolbar
= FindWindowEx(toolBoxContainer
.m_hWnd
, NULL
, TOOLBARCLASSNAME
, NULL
);
149 SendMessage(hToolbar
, TB_CHECKBUTTON
, ID_RECTSEL
, MAKELPARAM(TRUE
, 0));
150 toolBoxContainer
.SendMessage(WM_COMMAND
, ID_RECTSEL
);
152 imageModel
.CopyPrevious();
153 selectionModel
.InsertFromHBITMAP(bitmap
);
156 selectionWindow
.ShowWindow(SW_SHOW
);
157 ForceRefreshSelectionContents();
160 LRESULT
CMainWindow::OnDropFiles(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
162 TCHAR droppedfile
[MAX_PATH
];
164 HDROP hDrop
= (HDROP
)wParam
;
165 DragQueryFile(hDrop
, 0, droppedfile
, SIZEOF(droppedfile
));
168 ConfirmSave() && DoLoadImageFile(m_hWnd
, droppedfile
, TRUE
);
173 LRESULT
CMainWindow::OnCreate(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
175 SendMessage(WM_SETICON
, ICON_BIG
, (LPARAM
) LoadIcon(hProgInstance
, MAKEINTRESOURCE(IDI_APPICON
)));
176 SendMessage(WM_SETICON
, ICON_SMALL
, (LPARAM
) LoadIcon(hProgInstance
, MAKEINTRESOURCE(IDI_APPICON
)));
180 LRESULT
CMainWindow::OnDestroy(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
182 GetWindowPlacement(&(registrySettings
.WindowPlacement
));
183 PostQuitMessage(0); /* send a WM_QUIT to the message queue */
187 BOOL
CMainWindow::ConfirmSave()
189 if (imageModel
.IsImageSaved())
192 CString strProgramName
;
193 strProgramName
.LoadString(IDS_PROGRAMNAME
);
195 CString strSavePromptText
;
196 strSavePromptText
.Format(IDS_SAVEPROMPTTEXT
, PathFindFileName(filepathname
));
198 switch (MessageBox(strSavePromptText
, strProgramName
, MB_YESNOCANCEL
| MB_ICONQUESTION
))
202 return imageModel
.IsImageSaved();
212 LRESULT
CMainWindow::OnClose(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
221 LRESULT
CMainWindow::OnInitMenuPopup(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
223 HMENU menu
= GetMenu();
224 BOOL trueSelection
= (selectionWindow
.IsWindowVisible() && ((toolsModel
.GetActiveTool() == TOOL_FREESEL
) || (toolsModel
.GetActiveTool() == TOOL_RECTSEL
)));
227 case 0: /* File menu */
228 if ((HMENU
)wParam
!= GetSubMenu(menu
, 0))
230 EnableMenuItem(menu
, IDM_FILEASWALLPAPERPLANE
, ENABLED_IF(isAFile
));
231 EnableMenuItem(menu
, IDM_FILEASWALLPAPERCENTERED
, ENABLED_IF(isAFile
));
232 EnableMenuItem(menu
, IDM_FILEASWALLPAPERSTRETCHED
, ENABLED_IF(isAFile
));
233 RemoveMenu(menu
, IDM_FILE1
, MF_BYCOMMAND
);
234 RemoveMenu(menu
, IDM_FILE2
, MF_BYCOMMAND
);
235 RemoveMenu(menu
, IDM_FILE3
, MF_BYCOMMAND
);
236 RemoveMenu(menu
, IDM_FILE4
, MF_BYCOMMAND
);
237 if (!registrySettings
.strFile1
.IsEmpty())
239 RemoveMenu(menu
, IDM_FILEMOSTRECENTLYUSEDFILE
, MF_BYCOMMAND
);
240 CPath
pathFile1(registrySettings
.strFile1
);
241 pathFile1
.CompactPathEx(30);
242 if (!registrySettings
.strFile2
.IsEmpty())
244 CPath
pathFile2(registrySettings
.strFile2
);
245 pathFile2
.CompactPathEx(30);
246 if (!registrySettings
.strFile3
.IsEmpty())
248 CPath
pathFile3(registrySettings
.strFile3
);
249 pathFile3
.CompactPathEx(30);
250 if (!registrySettings
.strFile4
.IsEmpty())
252 CPath
pathFile4(registrySettings
.strFile4
);
253 pathFile4
.CompactPathEx(30);
254 InsertMenu((HMENU
)wParam
, 17, MF_BYPOSITION
| MF_STRING
, IDM_FILE4
, _T("4 ") + pathFile4
);
256 InsertMenu((HMENU
)wParam
, 17, MF_BYPOSITION
| MF_STRING
, IDM_FILE3
, _T("3 ") + pathFile3
);
258 InsertMenu((HMENU
)wParam
, 17, MF_BYPOSITION
| MF_STRING
, IDM_FILE2
, _T("2 ") + pathFile2
);
260 InsertMenu((HMENU
)wParam
, 17, MF_BYPOSITION
| MF_STRING
, IDM_FILE1
, _T("1 ") + pathFile1
);
263 case 1: /* Edit menu */
264 EnableMenuItem(menu
, IDM_EDITUNDO
, ENABLED_IF(imageModel
.HasUndoSteps()));
265 EnableMenuItem(menu
, IDM_EDITREDO
, ENABLED_IF(imageModel
.HasRedoSteps()));
266 EnableMenuItem(menu
, IDM_EDITCUT
, ENABLED_IF(trueSelection
));
267 EnableMenuItem(menu
, IDM_EDITCOPY
, ENABLED_IF(trueSelection
));
268 EnableMenuItem(menu
, IDM_EDITDELETESELECTION
, ENABLED_IF(trueSelection
));
269 EnableMenuItem(menu
, IDM_EDITINVERTSELECTION
, ENABLED_IF(trueSelection
));
270 EnableMenuItem(menu
, IDM_EDITCOPYTO
, ENABLED_IF(trueSelection
));
272 EnableMenuItem(menu
, IDM_EDITPASTE
, ENABLED_IF(GetClipboardData(CF_BITMAP
) != NULL
));
275 case 2: /* View menu */
276 CheckMenuItem(menu
, IDM_VIEWTOOLBOX
, CHECKED_IF(toolBoxContainer
.IsWindowVisible()));
277 CheckMenuItem(menu
, IDM_VIEWCOLORPALETTE
, CHECKED_IF(paletteWindow
.IsWindowVisible()));
278 CheckMenuItem(menu
, IDM_VIEWSTATUSBAR
, CHECKED_IF(::IsWindowVisible(hStatusBar
)));
279 CheckMenuItem(menu
, IDM_FORMATICONBAR
, CHECKED_IF(textEditWindow
.IsWindowVisible()));
280 EnableMenuItem(menu
, IDM_FORMATICONBAR
, ENABLED_IF(toolsModel
.GetActiveTool() == TOOL_TEXT
));
282 CheckMenuItem(menu
, IDM_VIEWSHOWGRID
, CHECKED_IF(showGrid
));
283 CheckMenuItem(menu
, IDM_VIEWSHOWMINIATURE
, CHECKED_IF(showMiniature
));
285 case 3: /* Image menu */
286 EnableMenuItem(menu
, IDM_IMAGECROP
, ENABLED_IF(selectionWindow
.IsWindowVisible()));
287 CheckMenuItem(menu
, IDM_IMAGEDRAWOPAQUE
, CHECKED_IF(!toolsModel
.IsBackgroundTransparent()));
291 CheckMenuItem(menu
, IDM_VIEWZOOM125
, CHECKED_IF(toolsModel
.GetZoom() == 125));
292 CheckMenuItem(menu
, IDM_VIEWZOOM25
, CHECKED_IF(toolsModel
.GetZoom() == 250));
293 CheckMenuItem(menu
, IDM_VIEWZOOM50
, CHECKED_IF(toolsModel
.GetZoom() == 500));
294 CheckMenuItem(menu
, IDM_VIEWZOOM100
, CHECKED_IF(toolsModel
.GetZoom() == 1000));
295 CheckMenuItem(menu
, IDM_VIEWZOOM200
, CHECKED_IF(toolsModel
.GetZoom() == 2000));
296 CheckMenuItem(menu
, IDM_VIEWZOOM400
, CHECKED_IF(toolsModel
.GetZoom() == 4000));
297 CheckMenuItem(menu
, IDM_VIEWZOOM800
, CHECKED_IF(toolsModel
.GetZoom() == 8000));
299 CheckMenuItem(menu
, IDM_COLORSMODERNPALETTE
, CHECKED_IF(paletteModel
.SelectedPalette() == 1));
300 CheckMenuItem(menu
, IDM_COLORSOLDPALETTE
, CHECKED_IF(paletteModel
.SelectedPalette() == 2));
304 LRESULT
CMainWindow::OnSize(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
306 int test
[] = { LOWORD(lParam
) - 260, LOWORD(lParam
) - 140, LOWORD(lParam
) - 20 };
307 SendMessage(hStatusBar
, WM_SIZE
, wParam
, lParam
);
308 SendMessage(hStatusBar
, SB_SETPARTS
, 3, (LPARAM
)&test
);
309 alignChildrenToMainWindow();
314 LRESULT
CMainWindow::OnGetMinMaxInfo(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
316 MINMAXINFO
*mm
= (LPMINMAXINFO
) lParam
;
317 mm
->ptMinTrackSize
.x
= 330;
318 mm
->ptMinTrackSize
.y
= 430;
322 LRESULT
CMainWindow::OnSetCursor(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
324 SetCursor(LoadCursor(NULL
, IDC_ARROW
));
329 LRESULT
CMainWindow::OnKeyDown(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
331 if (wParam
== VK_ESCAPE
)
333 HWND hwndCapture
= GetCapture();
336 if (selectionWindow
.m_hWnd
== hwndCapture
||
337 imageArea
.m_hWnd
== hwndCapture
||
338 fullscreenWindow
.m_hWnd
== hwndCapture
||
339 sizeboxLeftTop
.m_hWnd
== hwndCapture
||
340 sizeboxCenterTop
.m_hWnd
== hwndCapture
||
341 sizeboxRightTop
.m_hWnd
== hwndCapture
||
342 sizeboxLeftCenter
.m_hWnd
== hwndCapture
||
343 sizeboxRightCenter
.m_hWnd
== hwndCapture
||
344 sizeboxLeftBottom
.m_hWnd
== hwndCapture
||
345 sizeboxCenterBottom
.m_hWnd
== hwndCapture
||
346 sizeboxRightBottom
.m_hWnd
== hwndCapture
)
348 SendMessage(hwndCapture
, nMsg
, wParam
, lParam
);
353 switch (toolsModel
.GetActiveTool())
355 case TOOL_SHAPE
: case TOOL_BEZIER
:
356 imageArea
.SendMessage(nMsg
, wParam
, lParam
);
364 LRESULT
CMainWindow::OnSysColorChange(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
366 /* Redirect message to common controls */
367 HWND hToolbar
= FindWindowEx(toolBoxContainer
.m_hWnd
, NULL
, TOOLBARCLASSNAME
, NULL
);
368 SendMessage(hToolbar
, WM_SYSCOLORCHANGE
, 0, 0);
372 LRESULT
CMainWindow::OnCommand(UINT nMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
)
374 switch (LOWORD(wParam
))
378 HICON paintIcon
= LoadIcon(hProgInstance
, MAKEINTRESOURCE(IDI_APPICON
));
379 TCHAR infotitle
[100];
381 LoadString(hProgInstance
, IDS_INFOTITLE
, infotitle
, SIZEOF(infotitle
));
382 LoadString(hProgInstance
, IDS_INFOTEXT
, infotext
, SIZEOF(infotext
));
383 ShellAbout(m_hWnd
, infotitle
, infotext
, paintIcon
);
384 DeleteObject(paintIcon
);
387 case IDM_HELPHELPTOPICS
:
388 HtmlHelp(m_hWnd
, _T("help\\Paint.chm"), 0, 0);
391 SendMessage(WM_CLOSE
, wParam
, lParam
);
396 SetBitmapAndInfo(NULL
, NULL
, 0, FALSE
);
400 if (ConfirmSave() && GetOpenFileName(&ofn
))
402 DoLoadImageFile(m_hWnd
, ofn
.lpstrFile
, TRUE
);
411 case IDM_FILEPAGESETUP
:
412 // DUMMY: Shows the dialog only, no functionality
414 ZeroMemory(&psd
, sizeof(psd
));
415 psd
.lStructSize
= sizeof(psd
);
416 psd
.hwndOwner
= m_hWnd
;
420 // TODO: Test whether it actually works
422 ZeroMemory(&pd
, sizeof(pd
));
423 pd
.lStructSize
= sizeof(pd
);
424 pd
.hwndOwner
= m_hWnd
;
425 pd
.hDevMode
= NULL
; // freed by user
426 pd
.hDevNames
= NULL
; // freed by user
427 pd
.Flags
= PD_USEDEVMODECOPIESANDCOLLATE
| PD_RETURNDC
;
429 pd
.nFromPage
= 0xffff;
432 pd
.nMaxPage
= 0xffff;
433 if (PrintDlg(&pd
) == TRUE
)
435 BitBlt(pd
.hDC
, 0, 0, imageModel
.GetWidth(), imageModel
.GetHeight(), imageModel
.GetDC(), 0, 0, SRCCOPY
);
439 GlobalFree(pd
.hDevMode
);
441 GlobalFree(pd
.hDevNames
);
443 case IDM_FILEASWALLPAPERPLANE
:
444 RegistrySettings::SetWallpaper(filepathname
, RegistrySettings::TILED
);
446 case IDM_FILEASWALLPAPERCENTERED
:
447 RegistrySettings::SetWallpaper(filepathname
, RegistrySettings::CENTERED
);
449 case IDM_FILEASWALLPAPERSTRETCHED
:
450 RegistrySettings::SetWallpaper(filepathname
, RegistrySettings::STRETCHED
);
454 ConfirmSave() && DoLoadImageFile(m_hWnd
, registrySettings
.strFile1
, TRUE
);
459 ConfirmSave() && DoLoadImageFile(m_hWnd
, registrySettings
.strFile2
, TRUE
);
464 ConfirmSave() && DoLoadImageFile(m_hWnd
, registrySettings
.strFile3
, TRUE
);
469 ConfirmSave() && DoLoadImageFile(m_hWnd
, registrySettings
.strFile4
, TRUE
);
474 imageArea
.Invalidate(FALSE
);
478 imageArea
.Invalidate(FALSE
);
483 SetClipboardData(CF_BITMAP
, CopyImage(selectionModel
.GetBitmap(), IMAGE_BITMAP
, 0, 0, LR_COPYRETURNORG
));
488 SendMessage(WM_COMMAND
, IDM_EDITCOPY
, 0);
489 /* Delete selection */
490 SendMessage(WM_COMMAND
, IDM_EDITDELETESELECTION
, 0);
494 if (GetClipboardData(CF_BITMAP
) != NULL
)
496 InsertSelectionFromHBITMAP((HBITMAP
) GetClipboardData(CF_BITMAP
), m_hWnd
);
500 case IDM_EDITDELETESELECTION
:
502 /* remove selection window and already painted content using undo */
506 case IDM_EDITSELECTALL
:
508 HWND hToolbar
= FindWindowEx(toolBoxContainer
.m_hWnd
, NULL
, TOOLBARCLASSNAME
, NULL
);
509 SendMessage(hToolbar
, TB_CHECKBUTTON
, ID_RECTSEL
, MAKELPARAM(TRUE
, 0));
510 toolBoxContainer
.SendMessage(WM_COMMAND
, ID_RECTSEL
);
511 //TODO: do this properly
512 startPaintingL(imageModel
.GetDC(), 0, 0, paletteModel
.GetFgColor(), paletteModel
.GetBgColor());
513 whilePaintingL(imageModel
.GetDC(), imageModel
.GetWidth(), imageModel
.GetHeight(), paletteModel
.GetFgColor(), paletteModel
.GetBgColor());
514 endPaintingL(imageModel
.GetDC(), imageModel
.GetWidth(), imageModel
.GetHeight(), paletteModel
.GetFgColor(), paletteModel
.GetBgColor());
518 if (GetSaveFileName(&ofn
))
519 SaveDIBToFile(selectionModel
.GetBitmap(), ofn
.lpstrFile
, imageModel
.GetDC());
521 case IDM_EDITPASTEFROM
:
522 if (GetOpenFileName(&ofn
))
524 HBITMAP hbmNew
= DoLoadImageFile(m_hWnd
, ofn
.lpstrFile
, FALSE
);
527 InsertSelectionFromHBITMAP(hbmNew
, m_hWnd
);
528 DeleteObject(hbmNew
);
532 case IDM_COLORSEDITPALETTE
:
533 if (ChooseColor(&choosecolor
))
534 paletteModel
.SetFgColor(choosecolor
.rgbResult
);
536 case IDM_COLORSMODERNPALETTE
:
537 paletteModel
.SelectPalette(1);
539 case IDM_COLORSOLDPALETTE
:
540 paletteModel
.SelectPalette(2);
542 case IDM_IMAGEINVERTCOLORS
:
544 imageModel
.InvertColors();
547 case IDM_IMAGEDELETEIMAGE
:
548 imageModel
.CopyPrevious();
549 Rect(imageModel
.GetDC(), 0, 0, imageModel
.GetWidth(), imageModel
.GetHeight(), paletteModel
.GetBgColor(), paletteModel
.GetBgColor(), 0, TRUE
);
550 imageArea
.Invalidate(FALSE
);
552 case IDM_IMAGEROTATEMIRROR
:
553 switch (mirrorRotateDialog
.DoModal(mainWindow
.m_hWnd
))
555 case 1: /* flip horizontally */
556 if (selectionWindow
.IsWindowVisible())
557 selectionModel
.FlipHorizontally();
559 imageModel
.FlipHorizontally();
561 case 2: /* flip vertically */
562 if (selectionWindow
.IsWindowVisible())
563 selectionModel
.FlipVertically();
565 imageModel
.FlipVertically();
567 case 3: /* rotate 90 degrees */
569 case 4: /* rotate 180 degrees */
570 if (selectionWindow
.IsWindowVisible())
571 selectionModel
.RotateNTimes90Degrees(2);
573 imageModel
.RotateNTimes90Degrees(2);
575 case 5: /* rotate 270 degrees */
579 case IDM_IMAGEATTRIBUTES
:
581 if (attributesDialog
.DoModal(mainWindow
.m_hWnd
))
583 imageModel
.Crop(attributesDialog
.newWidth
, attributesDialog
.newHeight
, 0, 0);
587 case IDM_IMAGESTRETCHSKEW
:
589 if (stretchSkewDialog
.DoModal(mainWindow
.m_hWnd
))
591 imageModel
.StretchSkew(stretchSkewDialog
.percentage
.x
, stretchSkewDialog
.percentage
.y
,
592 stretchSkewDialog
.angle
.x
, stretchSkewDialog
.angle
.y
);
596 case IDM_IMAGEDRAWOPAQUE
:
597 toolsModel
.SetBackgroundTransparent(!toolsModel
.IsBackgroundTransparent());
600 imageModel
.Insert((HBITMAP
) CopyImage(selectionModel
.GetBitmap(), IMAGE_BITMAP
, 0, 0, LR_COPYRETURNORG
));
603 case IDM_VIEWTOOLBOX
:
604 toolBoxContainer
.ShowWindow(toolBoxContainer
.IsWindowVisible() ? SW_HIDE
: SW_SHOW
);
605 alignChildrenToMainWindow();
607 case IDM_VIEWCOLORPALETTE
:
608 paletteWindow
.ShowWindow(paletteWindow
.IsWindowVisible() ? SW_HIDE
: SW_SHOW
);
609 alignChildrenToMainWindow();
611 case IDM_VIEWSTATUSBAR
:
612 ::ShowWindow(hStatusBar
, ::IsWindowVisible(hStatusBar
) ? SW_HIDE
: SW_SHOW
);
613 alignChildrenToMainWindow();
615 case IDM_FORMATICONBAR
:
616 textEditWindow
.ShowWindow(textEditWindow
.IsWindowVisible() ? SW_HIDE
: SW_SHOW
);
618 case IDM_VIEWSHOWGRID
:
619 showGrid
= !showGrid
;
620 imageArea
.Invalidate(FALSE
);
622 case IDM_VIEWSHOWMINIATURE
:
623 showMiniature
= !showMiniature
;
624 miniature
.ShowWindow(showMiniature
? SW_SHOW
: SW_HIDE
);
627 case IDM_VIEWZOOM125
:
636 case IDM_VIEWZOOM100
:
639 case IDM_VIEWZOOM200
:
642 case IDM_VIEWZOOM400
:
645 case IDM_VIEWZOOM800
:
649 case IDM_VIEWFULLSCREEN
:
650 fullscreenWindow
.ShowWindow(SW_SHOW
);