#include <sgline.h>
Inheritance diagram for LineAttrItem:
Public Types | |
enum | TextPosition { NO_LABEL, LEFT, BELOW } |
Public Member Functions | |
const String & | GetDescription () const |
Describes this item, basically. | |
void | SetDescription (StringBase *pNewDescription) |
Changes the item's text in the gallery. | |
void | GetSize (TextPosition eTextPos, MILLIPOINT *pxSize, MILLIPOINT *pySize) const |
void | Render (RenderRegion *pRegion, const DocRect &drBounds, TextPosition eTextPos) const |
virtual void | DragWasReallyAClick (SGMouseInfo *pMouse, SGMiscInfo *pMiscInfo) |
Handles a mouse click event. This is a callback function - drags of items from galleries will call this function back if the drag turns out to just be a click. | |
virtual NodeAttribute * | CreateNewAttribute (BOOL fIsAdjust) const =0 |
virtual BOOL | GetStatusLineHelp (DocCoord *pMousePos, String_256 *pResult) |
Sets the given string to the text description of this line item. | |
virtual void | GetNameText (String_256 *pResult) |
To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods. | |
virtual BOOL | ItemSelected (NodeAttribute *pAttr) |
utility fn called when the item is selected. If your item needs to do anything just prior to it becoming selected then override this function. | |
Static Public Member Functions | |
static BOOL | UpdateCurrentAttribStatus () |
Updates the "current attribute" status flag of every LineAttrItem within the line gallery, setting it to whether each item represents an attribute value applying to the current selection. | |
Protected Member Functions | |
LineAttrItem (const String &strDescription, TextPosition eTextPos) | |
virtual MILLIPOINT | GetWidth () const |
Called by the formatting code. | |
virtual MILLIPOINT | GetHeight () const |
Called by the formatting code. | |
virtual MILLIPOINT | GetHorzGap () const |
Called by the formatting code. This base-class version returns a default value, derived classes may override it to make items closer or further apart. | |
virtual MILLIPOINT | GetVertGap () const |
Called by the formatting code. This base-class version returns a default value, derived classes may override it to make items closer or further apart. | |
virtual void | SetAttributes (RenderRegion *pRegion) const =0 |
virtual void | DrawItem (RenderRegion *pRegion, const DocRect &drBounds) const |
Draws this item within the bouding box. This default implementation draws a single line through the centre of the box, fine for almost all derived classes. You can override this to do something else (cf. the join-types attribute item, that must draw two lines that meet). | |
void | SetTextPosition (TextPosition eNewTextPos) |
Tells SGDisplayLineAttrItems whether to display themselves with a label describing themselves, or not. | |
virtual CCRuntimeClass ** | GetAttribRuntimeClasses () const =0 |
virtual BOOL | IsEqualValueToAny (NodeAttribute **pOtherAttribs) const =0 |
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. | |
Private Member Functions | |
virtual BOOL | HandleEvent (SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo) |
Handles a SuperGallery DisplayTree event Notes: This overrides the pure virtual SGDisplayNode::HandleEvent method. A node need not handle a specific event - if it does not handle it, it should return FALSE. Redraw and Formatting handlers should never return TRUE, as this will prevent the event from continuing through the tree. Non-leaf-nodes must call SGDisplayNode::GiveEventToMyChildren in order to pass the event dow the tree. THIS node is a leaf-node, so it doesn't. | |
virtual void | HandleRedraw (SGRedrawInfo *RedrawInfo, SGMiscInfo *MiscInfo) |
LineAttrItem item redraw method - removed from the main HandleEvent method merely to make the code tidier. | |
virtual void | CalculateMyRect (SGFormatInfo *FormatInfo, SGMiscInfo *MiscInfo) |
virtual BOOL | DefaultClickHandler (SGMouseInfo *pMouse, SGMiscInfo *pMiscInfo) |
CC_DECLARE_DYNAMIC (LineAttrItem) | |
Private Attributes | |
String | m_strDescription |
TextPosition | m_eDefaultTextPosition |
BOOL | m_fIsCurrentAttrib |
Definition at line 159 of file sgline.h.
|
Definition at line 163 of file sgline.h. 00164 { 00165 NO_LABEL, // don't display a text description 00166 LEFT, // display a description to the left of the item 00167 BELOW // display a description below the item 00168 };
|
|
Definition at line 197 of file sgline.cpp. 00198 : m_strDescription(strDescription), 00199 m_eDefaultTextPosition(eTextPos), 00200 m_fIsCurrentAttrib(FALSE) 00201 { 00202 // Empty. 00203 }
|
|
Definition at line 322 of file sgline.cpp. 00323 { 00324 // Find out the extent of this item, including a gap for formatting. 00325 MILLIPOINT xSize, ySize; 00326 GetSize(m_eDefaultTextPosition, &xSize, &ySize); 00327 if (xSize != SG_InfiniteWidth) 00328 xSize += GetHorzGap(); 00329 00330 ySize += GetVertGap(); 00331 00332 // Let the base class do what it needs to do with this. 00333 CalculateFormatRect(pFormatInfo, pMiscInfo, xSize, ySize); 00334 }
|
|
|
|
Implemented in BrushAttrItem, LineWidthItem, LineDashItem, LineArrowItem, LineCapItem, LineJoinTypeItem, StrokeTypeItem, and VarWidthItem. |
|
Definition at line 835 of file sgline.cpp. 00836 { 00837 // Get some objects. 00838 SuperGallery* pParent = GetParentGallery(); 00839 SGDisplayGroup* pGroup = (SGDisplayGroup*) GetParent(); 00840 ERROR3IF(pGroup == NULL, "No parent group in LineAttrItem::DefaultClickHandler?"); 00841 00842 // If there is any other item within the group already selected then 00843 // deselect it. We start searching from the first child of this group. 00844 for (LineAttrItem* pItem = (LineAttrItem*) pGroup->GetChild(); 00845 pItem != NULL; 00846 pItem = (LineAttrItem*) pItem->GetNext()) 00847 { 00848 if (pItem != this) pItem->SetSelected(FALSE); 00849 } 00850 00851 // If Adjust, toggle my selection state 00852 // If Select, set myself selected, and ensure all other items deselected 00853 // NB. NOTE THAT "ADJUST" IS REALLY WHAT EVERY ONE ELSE CALLS "CONSTRAIN"!! 00854 // (Well, actually, it's what Windows uses for altering a selection... it's not my 00855 // fault that the rest of Camelot flies in the face of windows conventions... and 00856 // as galleries are really "super" windows list boxes, they have to use windows 00857 // conventions. Note also that pMouse->Adjust is not necessarily fixed to any key 00858 // but happens under Windows to be attached to ctrl or the right button) 00859 SetSelected((pMouse->Adjust && !pMouse->DoubleClick) ? !Flags.Selected : TRUE); 00860 00861 // OK, now we have guaranteed that an item is selected on a double click we can run 00862 // an Apply action. 00863 if (pMouse->DoubleClick) 00864 { 00865 // Apply the attributes. 00866 if (pParent->ApplyAction(pMouse->Adjust ? SGACTION_APPLYADJUST : SGACTION_APPLY) && 00867 pMouse->Adjust) 00868 { 00869 // Adjust/Ctrl double click of an item. This applies the item and then 00870 // auto closes the gallery (just like RISC OS and Win95) 00871 // Auto-close only occurs, however, if the item says it's OK, as arrowheads 00872 // use the ctrl-double click to apply in a special way, so shouldn't autoclose. 00873 00874 if (ShouldCloseOnDoubleClick()) 00875 { 00876 pParent->SetVisibility(FALSE); 00877 00878 DialogBarOp::SetSystemStateChanged(); // Ensure toolbar button pops out again 00879 } 00880 } 00881 00882 return TRUE; 00883 } 00884 00885 // Update the pParent to know that we are the new multi-selection anchor 00886 // (The anchor only changes when single items are (de)selected) 00887 pParent->SetLastSelectedNode((Flags.Selected) ? this : NULL); 00888 00889 // Finally, inform the parent gallery that the selection has changed, so it can 00890 // shade/unshade buttons as appropriate, etc 00891 pParent->SelectionHasChanged(); 00892 return TRUE; 00893 }
|
|
Handles a mouse click event. This is a callback function - drags of items from galleries will call this function back if the drag turns out to just be a click.
For a description of how to use this, see the documentation, or take a look at other galleries for example code. Documentation: docs.doc
Reimplemented from SGDisplayNode. Definition at line 812 of file sgline.cpp. 00813 { 00814 // Just get default selection action to be applied for this click. 00815 DefaultClickHandler(pMouse, pMiscInfo); 00816 }
|
|
Draws this item within the bouding box. This default implementation draws a single line through the centre of the box, fine for almost all derived classes. You can override this to do something else (cf. the join-types attribute item, that must draw two lines that meet).
Reimplemented in BrushAttrItem, LineArrowItem, LineNoArrowItem, and LineJoinTypeItem. Definition at line 581 of file sgline.cpp. 00582 { 00583 // Calculate the mid-point of the vertical sides of the bounding box. 00584 INT32 yMid = (drBounds.lo.y + drBounds.hi.y) / 2; 00585 00586 // Draw a line at this height from the left to the right edge. 00587 Path pthLinePath; 00588 if (pthLinePath.Initialise()) 00589 { 00590 pthLinePath.InsertMoveTo(DocCoord(drBounds.lo.x, yMid)); 00591 pthLinePath.InsertLineTo(DocCoord(drBounds.hi.x, yMid)); 00592 pthLinePath.IsFilled = FALSE; 00593 pthLinePath.IsStroked = TRUE; 00594 pRegion->DrawPath(&pthLinePath); 00595 } 00596 }
|
|
Implemented in BrushAttrItem, LineWidthItem, LineDashItem, LineArrowItem, LineCapItem, LineJoinTypeItem, StrokeTypeItem, and VarWidthItem. |
|
Describes this item, basically.
Definition at line 910 of file sgline.cpp. 00911 { 00912 return m_strDescription; 00913 }
|
|
Called by the formatting code.
Reimplemented in LineDashItem, LineArrowItem, and LineNoArrowItem. Definition at line 633 of file sgline.cpp. 00634 { 00635 return c_nVertSizeOfItem; 00636 }
|
|
Called by the formatting code. This base-class version returns a default value, derived classes may override it to make items closer or further apart.
Reimplemented in LineArrowItem, StrokeTypeItem, and VarWidthItem. Definition at line 656 of file sgline.cpp. 00657 { 00658 return c_nHorzGapBetweenItems; 00659 }
|
|
To determine a name string for this node. Generally, this is used for a simple mechanism which searches for display items whose names match given search parameters in some way. It is also used in libraries to provide default redraw methods.
Reimplemented from SGDisplayNode. Definition at line 197 of file sgline.h. 00197 {if(pResult != NULL) *pResult = m_strDescription;};
|
|
Definition at line 353 of file sgline.cpp. 00356 { 00357 // Make sure we can put the results somewhere. 00358 ERROR3IF(pxSize == NULL || pySize == NULL, "Null* passed in LineAttrItem::GetSize"); 00359 00360 // Get the basic size and add in a possible text size as well. 00361 *pxSize = GetWidth(); 00362 *pySize = GetHeight(); 00363 switch (eTextPos) 00364 { 00365 case LEFT: 00366 if (*pxSize != SG_InfiniteWidth) 00367 { 00368 *pxSize += (c_nHorzSizeOfText + c_nHorzGapAfterText); 00369 } 00370 break; 00371 00372 case BELOW: 00373 *pySize += (c_nVertSizeOfText + c_nVertGapAboveText); 00374 break; 00375 00376 case NO_LABEL: 00377 break; 00378 00379 default: 00380 ERROR3("Unexpected case in LineAttrItem::GetSize"); 00381 break; 00382 } 00383 }
|
|
Sets the given string to the text description of this line item.
Reimplemented from SGDisplayNode. Definition at line 966 of file sgline.cpp. 00967 { 00968 // Check for rubbish. 00969 ERROR3IF(pResult == NULL, "Null String_256* passed to LineAttrItem::GetStatusLineHelp"); 00970 00971 // Build up the status-line text. This is composed of the item's text description, 00972 // followed by the text of the item's group title, without the last pluralising 's'. 00973 String_256 str; 00974 if (IsSelected()) 00975 str = String_256(_R(IDS_LINEGAL_SEL_CTRLCLICK)); 00976 else 00977 str = String_256(_R(IDS_LINEGAL_SEL_CLICK)); 00978 00979 str += GetDescription(); 00980 str += String_8(_R(IDS_SGLINE_STAT_SPACE_SEP)); // " " 00981 str += ((LineAttrGroup*) GetParent())->GetTitle(); 00982 str.Left(pResult, str.Length() - 1); 00983 00984 String_256 strAttr(_R(IDS_LINEGAL_ATTR)); 00985 *pResult += strAttr; 00986 00987 // if (IsSelected()) // removing this test fixes bug #4684 (hee hee!!) 00988 { 00989 String_256 strDbl(_R(IDS_LINEGAL_SEL_DBLCLK)); 00990 *pResult += strDbl; 00991 } 00992 00993 // Success! 00994 return TRUE; 00995 }
|
|
Called by the formatting code. This base-class version returns a default value, derived classes may override it to make items closer or further apart.
Reimplemented in LineArrowItem, and LineNoArrowItem. Definition at line 679 of file sgline.cpp. 00680 { 00681 return c_nVertGapBetweenItems; 00682 }
|
|
Called by the formatting code.
Reimplemented in LineWidthItem, LineArrowItem, LineNoArrowItem, StrokeTypeItem, and VarWidthItem. Definition at line 613 of file sgline.cpp. 00614 { 00615 return c_nHorzSizeOfItem; 00616 }
|
|
Handles a SuperGallery DisplayTree event Notes: This overrides the pure virtual SGDisplayNode::HandleEvent method. A node need not handle a specific event - if it does not handle it, it should return FALSE. Redraw and Formatting handlers should never return TRUE, as this will prevent the event from continuing through the tree. Non-leaf-nodes must call SGDisplayNode::GiveEventToMyChildren in order to pass the event dow the tree. THIS node is a leaf-node, so it doesn't.
Reimplemented from SGDisplayItem. Definition at line 721 of file sgline.cpp. 00722 { 00723 switch (EventType) 00724 { 00725 case SGEVENT_FORMAT: 00726 { 00727 SGFormatInfo* FormatInfo = GetFormatInfo(EventType, EventInfo); 00728 CalculateMyRect(FormatInfo, MiscInfo); // Cache our FormatRect for later use 00729 } 00730 break; 00731 00732 00733 case SGEVENT_REDRAW: 00734 { 00735 // Rely on FormatRect being cached from above 00736 SGRedrawInfo* RedrawInfo = GetRedrawInfo(EventType, EventInfo); 00737 00738 // only redraw if we intersect the clip rect 00739 if (IMustRedraw(RedrawInfo)) 00740 { 00741 // Now render the item. 00742 StartRendering(RedrawInfo, MiscInfo); 00743 RedrawInfo->Renderer->SaveContext(); 00744 HandleRedraw(RedrawInfo, MiscInfo); 00745 RedrawInfo->Renderer->RestoreContext(); 00746 StopRendering(RedrawInfo, MiscInfo); 00747 } 00748 } 00749 break; // exit and return FALSE to pass the redraw event on 00750 00751 00752 case SGEVENT_MOUSECLICK: 00753 { 00754 SGMouseInfo *Mouse = GetMouseInfo(EventType, EventInfo); 00755 00756 if (FormatRect.ContainsCoord(Mouse->Position)) 00757 { 00758 //OK temporary dodge (see, not a bodge) to stop people doing things with brushes in the 00759 //line gallery before we get them working! 00760 // LineAttrItem* pItem = this; 00761 00762 { 00763 // If the colour is in the selected document, then it is safe to 00764 // do a colour drag - for now, it will only allow drags for the 00765 // selected doc. 00766 // Otherwise, the normal click action takes place. 00767 // If the drag fails (turns into a click) then the normal click action 00768 // takes place, passed on by the GalleryColourDragInfo::OnClick handler 00769 // SGDisplayGroup *Parent = (SGDisplayGroup *) GetParent(); 00770 00771 if (Mouse->DoubleClick) // || Parent->GetParentDocument() != Document::GetSelected()) 00772 DefaultClickHandler(Mouse, MiscInfo); 00773 else 00774 { 00775 DefaultPreDragHandler(Mouse, MiscInfo); 00776 00777 GalleryLineDragInfo* pInfo; 00778 pInfo = new GalleryLineDragInfo(this, Mouse, MiscInfo, Mouse->MenuClick); 00779 if (pInfo != NULL) DragManagerOp::StartDrag(pInfo, GetListWindow()); 00780 } 00781 } 00782 00783 return(TRUE); // Claim this event - nobody else can own this click 00784 } 00785 } 00786 break; 00787 00788 default: 00789 // Pass unknown events on to the base class 00790 return(SGDisplayItem::HandleEvent(EventType, EventInfo, MiscInfo)); 00791 } 00792 00793 // Default return value: We do not claim this event, so it will be passed on to others 00794 return FALSE; 00795 }
|
|
LineAttrItem item redraw method - removed from the main HandleEvent method merely to make the code tidier. Member variable FormatRect should be set up (before calling this method) to be the rectangle in which to draw this item Justin here: this version sets default attributes within the render region, such as foreground & background colour, and then calls the Render() function to do the actual drawing. Notes: VERY IMPORTANT: The rendering must be enclosed by calls to StartRendering and StopRendering, to ensure that rendering works properly (in the future we may change the redraw system to use a GRenderRegion for each individual item, rather than one global one for the window, for which these calls will be essential) Scope: protected Definition at line 411 of file sgline.cpp. 00412 { 00413 // Remove the gap between the items, shrink by one pixel to ensure clean clipping, 00414 // and fix the bounds coincide with the position of pixels. 00415 DocRect drBounds(FormatRect); 00416 drBounds.Inflate(-(pMiscInfo->PixelSize + GetHorzGap() / 2), 00417 -(pMiscInfo->PixelSize + GetVertGap() / 2)); 00418 GridLockRect(pMiscInfo, &drBounds); 00419 00420 // Set the foreground and background colours according to whether this item is 00421 // selected or not. 00422 DocColour dcolForegnd, dcolBackgnd; 00423 if (Flags.Selected) 00424 { 00425 dcolForegnd = pRedrawInfo->SelForeground; 00426 dcolBackgnd = pRedrawInfo->SelBackground; 00427 } 00428 else 00429 { 00430 dcolForegnd = pRedrawInfo->Foreground; 00431 dcolBackgnd = pRedrawInfo->Background; 00432 } 00433 00434 // Set the attributes for drawing the formatted rectangle. 00435 RenderRegion* pRegion = pRedrawInfo->Renderer; 00436 pRegion->SetLineWidth(pMiscInfo->PixelSize); // line is one pixel wide 00437 pRegion->SetFillColour(dcolBackgnd); 00438 00439 // If we are drawing an item that is a "current attribute" then we want to draw it 00440 // with a "selected" line around it. Otherwise we draw it with effectively no line. 00441 if (m_fIsCurrentAttrib) 00442 { 00443 pRegion->SetLineColour(pRedrawInfo->SelBackground); 00444 } 00445 else 00446 { 00447 // Draw the line the same colour as the fill colour, so it's "invisible". 00448 pRegion->SetLineColour(dcolBackgnd); 00449 } 00450 00451 // Create a closed path that is filled with the fill colour and if necessary has 00452 // a visible outline. 00453 Path pth; 00454 pth.Initialise(); 00455 pth.IsFilled = TRUE; 00456 pth.IsStroked = m_fIsCurrentAttrib; // draw outline if "current attribute" 00457 00458 // "Draw" the bounding rectangle into the path. 00459 pth.InsertMoveTo(drBounds.lo); 00460 pth.InsertLineTo(DocCoord(drBounds.lo.x, drBounds.hi.y)); 00461 pth.InsertLineTo(drBounds.hi); 00462 pth.InsertLineTo(DocCoord(drBounds.hi.x, drBounds.lo.y)); 00463 pth.InsertLineTo(drBounds.lo); 00464 pth.CloseSubPath(); 00465 00466 // Draw the path. 00467 pRegion->DrawPath(&pth); 00468 00469 // Reset the rendering attributes back to the normal: standard gallery foreground 00470 // and background colours. 00471 pRegion->SetLineColour(dcolForegnd); 00472 pRegion->SetFixedSystemTextColours(&dcolForegnd, &dcolBackgnd); 00473 00474 // Shrink the rectangle by a pixel, to make sure it nicely fits within the bounds, 00475 // lock down, and let the derived class do the rest of the work as it pleases. 00476 drBounds.Inflate(-pMiscInfo->PixelSize, -pMiscInfo->PixelSize); 00477 GridLockRect(pMiscInfo, &drBounds); 00478 Render(pRegion, drBounds, m_eDefaultTextPosition); 00479 }
|
|
Implemented in BrushAttrItem, LineWidthItem, LineDashItem, LineArrowItem, LineNoStartArrowItem, LineNoEndArrowItem, LineCapItem, LineJoinTypeItem, StrokeTypeItem, and VarWidthItem. |
|
utility fn called when the item is selected. If your item needs to do anything just prior to it becoming selected then override this function.
Reimplemented in BrushAttrItem, and VarWidthItem. Definition at line 1042 of file sgline.cpp. 01043 { 01044 return TRUE; 01045 }
|
|
Definition at line 501 of file sgline.cpp. 00503 { 00504 // Make a copy of the given bounding box rectangle so that we can adjust it later 00505 // if we render some text within it. 00506 DocRect drLineBounds(drBounds); 00507 00508 // Next, render the text description of this item, if necessary. 00509 if (eTextPos != NO_LABEL) 00510 { 00511 // We must adjust the bounding box of the line to account for the text rendered 00512 // into it. Items display their text on the left of the rendered attribute. 00513 DocRect drTextBounds(drLineBounds); 00514 switch (eTextPos) 00515 { 00516 case BELOW: 00517 { 00518 // Divide the bounds horizontally, text below. 00519 drTextBounds.hi.y = drTextBounds.lo.y + c_nVertSizeOfText; 00520 drLineBounds.lo.y = drTextBounds.hi.y + c_nVertGapAboveText; 00521 00522 // Centre the text bounds. As there is no "GetTextExtent" function for 00523 // "system text" we have the obligatory bodge . . . 00524 // MILLIPOINT nTextLen = (GetDescription().Length() + 1) * c_nAveCharWidth; 00525 DocRect TextBounds; 00526 String_256 Desc = GetDescription(); 00527 pRegion->GetFixedSystemTextSize(&Desc, &TextBounds); 00528 MILLIPOINT nTextLen = TextBounds.Width() / 2; 00529 MILLIPOINT xMid = (drTextBounds.lo.x + drTextBounds.hi.x) / 2; 00530 drTextBounds.lo.x = xMid - nTextLen; 00531 drTextBounds.hi.x = xMid + nTextLen; 00532 break; 00533 } 00534 00535 case LEFT: 00536 // Divide the bounds vertically, text to the left. 00537 drTextBounds.hi.x = drTextBounds.lo.x + c_nHorzSizeOfText; 00538 drLineBounds.lo.x = drTextBounds.hi.x + c_nHorzGapAfterText; 00539 break; 00540 00541 default: 00542 ERROR3("Unexpected case in LineAttrItem::Render"); 00543 return; 00544 } 00545 00546 // Draw the text description of this item. Note that the foreground and 00547 // background colours have already been set by the caller. 00548 pRegion->DrawFixedSystemText((String*) &GetDescription(), drTextBounds); 00549 } 00550 00551 // Set the default line width for lines rendered within the gallery and let a 00552 // derived class set some specialised rendering attributes for its item. Then draw 00553 // the line, by default through the centre of the given bounding box. A derived 00554 // class may very occasionally need to override this as well (eg. to render join-types). 00555 pRegion->SaveContext(); 00556 pRegion->SetLineWidth(c_nDefaultLineWidth); 00557 SetAttributes(pRegion); 00558 DrawItem(pRegion, drLineBounds); 00559 pRegion->RestoreContext(); 00560 }
|
|
Implemented in BrushAttrItem, LineWidthItem, LineDashItem, LineArrowItem, LineNoArrowItem, LineCapItem, LineJoinTypeItem, StrokeTypeItem, and VarWidthItem. |
|
Changes the item's text in the gallery.
Definition at line 924 of file sgline.cpp. 00925 { 00926 if(pNewDescription != NULL) 00927 { 00928 m_strDescription = *pNewDescription; 00929 } 00930 }
|
|
Tells SGDisplayLineAttrItems whether to display themselves with a label describing themselves, or not.
Definition at line 948 of file sgline.cpp. 00949 { 00950 m_eDefaultTextPosition = eNewTextPos; 00951 }
|
|
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 in LineArrowItem. Definition at line 1020 of file sgline.cpp. 01021 { 01022 return(TRUE); 01023 }
|
|
Updates the "current attribute" status flag of every LineAttrItem within the line gallery, setting it to whether each item represents an attribute value applying to the current selection.
Definition at line 222 of file sgline.cpp. 00223 { 00224 // If the line gallery isn't running then we don't bother. 00225 if (!LineGallery::IsActive()) return TRUE; 00226 00227 // For each group in the line gallery, try to match the current attribute of the 00228 // selection with the group's items. 00229 SGDisplayRoot* pRoot = LineGallery::GetInstance()->GetDisplayTree(); 00230 if (pRoot == NULL) return FALSE; 00231 00232 for (LineAttrGroup* pGroup = (LineAttrGroup*) pRoot->GetChild(); 00233 pGroup != NULL; 00234 pGroup = (LineAttrGroup*) pGroup->GetNext()) 00235 { 00236 // Get a pointer to the first item within the group, if any. 00237 LineAttrItem* pItem = (LineAttrItem*) pGroup->GetChild(); 00238 if (pItem == NULL) continue; 00239 00240 // Get a pointer to the null-terminated array of pointers to run-time classes that 00241 // this type of item can represent. 00242 CCRuntimeClass** ppAttribClasses = pItem->GetAttribRuntimeClasses(); 00243 ERROR3IF(ppAttribClasses == NULL, 00244 "No attribute run-time classes in LineAttrItem::UpdateCurrentAttribStatus"); 00245 00246 // Count how many types of classes the item represents. Note the null statement. 00247 CCRuntimeClass** pprtc; 00248 for (pprtc = ppAttribClasses; *pprtc != NULL; pprtc++); 00249 INT32 nAttribClasses = pprtc - ppAttribClasses; 00250 00251 // Allocate an array of NodeAttribute pointers for each run-time class. 00252 typedef NodeAttribute* PATTRIBUTE; 00253 NodeAttribute** ppCommonAttribs = new PATTRIBUTE[nAttribClasses]; 00254 ERRORIF(ppCommonAttribs == NULL, _R(IDE_NOMORE_MEMORY), FALSE); 00255 00256 // For each run-time class that appears in *ppAttribClasses, try to find an 00257 // attribute of the same class that currently applies to the selection. 00258 for (INT32 i = 0; i < nAttribClasses; i++) 00259 { 00260 NodeAttribute* pattr = NULL; // sjk 00261 SelRange::CommonAttribResult eResult; 00262 00263 eResult = GetApplication()-> 00264 FindSelection()-> 00265 FindCommonAttribute(ppAttribClasses[i], &pattr); 00266 00267 // See if we found either a common attribute or the "default attribute". 00268 if (pattr != NULL) 00269 { 00270 // Check for nothing really brain-damaged happening. 00271 ERROR3IF(pattr->GetRuntimeClass() != ppAttribClasses[i], 00272 "Wrong kind of attribute in LineAttrItem::" 00273 "UpdateCurrentAttribStatus"); 00274 00275 // There is just one attribute applying, and we got it. 00276 ppCommonAttribs[i] = pattr; 00277 } 00278 else 00279 { 00280 // There are either many or none applying, so we aren't interested. 00281 ppCommonAttribs[i] = NULL; 00282 } 00283 } 00284 00285 // OK, so now we have an array of all the attributes this type of item is 00286 // interested in. Ask each item within the group to compare itself against 00287 // each attribute we have found, to see if it represents it or not. 00288 for (; pItem != NULL; pItem = (LineAttrItem*) pItem->GetNext()) 00289 { 00290 BOOL fOldState = pItem->m_fIsCurrentAttrib; 00291 pItem->m_fIsCurrentAttrib = pItem->IsEqualValueToAny(ppCommonAttribs); 00292 if (pItem->m_fIsCurrentAttrib != fOldState) pItem->ForceRedrawOfMyself(); 00293 } 00294 00295 // All done, we are finished with these kinds of attributes. 00296 delete[] ppCommonAttribs; 00297 } 00298 00299 // Everything went OK. 00300 return TRUE; 00301 }
|
|
|
|
|
|
|