ColorPickerDialogClass.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // ColorPickerDialogClass.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "colorpickerdialogclass.h"
  22. #include "colorbar.h"
  23. #include "colorpicker.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. //extern HINSTANCE _hinstance;
  30. /////////////////////////////////////////////////////////////////////////////
  31. //
  32. // Local constants
  33. //
  34. /////////////////////////////////////////////////////////////////////////////
  35. const DWORD UPDATE_COLOR_BARS = 0x00000001;
  36. const DWORD UPDATE_WHITENESS = 0x00000002;
  37. const DWORD UPDATE_HUE_PICKER = 0x00000004;
  38. /*class MyManageStateClass
  39. {
  40. public:
  41. MyManageStateClass (void)
  42. {
  43. m_hResHandle = ::AfxGetResourceHandle ();
  44. ::AfxSetResourceHandle (_hinstance);
  45. }
  46. ~MyManageStateClass (void) { ::AfxSetResourceHandle (m_hResHandle); }
  47. private:
  48. HINSTANCE m_hResHandle;
  49. };*/
  50. //#define MY_MANAGE_STATE() MyManageStateClass _xmystate;
  51. HWND
  52. Create_Color_Picker_Form (HWND parent, int red, int green, int blue)
  53. {
  54. //MY_MANAGE_STATE ()
  55. CWnd *parent_wnd = CWnd::FromHandle (parent);
  56. ColorPickerDialogClass *dialog = new ColorPickerDialogClass (red, green, blue, parent_wnd, IDD_COLOR_FORM);
  57. dialog->Create_Form (parent_wnd);
  58. //HINSTANCE old_handle = ::AfxGetResourceHandle ();
  59. //::AfxSetResourceHandle (_hinstance);
  60. return dialog->m_hWnd;
  61. }
  62. BOOL
  63. Get_Form_Color (HWND form_wnd, int *red, int *green, int *blue)
  64. {
  65. //MY_MANAGE_STATE ()
  66. BOOL retval = FALSE;
  67. ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
  68. if (dialog != NULL) {
  69. (*red) = dialog->Get_Red ();
  70. (*green) = dialog->Get_Green ();
  71. (*blue) = dialog->Get_Blue ();
  72. retval = TRUE;
  73. }
  74. return retval;
  75. }
  76. BOOL
  77. Set_Form_Color (HWND form_wnd, int red, int green, int blue)
  78. {
  79. //MY_MANAGE_STATE ()
  80. BOOL retval = FALSE;
  81. ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
  82. if (dialog != NULL) {
  83. dialog->Set_Color (red, green, blue);
  84. retval = TRUE;
  85. }
  86. return retval;
  87. }
  88. BOOL
  89. Set_Form_Original_Color (HWND form_wnd, int red, int green, int blue)
  90. {
  91. //MY_MANAGE_STATE ()
  92. BOOL retval = FALSE;
  93. ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
  94. if (dialog != NULL) {
  95. dialog->Set_Original_Color (red, green, blue);
  96. retval = TRUE;
  97. }
  98. return retval;
  99. }
  100. BOOL
  101. Show_Color_Picker (int *red, int *green, int *blue)
  102. {
  103. //MY_MANAGE_STATE ()
  104. BOOL retval = FALSE;
  105. ColorPickerDialogClass dialog (*red, *green, *blue);
  106. if (dialog.DoModal () == IDOK) {
  107. (*red) = dialog.Get_Red ();
  108. (*green) = dialog.Get_Green ();
  109. (*blue) = dialog.Get_Blue ();
  110. retval = TRUE;
  111. }
  112. return retval;
  113. }
  114. BOOL
  115. Set_Update_Callback (HWND form_wnd, WWCTRL_COLORCALLBACK callback, void *arg)
  116. {
  117. //MY_MANAGE_STATE()
  118. BOOL retval = FALSE;
  119. ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
  120. if (dialog != NULL) {
  121. dialog->Set_Update_Callback(callback, arg);
  122. retval = TRUE;
  123. }
  124. return retval;
  125. }
  126. /////////////////////////////////////////////////////////////////////////////
  127. //
  128. // ColorPickerDialogClass
  129. //
  130. /////////////////////////////////////////////////////////////////////////////
  131. ColorPickerDialogClass::ColorPickerDialogClass
  132. (
  133. int red,
  134. int green,
  135. int blue,
  136. CWnd *pParent,
  137. UINT res_id
  138. )
  139. : m_OrigRed ((float)red),
  140. m_OrigGreen ((float)green),
  141. m_OrigBlue ((float)blue),
  142. m_CurrentRed ((float)red),
  143. m_CurrentGreen ((float)green),
  144. m_CurrentBlue ((float)blue),
  145. m_CurrentColorBar (NULL),
  146. m_OrigColorBar (NULL),
  147. m_RedColorBar (NULL),
  148. m_GreenColorBar (NULL),
  149. m_BlueColorBar (NULL),
  150. m_WhitenessColorBar (NULL),
  151. m_HuePicker (NULL),
  152. m_bDeleteOnClose (false),
  153. m_UpdateCallback(NULL),
  154. CDialog(res_id, pParent)
  155. {
  156. //{{AFX_DATA_INIT(ColorPickerDialogClass)
  157. // NOTE: the ClassWizard will add member initialization here
  158. //}}AFX_DATA_INIT
  159. return ;
  160. }
  161. /////////////////////////////////////////////////////////////////////////////
  162. //
  163. // Create_Form
  164. //
  165. /////////////////////////////////////////////////////////////////////////////
  166. void
  167. ColorPickerDialogClass::Create_Form (CWnd *parent)
  168. {
  169. Create (IDD_COLOR_FORM, parent);
  170. SetProp (m_hWnd, "COLORPICKERDLGCLASS", (HANDLE)this);
  171. m_bDeleteOnClose = true;
  172. return ;
  173. }
  174. /////////////////////////////////////////////////////////////////////////////
  175. //
  176. // DoDataExchange
  177. //
  178. /////////////////////////////////////////////////////////////////////////////
  179. void
  180. ColorPickerDialogClass::DoDataExchange (CDataExchange *pDX)
  181. {
  182. CDialog::DoDataExchange(pDX);
  183. //{{AFX_DATA_MAP(ColorPickerDialogClass)
  184. DDX_Control(pDX, IDC_BLUE_SPIN, m_BlueSpin);
  185. DDX_Control(pDX, IDC_GREEN_SPIN, m_GreenSpin);
  186. DDX_Control(pDX, IDC_RED_SPIN, m_RedSpin);
  187. //}}AFX_DATA_MAP
  188. return ;
  189. }
  190. BEGIN_MESSAGE_MAP(ColorPickerDialogClass, CDialog)
  191. //{{AFX_MSG_MAP(ColorPickerDialogClass)
  192. ON_BN_CLICKED(IDC_RESET, OnReset)
  193. //}}AFX_MSG_MAP
  194. END_MESSAGE_MAP()
  195. /////////////////////////////////////////////////////////////////////////////
  196. //
  197. // OnInitDialog
  198. //
  199. /////////////////////////////////////////////////////////////////////////////
  200. BOOL
  201. ColorPickerDialogClass::OnInitDialog (void)
  202. {
  203. CDialog::OnInitDialog ();
  204. //
  205. // Setup the spin controls
  206. //
  207. m_BlueSpin.SetRange (0, 255);
  208. m_GreenSpin.SetRange (0, 255);
  209. m_RedSpin.SetRange (0, 255);
  210. m_BlueSpin.SetPos ((int)m_CurrentBlue);
  211. m_GreenSpin.SetPos ((int)m_CurrentGreen);
  212. m_RedSpin.SetPos ((int)m_CurrentRed);
  213. //
  214. // Get control of all the color bars on the dialog
  215. //
  216. m_CurrentColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_CURRENT_COLOR_BAR));
  217. m_OrigColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_ORIG_COLOR_BAR));
  218. m_RedColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_RED_BAR));
  219. m_GreenColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_GREEN_BAR));
  220. m_BlueColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_BLUE_BAR));
  221. m_WhitenessColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_WHITENESS_BAR));
  222. m_HuePicker = ColorPickerClass::Get_Color_Picker (::GetDlgItem (m_hWnd, IDC_HUE_PICKER));
  223. // Setup the original color bar
  224. m_OrigColorBar->Modify_Point (0, 0, m_OrigRed, m_OrigGreen, m_OrigBlue);
  225. m_HuePicker->Select_Color ((int)m_OrigRed, (int)m_OrigGreen, (int)m_OrigBlue);
  226. //m_WhitenessColorBar->Modify_Point (0, 0, m_OrigRed, m_OrigGreen, m_OrigBlue);
  227. m_RedColorBar->Set_Range (0, 255);
  228. m_GreenColorBar->Set_Range (0, 255);
  229. m_BlueColorBar->Set_Range (0, 255);
  230. m_WhitenessColorBar->Set_Range (0, 255);
  231. m_WhitenessColorBar->Insert_Point (1, 255, 255, 255, 255);
  232. //
  233. // Setup the red/green/blue color bars
  234. //
  235. //m_RedColorBar->Insert_Point (1, 1, 255, 0, 0);
  236. //m_GreenColorBar->Insert_Point (1, 1, 0, 255, 0);
  237. //m_BlueColorBar->Insert_Point (1, 1, 0, 0, 255);
  238. //
  239. // Update the remaining color bars to reflect the initial color
  240. //
  241. Update_Red_Bar ();
  242. Update_Green_Bar ();
  243. Update_Blue_Bar ();
  244. Update_Current_Color_Bar ();
  245. Update_Whiteness_Bar ();
  246. return TRUE;
  247. }
  248. /////////////////////////////////////////////////////////////////////////////
  249. //
  250. // Update_Red_Bar
  251. //
  252. /////////////////////////////////////////////////////////////////////////////
  253. void
  254. ColorPickerDialogClass::Update_Red_Bar (void)
  255. {
  256. m_RedColorBar->Set_Selection_Pos (m_CurrentRed);
  257. m_RedColorBar->Modify_Point (0, 0, 0, (float)m_CurrentGreen, (float)m_CurrentBlue);
  258. m_RedColorBar->Modify_Point (1, 255, 255, (float)m_CurrentGreen, (float)m_CurrentBlue);
  259. return ;
  260. }
  261. /////////////////////////////////////////////////////////////////////////////
  262. //
  263. // Update_Green_Bar
  264. //
  265. /////////////////////////////////////////////////////////////////////////////
  266. void
  267. ColorPickerDialogClass::Update_Green_Bar (void)
  268. {
  269. m_GreenColorBar->Set_Selection_Pos (m_CurrentGreen);
  270. m_GreenColorBar->Modify_Point (0, 0, m_CurrentRed, 0, m_CurrentBlue);
  271. m_GreenColorBar->Modify_Point (1, 255, m_CurrentRed, 255, m_CurrentBlue);
  272. return ;
  273. }
  274. /////////////////////////////////////////////////////////////////////////////
  275. //
  276. // Update_Blue_Bar
  277. //
  278. /////////////////////////////////////////////////////////////////////////////
  279. void
  280. ColorPickerDialogClass::Update_Blue_Bar (void)
  281. {
  282. m_BlueColorBar->Set_Selection_Pos (m_CurrentBlue);
  283. m_BlueColorBar->Modify_Point (0, 0, m_CurrentRed, m_CurrentGreen, 0);
  284. m_BlueColorBar->Modify_Point (1, 255, m_CurrentRed, m_CurrentGreen, 255);
  285. return ;
  286. }
  287. /////////////////////////////////////////////////////////////////////////////
  288. //
  289. // Update_Current_Color_Bar
  290. //
  291. /////////////////////////////////////////////////////////////////////////////
  292. void
  293. ColorPickerDialogClass::Update_Current_Color_Bar (void)
  294. {
  295. m_CurrentColorBar->Modify_Point (0, 0, m_CurrentRed, m_CurrentGreen, m_CurrentBlue);
  296. return ;
  297. }
  298. /////////////////////////////////////////////////////////////////////////////
  299. //
  300. // Update_Whiteness_Bar
  301. //
  302. /////////////////////////////////////////////////////////////////////////////
  303. void
  304. ColorPickerDialogClass::Update_Whiteness_Bar (void)
  305. {
  306. int red = 0;
  307. int green = 0;
  308. int blue = 0;
  309. m_HuePicker->Get_Current_Color (&red, &green, &blue);
  310. //
  311. // Given the current color, determine the 'whiteness' and update
  312. //
  313. float whiteness = min (m_CurrentRed, m_CurrentGreen);
  314. whiteness = min (whiteness, m_CurrentBlue);
  315. float percent = whiteness / 255;
  316. m_WhitenessColorBar->Set_Selection_Pos (whiteness);
  317. m_WhitenessColorBar->Modify_Point (0, 0, (float)red, (float)green, (float)blue);
  318. // Can we extrapolate the starting color from the whiteness factor?
  319. /*if (percent == 1) {
  320. m_WhitenessColorBar->Modify_Point (0, 0, 0, 0, 0);
  321. } else {
  322. //
  323. // Extrapolate the starting color
  324. //
  325. float start_red = (m_CurrentRed - whiteness) / (1 - percent);
  326. float start_green = (m_CurrentGreen - whiteness) / (1 - percent);
  327. float start_blue = (m_CurrentBlue - whiteness) / (1 - percent);
  328. m_WhitenessColorBar->Modify_Point (0, 0, start_red, start_green, start_blue);
  329. }*/
  330. return ;
  331. }
  332. /////////////////////////////////////////////////////////////////////////////
  333. //
  334. // OnNotify
  335. //
  336. /////////////////////////////////////////////////////////////////////////////
  337. BOOL
  338. ColorPickerDialogClass::OnNotify
  339. (
  340. WPARAM wParam,
  341. LPARAM lParam,
  342. LRESULT *pResult
  343. )
  344. {
  345. CBR_NMHDR *color_bar_hdr = (CBR_NMHDR *)lParam;
  346. switch (color_bar_hdr->hdr.idFrom)
  347. {
  348. case IDC_RED_BAR:
  349. {
  350. if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
  351. float red = color_bar_hdr->red;
  352. float green = m_CurrentGreen;
  353. float blue = m_CurrentBlue;
  354. Update_Color (red, green, blue);
  355. }
  356. }
  357. break;
  358. case IDC_GREEN_BAR:
  359. {
  360. if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
  361. float red = m_CurrentRed;
  362. float green = color_bar_hdr->green;
  363. float blue = m_CurrentBlue;
  364. Update_Color (red, green, blue);
  365. }
  366. }
  367. break;
  368. case IDC_BLUE_BAR:
  369. {
  370. if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
  371. float red = m_CurrentRed;
  372. float green = m_CurrentGreen;
  373. float blue = color_bar_hdr->blue;
  374. Update_Color (red, green, blue);
  375. }
  376. }
  377. break;
  378. case IDC_WHITENESS_BAR:
  379. {
  380. if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
  381. float red = color_bar_hdr->red;
  382. float green = color_bar_hdr->green;
  383. float blue = color_bar_hdr->blue;
  384. Update_Color (red, green, blue, UPDATE_COLOR_BARS);
  385. }
  386. }
  387. break;
  388. case IDC_HUE_PICKER:
  389. {
  390. CP_NMHDR *picker_hdr = (CP_NMHDR *)lParam;
  391. if (picker_hdr->hdr.code == CPN_COLORCHANGE) {
  392. float red = picker_hdr->red;
  393. float green = picker_hdr->green;
  394. float blue = picker_hdr->blue;
  395. float whiteness = m_WhitenessColorBar->Get_Selection_Pos () / 255;
  396. red = red + ((255 - red) * whiteness);
  397. green = green + ((255 - green) * whiteness);
  398. blue = blue + ((255 - blue) * whiteness);
  399. Update_Color (red, green, blue, UPDATE_COLOR_BARS | UPDATE_WHITENESS);
  400. }
  401. }
  402. break;
  403. case IDC_RED_SPIN:
  404. case IDC_GREEN_SPIN:
  405. case IDC_BLUE_SPIN:
  406. {
  407. if (color_bar_hdr->hdr.code == UDN_DELTAPOS) {
  408. float red = (float)m_RedSpin.GetPos ();
  409. float green = (float)m_GreenSpin.GetPos ();
  410. float blue = (float)m_BlueSpin.GetPos ();
  411. Update_Color (red, green, blue, UPDATE_COLOR_BARS | UPDATE_WHITENESS | UPDATE_HUE_PICKER);
  412. }
  413. }
  414. break;
  415. }
  416. return CDialog::OnNotify (wParam, lParam, pResult);
  417. }
  418. /////////////////////////////////////////////////////////////////////////////
  419. //
  420. // Update_Color
  421. //
  422. /////////////////////////////////////////////////////////////////////////////
  423. void
  424. ColorPickerDialogClass::Update_Color
  425. (
  426. float red,
  427. float green,
  428. float blue,
  429. DWORD flags
  430. )
  431. {
  432. /*bool update_red = m_CurrentRed != red;
  433. bool update_green = m_CurrentGreen != green;
  434. bool update_blue = m_CurrentBlue != blue;*/
  435. m_CurrentRed = red;
  436. m_CurrentGreen = green;
  437. m_CurrentBlue = blue;
  438. int int_blue = (int)blue;
  439. int int_green = (int)green;
  440. int int_red = (int)red;
  441. if (int_blue != m_BlueSpin.GetPos ()) {
  442. m_BlueSpin.SetPos (int_blue);
  443. }
  444. if (int_green != m_GreenSpin.GetPos ()) {
  445. m_GreenSpin.SetPos (int_green);
  446. }
  447. if (int_red != m_RedSpin.GetPos ()) {
  448. m_RedSpin.SetPos (int_red);
  449. }
  450. // Hack to get the edit controls to update in a timely fashion
  451. ::UpdateWindow (::GetDlgItem (m_hWnd, IDC_RED_EDIT));
  452. ::UpdateWindow (::GetDlgItem (m_hWnd, IDC_GREEN_EDIT));
  453. ::UpdateWindow (::GetDlgItem (m_hWnd, IDC_BLUE_EDIT));
  454. //
  455. // Update the red, green and blue color bars
  456. //
  457. if (flags & UPDATE_COLOR_BARS) {
  458. Update_Red_Bar ();
  459. Update_Green_Bar ();
  460. Update_Blue_Bar ();
  461. }
  462. //
  463. // Update the hue picker
  464. //
  465. if (flags & UPDATE_HUE_PICKER) {
  466. m_HuePicker->Select_Color ((int)red, (int)green, (int)blue);
  467. }
  468. //
  469. // Update the whiteness color bar
  470. //
  471. if (flags & UPDATE_WHITENESS) {
  472. Update_Whiteness_Bar ();
  473. }
  474. Update_Current_Color_Bar ();
  475. // If a callback is registered, call it.
  476. if (m_UpdateCallback)
  477. m_UpdateCallback((int)red, (int)green, (int)blue, m_CallArg);
  478. return ;
  479. }
  480. /////////////////////////////////////////////////////////////////////////////
  481. //
  482. // Set_Original_Color
  483. //
  484. /////////////////////////////////////////////////////////////////////////////
  485. void ColorPickerDialogClass::Set_Original_Color (int r, int g, int b)
  486. {
  487. m_OrigRed = (float)r;
  488. m_OrigGreen = (float)g;
  489. m_OrigBlue = (float)b;
  490. m_OrigColorBar->Modify_Point (0, 0, m_OrigRed, m_OrigGreen, m_OrigBlue);
  491. }
  492. /////////////////////////////////////////////////////////////////////////////
  493. //
  494. // OnReset
  495. //
  496. /////////////////////////////////////////////////////////////////////////////
  497. void
  498. ColorPickerDialogClass::OnReset (void)
  499. {
  500. Update_Color (m_OrigRed,
  501. m_OrigGreen,
  502. m_OrigBlue,
  503. UPDATE_COLOR_BARS| UPDATE_WHITENESS | UPDATE_HUE_PICKER);
  504. return ;
  505. }
  506. LRESULT ColorPickerDialogClass::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  507. {
  508. return CDialog::WindowProc(message, wParam, lParam);
  509. }
  510. /////////////////////////////////////////////////////////////////////////////
  511. //
  512. // OnCommand
  513. //
  514. /////////////////////////////////////////////////////////////////////////////
  515. BOOL
  516. ColorPickerDialogClass::OnCommand
  517. (
  518. WPARAM wParam,
  519. LPARAM lParam
  520. )
  521. {
  522. switch (LOWORD (wParam))
  523. {
  524. case IDC_RED_EDIT:
  525. case IDC_GREEN_EDIT:
  526. case IDC_BLUE_EDIT:
  527. {
  528. if (HIWORD (wParam) == EN_KILLFOCUS) {
  529. float red = (float)GetDlgItemInt (IDC_RED_EDIT);
  530. float green = (float)GetDlgItemInt (IDC_GREEN_EDIT);
  531. float blue = (float)GetDlgItemInt (IDC_BLUE_EDIT);
  532. Update_Color (red, green, blue, UPDATE_COLOR_BARS| UPDATE_WHITENESS | UPDATE_HUE_PICKER);
  533. }
  534. }
  535. break;
  536. }
  537. return CDialog::OnCommand(wParam, lParam);
  538. }
  539. /////////////////////////////////////////////////////////////////////////////
  540. //
  541. // PostNcDestroy
  542. //
  543. /////////////////////////////////////////////////////////////////////////////
  544. void
  545. ColorPickerDialogClass::PostNcDestroy (void)
  546. {
  547. CDialog::PostNcDestroy();
  548. if (m_bDeleteOnClose) {
  549. delete this;
  550. }
  551. return ;
  552. }