LineGallery Class Reference

The Line SuperGallery class Notes: SuperGalleries are specced in a number of docs including specs.doc ("super" gallery extensions) specs.doc (gallery basic ui) There is also howtouse.doc which describes creating a supergallery. More...

#include <sgline.h>

Inheritance diagram for LineGallery:

SuperGallery DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 LineGallery ()
 LineGallery default constructor. Sets a global instance pointer to this object.
virtual ~LineGallery ()
 Destroys a line gallery, resetting the global instance pointer to NULL.
virtual MsgResult Message (Msg *pMessage)
 A standard message handler, really. Notes: Any messages that this does not handle must be passed down to the SuperGallery base class message handler. NOTE WELL that the SuperGallery base class handler does some funky things for us - see SuperGallery::Message - such as deleting our display subtree for any document which dies (which, uncannily, would explain why they go away like that when you close documents ;-), and shading the gallery when there are no documents present. [To override this behaviour in these cases, you should respond to the message, and return OK rather than calling the base class message handler].
BOOL MakeSureGroupsHaveBeenCreated ()
BOOL DeleteBrushItem (BrushHandle Handle)
 Deletes the brush with the given handle.
CBrushGadgetGetBrushGadget ()
virtual BOOL InitMenuCommands (void)
 Initialises any menu commands that this gallery needs.
virtual BOOL BuildCommandMenu (GalleryContextMenu *TheMenu, SGMenuID MenuID)
 To build a menu of commands to be popped up over the gallery.
virtual OpState GetCommandState (StringBase *CommandID, String_256 *ShadeReason)
 To determine the state of a given menu item. This method is an exact parallel to an Op's GetState method (in fact, it is called by an Op's GetState).
virtual void DoCommand (StringBase *CommandID)
 To apply a given command when it is chosen from the menu.
void UpdateBrushItem (BrushHandle Handle)
 Searches for a brush item with the same handle as Handle, and asks it to update itself.
MILLIPOINT SetPreviousLineWidth ()
 queries AttributeManager to get the current default,sets it as the member variable and returns it
MILLIPOINT GetPreviousLineWidth ()
 as above

Static Public Member Functions

static BOOL Init ()
 Called when the program starts, loading .INI file settings.
static LineGalleryGetInstance ()
 Public access function to the line gallery.
static BOOL IsActive ()
 Used by the message-handlers of gadgets within the line gallery to determine if they should update themselves or not.
static void AddNewStrokeItem (StrokeTypeAttrValue *pNewStroke)
 Finds the line gallery, and adds the given stroke type attribute to the end of the stroke type display.
static void AddNewBrushItem (BrushAttrValue *pNewBrush)
 Goes through the line gallery to find out which group to add the new brush to. Basically if the brushes fileID == BRUSHFILE_NONE then it belongs in the default folder, otherwise we find the folder name from our array.

Private Member Functions

virtual BOOL PreCreate ()
 The LineGallery PreCreate handler. This overrides the base class PreCreate function. It is called at the very beginning of the SuperGallery::Create method, before the window has been created.
virtual BOOL PostCreate ()
 Called after the LineGallery is created. Forces an update of the "current attribute" status of all items.
virtual BOOL ApplyAction (SGActionType Action)
 Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
virtual void SelectionHasChanged ()
 Called by the base-class SuperGallery whenever the user clicks on an item. This version overrides the default bahaviour so that selecting more than one item does NOT grey the "Apply" button.
virtual BOOL OnCommonAttrsChangedMsg ()
 Responds to the selection state changing by updating the "current attribute" status of the gallery's items. Responds to the the common attributes changing.
virtual BOOL OnApplyButton (BOOL fIsAdjust)
 Called by the line gallery when the user clicks the "Apply" button. Iterates over each group within the gallery trying to apply any selected attributes within the group to the current selection.
void SetStatusText ()
 Works out what the status text should be from which items are selected in the gallery, and updates it on-screen.
virtual RenderRegionCreateRenderRegion (DocRect *pSize, ReDrawInfoType *pInfo)
 An overridable veneer to the DialogOp CreateOSRenderRegion method. This can be overriden to use a different type of renderregion for all of your rendering.
virtual void DestroyRenderRegion (RenderRegion *pRegion)
 Destroys the given render-region (in this case a GDraw version).
BOOL CreateDashGroup ()
 Creates a new "dash pattern" Group with all its associated items.
BOOL CreateWidthGroup ()
 Creates a new "line width" Group with its associated items.
BOOL CreateArrowGroup ()
 Creates a new "arrowhead/tail" Group with its associated items.
BOOL CreateCapGroup ()
 Creates a new "line cap" Group with its associated items.
BOOL CreateJoinTypeGroup ()
 Creates a new "join type" Group with its associated items.
BOOL CreateVarWidthGroup ()
 Creates a new "variable width" Group with its associated items.
BOOL CreateStrokeTypeGroup ()
 Creates a new "Stroke type" Group with its associated items.
LineAttrGroupCreateBrushAttrGroup (String_256 GroupName)
BOOL CreateBrushGroups ()
 Creates groups to hold brushes in the line gallery. Basically we create folders for each of the default files that are loaded during start-up, plus one extra folder where all subsequent brushes will be put. Note that PrepareBrushFolders must have been called at some point prior to this.
LineAttrGroupCreateGroup (const String_256 &strTitle, BOOL fOpen)
 Creates a new group (heading) within the line-attributes super-gallery.
BOOL CreateItem (LineAttrGroup *pGroup, LineAttrItem *pItem)

Static Private Member Functions

static BOOL PrepareBrushFolders ()
 Prepares tp create folders in which to put brushes that are loaded in as part of the load default brushes process. Basically scans for .xar files in the /Templates/Brushes/ folders and stores each filename found. These filenames are subsequently used to create folders in CreateBrushGroups.

Private Attributes

MILLIPOINT m_PreviousLineWidth
CBrushGadget BrushGadget

Static Private Attributes

static LineGallerym_pTheGallery = NULL
static double m_anArrowScales [4] = { 3.0, 8.0, 13.0, 18.0 }
static String_256m_pFileNameArray = NULL
static UINT32 m_NumDefaultFiles = 0

Detailed Description

The Line SuperGallery class Notes: SuperGalleries are specced in a number of docs including specs.doc ("super" gallery extensions) specs.doc (gallery basic ui) There is also howtouse.doc which describes creating a supergallery.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> (Based on template code by Jason)
Date:
15/2/95 (Based on the Colour SGallery code)
See also:
SuperGallery; SGDisplayLine

Definition at line 271 of file sgline.h.


Constructor & Destructor Documentation

LineGallery::LineGallery  ) 
 

LineGallery default constructor. Sets a global instance pointer to this object.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/2/95 (base generated in sgbase.cpp)

Definition at line 1168 of file sgline.cpp.

01169 {
01170     // Remember a pointer to the global instance of this gallery.
01171     ERROR3IF(m_pTheGallery != NULL, "Gallery already exists in LineGallery::LineGallery?");
01172     m_pTheGallery = this;
01173 
01174     DlgResID=_R(IDD_LINESGALLERY);
01175     
01176     // set to the normal default
01177     m_PreviousLineWidth = 500;
01178 } 

LineGallery::~LineGallery  )  [virtual]
 

Destroys a line gallery, resetting the global instance pointer to NULL.

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

Errors: -

See also:
-

Definition at line 1195 of file sgline.cpp.

01196 {
01197     // Make sure nothing is seriously screwed-up.
01198     ERROR3IF(m_pTheGallery == NULL, "No gallery in LineGallery::~LineGallery?");
01199     m_pTheGallery = NULL;
01200 
01201     // delete the string array
01202     if (m_pFileNameArray != NULL)
01203     {   
01204         for (UINT32 i = 0; i < m_NumDefaultFiles; i++)
01205             m_pFileNameArray[i].Empty();
01206 
01207         // don't forget that we allocated it with malloc..
01208         free((void*)m_pFileNameArray);
01209         
01210         m_pFileNameArray = NULL;
01211     }
01212 
01213 }


Member Function Documentation

void LineGallery::AddNewBrushItem BrushAttrValue pNewBrush  )  [static]
 

Goes through the line gallery to find out which group to add the new brush to. Basically if the brushes fileID == BRUSHFILE_NONE then it belongs in the default folder, otherwise we find the folder name from our array.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/1/2000

Definition at line 2355 of file sgline.cpp.

02356 {
02357     if (pNewBrush == NULL)
02358     {
02359         ERROR3("Illegal NULL param");
02360         return;
02361     }
02362 
02363     // find the string for title of the folder from the definition
02364     
02365     String_256 GroupString(_R(IDS_BRUSHGROUP_DEFAULT)); // initialise to default string
02366 
02367     BrushDefinition* pDef = pNewBrush->GetBrushDefinition();
02368     if (pDef == NULL)
02369     {
02370         ERROR3("No brush definition in LineGallery::AddNewBrushItem");
02371         return;
02372     }
02373     UINT32 FileID = pDef->GetBrushFileID();
02374     if (FileID != BRUSHFILE_NONE && FileID <= m_NumDefaultFiles)
02375     {
02376         if (m_pFileNameArray != NULL)
02377             GroupString = m_pFileNameArray[FileID];
02378     }
02379     
02380         
02381     // now search through the line gallery to find the group with that title
02382     LineGallery *pGallery = (LineGallery *) LineGallery::GetInstance();
02383     if (pGallery == NULL)
02384         return;
02385 
02386     // This will create the groups if they're not there yet
02387     pGallery->MakeSureGroupsHaveBeenCreated();
02388 
02389     SGDisplayRoot *pRoot = pGallery->GetDisplayTree();
02390     if (pRoot == NULL)
02391         return;
02392 
02393     LineAttrGroup *pGroup = (LineAttrGroup *) pRoot->GetChild();
02394     if (pGroup == NULL)
02395         return;
02396 
02397     LineAttrGroup* pCopyGroup = pGroup;
02398     
02399     // loop through until we find our group.
02400     String_256 NameString;
02401     while (pCopyGroup != NULL)
02402     {
02403         NameString = (String_256)(pCopyGroup->GetTitle());
02404         if (NameString.IsIdentical(GroupString))
02405         {
02406             pGroup = pCopyGroup;
02407             break;
02408             
02409         }
02410         pCopyGroup = (LineAttrGroup*)pCopyGroup->GetNext();
02411     }
02412 
02413     // Find the stroke's name, if it has one
02414     String_64 Name = TEXT(" ");
02415 
02416     String_32* pName = pDef->GetLineName();
02417     if (pName != NULL)
02418         Name  = *pName;
02419     
02420     
02421     BrushAttrItem* pBrushAttrItem = new BrushAttrItem(pNewBrush, Name);
02422     if (pBrushAttrItem == NULL)
02423         return;
02424 /*
02425 #ifdef _DEBUG
02426     pBrushAttrItem->CheckMemory(TRUE);
02427 #endif
02428     */
02429     pGallery->CreateItem(pGroup, pBrushAttrItem);
02430 
02431     // we must invalidate so that brushes are scaled correctly the first
02432     // time they are drawn
02433     pGallery->InvalidateCachedFormat();
02434     pGallery->ReformatAndRedrawIfNecessary();
02435 
02436 }

void LineGallery::AddNewStrokeItem StrokeTypeAttrValue pNewStroke  )  [static]
 

Finds the line gallery, and adds the given stroke type attribute to the end of the stroke type display.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/3/97

Definition at line 2292 of file sgline.cpp.

02293 {
02294 // Removed from non-stroking builds 2/10/97
02295 #ifdef VECTOR_STROKING
02296 
02297     ERROR3IF(pNewStroke == NULL, "Illegal NULL param");
02298 
02299     LineGallery *pGallery = (LineGallery *) LineGallery::GetInstance();
02300     if (pGallery == NULL)
02301         return;
02302 
02303     // This will create the groups if they're not there yet
02304     pGallery->MakeSureGroupsHaveBeenCreated();
02305 
02306     SGDisplayRoot *pRoot = pGallery->GetDisplayTree();
02307     if (pRoot == NULL)
02308         return;
02309 
02310     LineAttrGroup *pGroup = (LineAttrGroup *) pRoot->GetChild();
02311     if (pGroup == NULL)
02312         return;
02313 
02314 #if _DEBUG
02315     SGDisplayItem *pItem = (SGDisplayItem *) pGroup->GetChild();
02316     ERROR3IF(pItem == NULL || !pItem->IsKindOf(CC_RUNTIME_CLASS(StrokeTypeItem)),
02317                 "LineGallery::AddNewStrokeItem - I seem to be adding to the wrong group!");
02318 #endif
02319 
02320     // Find the stroke's name, if it has one
02321     String_64 Name(TEXT("Custom brush"));
02322     PathProcessorStroke *pProcessor = pNewStroke->GetPathProcessor();
02323     if (pProcessor != NULL && pProcessor->IsKindOf(CC_RUNTIME_CLASS(PathProcessorStrokeVector)))
02324     {
02325         StrokeHandle Handle = ((PathProcessorStrokeVector *)pProcessor)->GetStrokeDefinition();
02326         StrokeDefinition *pStroke = StrokeComponent::FindStroke(Handle);
02327         if (pStroke != NULL)
02328             Name = *pStroke->GetStrokeName();
02329     }
02330 
02331     StrokeTypeItem * pStrokeTypeItem = new StrokeTypeItem(pNewStroke, Name);
02332     if (pStrokeTypeItem == NULL)
02333         return;
02334 
02335     pGallery->CreateItem(pGroup, pStrokeTypeItem);
02336     pGallery->ReformatAndRedrawIfNecessary();
02337 
02338 #endif // VECTOR_STROKING
02339 }

BOOL LineGallery::ApplyAction SGActionType  Action  )  [private, virtual]
 

Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/2/95 (base generated in sgbase.cpp)
Parameters:
Action - Indicates what action to apply [INPUTS]
Returns:
TRUE to indicate successful handling of the action, or FALSE to indicate failure (NOTE that this is not necessarily an error, but may simply be that we don't support the given action. e.g. if we don't handle APPLYADJUST, we'll be called again with a normal APPLY call)
See also:
SGActionType

Reimplemented from SuperGallery.

Definition at line 1864 of file sgline.cpp.

01865 {
01866     // No display tree? Better forget about it then!
01867     if (DisplayTree == NULL) return FALSE;
01868 
01869     // Now, process the action  TO DO! - see Colour gallery for examples
01870     switch (Action)
01871     {
01872         case SGACTION_APPLY:
01873             return OnApplyButton(FALSE);
01874 
01875         case SGACTION_APPLYADJUST:
01876             return OnApplyButton(TRUE);
01877 
01878         case SGACTION_SETLINEPROPERTIES:
01879             return TRUE;
01880 
01881         case SGACTION_SETOPTIONS:
01882         case SGACTION_CREATE:
01883         case SGACTION_REDEFINE:
01884         case SGACTION_EDIT:
01885         case SGACTION_DELETE:
01886         case SGACTION_DISPLAYMODECHANGED:
01887             TRACEUSER( "JustinF", _T("Unimplemented feature executed in Line gallery\n"));
01888             // Drop through to default handler (return FALSE)
01889 
01890         default:
01891             ERROR3("Unexpected action in LineGallery::ApplyAction");
01892             return FALSE;
01893     }
01894 
01895     // Successful processing.
01896     return TRUE;
01897 }

BOOL LineGallery::BuildCommandMenu GalleryContextMenu TheMenu,
SGMenuID  MenuID
[virtual]
 

To build a menu of commands to be popped up over the gallery.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/03/97
Parameters:
TheMenu - The menu to add commands to [INPUTS] MenuID - The type of menu (over-list or from-options-button) to create
Returns:
TRUE if it succeeded

Reimplemented from SuperGallery.

Definition at line 2492 of file sgline.cpp.

02493 {
02494     BOOL ok = FALSE;
02495 
02496     SGDisplayNode *pItem = DisplayTree->FindNextSelectedItem(NULL);
02497 
02498 
02499     // Only pop the properties menu up for Custom Brushes
02500     if(pItem != NULL && pItem->IsKindOf(CC_RUNTIME_CLASS(StrokeTypeItem)))
02501     {
02502         StrokeTypeAttrValue *pAttrType = ((StrokeTypeItem *)pItem)->GetStrokeTypeAttrValue();
02503 
02504         if(pAttrType != NULL)
02505         {
02506             PathProcessor *pPP = pAttrType->GetPathProcessor();
02507             
02508             if(pPP != NULL && pPP->AllowsPropertiesDialog())
02509             {
02510                 ok = AddCommand(TheMenu, (StringBase *) &SGCmd_Properties);
02511             }
02512         }
02513     }
02514 
02515     // we want to launch our new edit dialog for the new style brushes, its all new baby
02516     if (pItem != NULL && pItem->IsKindOf(CC_RUNTIME_CLASS(BrushAttrItem)))
02517     {
02518         // make sure its not the default 'no brush'
02519         BrushDefinition* pDef = ((BrushAttrItem*)pItem)->GetBrushDefinition();
02520         if ( pDef != NULL)
02521         {
02522             ok = AddCommand(TheMenu, (StringBase *) &SGCmd_RenameBrush);
02523             if (ok) 
02524                 ok = AddCommand(TheMenu, (StringBase *) &SGCmd_ExportBrush);
02525 
02526             // check to see that this is not a default brush before adding delete option 
02527             UINT32 FileID = pDef->GetBrushFileID();
02528             if (FileID == BRUSHFILE_NONE && ok)
02529                  ok = AddCommand(TheMenu, (StringBase *) &SGCmd_Delete);
02530         }
02531     }
02532 
02533     return(ok);
02534 }

BOOL LineGallery::CreateArrowGroup  )  [private]
 

Creates a new "arrowhead/tail" Group with its associated items.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful.

Errors: -

See also:
LineGallery::CreateGroup; LineGallery::CreateItem; LineStartArrowItem::LineStartArrowItem

Definition at line 1429 of file sgline.cpp.

01430 {
01431     // Create the group.
01432     LineAttrGroup* pGroup = CreateGroup(String_256(_R(IDS_LINEGAL_CREATEARROW)), TRUE);
01433     if (pGroup != NULL)
01434         pGroup->Flags.Folded = TRUE;
01435 
01436     // Create each item.  First the "no-arrowhead" item.
01437     if (!CreateItem(pGroup, new LineNoEndArrowItem(String_64(_R(IDS_LINEGAL_NOHEAD)))) ||
01438         !CreateItem(pGroup, new LineNoStartArrowItem(String_64(_R(IDS_LINEGAL_NOTAIL)))))
01439     {
01440         return FALSE;
01441     }
01442 
01443     // Now do the real ones.
01444     INT32 nTypes = (INT32) ArrowRec::GetNumStockArrows();
01445     for (INT32 i = (INT32) SA_STRAIGHTARROW; i < nTypes; i++)
01446     {
01447         for (INT32 j = 0; j < 4; j++)
01448         {       
01449             // Get the text description for this kind of arrowhead.
01450             String_256 str = ArrowRec::GetStockArrowName((StockArrow) i);
01451             LineArrowItem* pItem = new LineArrowItem((StockArrow) i, m_anArrowScales[j], str);
01452             if (!CreateItem(pGroup, pItem)) return FALSE;
01453         }
01454     }
01455 
01456     // Success!
01457     return TRUE;
01458 }

LineAttrGroup* LineGallery::CreateBrushAttrGroup String_256  GroupName  )  [private]
 

BOOL LineGallery::CreateBrushGroups  )  [private]
 

Creates groups to hold brushes in the line gallery. Basically we create folders for each of the default files that are loaded during start-up, plus one extra folder where all subsequent brushes will be put. Note that PrepareBrushFolders must have been called at some point prior to this.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/1/2000
Returns:
TRUE if successful.
See also:
LineGallery::CreateGroup; LineGallery::CreateItem

Definition at line 1800 of file sgline.cpp.

01801 {
01802     // Create the default folder, which will contain the default stroke
01803     LineAttrGroup *pGroup = CreateGroup(String_256(_R(IDS_BRUSHGROUP_DEFAULT)), TRUE);
01804     if (pGroup == NULL)
01805         return(FALSE);
01806 
01807     // Create a default 'no brush' brush
01808     BrushAttrValue *pAttr;
01809 
01810     // --- Simple old-style line -----------------------------------------------
01811     pAttr = new BrushAttrValue;
01812     if (pAttr == NULL || !CreateItem(pGroup, new BrushAttrItem(pAttr, String_64(_R(IDS_BRUSHITEM_DEFAULT)))))
01813         return(FALSE);
01814     
01815     //For this release, force the brush group to be invisible and non-selectable
01816 //  pGroup->Flags.Folded = true;
01817 //  pGroup->Flags.Invisible = true;
01818 //  pGroup->Flags.CanSelect = false;
01819     
01820 
01821     // make groups for all the filenames we stored
01822     if (m_pFileNameArray != NULL)
01823     {
01824         UINT32 Counter = 0;
01825         String_256 GroupName;
01826         pGroup = NULL;
01827     
01828         while (Counter < m_NumDefaultFiles)
01829         {
01830             GroupName = m_pFileNameArray[Counter++];
01831 
01832             // create the group
01833             pGroup = CreateGroup(GroupName, TRUE);
01834             if (pGroup == NULL)
01835                 return(FALSE);
01836 
01837             //For this release, force the brush group to be invisible and non-selectable
01838 //          pGroup->Flags.Folded = true;
01839 //          pGroup->Flags.Invisible = true;
01840 //          pGroup->Flags.CanSelect = false;
01841         }
01842     }
01843 
01844     return TRUE;
01845 }

BOOL LineGallery::CreateCapGroup  )  [private]
 

Creates a new "line cap" Group with its associated items.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful.

Errors: -

See also:
LineGallery::CreateGroup; LineGallery::CreateItem; LineCapItem::LineCapItem

Definition at line 1476 of file sgline.cpp.

01477 {
01478     // Create the group.
01479     LineAttrGroup* pGroup = CreateGroup(String_256(_R(IDS_LINEGAL_CREATECAP)), TRUE);
01480     if (pGroup != NULL)
01481         pGroup->Flags.Folded = TRUE;
01482 
01483     // Create each item.
01484     return CreateItem(pGroup, new LineCapItem(LineCapButt,  String_64(_R(IDS_LINEGAL_BUTT))))
01485         && CreateItem(pGroup, new LineCapItem(LineCapRound, String_64(_R(IDS_LINEGAL_ROUND))))
01486         && CreateItem(pGroup, new LineCapItem(LineCapButt,  String_64(_R(IDS_LINEGAL_SQUARE))));
01487 }

BOOL LineGallery::CreateDashGroup  )  [private]
 

Creates a new "dash pattern" Group with all its associated items.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful.

Errors: -

See also:
LineGallery::CreateGroup; LineGallery::CreateItem; LineDashItem::LineDashItem

Definition at line 1393 of file sgline.cpp.

01394 {
01395     // Create the group (heading).
01396     LineAttrGroup* pGroup = CreateGroup(String_256(_R(IDS_LINEGAL_CREATEDASH)), TRUE);
01397     if (pGroup != NULL)
01398         pGroup->Flags.Folded = TRUE;
01399 
01400     // Create each item.
01401     INT32 n = (INT32) DashRec::GetNumStockDashes();
01402     for (INT32 i = (INT32) SD_SOLID; i < n; i++)
01403     {
01404         // If we fail then quit now.
01405         String_256 str = DashRec::GetStockDashName((StockDash) i);
01406         if (!CreateItem(pGroup, new LineDashItem((StockDash) i, str))) return FALSE;
01407     }
01408 
01409     // Success!
01410     return TRUE;
01411 }

LineAttrGroup * LineGallery::CreateGroup const String_256 strTitle,
BOOL  fOpen
[private]
 

Creates a new group (heading) within the line-attributes super-gallery.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
strTitle the title (heading) of the group to create [INPUTS] fOpen whether the group "folder" is initially "open"
- [OUTPUTS]
Returns:
A pointer to the newly created group, or NULL if it can't be created.

Errors: -

See also:
LineAttrGroup::LineAttrGroup

Definition at line 1291 of file sgline.cpp.

01292 {
01293     // Make sure the tree has been initialised.
01294     ERROR3IF(DisplayTree == NULL, "Root node not allocated in LineGallery::CreateGroup");
01295     
01296     // Try to create and set a new group.
01297     LineAttrGroup* pGroup = new LineAttrGroup(strTitle, this);
01298     if (pGroup != NULL)
01299     {
01300         // NB. note that the "folded" flag is inverted.
01301 //      pGroup->Flags.Folded = (fOpen) ? FALSE : TRUE;
01302         pGroup->Flags.Folded = true;
01303         pGroup->Flags.Invisible = false;
01304         pGroup->Flags.CanSelect = true;
01305 
01306         DisplayTree->AddItem(pGroup);
01307     }
01308     
01309     // Return a pointer to the new group.
01310     return pGroup;
01311 }

BOOL LineGallery::CreateItem LineAttrGroup pGroup,
LineAttrItem pItem
[private]
 

Definition at line 1329 of file sgline.cpp.

01330 {
01331     // If we were passed a genuine item insert it into the group.
01332     if (pGroup != NULL && pItem != NULL)
01333     {
01334         // Success.
01335         pGroup->AddItem(pItem);
01336         return TRUE;
01337     }
01338     
01339     // You failed to allocate your item or group!
01340     return FALSE;
01341 }

BOOL LineGallery::CreateJoinTypeGroup  )  [private]
 

Creates a new "join type" Group with its associated items.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful.

Errors: -

See also:
LineGallery::CreateGroup; LineGallery::CreateItem; LineJoinTypeItem::LineJoinTypeItem

Definition at line 1505 of file sgline.cpp.

01506 {
01507     // Create the group.
01508     LineAttrGroup* pGroup = CreateGroup(String_256(_R(IDS_LINEGAL_CREATEJOIN)), TRUE);
01509     if (pGroup != NULL)
01510         pGroup->Flags.Folded = TRUE;
01511 
01512     // Create each item.
01513     return CreateItem(pGroup, new LineJoinTypeItem(MitreJoin,    String_64(_R(IDS_LINEGAL_MITRE))))
01514         && CreateItem(pGroup, new LineJoinTypeItem(RoundJoin,    String_64(_R(IDS_LINEGAL_ROUND))))
01515         && CreateItem(pGroup, new LineJoinTypeItem(BevelledJoin, String_64(_R(IDS_LINEGAL_BEVEL))));
01516 }

RenderRegion * LineGallery::CreateRenderRegion DocRect pSize,
ReDrawInfoType pInfo
[private, virtual]
 

An overridable veneer to the DialogOp CreateOSRenderRegion method. This can be overriden to use a different type of renderregion for all of your rendering.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/3/95
If you override this, you MUST also override DestroyRenderRegion!

See also:
SuperGallery::DestroyRenderRegion

Reimplemented from SuperGallery.

Definition at line 2085 of file sgline.cpp.

02086 {
02087     // Try to create a GDraw render-region.
02088     RenderRegion* pRegion = CreateGRenderRegion(pSize, pInfo);
02089     if (pRegion != NULL)
02090     {
02091         // Try to create a display quality attribute.
02092         QualityAttribute* pAttr = new QualityAttribute;
02093         if (pAttr != NULL)
02094         {
02095             // If all that worked then turn on anti-aliasing when drawing in the gallery.
02096             pAttr->QualityValue = Quality::QualityMax;
02097             pRegion->SetQuality(pAttr, TRUE);
02098         }
02099     }
02100     return pRegion;
02101 }

BOOL LineGallery::CreateStrokeTypeGroup  )  [private]
 

Creates a new "Stroke type" Group with its associated items.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/3/97
Returns:
TRUE if successful.
See also:
LineGallery::CreateGroup; LineGallery::CreateItem

Definition at line 1733 of file sgline.cpp.

01734 {
01735 // Removed from non-stroking builds 2/10/97
01736 #ifdef VECTOR_STROKING
01737 
01738     // Create the group.
01739     LineAttrGroup *pGroup = CreateGroup(String_256(_R(IDS_LINEGAL_GROUP_STROKETYPE)), TRUE);
01740     if (pGroup == NULL)
01741         return(FALSE);
01742 
01743     // Create each item.
01744     StrokeTypeAttrValue *pAttr;
01745 
01746     // --- Simple old-style line -----------------------------------------------
01747     pAttr = new StrokeTypeAttrValue(NULL);
01748     if (pAttr == NULL || !CreateItem(pGroup, new StrokeTypeItem(pAttr, String_64(_R(IDS_LINEGAL_STROKETYPE_LINE)))))
01749         return(FALSE);
01750 
01751     // --- Simple flat-filled stroke --------------------------------------------
01752     pAttr = new StrokeTypeAttrValue(new PathProcessorStroke);
01753     if (pAttr == NULL || !CreateItem(pGroup, new StrokeTypeItem(pAttr, String_64(_R(IDS_LINEGAL_STROKETYPE_STROKE)))))
01754         return(FALSE);
01755     /*
01756     // --- Airbrush (L) ---------------------------------------------------------
01757     PathProcessorStrokeAirbrush *pAirbrush = new PathProcessorStrokeAirbrush;
01758     if (pAirbrush == NULL)
01759         return(FALSE);
01760 
01761     pAirbrush->SetIntensityFunction(new ValueFunctionRampL);
01762     pAttr = new StrokeTypeAttrValue(pAirbrush);
01763     if (pAttr == NULL || !CreateItem(pGroup, new StrokeTypeItem(pAttr, String_64(TEXT("Thin airbrush")))))
01764         return(FALSE);
01765 
01766     // --- Airbrush (S) ---------------------------------------------------------
01767     pAirbrush = new PathProcessorStrokeAirbrush;
01768     if (pAirbrush == NULL)
01769         return(FALSE);
01770 
01771     pAirbrush->SetIntensityFunction(new ValueFunctionRampS);
01772     pAttr = new StrokeTypeAttrValue(pAirbrush);
01773     if (pAttr == NULL || !CreateItem(pGroup, new StrokeTypeItem(pAttr, String_64(TEXT("Thick airbrush")))))
01774         return(FALSE);
01775     */
01776 #endif // VECTOR_STROKING
01777 
01778     return(TRUE);
01779 }

BOOL LineGallery::CreateVarWidthGroup  )  [private]
 

Creates a new "variable width" Group with its associated items.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/3/97
Returns:
TRUE if successful.
See also:
LineGallery::CreateGroup; LineGallery::CreateItem

Definition at line 1535 of file sgline.cpp.

01536 {
01537 // Removed from non-stroking builds 2/10/97
01538 #ifdef VECTOR_STROKING
01539 
01540     // Create the group.
01541     LineAttrGroup *pGroup = CreateGroup(String_256(_R(IDS_LINEGAL_GROUP_VARWIDTH)), TRUE);
01542     if (pGroup == NULL)
01543         return(FALSE);
01544         
01545     // --- Simple constant-width line ------------------------------------------
01546     VariableWidthAttrValue *pAttr;
01547     pAttr = new VariableWidthAttrValue(NULL);
01548     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CONSTANT)))))
01549         return(FALSE);
01550 
01551     // --- SmoothStroke SS_Fallout ------------------------------------------------------------
01552     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Fallout);
01553     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_FALLOUT)))))
01554         return(FALSE);
01555 
01556     // --- SmoothStroke SS_Iron ------------------------------------------------------------
01557     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Iron);
01558     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_IRON)))))
01559         return(FALSE);
01560         
01561     // --- Ellipse -------------------------------------------------------------
01562     pAttr = new VariableWidthAttrValue(new ValueFunctionEllipse);
01563     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_ELLIPSE)))))
01564         return(FALSE);
01565 
01566     // --- SmoothStroke SS_SlimBlip ------------------------------------------------------------
01567     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_SlimBlip);
01568     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_SLIMBLIP)))))
01569         return(FALSE);
01570 
01571     // --- Blip ------------------------------------------------------------
01572     pAttr = new VariableWidthAttrValue(new ValueFunctionBlip);
01573     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_BLIP)))))
01574         return(FALSE);
01575 
01576     // --- SmoothStroke SS_Cigar ------------------------------------------------------------
01577     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Cigar);
01578     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CIGAR)))))
01579         return(FALSE);
01580 
01581     // --- SmoothStroke SS_Cigar2 ------------------------------------------------------------
01582     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Cigar2);
01583     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CIGAR_2)))))
01584         return(FALSE);
01585     
01586     // --- SmoothStroke SS_Cigar3 ------------------------------------------------------------
01587     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Cigar3);
01588     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CIGAR_3)))))
01589         return(FALSE);
01590 
01591     // --- SmoothStroke SS_Convex ------------------------------------------------------------
01592     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Convex);
01593     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CONVEX)))))
01594         return(FALSE);
01595 
01596     // --- Simple S-shaped ramp with none-zero end width------------------------------------------------
01597     pAttr = new VariableWidthAttrValue(new ValueFunctionRampS2);
01598     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CONVEX_2)))))
01599         return(FALSE);
01600 
01601     // --- Simple S-shaped ramp ------------------------------------------------
01602     pAttr = new VariableWidthAttrValue(new ValueFunctionRampS);
01603     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CONVEX_3)))))
01604         return(FALSE);
01605 
01606     // --- SmoothStroke SS_Concave ------------------------------------------------------------
01607     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Concave);
01608     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CONCAVE)))))
01609         return(FALSE);
01610         
01611     // --- Simple linear ramp with non-zero end width --------------------------------------------------
01612     pAttr = new VariableWidthAttrValue(new ValueFunctionRampL2);
01613     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CONCAVE_2)))))
01614         return(FALSE);
01615         
01616     // --- Simple linear ramp --------------------------------------------------
01617     pAttr = new VariableWidthAttrValue(new ValueFunctionRampL);
01618     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_CONCAVE_3)))))
01619         return(FALSE);
01620         
01621     // --- Teardrop CurvedEnd ------------------------------------------------------------
01622     pAttr = new VariableWidthAttrValue(new ValueFunctionTeardropCurvedEnd);
01623     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_DAB)))))
01624         return(FALSE);
01625 
01626     // --- Teardrop ------------------------------------------------------------
01627     pAttr = new VariableWidthAttrValue(new ValueFunctionTeardrop);
01628     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_RAINDROP)))))
01629         return(FALSE);
01630         
01631     // --- SmoothStroke SS_Comet ------------------------------------------------------------
01632     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Comet);
01633     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_COMET)))))
01634         return(FALSE);
01635         
01636     // --- SmoothStroke SS_Petal ------------------------------------------------------------
01637     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Petal);
01638     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_PETAL)))))
01639         return(FALSE);
01640         
01641     // --- SmoothStroke SS_Reed ------------------------------------------------------------
01642     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Reed);
01643     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_REED)))))
01644         return(FALSE);
01645         
01646     // --- SmoothStroke SS_Meteor ------------------------------------------------------------
01647     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Meteor);
01648     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_METEOR)))))
01649         return(FALSE);
01650         
01651     // --- SmoothStroke SS_Torpedo ------------------------------------------------------------
01652     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Torpedo);
01653     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_TORPEDO)))))
01654         return(FALSE);
01655 
01656     // --- SmoothStroke SS_Missile ------------------------------------------------------------
01657     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Missile);
01658     if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_MISSILE)))))
01659         return(FALSE);
01660 
01661     // --- SmoothStroke SS_Goldfish ------------------------------------------------------------
01662     pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Goldfish);
01663     if (pAttr == NULL || !CreateItem(pGroup, new