SGFontsGroup Class Reference

This is a display tree group specifically for the fonts gallery - it disables various documenty things, and provides overrides for the group text. More...

#include <sgfonts.h>

Inheritance diagram for SGFontsGroup:

SGDisplayGroup SGDisplayNode CCObject SimpleCCObject List of all members.

Public Member Functions

 SGFontsGroup (SuperGallery *ParentGal, Document *ParentDoc=NULL, Library *ParentLib=NULL, String_64 *TText=NULL)
 SGFontsGroup 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 an Installed font 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)

Private Member Functions

 CC_DECLARE_DYNAMIC (SGFontsGroup)

Detailed Description

This is a display tree group specifically for the fonts gallery - it disables various documenty things, and provides overrides for the group text.

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

Definition at line 141 of file sgfonts.h.


Constructor & Destructor Documentation

SGFontsGroup::SGFontsGroup SuperGallery ParentGal,
Document ParentDoc = NULL,
Library ParentLib = NULL,
String_64 TText = NULL
 

SGFontsGroup 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.

/

NB: The default text for the installed font previews is in 'richard.rc'

The size of bitmaps (in pixels) to generate for the installed fonts

New larger size normal font const INT32 SGF_NORMAL_X = 180; const INT32 SGF_NORMAL_Y = 26;

const INT32 SGF_FULL_X = 160; const INT32 SGF_FULL_Y = 12;

const INT32 SGF_SMALL_X = 28; const INT32 SGF_SMALL_Y = 16;

Space for bmp to the left of each item const INT32 SGF_TYPE_WIDTH = 14;

BPP of thumbnails generated 'on the fly' (only 8 and 32 are known to work) const INT32 SGF_BPP = 8;

Number of pixels around thumbnail bitmap for selection rectangle This has only be tested with a value of 3, others may (should) work. const INT32 SGF_SURROUND = 3;

/*!/

Initialise the statics

Default location of the fonts library index ifdef _DEBUG String_256 FontsSGallery::DefaultLibraryPath = TEXT("\\\\deepthought\\camelotcd\\notneeded\\fonts"); String_256 FontsSGallery::DefaultLibraryPath = TEXT("\\\\jimpc\\corelxra\\fonts"); else String_256 FontsSGallery::DefaultLibraryPath = TEXT("D:\\fonts"); endif

Display mode - required by callback function (possibly) INT32 SGDisplayPreviewFonts::DMode = 0;

Pointer to the gallery being described - required by callback function FontsSGallery *FontsSGalleryThisGallery = NULL;

For enumeration of non-family fonts BOOL FontsSGallery::AddedFonts = FALSE;

Are we installing or deinstalling a font ? BOOL FontsSGallery::DontUpdate = FALSE;

For keeping the display modes constant when next loaded INT32 FontsSGallery::DefaultDisplayMode = 0;

For keeping the sort keys constant when next loaded (default == sort alphabetically) 1st sort key = DefaultSortKeys & 0x7f 2nd sort key = ((DefaultSortKeys>>8) & 0x7f) 1st sort key reversed = ((DefaultSortKeys>>7) & 0x01)==1 2nd sort key reversed = ((DefaultSortKeys>>15) & 0x01)==1 So 0 means no sorting at all and 1 means sort the gallery alphabetically UINT32 FontsSGallery::DefaultSortKeys = 1;

The installed fonts group SGFontsGroup *FontsSGalleryInsGroup = NULL;

Deinstalling fonts option BOOL FontsSGallery::DeleteTTFandFOTfiles = TRUE;

Use this as the large display mode string (for the installed fonts) Changed by Graham 1/7/97 so we use "AaBbCc" instead of the product name String_256 FontsSGallery::LargeDisplayString=String_256();

Used so that we don't add enummed fonts that we don't mean to FontClass FontsSGallery::EnumFontClass = FC_UNDEFINED;

Quiet status of gallery BOOL FontsSGallery::QuietStatus = FALSE;

Flag for stopping multiple warnings about dragging between sections... BOOL FontsSGallery::WarnAboutSectionDragging = FALSE;

Flag for stopping multiple warnings when ATM isn't installed for dragging between sections... BOOL FontsSGallery::WarnAboutMultipleATMDragging = FALSE;

/*!

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/2/94
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 TText - Text to use as the group's title
Notes: This constructor does nothing - just passes the call on to the baseclass constructor of identical proportions.

See also:
SGDisplayGroup::SGDisplayGroup

Definition at line 292 of file sgfonts.cpp.

00294                 : SGDisplayGroup(ParentGal, ParentDoc, ParentLib)
00295 {
00296     if(TText != NULL)
00297         TitleText = *TText;
00298     else
00299         TitleText.MakeMsg(_R(IDS_FONTS_GROUP));
00300 
00301     SetVirtualisedState(FALSE);
00302 }


Member Function Documentation

BOOL SGFontsGroup::CanVirtualise void   )  [virtual]
 

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/1/95
Returns:
FALSE, since the installed fonts group can't be virtualised...

Reimplemented from SGDisplayGroup.

Definition at line 567 of file sgfonts.cpp.

00568 {
00569     return FALSE;
00570 }

SGFontsGroup::CC_DECLARE_DYNAMIC SGFontsGroup   )  [private]
 

BOOL SGFontsGroup::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 475 of file sgfonts.cpp.

00476 {
00477     ERROR3IF(MousePos == NULL || Result == NULL, "Invalid NULL params");
00478 
00479     return FALSE;
00480 }

BOOL SGFontsGroup::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 511 of file sgfonts.cpp.

00512 {
00513     ERROR3IF(MousePos == NULL || Result == NULL, "Invalid NULL params");
00514 
00515     if(MousePos->x <= 16500)
00516     {
00517         if(Flags.Folded)
00518             /* "Click to open this section of the gallery"; */
00519             Result->MakeMsg(_R(IDS_LIBRARY_FOLDER_CLICK_TO_OPEN));
00520         else
00521             /* "Click to close this section of the gallery"; */
00522             Result->MakeMsg(_R(IDS_LIBRARY_FOLDER_CLICK_TO_CLOSE));
00523     }
00524     else
00525     {
00526         if(Flags.Selected)
00527         {
00528             /* "Ctrl-Click to deselect" */
00529             Result->MakeMsg(_R(IDS_LIBRARY_SECTION_CLICK_SELECTED));
00530             *Result += String_8(_R(IDS_SGFONTS_STATUS_LINE_SEP)); // "; "
00531         }
00532         else if(Flags.CanSelect)
00533         {
00534             /* "Click to select" */
00535             Result->MakeMsg(_R(IDS_LIBRARY_SECTION_CLICK_DESELECTED));
00536             *Result += String_8(_R(IDS_SGFONTS_STATUS_LINE_SEP)); // "; "
00537         }
00538 
00539         String_256 DClick;
00540         if(Flags.Folded)
00541             /* "Double click to open this section of the gallery"; */
00542             DClick.MakeMsg(_R(IDS_LIBRARY_SECTION_DCLICK_TO_OPEN));
00543         else
00544             /* "Double click to close this section of the gallery"; */
00545             DClick.MakeMsg(_R(IDS_LIBRARY_SECTION_DCLICK_TO_CLOSE));
00546 
00547         *Result += DClick;
00548     }
00549 
00550     return(TRUE);
00551 }

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

Handles an Installed font 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 355 of file sgfonts.cpp.

00356 {
00357     switch (EventType)
00358     {
00359         case SGEVENT_THUMBMSG:
00360             {
00361                 ThumbMessage *Msg = (ThumbMessage *) EventInfo;
00362                 if(Msg != NULL)
00363                 {
00364                     switch (Msg->State)
00365                     {
00366                         // Installed fonts cache needs resizing ?
00367                         case ThumbMessage::CACHESIZECHANGED:
00368                             {
00369                                 // We know our parent is the fonts gallery....
00370                                 FontsSGallery *TheGal = (FontsSGallery *)GetParentGallery();
00371 
00372                                 if(TheGal == NULL)
00373                                 {
00374                                     ERROR3("SGFontsGroup::HandleEvent Library == NULL for installed fonts group - bad !!!");
00375                                 }
00376                                 else
00377                                 {
00378                                     // Thumbnail cache associated with group
00379                                     SGThumbs *Thumbs = TheGal->InsCache;
00380 
00381                                     if(Thumbs != NULL)
00382                                     {
00383                                         // Rip the details out of the old cache
00384                                         SGThumbSize OldSize;
00385                                         Thumbs->GetSize(&OldSize);
00386 
00387                                         // Just check the new cache will know it's maximum size
00388                                         SGThumbs::MaxThumbnails = Msg->NewSize;
00389                                         
00390                                         // Kill off the old cache and reclaim all the memory
00391                                         delete Thumbs;
00392 
00393                                         // Allocate a new thumbnail cache for installed fonts
00394                                         // NULL directory is a special case...
00395                                         Thumbs = new SGThumbs(NULL, SGLib_Font, OldSize);
00396 
00397                                         // Assign the new cache to the library
00398                                         TheGal->InsCache = Thumbs;
00399                                     }
00400                                 }
00401                             }
00402 
00403                             break;
00404 
00405                         case ThumbMessage::KILLCACHE:
00406                             {
00407                                 // We know our parent is the fonts gallery....
00408                                 FontsSGallery *TheGal = (FontsSGallery *)GetParentGallery();
00409 
00410                                 if(TheGal == NULL)
00411                                 {
00412                                     ERROR3("SGFontsGroup::HandleEvent Library == NULL for installed fonts group - bad !!!");
00413                                 }
00414                                 else
00415                                 {
00416                                     // Thumbnail cache associated with group
00417                                     SGThumbs *Thumbs = TheGal->InsCache;
00418 
00419                                     if(Thumbs != NULL)
00420                                     {
00421                                         if(Msg->Type == SGLib_Font)
00422                                         {
00423                                             // Reclaim installed fonts thumbnail cache memory
00424                                             Thumbs->DeleteThumbnails();
00425                                         }
00426                                     }
00427                                }
00428                             }
00429                             break;
00430 
00431                         default:
00432                             break;
00433                     }
00434                 }
00435             }
00436             break;
00437         default:
00438             break;
00439     }
00440 
00441     // Pass back the event
00442     return SGDisplayGroup::HandleEvent(EventType, EventInfo, MiscInfo);
00443 }

void SGFontsGroup::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:
15/2/94
Parameters:
- [INPUTS]
- [OUTPUTS]

Reimplemented from SGDisplayGroup.

Definition at line 317 of file sgfonts.cpp.

00318 {
00319 }


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