Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

541 lines
21 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998
  4. *
  5. * TITLE: PWFRAME.CPP
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 8/12/1999
  12. *
  13. * DESCRIPTION: Preview frame class definition
  14. *
  15. *******************************************************************************/
  16. #include "precomp.h"
  17. #pragma hdrstop
  18. #include "pwframe.h"
  19. #include "simrect.h"
  20. #include "miscutil.h"
  21. #include "pviewids.h"
  22. #include "prevwnd.h"
  23. #include "simcrack.h"
  24. void WINAPI RegisterWiaPreviewClasses( HINSTANCE hInstance )
  25. {
  26. CWiaPreviewWindowFrame::RegisterClass( hInstance );
  27. CWiaPreviewWindow::RegisterClass( hInstance );
  28. }
  29. CWiaPreviewWindowFrame::CWiaPreviewWindowFrame( HWND hWnd )
  30. : m_hWnd(hWnd),
  31. m_nSizeBorder(DEFAULT_BORDER_SIZE),
  32. m_hBackgroundBrush(CreateSolidBrush(GetSysColor(COLOR_WINDOW))),
  33. m_bEnableStretch(true),
  34. m_bHideEmptyPreview(false),
  35. m_nPreviewAlignment(MAKELPARAM(PREVIEW_WINDOW_CENTER,PREVIEW_WINDOW_CENTER))
  36. {
  37. ZeroMemory( &m_sizeAspectRatio, sizeof(m_sizeAspectRatio) );
  38. ZeroMemory( &m_sizeDefAspectRatio, sizeof(m_sizeDefAspectRatio) );
  39. }
  40. CWiaPreviewWindowFrame::~CWiaPreviewWindowFrame(void)
  41. {
  42. if (m_hBackgroundBrush)
  43. {
  44. DeleteObject(m_hBackgroundBrush);
  45. m_hBackgroundBrush = NULL;
  46. }
  47. }
  48. LRESULT CWiaPreviewWindowFrame::OnCreate( WPARAM, LPARAM lParam )
  49. {
  50. //
  51. // Turn off RTL for this window
  52. //
  53. SetWindowLong( m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd,GWL_EXSTYLE) & ~WS_EX_LAYOUTRTL );
  54. LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
  55. CWiaPreviewWindow::RegisterClass(lpcs->hInstance);
  56. HWND hWndPreview = CreateWindowEx( 0, PREVIEW_WINDOW_CLASS, TEXT(""), WS_CHILD|WS_VISIBLE|WS_BORDER|WS_CLIPCHILDREN, 0, 0, 0, 0, m_hWnd, (HMENU)IDC_INNER_PREVIEW_WINDOW, lpcs->hInstance, NULL );
  57. if (!hWndPreview)
  58. return(-1);
  59. return(0);
  60. }
  61. LRESULT CWiaPreviewWindowFrame::OnSize( WPARAM wParam, LPARAM )
  62. {
  63. if ((SIZE_MAXIMIZED==wParam || SIZE_RESTORED==wParam))
  64. AdjustWindowSize();
  65. return(0);
  66. }
  67. LRESULT CWiaPreviewWindowFrame::OnSetFocus( WPARAM, LPARAM )
  68. {
  69. SetFocus( GetDlgItem(m_hWnd,IDC_INNER_PREVIEW_WINDOW) );
  70. return(0);
  71. }
  72. LRESULT CWiaPreviewWindowFrame::OnEnable( WPARAM wParam, LPARAM )
  73. {
  74. EnableWindow( GetDlgItem(m_hWnd,IDC_INNER_PREVIEW_WINDOW), (BOOL)wParam );
  75. return(0);
  76. }
  77. int CWiaPreviewWindowFrame::FillRect( HDC hDC, HBRUSH hBrush, int x1, int y1, int x2, int y2 )
  78. {
  79. RECT rc;
  80. rc.left = x1;
  81. rc.top = y1;
  82. rc.right = x2;
  83. rc.bottom = y2;
  84. return(::FillRect( hDC, &rc, hBrush ));
  85. }
  86. LRESULT CWiaPreviewWindowFrame::OnEraseBkgnd( WPARAM wParam, LPARAM )
  87. {
  88. // Only paint the regions around the preview control
  89. RECT rcClient;
  90. GetClientRect(m_hWnd,&rcClient);
  91. HDC hDC = (HDC)wParam;
  92. if (hDC)
  93. {
  94. HWND hWndPreview = GetDlgItem(m_hWnd,IDC_INNER_PREVIEW_WINDOW);
  95. if (!hWndPreview || !IsWindowVisible(hWndPreview))
  96. {
  97. ::FillRect( hDC, &rcClient, m_hBackgroundBrush );
  98. }
  99. else
  100. {
  101. CSimpleRect rcPreviewWnd = CSimpleRect(hWndPreview,CSimpleRect::WindowRect).ScreenToClient(m_hWnd);
  102. FillRect( hDC, m_hBackgroundBrush, 0, 0, rcClient.right, rcPreviewWnd.top ); // top
  103. FillRect( hDC, m_hBackgroundBrush, 0, rcPreviewWnd.top, rcPreviewWnd.left, rcPreviewWnd.bottom ); // left
  104. FillRect( hDC, m_hBackgroundBrush, rcPreviewWnd.right, rcPreviewWnd.top, rcClient.right, rcPreviewWnd.bottom ); // right
  105. FillRect( hDC, m_hBackgroundBrush, 0, rcPreviewWnd.bottom, rcClient.right, rcClient.bottom ); // bottom
  106. }
  107. }
  108. return(1);
  109. }
  110. LRESULT CWiaPreviewWindowFrame::OnGetBorderSize( WPARAM wParam, LPARAM lParam )
  111. {
  112. if (!wParam)
  113. {
  114. return SendDlgItemMessage( m_hWnd, IDC_INNER_PREVIEW_WINDOW, PWM_GETBORDERSIZE, wParam, lParam );
  115. }
  116. else
  117. {
  118. return m_nSizeBorder;
  119. }
  120. }
  121. LRESULT CWiaPreviewWindowFrame::OnSetBorderSize( WPARAM wParam, LPARAM lParam )
  122. {
  123. if (!HIWORD(wParam))
  124. {
  125. return SendDlgItemMessage( m_hWnd, IDC_INNER_PREVIEW_WINDOW, PWM_SETBORDERSIZE, wParam, lParam );
  126. }
  127. else
  128. {
  129. m_nSizeBorder = static_cast<UINT>(lParam);
  130. if (LOWORD(wParam))
  131. {
  132. SendMessage( m_hWnd, WM_SETREDRAW, 0, 0 );
  133. ResizeClientIfNecessary();
  134. SendMessage( m_hWnd, WM_SETREDRAW, 1, 0 );
  135. // Make sure the border of the preview control is drawn correctly.
  136. // This is a workaround for a weird bug that causes the resized border to not be redrawn
  137. SetWindowPos( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_DRAWFRAME );
  138. InvalidateRect( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), NULL, FALSE );
  139. UpdateWindow( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  140. InvalidateRect( m_hWnd, NULL, TRUE );
  141. UpdateWindow( m_hWnd );
  142. }
  143. }
  144. return 0;
  145. }
  146. LRESULT CWiaPreviewWindowFrame::OnHideEmptyPreview( WPARAM, LPARAM lParam )
  147. {
  148. m_bHideEmptyPreview = (lParam != 0);
  149. AdjustWindowSize();
  150. return 0;
  151. }
  152. // This gets the exact maximum image size that could be displayed in the preview control
  153. LRESULT CWiaPreviewWindowFrame::OnGetClientSize( WPARAM, LPARAM lParam )
  154. {
  155. bool bSuccess = false;
  156. SIZE *pSize = reinterpret_cast<SIZE*>(lParam);
  157. if (pSize)
  158. {
  159. HWND hWndPreview = GetDlgItem(m_hWnd,IDC_INNER_PREVIEW_WINDOW);
  160. if (hWndPreview)
  161. {
  162. // This will be used to take into account the size of the internal border and frame, so we will
  163. // have *EXACT* aspect ratio calculations
  164. UINT nAdditionalBorder = WiaPreviewControl_GetBorderSize(hWndPreview,0) * 2;
  165. // Add in the size of the border, calculated by comparing the window rect with the client rect
  166. // I am assuming the border will be same size in pixels on all sides
  167. nAdditionalBorder += CSimpleRect( hWndPreview, CSimpleRect::WindowRect ).Width() - CSimpleRect( hWndPreview, CSimpleRect::ClientRect ).Width();
  168. // Get the client rect for our window
  169. CSimpleRect rcClient( m_hWnd, CSimpleRect::ClientRect );
  170. if (rcClient.Width() && rcClient.Height())
  171. {
  172. pSize->cx = rcClient.Width() - nAdditionalBorder - m_nSizeBorder * 2;
  173. pSize->cy = rcClient.Height() - nAdditionalBorder - m_nSizeBorder * 2;
  174. bSuccess = (pSize->cx > 0 && pSize->cy > 0);
  175. }
  176. }
  177. }
  178. return (bSuccess != false);
  179. }
  180. LRESULT CWiaPreviewWindowFrame::OnSetPreviewAlignment( WPARAM wParam, LPARAM lParam )
  181. {
  182. m_nPreviewAlignment = lParam;
  183. if (wParam)
  184. AdjustWindowSize();
  185. return 0;
  186. }
  187. void CWiaPreviewWindowFrame::AdjustWindowSize(void)
  188. {
  189. HWND hWndPreview = GetDlgItem(m_hWnd,IDC_INNER_PREVIEW_WINDOW);
  190. if (hWndPreview)
  191. {
  192. if (!m_bHideEmptyPreview || WiaPreviewControl_GetBitmap(hWndPreview))
  193. {
  194. // Make sure the window is visible
  195. if (!IsWindowVisible(hWndPreview))
  196. {
  197. ShowWindow(hWndPreview,SW_SHOW);
  198. }
  199. // Get the window's client size and shrink it by the border size
  200. CSimpleRect rcClient(m_hWnd);
  201. rcClient.Inflate(-(int)m_nSizeBorder,-(int)m_nSizeBorder);
  202. // This will be used to take into account the size of the internal border and frame, so we will
  203. // have *EXACT* aspect ratio calculations
  204. UINT nAdditionalBorder = WiaPreviewControl_GetBorderSize(hWndPreview,0) * 2;
  205. // I am assuming the border will be same size in pixels on all sides
  206. nAdditionalBorder += GetSystemMetrics( SM_CXBORDER ) * 2;
  207. // Normally, we will allow stretching.
  208. // Assume we won't be doing a proportional resize
  209. POINT ptPreviewWndOrigin = { rcClient.left, rcClient.top };
  210. SIZE sizePreviewWindowExtent = { rcClient.Width(), rcClient.Height() };
  211. // Don't want any divide by zero errors
  212. if (m_sizeAspectRatio.cx && m_sizeAspectRatio.cy)
  213. {
  214. SIZE sizePreview = m_sizeAspectRatio;
  215. if (m_bEnableStretch ||
  216. sizePreview.cx > (int)(rcClient.Width()-nAdditionalBorder) ||
  217. sizePreview.cy > (int)(rcClient.Height()-nAdditionalBorder))
  218. {
  219. sizePreview = WiaUiUtil::ScalePreserveAspectRatio( rcClient.Width()-nAdditionalBorder, rcClient.Height()-nAdditionalBorder, m_sizeAspectRatio.cx, m_sizeAspectRatio.cy );
  220. }
  221. // Make sure it won't be invisible
  222. if (sizePreview.cx && sizePreview.cy)
  223. {
  224. // Decide where to place it in the x direction
  225. if (LOWORD(m_nPreviewAlignment) & PREVIEW_WINDOW_RIGHT)
  226. ptPreviewWndOrigin.x = m_nSizeBorder + rcClient.Width() - sizePreview.cx - nAdditionalBorder;
  227. else if (LOWORD(m_nPreviewAlignment) & PREVIEW_WINDOW_LEFT)
  228. ptPreviewWndOrigin.x = m_nSizeBorder;
  229. else ptPreviewWndOrigin.x = ((rcClient.Width() + m_nSizeBorder*2) - sizePreview.cx - nAdditionalBorder) / 2;
  230. // Decide where to place it in the y direction
  231. if (HIWORD(m_nPreviewAlignment) & PREVIEW_WINDOW_BOTTOM)
  232. ptPreviewWndOrigin.y = m_nSizeBorder + rcClient.Height() - sizePreview.cy - nAdditionalBorder;
  233. else if (HIWORD(m_nPreviewAlignment) & PREVIEW_WINDOW_TOP)
  234. ptPreviewWndOrigin.y = m_nSizeBorder;
  235. else ptPreviewWndOrigin.y = ((rcClient.Height() + m_nSizeBorder*2) - sizePreview.cy - nAdditionalBorder) / 2;
  236. sizePreviewWindowExtent.cx = sizePreview.cx + nAdditionalBorder;
  237. sizePreviewWindowExtent.cy = sizePreview.cy + nAdditionalBorder;
  238. }
  239. }
  240. // Now get the current size to make sure we don't resize the window unnecessarily
  241. CSimpleRect rcPreview( hWndPreview, CSimpleRect::WindowRect );
  242. rcPreview.ScreenToClient( m_hWnd );
  243. if (rcPreview.left != ptPreviewWndOrigin.x ||
  244. rcPreview.top != ptPreviewWndOrigin.y ||
  245. rcPreview.Width() != sizePreviewWindowExtent.cx ||
  246. rcPreview.Height() != sizePreviewWindowExtent.cy)
  247. {
  248. SetWindowPos( hWndPreview, NULL, ptPreviewWndOrigin.x, ptPreviewWndOrigin.y, sizePreviewWindowExtent.cx, sizePreviewWindowExtent.cy, SWP_NOZORDER|SWP_NOACTIVATE );
  249. }
  250. }
  251. else
  252. {
  253. // Hide the preview window if we're supposed to
  254. ShowWindow(hWndPreview,SW_HIDE);
  255. }
  256. }
  257. }
  258. void CWiaPreviewWindowFrame::ResizeClientIfNecessary(void)
  259. {
  260. HWND hWndPreview = GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW );
  261. if (hWndPreview)
  262. {
  263. SIZE sizePreviousAspectRatio = m_sizeAspectRatio;
  264. m_sizeAspectRatio.cx = m_sizeAspectRatio.cy = 0;
  265. if (WiaPreviewControl_GetPreviewMode(hWndPreview))
  266. {
  267. SIZE sizeCurrResolution;
  268. if (WiaPreviewControl_GetResolution( hWndPreview, &sizeCurrResolution ))
  269. {
  270. SIZE sizePixelResolution;
  271. if (WiaPreviewControl_GetImageSize( hWndPreview, &sizePixelResolution ))
  272. {
  273. WiaPreviewControl_SetResolution( hWndPreview, &sizePixelResolution );
  274. SIZE sizeSelExtent;
  275. if (WiaPreviewControl_GetSelExtent( hWndPreview, 0, 0, &sizeSelExtent ))
  276. {
  277. m_sizeAspectRatio = sizeSelExtent;
  278. }
  279. WiaPreviewControl_SetResolution( hWndPreview, &sizeCurrResolution );
  280. }
  281. }
  282. }
  283. else
  284. {
  285. if (m_sizeDefAspectRatio.cx || m_sizeDefAspectRatio.cy)
  286. {
  287. m_sizeAspectRatio = m_sizeDefAspectRatio;
  288. }
  289. else
  290. {
  291. SIZE sizeImage;
  292. if (WiaPreviewControl_GetImageSize( hWndPreview, &sizeImage ))
  293. {
  294. m_sizeAspectRatio = sizeImage;
  295. }
  296. }
  297. }
  298. if (!m_sizeAspectRatio.cx || !m_sizeAspectRatio.cy)
  299. {
  300. m_sizeAspectRatio = m_sizeDefAspectRatio;
  301. }
  302. if (m_sizeAspectRatio.cx != sizePreviousAspectRatio.cx || m_sizeAspectRatio.cy != sizePreviousAspectRatio.cy)
  303. {
  304. AdjustWindowSize();
  305. }
  306. }
  307. }
  308. LRESULT CWiaPreviewWindowFrame::OnGetEnableStretch( WPARAM, LPARAM )
  309. {
  310. return (m_bEnableStretch != false);
  311. }
  312. LRESULT CWiaPreviewWindowFrame::OnSetEnableStretch( WPARAM, LPARAM lParam )
  313. {
  314. m_bEnableStretch = (lParam != FALSE);
  315. ResizeClientIfNecessary();
  316. return 0;
  317. }
  318. LRESULT CWiaPreviewWindowFrame::OnSetBitmap( WPARAM wParam, LPARAM lParam )
  319. {
  320. SendMessage( m_hWnd, WM_SETREDRAW, 0, 0 );
  321. SendDlgItemMessage( m_hWnd, IDC_INNER_PREVIEW_WINDOW, PWM_SETBITMAP, wParam, lParam );
  322. ResizeClientIfNecessary();
  323. SendMessage( m_hWnd, WM_SETREDRAW, 1, 0 );
  324. // Make sure the border of the preview control is drawn correctly.
  325. // This is a workaround for a weird bug that causes the resized border to not be redrawn
  326. SetWindowPos( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_DRAWFRAME );
  327. InvalidateRect( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), NULL, FALSE );
  328. UpdateWindow( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  329. InvalidateRect( m_hWnd, NULL, TRUE );
  330. UpdateWindow( m_hWnd );
  331. return 0;
  332. }
  333. // wParam = MAKEWPARAM((BOOL)bOuterBorder,0), lParam = 0
  334. LRESULT CWiaPreviewWindowFrame::OnGetBkColor( WPARAM wParam, LPARAM )
  335. {
  336. if (!LOWORD(wParam))
  337. {
  338. // Meant for the inner window
  339. return (SendMessage( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), PWM_GETBKCOLOR, 0, 0 ));
  340. }
  341. else
  342. {
  343. LOGBRUSH lb = {0};
  344. GetObject(m_hBackgroundBrush,sizeof(LOGBRUSH),&lb);
  345. return (lb.lbColor);
  346. }
  347. }
  348. // wParam = MAKEWPARAM((BOOL)bOuterBorder,(BOOL)bRepaint), lParam = (COLORREF)color
  349. LRESULT CWiaPreviewWindowFrame::OnSetBkColor( WPARAM wParam, LPARAM lParam )
  350. {
  351. if (!LOWORD(wParam))
  352. {
  353. // Meant for the inner window
  354. SendMessage( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), PWM_SETBKCOLOR, HIWORD(wParam), lParam );
  355. }
  356. else
  357. {
  358. HBRUSH hBrush = CreateSolidBrush( static_cast<COLORREF>(lParam) );
  359. if (hBrush)
  360. {
  361. if (m_hBackgroundBrush)
  362. {
  363. DeleteObject(m_hBackgroundBrush);
  364. m_hBackgroundBrush = NULL;
  365. }
  366. m_hBackgroundBrush = hBrush;
  367. if (HIWORD(wParam))
  368. {
  369. InvalidateRect( m_hWnd, NULL, TRUE );
  370. UpdateWindow( m_hWnd );
  371. }
  372. }
  373. }
  374. return (0);
  375. }
  376. LRESULT CWiaPreviewWindowFrame::OnCommand( WPARAM wParam, LPARAM lParam )
  377. {
  378. // Forward notifications to the parent
  379. return (SendNotifyMessage( GetParent(m_hWnd), WM_COMMAND, MAKEWPARAM(GetWindowLongPtr(m_hWnd,GWLP_ID),HIWORD(wParam)), reinterpret_cast<LPARAM>(m_hWnd) ));
  380. }
  381. LRESULT CWiaPreviewWindowFrame::OnSetDefAspectRatio( WPARAM wParam, LPARAM lParam )
  382. {
  383. SIZE *pNewDefAspectRatio = reinterpret_cast<SIZE*>(lParam);
  384. if (pNewDefAspectRatio)
  385. {
  386. m_sizeDefAspectRatio = *pNewDefAspectRatio;
  387. }
  388. else
  389. {
  390. m_sizeDefAspectRatio.cx = m_sizeDefAspectRatio.cy = 0;
  391. }
  392. ResizeClientIfNecessary();
  393. return (0);
  394. }
  395. BOOL CWiaPreviewWindowFrame::RegisterClass( HINSTANCE hInstance )
  396. {
  397. WNDCLASS wc;
  398. memset( &wc, 0, sizeof(wc) );
  399. wc.style = CS_DBLCLKS;
  400. wc.lpfnWndProc = WndProc;
  401. wc.hInstance = hInstance;
  402. wc.hbrBackground = NULL;
  403. wc.lpszClassName = PREVIEW_WINDOW_FRAME_CLASS;
  404. BOOL res = (::RegisterClass(&wc) != 0);
  405. return(res != 0);
  406. }
  407. LRESULT CWiaPreviewWindowFrame::OnSetPreviewMode( WPARAM wParam, LPARAM lParam )
  408. {
  409. SendMessage( m_hWnd, WM_SETREDRAW, 0, 0 );
  410. LRESULT lRes = SendDlgItemMessage( m_hWnd, IDC_INNER_PREVIEW_WINDOW, PWM_SETPREVIEWMODE, wParam, lParam );
  411. ResizeClientIfNecessary();
  412. SendMessage( m_hWnd, WM_SETREDRAW, 1, 0 );
  413. // Make sure the border of the preview control is drawn correctly.
  414. // This is a workaround for a weird bug that causes the resized border to not be redrawn
  415. SetWindowPos( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_DRAWFRAME );
  416. InvalidateRect( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ), NULL, FALSE );
  417. UpdateWindow( GetDlgItem( m_hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  418. InvalidateRect( m_hWnd, NULL, TRUE );
  419. UpdateWindow( m_hWnd );
  420. return lRes;
  421. }
  422. LRESULT CALLBACK CWiaPreviewWindowFrame::WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
  423. {
  424. SC_BEGIN_MESSAGE_HANDLERS(CWiaPreviewWindowFrame)
  425. {
  426. // Handle these messages
  427. SC_HANDLE_MESSAGE( WM_CREATE, OnCreate );
  428. SC_HANDLE_MESSAGE( WM_SIZE, OnSize );
  429. SC_HANDLE_MESSAGE( WM_SETFOCUS, OnSetFocus );
  430. SC_HANDLE_MESSAGE( WM_ENABLE, OnEnable );
  431. SC_HANDLE_MESSAGE( WM_ERASEBKGND, OnEraseBkgnd );
  432. SC_HANDLE_MESSAGE( PWM_SETBITMAP, OnSetBitmap );
  433. SC_HANDLE_MESSAGE( WM_COMMAND, OnCommand );
  434. SC_HANDLE_MESSAGE( PWM_GETBKCOLOR, OnGetBkColor );
  435. SC_HANDLE_MESSAGE( PWM_SETBKCOLOR, OnSetBkColor );
  436. SC_HANDLE_MESSAGE( PWM_SETDEFASPECTRATIO, OnSetDefAspectRatio );
  437. SC_HANDLE_MESSAGE( PWM_SETPREVIEWMODE, OnSetPreviewMode );
  438. SC_HANDLE_MESSAGE( PWM_GETCLIENTSIZE, OnGetClientSize );
  439. SC_HANDLE_MESSAGE( PWM_GETENABLESTRETCH, OnGetEnableStretch );
  440. SC_HANDLE_MESSAGE( PWM_SETENABLESTRETCH, OnSetEnableStretch );
  441. SC_HANDLE_MESSAGE( PWM_SETBORDERSIZE, OnSetBorderSize );
  442. SC_HANDLE_MESSAGE( PWM_GETBORDERSIZE, OnGetBorderSize );
  443. SC_HANDLE_MESSAGE( PWM_HIDEEMPTYPREVIEW, OnHideEmptyPreview );
  444. SC_HANDLE_MESSAGE( PWM_SETPREVIEWALIGNMENT, OnSetPreviewAlignment );
  445. // Forward all of these standard messages to the control
  446. SC_FORWARD_MESSAGE( WM_ENTERSIZEMOVE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  447. SC_FORWARD_MESSAGE( WM_EXITSIZEMOVE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  448. SC_FORWARD_MESSAGE( WM_SETTEXT, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  449. // Forward all of these private messages to the control
  450. SC_FORWARD_MESSAGE( PWM_SETRESOLUTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  451. SC_FORWARD_MESSAGE( PWM_GETRESOLUTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  452. SC_FORWARD_MESSAGE( PWM_CLEARSELECTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  453. SC_FORWARD_MESSAGE( PWM_GETIMAGESIZE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  454. SC_FORWARD_MESSAGE( PWM_GETBITMAP, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  455. SC_FORWARD_MESSAGE( PWM_GETHANDLESIZE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  456. SC_FORWARD_MESSAGE( PWM_GETBGALPHA, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  457. SC_FORWARD_MESSAGE( PWM_GETHANDLETYPE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  458. SC_FORWARD_MESSAGE( PWM_SETBGALPHA, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  459. SC_FORWARD_MESSAGE( PWM_SETHANDLETYPE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  460. SC_FORWARD_MESSAGE( PWM_GETSELCOUNT, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  461. SC_FORWARD_MESSAGE( PWM_GETSELORIGIN, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  462. SC_FORWARD_MESSAGE( PWM_GETSELEXTENT, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  463. SC_FORWARD_MESSAGE( PWM_SETSELORIGIN, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  464. SC_FORWARD_MESSAGE( PWM_SETSELEXTENT, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  465. SC_FORWARD_MESSAGE( PWM_GETALLOWNULLSELECTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  466. SC_FORWARD_MESSAGE( PWM_SETALLOWNULLSELECTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  467. SC_FORWARD_MESSAGE( PWM_SELECTIONDISABLED, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  468. SC_FORWARD_MESSAGE( PWM_SETHANDLESIZE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  469. SC_FORWARD_MESSAGE( PWM_DISABLESELECTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  470. SC_FORWARD_MESSAGE( PWM_DETECTREGIONS, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  471. SC_FORWARD_MESSAGE( PWM_GETPREVIEWMODE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  472. SC_FORWARD_MESSAGE( PWM_SETBORDERSTYLE, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  473. SC_FORWARD_MESSAGE( PWM_SETBORDERCOLOR, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  474. SC_FORWARD_MESSAGE( PWM_SETHANDLECOLOR, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  475. SC_FORWARD_MESSAGE( PWM_REFRESHBITMAP, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  476. SC_FORWARD_MESSAGE( PWM_SETPROGRESS, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  477. SC_FORWARD_MESSAGE( PWM_GETPROGRESS, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  478. SC_FORWARD_MESSAGE( PWM_GETUSERCHANGEDSELECTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  479. SC_FORWARD_MESSAGE( PWM_SETUSERCHANGEDSELECTION, GetDlgItem( hWnd, IDC_INNER_PREVIEW_WINDOW ) );
  480. }
  481. SC_END_MESSAGE_HANDLERS();
  482. }