SGDisplayLibColGroup Class Reference

A derived SGDisplayLibColGroup class for Colour gallery libraries. More...

#include <sgcolour.h>

Inheritance diagram for SGDisplayLibColGroup:

SGDisplayColourGroup SGDisplayGroup SGDisplayNode CCObject SimpleCCObject List of all members.

Public Member Functions

 SGDisplayLibColGroup (SuperGallery *ParentGal, PathName *LibraryFile)
 Constructor.
virtual BOOL CanVirtualise (void)
 To deterimine if this group can be virtualised to disk.
virtual BOOL Virtualise (void)
 Virtualises this library out to disk (or rather, to be more accurate, chucks this library out of memory. Colour libraries are totally read-only, although while loaded we let the user reorganise them for convenience).
virtual BOOL DeVirtualise (void)
 De-Virtualises this library - loads it back in from disk.
virtual BOOL IsLibrary ()
virtual BOOL DisplayInColourLine ()
 To find out the current state of the showing on Colour Line flag.
virtual BOOL SetDisplayInColourLine (BOOL NewState)
 To set a new current state of the ShowOnColourLine flag.
virtual BOOL ToggleDisplayInColourLine ()
 To toggle the current state of the ShowOnColourLine flag.
INT32 CountChildren ()
 Returns the number of children of this group node.
DocColourGetItemColour (UINT32 Index, SGDisplayLibColour **ppLibColour=NULL)
 Returns the DocColour associated with the specified item in this group or NULL. If the SGDisplayLibColour pointer is provided it is updated with the found item THe called can then interogate the item if so desired.

Protected Member Functions

virtual void ReadGroupTitle (void)
 Reads the title for this group. This method overrides the base class functionality merely to stop it sitting on the TitleText member variable, in which our title is always cached.

Protected Attributes

PathName Filename
BOOL m_DisplayInColourLine

Private Member Functions

 CC_DECLARE_DYNAMIC (SGDisplayLibColGroup)

Detailed Description

A derived SGDisplayLibColGroup class for Colour gallery libraries.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
See also:
SuperGallery; SGDisplayGroup; SGDisplayRoot; SGDisplayItem

Definition at line 406 of file sgcolour.h.


Constructor & Destructor Documentation

SGDisplayLibColGroup::SGDisplayLibColGroup SuperGallery ParentGal,
PathName LibraryFile
 

Constructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Parameters:
ParentGal - The parent gallery of this group [INPUTS] LibraryFile - The library palette file to be displayed by this group

Definition at line 2073 of file sgcolour.cpp.

02074                      : SGDisplayColourGroup(ParentGal)
02075 {
02076     ERROR3IF(LibraryFile == NULL, "Illegal NULL param");
02077 
02078     // Copy the group name into the base class member variable
02079     String_256 TheFile = LibraryFile->GetFileName(FALSE);
02080 
02081     String_256 UpperFile(TheFile);      // Force the name to uppercase to compare, to be safe
02082     UpperFile.toUpper();
02083 
02084     if (UpperFile == String_256(TEXT("PANTSPOT")))
02085         TitleText.MakeMsg(_R(IDS_PANTONESPOTLIB));                      // "PANTONE Spot Colours"
02086     else if (UpperFile == String_256(TEXT("PPROCESSU")))
02087         TitleText.MakeMsg(_R(IDS_PANTONEPROCESSU));                     // "PANTONE Color Name-Uncoated"
02088     else if (UpperFile == String_256(TEXT("PPROCESSC")))
02089         TitleText.MakeMsg(_R(IDS_PANTONEPROCESSC));                     // "PANTONE Color Name-Coated"
02090     else if (UpperFile == String_256(TEXT("WEB")))
02091         TitleText.MakeMsg(_R(IDS_WEBLIBRARY));                          // "Web Colours"
02092     else
02093         TitleText.MakeMsg(_R(IDS_COLOURLIBRARY), (TCHAR *)TheFile);     // "Colour library Fabby.pal"
02094 
02095     // Copy the filename into our member variable
02096     Filename = *LibraryFile;
02097 
02098     Flags.Folded        = TRUE;     // Always default to being folded
02099     Flags.Virtualised   = TRUE;     // And virtualised (we demand-load when we're unfolded)
02100 
02101     Flags.CanSelect     = TRUE;     // The group is selectable (why not?)
02102 
02103     Flags.ReadOnly      = TRUE;     // The group is read-only (won't allow items to be dropped into it)
02104 
02105     // Illegal default value to determine if value is present
02106     m_DisplayInColourLine = -1;
02107 
02108     // read a preference value for that named gallery
02109     /*BOOL ReadOk =*/ Camelot.GetPrefDirect(TEXT("ColourLine"), UpperFile, &m_DisplayInColourLine);
02110     if (m_DisplayInColourLine == -1)
02111     {
02112         // If the value wasn't present then default to TRUE for "WEB" and FALSE for others
02113         m_DisplayInColourLine = (UpperFile == String_256(TEXT("WEB")));
02114     }
02115 }


Member Function Documentation

BOOL SGDisplayLibColGroup::CanVirtualise void   )  [virtual]
 

To deterimine if this group can be virtualised to disk.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Returns:
TRUE
Colour libraries can be virtualised

Reimplemented from SGDisplayGroup.

Definition at line 2134 of file sgcolour.cpp.

02135 {
02136     return(TRUE);
02137 }

SGDisplayLibColGroup::CC_DECLARE_DYNAMIC SGDisplayLibColGroup   )  [private]
 

INT32 SGDisplayLibColGroup::CountChildren  ) 
 

Returns the number of children of this group node.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/3/97
Returns:
The number of children

Definition at line 2245 of file sgcolour.cpp.

02246 {
02247     INT32 total = 0;
02248 
02249     SGDisplayNode *pChild = GetChild();
02250     while (pChild)
02251     {
02252         total ++;
02253         pChild = pChild->GetNext();
02254     }
02255 
02256     return total;
02257 }

BOOL SGDisplayLibColGroup::DeVirtualise void   )  [virtual]
 

De-Virtualises this library - loads it back in from disk.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Returns:
TRUE for success

Reimplemented from SGDisplayGroup.

Definition at line 2183 of file sgcolour.cpp.

02184 {
02185     if(!IsVirtualised())
02186         return TRUE;
02187 
02188     // Try and find the generic palette filter to load whatever type of palette file we're using
02189     Filter *pFilter = Filter::GetFirst();
02190     while (pFilter != NULL && pFilter->FilterID != FILTERID_PALETTE)
02191         pFilter = Filter::GetNext(pFilter);
02192 
02193     CCDiskFile Infile;
02194     if (pFilter == NULL || !Infile.open(Filename, ios::in | ios::binary))
02195         return(FALSE);
02196 
02197     ((ColourSGallery *)GetParentGallery())->SetCurrentImportGroup(this);
02198 
02199     if (!pFilter->DoImport(NULL, &Infile, NULL))
02200         InformError();
02201 
02202     ((ColourSGallery *)GetParentGallery())->SetCurrentImportGroup(NULL);
02203 
02204     if (Infile.isOpen())
02205         Infile.close();
02206 
02207     SetVirtualisedState(FALSE);
02208     return(TRUE);
02209 }

virtual BOOL SGDisplayLibColGroup::DisplayInColourLine  )  [inline, virtual]
 

To find out the current state of the showing on Colour Line flag.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/3/97
Returns:
The current state of the ShowOnColourLine flag.

Reimplemented from SGDisplayColourGroup.

Definition at line 426 of file sgcolour.h.

00426 { return m_DisplayInColourLine; } 

DocColour * SGDisplayLibColGroup::GetItemColour UINT32  Index,
SGDisplayLibColour **  ppLibColour = NULL
 

Returns the DocColour associated with the specified item in this group or NULL. If the SGDisplayLibColour pointer is provided it is updated with the found item THe called can then interogate the item if so desired.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/3/97
Parameters:
The index of the item required [INPUTS] An optional SGDisplayLibColour pointer, defaults to null.
Returns:
The DocColour associated with the specified item or NULL

Definition at line 2274 of file sgcolour.cpp.

02275 {
02276     UINT32 item = 0;
02277 
02278     SGDisplayLibColour *pChild = (SGDisplayLibColour *)GetChild();
02279     while (pChild)
02280     {
02281         if (item == Index)
02282         {
02283             // If the caller desired it, return the lib colour item
02284             if (ppLibColour)
02285                 *ppLibColour = pChild;
02286             return pChild->GetDisplayedColour();
02287         }
02288         
02289         item ++;
02290         pChild = (SGDisplayLibColour *)pChild->GetNext();
02291     }
02292 
02293     if (ppLibColour)
02294         *ppLibColour = NULL;
02295 
02296     // we found nothing
02297     return NULL;
02298 }

virtual BOOL SGDisplayLibColGroup::IsLibrary  )  [inline, virtual]
 

Reimplemented from SGDisplayColourGroup.

Definition at line 424 of file sgcolour.h.

00424 { return TRUE; }

void SGDisplayLibColGroup::ReadGroupTitle void   )  [protected, virtual]
 

Reads the title for this group. This method overrides the base class functionality merely to stop it sitting on the TitleText member variable, in which our title is always cached.

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

Reimplemented from SGDisplayGroup.

Definition at line 2227 of file sgcolour.cpp.

02228 {
02229     // Simply override the function so that it leaves the TitleText member variable alone!
02230 }

BOOL SGDisplayLibColGroup::SetDisplayInColourLine BOOL  NewState  )  [virtual]
 

To set a new current state of the ShowOnColourLine flag.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/3/97
Parameters:
New state for the ShowOnColourLine flag. [INPUTS]
Returns:
The old state of the ShowOnColourLine flag.

Reimplemented from SGDisplayColourGroup.

Definition at line 2312 of file sgcolour.cpp.

02313 {
02314     BOOL OldState = m_DisplayInColourLine;
02315     m_DisplayInColourLine = NewState;
02316     return OldState;
02317 }

BOOL SGDisplayLibColGroup::ToggleDisplayInColourLine  )  [virtual]
 

To toggle the current state of the ShowOnColourLine flag.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/3/97
Returns:
The old state of the ShowOnColourLine flag.

Reimplemented from SGDisplayColourGroup.

Definition at line 2330 of file sgcolour.cpp.

02331 {
02332     BOOL OldState = m_DisplayInColourLine;
02333     if (m_DisplayInColourLine)
02334         m_DisplayInColourLine = FALSE;
02335     else
02336         m_DisplayInColourLine = TRUE;
02337 
02338     // If in Camelot mode then save the new state in the preferences
02339     // as this is the only chance that we will get
02340     String_256 TheFile = Filename.GetFileName(FALSE);
02341     TheFile.toUpper();
02342     // read a preference value for that named gallery
02343     /*BOOL SetOk =*/ Camelot.SetPrefDirect(TEXT("ColourLine"), TheFile, &m_DisplayInColourLine);
02344 
02345     return OldState;
02346 }

BOOL SGDisplayLibColGroup::Virtualise void   )  [virtual]
 

Virtualises this library out to disk (or rather, to be more accurate, chucks this library out of memory. Colour libraries are totally read-only, although while loaded we let the user reorganise them for convenience).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/96
Returns:
TRUE for success

Reimplemented from SGDisplayGroup.

Definition at line 2156 of file sgcolour.cpp.

02157 {
02158     if(IsVirtualised())
02159         return TRUE;
02160 
02161     // Simply destroy the entire subtree from (but not including- FALSE) this node down
02162     DestroySubtree(FALSE);
02163     SetVirtualisedState(TRUE);
02164 
02165     return(TRUE);
02166 }


Member Data Documentation

PathName SGDisplayLibColGroup::Filename [protected]
 

Definition at line 441 of file sgcolour.h.

BOOL SGDisplayLibColGroup::m_DisplayInColourLine [protected]
 

Definition at line 443 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