coldlog.h

Go to the documentation of this file.
00001 // $Id: coldlog.h 1282 2006-06-09 09:46:49Z 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 // Declaration of the following classes
00100 //
00101 //  ColourEditDlg       Colour Editor dialogue box
00102 
00103 
00104 #ifndef INC_COLDLOG
00105 #define INC_COLDLOG
00106 
00107 #include "collist.h"
00108 //#include "colordlg.h"     // Winoil dialogue resources
00109 #include "colourix.h"
00110 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 //#include "dragtrgt.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00112 #include "dragcol.h"
00113 
00114 
00115 struct ReDrawInfoType;      // pre-declare Kernel-redraw structure to reduce dependencies
00116 class ColourDropDown;       // Colour drop-down menus
00117 class OpColEditCommand;     // Pop-up menu
00118 class Cursor;
00119 class KeyPress;
00120 class Layer;
00121 class ColourListComponent;
00122 class DialogColourInfo;
00123 
00124 /***********************************************************************************************
00125 
00126 <   ColEditDragArea
00127 
00128     Comment:    This enumerated type describes where the last drag in the colour editor 
00129                 originated. This may be any of the colour patches, or in the colour
00130                 picker display - these gadgets may be further subdivided (e.g. the
00131                 HSV picker subdivides into the H/S colour wheel and the Value slider)
00132 
00133 ***********************************************************************************************/
00134 
00135 typedef enum
00136 {
00137     CEDRAG_NONE,                        // Not dragging
00138 
00139     CEDRAG_DEFAULT_COMPONENT1,          // Dragging a default-picker component slider
00140     CEDRAG_DEFAULT_COMPONENT2,
00141     CEDRAG_DEFAULT_COMPONENT3,
00142     CEDRAG_DEFAULT_COMPONENT4,
00143 
00144     CEDRAG_HSVPICKER_HSWHEEL,           // Dragging the circular HSV picker wheel/slider
00145     CEDRAG_HSVPICKER_VSLIDER,
00146 
00147     CEDRAG_HSVPICKER_HSLIDER,           // Dragging the square HSV picker square/slider
00148     CEDRAG_HSVPICKER_VSSQUARE,
00149 
00150     CEDRAG_RGBPICKER_XY,                // Dragging the RGB picker XY cube face or Z cube side
00151     CEDRAG_RGBPICKER_Z,
00152     CEDRAG_RGBPICKER_BRIGHT,            //    (Brightness slider, if implemented)
00153 
00154     CEDRAG_CMYKPICKER_XY,               // Dragging the CMYK picker XY cube face or Z cube side
00155     CEDRAG_CMYKPICKER_Z,
00156     CEDRAG_CMYKPICKER_KEY,              //    Key slider
00157 
00158     CEDRAG_TINTORSHADE                  // Dragging tint or shade value
00159 } ColEditDragArea;
00160 
00161 
00162 
00163 typedef struct
00164 {
00165     IndexedColourType   ColType;        // The last colour type the editor displayed
00166     INT32               Folded;
00167     ColourModel     DisplayModel;       // The last display model the editor was put in
00168     IndexedColour   *ResultColour;      // The last result colour we were editing
00169     BOOL            Initialised;        // TRUE once the controls have been init'd once
00170     BOOL            ParentListOK;       // TRUE while we believe the parent list is up to date
00171 } ColEditState;
00172 
00173 
00174 
00175 typedef enum                            // Return value indicating degrees of constraint
00176 {
00177     CROSSCONSTRAINED_NONE,
00178     CROSSCONSTRAINED_HORZ,
00179     CROSSCONSTRAINED_VERT,
00180     CROSSCONSTRAINED_BOTH
00181 } CrossConstraint;
00182 
00183 // do we need to set the abort colour?  or have we already set it ....  This is used by the
00184 // custom colour picker control.
00185 
00186 enum AbortColourState { SAVE_ABORTCOLOUR, SAVED_ABORTCOLOUR };
00187 
00188 
00189 
00190 
00191 /***********************************************************************************************
00192 
00193 >   class ColourEditDlg: public DialogOp
00194 
00195     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00196     Created:    13/6/94
00197 
00198     Purpose:    A kernel colour editor dialogue. This is called if necessary
00199                 by the winoil ColourPicker class to provide a colour editor.
00200                 This calls back down into ColourPicker winoil to do some things,
00201                 but this system allows 95% of the code to be kept in the kernel,
00202                 while still allowing ColourPicker to give access to a local OS
00203                 editor if a suitable one is available.
00204     
00205     SeeAlso:    ColourPicker
00206 
00207 ***********************************************************************************************/
00208 
00209 #define OPTOKEN_COLOUREDITDLG _T("ColourPicker")
00210 
00211 #define COLED_TIMER_ID 76
00212 #define COLED_TIMER_FREQUENCY 100
00213 
00214 class ColourEditDlg: public DialogOp
00215 {
00216 friend class ColEditorDragTarget;
00217 friend class ColourPicker;              // Only for BODGE for status line text - see w\colpick.cpp
00218 friend class OpColEditCommand;          // For context sensitive menu stuff
00219 
00220     CC_DECLARE_DYNCREATE(ColourEditDlg)
00221 
00222 public:     // Construction/destruction
00223     ColourEditDlg();
00224     ~ColourEditDlg();
00225 
00226 
00227 public:     // Public interface
00228     static void InvokeDialog(ColourList *ParentList, IndexedColour *ColourToEdit);
00229             // Show the dialogue, and edit the given colour (or if NULL, choose a nice
00230             // local colour to edit)
00231 
00232     static BOOL CanYouEditThis(ColourList *ParentList, IndexedColour *ColourToEdit,
00233                                 BOOL ForceNewMode = FALSE);
00234             // Returns TRUE if the colour editor will accept the given colour for editing.
00235             // If you need to enable/disable UI which calls InvokeDialog(), use this method.
00236             // Do NOT use ForceNewMode - it is an internal parameter which causes side effects!
00237 
00238     static void ForceLineOrFillMode(BOOL PreferLineColour = FALSE);
00239             // Set whether editor will edit line or fill local colours
00240 
00241 
00242 public:     // Overridden DialogOp interfaces
00243     MsgResult Message(Msg *Message);
00244 
00245     void Do(OpDescriptor *MyOpDesc);
00246     void DoWithParam(OpDescriptor *MyOpDesc, OpParam *Param);
00247 
00248     static BOOL Init();
00249     BOOL Create();
00250     static OpState GetState(String_256*, OpDescriptor*);
00251 
00252     static const ResourceID IDD;
00253 
00254     static const CDlgMode Mode;
00255 
00256     virtual BOOL TimedProcessing(void); // Processing which has to be performed at fixed intervals
00257     BOOL UpdateColourEditor ();         // replacement of above
00258 
00259     BOOL StartingPickerDrag();
00260     BOOL EndingPickerDrag();
00261 
00262 private:
00263     BOOL MakeNewNColour(void);          // Internal helper function for Message()
00264     BOOL MakeColourASpot(void);         // Internal helper function for Message()
00265 
00266 
00267 protected:      // Menu upcalls
00268     OpState GetCommandState(StringBase *Command, StringBase *ShadeReason);
00269                         // Determines the (Op)State of the given menu command
00270 
00271     void DoCommand(StringBase *Command);
00272                         // Applies the given menu command
00273 
00274 
00275 public:         // Upcall from Application::OnKeyPress
00276     static BOOL OnKeyPress(KeyPress* pKeyPress);
00277             // Handles a keypress, and swallows all keyboard inputs during drags.
00278 
00279 
00280 protected:      // Preference values
00281     static INT32        DefaultDisplayModel;    // Preference: [0..15] Default display colour model (LOCAL)
00282     static INT32        DefaultDisplayModelN;   // Preference: [0..15] Default display colour model (STYLE)
00283     static INT32        AutoModelChange;        // Preference: TRUE for auto DisplayModel change (LOCAL)
00284     static INT32        AutoModelChangeN;       // Preference: TRUE for auto DisplayModel change (STYLE)
00285     static INT32        Folded;                 // Preference: TRUE if the window is folded
00286     static INT32        SplitLineDisplay;       // Preference: Show sliders in split gradfill way
00287     static INT32        Use3DDisplay;           // Preference: Use 3D displays where available
00288     static BOOL     bHSVHueAtTop;
00289     static BOOL     bUsePrintCMYK;
00290 
00291     static BOOL     SetUnitGroupDefaults(ColourModel ColModel); // Preference: the units for the colour values
00292 
00293     static AbortColourState abortColourState;   // do we need to set the abort colour?  or have
00294                                                 // we already set it ....  This is used by the
00295                                                 // custom colour picker control.
00296     static BOOL     EscapeKeyWasPressed;        // records the fact of whether the escape key has
00297                                                 // been pressed
00298 
00299 public:
00300     /*****************************************************************************************\
00301         
00302         Custom colour picker interface functions
00303 
00304     \*****************************************************************************************/
00305     
00306     // these functions allows camelots custom colour picker control to interface directly
00307     // with the ColourEditDlg ....
00308     
00309     static ColourEditDlg* GetColourEditDlg () { return (TheEditor); }
00310     
00311     static void SetEditingColour (IndexedColour* newEditingColour, Node* pSourceNode = NULL);
00312     static void SetAbortColourState (AbortColourState state) { abortColourState = state; }
00313     
00314     static void ApplyEditingColourNow (BOOL UseAbortColour = FALSE);
00315     static BOOL DoAbortColourNow (CWindowID colourPicker);
00316     static void DoHandleNamedcolour ();
00317 
00318     static void SetDefaultDisplayModel (INT32 newDisplayModel); // really a support function for
00319                                                                 // the colour dialog, BUT
00320                                                                 // solves problems that the
00321                                                                 // above creates
00322 
00323     void CloseColourEditor ();   // closes the dialog
00324 
00325     void SetDoTimerProcessing(BOOL Value);
00326     BOOL GetDoTimerProcessing();
00327 
00328     static void AbortColourPickerDrag();                        // Abort any colour picker drag
00329                                                                 // without trying to apply the colour
00330     /*****************************************************************************************\
00331         
00332         End of custom colour picker interface functions
00333 
00334     \*****************************************************************************************/
00335 
00336 protected:      // Internal data
00337     static ColourEditDlg *TheEditor;    // NULL or points to the one & only colour editor instantiation
00338 
00339     BOOL            AmShaded;           // TRUE if the window is currently shaded
00340 
00341     IndexedColour   OriginalColour;     // The original colour definition (before editing)
00342     IndexedColour   *ResultColour;      // The colour into which the approved result goes
00343     IndexedColour   *EditingColour;     // The colour we're currently editing
00344     IndexedColour   *OriginalEditingColour;     // The colour we're currently editing
00345     ColourList      *ParentList;        // The list in which it resides
00346 
00347     BOOL            NoFillButtonDown;   // we selected a no fill coloured object or press the button
00348     static BOOL     EditingLineColour;  // For unnamed col: Editing line(T) or fill(F)?
00349     BOOL            FirstEdit;          // For unnamed col: We have not changed this colour
00350                                         // at all yet (used to avoid undo on subsequent edits)
00351 
00352     static BOOL     UpdateOnNextIdle;   // To stop update flicker while loading files, etc.
00353                                         // TRUE if the next idle event should also update all window controls
00354 
00355     static ColourModel DisplayModel;    // The model in which the colour is currently being displayed
00356     static INT32        ColourPickerMode;   // (Axis orientation) of the picker, where applicable
00357 
00358     BOOL            ISentTheMessage;    // Lock used to stop us responding to msgs we sent
00359 
00360     ColourDropDown  *NameDropDown;      // Colour drop-down list support for the colour list and
00361     ColourDropDown  *ParentDropDown;    // the parent-colour list
00362 
00363     static BOOL resetColPickPos;        // We need to reset the location of camelots custom
00364                                         // colour picker control depending upon the colour model
00365     static RECT colPickOrigRect;        // Obviously to do this, we need to know where it was
00366                                         // originaly located
00367     static BOOL needColPickHidden;      // Is the custom colour picker control hidden?
00368     static BOOL colPickHidden;          // Is the custom colour picker control hidden?
00369 
00370 protected:      // Drag data
00371     ColEditDragArea DragStartArea;      // Which area of the picker a drag started in
00372                                         // Will be CEDRAG_NONE if we don't think we're dragging
00373     DocCoord        LastDragPos;        // Where the last drag position was, to allow us
00374                                         // to only update if the position changes significantly
00375     DocCoord        DragAnchor;         // Memory of where the drag started (Used relative to the
00376                                         // point being dragged in 3d modes to anchor the Z-slider)
00377 
00378     BOOL            DragUpdatedOnIdle;  // Flag to stop multiple idle events doing multiple updates
00379     ColourGeneric   ColourBeforeDrag;   // Memory of the colour before we dragged, for constrain
00380                                         // (Held in the current display ColourModel)
00381 
00382     IndexedColour   *AbortColour;       // Memory of the colour before drag, for escape-pressed aborts
00383 
00384 
00385 protected:      // Internal methods
00386     void CloseMyself(void);             // Closes the window and tidies up
00387 
00388                                         // Shades/unshades all gadgets in the window
00389     void ShadeMyself(BOOL UnShade = FALSE, BOOL OtherGadgetsOnly = FALSE);
00390 
00391     void SetControls(void);             // Sets the controls up from the colour
00392     
00393     void SetColourNameList(void);       // Sets the name field combobox list
00394 
00395     void RedrawColourNameList(void);    // Ensures that the colour name list shows the correct colour
00396                                         // for the newly edited EditingColour
00397 
00398     void SetExtent(void);               // Sets the extent of the window
00399 
00400     void InvalidateAndSetControls(void);
00401                                         // Sets the controls and redraws GDraw bits
00402 
00403     void InvalidatePatchGadget(ReDrawInfoType *Info = NULL);
00404                                         // Invalidates the current colour patch
00405 
00406     void SetColour(BOOL SetComponents = TRUE);
00407                                         // Reads the colour back from the controls
00408 
00409                                         // Sets and shades/unshades a component name
00410     void SetComponentInfo(UINT32 ComponentID, UINT32 NameGadget,
00411                             UINT32 WritableGadget, UINT32 InheritGadget);
00412                                         // Sets a slider/writable gadget combination
00413 
00414     void SetAllHexComponentsInfo(UINT32 ComponentID, UINT32 NameGadget,
00415                                  UINT32 WritableGadget);
00416                                         // Sets a slider/writable gadget combination (for web-rbgt)
00417 
00418     void FindUsefulColourToEdit(BOOL WantLineColour = FALSE,
00419                                 BOOL TheWindowIsOpen = TRUE);
00420                                         // Finds a useful colour, and 'EditThisColour's it
00421 
00422     //(WEBSTER - markn 14/12/96)
00423     void ApplyNoColour(BOOL LineColour);                    // Applies no colour to the selection 
00424     void LimitTo216Only();                                  // Snaps the colour to the closest colour in the web browser palette
00425     FIXED24 Nearest20Percent(FIXED24 n);        // Helper function for LimitTo216Only()
00426 
00427     void EditThisColour(ColourList *ParentList, IndexedColour *ColourToEdit,
00428                         BOOL TheWindowIsOpen = TRUE);
00429                                         // Switches the editor over to a different colour
00430 
00431     void EditingColourHasChanged(BOOL RedrawControls = TRUE, BOOL RedrawPicker = TRUE,
00432                                     BOOL FastTrackPicker = FALSE,
00433                                     Node* pSourceNode = NULL);
00434                                         // Handles changes to the EditingColour
00435 
00436     void ApplyColourNow(IndexedColour *ColourToApply);
00437                                         // Applies a Colour to the doc selection. USE WITH CARE
00438 
00439     IndexedColour *FindSafeParent(IndexedColour *SuggestedParent, BOOL ChildIsATint);
00440                                         // Determines a safe parent to link EditingColour to
00441 
00442     void CompileParentColourList(CGadgetID TargetGadget);
00443                                         // Compiles a list of potential parents for EditingColour
00444                                         // into a combo box list
00445 
00446     IndexedColour *DecodeParentColourListSelection(INT32 Index);
00447                                         // Decodes a click on the above-mentioned list
00448 
00449     BOOL OnMakeLocalToFrame();
00450     BOOL ShouldUngrey(IndexedColour *pCol);
00451 
00452 protected:      // Current window gadget/extent state (used to minimise unnecessary redraws)
00453     void ResetState(void);              // Resets the current state information to 'unknown'
00454     ColEditState    State;              // Current state of the window
00455 
00456     BOOL    IsSetGadgetValueCalled() const;
00457     BOOL    EnteredSetGadgetValue();
00458     BOOL    ExitedSetGadgetValue();
00459 
00460     BOOL    m_bDoingSetGadget;          // Are we calling SetGadgetValue()?
00461 
00462 protected:      // Kernel-rendered control support methods
00463 
00464     static BOOL GetColourContext(ColourModel ColModel, ColourContext** ppContext);
00465     
00466                                         // Renders a marker cross into a render region
00467     void RenderCross(RenderRegion *pRender, DocRect *CrossRect,
00468                             INT32 PixelSize, BOOL Shaded = FALSE);
00469 
00470                                         // Renders a marker cross for the parent colour
00471     void RenderParentCross(RenderRegion *pRender, DocRect *CrossRect, INT32 PixelSize);
00472 
00473                                         // Renders a constraint "bubble" around End1 and End2
00474     void RenderConstraint(RenderRegion *pRender, DocCoord End1, DocCoord End2);
00475 
00476                                         // Handles rendering of kernel-rendered controls
00477     void RenderControl(UINT32 GadgetToRender, ReDrawInfoType* RedrawInfo);
00478 
00479                                         // Rendering the picker control (for DisplayMode)
00480     void RenderPickerHSV(RenderRegion *pRender, DocRect *VirtualSize,
00481                             INT32 PixelSize, DialogColourInfo *RedrawColours,
00482                             DocRect *pClipRect);
00483 
00484     void RenderPickerRGB(RenderRegion *pRender, DocRect *VirtualSize,
00485                             INT32 PixelSize, DialogColourInfo *RedrawColours);
00486 
00487     void RenderPickerCMYK(RenderRegion *pRender, DocRect *VirtualSize,
00488                             INT32 PixelSize, DialogColourInfo *RedrawColours);
00489 
00490     void RenderPickerDefault(RenderRegion *pRender, DocRect *VirtualSize,
00491                             INT32 PixelSize, DialogColourInfo *RedrawColours);
00492 
00493     void RenderPickerTint(RenderRegion *pRender, DocRect *VirtualSize,
00494                             INT32 PixelSize, DialogColourInfo *RedrawColours);
00495 
00496     void RenderPickerShade(RenderRegion *pRender, DocRect *VirtualSize,
00497                             INT32 PixelSize, DialogColourInfo *RedrawColours,
00498                             DocRect *pClipRect);
00499 
00500     void RenderPickerSliderH(RenderRegion *pRender, DocRect *SliderRect,
00501                                         INT32 PixelSize, FIXED24 DisplayValue,
00502                                         DocColour *LeftCol, DocColour *RightCol,
00503                                         DocColour *TopLeftCol, DocColour *TopRightCol,
00504                                         BOOL Shaded = FALSE);
00505 
00506 
00507 protected:      // Kernel-rendered control click/drag handlers
00508                 // God, this is getting so hideous!
00509                                         // Drag start/continue/end handlers
00510     void StartDrag(ReDrawInfoType *Info);
00511     void UpdateDrag(ReDrawInfoType *Info);
00512     void EndDrag(ReDrawInfoType *Info);
00513     // SeeAlso: OnIdleEvent(), above
00514 
00515                                         // Handles setting new colour values from click/drags
00516     void SetNewValueFromMousePos(ReDrawInfoType *Info, BOOL StartingNewDrag);
00517                                                                                 
00518                                         // Handling click/drags (for DisplayMode)
00519     void SetNewValueHSV(ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag);
00520     void SetNewValueRGB(ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag);
00521     void SetNewValueCMYK(ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag);
00522     void SetNewValueDefault(ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag);
00523     void SetNewValueTint(ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag);
00524     void SetNewValueShade(ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag);
00525 
00526                                         // Handle pointer changes and bubble help
00527     BOOL HandleIdlePointer(ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp, UINT32 *ControlID);
00528     BOOL HandleIdlePointerHSV(ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp);
00529     BOOL HandleIdlePointerRGB(ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp);
00530     BOOL HandleIdlePointerCMYK(ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp);
00531     BOOL HandleIdlePointerDefault(ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp);
00532     BOOL HandleIdlePointerTint(ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp);
00533     BOOL HandleIdlePointerShade(ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp);
00534 
00535                                         // Internal shared cross-position calculations
00536     CrossConstraint CalcCrossRectRGB(ColourRGBT *SourceColour, DocRect *SquareRect, INT32 PixelSize,
00537                                             DocRect *Result);
00538     CrossConstraint CalcCrossRectCMYK(ColourCMYK *SourceColour, DocRect *SquareRect, INT32 PixelSize,
00539                                             DocRect *Result);
00540 
00541                                         // Internal function to specify which cursor shape
00542                                         // should be made active (Called by HandleIdlePointer)
00543                                         // (If not set by HandleIdlePointer, it reverts to arrow)
00544     void SetCursor(UINT32 CursorResID);
00545 
00546 
00547 protected:
00548     void EndTimedProcessing();
00549     void BeginTimedProcessing();
00550     UINT32 CurrentCursorID;             // Current cursor resource identifier (or NULL)
00551     Cursor *CurrentCursor;              // Current cursor object (or NULL)
00552 
00553     BOOL    m_bDoTimerProcessing;     // flag indicates whether or not to do timer processing
00554 
00555     void HideGadgetList(CGadgetID * Gadgets, BOOL Hide=TRUE);
00556     void HideOrShowColourPicker();
00557     void CheckDialogSize();
00558 
00559     BOOL m_NeedsResize;
00560     void NeedsResize() {m_NeedsResize = TRUE;}
00561 
00562     virtual BOOL OnIdleEvent();
00563 
00564 private:
00565     void LoseKeyboardFocus(void);
00566         // Lobs the keyboard focus back into the document
00567 };
00568 
00569 
00570 
00571 /*********************************************************************************************
00572 
00573 >   class   ColEditorDragTarget : public KernelDragTarget
00574 
00575     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00576     Created:    25/3/95
00577 
00578     Purpose:    Handles dragging of colours into the colour editor window.
00579                 Multiple instances of this class are created to handle the different areas
00580                 of the colour editor (which one they are working on is determined from the
00581                 gadget ID for which the target is created)
00582 
00583     Notes:      Drag targets are destructed automatically when a drag finishes by the drag
00584                 manager with which they were registered.
00585 
00586                 To remove a drag target at any time, destruct it - it automatically deregisters
00587                 and cleans up.
00588                 
00589     SeeAlso:    DragManagerOp::StartDrag; DragInformation; DragTarget
00590 
00591     Documentation:  Docs\Specs\DragMan.doc
00592 
00593 *********************************************************************************************/
00594 
00595 class ColEditorDragTarget : public KernelDragTarget
00596 {
00597 friend class DragManagerOp;
00598     
00599 CC_DECLARE_DYNAMIC(ColEditorDragTarget)
00600 
00601 public: // Public interface
00602     ColEditorDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL);
00603     
00604     virtual UINT32 GetCursorID();
00605     virtual BOOL GetStatusLineText(String_256 * TheText);
00606 
00607 protected:
00608     // Process a drag-related event
00609     virtual BOOL ProcessEvent(DragEventType Event,
00610                                 DragInformation *pDragInfo,
00611                                 OilCoord *pMousePos, KeyPress* pKeyPress);
00612 
00613     // Determine if we'll accept a drop here
00614     BOOL CanDropHere(DragInformation *pDragInfo);
00615 };
00616 
00617 
00618 
00619 /********************************************************************************************
00620 
00621 >   class ColEditorDragInfo : public ColourDragInformation
00622 
00623     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00624     Created:    15/10/95
00625     Purpose:    Contains info that a colourdrag may find useful - used for drags
00626                 from the colour editor
00627                 
00628 ********************************************************************************************/
00629 
00630 class ColEditorDragInfo : public ColourDragInformation
00631 {   
00632 CC_DECLARE_DYNCREATE(ColEditorDragInfo)
00633 
00634 public:
00635     ColEditorDragInfo();
00636     ColEditorDragInfo(IndexedColour *Colour, BOOL IsAdjust, Document* pParent);
00637 };
00638 
00639 
00640 
00641 /********************************************************************************************
00642 
00643 >   class CCAPI OpMakeColourLocalToFrame: public UndoableOperation
00644 
00645     Author:     Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
00646     Created:    31/7/97
00647     Purpose:    Operation to create copy of a colour (and its descendants) for the current 
00648                 frame.
00649                 
00650 ********************************************************************************************/
00651 
00652 class CCAPI OpMakeColourLocalToFrame: public UndoableOperation
00653 {
00654     CC_DECLARE_DYNCREATE( OpMakeColourLocalToFrame )
00655 
00656 public:
00657     OpMakeColourLocalToFrame();
00658     ~OpMakeColourLocalToFrame();
00659 
00660     static BOOL     Init();
00661     static OpState  GetState(String_256 *, OpDescriptor *);
00662     void            Do(OpDescriptor *);
00663     void            DoWithParam(OpDescriptor *, OpParam *);
00664     virtual void PerformMergeProcessing() ; 
00665 
00666     virtual BOOL Undo();
00667     virtual BOOL Redo();
00668 
00669 protected:
00670     BOOL ReplaceColourOnActiveLayer(IndexedColour *pOld, IndexedColour *pNew);
00671     BOOL IsColourLocalToFrame(Layer *pTheLayer, IndexedColour *pCol);
00672     IndexedColour *MakeColourLocalToFrame(IndexedColour *pCol);
00673 
00674 protected:  
00675     ColourList      *ParentList;        // The list in which it resides
00676     Document        *pOurDoc;
00677     Layer           *pActiveLayer;
00678     ColourListComponent *ColComp;
00679     Operation       *m_pPreviousOp;
00680 };
00681 
00682 
00683 
00684 
00685 #endif
00686 

Generated on Sat Nov 10 03:44:51 2007 for Camelot by  doxygen 1.4.4