1 /*
2  * PROJECT:     PAINT for ReactOS
3  * LICENSE:     LGPL
4  * FILE:        base/applications/mspaint/miniature.cpp
5  * PURPOSE:     Window procedure of the main window and all children apart from
6  *              hPalWin, hToolSettings and hSelection
7  * PROGRAMMERS: Benedikt Freisen
8  */
9 
10 #include "precomp.h"
11 
12 CMiniatureWindow miniature;
13 
14 /* FUNCTIONS ********************************************************/
15 
16 HWND CMiniatureWindow::DoCreate(HWND hwndParent)
17 {
18     if (m_hWnd)
19         return m_hWnd;
20 
21     RECT rc =
22     {
23         (LONG)registrySettings.ThumbXPos, (LONG)registrySettings.ThumbYPos,
24         (LONG)(registrySettings.ThumbXPos + registrySettings.ThumbWidth),
25         (LONG)(registrySettings.ThumbYPos + registrySettings.ThumbHeight)
26     };
27 
28     TCHAR strTitle[100];
29     ::LoadString(hProgInstance, IDS_MINIATURETITLE, strTitle, _countof(strTitle));
30 
31     DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME;
32     return Create(hwndParent, rc, strTitle, style, WS_EX_PALETTEWINDOW);
33 }
34 
35 LRESULT CMiniatureWindow::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
36 {
37     ShowWindow(SW_HIDE);
38     registrySettings.ShowThumbnail = FALSE;
39     return 0;
40 }
41 
42 LRESULT CMiniatureWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
43 {
44     RECT rc;
45     GetClientRect(&rc);
46 
47     PAINTSTRUCT ps;
48     HDC hDC = BeginPaint(&ps);
49     StretchBlt(hDC, 0, 0, rc.right, rc.bottom,
50                imageModel.GetDC(), 0, 0, imageModel.GetWidth(), imageModel.GetHeight(),
51                SRCCOPY);
52     EndPaint(&ps);
53     return 0;
54 }
55