ColourEditDlg Class Reference

#include <coldlog.h>

Inheritance diagram for ColourEditDlg:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ColourEditDlg ()
 Default constructor for the colour editor dialogue class Notes: You shouldn't really use this constructor if you can avoid it.
 ~ColourEditDlg ()
 Destructor for the colour editor dialogue class.
MsgResult Message (Msg *Message)
 Standard DialogOp message handler, for the Colour Editor dialogue.
void Do (OpDescriptor *MyOpDesc)
 Toggles the colour editor, and if opening it, finds a useful colour to edit.
void DoWithParam (OpDescriptor *MyOpDesc, OpParam *Param)
 'Does' a colour editor dialogue op. Shows the dialogue. Scope: private
BOOL Create ()
 Creates a colour editor dialogue box. Fails if DialogOp::Create fails to create the box.
virtual BOOL TimedProcessing (void)
BOOL UpdateColourEditor ()
 This function was originally was a override of the virtual OnIdle() function and was called whist the process had idle time to spare, which slowed down every other process on the computer. This function was modified and renamed so that it is now called by timer messages at fixed periods.
BOOL StartingPickerDrag ()
BOOL EndingPickerDrag ()
void CloseColourEditor ()
 A public method to close the colour editor dialog Scope: public.
void SetDoTimerProcessing (BOOL Value)
 sets a flag which indicates whether or not the colour picker will do idle processing. If this is set to false the colour picker is effectively disabled. Scope: public
BOOL GetDoTimerProcessing ()
 Access fn. Scope: public.

Static Public Member Functions

static void InvokeDialog (ColourList *ParentList, IndexedColour *ColourToEdit)
 Causes a modeless colour editor to appear for the given colour. Some time down the track, if the user commits a change to that colour, the system will be notified of that change via a ColourChangingMsg broadcast.
static BOOL CanYouEditThis (ColourList *ParentList, IndexedColour *ColourToEdit, BOOL ForceNewMode=FALSE)
 Determines if the colour editor will be happy with you calling InvokeDialog with the given parameters. Allows you to enable/disable any UI mechanism that links onto this method. (e.g. colour line edit colour button uses this to determine if drags can be dropped onto it).
static void ForceLineOrFillMode (BOOL PreferLineColour=FALSE)
 Sets the editing mode for local colours in the future. Whenever a new colour is chosen for editing, this will specify whether a line or fill colour should be chosen by preference.
static BOOL Init ()
 Initialises the colour editor dialogue op.
static OpState GetState (String_256 *, OpDescriptor *)
 Get the state of the Colour editor dialogue op.
static BOOL OnKeyPress (KeyPress *pKeyPress)
 To handle keypresses. This is called by Application::OnKeyPress before all other keypress handling. Normally the colour editor will just return FALSE as fast as possible, but during drags in the editor, it will return TRUE to stop keypresses getting through to the rest of camelot.
static ColourEditDlgGetColourEditDlg ()
static void SetEditingColour (IndexedColour *newEditingColour, Node *pSourceNode=NULL)
 Camelots new custom colour picker control (also written by me) needs to be able to change the value EditingColour on the fly (based upon the IndexedColour that is has just read/generated) so that we do not generate infinite amounts of undo information (which would be so if we always applied the supplied colour). This function allows us to achieve this functionality. Since this function is static, to access non-static member functions from within, we need to use TheEditor->function () otherwise VC6 complains. Scope: public.
static void SetAbortColourState (AbortColourState state)
static void ApplyEditingColourNow (BOOL UseAbortColour=FALSE)
 Camelots new custom colour picker control (also written by me) needs to be able to change the value EditingColour on the fly (based upon the IndexedColour that is has just read/generated) so that we do not generate infinite amounts of undo information (which would be so if we always applied the supplied colour). But we also need to be able to apply the edited colour to the selection when the user has finished dragging my colour picker control. This function allows us to achieve this functionality.
static BOOL DoAbortColourNow (CWindowID colourPicker)
 Allows camelots new custom colour picker control to abort the changing of a colour (by way of the user pressing the escape key). This function simply applies the abort colour (which was already 'saved' within SetEditingColour (). Scope: public.
static void DoHandleNamedcolour ()
static void SetDefaultDisplayModel (INT32 newDisplayModel)
 Camelots new custom colour picker control has changed the way in which the old default colour space stuff worked. If a user selects a colour space on the combobox - then we SHOULD remember this - and NOT jump straight back into the default (i.e. we should now set the selection as the default). We need to do this in two places: 1) internally from within ColourEditDlg::Message (); and 2) when the user sets the defaut model for (local colours) from within the camelot options dialog. This function allows us to achieve the second of these. Scope: public.
static void AbortColourPickerDrag ()
 Terminate the colour picker drag with extreme prejudice (I.e. pass non-zero WPARAM to prevent it calling us back).

Static Public Attributes

static const ResourceID IDD = _R(IDD_COLOUREDITDLG)
static const CDlgMode Mode = MODELESS

Protected Member Functions

OpState GetCommandState (StringBase *Command, StringBase *ShadeReason)
 Upcall from the menu system to determine te state of a menu command.
void DoCommand (StringBase *Command)
 Applies a given editor menu command.
void CloseMyself (void)
 Cleans up, discards data on the colour being edited, and closes the editor window. Used to close the editor in response to different messages, e.g. when the selected document changes, or when the colour is deleted.
void ShadeMyself (BOOL UnShade=FALSE, BOOL OtherGadgetsOnly=FALSE)
 Shades/Unshades the colour editor dialogue. Used to shade the dialogue while there is nothing available to edit, and return it to a useful state when something becomes available for editing.
void SetControls (void)
void SetColourNameList (void)
 Initialises the colour editor dialogue name combo-box list Scope: private.
void RedrawColourNameList (void)
 Ensures that the colour splodge in the colour name dropdown list is redrawn using the correct new appearance of the colour. Far more efficient than rebuilding the colour list from scratch.
void SetExtent (void)
 If necessary, changes the size of the editor window and shuffles controls around to show folded/unfolded tint/linked information appropriately. If the State has not been reset or changed, this may do nothing, to minimise unnecessary redraws.
void InvalidateAndSetControls (void)
 Invalidates all of the GDraw colour-display areas (picker, patch, parent patch) and also calls SetControls to set up all the controls. Called whenever the colour has changed so significantly that the entire window needs to be updated.
void InvalidatePatchGadget (ReDrawInfoType *Info=NULL)
 Invalidates the current colour patch to ensure it is redrawn.
void SetColour (BOOL SetComponents=TRUE)
 Reads the colour definition from the window into the colour which is currently being edited, and broadcasts a colour changing message so everybody knows about the change.
void SetComponentInfo (UINT32 ComponentID, UINT32 NameGadget, UINT32 WritableGadget, UINT32 InheritGadget)
 Finds and sets the component name for one gadget. If the component is not used in the EditingColours colour model, then the name is blanked and the related writable gadget is shaded.
void SetAllHexComponentsInfo (UINT32 ComponentID, UINT32 NameGadget, UINT32 WritableGadget)
 Finds and sets all component names for the hex gadget. This actually gets the individual rgb values, and concatenates into a single string of the form rrggbb for display.
void FindUsefulColourToEdit (BOOL WantLineColour=FALSE, BOOL TheWindowIsOpen=TRUE)
 Calls the ColourManager method (cf SeeAlso) to determine which colour should be displayed in the editor, and swaps to editing this colour (or if no colour is available, shades the editor).
void ApplyNoColour (BOOL LineColour)
 Sets either the fill or the line colour to "No colour".
void LimitTo216Only ()
 Finds the nearest 20% value for this component, e.g. if n=0.23, the result will be 0.2 as this is the closest 20% value.Snaps the current colour to the closest colour in the web browseer palette.
FIXED24 Nearest20Percent (FIXED24 n)
void EditThisColour (ColourList *ParentList, IndexedColour *ColourToEdit, BOOL TheWindowIsOpen=TRUE)
 Switches the colour editor, when it is open, to edit a different colour If the ColourToEdit is the colour currently being edited, nothing happens Scope: protected.
void EditingColourHasChanged (BOOL RedrawControls=TRUE, BOOL RedrawPicker=TRUE, BOOL FastTrackPicker=FALSE, Node *pSourceNode=NULL)
 Generic code to handle changes to EditingColour.
void ApplyColourNow (IndexedColour *ColourToApply)
 Applies the EditingColour to the document selection. Whether named or unnamed, it is applied as a new colour attribute, thus changing the colour used by the selected objects (rather than just redrawing static references to a colour which has been modified).
IndexedColourFindSafeParent (IndexedColour *SuggestedParent, BOOL ChildIsATint)
 Determines a safe parent colour to use for a tint/link colour. If the suggested parent will do, it is returned, otherwise the first safe parent in the ParentList ColourList will be returned.
void CompileParentColourList (CGadgetID TargetGadget)
 Sets up the given combo box gadget to provide a list of all the colours which can be used as a parent of an IndexedColour. This creates the list in the dialogue gadget specified, and selects the appropriate parent (of EditingColour) by default.
IndexedColourDecodeParentColourListSelection (INT32 Index)
 Shared code used by ColourTint and CoourLink Dlgs to decode selctions in the list of colours created by CompileParentColourList.
BOOL OnMakeLocalToFrame ()
 Invokes the OpMakeColourLocalToFrame operation to make local copy of the current edited colour.
BOOL ShouldUngrey (IndexedColour *pCol)
void ResetState (void)
BOOL IsSetGadgetValueCalled () const
BOOL EnteredSetGadgetValue ()
BOOL ExitedSetGadgetValue ()
void RenderCross (RenderRegion *pRender, DocRect *CrossRect, INT32 PixelSize, BOOL Shaded=FALSE)
 Renders a colour picker marker cross (a 'plus' shape).
void RenderParentCross (RenderRegion *pRender, DocRect *CrossRect, INT32 PixelSize)
 Renders a colour picker marker cross (an 'x' shape) to indicate the position of the PARENT colour on the colour's picker. Used for shades and maybe for linked colours if they ever become relative.
void RenderConstraint (RenderRegion *pRender, DocCoord End1, DocCoord End2)
 Renders a colour picker constraint bubble. This is a "sausage" in a straight line around two endpoints, used to mark drag constraints on screen.
void RenderControl (UINT32 GadgetToRender, ReDrawInfoType *RedrawInfo)
 Renders the controls that are kernel-redrawn (The colour 'picker' section, and the two (original and new colour definitions) colour patches).
void RenderPickerHSV (RenderRegion *pRender, DocRect *VirtualSize, INT32 PixelSize, DialogColourInfo *RedrawColours, DocRect *pClipRect)
 Redraws a colour picker control for the colour editor dialogue. This is used in the given display mode to display the colour information in a useful format. e.g. in HSV mode, a wheel and slider arrangement.
void RenderPickerRGB (RenderRegion *pRender, DocRect *VirtualSize, INT32 PixelSize, DialogColourInfo *RedrawColours)
 Redraws a colour picker control for the colour editor dialogue. This is used in the given display mode to display the colour information in a useful format. e.g. in HSV mode, a wheel and slider arrangement.
void RenderPickerCMYK (RenderRegion *pRender, DocRect *VirtualSize, INT32 PixelSize, DialogColourInfo *RedrawColours)
 Redraws a colour picker control for the colour editor dialogue. This is used in the given display mode to display the colour information in a useful format. e.g. in HSV mode, a wheel and slider arrangement.
void RenderPickerDefault (RenderRegion *pRender, DocRect *VirtualSize, INT32 PixelSize, DialogColourInfo *RedrawColours)
 Redraws a colour picker control for the colour editor dialogue. This is used in the given display mode to display the colour information in a useful format. e.g. in HSV mode, a wheel and slider arrangement.
void RenderPickerTint (RenderRegion *pRender, DocRect *VirtualSize, INT32 PixelSize, DialogColourInfo *RedrawColours)
 Redraws a colour picker control for the colour editor dialogue. This is used in the given display mode to display the colour information in a useful format. e.g. in HSV mode, a wheel and slider arrangement.
void RenderPickerShade (RenderRegion *pRender, DocRect *VirtualSize, INT32 PixelSize, DialogColourInfo *RedrawColours, DocRect *pClipRect)
 Redraws a colour picker control for the colour editor dialogue. This is used in the given display mode to display the colour information in a useful format. e.g. in HSV mode, a wheel and slider arrangement.
void RenderPickerSliderH (RenderRegion *pRender, DocRect *SliderRect, INT32 PixelSize, FIXED24 DisplayValue, DocColour *LeftCol, DocColour *RightCol, DocColour *TopLeftCol, DocColour *TopRightCol, BOOL Shaded=FALSE)
 Redraws a horizontal slider in a colour picker control. This generic method is used to draw a slider for a colour component. Generally, the slider will be a linear grad filled rectangle which shades from a colour with that component = 0.0 to 1.0.
void StartDrag (ReDrawInfoType *Info)
 Starts a drag from the colour picker control in the colour editor window.
void UpdateDrag (ReDrawInfoType *Info)
 Updates during a drag from the colour picker control in the colour editor window.
void EndDrag (ReDrawInfoType *Info)
 Ends a drag from the colour picker control in the colour editor window.
void SetNewValueFromMousePos (ReDrawInfoType *Info, BOOL StartingNewDrag)
 Handles drag updates - determines the new colour values from the current mouse position, and sets the colour as appropriate.
void SetNewValueHSV (ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag)
 Handles drag updates - determines the new colour values from the current mouse position, and sets the colour as appropriate. Just how it interprets the mouse position is dependant upon which region the drag was started within, and which DisplayMode is in operation. A different routine like this one will be called for each DisplayMode.
void SetNewValueRGB (ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag)
 Handles drag updates - determines the new colour values from the current mouse position, and sets the colour as appropriate. Just how it interprets the mouse position is dependant upon which region the drag was started within, and which DisplayMode is in operation. A different routine like this one will be called for each DisplayMode.
void SetNewValueCMYK (ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag)
 Handles drag updates - determines the new colour values from the current mouse position, and sets the colour as appropriate. Just how it interprets the mouse position is dependant upon which region the drag was started within, and which DisplayMode is in operation. A different routine like this one will be called for each DisplayMode.
void SetNewValueDefault (ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag)
 Handles drag updates - determines the new colour values from the current mouse position, and sets the colour as appropriate. Just how it interprets the mouse position is dependant upon which region the drag was started within, and which DisplayMode is in operation. A different routine like this one will be called for each DisplayMode.
void SetNewValueTint (ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag)
 Handles drag updates - determines the new colour values from the current mouse position, and sets the colour as appropriate.
void SetNewValueShade (ReDrawInfoType *Info, INT32 PixelSize, BOOL StartingNewDrag)
 Handles drag updates - determines the new colour values from the current mouse position, and sets the colour as appropriate. Just how it interprets the mouse position is dependant upon which region the drag was started within, and which DisplayMode is in operation. A different routine like this one will be called for each DisplayMode.
BOOL HandleIdlePointer (ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp, UINT32 *ControlID)
 Called when the mouse is idling over the colour picker control. Sets appropriate pointer shapes, and also returns bubble help for appropriate regions (probably only the original/current colour patches).
BOOL HandleIdlePointerHSV (ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp)
 Called when the mouse is idling over the colour picker control. Sets appropriate pointer shapes, and also returns bubble help for appropriate regions (probably only the original/current colour patches).
BOOL HandleIdlePointerRGB (ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp)
 Called when the mouse is idling over the colour picker control. Sets appropriate pointer shapes, and also returns bubble help for appropriate regions (probably only the original/current colour patches).
BOOL HandleIdlePointerCMYK (ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp)
 Called when the mouse is idling over the colour picker control. Sets appropriate pointer shapes, and also returns bubble help for appropriate regions (probably only the original/current colour patches).
BOOL HandleIdlePointerDefault (ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp)
 Called when the mouse is idling over the colour picker control. Sets appropriate pointer shapes, and also returns bubble help for appropriate regions (probably only the original/current colour patches).
BOOL HandleIdlePointerTint (ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp)
 Called when the mouse is idling over the colour picker control. Sets appropriate pointer shapes, and also returns bubble help for appropriate regions (probably only the original/current colour patches).
BOOL HandleIdlePointerShade (ReDrawInfoType *Info, String_128 *BubbleHelp, String_256 *StatusHelp)
 Called when the mouse is idling over the colour picker control. Sets appropriate pointer shapes, and also returns bubble help for appropriate regions (probably only the original/current colour patches).
CrossConstraint CalcCrossRectRGB (ColourRGBT *SourceColour, DocRect *SquareRect, INT32 PixelSize, DocRect *Result)
 Determines the 3-D RGB picker cross position for the 2-component picker slice-through-the-cube display.
CrossConstraint CalcCrossRectCMYK (ColourCMYK *SourceColour, DocRect *SquareRect, INT32 PixelSize, DocRect *Result)
 Determines the 3-D CMYK picker cross position for the 2-component picker slice-through-the-cube display.
void SetCursor (UINT32 CursorResID)
 Called by HandleIdlePointerXXX functions to set the cursor shape they desire.
void EndTimedProcessing ()
 Kills the message based timer which is used to call ColourEditDlg::TimedProcessing.
void BeginTimedProcessing ()
 Sets a message based timer which indirectly calls ColourEditDlg::TimedProcessing.
void HideGadgetList (CGadgetID *Gadgets, BOOL Hide=TRUE)
 Hides / shows the gadgets on the list.
void HideOrShowColourPicker ()
 Synchronize state of colour picker gadget.
void CheckDialogSize ()
 Ensure the dialog is a sensible size Scope: Protected.
void NeedsResize ()
virtual BOOL OnIdleEvent ()
 Idle event handler for the colour dialog.

Static Protected Member Functions

static BOOL SetUnitGroupDefaults (ColourModel ColModel)
 Sets the default ScaleUnits for the Colour Editor (actually sets StandardUnit groups.
static BOOL GetColourContext (ColourModel ColModel, ColourContext **ppContext)
 Gets an appropriate colour context for displaying the colour picker This is so that CMYK can use the printer profile.

Protected Attributes

BOOL AmShaded
IndexedColour OriginalColour
IndexedColourResultColour
IndexedColourEditingColour
IndexedColourOriginalEditingColour
ColourListParentList
BOOL NoFillButtonDown
BOOL FirstEdit
BOOL ISentTheMessage
ColourDropDownNameDropDown
ColourDropDownParentDropDown
ColEditDragArea DragStartArea
DocCoord LastDragPos
DocCoord DragAnchor
BOOL DragUpdatedOnIdle
ColourGeneric ColourBeforeDrag
IndexedColourAbortColour
ColEditState State
BOOL m_bDoingSetGadget
UINT32 CurrentCursorID
CursorCurrentCursor
BOOL m_bDoTimerProcessing
BOOL m_NeedsResize

Static Protected Attributes

static INT32 DefaultDisplayModel = (INT32) COLOURMODEL_HSVT
 If TRUE, the colour editor will automatically switch the display colour model whenever it switches to a new LOCAL colour (to that colour's model) If FALSE, the only time the display colour model will change is when the user explicitly sets a different colour model from the dialogue. Notes: Normal preference, available from the options dialogue. If TRUE, the colour editor will automatically switch the display colour model whenever it switches to a new NAMED colour (Colour STYLE) (to that colour's model) If FALSE, the only time the display colour model will change is when the user explicitly sets a different colour model from the dialogue. Notes: Normal preference, available from the options dialogue. Retains a 'memory' of the last used Colour Editor display model between sessions in Camelot. Used for LOCAL COLOURS Notes: Internal 'memory' preference, not directly settable by the user Retains a 'memory' of the last used Colour Editor display model between sessions in Camelot. used for COLOUR STYLES Notes: Internal 'memory' preference, not directly settable by the user Retains a 'memory' of the colour editor 'folded' state between sessions in Camelot. Notes: Internal 'memory' preference, not directly settable by the user Determines if the sliders in the colour editor show a 'split line' display. If FALSE, a simple display is given where each slider just shows the component being set (e.g. in RGB, the Red slider shades between black and red) If TRUE, the split mode is enabled, where the slider shows the normal grad-fill in the top half (black to red), but fills the bottom half with the range of colours which will result from changing that component of the edited colour (i.e. at any point on the slider it shows what colour you will get if you click on that spot) Notes: Secret squirrel preference! THis may become available in the options dialogue if it is decided that it is useful. If FALSE, the RGB/CMYK colour pickers in the colour editor will be simple sliders. If TRUE, the '3d colour cube' display will be used instead If TRUE, the HSV colour picker shows the SV Pane with full hue at the top (as all version did prior to Xara X1) If FALSE, the HSV colour picker shows the SV Pane with full hue at the bottom If TRUE, use print profile to do RGB-CMYK colour conversion.
static INT32 DefaultDisplayModelN = (INT32) COLOURMODEL_HSVT
static INT32 AutoModelChange = FALSE
static INT32 AutoModelChangeN = TRUE
static INT32 Folded = TRUE
static INT32 SplitLineDisplay = FALSE
static INT32 Use3DDisplay = FALSE
static BOOL bHSVHueAtTop = TRUE
static BOOL bUsePrintCMYK = TRUE
static AbortColourState abortColourState
static BOOL EscapeKeyWasPressed = FALSE
static ColourEditDlgTheEditor = NULL
static BOOL EditingLineColour = FALSE
static BOOL UpdateOnNextIdle = FALSE
static ColourModel DisplayModel = COLOURMODEL_HSVT
static INT32 ColourPickerMode = 0
static BOOL resetColPickPos
static RECT colPickOrigRect
static BOOL needColPickHidden
static BOOL colPickHidden

Private Member Functions

BOOL MakeNewNColour (void)
 Moves a lump of code out of the switch statement in the message handler, so it can be executed by the button in Camelot and the menu item in Webster.
BOOL MakeColourASpot (void)
 Moves a lump of code out of the switch statement in the message handler.
void LoseKeyboardFocus (void)

Friends

class ColEditorDragTarget
class ColourPicker
class OpColEditCommand

Detailed Description

Definition at line 214 of file coldlog.h.


Constructor & Destructor Documentation

ColourEditDlg::ColourEditDlg  ) 
 

Default constructor for the colour editor dialogue class Notes: You shouldn't really use this constructor if you can avoid it.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/6/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 653 of file coldlog.cpp.

00653                             : 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 }

ColourEditDlg::~ColourEditDlg  ) 
 

Destructor for the colour editor dialogue class.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/6/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 710 of file coldlog.cpp.

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 }


Member Function Documentation

void ColourEditDlg::AbortColourPickerDrag  )  [static]
 

Terminate the colour picker drag with extreme prejudice (I.e. pass non-zero WPARAM to prevent it calling us back).

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/03/2004
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2229 of file coldlog.cpp.

02230 {
02231     if (TheEditor)
02232         TheEditor->ColourPickerAbort(_R(IDC_COLOURPICKER), 1);
02233 }

void ColourEditDlg::ApplyColourNow IndexedColour IxColourToApply  )  [protected]
 

Applies the EditingColour to the document selection. Whether named or unnamed, it is applied as a new colour attribute, thus changing the colour used by the selected objects (rather than just redrawing static references to a colour which has been modified).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/4/95
Parameters:
IxColourToApply- the colour to be applied [INPUTS]
Make sure that EditingColour is in either the named or unnamed colour list when it is applied, so that the reference is not left pointing a something which can be easily deleted out from under it.

Definition at line 10454 of file coldlog.cpp.

10455 {
10456     // Apply it to the selection as a colour attrib mutator - this will thus affect
10457     // selected objects through selected grad-fill blobs etc
10458     NodeAttribute *Attrib = NULL;
10459     DocColour ColourToApply;
10460     ColourToApply.MakeRefToIndexedColour(IxColourToApply);
10461     if (EditingLineColour)
10462     {
10463         // Apply it as a Line colour mutator
10464         Attrib = new AttrStrokeColourChange;
10465         if (Attrib == NULL)
10466             return;
10467 
10468         ((AttrStrokeColourChange *)Attrib)->SetStartColour(&ColourToApply);
10469     }
10470     else
10471     {
10472         // Apply it as a fill mutator
10473         Attrib = new AttrColourChange;
10474         if (Attrib == NULL)
10475             return;
10476 
10477         ((AttrColourChange *)Attrib)->SetStartColour(&ColourToApply);
10478     }
10479 
10480 
10481     // Apply the attribute. While applying, we lock ourselves so we don't respond to the
10482     // attribute-changing messages, and also ensure that the attribute manager doesn't
10483     // ask the user if they want to set the current attribute (if you're editing the current
10484     // colour, you kindof expect the current colour to change!)
10485     BOOL OldSentState = ISentTheMessage;
10486     ISentTheMessage = TRUE;
10487 
10488         BOOL OldAskState = AttributeManager::AskBeforeSettingCurrentAttr;
10489         AttributeManager::AskBeforeSettingCurrentAttr = FALSE;
10490 
10491             // AttributeSelected knows what to do with a selected attribute
10492             AttributeManager::AttributeSelected(NULL, Attrib); 
10493 
10494         AttributeManager::AskBeforeSettingCurrentAttr = OldAskState;
10495     ISentTheMessage = OldSentState;
10496 }

void ColourEditDlg::ApplyEditingColourNow BOOL  UseAbortColour = FALSE  )  [static]
 

Camelots new custom colour picker control (also written by me) needs to be able to change the value EditingColour on the fly (based upon the IndexedColour that is has just read/generated) so that we do not generate infinite amounts of undo information (which would be so if we always applied the supplied colour). But we also need to be able to apply the edited colour to the selection when the user has finished dragging my colour picker control. This function allows us to achieve this functionality.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/11/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
The function also (directly) applies named colours because of some nastiness that I have found it necessary to treat named colours as unnamed colours; and then revert at the end. Scope: public
Returns:
Errors: -
See also:
ColourEditDlg::SetEditingColour ()

Definition at line 2203 of file coldlog.cpp.

02204 {
02205     if (TheEditor->EditingColour != NULL)
02206     {
02207         TheEditor->SetColour (FALSE);
02208     }
02209 }

void ColourEditDlg::ApplyNoColour BOOL  LineColour  )  [protected]
 

Sets either the fill or the line colour to "No colour".

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/96
Parameters:
LineColour - TRUE if you want to set the line colour, FALSE if you want to set the fill colour [INPUTS]
Needed for WEBSTER

See also:
-

Definition at line 2606 of file coldlog.cpp.

02607 {
02608     DocColour ColourToApply(COLOUR_TRANS);
02609 
02610     if (LineColour)
02611     {
02612         // Line colour selected so create a line colour attribute
02613         AttrStrokeColourChange* pAttrib = new AttrStrokeColourChange;
02614         if (pAttrib == NULL)
02615             return;
02616 
02617         pAttrib->SetStartColour(&ColourToApply);
02618 
02619         // AttributeSelected knows what to do with a selected attribute
02620         AttributeManager::AttributeSelected(NULL, pAttrib); 
02621     }
02622     else
02623     {   
02624         // Rather than setting the flat fill colour, we do an AttrColourChange, which
02625         // (I assume) will handle things like selected grad fill points, etc.
02626         AttrColourChange* pAttrib = new AttrColourChange;
02627         if (pAttrib == NULL)
02628             return;
02629 
02630         pAttrib->SetStartColour(&ColourToApply);
02631 
02632         // AttributeSelected knows what to do with a selected attribute
02633         AttributeManager::AttributeSelected(NULL, pAttrib); 
02634     }
02635 }

void ColourEditDlg::BeginTimedProcessing  )  [protected]
 

Sets a message based timer which indirectly calls ColourEditDlg::TimedProcessing.

Author:
Noel_Someone (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/6/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 11717 of file coldlog.cpp.

CrossConstraint ColourEditDlg::CalcCrossRectCMYK ColourCMYK SourceColour,
DocRect SquareRect,
INT32  PixelSize,
DocRect Result
[protected]
 

Determines the 3-D CMYK picker cross position for the 2-component picker slice-through-the-cube display.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/12/94
Parameters:
SourceColour - the colour definition for which the cross rect must be calc'd [INPUTS] SquareRect - The rect containing th 3-d cube 'slice' to plot the cross in PixelSize - the usual (size of a pixel in millipoints)
Result will be returned containing the CrossRect (in which to draw the cross) [OUTPUTS]
Returns:
A value indicating how the cross is constrained, so you can draw constraint bubbles as appropriate.
See also:
ColourEditDlg::SetNewValueCMYK; ColourEditDlg::RenderPickerCMYK

Definition at line 5781 of file coldlog.cpp.

05783 {
05784     DocRect CrossRect(-CROSSRADIUS, -CROSSRADIUS, CROSSRADIUS, CROSSRADIUS);
05785 
05786     FIXED24 XComponent;
05787     FIXED24 YComponent;
05788     CrossConstraint ReturnVal = CROSSCONSTRAINED_NONE;
05789 
05790     switch(ColourPickerMode)
05791     {
05792         case 1:     // XYZ = Y,M,C
05793             XComponent = SourceColour->Yellow;
05794             YComponent = SourceColour->Magenta;
05795 
05796             if (EditingColour->InheritsComponent(2))
05797                 ReturnVal = CROSSCONSTRAINED_HORZ;
05798                  
05799             if (EditingColour->InheritsComponent(3))
05800             {
05801                 if (ReturnVal == CROSSCONSTRAINED_NONE)
05802                     ReturnVal = CROSSCONSTRAINED_VERT;
05803                 else
05804                     ReturnVal = CROSSCONSTRAINED_BOTH;
05805             }
05806             break;
05807 
05808         case 2:     // XYZ = M,C,Y
05809             XComponent = SourceColour->Magenta;
05810             YComponent = SourceColour->Cyan;
05811 
05812             if (EditingColour->InheritsComponent(1))
05813                 ReturnVal = CROSSCONSTRAINED_HORZ;
05814                  
05815             if (EditingColour->InheritsComponent(2))
05816             {
05817                 if (ReturnVal == CROSSCONSTRAINED_NONE)
05818                     ReturnVal = CROSSCONSTRAINED_VERT;
05819                 else
05820                     ReturnVal = CROSSCONSTRAINED_BOTH;
05821             }
05822             break;
05823 
05824         default:    // XYZ = C,Y,M
05825             XComponent = SourceColour->Cyan;
05826             YComponent = SourceColour->Yellow;
05827 
05828             if (EditingColour->InheritsComponent(3))
05829                 ReturnVal = CROSSCONSTRAINED_HORZ;
05830                  
05831             if (EditingColour->InheritsComponent(1))
05832             {
05833                 if (ReturnVal == CROSSCONSTRAINED_NONE)
05834                     ReturnVal = CROSSCONSTRAINED_VERT;
05835                 else
05836                     ReturnVal = CROSSCONSTRAINED_BOTH;
05837             }
05838             break;
05839     }
05840 
05841     INT32 SizeXY = SquareRect->Height();
05842     INT32 XTrans = (INT32) ((double)SizeXY * XComponent.MakeDouble());
05843     INT32 YTrans = (INT32) ((double)SizeXY * YComponent.MakeDouble());
05844 
05845     // Translate the cross to the appropriate position
05846     CrossRect.Translate(HalfGridLock(SquareRect->lo.x + XTrans, PixelSize),
05847                         HalfGridLock(SquareRect->lo.y + YTrans, PixelSize));
05848 
05849     *Result = CrossRect;
05850 
05851     if (EditingColour->GetType() == COLOURTYPE_TINT)
05852         return(CROSSCONSTRAINED_BOTH);
05853 
05854     return(ReturnVal);
05855 }

CrossConstraint ColourEditDlg::CalcCrossRectRGB ColourRGBT SourceColour,
DocRect SquareRect,
INT32  PixelSize,
DocRect Result
[protected]
 

Determines the 3-D RGB picker cross position for the 2-component picker slice-through-the-cube display.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/12/94
Parameters:
SourceColour - the colour definition for which the cross rect must be calc'd [INPUTS] SquareRect - The rect containing th 3-d cube 'slice' to plot the cross in PixelSize - the usual (size of a pixel in millipoints)
Result will be returned containing the CrossRect (in which to draw the cross) [OUTPUTS]
Returns:
A value indicating how the cross is constrained, so you can draw constraint bubbles as appropriate.
See also:
ColourEditDlg::SetNewValueRGB; ColourEditDlg::RenderPickerRGB

Definition at line 5370 of file coldlog.cpp.

05372 {
05373     DocRect CrossRect(-CROSSRADIUS, -CROSSRADIUS, CROSSRADIUS, CROSSRADIUS);
05374 
05375     FIXED24 XComponent;
05376     FIXED24 YComponent;
05377 
05378     CrossConstraint ReturnVal = CROSSCONSTRAINED_NONE;
05379 
05380     switch(ColourPickerMode)
05381     {
05382         case 1:     // XYZ = R,B,G
05383             XComponent = SourceColour->Red;
05384             YComponent = SourceColour->Blue;
05385 
05386             if (EditingColour->InheritsComponent(3))
05387                 ReturnVal = CROSSCONSTRAINED_HORZ;
05388                  
05389             if (EditingColour->InheritsComponent(1))
05390             {
05391                 if (ReturnVal == CROSSCONSTRAINED_NONE)
05392                     ReturnVal = CROSSCONSTRAINED_VERT;
05393                 else
05394                     ReturnVal = CROSSCONSTRAINED_BOTH;
05395             }
05396             break;
05397 
05398         case 2:     // XYZ = B,G,R
05399             XComponent = SourceColour->Blue;
05400             YComponent = SourceColour->Green;
05401 
05402             if (EditingColour->InheritsComponent(2))
05403                 ReturnVal = CROSSCONSTRAINED_HORZ;
05404                  
05405             if (EditingColour->InheritsComponent(3))
05406             {
05407                 if (ReturnVal == CROSSCONSTRAINED_NONE)
05408                     ReturnVal = CROSSCONSTRAINED_VERT;
05409                 else
05410                     ReturnVal = CROSSCONSTRAINED_BOTH;
05411             }
05412             break;
05413 
05414         default:    // XYZ = G,R,B
05415             XComponent = SourceColour->Green;
05416             YComponent = SourceColour->Red;
05417 
05418             if (EditingColour->InheritsComponent(1))
05419                 ReturnVal = CROSSCONSTRAINED_HORZ;
05420                  
05421             if (EditingColour->InheritsComponent(2))
05422             {
05423                 if (ReturnVal == CROSSCONSTRAINED_NONE)
05424                     ReturnVal = CROSSCONSTRAINED_VERT;
05425                 else
05426                     ReturnVal = CROSSCONSTRAINED_BOTH;
05427             }
05428             break;
05429     }
05430 
05431     INT32 SizeXY = SquareRect->Height();
05432     INT32 XTrans = (INT32) ((double)SizeXY * XComponent.MakeDouble());
05433     INT32 YTrans = (INT32) ((double)SizeXY * YComponent.MakeDouble());
05434 
05435     // Translate the cross to the appropriate position
05436     CrossRect.Translate(HalfGridLock(SquareRect->lo.x + XTrans, PixelSize),
05437                         HalfGridLock(SquareRect->lo.y + YTrans, PixelSize));
05438 
05439     *Result = CrossRect;
05440 
05441     if (EditingColour->GetType() == COLOURTYPE_TINT)
05442         return(CROSSCONSTRAINED_BOTH);
05443 
05444     return(ReturnVal);
05445 }

BOOL ColourEditDlg::CanYouEditThis ColourList ParentList,
IndexedColour ColourToEdit,
BOOL  ForceNewMode = FALSE
[static]
 

Determines if the colour editor will be happy with you calling InvokeDialog with the given parameters. Allows you to enable/disable any UI mechanism that links onto this method. (e.g. colour line edit colour button uses this to determine if drags can be dropped onto it).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/3/96
Parameters:
ParentList - the ColourList in which the colour to be edited resides [INPUTS] May be NULL to use the Selected Document's colour list
ColourToEdit - the IndexedColour which you wish to edit. May be NULL if you just want it to find a useful local colour to edit, in which case it will return TRUE unless there are no documents open.

ForceNewMode - DO NOT USE - this is an internal flag causing side effects (if TRUE, and the colour is local, the return value will be FALSE, and the EditingLineColour member flag will be changed to indicate which colour should be edited - see the InvokeDialog code)

Returns:
TRUE if the colour can be edited. If this returns FALSE, then a call to InvokeDialog with these parameters will fail (specifically, it will revert to editing a "useful" local colour)
Notes: The colour must be in the ParentList Named colours in the ParentList can always be edited Unnamed colours can only be edited if they happen to coincide with the current line or fill colour - otherwise it makes no sense to edit a local colour (because you can only edit a local colour _on_ an object)

See also:
ColourEditDlg::InvokeDialog

Definition at line 10336 of file coldlog.cpp.

10338 {
10339     // If no list specified, assume the one in the selected doc
10340     if (ParentList == NULL)
10341         ParentList = ColourManager::GetColourList();
10342 
10343     // If they specified no colour, then we need to find a "useful" colour to edit.
10344     // This is always possible, except when there are no documents (SelDoc == NULL)
10345     if (ColourToEdit == NULL)
10346         return(Document::GetSelected() != NULL);
10347 
10348     if (ParentList != NULL)
10349     {
10350         if (ColourToEdit->IsNamed())
10351         {
10352             // Named colour
10353             // Check that the colour resides in the given colour list
10354             if (ParentList->FindPosition(ColourToEdit) >= 0)
10355                 return(TRUE);
10356 
10357             ERROR3("CanYouEditThis - Named IndexedColour not in provided ParentList!");
10358         }
10359         else
10360         {
10361             // Local colour
10362             // It is deeply scary to allow local colours to be dragged to the editor.
</