SGLibGroup Class Reference

This is a display tree group specifically for library galleries The main reason for implementing it was to receive library group messages. More...

#include <sglib.h>

Inheritance diagram for SGLibGroup:

SGDisplayGroup SGDisplayNode CCObject SimpleCCObject List of all members.

Public Member Functions

 SGLibGroup (SuperGallery *ParentGal, Document *ParentDoc, Library *ParentLib)
 SGLibGroup constructor. Initialises the Group's parent pointers to point at its parent(s). Note that generally speaking, one of ParentDoc, ParentLib will be NULL, and the other will be non-NULL.
virtual void ReadGroupTitle (void)
 Since we now store the group text with the group, we have to overwrite the normal ReadGroupTitle member. This new one simply does nothing.
virtual BOOL HandleEvent (SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo)
 Handles a library group event - thumbnail resizing, etc...
virtual BOOL GetBubbleHelp (DocCoord *MousePos, String_256 *Result)
 Called by the parent gallery when bubble help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help.
virtual BOOL GetStatusLineHelp (DocCoord *MousePos, String_256 *Result)
 Called by the parent gallery when status line help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help.
virtual BOOL CanVirtualise (void)
 Some groups shouldn't virtualise out to disk (the installed font group for example). Such groups should override this and return FALSE.
virtual BOOL DeVirtualise (void)
 Virtualise a group back into memory.

Static Public Attributes

static BOOL LibraryVirtualisingEnabled = TRUE

Private Member Functions

 CC_DECLARE_DYNAMIC (SGLibGroup)

Detailed Description

This is a display tree group specifically for library galleries The main reason for implementing it was to receive library group messages.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
See also:
SuperGallery; SGDisplayGroup;

Definition at line 329 of file sglib.h.


Constructor & Destructor Documentation

SGLibGroup::SGLibGroup SuperGallery ParentGal,
Document ParentDoc,
Library ParentLib
 

SGLibGroup constructor. Initialises the Group's parent pointers to point at its parent(s). Note that generally speaking, one of ParentDoc, ParentLib will be NULL, and the other will be non-NULL.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
ParentGal - points to the SuperGallery object which 'owns' this node [INPUTS] ParentDoc - NULL, or a pointer to the document this group references ParentLib - NULL, or a pointer to the library this group references
Notes: This constructor does nothing - jusat passes the call on to the baseclass constructor of identical proportions.

See also:
SGDisplayGroup::SGDisplayGroup

Definition at line 2440 of file sglib.cpp.

02442                 : SGDisplayGroup(ParentGal, ParentDoc, ParentLib)
02443 {
02444     // Library groups can be selected
02445     Flags.CanSelect = TRUE;
02446 
02447     SetVirtualisedState(FALSE);
02448 }


Member Function Documentation

BOOL SGLibGroup::CanVirtualise void   )  [virtual]
 

Some groups shouldn't virtualise out to disk (the installed font group for example). Such groups should override this and return FALSE.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/1/95
Returns:
TRUE if it can

Reimplemented from SGDisplayGroup.

Definition at line 2705 of file sglib.cpp.

02706 {
02707     return SGLibGroup::LibraryVirtualisingEnabled;
02708 }

SGLibGroup::CC_DECLARE_DYNAMIC SGLibGroup   )  [private]
 

BOOL SGLibGroup::DeVirtualise void   )  [virtual]
 

Virtualise a group back into memory.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/1/95
Returns:
TRUE if it devirtualised back in OK

Reimplemented from SGDisplayGroup.

Definition at line 2723 of file sglib.cpp.

02724 {
02725     if(!IsVirtualised())
02726         return TRUE;
02727 
02728     // On older machines this can take a couple of seconds, so we need some feedback...
02729     Progress ProgMsg(_R(IDS_GALLERY_PREPARE_FOR_UNFOLD), -1/*, FALSE*/);
02730     ParentLibrary->ProgressBar = &ProgMsg; // ::Init will call update if this is non-null
02731 
02732     INT32 Count = ParentLibrary->CreateItems();
02733 
02734 #ifdef _DEBUG
02735     ForceRedrawOfMyselfAndChildren();
02736 #endif
02737 
02738     ParentLibrary->ProgressBar = NULL;
02739 
02740     return (Count > 0);
02741 }

BOOL SGLibGroup::GetBubbleHelp DocCoord MousePos,
String_256 Result
[virtual]
 

Called by the parent gallery when bubble help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/6/95
Parameters:
MousePos - The current mouse position. This will generally be expected [INPUTS] to lie inside this item's FormatRect. With it, this item can provide help on specific areas of an item.
On exit, if the return value is TRUE, the string pointed at by Result [OUTPUTS] will contain a bubble help string for this item
Returns:
TRUE if it filled in the string, FALSE if it did not
Notes: The base class returns FALSE (i.e. provides no help) If you can provide help, then override the base class method to do so.

See also:
SGDisplayNode::GetStatusLineHelp

Reimplemented from SGDisplayNode.

Definition at line 2613 of file sglib.cpp.

02614 {
02615     ERROR3IF(MousePos == NULL || Result == NULL, "Invalid NULL params");
02616 
02617     return FALSE;
02618 }

BOOL SGLibGroup::GetStatusLineHelp DocCoord MousePos,
String_256 Result
[virtual]
 

Called by the parent gallery when status line help is needed. The parent gallery will do a hit test to determine which node contains the pointer, and will then ask that node to supply bubble/status-line help.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/95
Parameters:
MousePos - The current mouse position. This will generally be expected [INPUTS] to lie inside this item's FormatRect. With it, this item can provide help on specific areas of an item.
On exit, if the return value is TRUE, the string pointed at by Result [OUTPUTS] will contain a status line help string for this item
Returns:
TRUE if it filled in the string, FALSE if it did not
Notes: The base class returns FALSE (i.e. provides no help) If you can provide help, then override the base class method to do so.

See also:
SGDisplayNode::GetBubbleHelp

Reimplemented from SGDisplayNode.

Definition at line 2649 of file sglib.cpp.

02650 {
02651     ERROR3IF(MousePos == NULL || Result == NULL, "Invalid NULL params");
02652 
02653     if(MousePos->x <= GROUP_BAR_ICON_WIDTH)
02654     {
02655         if(Flags.Folded)
02656             /* "Click to open this section of the gallery"; */
02657             Result->MakeMsg(_R(IDS_LIBRARY_FOLDER_CLICK_TO_OPEN));
02658         else
02659             /* "Click to close this section of the gallery"; */
02660             Result->MakeMsg(_R(IDS_LIBRARY_FOLDER_CLICK_TO_CLOSE));
02661     }
02662     else
02663     {
02664         if(Flags.Selected)
02665         {
02666             /* "Ctrl-Click to deselect" */
02667             Result->MakeMsg(_R(IDS_LIBRARY_SECTION_CLICK_SELECTED));
02668             *Result += String_8(_R(IDS_SGFONTS_STATUS_LINE_SEP)); // "; "
02669         }
02670         else if(Flags.CanSelect)
02671         {
02672             /* "Click to select" */
02673             Result->MakeMsg(_R(IDS_LIBRARY_SECTION_CLICK_DESELECTED));
02674             *Result += String_8(_R(IDS_SGFONTS_STATUS_LINE_SEP)); // "; "
02675         }
02676 
02677         String_256 DClick;
02678         if(Flags.Folded)
02679             /* "Double click to open this section of the gallery"; */
02680             DClick.MakeMsg(_R(IDS_LIBRARY_SECTION_DCLICK_TO_OPEN));
02681         else
02682             /* "Double click to close this section of the gallery"; */
02683             DClick.MakeMsg(_R(IDS_LIBRARY_SECTION_DCLICK_TO_CLOSE));
02684 
02685         *Result += DClick;
02686     }
02687     return(TRUE);
02688 }

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

Handles a library group event - thumbnail resizing, etc...

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
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:
[OUTPUTS] 
Returns:
TRUE if the event was handled successfully FALSE if it was not
See also:
SGDisplayNode::HandleEvent

Reimplemented from SGDisplayGroup.

Definition at line 2501 of file sglib.cpp.

02502 {
02503     switch (EventType)
02504     {
02505         case SGEVENT_THUMBMSG:
02506             {
02507                 ThumbMessage *Msg = (ThumbMessage *) EventInfo;
02508                 if(Msg != NULL)
02509                 {
02510                     switch (Msg->State)
02511                     {
02512                         // Resize the library thumbnail cache
02513                         case ThumbMessage::ThumbState::CACHESIZECHANGED:
02514                             {
02515                                 Library *TheLib = GetParentLibrary();
02516 
02517                                 if(TheLib == NULL)
02518                                 {
02519                                     ERROR3("SGLibGroup::HandleEvent Library == NULL for library group - bad !!!");
02520                                 }
02521                                 else
02522                                 {
02523                                     // Thumbnail cache associated with library
02524                                     SGThumbs *Thumbs = TheLib->Thumbnails;
02525 
02526                                     if(Thumbs != NULL)
02527                                     {
02528                                         // Rip the details out of the old cache
02529                                         PathName OldPath(*(Thumbs->GetDirectory()));
02530                                         SGLibType OldType = Thumbs->GetType();
02531                                         SGThumbSize OldSize;
02532                                         Thumbs->GetSize(&OldSize);
02533 
02534                                         // Just check the new cache will know it's maximum size
02535                                         SGThumbs::MaxThumbnails = Msg->NewSize;
02536                                         
02537                                         // Kill off the old cache and reclaim all the memory
02538                                         delete Thumbs;
02539 
02540                                         // Create the new cache                                     
02541                                         Thumbs = new SGThumbs(&OldPath, OldType, OldSize);
02542 
02543                                         // Assign the new cache to the library
02544                                         TheLib->Thumbnails = Thumbs;
02545                                     }
02546                                 }
02547                             }
02548                             break;
02549 
02550                             case ThumbMessage::ThumbState::KILLCACHE:
02551                             {
02552                                 Library *TheLib = GetParentLibrary();
02553 
02554                                 if(TheLib == NULL)
02555                                 {
02556                                     ERROR3("SGLibGroup::HandleEvent Library == NULL for library group - bad !!!");
02557                                 }
02558                                 else
02559                                 {
02560                                     // Thumbnail cache associated with library
02561                                     SGThumbs *Thumbs = TheLib->Thumbnails;
02562 
02563                                     if(Thumbs != NULL)
02564                                     {
02565                                         if(Thumbs->GetType() == Msg->Type)
02566                                         {
02567                                             // Reclaim thumbnail cache memory
02568                                             Thumbs->DeleteThumbnails();
02569                                         }
02570                                     }
02571                                 }
02572                             }
02573                             break;
02574                     }
02575                 }
02576             }
02577             break;
02578     }
02579 
02580     // Pass back the event
02581     return SGDisplayGroup::HandleEvent(EventType, EventInfo, MiscInfo);
02582 }

void SGLibGroup::ReadGroupTitle void   )  [virtual]
 

Since we now store the group text with the group, we have to overwrite the normal ReadGroupTitle member. This new one simply does nothing.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]

Reimplemented from SGDisplayGroup.

Definition at line 2463 of file sglib.cpp.

02464 {
02465 }


Member Data Documentation

BOOL SGLibGroup::LibraryVirtualisingEnabled = TRUE [static]
 

Definition at line 351 of file sglib.h.


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