#include <sgstroke.h>
Inheritance diagram for VarWidthItem:
Public Member Functions | |
VarWidthItem (VariableWidthAttrValue *pAttr, const String &strDescription) | |
Constructs a user-interface item representing a stroke type. | |
~VarWidthItem () | |
Destructor. | |
void | RenderAttributes (RenderRegion *pRegion) |
Private Member Functions | |
CC_DECLARE_DYNAMIC (VarWidthItem) | |
virtual void | SetAttributes (RenderRegion *pRegion) const |
Sets the stroke typeattributes in the given render-region to render this item correctly. | |
virtual NodeAttribute * | CreateNewAttribute (BOOL fIsAdjust) const |
Create a NodeAttribute representing the attribute this item applies. | |
virtual MILLIPOINT | GetWidth () const |
Called by the line gallery formatting code. | |
virtual CCRuntimeClass ** | GetAttribRuntimeClasses () const |
Used when searching for display items representing the selection's current attributes. | |
virtual BOOL | IsEqualValueToAny (NodeAttribute **ppOtherAttribs) const |
Used when searching for display items representing the selection's current attributes. | |
virtual MILLIPOINT | GetHorzGap () const |
Called by the formatting code to determine the gap between items of this type. | |
virtual BOOL | ItemSelected (NodeAttribute *pAttr) |
utility fn called when the item is selected. As we now wish to apply both the stroke type item and the variable width item through one UI action we must do so here. Notes: This was implemented so that the user could apply a variable width stroke with just one click. As we have abaondoned the idea of keeping the different stroke types for this release it has been decided that we will only have the basic stroke type which will automatically be applied when you select a variable width | |
Private Attributes | |
VariableWidthAttrValue * | pAttrDef |
Definition at line 167 of file sgstroke.h.
|
Constructs a user-interface item representing a stroke type.
Definition at line 606 of file sgstroke.cpp. 00607 : LineAttrItem(strDescription, BELOW) 00608 { 00609 ERROR3IF(pAttr == NULL, "Illegal NULL param"); 00610 pAttrDef = pAttr; 00611 }
|
|
Destructor.
Definition at line 626 of file sgstroke.cpp.
|
|
|
|
Create a NodeAttribute representing the attribute this item applies.
Implements LineAttrItem. Definition at line 679 of file sgstroke.cpp.
|
|
Used when searching for display items representing the selection's current attributes.
Implements LineAttrItem. Definition at line 721 of file sgstroke.cpp. 00722 { 00723 static CCRuntimeClass* aprtc[] = 00724 { 00725 CC_RUNTIME_CLASS(AttrVariableWidth), 00726 NULL 00727 }; 00728 00729 return aprtc; 00730 }
|
|
Called by the formatting code to determine the gap between items of this type.
Reimplemented from LineAttrItem. Definition at line 782 of file sgstroke.cpp. 00783 { 00784 // I would like the gap to be the same all the way around 00785 return(GetVertGap()); 00786 }
|
|
Called by the line gallery formatting code.
Reimplemented from LineAttrItem. Definition at line 699 of file sgstroke.cpp. 00700 { 00701 return 2 * LineAttrItem::GetWidth() / 3; 00702 }
|
|
Used when searching for display items representing the selection's current attributes.
Implements LineAttrItem. Definition at line 749 of file sgstroke.cpp. 00750 { 00751 if (*ppOtherAttribs == NULL) 00752 return(FALSE); 00753 00754 AttrVariableWidth* pAttr = (AttrVariableWidth *) *ppOtherAttribs; 00755 ERROR3IF(!pAttr->IsKindOf(CC_RUNTIME_CLASS(AttrVariableWidth)), 00756 "VarWidthItem::IsEqualValueToAny - unexpected object type"); 00757 00758 if (pAttr != NULL) 00759 { 00760 VariableWidthAttrValue *pOther = (VariableWidthAttrValue *) pAttr->GetAttributeValue(); 00761 return((*pAttrDef) == (*pOther)); 00762 } 00763 00764 return(FALSE); 00765 }
|
|
utility fn called when the item is selected. As we now wish to apply both the stroke type item and the variable width item through one UI action we must do so here. Notes: This was implemented so that the user could apply a variable width stroke with just one click. As we have abaondoned the idea of keeping the different stroke types for this release it has been decided that we will only have the basic stroke type which will automatically be applied when you select a variable width
Reimplemented from LineAttrItem. Definition at line 807 of file sgstroke.cpp. 00808 { 00809 if (pAttribute == NULL || !pAttribute->IsKindOf(CC_RUNTIME_CLASS(AttrVariableWidth))) 00810 { 00811 ERROR3("Invalid attribute in VarWidthItem::ItemSelected"); 00812 return FALSE; 00813 } 00814 00815 // if we're applying a default then we should also apply an old-style stroke so... 00816 PathProcessorStroke* PPS = NULL; 00817 VariableWidthAttrValue* pVal = (VariableWidthAttrValue*)pAttribute->GetAttributeValue(); 00818 if (pVal->GetWidthFunction() != NULL) 00819 { 00820 // If not a default then create the PathProcessor for the stroke attribute 00821 // The default case will fall through with NULL and create an old-style stroke 00822 PPS = new PathProcessorStroke; 00823 if (PPS == NULL) 00824 return FALSE; 00825 } 00826 00827 StrokeTypeAttrValue NewStroke(PPS); 00828 AttrStrokeType* pAttrStroke = (AttrStrokeType*)NewStroke.MakeNode(); 00829 00830 if (pAttrStroke == NULL) 00831 return FALSE; 00832 00833 List AttribsList; 00834 NodeAttributePtrItem* pStrokeAttrPtr = new NodeAttributePtrItem; 00835 if (pStrokeAttrPtr == NULL) 00836 { 00837 delete pAttrStroke; 00838 return TRUE; 00839 } 00840 pStrokeAttrPtr->NodeAttribPtr = pAttrStroke; 00841 00842 // in order to apply the attributes simultaneously we need a list 00843 AttribsList.AddHead(pStrokeAttrPtr); 00844 00845 NodeAttributePtrItem* pVarWidthPtr = new NodeAttributePtrItem; 00846 if (pVarWidthPtr == NULL) 00847 { 00848 pStrokeAttrPtr->NodeAttribPtr = NULL; 00849 delete pAttrStroke; 00850 delete pStrokeAttrPtr; 00851 return TRUE; 00852 } 00853 pVarWidthPtr->NodeAttribPtr = pAttribute; 00854 00855 AttribsList.AddHead(pVarWidthPtr); 00856 00857 AttributeManager::AttributesSelected(AttribsList, _R(IDS_STROKEAPPLY_UNDO)); 00858 00859 // We don't need the list of attrs anymore 00860 NodeAttributePtrItem* pAttrItem = (NodeAttributePtrItem*)AttribsList.GetHead(); 00861 while (pAttrItem) 00862 { 00863 delete (pAttrItem->NodeAttribPtr); 00864 pAttrItem->NodeAttribPtr = NULL; 00865 pAttrItem = (NodeAttributePtrItem*)AttribsList.GetNext(pAttrItem); 00866 } 00867 AttribsList.DeleteAll(); // tidyup 00868 00869 BROADCAST_TO_ALL(StrokeMsg()); 00870 return FALSE; // means do not go ahead and apply pAttribute again 00871 }
|
|
Definition at line 176 of file sgstroke.h. 00176 { SetAttributes (pRegion); }
|
|
Sets the stroke typeattributes in the given render-region to render this item correctly.
Implements LineAttrItem. Definition at line 648 of file sgstroke.cpp. 00649 { 00650 // Set a 16pt line width - nice & thick 00651 pRegion->SetLineWidth(16000); 00652 00653 // Set the line width (this overrides the "default" line width set by the caller). 00654 pAttrDef->Render(pRegion, FALSE); 00655 00656 // Set a path processor up so that the variable line width is used when stroking 00657 StrokeTypeAttrValue *pStroke = new StrokeTypeAttrValue(new PathProcessorStroke); 00658 if (pStroke != NULL) 00659 pStroke->Render(pRegion, TRUE); 00660 }
|
|
Definition at line 188 of file sgstroke.h. |