PageToolbars.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:31k
源码类别:

界面编程

开发平台:

Visual C++

  1. // PageToolbars.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "profuis_controls.h"
  5. #include "PageToolbars.h"
  6. #include "MainDlg.h"
  7. #include <Resources/Resource.h>
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CPageToolbars dialog
  15. CPageToolbars::CPageToolbars(CWnd* pParent /*=NULL*/)
  16. : CPageBase(CPageToolbars::IDD, pParent)
  17. , m_bInitComplete( false )
  18. , m_clrColorCtrl( RGB(255,0,0) )
  19. {
  20. //{{AFX_DATA_INIT(CPageToolbars)
  21. // NOTE: the ClassWizard will add member initialization here
  22. //}}AFX_DATA_INIT
  23. m_nThinColorBtnHeight = 8;
  24. }
  25. void CPageToolbars::DoDataExchange(CDataExchange* pDX)
  26. {
  27. CPageBase::DoDataExchange(pDX);
  28. //{{AFX_DATA_MAP(CPageToolbars)
  29. DDX_Control(pDX, IDC_CHECK_FORCE_BALOON_STYLE, m_chkForceBalloonStyle);
  30. DDX_Control(pDX, IDC_CHECK_SHOW_GRIPPER, m_chkShowGripper);
  31. //}}AFX_DATA_MAP
  32. DDX_Control(pDX, IDC_MAIN_MENUBAR, m_wndMenuBar);
  33. DDX_Control(pDX, IDC_MAIN_TOOLBAR, m_wndToolBarUiLook);
  34. DDX_Control(pDX, IDC_COLOR_TOOLBAR, m_wndToolBarColor);
  35. DDX_Control(pDX, IDC_CONTROLS_TOOLBAR1, m_wndToolBarControls1);
  36. DDX_Control(pDX, IDC_CONTROLS_TOOLBAR2, m_wndToolBarControls2);
  37. DDX_Control(pDX, IDC_PALETTE_TOOLBAR, m_wndToolBarPalette);
  38. }
  39. BEGIN_MESSAGE_MAP(CPageToolbars, CPageBase)
  40. //{{AFX_MSG_MAP(CPageToolbars)
  41. ON_WM_SIZE()
  42. //}}AFX_MSG_MAP
  43. ON_REGISTERED_MESSAGE(
  44. CExtPopupMenuWnd::g_nMsgPrepareMenu,
  45. OnExtMenuPrepare
  46. )
  47. // color popup menu
  48. ON_REGISTERED_MESSAGE(
  49. CExtPopupColorMenuWnd::g_nMsgNotifyColorChangedFinally,
  50. OnColorChangedFinally
  51. )
  52. ON_REGISTERED_MESSAGE(
  53. CExtPopupColorMenuWnd::g_nMsgNotifyCustColor,
  54. OnColorSelectCustom
  55. )
  56. END_MESSAGE_MAP()
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CPageToolbars message handlers
  59. BOOL CPageToolbars::OnInitDialog() 
  60. {
  61. CPageBase::OnInitDialog();
  62. CWinApp * pApp = ::AfxGetApp();
  63. ASSERT( pApp != NULL );
  64. VERIFY( g_CmdManager->ProfileSetup( _T("PageToolbars"), GetSafeHwnd() ) );
  65. VERIFY( g_CmdManager->UpdateFromMenu( _T("PageToolbars"), IDR_MENU_PAGE_TOOLBARS ) );
  66. VERIFY( g_CmdManager->UpdateFromMenu( _T("PageToolbars"), IDR_COLOR_MENU ) );
  67. VERIFY( g_CmdManager->UpdateFromToolBar( _T("PageToolbars"), IDR_PALETTE_TOOLBAR ) );
  68. VERIFY( g_CmdManager->UpdateFromToolBar( _T("PageToolbars"), IDR_EDIT ) );
  69. CExtCmdItem * pCmdItem;
  70. pCmdItem = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_COMBOBOX_IN_MENUBAR );
  71. ASSERT( pCmdItem != NULL );
  72. pCmdItem->m_sTipTool = pCmdItem->m_sTipStatus = _T("Combobox in menubar");
  73. pCmdItem = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_COMBOBOX_IN_TOOLBAR );
  74. ASSERT( pCmdItem != NULL );
  75. pCmdItem->m_sTipTool = pCmdItem->m_sTipStatus = _T("Combobox in toolbar");
  76. pCmdItem = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_EDIT_IN_MENUBAR );
  77. ASSERT( pCmdItem != NULL );
  78. pCmdItem->m_sTipTool = pCmdItem->m_sTipStatus = _T("Edit in menubar");
  79. pCmdItem = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_EDIT_IN_TOOLBAR );
  80. ASSERT( pCmdItem != NULL );
  81. pCmdItem->m_sTipTool = pCmdItem->m_sTipStatus = _T("Edit in toolbar");
  82. pCmdItem = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_LABEL_IN_MENUBAR );
  83. ASSERT( pCmdItem != NULL );
  84. pCmdItem->m_sTipTool = pCmdItem->m_sTipStatus = _T(" Label in menubar ");
  85. pCmdItem = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_LABEL_IN_TOOLBAR );
  86. ASSERT( pCmdItem != NULL );
  87. pCmdItem->m_sTipTool = pCmdItem->m_sTipStatus = _T(" Label in toolbar ");
  88. //////////////////////////////////////////////////////////////////////////
  89. ASSERT( m_wndMenuBar.GetSafeHwnd() != NULL );
  90. if( !m_wndMenuBar.LoadMenuBar( IDR_MENU_PAGE_TOOLBARS ) ){
  91. ASSERT( FALSE );
  92. return FALSE;
  93. }
  94. // init combobox in the menubar
  95. if( !m_wndComboBoxInMenubar.Create(
  96. WS_CHILD|WS_VISIBLE|WS_TABSTOP
  97. |CBS_DROPDOWNLIST|CBS_HASSTRINGS,
  98. CRect( 0, 0, 150, 100 ),
  99. &m_wndMenuBar,
  100. ID_COMBOBOX_IN_MENUBAR
  101. )
  102. )
  103. {
  104. ASSERT( FALSE );
  105. return FALSE;
  106. }
  107. m_wndMenuBar.InsertButton(
  108. -1,
  109. ID_COMBOBOX_IN_MENUBAR
  110. );
  111. VERIFY(
  112. m_wndMenuBar.SetButtonCtrl( 
  113. m_wndMenuBar.CommandToIndex(ID_COMBOBOX_IN_MENUBAR), 
  114. &m_wndComboBoxInMenubar )
  115. );
  116. m_wndComboBoxInMenubar.SetFont(
  117. CFont::FromHandle(
  118. (HFONT)::GetStockObject(DEFAULT_GUI_FONT)
  119. )
  120. );
  121. m_wndComboBoxInMenubar.AddString( _T("ComboBox in menubar") );
  122. m_wndComboBoxInMenubar.SetCurSel( 0 );
  123. m_wndMenuBar.InsertButton(
  124. -1,
  125. ID_SEPARATOR
  126. );
  127. // init edit box in the menu bar
  128. if( ! m_wndEditInMenubar.CreateEx(
  129. WS_EX_CLIENTEDGE, 
  130. _T("EDIT"), 
  131. NULL,
  132. WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_LEFT,
  133. CRect( 0, 0, 100, 21 ),
  134. &m_wndMenuBar,
  135. ID_EDIT_IN_MENUBAR
  136. )
  137. )
  138. {
  139. ASSERT( FALSE );
  140. return FALSE;
  141. }
  142. m_wndMenuBar.InsertButton(
  143. -1,
  144. ID_EDIT_IN_MENUBAR
  145. );
  146. VERIFY(
  147. m_wndMenuBar.SetButtonCtrl( 
  148. m_wndMenuBar.CommandToIndex(ID_EDIT_IN_MENUBAR), 
  149. &m_wndEditInMenubar )
  150. );
  151. m_wndEditInMenubar.SetFont(
  152. CFont::FromHandle(
  153. (HFONT)::GetStockObject(DEFAULT_GUI_FONT)
  154. )
  155. );
  156. m_wndEditInMenubar.SetWindowText( _T("Edit in menubar") );
  157. // init box in the menu bar
  158. if( ! m_wndLabelInMenubar.CreateEx(
  159. 0, 
  160. _T("STATIC"), 
  161. NULL,
  162. WS_CHILD|WS_VISIBLE|SS_SIMPLE,
  163. CRect( 0, 0, 100, 21 ),
  164. &m_wndMenuBar,
  165. ID_LABEL_IN_MENUBAR
  166. )
  167. )
  168. {
  169. ASSERT( FALSE );
  170. return FALSE;
  171. }
  172. m_wndMenuBar.InsertButton(
  173. -1,
  174. ID_LABEL_IN_MENUBAR
  175. );
  176. VERIFY(
  177. m_wndMenuBar.SetButtonCtrl( 
  178. m_wndMenuBar.CommandToIndex(ID_LABEL_IN_MENUBAR), 
  179. &m_wndLabelInMenubar )
  180. );
  181. m_wndLabelInMenubar.SetFont(
  182. CFont::FromHandle(
  183. (HFONT)::GetStockObject(DEFAULT_GUI_FONT)
  184. )
  185. );
  186. m_wndLabelInMenubar.SetWindowText( _T("Label in menubar") );
  187. //////////////////////////////////////////////////////////////////////////
  188. ASSERT( m_wndToolBarUiLook.GetSafeHwnd() != NULL );
  189. if( ! m_wndToolBarUiLook.ThemeSwitcherInit() )
  190. {
  191. ASSERT( FALSE );
  192. return FALSE;
  193. }
  194. //////////////////////////////////////////////////////////////////////////
  195. ASSERT( m_wndToolBarControls1.GetSafeHwnd() != NULL );
  196. CExtCmdItem * pCmdItemSlider = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_MYEXTBTN_SLIDER );
  197.   ASSERT( pCmdItemSlider != NULL );
  198. pCmdItemSlider->m_sToolbarText = _T("Zoom:");
  199. pCmdItemSlider->m_sMenuText = _T("Zoom slider");
  200. pCmdItemSlider->m_sTipTool = pCmdItemSlider->m_sTipStatus = _T("Zoom slider");
  201. CExtCmdItem * pCmdItemScroller = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_MYEXTBTN_SCROLLER );
  202. ASSERT( pCmdItemScroller != NULL );
  203. pCmdItemScroller->m_sToolbarText = _T("Seek:");
  204. pCmdItemScroller->m_sMenuText = _T("Seek slider");
  205. pCmdItemScroller->m_sTipTool = pCmdItemScroller->m_sTipStatus = _T("Seek slider");
  206. CZoomBarSliderButton *pZoomSliderTBB =
  207. new CZoomBarSliderButton(
  208. /////////////////
  209. // standard CExtBarButton parms
  210. /////////////////
  211. &m_wndToolBarControls1,
  212. ID_MYEXTBTN_SLIDER,
  213. 0,
  214. /////////////////
  215. // CExtBarSliderButton specific parms
  216. /////////////////
  217. //
  218. // scroll total/pos/page
  219. 50, 25, 0,
  220. // button extent horz(left/right)/vert(up/down) in pixels
  221. // (if zeros - use slider-like layout instead of scrollbar-like)
  222. 0, 0,
  223. // total slider control extent horz/vert in pixels
  224. 100, 100
  225. );
  226. VERIFY(
  227. m_wndToolBarControls1.InsertSpecButton(
  228. -1,
  229. pZoomSliderTBB,
  230. FALSE
  231. )
  232. );
  233. CSeekBarSliderButton *pSeekScrollerTBB = new CSeekBarSliderButton(
  234. /////////////////
  235. // standard CExtBarButton parms
  236. /////////////////
  237. &m_wndToolBarControls1,
  238. ID_MYEXTBTN_SCROLLER,
  239. 0,
  240. /////////////////
  241. // CExtBarScrollerButton specific parms
  242. /////////////////
  243. //
  244. // scroll total/pos/page
  245. 100, 50, 0,
  246. // button extent horz(left/right)/vert(up/down) in pixels
  247. // (if zeros - use slider-like layout instead of scrollbar-like)
  248. 10, 10,
  249. // total slider control extent horz/vert in pixels
  250. 210, 210
  251. );
  252. VERIFY(
  253. m_wndToolBarControls1.InsertSpecButton(
  254. -1,
  255. pSeekScrollerTBB,
  256. FALSE
  257. )
  258. );
  259. VERIFY(
  260. m_wndToolBarControls1.InitContentExpandButton()
  261. );
  262. //////////////////////////////////////////////////////////////////////////
  263. ASSERT( m_wndToolBarControls2.GetSafeHwnd() != NULL );
  264. // init combobox in the toolbar
  265. if( !m_wndComboBoxInToolbar.Create(
  266. WS_CHILD|WS_VISIBLE|WS_TABSTOP
  267. |CBS_DROPDOWNLIST|CBS_HASSTRINGS,
  268. CRect( 0, 0, 150, 100 ),
  269. &m_wndToolBarControls2,
  270. ID_COMBOBOX_IN_TOOLBAR
  271. )
  272. )
  273. {
  274. ASSERT( FALSE );
  275. return FALSE;
  276. }
  277. m_wndToolBarControls2.InsertButton(
  278. -1,
  279. ID_COMBOBOX_IN_TOOLBAR
  280. );
  281. VERIFY(
  282. m_wndToolBarControls2.SetButtonCtrl( 
  283. m_wndToolBarControls2.CommandToIndex(ID_COMBOBOX_IN_TOOLBAR), 
  284. &m_wndComboBoxInToolbar )
  285. );
  286. m_wndComboBoxInToolbar.SetFont(
  287. CFont::FromHandle(
  288. (HFONT)::GetStockObject(DEFAULT_GUI_FONT)
  289. )
  290. );
  291. m_wndComboBoxInToolbar.AddString( _T("ComboBox in toolbar") );
  292. m_wndComboBoxInToolbar.SetCurSel( 0 );
  293. m_wndToolBarControls2.InsertButton(
  294. -1,
  295. ID_SEPARATOR
  296. );
  297. // init edit box in the toolbar
  298. if( !m_wndEditInToolbar.CreateEx(
  299. WS_EX_CLIENTEDGE, 
  300. _T("EDIT"), 
  301. NULL,
  302. WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_LEFT,
  303. CRect( 0, 0, 100, 21 ),
  304. &m_wndToolBarControls2,
  305. ID_EDIT_IN_TOOLBAR
  306. )
  307. )
  308. {
  309. ASSERT( FALSE );
  310. return FALSE;
  311. }
  312. m_wndToolBarControls2.InsertButton(
  313. -1,
  314. ID_EDIT_IN_TOOLBAR
  315. );
  316. VERIFY(
  317. m_wndToolBarControls2.SetButtonCtrl( 
  318. m_wndToolBarControls2.CommandToIndex(ID_EDIT_IN_TOOLBAR), 
  319. &m_wndEditInToolbar )
  320. );
  321. m_wndEditInToolbar.SetFont(
  322. CFont::FromHandle(
  323. (HFONT)::GetStockObject(DEFAULT_GUI_FONT)
  324. )
  325. );
  326. m_wndEditInToolbar.SetWindowText( _T("Edit in toolbar") );
  327. VERIFY(
  328. m_wndToolBarControls2.InitContentExpandButton()
  329. );
  330. // init label in the toolbar
  331. if( !m_wndLabelInToolbar.CreateEx(
  332. 0, 
  333. _T("STATIC"), 
  334. NULL,
  335. WS_CHILD|WS_VISIBLE|SS_SIMPLE,
  336. CRect( 0, 0, 100, 21 ),
  337. &m_wndToolBarControls2,
  338. ID_LABEL_IN_TOOLBAR
  339. )
  340. )
  341. {
  342. ASSERT( FALSE );
  343. return FALSE;
  344. }
  345. m_wndToolBarControls2.InsertButton(
  346. -1,
  347. ID_LABEL_IN_TOOLBAR
  348. );
  349. VERIFY(
  350. m_wndToolBarControls2.SetButtonCtrl( 
  351. m_wndToolBarControls2.CommandToIndex(ID_LABEL_IN_TOOLBAR), 
  352. &m_wndLabelInToolbar )
  353. );
  354. m_wndLabelInToolbar.SetFont(
  355. CFont::FromHandle(
  356. (HFONT)::GetStockObject(DEFAULT_GUI_FONT)
  357. )
  358. );
  359. m_wndLabelInToolbar.SetWindowText( _T("Label in toolbar") );
  360. VERIFY(
  361. m_wndToolBarControls2.InitContentExpandButton()
  362. );
  363. //////////////////////////////////////////////////////////////////////////
  364. ASSERT( m_wndToolBarColor.GetSafeHwnd() != NULL );
  365. VERIFY(
  366. m_wndToolBarColor.InsertButton(
  367. -1,
  368. ID_COLOR_BTN_HEIGHT,
  369. FALSE
  370. )
  371. );
  372. CMenu menuWidthCommands;
  373. VERIFY( menuWidthCommands.LoadMenu(IDR_COLOR_MENU) );
  374. VERIFY(
  375. m_wndToolBarColor.SetButtonMenu(
  376. m_wndToolBarColor.CommandToIndex(ID_COLOR_BTN_HEIGHT),
  377. menuWidthCommands.Detach(),
  378. TRUE,
  379. TRUE,
  380. FALSE
  381. )
  382. );
  383. VERIFY(
  384. m_wndToolBarColor.InsertButton( -1, ID_SEPARATOR, FALSE )
  385. );
  386. const int nLeftToolbarGrayscaleButtonsCount = 8;
  387. const int nLeftToolbarColorButtonsCount = 18;
  388. for( int nGrayscaleBtn = 0; nGrayscaleBtn < nLeftToolbarGrayscaleButtonsCount; nGrayscaleBtn++ )
  389. {
  390. VERIFY(
  391. m_wndToolBarColor.InsertSpecButton(
  392. -1,
  393. new CThinColorButtonInToolBar(
  394. CExtBitmap::stat_HLStoRGB(
  395. 0.0,
  396. double(nLeftToolbarGrayscaleButtonsCount - nGrayscaleBtn - 1)
  397. / double(nLeftToolbarGrayscaleButtonsCount-1),
  398. 0.0
  399. ),
  400. &m_wndToolBarColor
  401. ),
  402. FALSE
  403. )
  404. );
  405. }
  406. VERIFY(
  407. m_wndToolBarColor.InsertButton( -1, ID_SEPARATOR, FALSE )
  408. );
  409. for( int nColorBtn = 0; nColorBtn < nLeftToolbarColorButtonsCount; nColorBtn++ )
  410. {
  411. VERIFY(
  412. m_wndToolBarColor.InsertSpecButton(
  413. -1,
  414. new CThinColorButtonInToolBar(
  415. CExtBitmap::stat_HLStoRGB(
  416. double(nColorBtn) / double(nLeftToolbarColorButtonsCount),
  417. 0.5,
  418. 1.0
  419. ),
  420. &m_wndToolBarColor
  421. ),
  422. FALSE
  423. )
  424. );
  425. }
  426. VERIFY(
  427. m_wndToolBarColor.InitContentExpandButton()
  428. );
  429. //////////////////////////////////////////////////////////////////////////
  430. ASSERT( m_wndToolBarPalette.GetSafeHwnd() != NULL );
  431. if( !m_wndToolBarPalette.LoadToolBar( IDR_PALETTE_TOOLBAR ) ){
  432. ASSERT( FALSE );
  433. return FALSE;
  434. }
  435. m_wndToolBarPalette.m_bPaletteMode = true;
  436. m_wndToolBarPalette.GetButton(3)->SetWrap( CExtBarButton::__EVT_FLOAT );
  437. m_wndToolBarPalette.GetButton(6)->SetWrap( CExtBarButton::__EVT_FLOAT );
  438. m_wndToolBarPalette.GetButton(9)->SetWrap( CExtBarButton::__EVT_FLOAT );
  439. m_wndToolBarPalette.GetButton(12)->SetWrap( CExtBarButton::__EVT_FLOAT );
  440. //////////////////////////////////////////////////////////////////////////
  441. static UINT g_statBasicCommands[] =
  442. {
  443. ID_HEIGHT_8PX,
  444. ID_HEIGHT_10PX,
  445. ID_HEIGHT_12PX,
  446. ID_HEIGHT_14PX,
  447. ID_HEIGHT_16PX,
  448. ID_HEIGHT_18PX,
  449. ID_HEIGHT_20PX,
  450. ID_HEIGHT_22PX,
  451. ID_HEIGHT_24PX,
  452. ID_HEIGHT_26PX,
  453. ID_HEIGHT_28PX,
  454. ID_HEIGHT_30PX,
  455. ID_COLOR_BTN_HEIGHT,
  456. 0, // end of list
  457. };
  458. pCmdItem = g_CmdManager->CmdAllocPtr( _T("PageToolbars"), ID_COLOR_BTN_HEIGHT );
  459. ASSERT( pCmdItem != NULL );
  460. pCmdItem->m_sToolbarText = pCmdItem->m_sMenuText = pCmdItem->m_sTipStatus = pCmdItem->m_sTipTool = _T( "Color cell height" );
  461. VERIFY( g_CmdManager->SetBasicCommands( _T("PageToolbars"), g_statBasicCommands ) );
  462. //////////////////////////////////////////////////////////////////////////
  463. ::CheckDlgButton( GetSafeHwnd(), IDC_CHECK_SHOW_GRIPPER, BST_CHECKED );
  464. ::CheckDlgButton( GetSafeHwnd(), IDC_CHECK_FORCE_BALOON_STYLE, BST_UNCHECKED );
  465. CWnd::RepositionBars(0,0xFFFF,0);
  466. m_bInitComplete = true;
  467. return TRUE;  // return TRUE unless you set the focus to a control
  468.               // EXCEPTION: OCX Property Pages should return FALSE
  469. }
  470. //////////////////////////////////////////////////////////////////////////
  471. void CPageToolbars::OnSize(UINT nType, int cx, int cy) 
  472. {
  473. CPageBase::OnSize(nType, cx, cy);
  474. if( nType != SIZE_MINIMIZED )
  475. CWnd::RepositionBars(0,0xFFFF,0);
  476. }
  477. //////////////////////////////////////////////////////////////////////////
  478. BOOL CPageToolbars::OnCmdMsg(UINT nID, INT nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
  479. {
  480. if( !m_bInitComplete ){
  481. return CPageBase::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
  482. }
  483. if( nCode == CN_UPDATE_COMMAND_UI
  484. || nCode == CN_COMMAND
  485. )
  486. {
  487. if( nID == ID_MYEXTBTN_SLIDER || nID == ID_MYEXTBTN_SCROLLER ) {
  488. if( nCode == CN_UPDATE_COMMAND_UI ){
  489. CCmdUI * pCmdUI = (CCmdUI *)pExtra;
  490. ASSERT( pCmdUI != NULL );
  491. pCmdUI->Enable();
  492. }
  493. return TRUE;
  494. }
  495. if( nID == ID_COMBOBOX_IN_TOOLBAR 
  496. || nID == ID_COMBOBOX_IN_MENUBAR 
  497. || nID == ID_EDIT_IN_TOOLBAR 
  498. || nID == ID_EDIT_IN_MENUBAR 
  499. || nID == ID_CHECKBOX_IN_TOOLBAR 
  500. || nID == ID_CHECKBOX_IN_MENUBAR 
  501. || nID == ID_LINE_WIDTH_0
  502. || nID == ID_LINE_WIDTH_1
  503. || nID == ID_LINE_WIDTH_2
  504. || nID == ID_LINE_WIDTH_3
  505. || nID == ID_LINE_WIDTH_4
  506. || nID == ID_LINE_WIDTH_5
  507. || nID == ID_LINE_WIDTH_6
  508. || nID == ID_LINE_WIDTH_7
  509. || nID == ID_LINE_WIDTH_8
  510. || nID == ID_LINE_WIDTH_9
  511. || nID == ID_LINE_WIDTH_10
  512. || nID == ID_LINE_WIDTH_OTHER
  513. )
  514. {
  515. if( nCode == CN_UPDATE_COMMAND_UI ){
  516. CCmdUI * pCmdUI = (CCmdUI *)pExtra;
  517. ASSERT( pCmdUI != NULL );
  518. pCmdUI->Enable();
  519. }
  520. return TRUE;
  521. }
  522. if( nCode == CN_COMMAND )
  523. {
  524. if( nID == IDC_CHECK_SHOW_GRIPPER ) 
  525. {
  526. bool bDlgButtonChecked = ( IsDlgButtonChecked( nID ) == BST_CHECKED );
  527. m_wndToolBarColor.SetBarStyle( 
  528. bDlgButtonChecked
  529. ? m_wndToolBarColor.GetBarStyle() |  CBRS_GRIPPER 
  530. : m_wndToolBarColor.GetBarStyle() & ~CBRS_GRIPPER 
  531. );
  532. m_wndToolBarPalette.SetBarStyle( 
  533. bDlgButtonChecked
  534. ? m_wndToolBarPalette.GetBarStyle() |  CBRS_GRIPPER 
  535. : m_wndToolBarPalette.GetBarStyle() & ~CBRS_GRIPPER 
  536. );
  537. m_wndToolBarUiLook.SetBarStyle( 
  538. bDlgButtonChecked
  539. ? m_wndToolBarUiLook.GetBarStyle() |  CBRS_GRIPPER 
  540. : m_wndToolBarUiLook.GetBarStyle() & ~CBRS_GRIPPER 
  541. );
  542. m_wndMenuBar.SetBarStyle( 
  543. bDlgButtonChecked
  544. ? m_wndMenuBar.GetBarStyle() |  CBRS_GRIPPER 
  545. : m_wndMenuBar.GetBarStyle() & ~CBRS_GRIPPER 
  546. );
  547. m_wndToolBarControls1.SetBarStyle( 
  548. bDlgButtonChecked
  549. ? m_wndToolBarControls1.GetBarStyle() |  CBRS_GRIPPER 
  550. : m_wndToolBarControls1.GetBarStyle() & ~CBRS_GRIPPER 
  551. );
  552. m_wndToolBarControls2.SetBarStyle( 
  553. bDlgButtonChecked
  554. ? m_wndToolBarControls2.GetBarStyle() |  CBRS_GRIPPER 
  555. : m_wndToolBarControls2.GetBarStyle() & ~CBRS_GRIPPER 
  556. );
  557. _Update();
  558. }
  559. if( nID == IDC_CHECK_FORCE_BALOON_STYLE ) 
  560. {
  561. bool bDlgButtonChecked = ( IsDlgButtonChecked( nID ) == BST_CHECKED );
  562. m_wndToolBarPalette.m_bForceBalloonGradientInDialogs = bDlgButtonChecked;
  563. m_wndToolBarColor.m_bForceBalloonGradientInDialogs = bDlgButtonChecked;
  564. m_wndToolBarUiLook.m_bForceBalloonGradientInDialogs = bDlgButtonChecked;
  565. m_wndToolBarControls1.m_bForceBalloonGradientInDialogs = bDlgButtonChecked;
  566. m_wndToolBarControls2.m_bForceBalloonGradientInDialogs = bDlgButtonChecked;
  567. _Update();
  568. }
  569. }
  570. if( m_wndToolBarColor.GetSafeHwnd() != NULL )
  571. {
  572. INT nBtnHeight = 0;
  573. switch( nID )
  574. {
  575. case ID_HEIGHT_8PX: nBtnHeight = 8; break;
  576. case ID_HEIGHT_10PX: nBtnHeight = 10; break;
  577. case ID_HEIGHT_12PX: nBtnHeight = 12; break;
  578. case ID_HEIGHT_14PX: nBtnHeight = 14; break;
  579. case ID_HEIGHT_16PX: nBtnHeight = 16; break;
  580. case ID_HEIGHT_18PX: nBtnHeight = 18; break;
  581. case ID_HEIGHT_20PX: nBtnHeight = 20; break;
  582. case ID_HEIGHT_22PX: nBtnHeight = 22; break;
  583. case ID_HEIGHT_24PX: nBtnHeight = 24; break;
  584. case ID_HEIGHT_26PX: nBtnHeight = 26; break;
  585. case ID_HEIGHT_28PX: nBtnHeight = 28; break;
  586. case ID_HEIGHT_30PX: nBtnHeight = 30; break;
  587. } // switch( nID )
  588. if( nBtnHeight != 0 )
  589. {
  590. if( nCode == CN_UPDATE_COMMAND_UI )
  591. {
  592. CCmdUI * pCmdUI = (CCmdUI *)pExtra;
  593. ASSERT( pCmdUI != NULL );
  594. pCmdUI->Enable();
  595. pCmdUI->SetRadio(
  596. (m_nThinColorBtnHeight == nBtnHeight) ? TRUE : FALSE
  597. );
  598. }
  599. else
  600. {
  601. if( m_nThinColorBtnHeight != nBtnHeight  )
  602. {
  603. m_nThinColorBtnHeight = nBtnHeight;
  604. CWnd::RepositionBars(0,0xFFFF,0);
  605. m_wndToolBarColor.RedrawWindow();
  606. }
  607. }
  608. return TRUE;
  609. }
  610. INT nColorCmdIndex =
  611. m_wndToolBarColor.CommandToIndex( nID );
  612. if( nColorCmdIndex >= 0 )
  613. {
  614. if( nCode == CN_UPDATE_COMMAND_UI )
  615. {
  616. CCmdUI * pCmdUI = (CCmdUI *)pExtra;
  617. ASSERT( pCmdUI != NULL );
  618. pCmdUI->Enable();
  619. }
  620. else
  621. {
  622. CWinApp * pApp = ::AfxGetApp();
  623. ASSERT( pApp != NULL );
  624. CExtCmdItem * pCmdItem = g_CmdManager->CmdGetPtr( _T("PageToolbars"), nID );
  625. if( pCmdItem != NULL )
  626. {
  627. CString sMsg;
  628. sMsg.Format( _T("Command from the color toolbar:nn%s"), pCmdItem->m_sMenuText );
  629. ::AfxMessageBox( LPCTSTR(sMsg) );
  630. }
  631. }
  632. return TRUE;
  633. }
  634. }
  635. }
  636. return CPageBase::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
  637. }
  638. //////////////////////////////////////////////////////////////////////////
  639. void CPageToolbars::_Update()
  640. {
  641. m_wndMenuBar.SetWindowPos(
  642. NULL, 0, 0, 0, 0,
  643. SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
  644. |SWP_FRAMECHANGED
  645. );
  646. m_wndToolBarUiLook.SetWindowPos(
  647. NULL, 0, 0, 0, 0,
  648. SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
  649. |SWP_FRAMECHANGED
  650. );
  651. m_wndToolBarColor.SetWindowPos(
  652. NULL, 0, 0, 0, 0,
  653. SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
  654. |SWP_FRAMECHANGED
  655. );
  656. m_wndToolBarControls1.SetWindowPos(
  657. NULL, 0, 0, 0, 0,
  658. SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
  659. |SWP_FRAMECHANGED
  660. );
  661. m_wndToolBarControls2.SetWindowPos(
  662. NULL, 0, 0, 0, 0,
  663. SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
  664. |SWP_FRAMECHANGED
  665. );
  666. m_wndToolBarPalette.SetWindowPos(
  667. NULL, 0, 0, 0, 0,
  668. SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
  669. |SWP_FRAMECHANGED
  670. );
  671. CWnd::RepositionBars(0,0xFFFF,0);
  672. RedrawWindow( NULL, NULL,
  673. RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW
  674. |RDW_ALLCHILDREN
  675. );
  676. UpdateDialogControls( this, FALSE );
  677. }
  678. //////////////////////////////////////////////////////////////////////////
  679. LRESULT CPageToolbars::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
  680. {
  681. lParam;
  682. CExtPopupMenuWnd::MsgPrepareMenuData_t * pData =
  683. reinterpret_cast
  684. < CExtPopupMenuWnd::MsgPrepareMenuData_t * >
  685. ( wParam );
  686. ASSERT( pData != NULL );
  687. CExtPopupMenuWnd * pPopup = pData->m_pPopup;
  688. ASSERT( pPopup != NULL );
  689. INT nReplacePos =
  690. pPopup->ItemFindPosForCmdID( ID_COLOR_CTRL_8X5 );
  691. if( nReplacePos >= 0 )
  692. {
  693. CExtPopupColorMenuWnd * pColorPopup = new CExtPopupColorMenuWnd;
  694. pColorPopup->m_lParamCookie = LPARAM( ID_COLOR_CTRL_8X5 );
  695. pColorPopup->m_hWndNotifyColorChanged = GetSafeHwnd();
  696. pColorPopup->m_clrDefault = COLORREF(-1);
  697. pColorPopup->m_clrInitial = m_clrColorCtrl;
  698. VERIFY(
  699. pPopup->ItemInsertSpecPopup(
  700. pColorPopup,
  701. nReplacePos + 1,
  702. pPopup->ItemGetText(nReplacePos),
  703. pPopup->ItemGetIcon(nReplacePos)
  704. )
  705. );
  706. pPopup->ItemSetDisplayed( nReplacePos + 1, true );
  707. VERIFY( pPopup->ItemRemove(nReplacePos) );
  708. } // if( nReplacePos >= 0 )
  709. nReplacePos =
  710. pPopup->ItemFindPosForCmdID( ID_COLOR_CTRL_8X2 );
  711. if( nReplacePos >= 0 )
  712. {
  713. CExtPopupColorMenuWnd * pColorPopup = new CExtPopupColorMenuWnd;
  714. pColorPopup->m_lParamCookie = LPARAM( ID_COLOR_CTRL_8X2 );
  715. pColorPopup->m_hWndNotifyColorChanged = GetSafeHwnd();
  716. pColorPopup->m_clrDefault = COLORREF(-1);
  717. pColorPopup->SetColors8x2();
  718. VERIFY(
  719. pPopup->ItemInsertSpecPopup(
  720. pColorPopup,
  721. nReplacePos + 1,
  722. pPopup->ItemGetText(nReplacePos),
  723. pPopup->ItemGetIcon(nReplacePos)
  724. )
  725. );
  726. pPopup->ItemSetDisplayed( nReplacePos + 1, true );
  727. VERIFY( pPopup->ItemRemove(nReplacePos) );
  728. } // if( nReplacePos >= 0 )
  729. nReplacePos =
  730. pPopup->ItemFindPosForCmdID( ID_COLOR_CTRL_GRAYSCALE );
  731. if( nReplacePos >= 0 )
  732. {
  733. CExtPopupColorMenuWnd * pColorPopup = new CExtPopupColorMenuWnd;
  734. pColorPopup->m_lParamCookie = LPARAM( ID_COLOR_CTRL_GRAYSCALE );
  735. pColorPopup->m_hWndNotifyColorChanged = GetSafeHwnd();
  736. pColorPopup->m_clrDefault = COLORREF(-1);
  737. pColorPopup->RemoveAllColors();
  738. int nGrayColors = 16;
  739. pColorPopup->SetColorsInRow( nGrayColors );
  740. pColorPopup->m_sizeColorItemCell.cy *= 2;
  741. for( int nColorIndex = 0; nColorIndex < nGrayColors; nColorIndex++ )
  742. {
  743. double f = double( nColorIndex ) / double( nGrayColors - 1 );
  744. COLORREF clr = CExtBitmap::stat_HLStoRGB( 0.0, f, 0.0 );
  745. int n = GetRValue(clr);
  746. CExtSafeString str;
  747. str.Format(
  748. _T("#%02X%02X%02X"),
  749. n,
  750. n,
  751. n
  752. );
  753. pColorPopup->AddColor(
  754. new CExtPopupColorMenuWnd::COLORREF_TABLE_ENTRY(
  755. 0,
  756. clr,
  757. str
  758. )
  759. );
  760. }
  761. VERIFY(
  762. pPopup->ItemInsertSpecPopup(
  763. pColorPopup,
  764. nReplacePos + 1,
  765. pPopup->ItemGetText(nReplacePos),
  766. pPopup->ItemGetIcon(nReplacePos)
  767. )
  768. );
  769. pPopup->ItemSetDisplayed( nReplacePos + 1, true );
  770. VERIFY( pPopup->ItemRemove(nReplacePos) );
  771. } // if( nReplacePos >= 0 )
  772. nReplacePos =
  773. pPopup->ItemFindPosForCmdID( ID_COLOR_CTRL_HLS );
  774. if( nReplacePos >= 0 )
  775. {
  776. CExtPopupColorMenuWnd * pColorPopup = new CExtPopupColorMenuWnd;
  777. pColorPopup->m_lParamCookie = LPARAM( ID_COLOR_CTRL_HLS );
  778. pColorPopup->m_hWndNotifyColorChanged = GetSafeHwnd();
  779. pColorPopup->m_clrDefault = COLORREF(-1);
  780. pColorPopup->RemoveAllColors();
  781. int nStepsHue = 12;
  782. int nStepsSat = 8;
  783. pColorPopup->m_sizeColorItemCell.cx = 14;
  784. pColorPopup->m_sizeColorItemCell.cy = 12;
  785. pColorPopup->m_sizeColorItemSpaces.cx = 1;
  786. pColorPopup->m_sizeColorItemSpaces.cy = 1;
  787. pColorPopup->SetColorsInRow( nStepsHue );
  788. for( int nSat = 0; nSat < nStepsSat; nSat++ )
  789. {
  790. double fSat = 1.0 - double( nSat ) / double( nStepsSat );
  791. for( int nHue = 0; nHue < nStepsHue; nHue++ )
  792. {
  793. double fHue = double( nHue ) / double( nStepsHue );
  794. COLORREF clr = CExtBitmap::stat_HLStoRGB( fHue, 0.5, fSat );
  795. CExtSafeString str;
  796. str.Format(
  797. _T("#%02X%02X%02X"),
  798. GetRValue(clr),
  799. GetGValue(clr),
  800. GetBValue(clr)
  801. );
  802. pColorPopup->AddColor(
  803. new CExtPopupColorMenuWnd::COLORREF_TABLE_ENTRY(
  804. 0,
  805. clr,
  806. str
  807. )
  808. );
  809. }
  810. }
  811. VERIFY(
  812. pPopup->ItemInsertSpecPopup(
  813. pColorPopup,
  814. nReplacePos + 1,
  815. pPopup->ItemGetText(nReplacePos),
  816. pPopup->ItemGetIcon(nReplacePos)
  817. )
  818. );
  819. pPopup->ItemSetDisplayed( nReplacePos + 1, true );
  820. VERIFY( pPopup->ItemRemove(nReplacePos) );
  821. } // if( nReplacePos >= 0 )
  822. #if (!defined __EXT_MFC_NO_DATE_PICKER)
  823. nReplacePos =
  824. pPopup->ItemFindPosForCmdID(ID_DATE_PICKER_CTRL);
  825. if( nReplacePos >= 0 )
  826. {
  827. CExtPopupControlMenuWnd::g_bControlMenuWithShadows = true;
  828. CExtPopupDatePickerMenuWnd * pDatePickerPopup = new CExtPopupDatePickerMenuWnd;
  829. VERIFY(
  830. pPopup->ItemInsertSpecPopup(
  831. pDatePickerPopup,
  832. nReplacePos + 1,
  833. pPopup->ItemGetText(nReplacePos),
  834. pPopup->ItemGetIcon(nReplacePos)
  835. )
  836. );
  837. pPopup->ItemSetDisplayed( nReplacePos + 1, true );
  838. VERIFY( pPopup->ItemRemove(nReplacePos) );
  839. } // if( nReplacePos >= 0 )
  840. #endif // #if (!defined __EXT_MFC_NO_DATE_PICKER)
  841. nReplacePos =
  842. pPopup->ItemFindPosForCmdID( ID_PALETTE_MENU );
  843. if( nReplacePos >= 0 )
  844. {
  845. pPopup->ItemRemove( nReplacePos );
  846. CExtPopupMenuWnd * pPalettePopup = new CExtPopupMenuWnd;
  847. pPopup->ItemInsertSpecPopup(
  848. pPalettePopup,
  849. nReplacePos,
  850. g_CmdManager->CmdGetPtr(
  851. g_CmdManager->ProfileNameFromWnd( m_hWnd ),
  852. ID_PALETTE_MENU
  853. )->m_sMenuText
  854. );
  855. pPalettePopup->TrackFlagsSet(
  856. pPalettePopup->TrackFlagsGet()
  857. | TPMX_PALETTE | TPMX_PALETTE_TB_BKGND
  858. );
  859. pPalettePopup->ItemInsertCommand(
  860. 1,
  861. -1,
  862. _T("Palette 6 x 2:")
  863. );
  864. INT nLastPos = pPalettePopup->ItemGetCount() - 1;
  865. pPalettePopup->ItemEnabledSet( nLastPos, false );
  866. pPalettePopup->ItemEnabledAppearanceSet( nLastPos );
  867. pPalettePopup->ItemBoldSet( nLastPos );
  868. pPalettePopup->ItemPaletteRowWrapSet( nLastPos );
  869. CExtBitmap _bmp;
  870. VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(IDB_PAINT_PALETTE) ) );
  871. INT nRow, nColumn;
  872. static const INT nRowCountPaint = 2, nColumnCountPaint = 6;
  873. static const COLORREF clrTransparentPaint = RGB(255,0,255);
  874. static const CSize _sizeBitmapPartPaint(16,16);
  875. for( nRow = 0; nRow < nRowCountPaint; nRow ++ )
  876. {
  877. for( nColumn = 0; nColumn < nColumnCountPaint; nColumn ++ )
  878. {
  879. CPoint ptBitmapOffset(
  880. nRow * nColumnCountPaint * _sizeBitmapPartPaint.cx
  881. + nColumn * _sizeBitmapPartPaint.cx,
  882. 0
  883. );
  884. CRect rcBitmapPart(
  885. ptBitmapOffset,
  886. _sizeBitmapPartPaint
  887. );
  888. CExtCmdIcon _icon;
  889. _icon.m_bmpNormal.FromBitmap(
  890. _bmp,
  891. &rcBitmapPart
  892. );
  893. ASSERT( ! _icon.IsEmpty() );
  894. _icon.m_bmpNormal.AlphaColor( clrTransparentPaint, RGB(0,0,0), 0 );
  895. pPalettePopup->ItemInsertCommand(
  896. 3 + nRow*nColumnCountPaint + nColumn,
  897. -1,
  898. NULL,
  899. NULL,
  900. _icon
  901. );
  902. if( nColumn == (nColumnCountPaint-1) )
  903. pPalettePopup->ItemPaletteRowWrapSet(
  904. pPalettePopup->ItemGetCount() - 1
  905. );
  906. } // for( nColumn = 0; nColumn < nColumnCountPaint; nColumn ++ )
  907. } // for( nRow = 0; nRow < nRowCountPaint; nRow ++ )
  908. pPalettePopup->ItemInsert();
  909. pPalettePopup->ItemInsertCommand(
  910. 2,
  911. -1,
  912. _T("Palette 6 x 7:")
  913. );
  914. nLastPos = pPalettePopup->ItemGetCount() - 1;
  915. pPalettePopup->ItemEnabledSet( nLastPos, false );
  916. pPalettePopup->ItemEnabledAppearanceSet( nLastPos );
  917. pPalettePopup->ItemBoldSet( nLastPos );
  918. pPalettePopup->ItemPaletteRowWrapSet( nLastPos );
  919. VERIFY( _bmp.LoadBMP_Resource( MAKEINTRESOURCE(IDB_EXT_CUSTOM_TB_IMAGES) ) );
  920. static const INT nRowCountCustom = 7, nColumnCountCustom = 6;
  921. static const COLORREF clrTransparentCustom = RGB(255,0,255);
  922. static const CSize _sizeBitmapPartCustom(16,16);
  923. for( nRow = 0; nRow < nRowCountCustom; nRow ++ )
  924. {
  925. for( nColumn = 0; nColumn < nColumnCountCustom; nColumn ++ )
  926. {
  927. CPoint ptBitmapOffset(
  928. nRow * nColumnCountCustom * _sizeBitmapPartCustom.cx
  929. + nColumn * _sizeBitmapPartCustom.cx,
  930. 0
  931. );
  932. CRect rcBitmapPart(
  933. ptBitmapOffset,
  934. _sizeBitmapPartCustom
  935. );
  936. CExtCmdIcon _icon;
  937. _icon.m_bmpNormal.FromBitmap(
  938. _bmp,
  939. &rcBitmapPart
  940. );
  941. ASSERT( ! _icon.IsEmpty() );
  942. _icon.m_bmpNormal.AlphaColor( clrTransparentCustom, RGB(0,0,0), 0 );
  943. pPalettePopup->ItemInsertCommand(
  944. 3 + nRow*nColumnCountCustom + nColumn,
  945. -1,
  946. NULL,
  947. NULL,
  948. _icon
  949. );
  950. if( nColumn == (nColumnCountCustom-1) )
  951. pPalettePopup->ItemPaletteRowWrapSet(
  952. pPalettePopup->ItemGetCount() - 1
  953. );
  954. } // for( nColumn = 0; nColumn < nColumnCountCustom; nColumn ++ )
  955. } // for( nRow = 0; nRow < nRowCountCustom; nRow ++ )
  956. } // if( nReplacePos >= 0 )
  957. return TRUE;
  958. }
  959. //////////////////////////////////////////////////////////////////////////
  960. LRESULT CPageToolbars::OnColorChangedFinally(WPARAM wParam, LPARAM lParam)
  961. {
  962. switch( lParam )
  963. {
  964. case ID_COLOR_CTRL_8X5:
  965. case ID_COLOR_CTRL_8X2:
  966. case ID_COLOR_CTRL_GRAYSCALE:
  967. case ID_COLOR_CTRL_HLS:
  968. m_clrColorCtrl = COLORREF(wParam);
  969. if( m_clrColorCtrl == COLORREF(-1) )
  970. AfxMessageBox(_T("Default Color"));
  971. else
  972. {
  973. CString sColor;
  974. sColor.Format(
  975. _T( "Command from the color control in the menubarnRGB color is 0x%02X%02X%02X" ),
  976. INT( GetRValue(m_clrColorCtrl) ),
  977. INT( GetGValue(m_clrColorCtrl) ),
  978. INT( GetBValue(m_clrColorCtrl) )
  979. );
  980. AfxMessageBox( sColor );
  981. }
  982. break;
  983. default:
  984. break;
  985. } // switch( lParam )
  986. return 0;
  987. }
  988. //////////////////////////////////////////////////////////////////////////
  989. LRESULT CPageToolbars::OnColorSelectCustom(WPARAM wParam, LPARAM lParam)
  990. {
  991. wParam;
  992. if( lParam == ID_COLOR_CTRL_8X5
  993. || lParam == ID_COLOR_CTRL_8X2
  994. || lParam == ID_COLOR_CTRL_GRAYSCALE
  995. || lParam == ID_COLOR_CTRL_HLS
  996. )
  997. {
  998. CExtColorDlg dlgColor;
  999. dlgColor.m_strSection = _T("ColorDialog");
  1000. dlgColor.m_strEntryDialogPosition = _T("Position");
  1001. dlgColor.m_strEntryColorModelSelection = _T("ColorModel");
  1002. dlgColor.m_clrInit
  1003. = dlgColor.m_clrNew
  1004. = m_clrColorCtrl;
  1005. if( dlgColor.DoModal() != IDOK )
  1006. return -1;
  1007. OnColorChangedFinally( 
  1008. (WPARAM)dlgColor.m_clrNew,
  1009. (LPARAM)lParam
  1010. );
  1011. return 0;
  1012. }