#include <sgline2.h>
Inheritance diagram for LineArrowItem:
Public Member Functions | |
LineArrowItem (StockArrow nArrowType, double fpScale, const String &strDescription) | |
Protected Member Functions | |
virtual void | SetAttributes (RenderRegion *pRegion) const |
Sets the arrowhead attributes in the given render-region to render this item. | |
virtual void | DrawItem (RenderRegion *pRegion, const DocRect &drBounds) const |
Formats and draws an arrowhead/tail. | |
virtual NodeAttribute * | CreateNewAttribute (BOOL fIsAdjust) const |
A pointer to a NodeAttribute-derivative that this user-interface item represents, ie. an arrowhead attribute that can be passed to the attribute manager. This is either an AttrStartArrow or an AttrEndArrow, depending on the particular type of arrowhead and the state of the fIsAdjust parameter. | |
virtual MILLIPOINT | GetWidth () const |
Overrides the default width of display items in the line gallery, making arrowhead items half the normal width. | |
virtual MILLIPOINT | GetHeight () const |
Overrides the default width of display items in the line gallery, making arrowhead items one-and-a-half times the normal height. | |
virtual MILLIPOINT | GetHorzGap () const |
Overrides the default gap of display items in the line gallery, making arrowhead items more closely spaced horizontally than normal. | |
virtual MILLIPOINT | GetVertGap () const |
Halves the vertical gap between arrowhead items. | |
virtual CCRuntimeClass ** | GetAttribRuntimeClasses () const |
Used when searching for display items representing the selection's current attributes. | |
virtual BOOL | IsEqualValueToAny (NodeAttribute **pOtherAttribs) const |
Used when searching for display items representing the selection's current attributes. | |
virtual BOOL | IsStartArrow () const |
Used to work out what kind of AttrXXXXArrow attribute type to create in LineArrowItem::CreateNewAttribute. Can be overridden. This version asks the item's arrowhead record what kind it is. | |
virtual BOOL | ShouldCloseOnDoubleClick (void) |
When an item is ctrl-double-clicked, the default action is to apply the item and close the gallery (for convenience). However, arrowheads do a special action for ctrl-double-click (they apply to the other end of the line) so they do not want auto-close to occur. | |
Protected Attributes | |
ArrowRec | m_arArrow |
BOOL | m_fCentred |
Definition at line 181 of file sgline2.h.
|
Definition at line 418 of file sgline2.cpp. 00420 : LineAttrItem(strDescription, NO_LABEL), 00421 m_fCentred(nArrowType == SA_SPOT || 00422 nArrowType == SA_DIAMOND || 00423 nArrowType == SA_HOLLOWDIAMOND) 00424 { 00425 // Fill in the blank ArrowRec object and scale it, if we have a valid stock arrow type. 00426 if (nArrowType != (StockArrow) -1) 00427 { 00428 m_arArrow.CreateStockArrow(nArrowType); 00429 m_arArrow.SetArrowSize((FIXED16) fpScale); 00430 } 00431 }
|
|
A pointer to a NodeAttribute-derivative that this user-interface item represents, ie. an arrowhead attribute that can be passed to the attribute manager. This is either an AttrStartArrow or an AttrEndArrow, depending on the particular type of arrowhead and the state of the fIsAdjust parameter.
Implements LineAttrItem. Definition at line 599 of file sgline2.cpp. 00600 { 00601 // Work out whether to make a start- or end-arrow attribute 00602 BOOL fMakeStart = IsStartArrow(); 00603 if (fIsAdjust) fMakeStart = !fMakeStart; 00604 00605 // Make the appropriate attribute. 00606 NodeAttribute* pNewAttr; 00607 if (fMakeStart) 00608 { 00609 // Make a start-arrow attribute. 00610 AttrStartArrow* pNewStartAttr = new AttrStartArrow; 00611 if (pNewStartAttr != NULL) pNewStartAttr->Value.StartArrow = m_arArrow; 00612 pNewAttr = pNewStartAttr; 00613 } 00614 else 00615 { 00616 // Make an end-arrow attribute. 00617 AttrEndArrow* pNewEndAttr = new AttrEndArrow; 00618 if (pNewEndAttr != NULL) pNewEndAttr->Value.EndArrow = m_arArrow; 00619 pNewAttr = pNewEndAttr; 00620 } 00621 00622 // Return the new attribute. 00623 return pNewAttr; 00624 }
|
|
Formats and draws an arrowhead/tail.
Reimplemented from LineAttrItem. Reimplemented in LineNoArrowItem. Definition at line 554 of file sgline2.cpp. 00555 { 00556 // Calculate the mid-point of the bounding box. 00557 MILLIPOINT xMid = (drBounds.lo.x + drBounds.hi.x) / 2; 00558 MILLIPOINT yMid = (drBounds.lo.y + drBounds.hi.y) / 2; 00559 00560 // Work out where to draw the line to and from. This is a bodge worked out empirically 00561 // to get around the unfortunate Corel-like feature that arrowheads make lines longer 00562 // in an unknown way. 00563 const MILLIPOINT nFudge1 = drBounds.Width() / 7; 00564 const MILLIPOINT nFudge2 = 13 * drBounds.Width() / 84; 00565 DocCoord dcStart(xMid - nFudge1 + ((m_fCentred) ? (nFudge2 / 2) : nFudge2), yMid), 00566 dcEnd(drBounds.hi.x - nFudge1, yMid); 00567 00568 // Create and draw the path. 00569 Path pthLinePath; 00570 pthLinePath.Initialise(); 00571 pthLinePath.InsertMoveTo(dcStart); 00572 pthLinePath.InsertLineTo(dcEnd); 00573 pRegion->DrawPath(&pthLinePath); 00574 }
|
|
Used when searching for display items representing the selection's current attributes.
Implements LineAttrItem. Definition at line 643 of file sgline2.cpp. 00644 { 00645 static CCRuntimeClass* aprtc[] = 00646 { 00647 CC_RUNTIME_CLASS(AttrStartArrow), 00648 CC_RUNTIME_CLASS(AttrEndArrow), 00649 NULL 00650 }; 00651 00652 return aprtc; 00653 }
|
|
Overrides the default width of display items in the line gallery, making arrowhead items one-and-a-half times the normal height.
Reimplemented from LineAttrItem. Reimplemented in LineNoArrowItem. Definition at line 470 of file sgline2.cpp. 00471 { 00472 return 3 * LineAttrItem::GetHeight() / 2; 00473 }
|
|
Overrides the default gap of display items in the line gallery, making arrowhead items more closely spaced horizontally than normal.
Reimplemented from LineAttrItem. Definition at line 491 of file sgline2.cpp.
|
|
Halves the vertical gap between arrowhead items.
Reimplemented from LineAttrItem. Reimplemented in LineNoArrowItem. Definition at line 511 of file sgline2.cpp. 00512 { 00513 return LineAttrItem::GetVertGap() / 4; 00514 }
|
|
Overrides the default width of display items in the line gallery, making arrowhead items half the normal width.
Reimplemented from LineAttrItem. Reimplemented in LineNoArrowItem. Definition at line 449 of file sgline2.cpp. 00450 { 00451 return 5 * LineAttrItem::GetWidth() / 8; 00452 }
|
|
Used when searching for display items representing the selection's current attributes.
Implements LineAttrItem. Reimplemented in LineNoStartArrowItem, and LineNoEndArrowItem. Definition at line 672 of file sgline2.cpp. 00673 { 00674 AttrStartArrow* psattr = (AttrStartArrow*) *ppOtherAttribs; 00675 if (psattr != NULL && psattr->Value.StartArrow == m_arArrow) return TRUE; 00676 AttrEndArrow* peattr = (AttrEndArrow*) ppOtherAttribs[1]; 00677 return peattr != NULL && peattr->Value.EndArrow == m_arArrow; 00678 }
|
|
Used to work out what kind of AttrXXXXArrow attribute type to create in LineArrowItem::CreateNewAttribute. Can be overridden. This version asks the item's arrowhead record what kind it is.
Reimplemented in LineNoStartArrowItem, and LineNoEndArrowItem. Definition at line 694 of file sgline2.cpp.
|
|
Sets the arrowhead attributes in the given render-region to render this item.
Implements LineAttrItem. Reimplemented in LineNoArrowItem. Definition at line 532 of file sgline2.cpp. 00533 { 00534 pRegion->SetLineWidth(c_nDefaultLineWidth / 3); 00535 pRegion->SetStartArrow((ArrowRec&) m_arArrow); 00536 }
|
|
When an item is ctrl-double-clicked, the default action is to apply the item and close the gallery (for convenience). However, arrowheads do a special action for ctrl-double-click (they apply to the other end of the line) so they do not want auto-close to occur.
Reimplemented from LineAttrItem. Definition at line 722 of file sgline2.cpp. 00723 { 00724 return(FALSE); 00725 }
|
|
|
|
|