SGDisplayLibColour Class Reference

#include <sgcolour.h>

Inheritance diagram for SGDisplayLibColour:

SGDisplayColour SGDisplayItem SGDisplayNode CCObject SimpleCCObject List of all members.

Public Member Functions

 SGDisplayLibColour ()
 SGDisplayLibColour constructor DON'T call this constructor. It ERROR3's. Call the other constructor.
 SGDisplayLibColour (DocColour *ColourToDisplay, StringBase *Name, PalettePrefix Prefix=PalettePrefix_None, BOOL NewlineAfter=FALSE, BOOL IsSpotColour=FALSE)
 SGDisplayLibColour constructor.
virtual BOOL HandleEvent (SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo)
 Handles a SuperGallery DisplayTree event.
virtual void GetNameText (String_256 *Result)
 To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods.
virtual INT32 CompareTo (SGDisplayNode *Other, INT32 SortKey)
 Compares this Colour to the 'other' Colour, to determine their relative positions in the display tree. Returns a value which usually indicates that the other Colour should be inserted before (-1, or 0) or after (+1) this item.
virtual BOOL IsALibraryColour (void) const
 Proper virtual-function method for differentiating between IndexedColour and library DocColour gallery display items.
virtual BOOL IsASpotColour (void)
 Determine if the display colour is a normal or spot colour.

Private Member Functions

 CC_DECLARE_DYNAMIC (SGDisplayLibColour)

Private Attributes

StringBase ColourName
LibColourFlags Flags

Detailed Description

Definition at line 331 of file sgcolour.h.


Constructor & Destructor Documentation

SGDisplayLibColour::SGDisplayLibColour  ) 
 

SGDisplayLibColour constructor DON'T call this constructor. It ERROR3's. Call the other constructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/8/96

Definition at line 1640 of file sgcolour.cpp.

01641 {
01642     ERROR3("Illegal call on default SGDisplayLibColour constructor - call the other one!");
01643     Flags.Prefix = 0;
01644     Flags.NewlineAfter = FALSE;
01645     Flags.SpotColour = FALSE;
01646 }

SGDisplayLibColour::SGDisplayLibColour DocColour ColourToDisplay,
StringBase Name,
PalettePrefix  Prefix = PalettePrefix_None,
BOOL  NewlineAfter = FALSE,
BOOL  IsSpotColour = FALSE
 

SGDisplayLibColour constructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/8/96
Parameters:
ColourToDisplay - The definition of the colour this item will display [INPUTS] Name - The name (suffix) of this colour Prefix - ID of a prefix to be prepended to the name NewlineAfter - TRUE if this item is the last in a "run" of colours and should cause a new-line in the displayed list to produce a tidier on screen display. This is only used in "icons only" mode. IsSpotColour - FALSE for a normal colour, TRUE if this is a spot colour

Definition at line 1671 of file sgcolour.cpp.

01674 {
01675     ERROR3IF((INT32)Prefix < 0 || (INT32)Prefix > 0x3f, "Out of range prefix value");
01676     Flags.Prefix = ((UINT32) Prefix) & 0x3f;
01677     Flags.NewlineAfter  = NewlineAfter;
01678     Flags.SpotColour    = IsSpotColour;
01679 
01680     ERROR3IF(ColourToDisplay == NULL || Name == NULL, "Illegal NULL params");
01681     TheColour = *ColourToDisplay;
01682 
01683     // Copy the colour name. Note that we use a StringBase object an explicitly
01684     // allocate exactly the right number of characters, in order to minimise
01685     // memory usage (libraries hold thousands of colours, so even one byte less
01686     // saves kilobytes of storage over an entire library)
01687 //  INT32 Length = Name->Length();
01688     ColourName.Alloc(Name->Length());
01689     ColourName = *Name;
01690 }


Member Function Documentation

SGDisplayLibColour::CC_DECLARE_DYNAMIC SGDisplayLibColour   )  [private]
 

INT32 SGDisplayLibColour::CompareTo SGDisplayNode Other,
INT32  SortKey
[virtual]
 

Compares this Colour to the 'other' Colour, to determine their relative positions in the display tree. Returns a value which usually indicates that the other Colour should be inserted before (-1, or 0) or after (+1) this item.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/8/96
Parameters:
Other - the Colour to compare this Colour to [INPUTS] SortKey - An integer identifying how to compare the items 0 = No sorting (always returns 0) 1 = Sort-by-name 2 = Sort-by-hue 3 = Sort-by-intensity 4 = Sort-by-model
Returns:
negative (I am lesser), 0 (we are equal), or positive (I am greater)
Notes: Overrides the base Colour class compare for colour names, but otherwise relegates control back to the base class function.

See also:
SGDisplayNode::CompareTo; SGDisplayColour::CompareTo

Reimplemented from SGDisplayColour.

Definition at line 1902 of file sgcolour.cpp.

01903 {
01904     ERROR3IF(Other == NULL, "Illegal NULL parameter");
01905 
01906     ERROR3IF(!Other->IsKindOf(CC_RUNTIME_CLASS(SGDisplayLibColour)),
01907                 "SGDisplayLibColour::CompareTo - The other item's not a colour!");
01908 
01909     switch (SortKey)
01910     {
01911         case SGSORTKEY_BYNAME:
01912             {
01913                 // We override the base class version to use the specialised name strings that
01914                 // Library colours hold in them
01915                 SGDisplayLibColour *pOther = (SGDisplayLibColour *)Other;
01916 
01917                 return(ColourName.CompareTo( (TCHAR *) pOther->ColourName) );
01918             }
01919             break;
01920     }
01921 
01922     // Apart from sort-by-name, all sorting can be achieved by the base class code
01923     return(SGDisplayColour::CompareTo(Other, SortKey));
01924 }

void SGDisplayLibColour::GetNameText String_256 Result  )  [virtual]
 

To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/8/96
Parameters:
On exit, the string pointed at by Result will contain either a blank [OUTPUTS] string, or the name text associated with this item (if any)
See also:
SGDisplayLibColour::GetFullInfoText

Reimplemented from SGDisplayColour.

Definition at line 1713 of file sgcolour.cpp.

01714 {
01715     ERROR3IF(Result == NULL, "Illegal NULL param");
01716 
01717     switch((PalettePrefix) Flags.Prefix)
01718     {
01719         case PalettePrefix_Pantone:
01720             *Result = TEXT("PANTONE ");     // NOTE - all these string constants are
01721             *Result += ColourName;          // the same in all languages and changing the
01722 //          *Result += TEXT(" PC");         // exact string used here could affect the
01723             return;                         // Pantone licence
01724 
01725         case PalettePrefix_PantoneSpot:
01726             *Result = TEXT("PANTONE ");     // NOTE - all these string constants are
01727             *Result += ColourName;          // the same in all languages and changing the
01728             *Result += TEXT(" PC");         // exact string used here could affect the
01729             return;                         // Pantone licence
01730 
01731         case PalettePrefix_Focoltone:
01732             *Result = TEXT("Focoltone ");
01733             break;
01734 
01735         case PalettePrefix_Trumatch:
01736             *Result = TEXT("Trumatch ");
01737             break;
01738 
01739         case PalettePrefix_RGB:
01740             *Result = TEXT("RGB ");
01741             break;
01742 
01743         default:
01744             *Result = TEXT("");
01745             break;
01746     }
01747 
01748     *Result += ColourName;
01749 }

BOOL SGDisplayLibColour::HandleEvent SGEventType  EventType,
void *  EventInfo,
SGMiscInfo MiscInfo
[virtual]
 

Handles a SuperGallery DisplayTree event.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/8/96
Parameters:
EventType - An enumerated value describing what type of event is to be processed [INPUTS]
EventInfo - A structure describing the event (may be NULL). The exact thing pointed at by this pointer depends upon the event type:

MonoOn Event Thing EventInfo points at SGEVENT_FORMAT (SGFormatInfo *) SGEVENT_REDRAW (SGRedrawInfo *) SGEVENT_MOUSECLICK (SGMouseInfo *) MonoOff Use the provided SGDisplayNode::Get[Format]Info() inlines to retrieve this information - they provide useful error/type checking, and hide the cast

MiscInfo - always provided. Contains a few useful bits of info that may be needed for all event types.

Parameters:
FormatInfo is updated as appropriate [OUTPUTS]
Returns:
TRUE if the event was handled successfully FALSE if it was not
Notes: This overrides the pure virtual SGDisplayNode::HandleEvent method

A node need not handle a specific event - if it does not handle it, it should return FALSE.

Redraw and Formatting handlers should never return TRUE, as this will prevent the event from continuing through the tree.

Non-leaf-nodes must call SGDisplayNode::GiveEventToMyChildren in order to pass the event dow the tree. THIS node is a leaf-node, so it doesn't.

See also:
SGDisplayNode::HandleEvent

Reimplemented from SGDisplayColour.

Definition at line 1800 of file sgcolour.cpp.

01802 {
01803     switch (EventType)
01804     {
01805         case SGEVENT_FORMAT:
01806             {
01807                 SGFormatInfo *FormatInfo = GetFormatInfo(EventType, EventInfo);
01808                 CalculateMyRect(FormatInfo, MiscInfo);      // Cache our FormatRect for later use
01809 
01810                 // If in display mode 2, and this is the end of a pantone "page", then
01811                 // we special case it to do a "newline" at the end of the line, to
01812                 // keep pages together nicely
01813                 if (!LibraryHasBeenSorted && MiscInfo->DisplayMode == 2)
01814                 {
01815                     if (Flags.NewlineAfter)
01816                         NewLine(FormatInfo, MiscInfo);
01817                 }
01818             }
01819             break;
01820 
01821         case SGEVENT_MOUSECLICK:
01822             {
01823                 SGMouseInfo *Mouse = GetMouseInfo(EventType, EventInfo);
01824 
01825                 if (FormatRect.ContainsCoord(Mouse->Position))
01826                 {
01827                     // If the colour is in the selected document, then it is safe to
01828                     // do a colour drag - for now, it will only allow drags for the
01829                     // selected doc.
01830                     // Otherwise, the normal click action takes place.
01831                     // If the drag fails (turns into a click) then the normal click action
01832                     // takes place, passed on by the GalleryColourDragInfo::OnClick handler
01833 //                  SGDisplayGroup *Parent = (SGDisplayGroup *) GetParent();
01834 
01835                     if (Mouse->DoubleClick) // || Parent->GetParentDocument() != Document::GetSelected())
01836                     {
01837                         // Use the default click handler.
01838                         // However, because we assign a very special meaning to adjust-double-click (apply
01839                         // line colour) we don't want the default action (apply & close gallery) to take
01840                         // effect, so we pass in FALSE as the last parameter.
01841                         DefaultClickHandler(Mouse, MiscInfo, FALSE, FALSE);
01842                     }
01843                     else
01844                     {
01845                         DefaultPreDragHandler(Mouse, MiscInfo);
01846 
01847                         // Don't start drags when there are no documents about
01848                         if (Document::GetSelected() != NULL)
01849                         {
01850                             GalleryColourDragInfo *DragCol;
01851                             DragCol = new GalleryColourDragInfo(this, Mouse, MiscInfo, Mouse->MenuClick);
01852 
01853                             if (DragCol != NULL)
01854                                 DragManagerOp::StartDrag(DragCol, GetListWindow());
01855                         }
01856                     }
01857 
01858                     return(TRUE);       // Claim this event - nobody else can own this click
01859                 }
01860             }
01861             break;
01862 
01863 
01864         default:
01865             return(SGDisplayColour::HandleEvent(EventType, EventInfo, MiscInfo));
01866     }
01867 
01868     // Default return value: We do not claim this event, so it will be passed on to others
01869     return(FALSE);
01870 }

BOOL SGDisplayLibColour::IsALibraryColour void   )  const [virtual]
 

Proper virtual-function method for differentiating between IndexedColour and library DocColour gallery display items.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/8/96
Parameters:
- [INPUTS]
Returns:
FALSE if this is a base-class SGDisplayColour (IndexedColour) TRUE if this is a derived class SGDisplayLibColour (library DocColour)
Notes: Always returns TRUE

Reimplemented from SGDisplayColour.

Definition at line 1946 of file sgcolour.cpp.

01947 {
01948     return(TRUE);
01949 }

BOOL SGDisplayLibColour::IsASpotColour void   )  [virtual]
 

Determine if the display colour is a normal or spot colour.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/9/96
Returns:
FALSE if this is a normal colour TRUE if this is a spot colour

Reimplemented from SGDisplayColour.

Definition at line 1967 of file sgcolour.cpp.

01968 {
01969     // If spot colours are all forced to be process, this colour is a process colour!
01970     if (IndexedColour::AreSpotsForcedToProcess())
01971         return(FALSE);
01972 
01973     return(Flags.SpotColour);
01974 }


Member Data Documentation

StringBase SGDisplayLibColour::ColourName [private]
 

Definition at line 361 of file sgcolour.h.

LibColourFlags SGDisplayLibColour::Flags [private]
 

Reimplemented from SGDisplayNode.

Definition at line 362 of file sgcolour.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:01:01 2007 for Camelot by  doxygen 1.4.4