sgcolour.h

Go to the documentation of this file.
00001 // $Id: sgcolour.h 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // SGColour.h - the ColourSGallery (Colour SuperGallery) class
00099 
00100 #ifndef INC_SGCOLOUR
00101 #define INC_SGCOLOUR
00102 
00103 
00104 #include "coplfilr.h"       // For PalettePrefix
00105 //#include "doccolor.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "dragcol.h"
00107 //#include "pathname.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "sgallery.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 #include "sgdrag.h"
00110 //#include "sgtree.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 
00112 
00113 // Prototypes
00114 class IndexedColour;
00115 class ColourList;
00116 class ColourListComponent;
00117 
00118 
00119 
00120 /********************************************************************************************
00121 
00122 >   class GalleryColourDragInfo : public ColourDragInformation
00123 
00124     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00125     Created:    16/2/95
00126     Purpose:    A colour drag, which was started from the colour gallery
00127 
00128     Notes:      Note that Library/Document colour dragging is handled in the base class
00129 
00130     SeeAlso:    ColourDragInformation
00131                 
00132 ********************************************************************************************/
00133 class SGDisplayColour;
00134 
00135 class GalleryColourDragInfo : public ColourDragInformation
00136 { 
00137     CC_DECLARE_DYNCREATE(GalleryColourDragInfo)
00138  
00139 public:
00140     GalleryColourDragInfo();
00141 
00142         // Drag of a "document colour"
00143     GalleryColourDragInfo(Document *pDocument, SGDisplayColour *pSourceItem,
00144                             SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
00145                             BOOL IsAdjust = FALSE);
00146 
00147         // Drag of a "library colour"
00148     GalleryColourDragInfo(SGDisplayColour *pSourceItem,
00149                             SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
00150                             BOOL IsAdjust = FALSE);
00151     
00152     virtual void OnClick(INT32 Flags, POINT Point);
00153 
00154     SGDisplayColour *GetDraggedColour(void) { return(SourceItem); }
00155 
00156 
00157 protected:
00158     SGDisplayColour *SourceItem;
00159     SGMouseInfo     MouseInfo;
00160     SGMiscInfo      MiscInfo;
00161 };
00162 
00163 
00164 
00165 /*********************************************************************************************
00166 
00167 >   class   SGColourDragTarget : public SGListDragTarget
00168 
00169     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00170     Created:    20/3/95
00171 
00172     Purpose:    An instantiation of this class is created by each entity which wishes to 
00173                 provide a 'destination' to which the mouse can go to complete a drag.
00174 
00175                 This particular target is used for handling drags of ColourSGalllery items
00176                 within their displayed list. It automatically handles drags with draginfo
00177                 derived from ColourDragInformation.
00178 
00179     Notes:      Drag targets are destructed automatically when a drag finishes by the drag
00180                 manager with which they were registered.
00181 
00182                 To remove a drag target at any time, destruct it - it automatically deregisters
00183                 and cleans up.
00184                 
00185     SeeAlso:    DragManagerOp::StartDrag; DragInformation; DragTarget;
00186                 SGColourDragTarget::ProcessEvent
00187 
00188     Documentation:  Docs\Specs\DragMan.doc; Docs\HowToUse\SGallery.doc
00189 
00190 *********************************************************************************************/
00191 
00192 class SGColourDragTarget : public SGListDragTarget
00193 {
00194 friend class DragManagerOp;
00195     
00196 CC_DECLARE_DYNAMIC(SGColourDragTarget)
00197 
00198 public: // Public interface
00199     SGColourDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL);
00200 
00201 protected:
00202         // Process a drag-related event
00203     virtual BOOL ProcessEvent(DragEventType Event,
00204                                 DragInformation *pDragInfo,
00205                                 OilCoord *pMousePos, KeyPress* pKeyPress);
00206 };
00207 
00208 
00209 
00210 
00211 
00212 /***********************************************************************************************
00213 
00214 >   class SGDisplayColour : public SGDisplayItem
00215 
00216     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00217     Created:    27/10/94
00218     Purpose:    This DisplayTree node is used by the Colour SuperGallery
00219                 It is responsible for providing the ability to handle/redraw one IndexedColour
00220                 displayed in said gallery.
00221 
00222     SeeAlso:    ColourSGallery; SuperGallery; SGDisplayItem
00223 
00224 ***********************************************************************************************/
00225 
00226 class CCAPI SGDisplayColour : public SGDisplayItem
00227 {
00228     CC_DECLARE_DYNAMIC(SGDisplayColour);
00229 
00230 public:
00231     SGDisplayColour();
00232     SGDisplayColour(IndexedColour *ColourToDisplay);
00233 
00234 
00235 public:     // Virtual overrides
00236     virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo,
00237                              SGMiscInfo *MiscInfo);
00238 
00239     virtual void DragWasReallyAClick(SGMouseInfo *Mouse, SGMiscInfo *MiscInfo);
00240         // Special handler called by GalleryColourDragInfo when a drag turns out to be a click
00241 
00242 
00243     virtual void GetNameText(String_256 *Result);
00244     virtual void GetFullInfoText(String_256 *Result);
00245         // Read the name and full-information text for this item
00246 
00247     virtual BOOL GetBubbleHelp(DocCoord *MousePos, String_256 *Result);
00248         // Returns a bubble help string (or returns FALSE if it couldn't supply one)
00249     
00250     virtual BOOL GetStatusLineHelp(DocCoord *MousePos, String_256 *Result);
00251         // Returns a status-line help string (or returns FALSE if it couldn't)
00252 
00253     virtual void MoveAfter(SGDisplayNode *NodeToMove);
00254     virtual void MoveBefore(SGDisplayNode *NodeToMove);
00255         // Move items around in the tree, and also move the original in the colour list
00256 
00257     virtual INT32 CompareTo(SGDisplayNode *Other, INT32 SortKey);
00258         // Compare two colours using the given sort key. Returns -ve, 0, or +ve
00259 
00260 
00261 public:     // Specialisations
00262     virtual BOOL IsALibraryColour(void) const;
00263             // Determine if this is really an SGDisplayColour (IndexedColour) or derived
00264             // SGDisplayLibColour (library DocColour) object
00265 
00266     virtual BOOL IsASpotColour(void);
00267             // Determine if the colour in this item is a Spot colour
00268 
00269 
00270 protected:  // Internal handlers
00271     virtual void CalculateMyRect(SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo);
00272             // Determines item size for the current DisplayMode and calculates FormatRect
00273 
00274     virtual void HandleRedraw(SGRedrawInfo *RedrawInfo, SGMiscInfo *MiscInfo);
00275             // Redraws the item into the current FormatRect
00276 
00277 
00278 public:     // Specialisations of this class
00279     inline DocColour *GetDisplayedColour(void);
00280 
00281 
00282 protected:  // Special member variables
00283     DocColour TheColour;
00284 };
00285 
00286 
00287 
00288 /********************************************************************************************
00289 
00290 >   inline DocColour *SGDisplayColour::GetDisplayedColour(void)
00291 
00292     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00293     Created:    18/1/95
00294 
00295     Returns:    A pointer to the colour which this Display Item is used to display.
00296             
00297     Purpose:    To find out the colour this object is responsible for displaying
00298 
00299 ********************************************************************************************/
00300 
00301 DocColour *SGDisplayColour::GetDisplayedColour(void)
00302 {
00303     return(&TheColour);
00304 }
00305 
00306 
00307 
00308 
00309 
00310 /***********************************************************************************************
00311 
00312 >   class SGDisplayLibColour : public SGDisplayColour
00313 
00314     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00315     Created:    6/8/96
00316     Purpose:    This DisplayTree node is used by the Colour SuperGallery
00317                 It is responsible for providing the ability to handle/redraw one library
00318                 colour displayed in said gallery.
00319 
00320     SeeAlso:    ColourSGallery; SuperGallery; SGDisplayColour; SGDisplayItem
00321 
00322 ***********************************************************************************************/
00323 
00324 typedef struct
00325 {
00326     UINT32 Prefix           : 6;
00327     UINT32 NewlineAfter : 1;
00328     UINT32 SpotColour       : 1;
00329 } LibColourFlags;
00330 
00331 class CCAPI SGDisplayLibColour : public SGDisplayColour
00332 {
00333     CC_DECLARE_DYNAMIC(SGDisplayLibColour);
00334 
00335 public:
00336     SGDisplayLibColour();
00337     SGDisplayLibColour(DocColour *ColourToDisplay, StringBase *Name,
00338                         PalettePrefix Prefix = PalettePrefix_None,
00339                         BOOL NewlineAfter = FALSE, BOOL IsSpotColour = FALSE);
00340 
00341 public:
00342     virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo,
00343                              SGMiscInfo *MiscInfo);
00344 
00345     virtual void GetNameText(String_256 *Result);
00346         // Read the name text for this item
00347 
00348     virtual INT32 CompareTo(SGDisplayNode *Other, INT32 SortKey);
00349         // Compare two colours using the given sort key. Returns -ve, 0, or +ve
00350 
00351 
00352 public:     // Specialisations
00353     virtual BOOL IsALibraryColour(void) const;
00354             // Determine if this is really an SGDisplayColour (IndexedColour) or derived
00355             // SGDisplayLibColour (library DocColour) object
00356 
00357     virtual BOOL IsASpotColour(void);
00358             // Determine if the colour in this item is a Spot colour
00359 
00360 private:
00361     StringBase ColourName;      // NOTE: This must be initialised with Alloc() before use
00362     LibColourFlags Flags;       // State flags
00363 };
00364 
00365 
00366 /***********************************************************************************************
00367 
00368 >   class SGDisplayColourGroup : public SGDisplayGroup
00369 
00370     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00371     Created:    25/3/97
00372     Purpose:    A derived SGDisplayColourGroup class for the Colour gallery groups.
00373     SeeAlso:    SuperGallery; SGDisplayGroup; SGDisplayRoot; SGDisplayItem
00374 
00375 ***********************************************************************************************/
00376 
00377 class CCAPI SGDisplayColourGroup : public SGDisplayGroup
00378 {
00379     CC_DECLARE_DYNAMIC(SGDisplayColourGroup);
00380 
00381 public:
00382     SGDisplayColourGroup(SuperGallery *ParentGal,
00383                     Document *ParentDoc = NULL, Library *ParentLib = NULL);
00384 
00385 public:
00386     virtual BOOL IsLibrary() { return FALSE; }
00387 
00388     virtual BOOL DisplayInColourLine();
00389     virtual BOOL SetDisplayInColourLine(BOOL NewState);
00390     virtual BOOL ToggleDisplayInColourLine();
00391 };
00392 
00393 /***********************************************************************************************
00394 
00395 >   class SGDisplayLibColGroup : public SGDisplayColourGroup
00396 
00397     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00398     Created:    9/8/96
00399 
00400     Purpose:    A derived SGDisplayLibColGroup class for Colour gallery libraries.
00401 
00402     SeeAlso:    SuperGallery; SGDisplayGroup; SGDisplayRoot; SGDisplayItem
00403 
00404 ***********************************************************************************************/
00405 
00406 class CCAPI SGDisplayLibColGroup : public SGDisplayColourGroup
00407 {
00408     CC_DECLARE_DYNAMIC(SGDisplayLibColGroup);
00409 
00410 public:
00411     SGDisplayLibColGroup(SuperGallery *ParentGal, PathName *LibraryFile);
00412 
00413 
00414 public: // Functions for virtualisation of groups (building groups but not adding items until we need them)
00415     virtual BOOL CanVirtualise(void);
00416         // Can this group virtualise out to disk? (yes)
00417 
00418     virtual BOOL Virtualise(void);
00419         // Virtualise out (throw away the group contents)
00420 
00421     virtual BOOL DeVirtualise(void);
00422         // Virtualise back in (pull contents back in from disk)
00423 
00424     virtual BOOL IsLibrary() { return TRUE; }
00425 
00426     virtual BOOL DisplayInColourLine() { return m_DisplayInColourLine; } 
00427     virtual BOOL SetDisplayInColourLine(BOOL NewState);
00428     virtual BOOL ToggleDisplayInColourLine();
00429 
00430     // count the number of children that this group has
00431     INT32 CountChildren();
00432     
00433     // find the nth child of this group and return the associated DocColour
00434     DocColour *GetItemColour(UINT32 Index, SGDisplayLibColour **ppLibColour = NULL);
00435 
00436 protected:      // Internal handlers
00437     virtual void ReadGroupTitle(void);
00438         // (Re)Reads a group's title text from the parent doc/lib
00439 
00440 protected:
00441     PathName Filename;
00442 
00443     BOOL m_DisplayInColourLine;
00444 };
00445 
00446 
00447 
00448 
00449 
00450 /***********************************************************************************************
00451 
00452 >   class ColourSGallery : public SuperGallery
00453 
00454     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00455     Created:    27/10/94
00456     Purpose:    The Colour SuperGallery class
00457 
00458     Notes:      SuperGalleries are specced in a number of docs including
00459                     specs\gallib.doc ("super" gallery extensions)
00460                     specs\propui.doc  (gallery basic ui)
00461 
00462     SeeAlso:    SuperGallery; SGDisplayColour
00463 
00464 ***********************************************************************************************/
00465 
00466 class ColourSGallery : public SuperGallery
00467 {
00468 friend class SGDisplayColour;       // Allow DisplayColours access to the ISentTheMessage lock
00469 
00470     CC_DECLARE_DYNCREATE(ColourSGallery)
00471 
00472 public:
00473     ColourSGallery();
00474     ~ColourSGallery();
00475 
00476     virtual MsgResult Message(Msg* Message);
00477 
00478     static BOOL Init(void);
00479 
00480     // Returns a pointer to the line gallery, or NULL if there isn't one.
00481     static ColourSGallery* GetInstance();
00482 
00483 protected:              // Overridden upcall methods
00484     virtual BOOL PreCreate(void);
00485 
00486     virtual BOOL ApplyAction(SGActionType Action);
00487 
00488     virtual void HandleDragStart(DragMessage *DragMsg);
00489 
00490     virtual void SelectionHasChanged(void);
00491 
00492     virtual void DoShadeGallery(BOOL ShadeIt);
00493         // Called by SuperGallery::ShadeGallery to allow the derived gallery to add code
00494         // to shade/unshade any extra controls it may have in the window
00495 
00496 public:                 // Overridden upcall methods
00497     virtual SGDisplayItem *CopyDisplayItem(SGDisplayItem *SourceItem, 
00498                                 SGDisplayGroup *DestGroup,
00499                                 SGDisplayItem *TargetPosition = NULL);
00500         // Asks the gallery to copy (or if appropriate, move) the given item to
00501         // the given group. This hould be done by copying the given item, and
00502         // then calling InsertCopiedItem() to insert it appropriately (see above)
00503 
00504     virtual void AllItemsCopied(SGDisplayGroup *DestGroup);
00505         // Informs the gallery when a sequence of MOVE or COPY actions have been applied
00506         // to the given gallery (see SGDisplayNode::MoveBefore; SGallery::CopyDisplayItem)
00507         // (this allows you to cause a message to be broadcast which sums up all of the
00508         // changes in one go, which is a good thing if a selection of thousands of objects
00509         // has just been moved up one position in the list!)
00510 
00511 
00512 protected:      // RenderRegion replacement - override to provide anything other than OSRndRgn
00513     virtual RenderRegion *CreateRenderRegion(DocRect *VirtualSize, ReDrawInfoType *DlgRedrawInfo);
00514     virtual void DestroyRenderRegion(RenderRegion *pRender);
00515         // Overridden to make us use a colour-corrected/separated render region.
00516 
00517 
00518 public:         // Overridden Command interface (for Ops and menu support)
00519     virtual BOOL InitMenuCommands(void);
00520         // Called on startup to initialise any desired menu commands. Will make repeated calls
00521         // to InitMenuCommand(), below.
00522 
00523     virtual BOOL BuildCommandMenu(GalleryContextMenu *TheMenu, SGMenuID MenuID);
00524         // Builds the command menu for the given menu pop-up (over an item, or options button)
00525 
00526     virtual OpState GetCommandState(StringBase *CommandID, String_256 *ShadeReason);
00527         // Returns an OpState indicating the state of this command, much like an Op GetState
00528 
00529     virtual void DoCommand(StringBase *CommandID);
00530         // Attempts to "do" the given command. Should call down to the base class to handle
00531         // any commands it can't deal with.
00532 
00533 
00534 public:         // Colour library support
00535     void SetCurrentImportGroup(SGDisplayLibColGroup *TheGroup)  { CurrentImportGroup = TheGroup; };
00536     SGDisplayLibColGroup *GetCurrentImportGroup(void)           { return(CurrentImportGroup); };
00537         // Sets/Gets the current group into which we're importing (see DeVirtualise())
00538 
00539 
00540     static BOOL CanAddColourToGallery(IndexedColour *pCol,ColourList* pColList);
00541             // Helper function for CreateNewSubtree()
00542             // WEBSTER - markn 5/12/96
00543 
00544 protected:      // Personal/Internal methods
00545     void CreateNewSubtree(Document *ParentDoc, SGDisplayColourGroup *ExistingGroup = NULL);
00546             // Creates a new subtree group to display the colours for the given document
00547             // If ExistingGroup != NULL, that group will be re-cached for the given doc
00548 
00549     void RedrawColourDisplay(Document *TheDocument, IndexedColour *TheColour);
00550             // Redraws the area of the window showing the one specified colour (no reformat)
00551 
00552     void EditColour(ColourList *ParentList, IndexedColour *TheColour);
00553             // Opens the colour editor on the given colour (splat! ;-)
00554 
00555     BOOL OKToDeleteSelection(SGDisplayGroup *DocumentGroup);
00556             // Checks if it is OK to delete the selection; May return TRUE, but deselect
00557             // some items selectively to change the set to be deleted
00558 
00559     BOOL DeleteSelection(SGDisplayGroup *DocumentGroup, ColourList *ParentList);
00560             // Forcibly deletes all the selected colours in the given document group
00561 
00562     void SetSelectionFromDocument(BOOL AlwaysScroll = FALSE);
00563             // Selects the current line/fill colours from the document
00564 
00565 protected:
00566     BOOL ISentTheMessage;               // Lock to stop us responding to messages we sent
00567 
00568     ColourListComponent *CurrentColComp;// NULL, or points to the colour component in use
00569     SGDisplayNode *CurrentTarget;       // NULL (add-tail), or the item to insert before
00570                                         // when ending the component copy
00571 
00572 public:     // preferences
00573     static INT32 AutoScrollSelection;       // TRUE to allow auto-scrolling when new colours are
00574                                         // selected in the gallery (which can be annoying
00575                                         // if you were scrolled where you wanted to be)
00576 
00577     static INT32 DefaultDisplayMode;        // Memory of current display mode between sessions
00578 
00579     static String_256 PalettePath;      // The path to load the palettes from 
00580 
00581     static BOOL ShowDocumentColours;    // True if want document colours in colour line
00582 
00583     static BOOL ShowNetscapeColours;    // True if want Netscape colours being shown in colour line
00584                                         // Webster only at present
00585 
00586 private:
00587     SGDisplayLibColGroup *CurrentImportGroup;   // Group currently being imported into, or NULL
00588 
00589 public:
00590     // This will create the gallery groups (unless they're already there) and return TRUE if ok.
00591     BOOL MakeSureGroupsHaveBeenCreated();
00592     
00593     // Walk through the list of library colour galleries
00594     SGDisplayLibColGroup * GetFirstLibGroup();
00595     SGDisplayLibColGroup * GetNextLibGroup(SGDisplayLibColGroup * pLibGroup);
00596 
00597     BOOL ApplySelectedAsBackground();
00598     BOOL GetDocColourToApply(SGDisplayColour *pFirstSelected, DocColour * pColourToApply,
00599                              Document **pDoc);
00600 protected:
00601     static ColourSGallery* m_pTheGallery;
00602 };
00603 
00604 
00605 
00606 
00607 
00608 /********************************************************************************************
00609 
00610 >   class OpDisplayColourGallery: public Operation
00611 
00612     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00613     Created:    9/2/95 (Based on the Colour SGallery code)
00614 
00615     Purpose:    Displays the Colour gallery.
00616                 This op can be attached to a menu, button or keypress
00617 
00618     SeeAlso:    ColourSGallery
00619 
00620 ********************************************************************************************/
00621 
00622 #define OPTOKEN_DISPLAYCOLOURGALLERY _T("DisplayColourGallery")
00623 
00624 class CCAPI OpDisplayColourGallery: public Operation
00625 {         
00626     CC_DECLARE_DYNCREATE( OpDisplayColourGallery );
00627 
00628 public:
00629     static BOOL     Init();             
00630     static OpState  GetState(String_256*, OpDescriptor*);       
00631     void            Do(OpDescriptor*);
00632 
00633     static SuperGallery *FindGallery(void);
00634             // Finds the Colour gallery class instance
00635 };  
00636 
00637 
00638 
00639 
00640 
00641 
00642 
00643 
00644 #define OPTOKEN_COLOURNAMEDLG _T("ColourNameDlg")
00645 
00646 /********************************************************************************************
00647 
00648 >   class ColourNameDlg: public DialogOp
00649 
00650     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00651     Created:    1/4/95
00652     Purpose:    Allows the user to edit the name of a colour
00653 
00654     Notes:      Call InvokeDialog to show the dialogue. Two overloaded methods are
00655                 provided, which take a string to set, or a colourlist+colour respectively.
00656 
00657 ********************************************************************************************/
00658 
00659 class ColourNameParam : public OpParam      // Internal parameter-passing class
00660 {
00661 CC_DECLARE_MEMDUMP(ColourNameParam)
00662 
00663 public:
00664     ColourList      *TheList;
00665     IndexedColour   *TheColour;
00666     String_64       *TheName;
00667     BOOL            Result;
00668 
00669 public:
00670     ColourNameParam()   \
00671                 { TheList = NULL; TheColour = NULL; TheName = NULL; Result = FALSE; }
00672 
00673     ColourNameParam(ColourList *ParentList, IndexedColour *ColourToEdit)        \
00674                 { TheList = ParentList; TheColour = ColourToEdit; TheName = NULL; Result = FALSE; }
00675 
00676     ColourNameParam(String_64 *NameToFill, IndexedColour *DisplayColour = NULL) \
00677                 { TheList = NULL; TheColour = DisplayColour; TheName = NameToFill; Result = FALSE; }
00678 };
00679 
00680 
00681 
00682 class ColourNameDlg : public DialogOp
00683 {         
00684 CC_DECLARE_DYNCREATE(ColourNameDlg)
00685 
00686 public:     // External inteface
00687     static BOOL InvokeDialog(ColourList *Parentlist, IndexedColour *ColourToName);
00688     static BOOL InvokeDialog(String_64 *NameToFill, IndexedColour *DisplayColour = NULL);
00689 
00690 
00691 public:     // DialogOp interface
00692     ColourNameDlg();
00693 
00694     void DoWithParam(OpDescriptor*, OpParam*);
00695     BOOL Create(); 
00696 
00697     static const INT32 IDD;
00698     static const CDlgMode Mode;
00699 
00700     static OpState GetState(String_256*, OpDescriptor*);    
00701     static BOOL Init();                        
00702 
00703     virtual MsgResult Message(Msg* Message);
00704 
00705 protected:
00706     void CommitName(void);      // Reads from the dialogue to commit the name, and End()s
00707 
00708 protected:  // Data members
00709     ColourNameParam *Info;
00710 }; 
00711 
00712 
00713 #endif
00714 

Generated on Sat Nov 10 03:46:52 2007 for Camelot by  doxygen 1.4.4