#include <coldlog.h>
Inheritance diagram for ColourEditDlg:

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 ColourEditDlg * | GetColourEditDlg () |
| 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). | |
| IndexedColour * | FindSafeParent (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. | |
| IndexedColour * | DecodeParentColourListSelection (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 |
| IndexedColour * | ResultColour |
| IndexedColour * | EditingColour |
| IndexedColour * | OriginalEditingColour |
| ColourList * | ParentList |
| BOOL | NoFillButtonDown |
| BOOL | FirstEdit |
| BOOL | ISentTheMessage |
| ColourDropDown * | NameDropDown |
| ColourDropDown * | ParentDropDown |
| ColEditDragArea | DragStartArea |
| DocCoord | LastDragPos |
| DocCoord | DragAnchor |
| BOOL | DragUpdatedOnIdle |
| ColourGeneric | ColourBeforeDrag |
| IndexedColour * | AbortColour |
| ColEditState | State |
| BOOL | m_bDoingSetGadget |
| UINT32 | CurrentCursorID |
| Cursor * | CurrentCursor |
| 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 ColourEditDlg * | TheEditor = 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 |
Definition at line 214 of file coldlog.h.
|
|
Default constructor for the colour editor dialogue class Notes: You shouldn't really use this constructor if you can avoid it.
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 }
|
|
|
Destructor for the colour editor dialogue class.
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 }
|
|
|
Terminate the colour picker drag with extreme prejudice (I.e. pass non-zero WPARAM to prevent it calling us back).
Definition at line 2229 of file coldlog.cpp. 02230 { 02231 if (TheEditor) 02232 TheEditor->ColourPickerAbort(_R(IDC_COLOURPICKER), 1); 02233 }
|
|
|
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).
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 }
|
|
|
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.
Definition at line 2203 of file coldlog.cpp. 02204 { 02205 if (TheEditor->EditingColour != NULL) 02206 { 02207 TheEditor->SetColour (FALSE); 02208 } 02209 }
|
|
|
Sets either the fill or the line colour to "No colour".
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 }
|
|
|
Sets a message based timer which indirectly calls ColourEditDlg::TimedProcessing.
Definition at line 11717 of file coldlog.cpp. 11718 { 11719 KillTimer(COLED_TIMER_ID); 11720 SetTimer(COLED_TIMER_ID, COLED_TIMER_FREQUENCY, NULL); 11721 }
|
|
||||||||||||||||||||
|
Determines the 3-D CMYK picker cross position for the 2-component picker slice-through-the-cube display.
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 }
|
|
||||||||||||||||||||
|
Determines the 3-D RGB picker cross position for the 2-component picker slice-through-the-cube display.
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 }
|
|
||||||||||||||||
|
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).
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)
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. 10363 // Local colours do not exist on their own - they can only be edited ON 10364 // an object. The only objects we know of like this are the current selection, 10365 // so we can only edit local line and fill colours. 10366 10367 StatusLine* pStatusLine = StatusLine::Get(); 10368 10369 if (!pStatusLine || (pStatusLine->IsRestrictedAccessToColourPicker () == FALSE)) 10370 { 10371 // Get the current line/fill colours, and see if they match the colour we were asked for 10372 DocColour DocColourToCheck; 10373 10374 // Try for current fill colour 10375 ColourManager::FindColourOfInterestToUser(&DocColourToCheck, NULL, FALSE); 10376 if (DocColourToCheck.FindParentIndexedColour() == ColourToEdit) 10377 { 10378 if (ForceNewMode) 10379 ForceLineOrFillMode(FALSE); // If appropriate, set line/fill mode and return FALSE 10380 else 10381 return(TRUE); 10382 } 10383 10384 // Try for current line colour 10385 ColourManager::FindColourOfInterestToUser(&DocColourToCheck, NULL, TRUE); 10386 if (DocColourToCheck.FindParentIndexedColour() == ColourToEdit) 10387 { 10388 if (ForceNewMode) 10389 ForceLineOrFillMode(TRUE); // If appropriate, set line/fill mode and return FALSE 10390 else 10391 return(TRUE); 10392 } 10393 } 10394 else 10395 { 10396 // the above code may have been valid BEFORE camelots custom colour picker 10397 // control, but NOW we need to allow the colour editor to display/edit 10398 // local index colours .... 10399 10400 return (TRUE); 10401 } 10402 } 10403 } 10404 10405 // For whatever reason, we can't allow this to be edited 10406 return(FALSE); 10407 }
|
|
|
Ensure the dialog is a sensible size Scope: Protected.
Definition at line 1179 of file coldlog.cpp. 01180 { 01181 if (!m_NeedsResize) 01182 return; 01183 01184 m_NeedsResize=FALSE; 01185 01186 // Set up bubble help 01187 ColourPicker::SetBubbleHelp(TintGadgetIDs); 01188 ColourPicker::SetBubbleHelp(LinkGadgetIDs); 01189 ColourPicker::SetBubbleHelp(OtherGadgetIDs); 01190 01191 ColourPicker::RelayoutDialog(WindowID); 01192 }
|
|
|
A public method to close the colour editor dialog Scope: public.
Definition at line 2122 of file coldlog.cpp. 02123 { 02124 CloseMyself(); 02125 }
|
|
|
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.
Definition at line 2488 of file coldlog.cpp. 02489 { 02490 if (EditingColour != NULL) 02491 { 02492 // Ensure we remember the current model as the preferred default 02493 if (EditingColour->IsNamed()) 02494 DefaultDisplayModelN = (INT32) DisplayModel; 02495 // But do not overwrite the preference for local colours - this must be set in the options dlg 02496 // else 02497 // DefaultDisplayModel = (INT32) DisplayModel; 02498 02499 delete EditingColour; 02500 EditingColour = NULL; 02501 } 02502 ParentList = NULL; 02503 State.ParentListOK = FALSE; // Swapping colours - ensure we update parent list 02504 02505 Close(); 02506 End(); 02507 }
|
|
|
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.
Definition at line 10700 of file coldlog.cpp. 10701 { 10702 if (ParentList == NULL || EditingColour == NULL) 10703 return; 10704 10705 if (ParentDropDown != NULL) 10706 delete ParentDropDown; 10707 10708 ParentDropDown = new ColourDropDown; 10709 10710 if (ParentDropDown != NULL) 10711 { 10712 if (ParentDropDown->Init(WindowID, TargetGadget)) 10713 { 10714 if (ParentDropDown->FillInColourList(EditingColour->FindLastLinkedParent(), -1, ResultColour)) 10715 return; 10716 10717 // NOTE: We could do a SetComboListLength here, except that this causes awful 10718 // redraws of everything "behind" the combo-list extent. I can't stop it doing this, 10719 // other than by not setting the list length. 10720 } 10721 } 10722 10723 // We must have failed in order to reach here, so shade the gadget and hang our head in shame 10724 EnableGadget(TargetGadget, FALSE); 10725 }
|
|
|
Creates a colour editor dialogue box. Fails if DialogOp::Create fails to create the box.
Reimplemented from DialogOp. Definition at line 9990 of file coldlog.cpp. 09991 { 09992 ISentTheMessage = FALSE; // Ensure our message lock is disabled 09993 AmShaded = FALSE; // We are not currently in a shaded state 09994 m_bDoTimerProcessing = TRUE; 09995 if (TheEditor != this) // Allow only one instance of this dialogue open at once 09996 return(FALSE); 09997 09998 09999 if (EditingColour != NULL && ParentList == NULL) 10000 { 10001 ERROR3("ColourEditDlg not correctly initialised before call to Create()"); 10002 return(FALSE); 10003 } 10004 10005 if (DialogOp::Create()) 10006 { 10007 // SetControls(); -- now done by DIM_CREATE handler 10008 return(TRUE); 10009 } 10010 10011 return(FALSE); 10012 }
|
|
|
Shared code used by ColourTint and CoourLink Dlgs to decode selctions in the list of colours created by CompileParentColourList.
Definition at line 10748 of file coldlog.cpp. 10749 { 10750 if (ParentList == NULL || EditingColour == NULL) 10751 return(NULL); 10752 10753 if (ParentDropDown != NULL) 10754 return(ParentDropDown->DecodeSelection(Index)); 10755 10756 /* 10757 IndexedColour *Ptr = (IndexedColour *) ParentList->GetHead(); 10758 while (Ptr != NULL) 10759 { 10760 // If this colour is a possible parent: 10761 // * Not deleted 10762 // * Named 10763 // * Not a Spot colour if EditingColour is LINKED 10764 // * Is not a child/descendant of the ResultColour (circular reference! no!) 10765 // (Note that this includes it being the ResultColour) 10766 // then we will add it to the list 10767 10768 if (!Ptr->IsDeleted() && Ptr->IsNamed() && !Ptr->IsADescendantOf(ResultColour)) 10769 { 10770 if (EditingColour->GetType() != COLOURTYPE_LINKED || Ptr->GetType() != COLOURTYPE_SPOT) 10771 { 10772 Index--; 10773 10774 if (Index < 0) 10775 return(Ptr); 10776 } 10777 } 10778 Ptr = (IndexedColour *) ParentList->GetNext(Ptr); 10779 } 10780 */ 10781 return(NULL); // Not found?! 10782 }
|
|
|
Toggles the colour editor, and if opening it, finds a useful colour to edit.
Reimplemented from Operation. Definition at line 10029 of file coldlog.cpp. 10030 { 10031 if (TheEditor != NULL && TheEditor != this) 10032 { 10033 // If there is an editor open, just ask it to die then kill ourself off, as 10034 // we don't want another editor to then pop up! 10035 TheEditor->Close(); 10036 TheEditor->End(); // Kill existing editor 10037 10038 End(); // Kill ourself 10039 return; 10040 } 10041 10042 10043 if (EditingColour != NULL) 10044 { 10045 delete EditingColour; 10046 EditingColour = NULL; 10047 } 10048 10049 // WEBSTER - markn 31/1/97 10050 // Bodge - uses the Named default value to keep that model preserved 10051 #ifndef WEBSTER 10052 DisplayModel = (ColourModel) DefaultDisplayModel; 10053 #else 10054 DisplayModel = (ColourModel) DefaultDisplayModelN; 10055 #endif // WEBSTER 10056 10057 FindUsefulColourToEdit(EditingLineColour, FALSE); 10058 10059 Progress Hourglass; // Start an hourglass running 10060 10061 if (Create()) 10062 { 10063 Open(); // Open the dialogue (& set the controls etc) 10064 PaintGadgetNow(_R(IDC_EDIT_PICKER)); // Redraw picker while hourglass is still up 10065 } 10066 else 10067 End(); 10068 }
|
|
|
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.
Definition at line 2255 of file coldlog.cpp. 02256 { 02257 // firstly, lets check for obvious insanity 02258 02259 String_256 ClassNameStr; // The control type 02260 02261 // Check passed a sensible window ID 02262 if (TheEditor && (TheEditor->WindowID == colourPicker)) 02263 { 02264 // only reset colour if we have a prior one to select (AbortColour). fixes #10649 - 02265 // crash when escape is pressed before the dropper has selected a colour... 02266 if (TheEditor->AbortColour != NULL) 02267 { 02268 if (TheEditor->EditingColour != NULL) 02269 { 02270 delete (TheEditor->EditingColour); 02271 } 02272 TheEditor->EditingColour = new IndexedColour (*(TheEditor->AbortColour)); 02273 ApplyEditingColourNow (TRUE); // this generates two bits of undo - which is undesirable! 02274 } 02275 return (TRUE); 02276 } 02277 02278 ENSURE(FALSE, "DoColourPickerColour called for invalid colour picker control"); 02279 return (FALSE); 02280 }
|
|
|
Applies a given editor menu command.
Definition at line 7248 of file coldlog.cpp. 07249 { 07250 ColourModel NewColourModel = COLOURMODEL_INDEXED; 07251 07252 if (*Command == ColCmd_Help) 07253 HelpUser(*this); 07254 else if (*Command == ColCmd_Name) 07255 { 07256 if (ResultColour != NULL && ParentList != NULL && ResultColour->IsNamed()) 07257 { 07258 // Lock ourselves so we don't update on any message broadcasts 07259 BOOL ISentState = ISentTheMessage; 07260 ISentTheMessage = TRUE; 07261 07262 // Nasty, but ColourNameDlg is in sgcolour 07263 #ifndef EXCLUDE_GALS 07264 // Rename the result colour 07265 if (ColourNameDlg::InvokeDialog(ParentList, ResultColour)) 07266 { 07267 // Commit any colour model change to this colour now 07268 // ColourContext *cc = ColourContext::GetGlobalDefault(DisplayModel); 07269 ColourContext *cc = NULL; 07270 BOOL bDeleteCC = GetColourContext(DisplayModel, &cc); 07271 if (cc != NULL) 07272 { 07273 ColourPicker::ForceColourModel(ResultColour, cc); 07274 07275 // Delete the colour context if necessary 07276 if (bDeleteCC) 07277 ColourContextList::GetList()->RemoveContext(&cc); // Have finished with it 07278 } 07279 07280 // Make sure the editor swaps (it'll ignore us if ResultColour == ColToEdit) 07281 IndexedColour *ColToEdit = ResultColour; 07282 ResultColour = NULL; 07283 07284 // And start the editor up again on the original colour 07285 EditThisColour(ParentList, ColToEdit); 07286 } 07287 #endif 07288 ISentTheMessage = ISentState; 07289 } 07290 } 07291 else if (*Command == ColCmd_EditParent) // Edit parent only available if have parent 07292 { 07293 if (ResultColour != NULL && ParentList != NULL && ResultColour->FindLinkedParent() != NULL) 07294 EditThisColour(ParentList, ResultColour->FindLinkedParent()); 07295 } 07296 else if (*Command == ColCmd_HSV) 07297 NewColourModel = COLOURMODEL_HSVT; 07298 else if (*Command == ColCmd_RGB) 07299 NewColourModel = COLOURMODEL_RGBT; 07300 else if (*Command == ColCmd_CMYK) 07301 NewColourModel = COLOURMODEL_CMYK; 07302 else if (*Command == ColCmd_Grey) 07303 NewColourModel = COLOURMODEL_GREYT; 07304 #ifdef WEBSTER // Martin 16/07/97 07305 else if (*Command == ColCmd_NewNColour) 07306 MakeNewNColour(); //do the same thing as pressing the button! 07307 #endif //WEBSTER 07308 07309 if (NewColourModel != COLOURMODEL_INDEXED && NewColourModel != DisplayModel) 07310 { 07311 DisplayModel = (ColourModel) NewColourModel; // Switch display to the new model 07312 07313 // WEBSTER - markn 31/1/97 07314 // Always set the default colour models to the display mode 07315 #ifndef WEBSTER 07316 if (EditingColour->IsNamed()) 07317 DefaultDisplayModelN = NewColourModel; // And remember preference 07318 #else 07319 DefaultDisplayModelN = NewColourModel; 07320 DefaultDisplayModel = NewColourModel; 07321 #endif // WEBSTER 07322 07323 ColourEditDlg::SetUnitGroupDefaults(DisplayModel); 07324 07325 InvalidateAndSetControls(); // And update the displays 07326 } 07327 }
|
|
|
|
|
||||||||||||
|
'Does' a colour editor dialogue op. Shows the dialogue. Scope: private
Reimplemented from Operation. Definition at line 10089 of file coldlog.cpp. 10090 { 10091 ERROR3IF(Param == NULL, "ColourEditDlg::DoWithParam - NULL Param passed in"); 10092 ERROR3IF(!Param->IsKindOf(CC_RUNTIME_CLASS(ColourEditDlgParam)), 10093 "ColourEditDlg::DoWithParam - Param is illegal"); 10094 10095 // Initialise ourselves from the supplied parameters 10096 ColourEditDlgParam *Info = (ColourEditDlgParam *) Param; 10097 10098 if (Info->ParentList == NULL) 10099 Info->ParentList = ColourManager::GetColourList(); 10100 10101 // Determine if we can safely edit this colour 10102 // NOTE that the TRUE is used to cause side effects on the EditingLineColour flag, 10103 // and we will always edit a colour, even if this function returns FALSE. (But if 10104 // it is FALSE, we will edit a "useful" colour) 10105 if (!CanYouEditThis(Info->ParentList, Info->ColourToEdit, TRUE)) 10106 Info->ColourToEdit = NULL; // You can't do that! Choose a "useful" colour to edit instead 10107 10108 if (TheEditor != NULL && TheEditor != this) 10109 { 10110 // If there is an editor open, bring it to the top of the window stack, and ask it 10111 // to swap to the ColourToEdit, or a useful local colour if ColourToEdit is NULL 10112 TheEditor->BringToTop(); 10113 10114 if (Info->ColourToEdit == NULL) 10115 TheEditor->FindUsefulColourToEdit(TheEditor->EditingLineColour, TRUE); 10116 else 10117 TheEditor->EditThisColour(Info->ParentList, Info->ColourToEdit); 10118 10119 // And kill ourself off, as we don't want multiple instantiations of the editor open 10120 End(); 10121 return; 10122 } 10123 10124 if (Document::GetSelected() == NULL || 10125 (Info->ParentList != NULL && Document::GetSelected()->GetIndexedColours() != Info->ParentList)) 10126 { 10127 ERROR3("Colour editor: No selected doc or Colour not in selected doc"); 10128 End(); 10129 return; 10130 } 10131 10132 // Check that the colour given really truly is in the parent list, but only if we've got a colour/list 10133 if (Info->ColourToEdit != NULL && Info->ParentList != NULL && // Have a valid pointer 10134 Info->ParentList->FindPosition(Info->ColourToEdit) < 0 && // Isn't in named colours 10135 Info->ParentList->GetUnnamedColours()->FindPosition(Info->ColourToEdit) < 0 ) // Isn't in unnamed colours 10136 { 10137 ERROR3("Colour editor: attempt to edit colour with bogus parent list pointer"); 10138 End(); 10139 return; 10140 } 10141 10142 ParentList = Info->ParentList; // The list in which the edited colour resides 10143 ResultColour = Info->ColourToEdit; // The colour to recieve the result 10144 10145 if (EditingColour != NULL) 10146 { 10147 delete EditingColour; 10148 EditingColour = NULL; 10149 } 10150 10151 if (ResultColour != NULL) 10152 { 10153 FirstEdit = TRUE; 10154 EditingColour = new IndexedColour(*ResultColour); // The colour we're working on for now 10155 10156 if (EditingColour == NULL) 10157 { 10158 InformError(); 10159 End(); 10160 return; 10161 } 10162 10163 // Copy the original colour into the OriginalColour. 10164 // We only need the colour definition, but we do need the full accuracy of an 10165 // IndexedColour to ensure rounding errors (and thus slight dither differences in 10166 // redraw) do not occur. 10167 OriginalColour = *ResultColour; 10168 10169 // Ensure the OriginalColour does not reference any other colour 10170 OriginalColour.SetLinkedParent(NULL, COLOURTYPE_NORMAL); 10171 } 10172 else 10173 { 10174 FindUsefulColourToEdit(EditingLineColour, FALSE); 10175 } 10176 10177 if (EditingColour != NULL) 10178 { 10179 StatusLine* pStatusLine = StatusLine::Get(); 10180 10181 if (EditingColour->IsNamed()) 10182 { 10183 if (!pStatusLine || (pStatusLine->IsRestrictedAccessToColourPicker () == FALSE)) 10184 { 10185 if (AutoModelChangeN) 10186 { 10187 DisplayModel = OriginalColour.GetColourModel(); 10188 // WEBSTER - markn 14/1/97 10189 // Make sure the display model is either HSV or RGB 10190 // If it's neither RGB or HSV, force it to HSV 10191 #ifdef WEBSTER 10192 if (DisplayModel != COLOURMODEL_RGBT && DisplayModel != COLOURMODEL_HSVT) 10193 DisplayModel = COLOURMODEL_HSVT; 10194 #endif // WEBSTER 10195 #ifdef DISABLE_WEBHEXRGBT 10196 if (DisplayModel == COLOURMODEL_WEBHEXRGBT) 10197 DisplayModel == COLOURMODEL_RGBT; 10198 #endif 10199 } 10200 } 10201 } 10202 else 10203 { 10204 if (pStatusLine->IsRestrictedAccessToColourPicker () == FALSE) 10205 { 10206 if (AutoModelChange) 10207 DisplayModel = OriginalColour.GetColourModel(); 10208 #ifdef DISABLE_WEBHEXRGBT 10209 if (DisplayModel == COLOURMODEL_WEBHEXRGBT) 10210 DisplayModel == COLOURMODEL_RGBT; 10211 #endif 10212 } 10213 } 10214 } 10215 10216 Progress Hourglass; // Start an hourglass running 10217 10218 if (Create()) 10219 { 10220 Open(); // Open the dialogue (& set the controls etc) 10221 PaintGadgetNow(_R(IDC_EDIT_PICKER)); // Redraw picker while hourglass is still up 10222 } 10223 else 10224 End(); 10225 }
|
|
||||||||||||||||||||
|
Generic code to handle changes to EditingColour.
FastTrackPicker - TRUE if you want the picker section to redraw immediately to get instant-effect on the update.
Definition at line 10527 of file coldlog.cpp. 10530 { 10531 if (EditingColour == NULL) 10532 return; 10533 10534 if (RedrawControls) 10535 { 10536 SetControls(); 10537 RedrawColourNameList(); // And ensure the colour list redraws its colour patch 10538 } 10539 10540 if (RedrawPicker) 10541 { 10542 InvalidateGadget(_R(IDC_EDIT_PICKER)); 10543 10544 if (FastTrackPicker) 10545 PaintGadgetNow(_R(IDC_EDIT_PICKER)); 10546 } 10547 10548 if (EditingColour->IsNamed()) 10549 { 10550 // Apply the change, generating UNDO. This uses 'EditingColour' for an UNDO 10551 // record, so we must not touch/delete EditingColour after this call. 10552 // 10553 // Thus, during processing of the ChangeColour call, it is highly advisable that 10554 // EditingColour does not point at the UndoRecord that we passed in, as any 10555 // re-entrant call to our code could potentially delete EditingColour or apply 10556 // another ChangeColour with the same UNDO buffer! Bad! 10557 // 10558 // NOTE that we copy UndoRecord into the new EditingColour buffer, because 10559 // ResultColour is out of date (it will shortly be changed to be the same as 10560 // the UndoRecord). Obviously, we don't want to suddenly swap the 10561 // definition back to the previous (undo) state of ResultColour; we want it 10562 // to effectively stay exactly as it is now. 10563 IndexedColour *UndoRecord = EditingColour; 10564 EditingColour = new IndexedColour(*UndoRecord); 10565 if (EditingColour == NULL) 10566 InformError(); 10567 10568 // Set the new colour definition, locking out ColourChangingMsgs while it happens 10569 BOOL OldSentState = ISentTheMessage; 10570 ISentTheMessage = TRUE; 10571 ColourManager::ChangeColour(ParentList, UndoRecord, ResultColour, !RedrawPicker); 10572 ISentTheMessage = OldSentState; 10573 } 10574 else 10575 { 10576 if (FirstEdit) 10577 { 10578 // We have not yet changed this colour, so we must add the unnamed colour to 10579 // the colour list, and apply it to the selection. 10580 10581 // Remember the colour to apply, and make a new copy to continue editing 10582 IndexedColour *IxColourToApply = EditingColour; 10583 EditingColour = new IndexedColour(*IxColourToApply); 10584 if (EditingColour == NULL) 10585 InformError(); 10586 10587 // Add the new colour to the list of unnamed colours 10588 ParentList->GetUnnamedColours()->AddTail(IxColourToApply); 10589 10590 // And apply the colour to the selection as a new attribute 10591 ApplyColourNow(IxColourToApply); 10592 10593 // And now remember that we've applied it once, and remember the new resultcol 10594 FirstEdit = FALSE; 10595 ResultColour = IxColourToApply; 10596 10597 // Make the colour list redraw the first time we change a local colour. 10598 // This is necessary because on the first edit, the colour in the list 10599 // (the physical colour pointer, not just the appearance) is changed. 10600 RedrawColourNameList(); 10601 } 10602 else 10603 { 10604 // We are changing the same unnamed colour as last time. Rather than 10605 // applying it to the selection and causing another undo record, we 10606 // want to poke at the first new unnamed colour we added, which conveniently 10607 // happens to be pointed at by 'ResultColour'. 10608 10609 // Copy the new definition into ResultColour 10610 *ResultColour = *EditingColour; 10611 10612 // And redraw the affected parts of the document tree 10613 ColourManager::ColourHasChanged((Document *)ParentList->GetParentDocument(), ParentList, ResultColour); 10614 } 10615 } 10616 }
|
|
||||||||||||||||
|
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.
TheWindowIsOpen - TRUE if the window is believed to be open now, FALSE if it is not. Used by the create handler to stop us from poking at the window when it isn't actually open yet!
Definition at line 1911 of file coldlog.cpp. 01913 { 01914 if (ColourToEdit == ResultColour) // We're already editing it! 01915 return; 01916 01917 if (Document::GetSelected() == NULL || Document::GetSelected()->GetIndexedColours() != NewParentList) 01918 { 01919 ERROR3("Colour editor: No selected doc or Colour not in selected doc"); 01920 return; 01921 } 01922 01923 if (ColourToEdit == NULL) 01924 { 01925 ERROR3("Colour editor EditThisColour: What colour?! It's NULL!"); 01926 return; 01927 } 01928 01929 // Check that the colour given really truly is in the parent list 01930 if (NewParentList != NULL && // Have valid pointers 01931 NewParentList->FindPosition(ColourToEdit) < 0 && // Isn't in named colours 01932 NewParentList->GetUnnamedColours()->FindPosition(ColourToEdit) < 0 ) // Isn't in unnamed colours 01933 { 01934 ERROR3("Colour editor: attempt to edit colour with bogus parent list pointer"); 01935 return; 01936 } 01937 01938 State.ParentListOK = FALSE; // Swapping colours - ensure we update parent list 01939 01940 if (TheWindowIsOpen) // Only poke at the window if it's actually open! 01941 { 01942 if (NewParentList == NULL || ColourToEdit == NULL || ColourToEdit->IsDeleted()) 01943 { 01944 // It's DELETED! Shade the window and exit 01945 ShadeMyself(); 01946 return; 01947 } 01948 01949 ShadeMyself(TRUE, TRUE); // Unshade the window contents 01950 } 01951 01952 ParentList = NewParentList; 01953 01954 if (EditingColour != NULL) 01955 delete EditingColour; 01956 01957 FirstEdit = TRUE; // Remember that we haven't applied this colour yet 01958 01959 EditingColour = new IndexedColour(*ColourToEdit); // The colour we're working on for now 01960 if (EditingColour == NULL) 01961 { 01962 InformError(); 01963 ShadeMyself(); 01964 return; 01965 } 01966 01967 ResultColour = ColourToEdit; // Where the result goes when 'OK'd 01968 01969 // Copy the original colour into the OriginalColour. 01970 // We only need the colour definition, but we do need the full accuracy of an 01971 // IndexedColour to ensure rounding errors (and thus slight dither differences in 01972 // redraw) do not occur. 01973 OriginalColour = *ResultColour; 01974 01975 StatusLine* pStatusLine = StatusLine::Get(); 01976 01977 if (EditingColour->IsNamed()) 01978 { 01979 if (!pStatusLine || !pStatusLine->IsRestrictedAccessToColourPicker ()) 01980 { 01981 if (AutoModelChangeN) 01982 DisplayModel = OriginalColour.GetColourModel(); 01983 else 01984 DisplayModel = (ColourModel) DefaultDisplayModelN; 01985 } 01986 } 01987 else 01988 { 01989 if (!pStatusLine || !pStatusLine->IsRestrictedAccessToColourPicker ()) 01990 { 01991 if (AutoModelChange) 01992 DisplayModel = OriginalColour.GetColourModel(); 01993 else 01994 DisplayModel = (ColourModel) DefaultDisplayModel; 01995 } 01996 } 01997 // WEBSTER - markn 14/1/97 01998 // Make sure the display model is either HSV or RGB 01999 // If it's neither RGB or HSV, force it to HSV 02000 #ifdef WEBSTER 02001 if (DisplayModel != COLOURMODEL_RGBT && DisplayModel != COLOURMODEL_HSVT) 02002 DisplayModel = COLOURMODEL_HSVT; 02003 #endif // WEBSTER 02004 02005 // Ensure the OriginalColour does not reference any other colour 02006 OriginalColour.SetLinkedParent(NULL, COLOURTYPE_NORMAL); 02007 02008 if (TheWindowIsOpen) 02009 InvalidateAndSetControls(); 02010 }
|
|
|
Ends a drag from the colour picker control in the colour editor window.
Definition at line 7391 of file coldlog.cpp. 07392 { 07393 // Only update if we think we're dragging (as for the other Drag methods) 07394 // However, if the last update was on an idle event, then the mouse has not moved 07395 // and so the colour has not changed since we last broadcast, so there is no 07396 // need to broadcast again, with all the flickery redraw etc. that will cause 07397 if (DragStartArea != CEDRAG_NONE && EditingColour != NULL && !DragUpdatedOnIdle) 07398 { 07399 // EndTimedProcessing (); 07400 07401 SetNewValueFromMousePos(Info, FALSE); // Update colour one last time 07402 07403 if (CanSetColour(EditingColour) || EditingColour->GetType() == COLOURTYPE_TINT) 07404 EditingColourHasChanged(TRUE, TRUE, TRUE); // Ensure window etc fully updated 07405 } 07406 07407 DragUpdatedOnIdle = FALSE; 07408 // GetApplication()->RemoveIdleProcessor(IDLEPRIORITY_HIGH, this); // Leave idles on for bubblehelp 07409 DragStartArea = CEDRAG_NONE; // We aren't dragging any more 07410 07411 if (AbortColour != NULL) 07412 { 07413 delete AbortColour; 07414 AbortColour= NULL; 07415 } 07416 }
|
|
|
|
|
|
Kills the message based timer which is used to call ColourEditDlg::TimedProcessing.
Definition at line 11737 of file coldlog.cpp. 11738 { 11739 KillTimer(COLED_TIMER_ID); 11740 }
|
|
|
Definition at line 10793 of file coldlog.cpp. 10794 { 10795 m_bDoingSetGadget = TRUE; 10796 return FALSE; 10797 }
|
|
|
Definition at line 10799 of file coldlog.cpp. 10800 { 10801 m_bDoingSetGadget = FALSE; 10802 return TRUE; 10803 }
|
|
||||||||||||
|
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.
Quietly ignores calls when EditingColour == NULL Definition at line 10644 of file coldlog.cpp. 10645 { 10646 if (ParentList == NULL || EditingColour == NULL || ResultColour == NULL) 10647 return(NULL); 10648 10649 if (SuggestedParent != NULL) 10650 { 10651 // The caller has suggested a colour - is it safe to use it? 10652 // Conditions are: 10653 // Not deleted 10654 // Must be a named colour 10655 // Must not be a descendant of the ResultColour (avoid circular references) 10656 // Spot colours may only have tints as children 10657 if (SuggestedParent->IsDeleted() || !SuggestedParent->IsNamed() || 10658 SuggestedParent->IsADescendantOf(ResultColour)) 10659 { 10660 SuggestedParent = NULL; 10661 } 10662 } 10663 10664 if (SuggestedParent != NULL) // SuggestedParent passed the test: let 'em use it 10665 return(SuggestedParent); 10666 10667 IndexedColour *Ptr = (IndexedColour *) ParentList->GetHead(); 10668 while (Ptr != NULL) 10669 { 10670 if (!Ptr->IsDeleted() && Ptr->IsNamed() && !Ptr->IsADescendantOf(ResultColour)) 10671 return(Ptr); 10672 10673 Ptr = (IndexedColour *) ParentList->GetNext(Ptr); 10674 } 10675 10676 return(NULL); 10677 }
|
|
||||||||||||
|
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).
Definition at line 2758 of file coldlog.cpp. 02759 { 02760 State.ParentListOK = FALSE; // Swapping colours - ensure we update parent list 02761 02762 ColourList *NewParentList = NULL; 02763 IndexedColour *IxColourToEdit = NULL; 02764 DocColour DocColourToEdit; 02765 02766 EditingLineColour = WantLineColour; // Remember whether editing line or fill 02767 02768 ColourManager::FindColourOfInterestToUser(&DocColourToEdit, &NewParentList, WantLineColour); 02769 02770 if (NewParentList == NULL) 02771 { 02772 if (TheWindowIsOpen) 02773 ShadeMyself(); 02774 } 02775 else 02776 { 02777 NoFillButtonDown = DocColourToEdit.IsTransparent(); 02778 02779 if (NoFillButtonDown) 02780 { 02781 AttributeManager &AttrMgr = Document::GetSelected()->GetAttributeMgr(); 02782 02783 DocColour LineCol; 02784 DocColour FillCol; 02785 02786 AttrMgr.GetCurrentLineAndFillColour(CC_RUNTIME_CLASS(NodeRenderableInk), 02787 &LineCol, &FillCol); 02788 if (WantLineColour) 02789 DocColourToEdit = LineCol; 02790 else 02791 DocColourToEdit = FillCol; 02792 02793 // if the default is no fill DON'T set that because this is the colour we get 02794 // when we are explicitly removing no fill 02795 if ( DocColourToEdit.IsTransparent() ) 02796 DocColourToEdit = DocColour(COLOUR_WHITE);//prob should set to page colour 02797 } 02798 IxColourToEdit = ColourManager::GenerateNewUnnamedColour(NewParentList, &DocColourToEdit); 02799 02800 if (EditingColour == NULL || IxColourToEdit != NULL) 02801 EditThisColour(NewParentList, IxColourToEdit, TheWindowIsOpen); 02802 else 02803 { 02804 if (TheWindowIsOpen) 02805 ShadeMyself(); 02806 } 02807 } 02808 }
|
|
|
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.
Definition at line 10427 of file coldlog.cpp. 10428 { 10429 EditingLineColour = PreferLineColour; 10430 }
|
|
||||||||||||
|
Gets an appropriate colour context for displaying the colour picker This is so that CMYK can use the printer profile.
Definition at line 11759 of file coldlog.cpp. 11760 { 11761 // If we want a CMYK context then try to set one up with the printer profile 11762 if (ColourEditDlg::bUsePrintCMYK && ColModel == COLOURMODEL_CMYK) 11763 { 11764 PORTNOTE("other", "Disabled CMS usage") 11765 #ifndef EXCLUDE_FROM_XARALX 11766 ColourContext *pContext; 11767 11768 XaraCMS* ptheCMS = GetApplication()->GetCMSManager(); 11769 11770 if (ptheCMS != NULL) 11771 { 11772 // First try to set the printer context specified in the ini file read 11773 // when we started up 11774 String_256 PrintProfile; 11775 ptheCMS->GetPrinterProfile(&PrintProfile); 11776 pContext = new ColourContextCMYK(NULL, &PrintProfile); 11777 11778 if (pContext == NULL || !(pContext->IsDeviceContext())) 11779 { 11780 // Eeek, we failed to build the physical device context 11781 // which means something rather nasty went on. 11782 11783 delete pContext; 11784 pContext=NULL; 11785 11786 // Now try with the default printer profile 11787 ptheCMS->GetDefaultPrinterProfile(&PrintProfile); 11788 pContext = new ColourContextCMYK(NULL, &PrintProfile); 11789 11790 if (pContext == NULL || !(pContext->IsDeviceContext())) 11791 { 11792 // We failed to get the default printer profile so delete the context and fall through 11793 delete pContext; 11794 pContext=NULL; 11795 } 11796 } 11797 11798 if (pContext) 11799 { 11800 ColourContextList::GetList()->AddContext(&pContext); // Add it to the list so it works properly 11801 *ppContext = pContext; 11802 return(TRUE); 11803 } 11804 } 11805 #endif 11806 } 11807 11808 // Otherwise just fall back to getting a default context for the required model 11809 *ppContext = ColourContext::GetGlobalDefault(ColModel); 11810 return(FALSE); 11811 }
|
|
|
\ Custom colour picker interface functions Definition at line 309 of file coldlog.h. 00309 { return (TheEditor); }
|
|
||||||||||||
|
Upcall from the menu system to determine te state of a menu command.
Definition at line 7201 of file coldlog.cpp. 07202 { 07203 OpState State; 07204 07205 if (*Command == ColCmd_Name) // Name only available for named colour 07206 { 07207 if (ResultColour == NULL || ParentList == NULL || !ResultColour->IsNamed()) 07208 { 07209 State.Greyed = TRUE; 07210 ShadeReason->MakeMsg(_R(IDS_K_COLDLOG_NONAMELOCCOLS)); 07211 } 07212 } 07213 else if (*Command == ColCmd_EditParent) // Edit parent only available if have parent 07214 { 07215 if (ResultColour == NULL || ParentList == NULL || ResultColour->FindLinkedParent() == NULL) 07216 { 07217 State.Greyed = TRUE; 07218 ShadeReason->MakeMsg(_R(IDS_COLMENU_NOPARENT)); 07219 } 07220 } 07221 else if (*Command == ColCmd_HSV) // Tick appropriate colour model 07222 State.Ticked = (DisplayModel == COLOURMODEL_HSVT); 07223 else if (*Command == ColCmd_RGB) 07224 State.Ticked = (DisplayModel == COLOURMODEL_RGBT); 07225 else if (*Command == ColCmd_CMYK) 07226 State.Ticked = (DisplayModel == COLOURMODEL_CMYK); 07227 else if (*Command == ColCmd_Grey) 07228 State.Ticked = (DisplayModel == COLOURMODEL_GREYT); 07229 07230 return(State); 07231 }
|
|
|
Access fn. Scope: public.
Definition at line 2172 of file coldlog.cpp. 02173 { 02174 return m_bDoTimerProcessing; 02175 }
|
|
||||||||||||
|
Get the state of the Colour editor dialogue op.
Definition at line 9881 of file coldlog.cpp. 09882 { 09883 OpState OpSt; 09884 09885 // Tick the menu while the editor is open 09886 if (TheEditor != NULL) 09887 OpSt.Ticked = TRUE; 09888 09889 return(OpSt); 09890 }
|
|
||||||||||||||||||||
|
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).
ControlID - Returned with a unique "control" ID number for the "control" which the pointer is over. Currently this means _R(IDC_EDIT_PATCH1) or _R(IDC_EDIT_PATCH2), which are not real controls, but fake ones just to get a unique ID number for the current/original colour patches.
Definition at line 9163 of file coldlog.cpp. 09165 { 09166 BOOL Result = FALSE; 09167 09168 ERROR3IF(Info == NULL || BubbleHelp == NULL || ControlID == NULL, "Illegal NULL params"); 09169 09170 // Return a valid string no matter what happens 09171 *BubbleHelp = String_128(_T("")); 09172 *StatusHelp = String_256(_T("")); 09173 *ControlID = 0; // No bubble help "control" 09174 09175 if (EditingColour == NULL || AmShaded) // We are shaded - abort 09176 return(FALSE); 09177 09178 // Reset the cursor ID to none. If nobody changes this before the end of this function, 09179 // then the cursor will reset to the default (arrow or whatever). See SetCursor 09180 // UINT32 OldCurrentCursor = CurrentCursorID; 09181 CurrentCursorID = 0; 09182 09183 // First, calculate all the regions and stuff... 09184 INT32 PixelSize = 72000 / Info->Dpi; // Size of output pixel in millipoints 09185 09186 09187 // If the pointer is over the colour patches then handle it and return immediately, without 09188 // passing the call onto the specific picker. 09189 // if (pointer in the current/original colour patches) 09190 // Set up bubble help 09191 // Change pointer? 09192 // return(TRUE); 09193 DocRect VirtualSize(0, 0, Info->dx, Info->dy); 09194 VirtualSize.Inflate(-PixelSize * 4); 09195 09196 // Now draw the original/current colour patch in the top right corner 09197 DocRect PatchRect(VirtualSize); 09198 PatchRect.lo.x = PatchRect.hi.x - PATCHSIZE; 09199 PatchRect.lo.y = PatchRect.hi.y - PATCHSIZE; 09200 GridLockRect(&PatchRect, PixelSize); 09201 09202 // Patches are horizontal if the colour model is not HSV 09203 BOOL HorzPatch = (DisplayModel != COLOURMODEL_HSVT); 09204 09205 // But this setting is overridden for the special tint and shade modes 09206 if (EditingColour != NULL && EditingColour->GetType() == COLOURTYPE_TINT) 09207 { 09208 if (EditingColour->TintIsShade()) 09209 HorzPatch = FALSE; 09210 else 09211 HorzPatch = TRUE; 09212 } 09213 09214 { 09215 INT32 OverWhat = 0; 09216 09217 if (PatchRect.ContainsCoord(*(Info->pMousePos))) 09218 { 09219 if (HorzPatch) 09220 OverWhat = 1; 09221 else 09222 OverWhat = 2; 09223 } 09224 else 09225 { 09226 if (HorzPatch) 09227 PatchRect.Translate(-PATCHSIZE, 0); 09228 else 09229 PatchRect.Translate(0, -PATCHSIZE); 09230 09231 if (PatchRect.ContainsCoord(*(Info->pMousePos))) 09232 { 09233 if (HorzPatch) 09234 OverWhat = 2; 09235 else 09236 OverWhat = 1; 09237 } 09238 } 09239 09240 if (OverWhat != 0) 09241 { 09242 if (OverWhat == 1) 09243 { 09244 BubbleHelp->MakeMsg(_R(IDS_K_COLDLOG_CURRCOLBBL)); 09245 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CURRCOLSTAT)); 09246 *ControlID = _R(IDC_EDIT_PATCH1); 09247 } 09248 else 09249 { 09250 BubbleHelp->MakeMsg(_R(IDS_K_COLDLOG_ORIGCOLBBL)); 09251 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_ORIGCOLSTAT)); 09252 *ControlID = _R(IDC_EDIT_PATCH2); 09253 } 09254 09255 Result = TRUE; 09256 } 09257 } 09258 09259 // Finally, if we haven't sorted ourselves out, call the relevant colour picker handler 09260 // for the current display mode etc 09261 09262 if (BubbleHelp->IsEmpty()) 09263 { 09264 if (EditingColour->GetType() == COLOURTYPE_TINT) 09265 { 09266 if (EditingColour->TintIsShade()) 09267 Result = HandleIdlePointerShade(Info, BubbleHelp, StatusHelp); 09268 else 09269 Result = HandleIdlePointerTint(Info, BubbleHelp, StatusHelp); 09270 } 09271 else 09272 { 09273 switch (DisplayModel) 09274 { 09275 case COLOURMODEL_HSVT: 09276 Result = HandleIdlePointerHSV(Info, BubbleHelp, StatusHelp); 09277 break; 09278 09279 case COLOURMODEL_RGBT: 09280 case COLOURMODEL_WEBRGBT: 09281 // RGB has the ability to change display modes, even when the colour is uneditable 09282 // so we call the handler even when CanSetColour() == FALSE 09283 if (Use3DDisplay) 09284 Result = HandleIdlePointerRGB(Info, BubbleHelp, StatusHelp); 09285 else 09286 Result = HandleIdlePointerDefault(Info, BubbleHelp, StatusHelp); 09287 break; 09288 09289 case COLOURMODEL_CMYK: 09290 // CMYK has the ability to change display modes, even when the colour is uneditable 09291 // so we call the handler even when CanSetColour() == FALSE 09292 if (Use3DDisplay) 09293 Result = HandleIdlePointerCMYK(Info, BubbleHelp, StatusHelp); 09294 else 09295 Result = HandleIdlePointerDefault(Info, BubbleHelp, StatusHelp); 09296 break; 09297 09298 default: 09299 Result = HandleIdlePointerDefault(Info, BubbleHelp, StatusHelp); 09300 break; 09301 } 09302 } 09303 } 09304 09305 // Last, set the appropriate cursor shape 09306 /* 09307 if (OldCurrentCursor != CurrentCursorID) 09308 { 09309 TRACEUSER( "Jason", _T("Cursor Change=%ld to %ld\n"), OldCurrentCursor, CurrentCursorID); 09310 if (CurrentCursor != NULL) 09311 { 09312 delete CurrentCursor; 09313 CurrentCursor = NULL; 09314 } 09315 09316 if (CurrentCursorID != NULL) 09317 { 09318 CurrentCursor = new Cursor(CurrentCursorID); 09319 if (CurrentCursor != NULL) 09320 CurrentCursor->SetActive(); 09321 } 09322 else 09323 { 09324 if (Cursor::Arrow != NULL) 09325 Cursor::Arrow->SetActive(); 09326 } 09327 } 09328 */ 09329 return(Result); 09330 }
|
|
||||||||||||||||
|
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).
Definition at line 9573 of file coldlog.cpp. 09574 { 09575 INT32 PixelSize = 72000 / Info->Dpi; // Size of output pixel in millipoints 09576 09577 DocRect VirtualSize(0, 0, Info->dx, Info->dy); 09578 VirtualSize.Inflate(-PixelSize * 4); // And exclude the border 09579 09580 // Determine how much space is left over after the key slider has been placed 09581 INT32 KeySliderLeft = VirtualSize.hi.x - (CROSSRADIUS+PixelSize)*2; 09582 ERROR3IF(KeySliderLeft < VirtualSize.lo.x, 09583 "Not enough room to render the colour picker!"); 09584 09585 // Fill the control background, and draw the cube 'shadow' 09586 DocRect CubeAvailableSpace(VirtualSize); 09587 CubeAvailableSpace.hi.x = KeySliderLeft - 2000; 09588 09589 DocRect SquareRect; 09590 INT32 SizeZ; 09591 DrawCubeShadowAndCalcValues(NULL, &CubeAvailableSpace, PixelSize, NULL, 09592 &SquareRect, &SizeZ); 09593 09594 DocRect CubeFaceRect(SquareRect); // Remember the rect of the front face for below 09595 09596 09597 // Now, shift the square down from the front of the cube by an amount appropriate to 09598 // the Z-axis component of the colour 09599 // ColourContextCMYK *cc = (ColourContextCMYK *)ColourContext::GetGlobalDefault(COLOURMODEL_CMYK); 09600 ColourContext *cc = NULL; 09601 BOOL bDeleteCC = GetColourContext(DisplayModel, &cc); 09602 ColourCMYK SourceColour; 09603 09604 if (EditingColour != NULL) 09605 cc->ConvertColour(EditingColour, (ColourGeneric *) &SourceColour); 09606 09607 // Delete the colour context if necessary 09608 if (bDeleteCC) 09609 ColourContextList::GetList()->RemoveContext(&cc); // Have finished with it 09610 09611 if (CanSetColour(EditingColour)) 09612 { 09613 FIXED24 ZComponent = SourceColour.Magenta; 09614 if (ColourPickerMode == 1) 09615 ZComponent = SourceColour.Cyan; 09616 else if (ColourPickerMode == 2) 09617 ZComponent = SourceColour.Yellow; 09618 09619 INT32 ZTrans = (INT32) ((double)SizeZ * ZComponent.MakeDouble()) - SizeZ; 09620 SquareRect.Translate(-ZTrans, ZTrans); 09621 GridLockRect(&SquareRect, PixelSize); 09622 } 09623 09624 DocCoord BitmapPos; 09625 BitmapPos.x = HalfGridLock(CubeFaceRect.hi.x + SizeZ/2, PixelSize); 09626 BitmapPos.y = HalfGridLock(CubeFaceRect.hi.y - SizeZ/2, PixelSize); 09627 09628 const INT32 BitmapSize = 14 * PixelSize; 09629 DocRect SwapAxesRect(BitmapPos.x, BitmapPos.y, 09630 BitmapPos.x + BitmapSize + PixelSize * 3, BitmapPos.y + BitmapSize); 09631 GridLockRect(&SwapAxesRect, PixelSize); 09632 09633 if (SwapAxesRect.ContainsCoord(*(Info->pMousePos))) 09634 { 09635 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CLICKTOCYCLE2)); 09636 return(TRUE); 09637 } 09638 09639 if (EditingColour->GetType() != COLOURTYPE_LINKED) 09640 return(FALSE); 09641 09642 if (SquareRect.ContainsCoord(*(Info->pMousePos))) 09643 { 09644 INT32 C1 = 1; 09645 INT32 C2 = 3; 09646 if (ColourPickerMode == 1) 09647 C1 = 2; 09648 else if (ColourPickerMode == 2) 09649 C2 = 2; 09650 09651 INT32 Count = 0; 09652 09653 if (EditingColour->InheritsComponent(C1)) 09654 Count++; 09655 09656 if (EditingColour->InheritsComponent(C2)) 09657 Count++; 09658 09659 if (Count == 1) 09660 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_DRAGINONEDIR)); 09661 else if (Count == 2) 09662 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CANTDRAG)); 09663 } 09664 else 09665 { 09666 // Check if the pointer is in the Z 'drag button' 09667 DocRect ZButton(SquareRect); 09668 ZButton.lo.x = ZButton.hi.x; 09669 ZButton.hi.x += ZSLIDERSIZE - (PixelSize * 2); 09670 ZButton.hi.y = ZButton.lo.y; 09671 ZButton.lo.y -= ZSLIDERSIZE - (PixelSize * 2); 09672 GridLockRect(&ZButton, PixelSize); 09673 09674 if (ZButton.ContainsCoord(*(Info->pMousePos))) 09675 { 09676 // How on earth did all of this get so out of hand?! 09677 INT32 ComponentID = 2; 09678 if (ColourPickerMode == 1) 09679 ComponentID = 1; 09680 else if (ColourPickerMode == 2) 09681 ComponentID = 3; 09682 09683 if (EditingColour->InheritsComponent(ComponentID)) 09684 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CANTDRAG2)); 09685 } 09686 else 09687 { 09688 // Check if the pointer is in the Key slider 09689 DocRect KeyRect(KeySliderLeft, 0, Info->dx, Info->dy - (PATCHSIZE + PixelSize*2)); 09690 if (KeyRect.ContainsCoord(*(Info->pMousePos))) 09691 { 09692 if (EditingColour->InheritsComponent(4)) 09693 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CANTDRAGKEY)); 09694 } 09695 } 09696 } 09697 09698 return(StatusHelp->IsEmpty()); 09699 }
|
|
||||||||||||||||
|
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).
Definition at line 9726 of file coldlog.cpp. 09727 { 09728 if (EditingColour->GetType() != COLOURTYPE_LINKED) 09729 return(FALSE); 09730 09731 // ColourContext *cc = ColourContext::GetGlobalDefault(DisplayModel); 09732 ColourContext *cc = NULL; 09733 BOOL bDeleteCC = GetColourContext(DisplayModel, &cc); 09734 if (cc == NULL) 09735 return(FALSE); 09736 09737 // Get the slider rectangle widths. The height is fixed/moved during the loop below 09738 INT32 PixelSize = 72000 / Info->Dpi; // Size of output pixel in millipoints 09739 DocRect SliderRect(0, 0, Info->dx, Info->dy); 09740 SliderRect.hi.y -= PATCHSIZE + (PixelSize * 2); // Allow space for the current colour patch 09741 09742 // Count how many components we have to display 09743 INT32 NumComponents = 0; 09744 INT32 ComponentIndex; 09745 for (ComponentIndex = 1; ComponentIndex <= 4; ComponentIndex++) 09746 { 09747 if (cc->GetComponentName(ComponentIndex, NULL)) 09748 NumComponents++; 09749 } 09750 09751 // Calculate slider sizes and spacing 09752 INT32 SliderHeight = GetSliderHeight(SliderRect.Height(), NumComponents); 09753 INT32 SliderGap = GetSliderGap(SliderRect.Height(), NumComponents); 09754 09755 // And move the top down by half a SliderGap, so the sliders are centered vertically 09756 SliderRect.hi.y -= SliderGap / 2; 09757 09758 // Check the slider for each component supplied in the current DisplayModel 09759 for (ComponentIndex = 0; ComponentIndex <= 3; ComponentIndex++) 09760 { 09761 // Ensure slider rect is the correct height 09762 SliderRect.lo.y = SliderRect.hi.y - SliderHeight; 09763 09764 // If this component is available/used in this colour model, see if we are dragging it 09765 if (cc->GetComponentName(ComponentIndex+1, NULL)) 09766 { 09767 if (SliderRect.ContainsCoord(*(Info->pMousePos))) 09768 { 09769 if (EditingColour->InheritsComponent(ComponentIndex+1)) 09770 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CANTDRAG2)); 09771 return(StatusHelp->IsEmpty()); 09772 } 09773 } 09774 09775 // Move down to the next slider rectangle position 09776 SliderRect.hi.y = SliderRect.lo.y - SliderGap; 09777 } 09778 09779 // Delete the colour context if necessary 09780 if (bDeleteCC) 09781 ColourContextList::GetList()->RemoveContext(&cc); // Have finished with it 09782 09783 return(FALSE); 09784 }
|
|
||||||||||||||||
|
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).
Definition at line 9386 of file coldlog.cpp. 09387 { 09388 if (EditingColour->GetType() != COLOURTYPE_LINKED) 09389 return(FALSE); 09390 09391 INT32 PixelSize = 72000 / Info->Dpi; // Size of output pixel in millipoints 09392 DocRect VirtualSize(0, 0, Info->dx, Info->dy); 09393 VirtualSize.Inflate(-PixelSize * 4); // And exclude the border 09394 09395 // Calculate the two important rectangles - the hue slider, and Val/Sat square 09396 DocRect HueRect; 09397 DocRect ValSatSquare; 09398 CalculateHSVPickerRects(&VirtualSize, PixelSize, &HueRect, &ValSatSquare); 09399 09400 if (HueRect.ContainsCoord(*(Info->pMousePos)) && EditingColour->InheritsComponent(1)) 09401 { 09402 // SetCursor(No_can_drag_me_mate); 09403 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_NOHUECHANGE)); 09404 } 09405 else if (ValSatSquare.ContainsCoord(*(Info->pMousePos))) 09406 { 09407 if (EditingColour->InheritsComponent(2)) 09408 { 09409 if (EditingColour->InheritsComponent(3)) 09410 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_NOSATVALCHANGE)); 09411 else 09412 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_NOSATCHANGE)); 09413 } 09414 else if (EditingColour->InheritsComponent(3)) 09415 { 09416 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_NOVALCHANGE)); 09417 } 09418 } 09419 09420 return(StatusHelp->IsEmpty()); 09421 }
|
|
||||||||||||||||
|
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).
Definition at line 9448 of file coldlog.cpp. 09449 { 09450 INT32 PixelSize = 72000 / Info->Dpi; // Size of output pixel in millipoints 09451 09452 // Fill the control background, and calculate the cube params (without redraw) 09453 DocRect VirtualSize(0, 0, Info->dx, Info->dy); 09454 VirtualSize.Inflate(-PixelSize * 4); // And exclude the border 09455 09456 DocRect SquareRect; 09457 INT32 SizeZ; 09458 DrawCubeShadowAndCalcValues(NULL, &VirtualSize, PixelSize, NULL, 09459 /* TO */ &SquareRect, &SizeZ); 09460 09461 DocRect CubeFaceRect(SquareRect); // Remember the rect of the front face for below 09462 09463 // Now, shift the square down from the front of the cube by an amount appropriate to 09464 // the Z-axis component of the colour 09465 ColourContextRGBT *cc = (ColourContextRGBT *) 09466 ColourContext::GetGlobalDefault(COLOURMODEL_RGBT); 09467 ColourRGBT SourceColour; 09468 if (EditingColour != NULL) 09469 cc->ConvertColour(EditingColour, (ColourGeneric *) &SourceColour); 09470 09471 if (CanSetColour(EditingColour)) 09472 { 09473 FIXED24 ZComponent = SourceColour.Blue; 09474 if (ColourPickerMode == 1) 09475 ZComponent = SourceColour.Green; 09476 else if (ColourPickerMode == 2) 09477 ZComponent = SourceColour.Red; 09478 09479 INT32 ZTrans = (INT32) ((double)SizeZ * ZComponent.MakeDouble()) - SizeZ; 09480 SquareRect.Translate(-ZTrans, ZTrans); 09481 GridLockRect(&SquareRect, PixelSize); 09482 } 09483 09484 DocCoord BitmapPos; 09485 BitmapPos.x = HalfGridLock(CubeFaceRect.hi.x + SizeZ/2, PixelSize); 09486 BitmapPos.y = HalfGridLock(CubeFaceRect.hi.y - SizeZ/2, PixelSize); 09487 09488 const INT32 BitmapSize = 14 * PixelSize; 09489 DocRect SwapAxesRect(BitmapPos.x, BitmapPos.y, 09490 BitmapPos.x + BitmapSize + PixelSize * 3, BitmapPos.y + BitmapSize); 09491 GridLockRect(&SwapAxesRect, PixelSize); 09492 09493 if (SwapAxesRect.ContainsCoord(*(Info->pMousePos))) 09494 { 09495 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CLICKTOCYCLE)); 09496 return(TRUE); 09497 } 09498 09499 if (EditingColour->GetType() != COLOURTYPE_LINKED) 09500 return(FALSE); 09501 09502 if (SquareRect.ContainsCoord(*(Info->pMousePos))) 09503 { 09504 INT32 C1 = 1; 09505 INT32 C2 = 2; 09506 if (ColourPickerMode == 1) 09507 C1 = 3; 09508 else if (ColourPickerMode == 2) 09509 C2 = 3; 09510 09511 INT32 Count = 0; 09512 09513 if (EditingColour->InheritsComponent(C1)) 09514 Count++; 09515 09516 if (EditingColour->InheritsComponent(C2)) 09517 Count++; 09518 09519 if (Count == 1) 09520 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_DRAGINONEDIR)); 09521 else if (Count == 2) 09522 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CANTDRAG)); 09523 } 09524 else 09525 { 09526 // Check if the pointer is in the Z 'drag button' 09527 DocRect ZButton(SquareRect); 09528 ZButton.lo.x = ZButton.hi.x; 09529 ZButton.hi.x += ZSLIDERSIZE - (PixelSize * 2); 09530 ZButton.hi.y = ZButton.lo.y; 09531 ZButton.lo.y -= ZSLIDERSIZE - (PixelSize * 2); 09532 GridLockRect(&ZButton, PixelSize); 09533 09534 if (ZButton.ContainsCoord(*(Info->pMousePos))) 09535 { 09536 INT32 ComponentID = ColourPickerMode; 09537 if (ComponentID == 0) 09538 ComponentID = 3; 09539 09540 if (EditingColour->InheritsComponent(ComponentID)) 09541 StatusHelp->MakeMsg(_R(IDS_K_COLDLOG_CANTDRAG2)); 09542 } 09543 } 09544 09545 return(StatusHelp->IsEmpty()); 09546 }
|
|
||||||||||||||||
|
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).
Definition at line 9843 of file coldlog.cpp. 09844 { 09845 /* 09846 DocRect VirtualSize(0, 0, Info->dx, Info->dy); 09847 VirtualSize.Inflate(-PixelSize * 4); // And exclude the border 09848 09849 // Calculate the two important rectangles - the hue slider, and Val/Sat square 09850 DocRect HueRect; 09851 DocRect ValSatSquare; 09852 CalculateHSVPickerRects(&VirtualSize, PixelSize, &HueRect, &ValSatSquare); 09853 09854 if (!ValSatSquare.ContainsCoord(*(Info->pMousePos))) 09855 return; 09856 09857 */ 09858 09859 return(FALSE); 09860 }
|
|
||||||||||||||||
|
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).
Definition at line 9812 of file coldlog.cpp. 09813 { 09814 return(FALSE); 09815 }
|
|
||||||||||||
|
Hides / shows the gadgets on the list.
Definition at line 1112 of file coldlog.cpp. 01113 { 01114 CGadgetID Gadget; 01115 while ((Gadget=*(Gadgets++))) // assignment 01116 { 01117 HideGadget(Gadget, Hide); 01118 } 01119 }
|
|
|
Synchronize state of colour picker gadget.
Definition at line 1155 of file coldlog.cpp. 01156 { 01157 if (needColPickHidden != colPickHidden) 01158 { 01159 // this used to use Hide() but that was boring 01160 EnableGadget(_R(IDC_COLOURPICKER), !needColPickHidden); 01161 colPickHidden=needColPickHidden; 01162 01163 //CheckDialogSize(); 01164 } 01165 }
|
|
|
Initialises the colour editor dialogue op.
Reimplemented from SimpleCCObject. Definition at line 9909 of file coldlog.cpp. 09910 { 09911 Camelot.DeclareSection(TEXT("Displays"), 9); 09912 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorDisplayModel"), &DefaultDisplayModel); 09913 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorDisplayModelS"), &DefaultDisplayModelN); 09914 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorAutoModel"), &AutoModelChange); 09915 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorAutoModelS"), &AutoModelChangeN); 09916 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorFolded"), &Folded); 09917 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorSplitLine"), &SplitLineDisplay); 09918 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorUse3D"), &Use3DDisplay); 09919 Camelot.DeclarePref(TEXT("Displays"), TEXT("ColourEditorHSVHueTop"), &bHSVHueAtTop); 09920 Camelot.DeclarePref(TEXT("Displays"), TEXT("UsePrintCMYK"), &bUsePrintCMYK); 09921 09922 DisplayModel = (ColourModel) DefaultDisplayModel; 09923 ColourContext *DefCC = NULL; 09924 BOOL bDeleteCC = GetColourContext(DisplayModel, &DefCC); 09925 if (DefCC == NULL) 09926 { 09927 DisplayModel = COLOURMODEL_HSVT; 09928 DefaultDisplayModel = (INT32) COLOURMODEL_HSVT; 09929 } 09930 // Delete the colour context if necessary 09931 if (bDeleteCC) 09932 ColourContextList::GetList()->RemoveContext(&DefCC); // Have finished with it 09933 09934 bDeleteCC = GetColourContext((ColourModel)DefaultDisplayModelN, &DefCC); 09935 if (DefCC == NULL) 09936 DefaultDisplayModelN = (INT32) COLOURMODEL_HSVT; 09937 09938 // Delete the colour context if necessary 09939 if (bDeleteCC) 09940 ColourContextList::GetList()->RemoveContext(&DefCC); // Have finished with it 09941 09942 #ifdef DISABLE_WEBHEXRGBT 09943 if (DisplayModel==COLOURMODEL_WEBHEXRGBT) 09944 DisplayModel = COLOURMODEL_RGBT; 09945 #endif 09946 09947 // Initialise all of our menu command Ops 09948 if (!OpColEditCommand::Init()) 09949 return(FALSE); 09950 09951 // And initialise our own op 09952 return(RegisterOpDescriptor(0, // Tool ID 09953 _R(IDS_COLOUREDITDLG), // String resource ID 09954 CC_RUNTIME_CLASS(ColourEditDlg), // Runtime class 09955 OPTOKEN_COLOUREDITDLG, // Token string 09956 ColourEditDlg::GetState, // GetState function 09957 0, // help ID 09958 _R(IDBBL_COLOUREDITOR), // bubble help 09959 _R(IDD_BARCONTROLSTORE), // resource ID 09960 _R(IDC_COLOUREDITOR), // control ID 09961 SYSTEMBAR_UTILITIES, // Bar ID 09962 TRUE, // Recieve system messages 09963 FALSE, // Smart duplicate operation 09964 TRUE, // Clean operation 09965 0, // No vertical counterpart 09966 0, // String for one copy only error 09967 DONT_GREY_WHEN_SELECT_INSIDE, // Auto state flags 09968 TRUE // Tickable 09969 )); 09970 }
|
|
|
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.
Definition at line 2328 of file coldlog.cpp. 02329 { 02330 InvalidateGadget(_R(IDC_EDIT_PICKER)); // Redraw picker and colour patches 02331 RedrawColourNameList(); // Redraw colour name dropdown 02332 02333 SetControls(); // Re-init the window controls 02334 }
|
|
|
Invalidates the current colour patch to ensure it is redrawn.
Definition at line 2431 of file coldlog.cpp. 02432 { 02433 ReDrawInfoType LocalInfo; 02434 02435 if (Info == NULL) 02436 GetKernelRenderedGadgetInfo(_R(IDC_EDIT_PICKER), &LocalInfo); 02437 else 02438 memcpy(&LocalInfo, Info, sizeof(ReDrawInfoType)); 02439 02440 INT32 PixelSize = 72000 / LocalInfo.Dpi; // Size of output pixel in millipoints 02441 02442 DocRect PatchRect(0, 0, LocalInfo.dx, LocalInfo.dy); 02443 PatchRect.Inflate(-PixelSize * 4); // Allow for the indented border 02444 02445 // Now draw the original/current colour patch in the top right corner 02446 PatchRect.lo.x = PatchRect.hi.x - PATCHSIZE; 02447 PatchRect.lo.y = PatchRect.hi.y - PATCHSIZE; 02448 GridLockRect(&PatchRect, PixelSize); 02449 02450 // Patches are horizontal if the colour model is not HSV 02451 BOOL HorzPatch = (DisplayModel != COLOURMODEL_HSVT); 02452 02453 // But this setting is overridden for the special tint and shade modes 02454 if (EditingColour != NULL && EditingColour->GetType() == COLOURTYPE_TINT) 02455 { 02456 if (EditingColour->TintIsShade()) 02457 HorzPatch = FALSE; 02458 else 02459 HorzPatch = TRUE; 02460 } 02461 02462 // Translate the rect across or down as appropriate to 'HorzPatch' 02463 if (!HorzPatch) 02464 PatchRect.Translate(0, -PATCHSIZE); 02465 02466 InvalidateGadget(_R(IDC_EDIT_PICKER), &LocalInfo, &PatchRect); 02467 }
|
|
||||||||||||
|
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.
Definition at line 10251 of file coldlog.cpp. 10252 { 10253 if (ParentList == NULL) 10254 ParentList = ColourManager::GetColourList(); 10255 10256 // Determine if we can safely edit this colour 10257 // NOTE that the TRUE is used to cause side effects on the EditingLineColour flag, 10258 // and we will always edit a colour, even if this function returns FALSE. (But if 10259 // it is FALSE, we will edit a "useful" colour) 10260 if (!CanYouEditThis(ParentList, ColourToEdit, TRUE)) 10261 ColourToEdit = NULL; // You can't do that! Choose a "useful" colour to edit instead 10262 10263 if (TheEditor != NULL) 10264 { 10265 // If there is an editor open, bring it to the top of the window stack, and ask it 10266 // to swap to the ColourToEdit, or a useful local colour if ColourToEdit is NULL 10267 TheEditor->BringToTop(); 10268 10269 if (ColourToEdit == NULL) 10270 TheEditor->FindUsefulColourToEdit(TheEditor->EditingLineColour, TRUE); 10271 else 10272 TheEditor->EditThisColour(ParentList, ColourToEdit); 10273 return; 10274 } 10275 10276 // need to set/reset static variables that control where my (as in Chris Snook) custom 10277 // colour picker control appears ..... 10278 10279 resetColPickPos = FALSE; 10280 needColPickHidden = FALSE; 10281 colPickHidden = FALSE; 10282 10283 // Otherwise, invoke the dialogue to bring it up 10284 ColourEditDlgParam EditInfo(ParentList, ColourToEdit); 10285 OpDescriptor *EditDlg = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(ColourEditDlg)); 10286 10287 ERROR3IF(EditDlg == NULL, 10288 "ColourEditDlg::InvokeDialog is unable to find the ColourEditDlg OpDescriptor"); 10289 10290 if (EditDlg != NULL) 10291 EditDlg->Invoke(&EditInfo); 10292 }
|
|
|
Definition at line 10788 of file coldlog.cpp. 10789 { 10790 return m_bDoingSetGadget; 10791 }
|
|
|
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.
Definition at line 2691 of file coldlog.cpp. 02692 { 02693 if (EditingColour == NULL) 02694 return; 02695 02696 ColourContext *CCrgbt = ColourManager::GetColourContext(COLOURMODEL_RGBT); 02697 02698 ColourRGBT RGBColour,result; 02699 CCrgbt->ConvertColour(EditingColour, (ColourGeneric *)&RGBColour); 02700 02701 PaletteManager::FindNearestBrowserColour(RGBColour,&result); 02702 02703 // IndexedColour NewRGBIndexedColour(COLOURMODEL_RGBT, (ColourGeneric *)&result); 02704 // 02705 // *EditingColour = NewRGBIndexedColour; 02706 02707 if (EditingColour->GetColourModel() == COLOURMODEL_RGBT) 02708 { 02709 ColourPicker::SetComponentFromDouble(EditingColour, CCrgbt, 1, result.Red.MakeDouble()); 02710 ColourPicker::SetComponentFromDouble(EditingColour, CCrgbt, 2, result.Green.MakeDouble()); 02711 ColourPicker::SetComponentFromDouble(EditingColour, CCrgbt, 3, result.Blue.MakeDouble()); 02712 } 02713 else 02714 { 02715 IndexedColour NewRGBIndexedColour(COLOURMODEL_RGBT, (ColourGeneric *)&result); 02716 02717 ColourContext *CChsvt = ColourManager::GetColourContext(COLOURMODEL_HSVT); 02718 02719 ColourHSVT hsv; 02720 CChsvt->ConvertColour(&NewRGBIndexedColour, (ColourGeneric *)&hsv); 02721 02722 ColourPicker::SetComponentFromDouble(EditingColour, CChsvt, 1, hsv.Hue.MakeDouble()); 02723 ColourPicker::SetComponentFromDouble(EditingColour, CChsvt, 2, hsv.Saturation.MakeDouble()); 02724 ColourPicker::SetComponentFromDouble(EditingColour, CChsvt, 3, hsv.Value.MakeDouble()); 02725 } 02726 02727 EditingColourHasChanged(TRUE,TRUE,TRUE); 02728 02729 // InvalidateAndSetControls(); // And redraw the picker, and put the new values in the writables 02730 02732 //search for "DisplayModel =" to find where it sets the display colour model 02733 //search for "Command" to find all the menu handling code 02734 }
|
|
|
Definition at line 533 of file coldlog.cpp. 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 }
|
|
|
Moves a lump of code out of the switch statement in the message handler.
Definition at line 3993 of file coldlog.cpp. 03994 { 03995 // We might be about to show an InformError dialogue. This causes the dropdown list to 03996 // close, and that in turn causes a re-entrant call to this message handler, 03997 // the net result being that we create the new colour twice, once before 03998 // the user has even decided which button to press!!! AAAAARARRRRGGH! 03999 // Nasty sounding buglet there. But let's fix the symptom... 04000 static BOOL GoneReentrant = FALSE; 04001 04002 if (GoneReentrant) // Eek! Reentrancy! Oh, no you don't, matey! 04003 return(FALSE); 04004 04005 if (IndexedColour::AreSpotsForcedToProcess()) 04006 { 04007 // Hey, you can't create spots now - they're all process colours! 04008 GoneReentrant = TRUE; 04009 InformError(_R(IDE_SPOTSAREPROCESS), _R(IDS_OK)); 04010 GoneReentrant = FALSE; 04011 return(FALSE); 04012 } 04013 04014 if (EditingColour == NULL || ParentList == NULL || ResultColour == NULL) 04015 return(FALSE); 04016 04017 BOOL Changed = FALSE; 04018 04019 if (!ResultColour->IsNamed()) // Unnamed colour - must convert to a named colour 04020 { 04021 GoneReentrant = TRUE; 04022 LoseKeyboardFocus(); 04023 04024 // This is an unnamed (local) colour, so it can't be a spot colour. 04025 // Ask the user if they want to cancel or convert the colour to be a named spot 04026 if (InformError(_R(IDE_LOCALCANTBESPOT), _R(IDS_MAKENAMEDSPOT), _R(IDS_CANCEL)) == 1) 04027 { 04028 // Rightoh, we should be safe from the reentrancy demon now 04029 GoneReentrant = FALSE; 04030 04031 // Create a colour (style or local) from the current EditingColour 04032 // Make sure the new colour has a suitable parent hint colour 04033 // Make sure we don't try to make an unnamed/deleted colour our parent! 04034 IndexedColour *NewParent = ResultColour; 04035 if (NewParent != NULL && !NewParent->IsNamed()) 04036 NewParent = NewParent->FindLastLinkedParent(); 04037 04038 // Ensure the parent is legal 04039 if (NewParent != NULL && (!NewParent->IsNamed() || NewParent->IsDeleted())) 04040 NewParent = NULL; 04041 04042 // EditingColour will now be put into use as an undo record, so we must get 04043 // a new one for our own use... We do this first in case re-entrant calls 04044 // occur which might make us delete EditingColour or something. 04045 IndexedColour *OldResultColour = ResultColour; 04046 IndexedColour *NewColour = new IndexedColour(*EditingColour); 04047 if (NewColour == NULL) 04048 { 04049 InformError(); 04050 return(FALSE); 04051 } 04052 04053 // And set a legal parent, or NULL if we didn't find one 04054 NewColour->SetLinkedParent(NewParent, COLOURTYPE_SPOT); 04055 04056 // Ask the user for new-colour settings, and allow them to cancel the 04057 // make-style if they like 04058 if (!NewColourDlg::InvokeDialog(ParentList, NewColour)) 04059 { 04060 // They've cancelled the operation. Go back to editing what they were 04061 // editing before. 04062 EditThisColour(ParentList, OldResultColour); 04063 return(FALSE); 04064 } 04065 04066 if (NewColour->IsNamed()) 04067 { 04068 // Add it to the colour list, with undo 04069 ParentList->AddItem(NewColour); 04070 04071 IndexedColour *NewCols[2]; 04072 NewCols[0] = NewColour; 04073 NewCols[1] = NULL; 04074 04075 ColourManager::UnHideColours(ParentList, NewCols); 04076 } 04077 else 04078 { 04079 // This should now never happen. However, if it does, we might 04080 // as well add it to the unnamed colours so we don't memory leak it. 04081 ERROR3("'New named colour' dialogue returned an UNNAMED colour"); 04082 04083 // Just add it to the colour list 04084 ParentList->GetUnnamedColours()->AddTail(NewColour); 04085 FirstEdit = FALSE; 04086 } 04087 04088 // Apply it to the selection 04089 ApplyColourNow(NewColour); 04090 EditThisColour(ParentList, NewColour); 04091 04092 // And make sure we know the colour changed in some way 04093 Changed = TRUE; 04094 } 04095 // else 04096 // user cancelled, so just drop through to return FALSE 04097 } 04098 else 04099 { 04100 // It's a named colour, so we can just make it a spot with no fuss 04101 IndexedColour *LastParent = EditingColour->FindLastLinkedParent(); 04102 04103 // Check if any safe parent colours are available 04104 LastParent = FindSafeParent(LastParent, FALSE); 04105 04106 if (EditingColour->GetType() != COLOURTYPE_SPOT) 04107 { 04108 EditingColour->SetLinkedParent(LastParent, COLOURTYPE_SPOT); 04109 Changed = TRUE; 04110 } 04111 } 04112 04113 GoneReentrant = FALSE; 04114 04115 return(Changed); 04116 }
|
|
|
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.
See also: ColourEditDlg::MakeColourASpot for stuff about reentrancy Definition at line 3869 of file coldlog.cpp. 03870 { 03871 // We might be about to show an InformError dialogue. This causes the dropdown list to 03872 // close, and that in turn causes a re-entrant call to this message handler, 03873 // the net result being that we create the new colour twice, once before 03874 // the user has even decided which button to press!!! AAAAARARRRRGGH! 03875 // Nasty sounding buglet there. But let's fix the symptom... 03876 static BOOL GoneReentrant = FALSE; 03877 03878 if (GoneReentrant) // Eek! Reentrancy! Oh, no you don't, matey! 03879 return(FALSE); 03880 03881 // Create a colour (style or local) from the current EditingColour 03882 if (EditingColour != NULL && ParentList != NULL)// && !EditingColour->IsNamed()) 03883 { 03884 // Make sure the new colour has a suitable parent colour 03885 if (EditingColour->FindLastLinkedParent() == NULL || 03886 (EditingColour->GetType() != COLOURTYPE_TINT && EditingColour->GetType() != COLOURTYPE_LINKED)) 03887 { 03888 // Make sure we don't try to make an unnamed/deleted colour our parent! 03889 IndexedColour *NewParent = ResultColour; 03890 03891 if (NewParent != NULL && !NewParent->IsNamed()) 03892 NewParent = NewParent->FindLastLinkedParent(); 03893 03894 // Ensure the parent is legal 03895 if (NewParent != NULL && (!NewParent->IsNamed() || NewParent->IsDeleted())) 03896 NewParent = NULL; 03897 03898 // And set a legal parent, or NULL if we didn't find one 03899 EditingColour->SetLinkedParent(NewParent, EditingColour->GetType()); 03900 } 03901 03902 // EditingColour will now be put into use as an undo record, so we must get 03903 // a new one for our own use... We do this first in case re-entrant calls (to 03904 // Message !) occur which might make us delete EditingColour or something. We 03905 // must handle the other reentrancy problem of closing the menu if an error 03906 // dialog pops up as well by setting GoneReentrant. 03907 IndexedColour *OldResultColour = ResultColour; 03908 IndexedColour *NewColour = new IndexedColour(*EditingColour); 03909 if (NewColour == NULL) 03910 { 03911 GoneReentrant = TRUE; 03912 InformError(); 03913 GoneReentrant = FALSE; 03914 return(FALSE); 03915 } 03916 03917 // Ask the user for new-colour settings, and allow them to cancel the 03918 // make-style if they like 03919 if (!NewColourDlg::InvokeDialog(ParentList, NewColour)) 03920 { 03921 // They've cancelled the operation. Go back to editing what they were 03922 // editing before. 03923 EditThisColour(ParentList, OldResultColour); 03924 return(FALSE); 03925 } 03926 03927 if (NewColour->IsNamed()) 03928 { 03929 // Add it to the colour list, with undo 03930 ParentList->AddItem(NewColour); 03931 03932 IndexedColour *NewCols[2]; 03933 NewCols[0] = NewColour; 03934 NewCols[1] = NULL; 03935 03936 ColourManager::UnHideColours(ParentList, NewCols); 03937 } 03938 else 03939 { 03940 // This should now never happen. However, if it does, we might 03941 // as well add it to the unnamed colours so we don't memory leak it. 03942 ERROR3("'New named colour' dialogue returned an UNNAMED colour"); 03943 03944 // Just add it to the colour list 03945 ParentList->GetUnnamedColours()->AddTail(NewColour); 03946 FirstEdit = FALSE; 03947 } 03948 03949 // Force the new colour into the currently displayed colour model (wysiwyg) 03950 // ColourContext *cc = ColourContext::GetGlobalDefault(DisplayModel); 03951 ColourContext *cc = NULL; 03952 BOOL bDeleteCC = GetColourContext(DisplayModel, &cc); 03953 ERROR3IF(cc == NULL, "Necessary document default colour context not defined?!"); 03954 ColourPicker::ForceColourModel(NewColour, cc); 03955 03956 // Delete the colour context if necessary 03957 if (bDeleteCC) 03958 ColourContextList::GetList()->RemoveContext(&cc); // Have finished with it 03959 03960 // Apply it to the selection 03961 ApplyColourNow(NewColour); 03962 03963 DisplayModel = NewColour->GetColourModel(); 03964 EditThisColour(ParentList, NewColour); 03965 } 03966 03967 GoneReentrant = FALSE; 03968 03969 return TRUE; 03970 }
|
|
|
Standard DialogOp message handler, for the Colour Editor dialogue.
Reimplemented from DialogOp. Definition at line 2831 of file coldlog.cpp. 02832 { 02833 // DY 5/5/2000 this is really ugly but I'm in a hurry. Basically I need to disable background processing 02834 // whilst a brush stroke is in progress, at the end of the drag normal servive will be resumed 02835 if (!m_bDoTimerProcessing) 02836 return(DialogOp::Message(Message)); 02837 02838 if (MESSAGE_IS_A(Message, ColourChangingMsg)) 02839 { 02840 ColourChangingMsg *TheMsg = (ColourChangingMsg *) Message; 02841 02842 switch ( TheMsg->State ) 02843 { 02844 case ColourChangingMsg::COLOURUPDATED: 02845 case ColourChangingMsg::COLOURUPDATEDINVISIBLE: 02846 // If I didn't send the message and the colour is the one I'm editing, 02847 // reset the controls to reflect whatever the change was. 02848 // (This mainly happens as a result of undo) 02849 if (!ISentTheMessage && TheMsg->ChangedColour == ResultColour) 02850 { 02851 // Delete our current copy of the EditingColour, and get a fresh one 02852 // as a copy of the newly-changed ResultColour 02853 if (EditingColour != NULL) 02854 delete EditingColour; 02855 02856 EditingColour = new IndexedColour(*ResultColour); 02857 if (EditingColour == NULL) 02858 InformError(); // Report the memory error and continue 02859 02860 InvalidateAndSetControls(); 02861 } 02862 else if (ResultColour != NULL && ResultColour->IsADescendantOf(TheMsg->ChangedColour)) 02863 { 02864 // If an ancestor of the colour being edited has changed, redraw the editor 02865 // to take on board the change in appearance 02866 InvalidateAndSetControls(); 02867 } 02868 break; 02869 02870 case ColourChangingMsg::LISTPAGED: // May have swapped to another list 02871 if (TheMsg->NewColourList != ParentList) 02872 { 02873 ResultColour = NULL; // Lose this colour 02874 if (EditingColour != NULL) 02875 delete EditingColour; 02876 EditingColour = NULL; 02877 02878 UpdateOnNextIdle = TRUE; 02879 UpdateColourEditor (); 02880 } 02881 /* 02882 if (TheMsg->NewColourList != ParentList) 02883 { 02884 ResultColour = NULL; // Lose this colour 02885 if (EditingColour != NULL) 02886 delete EditingColour; 02887 EditingColour = NULL; 02888 02889 FindUsefulColourToEdit(EditingLineColour); // Try to find a replacement 02890 02891 if (EditingColour == NULL) // We failed - shade the dialogue 02892 ShadeMyself(); 02893 } 02894 */ 02895 break; 02896 02897 case ColourChangingMsg::LISTDELETED: // May have deleted this colour 02898 // The ColourList we're editing in has been deleted from under us! 02899 if (TheMsg->NewColourList == ParentList) 02900 ShadeMyself(); 02901 break; 02902 02903 case ColourChangingMsg::LISTDESELECTED:// No document available 02904 ShadeMyself(); 02905 break; 02906 02907 case ColourChangingMsg::LISTUPDATED: // Colour may have been deleted 02908 { 02909 //BOOL SetControls = FALSE; 02910 02911 // If the colour is deleted out from under us, try to find another one to edit 02912 if (ResultColour != NULL && ResultColour->IsDeleted()) 02913 { 02914 ResultColour = NULL; // Lose this colour 02915 if (EditingColour != NULL) 02916 delete EditingColour; 02917 EditingColour = NULL; 02918 02919 FindUsefulColourToEdit(EditingLineColour); // Try to find a replacement 02920 02921 if (EditingColour == NULL) // We failed - shade the dialogue 02922 ShadeMyself(); 02923 } 02924 02925 if (EditingColour != NULL) 02926 { 02927 if (EditingColour->FindLastLinkedParent() != NULL && 02928 EditingColour->FindLastLinkedParent()->IsDeleted()) 02929 { 02930 // If the parent of EditingColour has been deleted, then make standalone 02931 IndexedColourType Type = EditingColour->GetType(); 02932 if (Type != COLOURTYPE_SPOT) 02933 Type = COLOURTYPE_NORMAL; 02934 02935 EditingColour->SetLinkedParent(NULL, Type); 02936 //SetControls = TRUE; 02937 } 02938 else if (EditingColour->GetType() == COLOURTYPE_NORMAL && 02939 ResultColour != NULL && ResultColour->FindLinkedParent() != NULL) 02940 { 02941 // ResultColour's parent may have just become un-deleted (by an UNDO). 02942 // If this could be the case, and EditingColour has no parent, then 02943 // we must have set EditingColour to have no parent just above (i.e. the 02944 // user deleted the parent and then hit UNDO) 02945 // In this case, set EditingColour back to the values in ResultColour 02946 EditingColour->SetLinkedParent(ResultColour->FindLinkedParent(), ResultColour->GetType()); 02947 //SetControls = TRUE; 02948 } 02949 } 02950 02951 // Ensure the colour name and type dropdowns are updated to offer sensible options 02952 State.ParentListOK = FALSE; 02953 State.Initialised = FALSE; 02954 InvalidateAndSetControls(); 02955 } 02956 break; 02957 02958 case ColourChangingMsg::SELVIEWCONTEXTCHANGE: 02959 // The selected view's colour context has chnaged, which probably affects the 02960 // colour correction/separation options. We redraw using these options, so we 02961 // need to redraw to reflect the new settings. 02962 InvalidateAndSetControls(); 02963 break; 02964 02965 default: 02966 break; 02967 } 02968 02969 return(DialogOp::Message(Message)); 02970 } 02971 02972 if (MESSAGE_IS_A(Message, SelChangingMsg)) // Selection changed - edit new colour 02973 { 02974 SelChangingMsg *Msg = (SelChangingMsg *) Message; 02975 switch ( Msg->State ) 02976 { 02977 case SelChangingMsg::COLOURATTCHANGED: 02978 case SelChangingMsg::SELECTIONCHANGED: 02979 case SelChangingMsg::NODECHANGED: 02980 if (!ISentTheMessage) 02981 { 02982 UpdateOnNextIdle = TRUE; 02983 UpdateColourEditor (); 02984 } 02985 // FindUsefulColourToEdit(EditingLineColour); 02986 break; 02987 02988 default: 02989 break; 02990 } 02991 } 02992 else if (MESSAGE_IS_A(Message, CurrentAttrChangedMsg)) // Current attrs changed - edit new colour 02993 { 02994 if (!ISentTheMessage) 02995 { 02996 UpdateOnNextIdle = TRUE; 02997 UpdateColourEditor (); 02998 } 02999 // FindUsefulColourToEdit(EditingLineColour); 03000 } 03001 else if (MESSAGE_IS_A(Message, DragMessage)) 03002 { 03003 // If a drag starting message comes around, pass it on to the tree 03004 DragMessage *Msg = (DragMessage *) Message; 03005 if (Msg->State == DragMessage::DRAGSTARTED) 03006 { 03007 // If it's a colour drag which did NOT originate from the editor, then attach 03008 // a drag target so it can be dropped into the editor. 03009 if (Msg->pInfo->IsKindOf(CC_RUNTIME_CLASS(ColourDragInformation)) && 03010 !IS_A(Msg->pInfo, ColEditorDragInfo)) 03011 { 03012 ColourDragInformation *CDI = (ColourDragInformation *)Msg->pInfo; 03013 03014 // Check if it's a library colour, or else it must be a colour in the selected doc 03015 if (CDI->GetParentDoc() == NULL || CDI->GetParentDoc() == Document::GetSelected()) 03016 { 03017 // Create targets for all the interesting bits of the window 03018 // **** !!!! ToDo (maybe) Targets for colour picker and colour patches 03019 03020 // Last, add one for the whole window - this is lower priority than the 03021 // others, so will only be active for any areas which are not claimed by 03022 // the above targets 03023 /*ColEditorDragTarget * NewTarget = */ new ColEditorDragTarget(this, 0); 03024 } 03025 // We don't really care if this failed... 03026 } 03027 } 03028 } 03029 03030 // WEBSTER - markn 9/1/97 03031 // This message shouldn't need servicing in Webster. 03032 //#ifndef WEBSTER 03033 else if (MESSAGE_IS_A(Message, OptionsChangingMsg)) 03034 { 03035 OptionsChangingMsg *Msg = (OptionsChangingMsg *) Message; 03036 if (Msg->State == OptionsChangingMsg::NEWUNITS) 03037 { 03038 // A unit has changed. This can include the decimal point character, so we need 03039 // to set the values in all writable fields again & get the default. 03040 SetUnitGroupDefaults(DisplayModel); 03041 SetControls(); 03042 } 03043 } 03044 //#endif // WEBSTER 03045 else if (MESSAGE_IS_A(Message, DocViewMsg)) 03046 { 03047 DocViewMsg *Msg = (DocViewMsg *) Message; 03048 03049 if (Msg->State == DocViewMsg::SELCHANGED) 03050 { 03051 // Selected DocView is changing - redraw to use the new DocView's colour context 03052 BOOL DoRedraw = TRUE; 03053 if (Msg->pOldDocView != NULL && Msg->pNewDocView != NULL) 03054 { 03055 // If we know the old & new views, then see if they have the same colour 03056 // context attached - if they do, there's no need to redraw. This eliminates 03057 // flicker when swapping normal views (the most common view-swap action) 03058 // We only check the RGB context because we assume the screen is always RGB 03059 ColourContext *OldCC = Msg->pOldDocView->GetColourContext(COLOURMODEL_RGBT, TRUE); 03060 ColourContext *NewCC = Msg->pNewDocView->GetColourContext(COLOURMODEL_RGBT, TRUE); 03061 03062 if (OldCC == NewCC) 03063 DoRedraw = FALSE; 03064 } 03065 03066 if (DoRedraw) 03067 { 03068 UpdateOnNextIdle = TRUE; 03069 UpdateColourEditor (); 03070 } 03071 // InvalidateAndSetControls(); 03072 } 03073 } 03074 03075 03076 if (!(IS_OUR_DIALOG_MSG(Message))) 03077 return(DialogOp::Message(Message)); 03078 03079 DialogMsg* Msg = (DialogMsg*)Message; 03080 03081 #if _DEBUG 03082 /* 03083 if ((INT32)Msg->DlgMsg == (INT32)DIM_TITLEFOCUSWARN + 1) 03084 { 03085 if (CurrentCursor != NULL) 03086 { 03087 delete CurrentCursor; 03088 CurrentCursor = NULL; 03089 } 03090 03091 if (CurrentCursorID != NULL) 03092 { 03093 CurrentCursor = new Cursor(CurrentCursorID); 03094 if (CurrentCursor != NULL) 03095 CurrentCursor->SetActive(); 03096 } 03097 else 03098 { 03099 if (Cursor::Arrow != NULL) 03100 Cursor::Arrow->SetActive(); 03101 } 03102 return(DialogOp::Message(Message)); 03103 } 03104 */ 03105 #endif 03106 03107 switch(Msg->DlgMsg) 03108 { 03109 case DIM_TITLEFOCUSWARN: 03110 // --- Input focus bodge --- 03111 // The window has been moved or the titlebar clicked. This means we've been given 03112 // the input focus, and we don't want that. So we throw the focus away again. 03113 // Unfortunately this does not work as we immediately get the focus again! Thus, 03114 // we set up an idle processor to be called back once all the moving has been 03115 // finished, so that we lose the focus shortly after the drag completes, and 03116 // the effect is more permanent! 03117 DragStartArea = CEDRAG_NONE; // Tell idle system we're not in the middle of a picker drag 03118 03119 //LoseKbdFocusPending = TRUE; // And flag the fact that we want to lose the focus 03120 //BeginTimedProcessing(); 03121 //LoseKeyboardFocus (); 03122 DialogManager::DefaultKeyboardFocus(); 03123 break; 03124 03125 case DIM_CREATE: 03126 ColourPicker::OnCreate(WindowID); 03127 SetGadgetBitmaps(_R(IDC_EDIT_DROPMENU), 0, 0); 03128 #ifndef WEBSTER 03129 SetGadgetBitmaps(_R(IDC_EDIT_MAKESTYLE), 0, 0); 03130 SetGadgetBitmaps(_R(IDC_EDIT_ADVANCED), 0, 0); 03131 #endif 03132 // WEBSTER - markn 11/12/96 03133 // Changes to the bitmap buttons at the top of the colour editor 03134 // Set up our bitmap button gadgets with appropriate bitmaps 03135 //SetGadgetBitmaps(_R(IDC_EDIT_LINEFILL), 0, 0); 03136 SetGadgetBitmaps(_R(IDC_EDIT_NOCOLOUR), 0, 0); 03137 SetGadgetBitmaps(_R(IDC_EDIT_216ONLY), 0, 0); 03138 SetGadgetBitmaps(_R(IDC_MAKE_LOCAL), 0, 0); 03139 SetGadgetBitmaps(_R(IDC_EDIT_RENAME), 0, 0); 03140 03141 03142 // WEBSTER - markn 31/1/97 03143 // Make sure the line/fill switch is set correctly 03144 //#ifdef WEBSTER 03145 //SetBoolGadgetSelected(_R(IDC_EDIT_LINEFILL), EditingLineColour); 03146 //#endif // WEBSTER 03147 03148 ResetState(); // Ensure all controls and window extent are updated 03149 SetUnitGroupDefaults(DisplayModel); // and defaults are set 03150 SetControls(); // ...and update them 03151 03152 ColourPicker::RelayoutDialog(WindowID); 03153 03154 // And then lob away the input focus again - put it back into the mainframe 03155 LockLoseFocus = FALSE; // Ensure the focus lock is reset to off whenever we open 03156 LoseFocusFromEditControls = FALSE; 03157 LoseKeyboardFocus(); 03158 03159 { 03160 INT32 i = 0; 03161 while (GadgetHelp[i].Gadget) 03162 { 03163 SetGadgetHelp(GadgetHelp[i].Gadget, GadgetHelp[i].BubbleID, GadgetHelp[i].BubbleID); 03164 i++; 03165 } 03166 } 03167 BeginTimedProcessing(); 03168 break; 03169 03170 case DIM_COMMIT: 03171 // // NOTE - this dialogue does NOT have an 'OK' (commit) button 03172 // // The only way that we can therefore recieve this message is if return 03173 // // is pressed. If this is done in the name text field, we must update 03174 // // the name list to show this colour's name correctly 03175 if (!ISentTheMessage) 03176 { 03177 SetColour(FALSE); // Update the colour 03178 03179 LoseFocusFromEditControls = TRUE; 03180 LoseKeyboardFocus(); // And we've committed, so lose the keyboard focus 03181 LoseFocusFromEditControls = FALSE; 03182 // 03183 // State.ParentListOK = FALSE; 03184 // SetColourNameList(); // Update the parent list 03185 } 03186 break; 03187 03188 case DIM_CANCEL: // Cancel clicked 03189 { 03190 StatusLine* pStatusLine = StatusLine::Get(); 03191 if (!pStatusLine || !pStatusLine->IsRestrictedAccessToColourPicker()) 03192 { 03193 CloseMyself(); // And close the window 03194 } 03195 else 03196 { 03197 ColourPickerAbort (_R(IDC_COLOURPICKER)); 03198 } 03199 } 03200 return(OK); // ... making sure the base class handler is NOT called (it blows up) 03201 03202 case DIM_CTRL_RESIZED: 03203 { 03204 if (Msg->GadgetID == _R(IDC_EDIT_PICKER)) 03205 ColourPicker::OnSize(WindowID); 03206 } 03207 break; 03208 03209 case DIM_REDRAW: // Kernel-redraw of colour patch or picker controls 03210 { 03211 RenderControl(Msg->GadgetID, (ReDrawInfoType*) Msg->DlgMsgParam); 03212 } 03213 break; 03214 03215 case DIM_LFT_BN_CLICKED: 03216 // Remove bubble help whenever the user clicks 03217 PORTNOTE("other", "Disabled BubbleHelp stuff") 03218 #ifndef EXCLUDE_FROM_XARALX 03219 ControlHelper::BubbleHelpDisable(); 03220 #endif 03221 03222 if (FALSE) {} 03223 #if 0 03224 else if (Msg->GadgetID == _R(IDC_NATIVEPICKER)) 03225 { 03226 if (EditingColour != NULL) 03227 { 03228 Close(); // Close ourself, and replace with the native colour picker 03229 03230 ColourPicker NewPicker; 03231 NewPicker.EditColour(ParentList, ResultColour, TRUE); 03232 03233 if (EditingColour != NULL) 03234 { 03235 delete EditingColour; 03236 EditingColour = NULL; 03237 } 03238 End(); 03239 } 03240 } 03241 #endif 03242 03243 // WEBSTER - markn 11/12/96 03244 #ifndef WEBSTER 03245 else if (Msg->GadgetID == _R(IDC_EDIT_ADVANCED)) 03246 { 03247 // Toggling size is allowed even when we're shaded 03248 Folded = !Folded; // Toggle the folded state of the window 03249 SetControls(); // And re-set the window size 03250 } 03251 #endif // WEBSTER 03252 03253 #if 0 // WEBSTER - markn 11/12/96 03254 else if (Msg->GadgetID == _R(IDC_EDIT_LINEFILL)) 03255 { 03256 FindUsefulColourToEdit(GetBoolGadgetSelected(_R(IDC_EDIT_LINEFILL))); 03257 } 03258 #endif 03259 03260 // WEBSTER - markn 14/12/96 03261 else if (Msg->GadgetID == _R(IDC_EDIT_NOCOLOUR)) 03262 { 03263 if ( NoFillButtonDown ) 03264 { 03265 NoFillButtonDown = FALSE; // remember it's up 03266 EditingColourHasChanged( TRUE, FALSE ); 03267 } 03268 else 03269 ApplyNoColour(EditingLineColour);//push it down 03270 } 03271 else if (Msg->GadgetID == _R(IDC_EDIT_RENAME)) 03272 { 03273 DoCommand(&ColCmd_Name); 03274 } 03275 // WEBSTER - markn 14/12/96 03276 else if (Msg->GadgetID == _R(IDC_EDIT_216ONLY)) 03277 { 03278 LimitTo216Only(); 03279 DialogManager::DefaultKeyboardFocus(); // remove the input focus from the button (yuk!) 03280 } 03281 else if (Msg->GadgetID == _R(IDC_EDIT_DROPMENU)) 03282 { 03283 // Show drop-down menu 03284 // Chuck up a context sensitive menu 03285 ColEditContextMenu *Bob = new ColEditContextMenu; 03286 if (Bob != NULL) 03287 Bob->Show(); 03288 } 03289 else if ((Msg->GadgetID == _R(IDC_EDIT_INHERIT1)) || 03290 (Msg->GadgetID == _R(IDC_EDIT_INHERIT2)) || 03291 (Msg->GadgetID == _R(IDC_EDIT_INHERIT3)) || 03292 (Msg->GadgetID == _R(IDC_EDIT_INHERIT4))) 03293 { 03294 SetColour(FALSE); // Read the new settings from the window 03295 SetControls(); // Ensure controls shade/unshade as appropriate 03296 } 03297 // WEBSTER - markn 14/1/97 03298 // Removed click handling on unused buttons 03299 else if (Msg->GadgetID == _R(IDC_EDIT_3D)) 03300 { 03301 // 3D display mode turned on/off. Redraw the picker control to show it 03302 // in the new mode. 03303 Use3DDisplay = GetBoolGadgetSelected(_R(IDC_EDIT_3D)); 03304 InvalidateGadget(_R(IDC_EDIT_PICKER)); 03305 } 03306 else if (Msg->GadgetID == _R(IDC_EDIT_MAKESTYLE)) 03307 { 03308 MakeNewNColour(); 03309 } 03310 // can make named colours in webster #endif // WEBSTER 03311 else if (Msg->GadgetID == _R(IDC_MAKE_LOCAL)) 03312 { 03313 // handles the webster only "Make Local to Frame" button 03314 OnMakeLocalToFrame(); 03315 } 03316 03317 // And then lob away the input focus again - put it back into the mainframe 03318 LoseKeyboardFocus(); 03319 break; 03320 03321 case DIM_LFT_BN_DOWN: 03322 // case DIM_RGT_BN_DOWN: 03323 // Remove bubble help whenever the user clicks 03324 PORTNOTE("other", "Disabled BubbleHelp stuff") 03325 #ifndef EXCLUDE_FROM_XARALX 03326 ControlHelper::BubbleHelpDisable(); 03327 #endif 03328 if (Msg->GadgetID == _R(IDC_COLOURPICKER)) 03329 { 03330 // This little wheeze is enough to remove hover 03331 EnableGadget(_R(IDC_COLOURPICKER), FALSE); 03332 EnableGadget(_R(IDC_COLOURPICKER), TRUE); 03333 SetBoolGadgetSelected(_R(IDC_COLOURPICKER), FALSE); 03334 InvalidateGadget(_R(IDC_COLOURPICKER)); 03335 03336 ColourPickerDragInformation * DragCol = new ColourPickerDragInformation(); 03337 DragManagerOp::StartDrag(DragCol, GetReadWriteWindowID()); 03338 break; 03339 } 03340 03341 // Drag methods all cope with shaded condition (EditingColour == NULL) 03342 if (Msg->DlgMsgParam) 03343 { 03344 if (Msg->GadgetID == _R(IDC_EDIT_PICKER)) 03345 { 03346 StartDrag((ReDrawInfoType*) Msg->DlgMsgParam); 03347 NoFillButtonDown = FALSE; 03348 } 03349 #if FALSE 03350 /* 03351 else if (Msg->GadgetID == _R(IDC_EDIT_PATCH) && EditingColour != NULL && ParentList != NULL) 03352 { 03353 ReDrawInfoType* Info = (ReDrawInfoType *) Msg->DlgMsgParam; 03354 INT32 PatchHeight = Info->dy / 3; 03355 03356 IndexedColour *TheColour = ResultColour; // Middle patch/default 03357 if (Info->pMousePos->y < PatchHeight) 03358 { 03359 // Bottom patch - parent colour 03360 if (EditingColour->FindLinkedParent() != NULL) 03361 TheColour = EditingColour->FindLinkedParent(); 03362 } 03363 else if (Info->pMousePos->y > PatchHeight * 2) 03364 { 03365 // Top patch - OriginalColour 03366 TheColour = new IndexedColour(OriginalColour); 03367 if (TheColour != NULL) 03368 { 03369 TheColour->SetUnnamed(); 03370 03371 // Ensure we don't get a memory leak 03372 ParentList->AddItem(TheColour); 03373 } 03374 } 03375 03376 if (TheColour != NULL) 03377 { 03378 ColourDragInformation *DragCol; 03379 DragCol = new ColourDragInformation(TheColour, FALSE, (Document *)ParentList->GetParentDocument()); 03380 DragManagerOp::StartDrag(DragCol, GetReadWriteWindowID()); 03381 } 03382 } 03383 */ 03384 #endif 03385 } 03386 03387 break; 03388 03389 case DIM_MOUSE_DRAG: 03390 // Drag methods all cope with shaded condition (EditingColour == NULL) 03391 if (Msg->GadgetID == _R(IDC_EDIT_PICKER) && DragStartArea != CEDRAG_NONE) 03392 UpdateDrag((ReDrawInfoType*) Msg->DlgMsgParam); 03393 break; 03394 03395 03396 /* 03397 case DIM_MOUSE_MOVE: 03398 ColourPicker::UpdateBubbleHelpAndPointer(); 03399 break; 03400 */ 03401 03402 case DIM_LFT_BN_UP: 03403 // Drag methods all cope with shaded condition (EditingColour == NULL) 03404 if (Msg->GadgetID == _R(IDC_EDIT_PICKER) && DragStartArea != CEDRAG_NONE) 03405 EndDrag((ReDrawInfoType*) Msg->DlgMsgParam); 03406 else if (Msg->GadgetID != _R(IDC_EDIT_DROPMENU)) // Don't lose focus if dropping a menu! 03407 LoseKeyboardFocus(); 03408 break; 03409 03410 03411 case DIM_RGT_BN_UP: 03412 if (EditingColour != NULL && !AmShaded) 03413 { 03414 // Chuck up a context sensitive menu 03415 ColEditContextMenu *Bob = new ColEditContextMenu; 03416 if (Bob != NULL) 03417 Bob->Show(); 03418 } 03419 break; 03420 03421 03422 case DIM_TEXT_CHANGED: // Text in a writable icon has changed 03423 if (!ISentTheMessage && EditingColour != NULL) 03424 { 03425 // If we are editing a colour, and we are not responsible for the 03426 // change, we update the EditingColour, and possibly force-redraw the 03427 // current-colour indicator patch, as appropriate to the change 03428 03429 if (( Msg->GadgetID == _R(IDC_EDIT_COMPONENT1)) || 03430 ( Msg->GadgetID == _R(IDC_EDIT_COMPONENT2)) || 03431 ( Msg->GadgetID == _R(IDC_EDIT_COMPONENT3)) || 03432 ( Msg->GadgetID == _R(IDC_EDIT_COMPONENT4)) || 03433 ( Msg->GadgetID == _R(IDC_EDIT_WEBHEX))) 03434 { 03435 // While setting the colour, make sure we don't try to update the 03436 // field that the user is currently typing into! 03437 CurrentTypingGadget = Msg->GadgetID; 03438 SetColour(); 03439 CurrentTypingGadget = 0; 03440 03441 // We have to set the transparency button manually here 'cos SetColour 03442 // does not write the gadgets when we're typing (it would over write 03443 // whatever we are typing!) 03444 if (NoFillButtonDown) // if it's up already don't bother redrawing 03445 { 03446 NoFillButtonDown = FALSE; 03447 SetBoolGadgetSelected( _R(IDC_EDIT_NOCOLOUR), NoFillButtonDown); 03448 } 03449 03450 03451 // Set flag to tell the 'lose focus' function to also update the 03452 // text components once while it's at it - this just tidies up the 03453 // appearance of the controls as soon as we lose focus. 03454 TextMayBeWrong = TRUE; 03455 } 03456 else if (Msg->GadgetID == _R(IDC_EDIT_TINT)) 03457 { 03458 INT32 MinValue = (EditingColour->TintIsShade()) ? -100 : 0; 03459 INT32 NewValue = GetLongGadgetValue(_R(IDC_EDIT_TINT), MinValue, 100); 03460 if (NewValue < MinValue) NewValue = MinValue; 03461 if (NewValue > 100) NewValue = 100; 03462 03463 CurrentTypingGadget = _R(IDC_EDIT_TINT); 03464 SetColour(FALSE); 03465 CurrentTypingGadget = 0; 03466 } 03467 else if (Msg->GadgetID == _R(IDC_EDIT_SHADE)) 03468 { 03469 INT32 NewValue = GetLongGadgetValue(_R(IDC_EDIT_SHADE), -100, 100); 03470 if (NewValue < -100) NewValue = -100; 03471 if (NewValue > 100) NewValue = 100; 03472 03473 CurrentTypingGadget = _R(IDC_EDIT_SHADE); 03474 SetColour(FALSE); 03475 CurrentTypingGadget = 0; 03476 } 03477 } 03478 break; 03479 03480 // case DIM_FOCUS_LOST: 03481 // // This message is sent from the Name Combo box when it loses the input focus. 03482 // // This occurs when we move to a different field, close the dialogue, press 03483 // // return, etc. It means any change to the name is only set when the user 03484 // // finishes editing the text, at which point it is reasonable to ensure the 03485 // // name is unique 03486 // 03487 // if (Msg->GadgetID == _R(IDC_EDIT_NAMEMENU)) 03488 // SetColour(FALSE); // Update the colour 03489 // break; 03490 03491 03492 /* 03493 case DIM_SLIDER_POS_CHANGING: 03494 case DIM_SLIDER_POS_SET: 03495 if (EditingColour != NULL && !ISentTheMessage) 03496 { 03497 INT32 NewValue = GetLongGadgetValue(_R(IDC_EDIT_TINTSLIDER), 0, 100); 03498 if (NewValue < 0) NewValue = 0; 03499 if (NewValue > 100) NewValue = 100; 03500 NewValue = 100-NewValue; 03501 03502 INT32 WritableValue = GetLongGadgetValue(_R(IDC_EDIT_TINT), 0, 100); 03503 if (WritableValue != NewValue) 03504 { 03505 BOOL LastSentState = ISentTheMessage; // Lock: Ignore DIM_TEXT_CHANGED 03506 ISentTheMessage = TRUE; 03507 SetLongGadgetValue(_R(IDC_EDIT_TINT), NewValue); 03508 ISentTheMessage = LastSentState; 03509 03510 SetColour(); 03511 } 03512 } 03513 03514 // And then lob away the input focus again - put it back into the mainframe 03515 LoseKeyboardFocus(); 03516 break; 03517 */ 03518 03519 case DIM_LISTDROPPED: 03520 // A dropdown list is about to drop down- turn on our focus-losing lock 03521 LockLoseFocus = TRUE; 03522 break; 03523 03524 case DIM_TIMER: 03525 if(Msg->DlgMsgParam == COLED_TIMER_ID) 03526 // 03527 //UpdateOnNextIdle = TRUE; 03528 03529 TimedProcessing(); 03530 //UpdateColourEditor (); 03531 03532 break; 03533 03534 03535 case DIM_SELECTION_CHANGED: // Combo-box selection 03536 case DIM_SELECTION_CHANGED_COMMIT: // Combo-box selection 03537 if (ISentTheMessage) 03538 break; 03539 03540 if ((Msg->GadgetID == _R(IDC_EDIT_NAMEMENU)) || 03541 (Msg->GadgetID == _R(IDC_EDIT_COLMODEL)) || 03542 (Msg->GadgetID == _R(IDC_EDIT_COLTYPE)) || 03543 (Msg->GadgetID == _R(IDC_EDIT_PARENTCOL))) 03544 { 03545 // A dropdown list has been closed up again - turn off our focus-losing lock 03546 LockLoseFocus = FALSE; 03547 } 03548 03549 // WEBSTER - markn 14/1/97 03550 // Commented out the combo box handling 03551 //#ifndef WEBSTER 03552 // Handle selections in the colour name combobox. This will switch to 03553 // editing the chosen colour 03554 if (Msg->GadgetID == _R(IDC_EDIT_NAMEMENU) && ParentList != NULL) 03555 { 03556 WORD SelIndex; 03557 GetValueIndex(_R(IDC_EDIT_NAMEMENU), &SelIndex); 03558 03559 if (NameDropDown != NULL) 03560 { 03561 IndexedColour *Selected = NameDropDown->DecodeSelection((INT32)SelIndex); 03562 03563 if (Selected == NULL) 03564 { 03565 if (SelIndex < 2) // Have chosen a valid special item 03566 { 03567 // Edit fill colour or line colour 03568 |