#include <sgline.h>
Inheritance diagram for LineGallery:
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. | |
CBrushGadget * | GetBrushGadget () |
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 LineGallery * | GetInstance () |
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 RenderRegion * | CreateRenderRegion (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. | |
LineAttrGroup * | CreateBrushAttrGroup (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. | |
LineAttrGroup * | CreateGroup (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 LineGallery * | m_pTheGallery = NULL |
static double | m_anArrowScales [4] = { 3.0, 8.0, 13.0, 18.0 } |
static String_256 * | m_pFileNameArray = NULL |
static UINT32 | m_NumDefaultFiles = 0 |
Definition at line 271 of file sgline.h.
|
LineGallery default constructor. Sets a global instance pointer to this object.
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 }
|
|
Destroys a line gallery, resetting the global instance pointer to NULL.
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 }
|
|
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.
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 }
|
|
Finds the line gallery, and adds the given stroke type attribute to the end of the stroke type display.
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 }
|
|
Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
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 }
|
|
To build a menu of commands to be popped up over the gallery.
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 }
|
|
Creates a new "arrowhead/tail" Group with its associated items.
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 }
|
|
|
|
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.
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 }
|
|
Creates a new "line cap" Group with its associated items.
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 }
|
|
Creates a new "dash pattern" Group with all its associated items.
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 }
|
|
Creates a new group (heading) within the line-attributes super-gallery.
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 }
|
|
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 }
|
|
Creates a new "join type" Group with its associated items.
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 }
|
|
An overridable veneer to the DialogOp CreateOSRenderRegion method. This can be overriden to use a different type of renderregion for all of your rendering.
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 }
|
|
Creates a new "Stroke type" Group with its associated items.
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 }
|
|
Creates a new "variable width" Group with its associated items.
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 VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_GOLDFISH))))) 01664 return(FALSE); 01665 01666 // --- SmoothStroke SS_Yacht ------------------------------------------------------------ 01667 pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Yacht); 01668 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_YACHT))))) 01669 return(FALSE); 01670 01671 // --- SmoothStroke SS_Barb ------------------------------------------------------------ 01672 pAttr = new VariableWidthAttrValue(new ValueFunctionSS_Barb); 01673 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_BARB))))) 01674 return(FALSE); 01675 01676 // --- SmoothStroke SS_Ocean Liner ------------------------------------------------------------ 01677 pAttr = new VariableWidthAttrValue(new ValueFunctionSS_OceanLiner); 01678 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_OCEAN_LINER))))) 01679 return(FALSE); 01680 01681 // --- Propeller ------------------------------------------------------------ 01682 pAttr = new VariableWidthAttrValue(new ValueFunctionPropeller); 01683 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_PROPELLER))))) 01684 return(FALSE); 01685 01686 // --- DoubleRampS ------------------------------------------------------------ 01687 pAttr = new VariableWidthAttrValue(new ValueFunctionDoubleRampS); 01688 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_BOW_TIE))))) 01689 return(FALSE); 01690 01691 // --- BevelEnds ------------------------------------------------------------ 01692 pAttr = new VariableWidthAttrValue(new ValueFunctionBevelEnds); 01693 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_BEVELLED_ENDS))))) 01694 return(FALSE); 01695 01696 // --- SawTooth ------------------------------------------------------------ 01697 pAttr = new VariableWidthAttrValue(new ValueFunctionSawTooth); 01698 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_SAW_TOOTH))))) 01699 return(FALSE); 01700 01701 // --- Intestine ------------------------------------------------------------ 01702 pAttr = new VariableWidthAttrValue(new ValueFunctionIntestine); 01703 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_INTESTINE))))) 01704 return(FALSE); 01705 01706 // --- Decay ------------------------------------------------------------ 01707 pAttr = new VariableWidthAttrValue(new ValueFunctionDecay); 01708 if (pAttr == NULL || !CreateItem(pGroup, new VarWidthItem(pAttr, String_64(_R(IDS_LINEGAL_VARWIDTH_DECAY))))) 01709 return(FALSE); 01710 01711 #endif // VECTOR_STROKING 01712 01713 return(TRUE); 01714 }
|
|
Creates a new "line width" Group with its associated items.
Definition at line 1359 of file sgline.cpp. 01360 { 01361 // Create the group (heading). 01362 LineAttrGroup* pGroup = CreateGroup(String_256(_R(IDS_LINEGAL_CREATELINE)), TRUE); 01363 if (pGroup != NULL) 01364 pGroup->Flags.Folded = TRUE; 01365 01366 // Create each item. 01367 return CreateItem(pGroup, new LineWidthItem(0.25, String_64(_R(IDS_LINEGAL_025PT)))) 01368 && CreateItem(pGroup, new LineWidthItem(0.5, String_64(_R(IDS_LINEGAL_05PT)))) 01369 && CreateItem(pGroup, new LineWidthItem(1.0, String_64(_R(IDS_LINEGAL_1PT)))) 01370 && CreateItem(pGroup, new LineWidthItem(2.0, String_64(_R(IDS_LINEGAL_2PT)))) 01371 && CreateItem(pGroup, new LineWidthItem(4.0, String_64(_R(IDS_LINEGAL_4PT)))) 01372 && CreateItem(pGroup, new LineWidthItem(8.0, String_64(_R(IDS_LINEGAL_8PT)))) 01373 && CreateItem(pGroup, new LineWidthItem(12.0, String_64(_R(IDS_LINEGAL_12PT)))) 01374 && CreateItem(pGroup, new LineWidthItem(16.0, String_64(_R(IDS_LINEGAL_16PT)))); 01375 }
|
|
Deletes the brush with the given handle.
Definition at line 2796 of file sgline.cpp. 02797 { 02798 LineGallery *pGallery = (LineGallery *) LineGallery::GetInstance(); 02799 if (pGallery == NULL) 02800 return FALSE; 02801 02802 // Iterate over each group. 02803 for (LineAttrGroup* pGroup = (LineAttrGroup*) GetDisplayTree()->GetChild(); 02804 pGroup != NULL; 02805 pGroup = (LineAttrGroup*) pGroup->GetNext()) 02806 { 02807 // Iterate over each item within the group. 02808 LineAttrItem* pNextItem; 02809 02810 LineAttrItem* pItem = (LineAttrItem*) pGroup->GetChild(); 02811 02812 // if its not a brush we're not interested 02813 if (!pItem->IsKindOf(CC_RUNTIME_CLASS(BrushAttrItem))) 02814 pItem = NULL; 02815 02816 while (pItem != NULL) 02817 { 02818 // get the next item before we delete anything 02819 pNextItem = (LineAttrItem*) pItem->GetNext(); 02820 02821 // If the item is selected then remove it from the tree before deleting 02822 if (((BrushAttrItem*)pItem)->GetBrushHandle() == Handle) 02823 { 02824 pItem->RemoveFromTree(); 02825 pItem->DestroySubtree(TRUE); 02826 } 02827 pItem = pNextItem; 02828 } 02829 02830 } 02831 02832 02833 SelectionHasChanged(); 02834 pGallery->ReformatAndRedrawIfNecessary(); 02835 return TRUE; 02836 }
|
|
Destroys the given render-region (in this case a GDraw version).
Reimplemented from SuperGallery. Definition at line 2118 of file sgline.cpp. 02119 { 02120 DestroyGRenderRegion(pRegion); 02121 }
|
|
To apply a given command when it is chosen from the menu.
Reimplemented from SuperGallery. Definition at line 2581 of file sgline.cpp. 02582 { 02583 // Taken out by vector stroking code Neville 2/10/97 02584 #ifdef VECTOR_STROKING 02585 // if (*CommandID == SGCmd_Properties) 02586 // { 02587 // SGalleryLinePropertiesDlg::InvokeDialog(this); 02588 // } 02589 // else 02590 #endif // VECTOR_STROKING 02591 02592 // we are now launching the brush edit dialog from here 02593 SGDisplayNode *pItem = DisplayTree->FindNextSelectedItem(NULL); 02594 // we want to launch our new edit dialog for the new style brushes, its all new baby 02595 if (pItem != NULL && pItem->IsKindOf(CC_RUNTIME_CLASS(BrushAttrItem))) 02596 { 02597 // get the brush component from the document 02598 Document* pDoc = Document::GetCurrent(); 02599 if (pDoc == NULL) 02600 { 02601 return; // not necessarily an error, but we don't wish to proceed 02602 } 02603 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 02604 if (pBrushComp == NULL) 02605 { 02606 ERROR3("We've got a document with no brush component"); 02607 return; 02608 } 02609 BrushHandle Handle = ((BrushAttrItem*)pItem)->GetBrushHandle(); 02610 if (Handle != BrushHandle_NoBrush) 02611 { 02612 if (*CommandID == SGCmd_RenameBrush) 02613 { 02614 // launch the naming dialog 02615 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_NAME_BRUSH_DLG); 02616 if (pDesc != NULL) 02617 { 02618 // provide the new brush handle as a parameter 02619 OpParam Param(static_cast<INT32>(Handle), 0); 02620 pDesc->Invoke(&Param); 02621 } 02622 } 02623 else if (*CommandID == SGCmd_ExportBrush) 02624 { 02625 pBrushComp->CopyInkObjectsToClipboard(Handle); 02626 } 02627 else if (*CommandID == SGCmd_Delete) 02628 { 02629 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_DELETEBRUSH); 02630 if (pDesc != NULL) 02631 { 02632 // provide the new brush handle as a parameter 02633 OpParam Param(static_cast<INT32>(Handle), 0); 02634 pDesc->Invoke(&Param); 02635 } 02636 } 02637 02638 } 02639 } 02640 02641 // SuperGallery::DoCommand(CommandID); // Unknown command- pass to the base class 02642 }
|
|
Definition at line 304 of file sgline.h. 00304 { return &BrushGadget;}
|
|
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).
Reimplemented from SuperGallery. Definition at line 2556 of file sgline.cpp. 02557 { 02558 OpState State; 02559 02560 if (*CommandID == SGCmd_Properties) 02561 return(State); 02562 02563 return(State); 02564 }
|
|
Public access function to the line gallery.
Definition at line 1131 of file sgline.cpp. 01132 { 01133 return m_pTheGallery; 01134 }
|
|
as above
Definition at line 2777 of file sgline.cpp. 02778 { 02779 return m_PreviousLineWidth; 02780 }
|
|
Called when the program starts, loading .INI file settings.
Reimplemented from SimpleCCObject. Definition at line 1102 of file sgline.cpp. 01103 { 01104 return Camelot.DeclareSection(TEXT("Displays"), 20) 01105 && Camelot.DeclarePref(TEXT("Displays"), TEXT("ArrowScale1"), 01106 &m_anArrowScales[0], 0.1, 50.0) 01107 && Camelot.DeclarePref(TEXT("Displays"), TEXT("ArrowScale2"), 01108 &m_anArrowScales[1], 0.1, 50.0) 01109 && Camelot.DeclarePref(TEXT("Displays"), TEXT("ArrowScale3"), 01110 &m_anArrowScales[2], 0.1, 50.0) 01111 && Camelot.DeclarePref(TEXT("Displays"), TEXT("ArrowScale4"), 01112 &m_anArrowScales[3], 0.1, 50.0) 01113 && PrepareBrushFolders(); 01114 }
|
|
Initialises any menu commands that this gallery needs.
Reimplemented from SuperGallery. Definition at line 2455 of file sgline.cpp. 02456 { 02457 static BOOL MenusInitialised = FALSE; 02458 02459 BOOL ok = TRUE; 02460 02461 if (!MenusInitialised) 02462 { 02463 // Initialise menu command Ops 02464 //ok = ok && InitMenuCommand((StringBase *) &SGCmd_Properties, _R(IDS_SGMENU_PROPERTIES)); 02465 ok = ok && InitMenuCommand((StringBase *) &SGCmd_RenameBrush, _R(IDS_SGMENU_RENAMEBRUSH)); 02466 ok = ok && InitMenuCommand((StringBase *) &SGCmd_ExportBrush, _R(IDS_SGMENU_EXPORTBRUSH)); 02467 ok = ok && InitMenuCommand((StringBase *) &SGCmd_Delete, _R(IDS_SGMENU_DELETE)); 02468 MenusInitialised = TRUE; 02469 } 02470 02471 return(ok); 02472 }
|
|
Used by the message-handlers of gadgets within the line gallery to determine if they should update themselves or not.
Definition at line 1152 of file sgline.cpp. 01153 { 01154 return m_pTheGallery != NULL && m_pTheGallery->IsVisible(); 01155 }
|
|
Definition at line 291 of file sgline.h. 00291 {return(PreCreate());};
|
|
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].
Reimplemented from SuperGallery. Definition at line 1920 of file sgline.cpp. 01921 { 01922 // Do we need to update our display of the current attributes. 01923 if (MESSAGE_IS_A(pMessage, CurrentAttrChangedMsg)) 01924 { 01925 LineAttrItem::UpdateCurrentAttribStatus(); 01926 } 01927 01928 // A dialogue box message? 01929 else if (IS_OUR_DIALOG_MSG(pMessage)) 01930 { 01931 DialogMsg* pMsg = (DialogMsg*) pMessage; 01932 switch (pMsg->DlgMsg) 01933 { 01934 // Gallery being created. 01935 case DIM_CREATE: 01936 SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAY_LINE_GALLERY), TRUE); 01937 break; 01938 01939 // Gallery being closed. 01940 case DIM_CANCEL: 01941 SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAY_LINE_GALLERY), FALSE); 01942 break; 01943 01944 case DIM_LFT_BN_CLICKED: 01945 if (pMsg->GadgetID == _R(IDC_GALLERY_HELP)) // Show help page 01946 { 01947 HelpUserTopic(_R(IDS_HELPPATH_Gallery_Line)); 01948 } 01949 break; 01950 01951 default: 01952 break; 01953 01954 } 01955 } 01956 01957 // A document state message? 01958 else if (MESSAGE_IS_A(pMessage, DocChangingMsg)) 01959 { 01960 DocChangingMsg* pMsg = (DocChangingMsg*) pMessage; 01961 if (pMsg->State == DocChangingMsg::SELCHANGED) 01962 { 01963 if (pMsg->pNewDoc != NULL) 01964 { 01965 // A new document is selected, so update our selection state. 01966 SuperGallery::ShadeGallery(FALSE); 01967 SelectionHasChanged(); 01968 } 01969 else 01970 { 01971 // There is no selected doc, so grey the gallery for now. 01972 SuperGallery::ShadeGallery(TRUE); 01973 } 01974 } 01975 } 01976 else if (MESSAGE_IS_A(pMessage, BrushDefMsg)) 01977 { 01978 UpdateBrushItem(((BrushDefMsg*)pMessage)->m_BrushEdited); 01979 } 01980 // Pass on to the base-class for any more handling. 01981 return SuperGallery::Message(pMessage); 01982 }
|
|
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.
Definition at line 2170 of file sgline.cpp. 02171 { 02172 BOOL ActuallyDidSomething = FALSE; 02173 02174 // Iterate over each group. 02175 for (LineAttrGroup* pGroup = (LineAttrGroup*) GetDisplayTree()->GetChild(); 02176 pGroup != NULL; 02177 pGroup = (LineAttrGroup*) pGroup->GetNext()) 02178 { 02179 // Iterate over each item within the group. 02180 for (LineAttrItem* pItem = (LineAttrItem*) pGroup->GetChild(); 02181 pItem != NULL; 02182 pItem = (LineAttrItem*) pItem->GetNext()) 02183 { 02184 // If the item is selected then try to apply the attribute it represents 02185 // to the current selection. 02186 if (pItem->IsSelected()) 02187 { 02188 // Ask the item to create a new attribute of the required kind. 02189 NodeAttribute* pNewAttr = pItem->CreateNewAttribute(fIsAdjust); 02190 ERRORIF(pNewAttr == NULL, _R(IDE_NOMORE_MEMORY), FALSE); 02191 02192 // ask items if they need to do anything before they become selected 02193 // Note that if this returns FALSE it means we no longer want to apply 02194 // the attribute here 02195 if (pItem->ItemSelected(pNewAttr)) 02196 AttributeManager::AttributeSelected(pNewAttr); 02197 02198 // deselect the item 02199 pItem->SetSelected(FALSE); 02200 02201 ActuallyDidSomething = TRUE; 02202 } 02203 } 02204 } 02205 02206 // Success. 02207 return(ActuallyDidSomething); 02208 }
|
|
Responds to the selection state changing by updating the "current attribute" status of the gallery's items. Responds to the the common attributes changing.
Reimplemented from MessageHandler. Definition at line 2063 of file sgline.cpp. 02064 { 02065 return SuperGallery::OnCommonAttrsChangedMsg() && LineAttrItem::UpdateCurrentAttribStatus(); 02066 }
|
|
Called after the LineGallery is created. Forces an update of the "current attribute" status of all items.
Reimplemented from SuperGallery. Definition at line 1269 of file sgline.cpp. 01270 { 01271 // Prime the current attribute status flags of each item. 01272 return SuperGallery::PostCreate() && LineAttrItem::UpdateCurrentAttribStatus(); 01273 }
|
|
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.
Reimplemented from SuperGallery. Definition at line 1229 of file sgline.cpp. 01230 { 01231 // If there isn't already one, create a DisplayTree 01232 if (DisplayTree != NULL) return TRUE; 01233 01234 // New root node, with a scrollbar. 01235 DisplayTree = new SGDisplayRootScroll(this); 01236 ERRORIF(DisplayTree == NULL, _R(IDE_NOMORE_MEMORY), FALSE); 01237 01238 // Try to create a title sub-tree for each kind of line attribute. 01239 BOOL ok = 01240 CreateBrushGroups() && 01241 #ifdef VECTOR_STROKING 01242 //CreateStrokeTypeGroup() && 01243 CreateVarWidthGroup() && 01244 #endif // VECTOR_STROKING 01245 // CreateWidthGroup() && 01246 CreateDashGroup() && 01247 CreateArrowGroup(); 01248 // CreateCapGroup() && 01249 // CreateJoinTypeGroup(); 01250 return ok; 01251 }
|
|
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.
Definition at line 2701 of file sgline.cpp. 02702 { 02703 // find all .xar files in the /templates/brushes directory and put them in a temp array 02704 PORTNOTE("other", "Disabled loading of line gallery templates") 02705 #ifndef EXCLUDE_FROM_XARALX 02706 02707 // allocate a stupidly large array 02708 String_256 TempString[1000]; // surely can't be 1000 files! 02709 02710 // set up the path to our .xar files 02711 String_256 SearchPath; 02712 CResDll::GetExecutablePath((TCHAR*)SearchPath); 02713 String_256 Path = TEXT("\\Templates\\Brushes\\"); 02714 SearchPath += Path; 02715 String_256 FileSpecifier = SearchPath; 02716 FileSpecifier += TEXT("*.xar"); 02717 UINT32 Counter = 0; 02718 02719 // use file util to find the file for us, we need only pass the searchpath 02720 BOOL ok = FileUtil::StartFindingFiles(&FileSpecifier); 02721 02722 String_256 Filename; 02723 INT32 StringLength; 02724 String_256 ShortName; 02725 while (ok) 02726 { 02727 // FileUtil will put our filename string into Filename 02728 ok = FileUtil::FindNextFile(&Filename); 02729 02730 if (ok && Counter < 1000) 02731 { 02732 // strip the .xar from the string 02733 StringLength = Filename.Length(); 02734 Filename.Left(&ShortName, StringLength - 4); 02735 02736 // //Special case - when Xara default brushes are loaded, change the folder group 02737 // //text to something prettier than "defbrush" - bit of a bodge but it works... 02738 // if (ShortName == String_256("defbrush")) 02739 // { 02740 // ShortName = String_256("Default brushes"); 02741 // } 02742 02743 TempString[Counter++] = ShortName; 02744 } 02745 } 02746 02747 FileUtil::StopFindingFiles(); 02748 02749 // Now allocate our member string array, MFC seems to get very upset when 02750 // we try to delete an array of String_256's so use malloc 02751 02752 m_pFileNameArray = (String_256*)malloc(sizeof(String_256) * Counter); 02753 02754 if (m_pFileNameArray == NULL) 02755 return FALSE; 02756 02757 // copy the strings over 02758 INT32 size = sizeof(String_256); 02759 02760 memcpy(m_pFileNameArray, &TempString, size * Counter); 02761 02762 m_NumDefaultFiles = Counter; // remember how many we got 02763 #endif 02764 return TRUE; 02765 }
|
|
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.
Reimplemented from SuperGallery. Definition at line 2140 of file sgline.cpp. 02141 { 02142 // Nothing to do if we are unavailable. 02143 if (GetDisplayTree() == NULL || AmShaded || !IsVisible()) return; 02144 02145 // Only grey the "Apply" button when NO items are selected. 02146 EnableGadget(_R(IDC_GALLERY_APPLY), (GetDisplayTree()->GetSelectedItemCount() > 0)); 02147 02148 // Update the status text to reflect the new selection. 02149 SetStatusText(); 02150 }
|
|
queries AttributeManager to get the current default,sets it as the member variable and returns it
Definition at line 2657 of file sgline.cpp. 02658 { 02659 Document* pDoc = Document::GetCurrent(); 02660 if (pDoc == NULL) 02661 { 02662 ERROR3("No document"); 02663 return -1; 02664 } 02665 02666 AttributeManager* pAttrMgr = &(pDoc->GetAttributeMgr()); 02667 if (pAttrMgr == NULL) 02668 { 02669 ERROR3("No attribute manager"); 02670 return -1; 02671 } 02672 02673 NodeAttribute* pAttr = pAttrMgr->GetCurrentAttribute(CC_RUNTIME_CLASS(NodeRenderableInk), CC_RUNTIME_CLASS(AttrLineWidth)); 02674 if (pAttr == NULL) 02675 return -1; 02676 02677 LineWidthAttribute* pVal = (LineWidthAttribute*)pAttr->GetAttributeValue(); 02678 if (pVal == NULL) 02679 return -1; 02680 02681 m_PreviousLineWidth = pVal->LineWidth; 02682 return m_PreviousLineWidth; 02683 }
|
|
Works out what the status text should be from which items are selected in the gallery, and updates it on-screen.
Definition at line 2222 of file sgline.cpp. 02223 { 02224 /* THIS CODE HAS BEEN COMMENTED OUT BECAUSE, ALTHOUGH IT WORKS, THE GALLERY STATUS-LINE 02225 CODE PROVIDES ITS OWN STATUS-LINE HELP TEXT FOR THE APPLY BUTTON. 02226 02227 // Update the status line text, according to what is selected in the gallery. 02228 String_256 strAttribs; 02229 strAttribs.Empty(); 02230 02231 // Ask each selected item in each group to provide a description of its attribute. 02232 INT32 nSelected = 0; 02233 for (LineAttrGroup* pGroup = (LineAttrGroup*) GetDisplayTree()->GetChild(); 02234 pGroup != NULL; 02235 pGroup = (LineAttrGroup*) pGroup->GetNext()) 02236 { 02237 for (LineAttrItem* pItem = (LineAttrItem*) pGroup->GetChild(); 02238 pItem != NULL; 02239 pItem = (LineAttrItem*) pItem->GetNext()) 02240 { 02241 // Does this item have something to contribute? 02242 if (pItem->IsSelected()) 02243 { 02244 // It does, so if it isn't the first add some punctuation. 02245 if (nSelected > 0) strAttribs += TEXT(", "); 02246 strAttribs += pItem->GetDescription(); 02247 nSelected++; 02248 } 02249 } 02250 } 02251 02252 // Did we find any selected attributes? 02253 if (nSelected > 0) 02254 { 02255 // If there's only one attribute then prepend a singular indefinite article and don't 02256 // pluralize the "attribute" word. If not then vice versa. 02257 String strPlural = TEXT("s"); // Commented out 02258 if (nSelected == 1) 02259 { 02260 String_256 s = TEXT("a "); // Commented out 02261 strAttribs = (s += strAttribs); 02262 strPlural.Empty(); 02263 } 02264 02265 // Format the attribute text into a meaningful sentence and if successful set the 02266 // status line text with the information. 02267 String_256 strStatus; 02268 if (strStatus.MakeMsg(_R(IDS_LINEGAL_STATUS_TEXT_MASK), &strAttribs, &strPlural) != 0) 02269 { 02270 // Write the new text. 02271 // GetApplication()->UpdateStatusBarText(&strStatus); 02272 TRACEUSER( "JustinF", _T("%s\n"), (LPCTSTR) strStatus); 02273 } 02274 } 02275 */ 02276 }
|
|
Searches for a brush item with the same handle as Handle, and asks it to update itself.
Definition at line 1999 of file sgline.cpp. 02000 { 02001 // we need to make sure the groups have been created 02002 if (!MakeSureGroupsHaveBeenCreated()) 02003 return; 02004 02005 // Iterate over each group. 02006 for (LineAttrGroup* pGroup = (LineAttrGroup*) GetDisplayTree()->GetChild(); 02007 pGroup != NULL; 02008 pGroup = (LineAttrGroup*) pGroup->GetNext()) 02009 { 02010 // Iterate over each item within the group. 02011 LineAttrItem* pNextItem; 02012 02013 LineAttrItem* pItem = (LineAttrItem*) pGroup->GetChild(); 02014 02015 // if its not a brush we're not interested 02016 if (!pItem->IsKindOf(CC_RUNTIME_CLASS(BrushAttrItem))) 02017 pItem = NULL; 02018 02019 while (pItem != NULL) 02020 { 02021 // get the next item before we delete anything 02022 pNextItem = (LineAttrItem*) pItem->GetNext(); 02023 02024 // If the item is selected then remove it from the tree before deleting 02025 if (((BrushAttrItem*)pItem)->GetBrushHandle() == Handle) 02026 ((BrushAttrItem*)pItem)->UpdateGalleryItem(); 02027 02028 pItem = pNextItem; 02029 } 02030 02031 } 02032 }
|
|
|
|
|
|
|
|
|
|
|
|
|