coldlog.cpp

Go to the documentation of this file.
00001 // $Id: coldlog.cpp 1685 2006-08-09 19:25:40Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 // Implementation of the following classes
00100 //
00101 //  ColourEditDlg   Colour editor dialogue box
00102 
00103 /*
00104 */
00105 
00106 
00107 
00108 //-----------------------------------------------------------------------------------------
00109 // Include files
00110 
00111 #include "camtypes.h"
00112 
00113 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00114 //#include "attrmgr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00115 //#include "barsdlgs.h"
00116 #include "bubbleid.h" 
00117 #include "camelot.h" 
00118 #include "ccolbar.h"
00119 #include "colcontx.h"
00120 #include "coldlog.h"
00121 #include "coldrop.h"
00122 #include "colmenu.h"
00123 #include "colormgr.h"
00124 #include "colourix.h"
00125 #include "colpick.h"
00126 #include "ctrlhelp.h"
00127 //#include "cursor.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00128 #include "dlgmgr.h"
00129 //#include "dlgtypes.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00130 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00131 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00132 #include "dragcol.h"
00133 #include "dragmgr.h"
00134 #include "dragpick.h"
00135 //#include "ensure.h"   - in camtypes.h [AUTOMATICALLY REMOVED]
00136 //#include "errors.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00137 #include "helpuser.h"       // For HelpUser()
00138 //#include "ink.h"          // For NodeRenderableInk - in camtypes.h [AUTOMATICALLY REMOVED]
00139 //#include "jason.h"
00140 #include "keypress.h"       // For constrain, escape, and OnKeyPress stuff
00141 #include "lineattr.h"       // For AttrStrokeColour
00142 //#include "msg.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00143 #include "newcol.h"         // New colour dlg
00144 #include "nodedoc.h"
00145 #include "oilprog.h"        // For Beep()
00146 //#include "ops.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00147 #include "optsmsgs.h"       // For OptionsChangingMsg
00148 #include "progress.h"
00149 //#include "resource.h"
00150 #include "scunit.h"         // For colour units
00151 #include "optsunit.h"       // For default colour units
00152 #include "sgcolour.h"       // For ColourNameDlg
00153 //#include "will2.h"            // For string resources (v1.1)
00154 
00155 #include "ccdc.h"           // For render-into-dialogue support
00156 #include "dlgcol.h"
00157 //#include "fillattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00158 #include "grnddib.h"
00159 #include "palman.h"
00160 
00161 //#include "spread.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00162 #include "objchge.h"
00163 
00164 // include files necessary for correctly supporting camelots CColourPicker custom control
00165 //#include "mainfrm.h"
00166 #include "statline.h"
00167 #include "ophist.h"
00168 #include "layer.h"
00169 
00170 const ResourceID ColourEditDlg::IDD = _R(IDD_COLOUREDITDLG);
00171 
00172 //-----------------------------------------------------------------------------------------
00173 
00174 // The kernel colour picker - called via the winoil ColourPicker class
00175 CC_IMPLEMENT_DYNCREATE(ColourEditDlg, DialogOp)
00176 CC_IMPLEMENT_DYNAMIC(ColEditorDragTarget, KernelDragTarget)
00177 CC_IMPLEMENT_DYNCREATE(ColEditorDragInfo, ColourDragInformation)
00178 CC_IMPLEMENT_DYNCREATE(OpMakeColourLocalToFrame, UndoableOperation)
00179 
00180 
00181 // CAM_DEBUG_NEW is defined a couple of pages further down...
00182 
00183 //-----------------------------------------------------------------------------------------
00184 
00185 /********************************************************************************************
00186 
00187     Preference:     ColourEditorAutoModel
00188     Section:        Displays
00189     Range:          TRUE or FALSE
00190     Purpose:        If TRUE, the colour editor will automatically switch the display colour
00191                     model whenever it switches to a new LOCAL colour (to that colour's model)
00192                     If FALSE, the only time the display colour model will change is when
00193                     the user explicitly sets a different colour model from the dialogue.
00194     Notes:          Normal preference, available from the options dialogue.
00195     SeeAlso:        ColourEditDlg
00196 
00197 ********************************************************************************************/
00198 
00199 /********************************************************************************************
00200 
00201     Preference:     ColourEditorAutoModelN
00202     Section:        Displays
00203     Range:          TRUE or FALSE
00204     Purpose:        If TRUE, the colour editor will automatically switch the display colour
00205                     model whenever it switches to a new NAMED colour (Colour STYLE) (to that
00206                     colour's model)
00207                     If FALSE, the only time the display colour model will change is when
00208                     the user explicitly sets a different colour model from the dialogue.
00209     Notes:          Normal preference, available from the options dialogue.
00210     SeeAlso:        ColourEditDlg
00211 
00212 ********************************************************************************************/
00213 
00214 /********************************************************************************************
00215 
00216     Preference:     ColourEditorDisplayModel
00217     Section:        Displays
00218     Range:          1..15 (COLOURMODEL_XXXX enum). If an invalid setting is chosen,
00219                     then COLOURMODEL_HSVT will be selected by default
00220     Purpose:        Retains a 'memory' of the last used Colour Editor display model
00221                     between sessions in Camelot. Used for LOCAL COLOURS
00222     Notes:          Internal 'memory' preference, not directly settable by the user
00223     SeeAlso:        ColourEditDlg; ColourModel
00224 
00225 ********************************************************************************************/
00226 
00227 /********************************************************************************************
00228 
00229     Preference:     ColourEditorDisplayModelN
00230     Section:        Displays
00231     Range:          1..15 (COLOURMODEL_XXXX enum). If an invalid setting is chosen,
00232                     then COLOURMODEL_HSVT will be selected by default
00233     Purpose:        Retains a 'memory' of the last used Colour Editor display model
00234                     between sessions in Camelot. used for COLOUR STYLES
00235     Notes:          Internal 'memory' preference, not directly settable by the user
00236     SeeAlso:        ColourEditDlg; ColourModel
00237 
00238 ********************************************************************************************/
00239 
00240 /********************************************************************************************
00241 
00242     Preference:     ColourEditorFolded
00243     Section:        Displays
00244     Range:          TRUE or FALSE
00245     Purpose:        Retains a 'memory' of the colour editor 'folded' state between
00246                     sessions in Camelot.
00247     Notes:          Internal 'memory' preference, not directly settable by the user
00248     SeeAlso:        ColourEditDlg
00249 
00250 ********************************************************************************************/
00251 
00252 /********************************************************************************************
00253 
00254     Preference:     ColourEditorSplitLine
00255     Section:        Displays
00256     Range:          TRUE or FALSE
00257     Purpose:        Determines if the sliders in the colour editor show a 'split line'
00258                     display. If FALSE, a simple display is given where each slider just
00259                     shows the component being set (e.g. in RGB, the Red slider shades
00260                     between black and red)
00261                     If TRUE, the split mode is enabled, where the slider shows the normal
00262                     grad-fill in the top half (black to red), but fills the bottom half
00263                     with the range of colours which will result from changing that 
00264                     component of the edited colour (i.e. at any point on the slider it
00265                     shows what colour you will get if you click on that spot)
00266     Notes:          Secret squirrel preference! THis may become available in the options
00267                     dialogue if it is decided that it is useful.
00268     SeeAlso:        ColourEditDlg
00269 
00270 ********************************************************************************************/
00271 
00272 /********************************************************************************************
00273 
00274     Preference:     ColourEditorUse3D
00275     Section:        Displays
00276     Range:          TRUE or FALSE
00277     Purpose:        If FALSE, the RGB/CMYK colour pickers in the colour editor will be
00278                     simple sliders. If TRUE, the '3d colour cube' display will be used instead
00279     SeeAlso:        ColourEditDlg
00280 
00281 ********************************************************************************************/
00282 
00283 /********************************************************************************************
00284 
00285     Preference:     ColourEditorHSVHueTop
00286     Section:        Displays
00287     Range:          TRUE or FALSE
00288     Purpose:        If TRUE, the HSV colour picker shows the SV Pane with full hue at the top
00289                     (as all version did prior to Xara X1)
00290                     If FALSE, the HSV colour picker shows the SV Pane with full hue at the bottom
00291     SeeAlso:        ColourEditDlg
00292 
00293 ********************************************************************************************/
00294 
00295 /********************************************************************************************
00296 
00297     Preference:     UsePrintCMYK
00298     Section:        Displays
00299     Range:          TRUE or FALSE
00300     Purpose:        If TRUE, use print profile to do RGB-CMYK colour conversion
00301     SeeAlso:        ColourEditDlg
00302 
00303 ********************************************************************************************/
00304 
00305 
00306 // PREFERENCES
00307 INT32 ColourEditDlg::DefaultDisplayModel  = (INT32) COLOURMODEL_HSVT;
00308 INT32 ColourEditDlg::DefaultDisplayModelN = (INT32) COLOURMODEL_HSVT;
00309 INT32 ColourEditDlg::AutoModelChange    = FALSE;            // When new colour set, change Displaymodel (LOCAL)
00310 
00311 // WEBSTER - markn 31/1/97
00312 // Don't autochange named colour display model (i.e. set to FALSE instead of TRUE
00313 #ifndef WEBSTER
00314 INT32 ColourEditDlg::AutoModelChangeN = TRUE;           // When new colour set, change Displaymodel (STYLE)
00315 #else
00316 INT32 ColourEditDlg::AutoModelChangeN = FALSE;          // When new colour set, change Displaymodel (STYLE)
00317 #endif // WEBSTER
00318 
00319 INT32 ColourEditDlg::Folded         = TRUE;             // Is the dlg folded?
00320 INT32 ColourEditDlg::SplitLineDisplay   = FALSE;            // Show sliders in split gradfill way
00321 INT32 ColourEditDlg::Use3DDisplay       = FALSE;            // Show sliders rather than colourcube
00322 
00323 // If FALSE turns the SV square upside down compared to previous versions
00324 BOOL ColourEditDlg::bHSVHueAtTop = TRUE;
00325 
00326 BOOL ColourEditDlg::bUsePrintCMYK = TRUE;
00327 
00328 //-----------------------------------------------------------------------------------------
00329 
00330 // Statics
00331 BOOL ColourEditDlg::EditingLineColour = FALSE;          // Default to editing local fill colours
00332 BOOL ColourEditDlg::UpdateOnNextIdle  = FALSE;          // Callback - Update the dialogue on the next idle event
00333 
00334 BOOL ColourEditDlg::resetColPickPos;                    // by default - we don't need to reset
00335 RECT ColourEditDlg::colPickOrigRect;                    // store the original location of
00336                                                         // custom colour picker control
00337 BOOL ColourEditDlg::needColPickHidden;
00338 BOOL ColourEditDlg::colPickHidden;
00339 
00340 AbortColourState ColourEditDlg::abortColourState;
00341 
00342 BOOL ColourEditDlg::EscapeKeyWasPressed = FALSE;        // record the fact of whether the
00343                                                         // escape key has been pressed.
00344 
00345 // NOTE:  the above variable is used as a bodge fix.  For some reason, ColourEditDlg::OnKeyPress ()
00346 //        (which internally calls SetNewValueFromMousePos ()) seems to be failing to detect that
00347 //        the escape key is pressed.  Since OnKeyPress already knows this, lets record this fact
00348 //        and take things from there.  Although this is a bodge fix, this new method actually
00349 //        appears to work better than the original (I can't find the problem) one.
00350 
00351 /***********************************************************************************************
00352 
00353 >   class ColourEditDlgParam : public OpParam
00354 
00355     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00356     Created:    14/10/94
00357 
00358     Purpose:    The OpParam to use when Invoke()ing the ColourEditDlg
00359                 You shouldn't ever need to use this - just call the static function
00360                 ColourEditDlg::InvokeDialog if you want a colour editor
00361 
00362     Scope:      private
00363     SeeAlso:    ColourEditDlg::InvokeDialog; ColourPicker::EditColour
00364 
00365 ***********************************************************************************************/
00366 
00367 class ColourEditDlgParam : public OpParam
00368 {
00369 CC_DECLARE_MEMDUMP(ColourEditDlgParam)
00370 
00371 public:
00372     ColourEditDlgParam(ColourList *TheParentList, IndexedColour *TheColourToEdit)   \
00373                     : OpParam(0, 0)                                                 \
00374             { ParentList = TheParentList; ColourToEdit = TheColourToEdit; };
00375 
00376     ColourList      *ParentList;
00377     IndexedColour   *ColourToEdit;
00378 };
00379 
00380 
00381 CC_IMPLEMENT_MEMDUMP(ColourEditDlgParam, OpParam)
00382 
00383 
00384 
00385 //-----------------------------------------------------------------------------------------
00386 // This must be defined AFTER all CC_IMPLEMENT_DYNCREATE calls
00387 #define new CAM_DEBUG_NEW
00388 
00389 
00390 //-----------------------------------------------------------------------------------------
00391 // Local (file or class scope) constants/statics
00392 
00393 const INT32 CROSSRADIUS = 6000;     // Marker cross is 1/6th of an inch across (millipoints)
00394 const INT32 PCROSSRADIUS = 3500;        // Marker cross to indicate parent position is smaller
00395 const INT32 ZSLIDERSIZE = 8000;     // Size of Z slider in 3d mode
00396 const INT32 PATCHSIZE   = 13500;        // Size of original/current colour patch square
00397 
00398 const CDlgMode ColourEditDlg::Mode = MODELESS;          // Mode of the dialog  
00399 
00400 ColourEditDlg *ColourEditDlg::TheEditor = NULL;         // THE instantiation of this dlg
00401 ColourModel ColourEditDlg::DisplayModel = COLOURMODEL_HSVT; // Default DisplayModel
00402 INT32 ColourEditDlg::ColourPickerMode = 0;              // Default picker axis orientation
00403 
00404 
00405 static CGadgetID TintGadgetIDs[] =  // NULL terminated list of special tint gadgets
00406 {
00407     _R(IDC_EDIT_TINTNAME),              // This first item is used to determine positioning
00408     _R(IDC_EDIT_TINT),
00409     _R(IDC_EDIT_TINTPERCENT),
00410 //  _R(IDC_EDIT_TINTSLIDER),
00411     _R(IDC_EDIT_SHADE),
00412     _R(IDC_EDIT_SHADEPERCENT),
00413     0
00414 };
00415 
00416 
00417 static CGadgetID LinkGadgetIDs[] =  // NULL terminated list of special linked-colour gadgets
00418 {
00419     _R(IDC_EDIT_INHERITNAME),           // This first item is used to determine positioning
00420     _R(IDC_EDIT_INHERIT1),
00421     _R(IDC_EDIT_INHERIT2),
00422     _R(IDC_EDIT_INHERIT3),
00423     _R(IDC_EDIT_INHERIT4),
00424     0
00425 };
00426 
00427 
00428 static CGadgetID OtherGadgetIDs[] = // NULL terminated list of all non tint/link gadgets
00429 {                                   // which should be shaded to shade the dialogue
00430     _R(IDC_EDIT_NAMEMENU),
00431     _R(IDC_EDIT_COMPONENT1),
00432     _R(IDC_EDIT_COMPONENT2),
00433     _R(IDC_EDIT_COMPONENT3),
00434     _R(IDC_EDIT_COMPONENT4),
00435     _R(IDC_EDIT_WEBHEX),
00436     _R(IDC_NAME_COMPONENT1),
00437     _R(IDC_NAME_COMPONENT2),
00438     _R(IDC_NAME_COMPONENT3),
00439     _R(IDC_NAME_COMPONENT4),
00440     _R(IDC_NAME_WEBHEX),
00441     _R(IDC_EDIT_COLMODEL),
00442     _R(IDC_EDIT_3D),
00443     _R(IDC_EDIT_COLTYPE),
00444     _R(IDC_EDIT_MAKESTYLE),
00445 #ifndef WEBSTER
00446     _R(IDC_EDIT_ADVANCED),  // WEBSTER - markn 11/12/96
00447 #endif // WEBSTER
00448     _R(IDC_EDIT_DROPMENU),
00449     _R(IDC_EDIT_PARENTCOL),
00450     _R(IDC_EDIT_PARENTNAME),
00451     _R(IDC_EDIT_216ONLY),
00452 //  WEBSTER-ranbirr-27/03/97
00453     _R(IDC_EDIT_NOCOLOUR),
00454     _R(IDC_EDIT_LINEFILL),
00455     _R(IDC_MAKE_LOCAL),
00456     _R(IDC_EDIT_RENAME),
00457     _R(IDC_COLOURPICKER),
00458     0
00459 };
00460 
00461 typedef struct
00462 {
00463     CGadgetID   Gadget;                     // Gadget ID
00464     UINT32      BubbleID;                   //Bubble help ID for this gadget
00465 } GadgetHelpInfo;
00466 
00467 static GadgetHelpInfo GadgetHelp[] = 
00468 {
00469     { _R(IDC_EDIT_DROPMENU),    _R(IDS_EDITBH_MENU) },
00470     { _R(IDC_EDIT_COLMODEL),    _R(IDS_EDITBH_COLMODEL) },
00471     { _R(IDC_EDIT_NAMEMENU),    _R(IDS_EDITBH_NAME) },
00472     { _R(IDC_EDIT_COLTYPE),     _R(IDS_EDITBH_COLTYPE) },
00473     { _R(IDC_EDIT_INHERIT1),    _R(IDS_EDITBH_INHERIT) },
00474     { _R(IDC_EDIT_INHERIT2),    _R(IDS_EDITBH_INHERIT) },
00475     { _R(IDC_EDIT_INHERIT3),    _R(IDS_EDITBH_INHERIT) },
00476     { _R(IDC_EDIT_INHERIT4),    _R(IDS_EDITBH_INHERIT) },
00477     { _R(IDC_EDIT_PARENTCOL),   _R(IDS_EDITBH_PARENTCOL) },
00478     { _R(IDC_EDIT_3D),          _R(IDS_EDITBH_3D) },
00479     { _R(IDC_EDIT_MAKESTYLE),   _R(IDS_EDITBH_MAKESTYLE) },
00480     { _R(IDC_EDIT_NOCOLOUR),    _R(IDS_COLBAR_HNOCOLOUR) },
00481     { _R(IDC_EDIT_LINEFILL),    _R(IDS_EDITBH_LINEFILL) },
00482     { _R(IDC_EDIT_216ONLY),     _R(IDS_EDITBH_216ONLY)  },
00483     { _R(IDC_MAKE_LOCAL),       _R(IDS_EDITBH_MAKE_LOCAL)   },
00484     { _R(IDC_EDIT_RENAME),      _R(IDS_COLBAR_HNOCOLOUR) },
00485     { _R(IDC_COLOURPICKER),     _R(IDS_STATICCOLOURPICKERTOOLHELP) },
00486     { 0, 0 }                            // List terminator
00487 };
00488 
00489 
00490 // Two utility functions to get slider sizing right
00491 
00492 INT32 GetSliderHeight(INT32 RectHeight, INT32 Num)
00493 {
00494     INT32 AvailableHeight = (RectHeight / Num) - 4000; // subtract the minimum gap size
00495     if (AvailableHeight<2000)
00496         AvailableHeight = 2000; // minimum height
00497     return (AvailableHeight>18000)?18000:AvailableHeight;
00498 }
00499 
00500 INT32 GetSliderGap(INT32 RectHeight, INT32 Num)
00501 {
00502     INT32 SliderGap = (RectHeight / Num) - GetSliderHeight(RectHeight, Num);
00503     if (SliderGap < 4000)
00504         SliderGap = 4000;
00505     return SliderGap;
00506 }
00507 
00508 
00509 /********************************************************************************************
00510 
00511 >   void ColourEditDlg::LoseKeyboardFocus(void)
00512 
00513     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00514     Created:    19/5/95
00515 
00516     Purpose:    Colour Editor focus bodge thingummy
00517                 Returns the input focus back to the selected document (mainframe window)
00518 
00519 ********************************************************************************************/
00520 
00521 static BOOL TextMayBeWrong = FALSE;                     // Flag indicating that we might need to update
00522                                                         // a component field when losing the keyboard focus
00523 
00524 static BOOL LoseKbdFocusPending = FALSE;                // Flag used to indicate to the OnIdleEvent
00525                                                         // handler that we wish to lose the kbd focus
00526 
00527 static BOOL LockLoseFocus = FALSE;                      // TRUE if focus-losing is locked (we are nto allowed
00528                                                         // to try to throw away the input focus while it's TRUE)
00529 
00530 static BOOL LoseFocusFromEditControls = FALSE;          // TRUE if we should lose the focus if it's inside an
00531                                                         // edit/writable control. Usually FALSE except on commit.
00532 
00533 void ColourEditDlg::LoseKeyboardFocus(void)
00534 {
00535 //  ControlHelper::BubbleHelpDisable();                 // Ensure any open bubble help is killed
00536 
00537     if (!LockLoseFocus)
00538     {
00539         // If we don't want to throw away the focus from edit controls, we'll check for that case
00540         if (!LoseFocusFromEditControls)
00541         {
00542             // AWOOGA! NASTY WINOIL CODE HACK NASTINESS YUCK YUCK YUCK !!!! ****
00543             CWindowID Focus = wxWindow::FindFocus();
00544             if (Focus != NULL)
00545             {
00546                 static UINT32 WritableGadgets[] = 
00547                 {
00548                     _R(IDC_EDIT_COMPONENT1),
00549                     _R(IDC_EDIT_COMPONENT2),
00550                     _R(IDC_EDIT_COMPONENT3),
00551                     _R(IDC_EDIT_COMPONENT4),
00552                     _R(IDC_EDIT_WEBHEX),
00553                     _R(IDC_EDIT_TINT),
00554                     _R(IDC_EDIT_SHADE),
00555                     _R(IDC_COLOURPICKER),
00556                     //_R(IDC_EDIT_216ONLY),
00557                     0
00558                 };
00559 
00560                 // Look to see if the input focus belonhgs to an edit control in our window.
00561                 // If it does, then we won't throw the focus away - we'll return immediately.
00562                 INT32 i = 0;
00563                 while (WritableGadgets[i])
00564                 {
00565                     if (Focus == DialogManager::GetGadget(WindowID, WritableGadgets[i]))
00566                         return;
00567 
00568                     i++;
00569                 }
00570             }
00571         }
00572 
00573         DialogManager::DefaultKeyboardFocus();
00574 
00575         // And ensure that all component gadgets are updated - if the user was editing
00576         // in one, then we need to chop it back to displaying the value to 1 d.p. with a %, etc
00577         if (EditingColour != NULL && TextMayBeWrong)
00578         {
00579             SetComponentInfo(1, _R(IDC_NAME_COMPONENT1), _R(IDC_EDIT_COMPONENT1), _R(IDC_EDIT_INHERIT1));
00580             SetComponentInfo(2, _R(IDC_NAME_COMPONENT2), _R(IDC_EDIT_COMPONENT2), _R(IDC_EDIT_INHERIT2));
00581             SetComponentInfo(3, _R(IDC_NAME_COMPONENT3), _R(IDC_EDIT_COMPONENT3), _R(IDC_EDIT_INHERIT3));
00582             SetComponentInfo(4, _R(IDC_NAME_COMPONENT4), _R(IDC_EDIT_COMPONENT4), _R(IDC_EDIT_INHERIT4));   
00583 
00584             SetAllHexComponentsInfo ((UINT32)-1, _R(IDC_NAME_WEBHEX), _R(IDC_EDIT_WEBHEX));
00585         }
00586 
00587         TextMayBeWrong = FALSE;
00588 
00589         LoseKbdFocusPending = FALSE;        // And clear the pending flag
00590     }
00591 }
00592 
00593 
00594 /********************************************************************************************
00595 
00596 > BOOL ColourEditDlg::SetUnitGroupDefaults(ColourModel ColModel)
00597 
00598     Author:     Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
00599     Created:    02/05/96
00600     Imputs:     ColModel = colour model we're editing (for WEBSTER - markn 9/1/97)
00601     Purpose:    Sets the default ScaleUnits for the Colour Editor (actually sets
00602                 StandardUnit groups.
00603     Errors:     ERROR3 if unable to initialize defaults
00604     Scope:      static
00605     SeeAlso:    class StandardUnit
00606 
00607 ********************************************************************************************/
00608 BOOL ColourEditDlg::SetUnitGroupDefaults(ColourModel ColModel)
00609 {
00610 // WEBSTER - markn 9/1/97
00611 // Rather than get the unit preference from the units tab (which doesn't exist in Webster)
00612 // it chooses between percent ('%') and 0-255 ('d') unit types dependant on the colour model.
00613 // HSV shows its values in '%' format
00614 // RGB shows its values in 0-255 format
00615 //
00616 
00617 #ifdef WEBSTER
00618 // WEBSTER - markn 23/1/97
00619 // We've decided to make both models use percentages as the default unit type
00620     ScaleUnit* pUnit = StandardUnit::PercentGroup.FindUnitFromIndex(0); // percentage '%'
00621 #else
00622     ScaleUnit* pUnit = UnitsTab::GetColourUnitPreference();
00623 #endif // WEBSTER
00624 
00625     if (pUnit == NULL || !pUnit->IS_KIND_OF(ScaleUnit))
00626     {
00627         ERROR3("Failed to get a default unit");
00628         return FALSE;
00629     }
00630     StandardUnit::PercentGroup.SetDefaultUnit(pUnit);
00631 
00632     StandardUnit::AngleGroup.SetDefaultUnit(&StandardUnit::UnitDegree);
00633     return TRUE;
00634 }
00635 
00636 
00637 /********************************************************************************************
00638 
00639 >   ColourEditDlg::ColourEditDlg(): DialogOp(ColourEditDlg::IDD, ColourEditDlg::Mode) 
00640 
00641     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00642     Created:    13/6/94
00643     Inputs:     -
00644     Outputs:    -
00645     Returns:    -
00646     Purpose:    Default constructor for the colour editor dialogue class
00647     Notes:      You shouldn't really use this constructor if you can avoid it
00648     Errors:     -
00649     SeeAlso:    -
00650 
00651 ********************************************************************************************/
00652 
00653 ColourEditDlg::ColourEditDlg(): DialogOp(ColourEditDlg::IDD, ColourEditDlg::Mode) 
00654 {
00655     // If there is no existing editor, make us "the" editor instantiation
00656     // Otherwise, we'll realise our mistake (in Do/DoWithParam) and kill ourself
00657     if (TheEditor == NULL)
00658         TheEditor = this;
00659 
00660     ParentList      = NULL;
00661     ResultColour    = NULL;
00662     EditingColour   = NULL;
00663     ISentTheMessage = FALSE;
00664     AmShaded        = FALSE;
00665 
00666     DragStartArea     = CEDRAG_NONE;
00667     DragUpdatedOnIdle = FALSE;
00668     FirstEdit         = TRUE;
00669 
00670     ResetState();
00671 
00672 // WEBSTER - markn 31/1/97
00673 // Bodge - uses the Named default value to keep that model preserved
00674 #ifndef WEBSTER
00675     DisplayModel    = (ColourModel) DefaultDisplayModel;
00676 #else
00677     DisplayModel    = (ColourModel) DefaultDisplayModelN;
00678 #endif // WEBSTER
00679 
00680     AbortColour = NULL;
00681 
00682     NameDropDown    = NULL;
00683     ParentDropDown  = NULL;
00684 
00685     CurrentCursorID = 0;
00686     CurrentCursor   = NULL;
00687 
00688     m_bDoingSetGadget = FALSE;
00689     m_NeedsResize = FALSE;
00690     GetApplication()->RegisterIdleProcessor(IDLEPRIORITY_LOW, this);
00691 }
00692 
00693 
00694 
00695 /********************************************************************************************
00696 
00697 >   ColourEditDlg::~ColourEditDlg()
00698 
00699     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00700     Created:    13/6/94
00701     Inputs:     -
00702     Outputs:    -
00703     Returns:    -
00704     Purpose:    Destructor for the colour editor dialogue class
00705     Errors:     -
00706     SeeAlso:    -
00707 
00708 ********************************************************************************************/
00709 
00710 ColourEditDlg::~ColourEditDlg()
00711 {
00712     GetApplication()->RemoveIdleProcessor(IDLEPRIORITY_LOW, this);
00713     EndTimedProcessing();
00714 
00715     if (EditingColour != NULL)
00716     {
00717         // Ensure we remember the current model as the preferred default
00718         if (EditingColour->IsNamed())
00719             DefaultDisplayModelN = (INT32) DisplayModel;
00720 // But do not overwrite the preference for local colours - this must be set in the options dlg
00721 //      else
00722 //          DefaultDisplayModel = (INT32) DisplayModel;
00723 
00724         delete EditingColour;
00725     }
00726 
00727     if (AbortColour != NULL)
00728     {
00729         delete AbortColour;
00730         AbortColour = NULL;
00731     }
00732 
00733     // If we were the current active editor instantiation then we indicate there
00734     // is no longer an editor open.
00735     if (TheEditor == this)
00736         TheEditor = NULL;
00737 
00738     // Delete our drop-down colour list support objects
00739     if (NameDropDown != NULL)
00740         delete NameDropDown;
00741 
00742     if (ParentDropDown != NULL)
00743         delete ParentDropDown;
00744 
00745     if (CurrentCursor != NULL)
00746         delete CurrentCursor;
00747 }
00748 
00749 
00750 
00751 /********************************************************************************************
00752 
00753 >   void ColourEditDlg::SetColourNameList(void)
00754 
00755     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00756     Created:    13/12/94
00757     Purpose:    Initialises the colour editor dialogue name combo-box list
00758     Scope:      private
00759 
00760 ********************************************************************************************/
00761 
00762 void ColourEditDlg::SetColourNameList(void)
00763 {
00764     if (State.ParentListOK)
00765         return;
00766 
00767     // Get a description of the current local colour
00768     SelRange *Selection = GetApplication()->FindSelection();
00769 //
00770 //  String_256 SelDesc = Selection->Describe(MENU);
00771 //  String_256 ColourDesc(TEXT("(No selection colour)"));;
00772 //  if (Selection->Count() != 0)
00773 //      ColourDesc._MakeMsg("Colour of #1%s", (TCHAR *)SelDesc);
00774 
00775 
00776     Progress Hourglass;     // Start an hourglass running. On destruction it'll turn it off again
00777 
00778     BOOL OldSentState = ISentTheMessage;
00779     ISentTheMessage = TRUE;
00780 
00781     if (NameDropDown != NULL)
00782         delete NameDropDown;
00783     NameDropDown = new ColourDropDown;
00784 
00785     BOOL ok = TRUE;
00786     if (NameDropDown == NULL || !NameDropDown->Init(WindowID, _R(IDC_EDIT_NAMEMENU)))
00787         ok = FALSE;
00788 
00789     if (ok)
00790     {
00791         String_256 FillColDesc(_R(IDS_COLEDIT_FILL));
00792         String_256 LineColDesc(_R(IDS_COLEDIT_LINE));
00793 
00794         if (Selection->Count() == 0)        // No selection, so will use current colours
00795         {
00796             FillColDesc = String_256(_R(IDS_COLEDIT_CURFILL));
00797             LineColDesc = String_256(_R(IDS_COLEDIT_CURLINE));
00798         }
00799 
00800         // Ensure there are no special entries in the list, then add the 2 we want this time
00801         NameDropDown->ClearAllSpecialEntries();
00802 
00803         ColourList  *NewParentList  = NULL;
00804         DocColour   DocColourToEdit;
00805         ColourManager::FindColourOfInterestToUser(&DocColourToEdit, &NewParentList, FALSE);
00806         
00807         ok = NameDropDown->AddSpecialEntry(&FillColDesc, &DocColourToEdit);
00808         if (ok)
00809         {
00810             ColourManager::FindColourOfInterestToUser(&DocColourToEdit, &NewParentList, TRUE);
00811             ok = NameDropDown->AddSpecialEntry(&LineColDesc, &DocColourToEdit);
00812         }
00813 
00814         if (ok)
00815         {
00816             // Determine if we're editing a named colour, or a current colour
00817             IndexedColour *Ptr = NULL;
00818             if (ParentList != NULL)
00819             {
00820                 Ptr = (IndexedColour *) ParentList->GetHead();
00821                 while (Ptr != NULL)
00822                 {
00823                     if (!Ptr->IsDeleted() && Ptr->IsNamed())
00824                     {
00825                         if (Ptr == ResultColour)
00826                             break;
00827                     }
00828                     Ptr = (IndexedColour *) ParentList->GetNext(Ptr);
00829                 }
00830             }
00831 
00832             // If we aren't editing a named colour (Ptr == NULL) then we're editing fill (0) or line (1) colour
00833             INT32 SelIndex = -1;
00834             if (Ptr == NULL)
00835                 SelIndex = (EditingLineColour) ? 1 : 0;
00836 
00837             // Fill in the list
00838             ok = NameDropDown->FillInColourList(Ptr, SelIndex);
00839 
00840             // NOTE: We could do a SetComboListLength here, except that this causes awful
00841             // redraws of everything "behind" the combo-list extent. I can't stop it doing this,
00842             // other than by not setting the list length... so I don't
00843         }
00844     }
00845 
00846     // If we failed, then we shade this control so that some semblance of stability remains
00847     if (!ok)
00848         EnableGadget(_R(IDC_EDIT_NAMEMENU), FALSE);
00849 
00850 /*
00851     INT32 Index = 0;
00852     INT32 SelectedIndex = 0;
00853 
00854     // Compile a list of all editable colours into the colour name combo-list
00855     GadgetRedraw(_R(IDC_EDIT_NAMEMENU), FALSE);
00856     DeleteAllValues(_R(IDC_EDIT_NAMEMENU));
00857 
00858     String_256 FillColDesc(TEXT("Fill colour"));
00859     String_256 LineColDesc(TEXT("Line colour"));
00860     String_256 DottedLine(TEXT("---------------------------------------"));
00861 
00862     if (Selection->Count() == 0)        // No selection, so will use current colours
00863     {
00864         FillColDesc = TEXT("Current fill colour");
00865         LineColDesc = TEXT("Current line colour");
00866     }
00867 
00868     SetStringGadgetValue(_R(IDC_EDIT_NAMEMENU), &FillColDesc, TRUE);    
00869     SetStringGadgetValue(_R(IDC_EDIT_NAMEMENU), &LineColDesc, TRUE);
00870     SetStringGadgetValue(_R(IDC_EDIT_NAMEMENU), &DottedLine, TRUE);
00871     Index += 3;
00872     if (EditingLineColour)
00873         SelectedIndex++;
00874 
00875     if (ParentList != NULL)
00876     {
00877         IndexedColour *Ptr = (IndexedColour *) ParentList->GetHead();
00878         while (Ptr != NULL)
00879         {
00880             if (!Ptr->IsDeleted() && Ptr->IsNamed())
00881             {
00882                 SetStringGadgetValue(_R(IDC_EDIT_NAMEMENU), Ptr->GetName(), TRUE);
00883                 if (Ptr == ResultColour)
00884                     SelectedIndex = Index;
00885 
00886                 Index++;
00887             }
00888 
00889             Ptr = (IndexedColour *) ParentList->GetNext(Ptr);
00890         }
00891     }
00892 
00893     GadgetRedraw(_R(IDC_EDIT_NAMEMENU), TRUE);
00894 
00895     // Set the writable colour name (combo box editable) field
00896     SetSelectedValueIndex(_R(IDC_EDIT_NAMEMENU), SelectedIndex);
00897 */
00898 
00899     ISentTheMessage = OldSentState;
00900 
00901     State.ParentListOK = TRUE;
00902 }
00903 
00904 
00905 
00906 /********************************************************************************************
00907 
00908 >   void ColourEditDlg::RedrawColourNameList(void)
00909 
00910     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00911     Created:    20/10/95
00912 
00913     Purpose:    Ensures that the colour splodge in the colour name dropdown list is
00914                 redrawn using the correct new appearance of the colour. Far more
00915                 efficient than rebuilding the colour list from scratch.
00916 
00917 ********************************************************************************************/
00918 
00919 void ColourEditDlg::RedrawColourNameList(void)
00920 {
00921     if (NameDropDown == NULL)
00922         return;
00923 
00924     String_256 FillColDesc(_R(IDS_COLEDIT_FILL));
00925     String_256 LineColDesc(_R(IDS_COLEDIT_LINE));
00926 
00927     SelRange *Selection = GetApplication()->FindSelection();
00928     if (Selection->Count() == 0)        // No selection, so will use current colours
00929     {
00930         FillColDesc = String_256(_R(IDS_COLEDIT_CURFILL));
00931         LineColDesc = String_256(_R(IDS_COLEDIT_CURLINE));
00932     }
00933 
00934     ColourList  *NewParentList  = NULL;
00935     DocColour   DocColourToEdit;
00936 
00937     ColourManager::FindColourOfInterestToUser(&DocColourToEdit, &NewParentList, FALSE);
00938     NameDropDown->UpdateSpecialEntry(&FillColDesc, &DocColourToEdit);
00939 
00940     ColourManager::FindColourOfInterestToUser(&DocColourToEdit, &NewParentList, TRUE);
00941     NameDropDown->UpdateSpecialEntry(&LineColDesc, &DocColourToEdit);
00942 
00943     // And ensure that the dropdown is redrawn
00944     InvalidateGadget(_R(IDC_EDIT_NAMEMENU));
00945 }
00946 
00947 
00948 
00949 /********************************************************************************************
00950 
00951 >   void ColourEditDlg::ResetState(void)
00952 
00953     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00954     Created:    23/1/95
00955     Purpose:    Initialises the colour editor dialogue State variable to be 'unknown'.
00956                 The next SetControls() call after this will set all the controls in the
00957                 window, rather than only those which are known to have changed.
00958     Scope:      private
00959 
00960 ********************************************************************************************/
00961 
00962 // We fake a special colour type for shades for the State information *only*
00963 #define COLOURTYPE_SHADE ((IndexedColourType) 32)
00964 
00965 void ColourEditDlg::ResetState(void)
00966 {
00967     State.Folded        = 2;
00968     State.ColType       = (IndexedColourType) 99;   // An invalid value!
00969     State.DisplayModel  = MAX_COLOURMODELS;
00970     State.ResultColour  = NULL;
00971     State.Initialised   = FALSE;
00972     State.ParentListOK  = FALSE;
00973 }
00974 
00975 
00976 
00977 /********************************************************************************************
00978 
00979 >   void ColourEditDlg::SetExtent(void)
00980 
00981     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00982     Created:    23/1/95
00983 
00984     Purpose:    If necessary, changes the size of the editor window and shuffles controls
00985                 around to show folded/unfolded tint/linked information appropriately.
00986                 If the State has not been reset or changed, this may do nothing, to minimise
00987                 unnecessary redraws.
00988 
00989     Scope:      private
00990 
00991 ********************************************************************************************/
00992 
00993 void ColourEditDlg::SetExtent(void)
00994 {
00995     // Set size to small (cut off below 'more' button) or large (full-size) as appropriate
00996     // NOTE that this relies on the gadgets passed to SetWindowExtent being at the
00997     // bottom of the folded/unfolded layouts of the dialogue respectively.
00998 
00999     if (EditingColour == NULL)
01000     {
01001         // WEBSTER - markn 1/2/97
01002         #ifdef WEBSTER
01003         ColourPicker::SetWindowExtent(WindowID, _R(IDC_EDIT_PICKER), _R(IDC_EDIT_PICKER));
01004         #endif // WEBSTER
01005         HideGadget(_R(IDC_EDIT_ADVANCEDPANEL), TRUE);
01006         NeedsResize();
01007         return;
01008     }
01009 
01010     // If there has been no change in the colour type, we should return.
01011     // This is compllicated by shades, which internally are a variant of TINTs, but
01012     // externally are different "types".
01013     IndexedColourType CurrentColType = EditingColour->GetType();
01014     if (CurrentColType == COLOURTYPE_TINT && EditingColour->TintIsShade())
01015         CurrentColType = COLOURTYPE_SHADE;  // Shade is a special "Bodge" colour type
01016 
01017 #ifndef WEBSTER
01018     if (State.Folded == Folded && State.ColType == CurrentColType)
01019         return;
01020 #else
01021     // WEBSTER - markn 24/4/97
01022     // Always unfolded.
01023     Folded = FALSE; // always unfolded
01024 #endif // WEBSTER
01025 
01026     NeedsResize();
01027 
01028     if (Folded)
01029     {       
01030         // WEBSTER - markn 11/12/96
01031         // Always unfolded.
01032         // Changed folded to show ed fields
01033 #ifndef WEBSTER
01034         ColourPicker::SetWindowExtent(WindowID, _R(IDC_EDIT_PICKER), _R(IDC_EDIT_PICKER));
01035         //      SetStringGadgetValue(_R(IDC_EDIT_ADVANCED), _R(IDS_EDIT_MORE));
01036         SetBoolGadgetSelected(_R(IDC_EDIT_ADVANCED), FALSE);
01037 #else
01038         ColourPicker::SetWindowExtent(WindowID, _R(IDC_EDIT_PICKER), _R(IDC_EDIT_COLTYPE));
01039 #endif // WEBSTER
01040         HideGadget(_R(IDC_EDIT_ADVANCEDPANEL), TRUE);
01041     }           
01042     else
01043     {
01044         HideGadget(_R(IDC_EDIT_ADVANCEDPANEL), FALSE);
01045         CGadgetID Gadget = _R(IDC_EDIT_COLTYPE);
01046 
01047         if (EditingColour != NULL)  // If we have an editing colour, set tint/link controls
01048         {
01049             switch (EditingColour->GetType())
01050             {
01051                 case COLOURTYPE_TINT:
01052                     {
01053                         Gadget = _R(IDC_EDIT_TINT);
01054                         HideGadgetList(LinkGadgetIDs, TRUE);
01055                         HideGadgetList(TintGadgetIDs, FALSE);
01056                         HideGadget (_R(IDC_EDIT_PARENTNAME), FALSE);
01057                         HideGadget (_R(IDC_EDIT_PARENTCOL), FALSE);
01058                         // ColourPicker::SetGadgetPositions(WindowID, LinkGadgetIDs, 0);
01059                         // ColourPicker::SetGadgetPositions(WindowID, TintGadgetIDs, _R(IDC_EDIT_PARENTCOL));
01060 
01061                         // And if it's not a shade, hide the extra writable field
01062                         HideGadget(_R(IDC_EDIT_SHADE), !EditingColour->TintIsShade());
01063                         HideGadget(_R(IDC_EDIT_SHADEPERCENT), !EditingColour->TintIsShade());
01064                     }
01065                     break;
01066 
01067                 case COLOURTYPE_LINKED:
01068                     Gadget = _R(IDC_EDIT_INHERIT4);
01069                     HideGadgetList(LinkGadgetIDs, FALSE);
01070                     HideGadgetList(TintGadgetIDs, TRUE);
01071                     HideGadget (_R(IDC_EDIT_PARENTNAME), FALSE);
01072                     HideGadget (_R(IDC_EDIT_PARENTCOL), FALSE);
01073                     // ColourPicker::SetGadgetPositions(WindowID, TintGadgetIDs, 0);
01074                     // ColourPicker::SetGadgetPositions(WindowID, LinkGadgetIDs, _R(IDC_EDIT_PARENTCOL));
01075                     break;
01076 
01077                 default:
01078                     HideGadget (_R(IDC_EDIT_PARENTNAME), TRUE);
01079                     HideGadget (_R(IDC_EDIT_PARENTCOL), TRUE);
01080                     HideGadgetList(LinkGadgetIDs, TRUE);
01081                     HideGadgetList(TintGadgetIDs, TRUE);
01082                     break;
01083             }
01084         }
01085 
01086         ColourPicker::SetWindowExtent(WindowID, _R(IDC_EDIT_PICKER), Gadget);
01087 #ifndef WEBSTER // not included in Webster
01088         SetBoolGadgetSelected(_R(IDC_EDIT_ADVANCED), TRUE);
01089 //      SetStringGadgetValue(_R(IDC_EDIT_ADVANCED), _R(IDS_EDIT_LESS));
01090 #endif
01091     }
01092 
01093 }
01094 
01095 
01096 /********************************************************************************************
01097 
01098 >   void ColourEditDlg::HideGadgetList(CGadgetID * Gadgets, BOOL Hide=TRUE)
01099 
01100     Author:     Alex Bligh
01101     Created:    30/5/2005
01102 
01103     Inputs:     Gadgets - NULL terminated list of gadgets
01104                 Hide - TRUE to hide else FALSE to show
01105 
01106     Purpose:    Hides / shows the gadgets on the list
01107 
01108     Scope:      Protected
01109 
01110 ********************************************************************************************/
01111 
01112 void ColourEditDlg::HideGadgetList(CGadgetID * Gadgets, BOOL Hide /*=TRUE*/)
01113 {
01114     CGadgetID Gadget;
01115     while ((Gadget=*(Gadgets++))) // assignment
01116     {
01117         HideGadget(Gadget, Hide);   
01118     }
01119 }
01120 
01121 /*****************************************************************************
01122 >   BOOL ColourEditDlg::OnIdleEvent()
01123 
01124     Author:     Alex Bligh
01125     Created:    30/5/2005
01126     Purpose:    Idle event handler for the colour dialog
01127                 
01128     Returns:    FALSE (to indicate we want no more idle events)
01129                 The wakeup from the timer will create one for us
01130     Errors:     -
01131 
01132 
01133 *****************************************************************************/
01134 
01135 BOOL ColourEditDlg::OnIdleEvent()
01136 {
01137     return ColourPicker::OnIdleEvent(WindowID);
01138 }
01139 
01140 /********************************************************************************************
01141 
01142 >   void ColourEditDlg::HideOrShowColourPicker()
01143 
01144     Author:     Alex Bligh
01145     Created:    30/5/2005
01146 
01147     Inputs:     -
01148