#include <cntrtool.h>
Inheritance diagram for OpContourNodes:
Public Member Functions | |
OpContourNodes () | |
Constructor. | |
~OpContourNodes () | |
Destructor. | |
BOOL | DoDrag (ContourTool *pTool, ContourInfoBarOp *pOp, DocCoord &PointerPos, BOOL bDragOnBlob, DocRect *pBlobRect=NULL) |
This starts a drag that may lead to a contour. The DragFinished() method will do the hard work of contouring if it can be done. | |
virtual BOOL | SnappingDrag () |
virtual void | DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL bSolidDrag) |
Pure virtual function which tells the operation that the mouse has moved. | |
virtual void | DragFinished (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL Success, BOOL bSolidDrag) |
Ends the drag. Either creates a new grid or resizes GridClicked depending on the state of affairs when the drag started. | |
BOOL | SetupDragInfo () |
Sets up the drag information necessary to render the drag blobs. | |
void | RenderDragBlobs (INT32 Width, Spread *pSpread, BOOL bKeepDirections=FALSE) |
void | RenderDragBlobs (DocRect Rect, Spread *pSpread, BOOL bSolidDrag) |
Draws an EORed rectangle defined by AnchorPoint and DragPoint. | |
void | GetOpName (String_256 *OpName) |
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies. | |
Static Public Member Functions | |
static BOOL | Declare () |
Adds the operation to the list of all known operations. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
Find out the state of the operation at the specific time. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpContourNodes) | |
BOOL | NodeCanBeDragContoured (Node *pSubNode, Node *pNode, BOOL bContourNodesExist) |
Helper function for SetupDragInfo(), which encapsulates a test for whether a node's outline should be considered when dragging contours. There are a number of rules for exactly which nodes should be considered; examine the body of this function for details. | |
void | AlterPointerPosToAccountForBlob (DocCoord *pPoint) |
Ensures that dragging back onto a blob returns you to the original contour value. | |
Private Attributes | |
ContourTool * | m_pTool |
ContourInfoBarOp * | m_pBarOp |
BOOL | m_bHasDragged |
DocCoord | m_LastPointerPos |
DocCoord | m_ThisPointerPos |
DocRect | m_BlobRect |
DocRect | m_SelRect |
Path * | m_pPathList |
UINT32 | m_NumPaths |
BOOL * | m_pPathOuterList |
AttrJoinType ** | m_pPathJoinTypeList |
JointType | m_JoinType |
UINT32 * | m_pSetList |
UINT32 | m_NumSets |
BOOL | m_bDragStartedOnBlob |
INT32 | m_Flatness |
MILLIPOINT | m_OriginalWidth |
MILLIPOINT | m_StartDragWidth |
Definition at line 136 of file cntrtool.h.
|
Constructor.
Definition at line 3276 of file cntrtool.cpp. 03277 { 03278 m_pBarOp = NULL; 03279 03280 m_bHasDragged = FALSE; 03281 03282 m_pPathList = NULL; 03283 m_NumPaths = 0; 03284 m_pSetList = NULL; 03285 m_NumSets = 0; 03286 m_pPathOuterList = NULL; 03287 m_pPathJoinTypeList = NULL; 03288 m_OriginalWidth = 0; 03289 m_StartDragWidth = 0; 03290 m_pTool = NULL; 03291 m_JoinType = MitreJoin; 03292 }
|
|
Destructor.
Definition at line 3304 of file cntrtool.cpp. 03305 { 03306 if (m_pPathList) 03307 { 03308 delete [] m_pPathList; 03309 } 03310 03311 if (m_pSetList) 03312 { 03313 delete [] m_pSetList; 03314 } 03315 03316 if (m_pPathOuterList) 03317 { 03318 delete [] m_pPathOuterList; 03319 } 03320 03321 if (m_pPathJoinTypeList) 03322 { 03323 delete [] m_pPathJoinTypeList; 03324 m_pPathJoinTypeList = NULL; 03325 } 03326 }
|
|
Ensures that dragging back onto a blob returns you to the original contour value.
Definition at line 4144 of file cntrtool.cpp. 04145 { 04146 DocCoord PPos; 04147 04148 DocCoord Offset; 04149 04150 double Scale = 0; 04151 04152 BlobManager * pBlobMgr = GetApplication()->GetBlobManager(); 04153 04154 double BlobSize = 0; 04155 04156 if (pBlobMgr) 04157 BlobSize = pBlobMgr->GetBlobSize()/2; 04158 else 04159 return; 04160 04161 if (m_BlobRect.IsValid()) 04162 { 04163 DocCoord Centre = m_BlobRect.Centre(); 04164 04165 if (m_BlobRect.ContainsCoord(*pPoint)) 04166 { 04167 04168 pPoint->x = Centre.x; 04169 pPoint->y = Centre.y; 04170 } 04171 else 04172 { 04173 // move the pointer appropriately so that the blob is always 04174 // the same value 04175 04176 // first find the point which is the intersection between the line from 04177 // the centre of the blob to the point on the outside of the blob 04178 PPos.x = pPoint->x - Centre.x; 04179 PPos.y = pPoint->y - Centre.y; 04180 04181 if (abs(PPos.x) > abs(PPos.y)) 04182 { 04183 Scale = ((double)abs(PPos.y)) / ((double)abs(PPos.x)); 04184 Scale *= BlobSize; 04185 04186 if (PPos.x > 0) 04187 { 04188 Offset.x = (INT32)BlobSize; 04189 } 04190 else 04191 { 04192 Offset.x = (INT32)-BlobSize; 04193 } 04194 04195 if (PPos.y > 0) 04196 { 04197 Offset.y = (INT32)Scale; 04198 } 04199 else 04200 { 04201 Offset.y = (INT32)-Scale; 04202 } 04203 } 04204 else 04205 { 04206 Scale = ((double)PPos.x) / ((double)PPos.y); 04207 Scale *= BlobSize; 04208 04209 if (PPos.y > 0) 04210 { 04211 Offset.y = (INT32)BlobSize; 04212 } 04213 else 04214 { 04215 Offset.y = (INT32)-BlobSize; 04216 } 04217 04218 if (PPos.x > 0) 04219 { 04220 Offset.x = (INT32)Scale; 04221 } 04222 else 04223 { 04224 Offset.x = (INT32)-Scale; 04225 } 04226 } 04227 04228 pPoint->x -= Offset.x; 04229 pPoint->y -= Offset.y; 04230 } 04231 } 04232 }
|
|
|
|
Adds the operation to the list of all known operations.
Definition at line 4413 of file cntrtool.cpp. 04414 { 04415 return (RegisterOpDescriptor( 04416 0, 04417 _R(IDS_CONTOUR_TOOL), 04418 CC_RUNTIME_CLASS(OpContourNodes), 04419 OPTOKEN_CONTOURNODES, 04420 OpContourNodes::GetState, 04421 0, /* help ID */ 04422 _R(IDBBL_NOOP), /* bubble ID */ 04423 0 /* bitmap ID */ 04424 )); 04425 }
|
|
This starts a drag that may lead to a contour. The DragFinished() method will do the hard work of contouring if it can be done.
Definition at line 3827 of file cntrtool.cpp. 03829 { 03830 // snap the pointer position 03831 DocView * pView = DocView::GetCurrent(); 03832 Spread * pSpread = Document::GetSelectedSpread(); 03833 03834 if (pView && pSpread) 03835 { 03836 pView->Snap(pSpread, &PointerPos, FALSE, TRUE); 03837 } 03838 03839 // if there's no selection then forget it ! 03840 if (!GetApplication()->FindSelection()) 03841 return FALSE; 03842 03844 // 03845 // This added by Karim MacDonald 17/12/1999, to fix a bug, whereby starting a contour 03846 // drag whilst a text char was sub-selected, then dragging with selector tool, caused 03847 // and error. 03848 // 03849 03850 // if the drag was started on a blob, ensure any text in the selection is valid for this. 03851 if (bDragOnBlob) 03852 GetApplication()->FindSelection()->MakePartialSelectionWhole(); 03853 03854 // otherwise quit - can't do this drag unless it's from a blob. 03855 else 03856 return FALSE; 03857 // 03859 03860 m_pBarOp = pBar; 03861 m_pTool = pTool; 03862 m_bHasDragged = FALSE; 03863 m_LastPointerPos = PointerPos; 03864 m_ThisPointerPos = PointerPos; 03865 03866 if (pBlobRect) 03867 m_BlobRect = *pBlobRect; 03868 else 03869 m_BlobRect = DocRect(0,0,0,0); 03870 03871 m_bDragStartedOnBlob = bDragOnBlob; 03872 03873 // decide what the start value for the drag will be 03874 List ContourList; 03875 BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController)); 03876 03877 if (ContourList.IsEmpty()) 03878 { 03879 m_OriginalWidth = 0; 03880 } 03881 else 03882 { 03883 NodeListItem * pItem = (NodeListItem *)ContourList.GetHead(); 03884 03885 m_OriginalWidth = ((NodeContourController *)(pItem->pNode))->GetWidth(); 03886 } 03887 03888 ContourList.DeleteAll(); 03889 03890 StartDrag( DRAGTYPE_AUTOSCROLL ); 03891 03892 if (bDragOnBlob) 03893 { 03894 SetupDragInfo(); 03895 03896 if (pBlobRect) 03897 { 03898 DocCoord BlobCentre(pBlobRect->Centre()); 03899 03900 // calculate the width 03901 INT32 Width = ContourTool::CalculateContourWidth(m_SelRect, 03902 BlobCentre); 03903 03904 m_StartDragWidth = Width; 03905 03906 m_LastPointerPos = BlobCentre; 03907 m_ThisPointerPos = BlobCentre; 03908 } 03909 } 03910 03911 // Tell the Dragging system that we need drags to happen 03912 return TRUE; 03913 }
|
|
Ends the drag. Either creates a new grid or resizes GridClicked depending on the state of affairs when the drag started.
Reimplemented from Operation. Definition at line 4017 of file cntrtool.cpp. 04019 { 04020 // snap the pointer position 04021 DocView * pView = DocView::GetCurrent(); 04022 04023 if (pView && pSpread) 04024 { 04025 pView->Snap(pSpread, &PointerPos, FALSE, TRUE); 04026 } 04027 04028 ContourTool * pTool = (ContourTool *)Tool::GetCurrent(); 04029 04030 // End the drag and the op 04031 // BlobManager * pBlobMgr = GetApplication()->GetBlobManager(); 04032 04033 EndDrag(); 04034 04035 // added 20/12/1999 by Karim MacDonald. 04036 // if the drag did not start on a blob, we quit now. 04037 if (!m_bDragStartedOnBlob) 04038 return; 04039 04040 // calculate the contour width & set the infobar 04041 INT32 Width = (ContourTool::CalculateContourWidth(m_SelRect, PointerPos) - m_StartDragWidth) 04042 + m_OriginalWidth; 04043 04044 // if we've not dragged, then do nothing 04045 if (!m_bHasDragged) 04046 return; 04047 04048 if (m_pBarOp) 04049 m_pBarOp->UpdateState(); 04050 04051 m_bHasDragged = FALSE; 04052 04053 if (!pSpread) 04054 pSpread = Document::GetSelectedSpread(); 04055 04056 // render the drag blobs off 04057 RenderDragBlobs(m_SelRect, pSpread, bSolidDrag); 04058 04059 // create the contour, or change its width 04060 if (Success) 04061 { 04062 if (pTool) 04063 { 04064 pTool->RenderToolBlobs(pSpread, NULL); 04065 pTool->SetBlobRendering(FALSE); 04066 } 04067 04068 List ContourList; 04069 BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController)); 04070 04071 if (ContourList.IsEmpty()) 04072 { 04073 // make a list of the range, and then invoke the op 04074 EffectsStack* pStack = GetApplication()->FindSelection()->GetEffectsStack(); 04075 ENSURE(pStack, "Argh!"); 04076 Range* pSelList = pStack->GetBaseLevelRange(); 04077 ENSURE(pSelList, "Argh!"); 04078 04079 Node* pNode = pSelList->FindFirst(); 04080 NodeListItem* pItem = NULL; 04081 while (pNode) 04082 { 04083 pItem = new NodeListItem(pNode); 04084 ContourList.AddTail(pItem); 04085 04086 pNode = pSelList->FindNext(pNode); 04087 } 04088 04089 CreateContourParam Param(&ContourList, 3, Width, m_pBarOp->GetInsetPathFlag()); 04090 04091 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CREATECONTOUR); 04092 04093 if (pOpDesc) 04094 pOpDesc->Invoke(&Param); 04095 04096 ContourList.DeleteAll(); 04097 delete pSelList; 04098 } 04099 else 04100 { 04101 ChangeContourWidthParam Param(&ContourList, Width, FALSE); 04102 04103 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOURWIDTH); 04104 04105 if (pOpDesc) 04106 pOpDesc->Invoke(&Param); 04107 04108 ContourList.DeleteAll(); 04109 } 04110 04111 // put the tool blobs back on 04112 if (pTool) 04113 { 04114 pTool->SetBlobRendering(TRUE); 04115 pTool->SetupToolBlobs(); 04116 pTool->RenderToolBlobs(pSpread, NULL); 04117 } 04118 } 04119 04120 delete [] m_pPathList; 04121 m_pPathList = NULL; 04122 04123 delete [] m_pSetList; 04124 m_pSetList = NULL; 04125 04126 delete [] m_pPathOuterList; 04127 m_pPathOuterList = NULL; 04128 04129 delete [] m_pPathJoinTypeList; 04130 m_pPathJoinTypeList = NULL; 04131 }
|
|
Pure virtual function which tells the operation that the mouse has moved. virtual void Operation::DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag)
Reimplemented from Operation. Definition at line 3933 of file cntrtool.cpp. 03935 { 03936 ERROR3IF(!m_pBarOp, "No info bar op"); 03937 03938 // snap the pointer position 03939 DocView *pView = DocView::GetCurrent(); 03940 03941 if (pView && pSpread) 03942 { 03943 pView->Snap(pSpread, &PointerPos, FALSE, TRUE); 03944 } 03945 /* 03946 // check the pointer pos for it being over the blob 03947 AlterPointerPosToAccountForBlob(&PointerPos); 03948 */ 03949 if (PointerPos == m_LastPointerPos) 03950 { 03951 return; 03952 } 03953 03954 if (!m_bDragStartedOnBlob) 03955 { 03956 m_bHasDragged = TRUE; 03957 return; 03958 } 03959 03960 // render the drag blobs off first 03961 if (m_bHasDragged) 03962 RenderDragBlobs(m_SelRect, pSpread, bSolidDrag); 03963 03964 m_bHasDragged = TRUE; 03965 03966 m_LastPointerPos = PointerPos; 03967 m_ThisPointerPos = PointerPos; 03968 03969 ContourTool::DisplayStatusBarHelp(_R(IDS_CONTOURDRAGHELP)); 03970 03971 INT32 Width = (ContourTool::CalculateContourWidth(m_SelRect, PointerPos) - m_StartDragWidth) 03972 + m_OriginalWidth; 03973 03974 RenderDragBlobs(Width, pSpread); 03975 03976 if (Width < 0) 03977 { 03978 // outer contour 03979 m_pBarOp->SetBoolGadgetSelected(_R(IDC_BTN_CONTOUROUTER), TRUE); 03980 m_pBarOp->SetBoolGadgetSelected(_R(IDC_BTN_CONTOURINNER), FALSE); 03981 } 03982 else 03983 { 03984 // inner contour 03985 m_pBarOp->SetBoolGadgetSelected(_R(IDC_BTN_CONTOUROUTER), FALSE); 03986 m_pBarOp->SetBoolGadgetSelected(_R(IDC_BTN_CONTOURINNER), TRUE); 03987 } 03988 03989 m_pBarOp->PaintGadgetNow(_R(IDC_BTN_CONTOURINNER)); 03990 m_pBarOp->PaintGadgetNow(_R(IDC_BTN_CONTOUROUTER)); 03991 03992 m_pBarOp->SetSliderValue(abs(Width), FALSE); 03993 }
|
|
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
Reimplemented from Operation. Definition at line 4465 of file cntrtool.cpp. 04466 { 04467 *OpName = String_256(_R(IDS_CREATECONTOUROP)); 04468 }
|
|
Find out the state of the operation at the specific time.
Definition at line 4442 of file cntrtool.cpp. 04443 { 04444 OpState State; 04445 04446 return State; 04447 }
|
|
Helper function for SetupDragInfo(), which encapsulates a test for whether a node's outline should be considered when dragging contours. There are a number of rules for exactly which nodes should be considered; examine the body of this function for details.
Definition at line 3743 of file cntrtool.cpp. 03746 { 03747 // subnode must not require a parent node to exist. 03748 BOOL ok = !pSubNode->NeedsParent(NULL); 03749 03750 // subnode must be a NodeRenderableInk. 03751 if (ok) ok = pSubNode->IsAnObject(); 03752 03753 // subnode must not be any compound node other than the exceptions listed here. 03754 if (ok) ok = !pSubNode->IsCompound() || pSubNode->IsABaseTextClass() || 03755 pSubNode->IS_KIND_OF(NodeMould) || pSubNode->IsANodeClipViewController(); 03756 03757 // subnode must not reside within a NodeMould. 03758 if (ok) ok = (pSubNode->FindParent(CC_RUNTIME_CLASS(NodeMould)) == NULL); 03759 03760 // ClipView tests. 03761 if (ok) 03762 { 03763 // if contours do exist, then subnode must not reside within a ClipView group 03764 // which has, or whose parents have, a contour currently applied, and which is, 03765 // or lies beneath, the contour's object node. 03766 if (bContourNodesExist) 03767 { 03768 Node* pNCC = pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)); 03769 if (pNCC != NULL) 03770 { 03771 Node* pNodeTest = pNCC; 03772 while (pNodeTest != pNode && pNodeTest != NULL) 03773 pNodeTest = pNodeTest->FindParent(); 03774 if (pNodeTest != NULL) 03775 { 03776 // pNCC is, or is a child of, pNode. 03777 // now we just need to find out whether pSubNode and pNCC 03778 // have a NCVC in between. 03779 ok = !pSubNode->IsFamily(CC_RUNTIME_CLASS(NodeClipViewController), pNCC); 03780 } 03781 } 03782 } 03783 03784 // if no contours exist yet, then subnode must not reside within a ClipView group 03785 // which either is, or lies beneath, the contour's object node. 03786 else 03787 ok = !pSubNode->IsFamily(CC_RUNTIME_CLASS(NodeClipViewController), pNode); 03788 } 03789 03790 return ok; 03791 03792 /* 03793 * This comment holds the unexpanded version of the above tests, 03794 * apart from the ClipView test for when contours do exist. 03795 * 03796 return !pSubNode->NeedsParent(NULL) && 03797 (!pSubNode->IsCompound() || pSubNode->IsABaseTextClass() || 03798 pSubNode->IS_KIND_OF(NodeMould) || pSubNode->IsANodeClipViewController()) && 03799 pSubNode->IsAnObject() && 03800 pSubNode->FindParent(CC_RUNTIME_CLASS(NodeMould)) == NULL && 03801 (bContourNodesExist || 03802 !pSubNode->IsFamily(CC_RUNTIME_CLASS(NodeClipViewController), pNode)) 03803 ; 03804 */ 03805 }
|
|
Draws an EORed rectangle defined by AnchorPoint and DragPoint.
Reimplemented from Operation. Definition at line 4388 of file cntrtool.cpp. 04389 { 04390 if (m_pPathList == NULL || m_NumPaths == 0) 04391 { 04392 return; 04393 } 04394 04395 // set up the bounds 04396 INT32 Width = (ContourTool::CalculateContourWidth(m_SelRect, m_ThisPointerPos) - m_StartDragWidth) 04397 + m_OriginalWidth; 04398 04399 RenderDragBlobs(Width, pSpread); 04400 }
|
|
|
|
Sets up the drag information necessary to render the drag blobs.
Definition at line 3340 of file cntrtool.cpp. 03341 { 03342 Range Sel((*GetApplication()->FindSelection())); 03343 03344 if (Sel.IsEmpty()) 03345 return FALSE; 03346 03347 RangeControl rg = Sel.GetRangeControlFlags(); 03348 rg.PromoteToParent = TRUE; 03349 Sel.SetRangeControl(rg); 03350 03351 // go through all nodes getting their inside bounding rects, and 03352 // building up the summed path 03353 CProfileBiasGain Profile; 03354 03355 // find out how many paths we require 03356 03357 Node * pNode = Sel.FindFirst(); 03358 03359 DocRect dr(0,0,0,0); 03360 03361 // how many paths do we need ? 03362 m_NumPaths = 0; 03363 03364 Node * pSubNode = NULL; 03365 03366 // don't do needs parent nodes !!! 03367 // therefore, recurse through the subtree of every node in the selection 03368 // calling their can become a's individually 03369 m_NumSets = 0; 03370 03371 // do we have any contour controller nodes in the selection ? if so, 03372 // we need to set a flag to tell ourselves to ignore all nodes which aren't contoured 03373 BOOL bContourNodesExist = FALSE; 03374 03375 List ContourNodeList; 03376 BevelTools::BuildListOfSelectedNodes(&ContourNodeList, 03377 CC_RUNTIME_CLASS(NodeContourController), 03378 TRUE); 03379 03380 if (!ContourNodeList.IsEmpty()) 03381 { 03382 bContourNodesExist = TRUE; 03383 } 03384 03385 // do the flatness 03386 // get the current view's zoom factor 03387 DocView * pView = DocView::GetCurrent(); 03388 03389 double ZoomFactor = 1; 03390 03391 BecomeA TestBecomeA(BECOMEA_TEST, CC_RUNTIME_CLASS(NodePath)); 03392 TestBecomeA.ResetCount(); 03393 03394 if (pView) 03395 { 03396 ZoomFactor = 03397 pView->GetScaledPixelWidth().MakeDouble() / pView->GetPixelWidth().MakeDouble(); 03398 } 03399 03400 // alter the flatness appropriately 03401 double dFlat = ContourToolFlatness; 03402 03403 if (ZoomFactor < 1.0) 03404 m_Flatness = (INT32)(dFlat * ZoomFactor); 03405 else 03406 m_Flatness = ContourToolFlatness; 03407 03408 ContourNodeList.DeleteAll(); 03409 03410 Node* pLastController = NULL; 03411 Node* pParentController = NULL; 03412 03413 // we do a depth first search of the selection, calling DoBecomeA on the appropriate nodes 03414 // we do this because 03415 // a) we need to neglect all 'needs parent' nodes, which means calling doBecomeA on 03416 // just the top level selected nodes is insufficient 03417 // we also count how many 'sets' we need 03418 // a set defines a range in the path list (i.e. between path 2 and path 6) of paths 03419 // which need to be merged together before rendering 03420 // in building this set, we need to take into account when the nodes switch from one 03421 // contour controller node to another, as this obviously indicates the start of a new set 03422 // if any contour controller nodes exist, then we must ignore all nodes which are in the 03423 // selection but not part of a contour node. This is because in this case, when dragging, 03424 // no new contour nodes are created - the existing ones widths are changed 03425 03426 // MRH - We need to find the default or applied join type on the contour controller! 03427 m_JoinType = MitreJoin; 03428 AttrJoinType* pJoinType = NULL; 03429 03430 while (pNode) 03431 { 03432 pSubNode = pNode->FindFirstDepthFirst(); 03433 03434 // set up the parent controller from this node 03435 if (bContourNodesExist) 03436 { 03437 pLastController = pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)); 03438 } 03439 03440 while (pSubNode) 03441 { 03442 if(IS_A(pSubNode,NodeContour)) 03443 { 03444 ((NodeRenderableInk *)pSubNode)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), (NodeAttribute **)(&pJoinType)); 03445 03446 if (pJoinType) 03447 { 03448 m_JoinType = pJoinType->Value.JoinType; 03449 } 03450 } 03451 03452 TestBecomeA.ResetCount(); 03453 if (NodeCanBeDragContoured(pSubNode, pNode, bContourNodesExist) && 03454 pSubNode->CanBecomeA(&TestBecomeA)) 03455 { 03456 if (!bContourNodesExist || 03457 pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)) != NULL) 03458 { 03459 m_NumPaths += TestBecomeA.GetCount(); 03460 } 03461 03462 // check for the number of sets needing to be increased - i.e. if 03463 // the controller node of the new node is different to the last controller 03464 if (bContourNodesExist) 03465 { 03466 pParentController = pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)); 03467 03468 if (pParentController) 03469 { 03470 if (pParentController != pLastController && 03471 pLastController != NULL) 03472 { 03473 m_NumSets ++; 03474 } 03475 03476 pLastController = pParentController; 03477 } 03478 } 03479 } 03480 03481 pSubNode = pSubNode->FindNextDepthFirst(pNode); 03482 } 03483 03484 m_NumSets ++; 03485 03486 pNode = Sel.FindNext(pNode); 03487 } 03488 03489 // increase the number of sets by 1 03490 m_NumSets++; 03491 03492 ERROR2IF(m_NumPaths == 0, FALSE, "Nothing to contour"); 03493 03494 if (m_pPathList) 03495 delete [] m_pPathList; 03496 03497 if (m_pSetList) 03498 delete [] m_pSetList; 03499 03500 if (m_pPathOuterList) 03501 delete [] m_pPathOuterList; 03502 03503 if (m_pPathJoinTypeList) 03504 delete [] m_pPathJoinTypeList; 03505 03506 ALLOC_WITH_FAIL(m_pPathList, new Path[m_NumPaths], this); 03507 03508 // each path has whether the object it came from was an inner or an outer contour 03509 // or not 03510 ALLOC_WITH_FAIL(m_pPathOuterList, new BOOL[m_NumPaths], this); 03511 ALLOC_WITH_FAIL(m_pPathJoinTypeList, new AttrJoinType*[m_NumPaths], this); 03512 UINT32 i; 03513 for (i = 0; i < m_NumPaths; i++) 03514 { 03515 m_pPathList[i].Initialise(); 03516 m_pPathOuterList[i] = TRUE; 03517 m_pPathJoinTypeList[i] = NULL; 03518 } 03519 03520 ALLOC_WITH_FAIL(m_pSetList, new UINT32[m_NumSets], this); 03521 03522 // Make sure we have a valid pOurDoc as Contouring moulds with bitmap fills go bang! 03523 pOurDoc = Document::GetCurrent(); 03524 03525 // sum all paths together in the range 03526 ContourDragBecomeA MyBecomeA(BECOMEA_PASSBACK, CC_RUNTIME_CLASS(NodePath), this, FALSE, 03527 m_pPathList, m_NumPaths); 03528 MyBecomeA.ResetCount(); 03529 03530 pNode = Sel.FindFirst(); 03531 03532 // don't do needs parent nodes !!! 03533 // therefore, recurse through the subtree of every node in the selection 03534 // calling their do become a's individually 03535 03536 NodeContourController * pControl = NULL; 03537 03538 AttrJoinType * pAttrJoin = NULL; 03539 Node * pNodePath = NULL; 03540 03541 UINT32 SetCount = 0; 03542 // UINT32 ObjectCount = 0; 03543 03544 while (pNode) 03545 { 03546 pSubNode = pNode->FindFirstDepthFirst(); 03547 03548 // set up the parent controller from this node 03549 if (bContourNodesExist) 03550 { 03551 pLastController = pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)); 03552 } 03553 03554 // start a new set 03555 m_pSetList[SetCount] = MyBecomeA.GetCount(); 03556 SetCount ++; 03557 03558 ERROR3IF(SetCount >= m_NumSets, "Number of sets doesn't match"); 03559 03560 while (pSubNode) 03561 { 03562 if (NodeCanBeDragContoured(pSubNode, pNode, bContourNodesExist) && 03563 pSubNode->CanBecomeA(&TestBecomeA)) 03564 { 03565 // check for the number of sets needing to be increased - i.e. if 03566 // the controller node of the new node is different to the last controller 03567 if (bContourNodesExist) 03568 { 03569 pParentController = pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)); 03570 03571 if (pParentController) 03572 { 03573 if (pParentController != pLastController && 03574 pLastController != NULL) 03575 { 03576 // start a new set 03577 m_pSetList[SetCount] = MyBecomeA.GetCount(); 03578 SetCount ++; 03579 } 03580 03581 pLastController = pParentController; 03582 } 03583 } 03584 03585 // do the become a 03586 if (!bContourNodesExist || 03587 pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)) != NULL) 03588 { 03589 // get the start path count 03590 UINT32 StartCount = MyBecomeA.GetCount(); 03591 03592 // find out if we have a parent contour controller node or not 03593 pControl = 03594 (NodeContourController *)pSubNode->FindParent(CC_RUNTIME_CLASS(NodeContourController)); 03595 03596 // do the become A 03597 if (!pSubNode->IsNodePath()) 03598 { 03599 pSubNode->DoBecomeA(&MyBecomeA); 03600 } 03601 else 03602 { 03603 // make the node out of the path first 03604 pNodePath = ((NodePath *)pSubNode)->MakeNodePathFromAttributes(m_Flatness); 03605 03606 pNodePath->DoBecomeA(&MyBecomeA); 03607 03608 delete pNodePath; 03609 pNodePath = NULL; 03610 } 03611 03612 // find out if my parent controller is an inner or an outer, 03613 // and store the value for each path which has just been created 03614 if (pControl) 03615 { 03616 // find the applied join type attribute for this particular series of 03617 if (pControl->GetContourNode()) 03618 { 03619 pControl->GetContourNode()->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), 03620 (NodeAttribute **)(&pAttrJoin)); 03621 } 03622 03623 for (UINT32 x = StartCount; x < MyBecomeA.GetCount(); x++) 03624 { 03625 if (pControl->GetWidth() > 0) 03626 { 03627 m_pPathOuterList[x] = FALSE; 03628 } 03629 03630 m_pPathJoinTypeList[x] = pAttrJoin; 03631 } 03632 } 03633 else 03634 { 03635 if (pSubNode->IsAnObject()) 03636 { 03637 // find the selected parent of this sub node (if one exists !) 03638 Node * pSubNodeParentStep = pSubNode->FindParent(); 03639 Node * pSubNodeParent = NULL; 03640 pAttrJoin = NULL; 03641 03642 while (pSubNodeParentStep) 03643 { 03644 if (pSubNodeParentStep->IsAnObject() && 03645 pSubNodeParentStep->IsSelected()) 03646 { 03647 pSubNodeParent = pSubNodeParentStep; 03648 } 03649 03650 pSubNodeParentStep = pSubNodeParentStep->FindParent(); 03651 } 03652 03653 if (pSubNodeParent) 03654 { 03655 ((NodeRenderableInk *)pSubNodeParent)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), 03656 (NodeAttribute **)(&pAttrJoin)); 03657 } 03658 else if (pSubNode->IsAnObject()) 03659 { 03660 ((NodeRenderableInk *)pSubNode)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), 03661 (NodeAttribute **)(&pAttrJoin)); 03662 } 03663 03664 for (UINT32 x = StartCount; x < MyBecomeA.GetCount(); x++) 03665 { 03666 m_pPathJoinTypeList[x] = pAttrJoin; 03667 } 03668 } 03669 } 03670 } 03671 } 03672 03673 pSubNode = pSubNode->FindNextDepthFirst(pNode); 03674 } 03675 03676 pNode = Sel.FindNext(pNode); 03677 } 03678 03679 // put the last set node in 03680 m_pSetList[SetCount] = MyBecomeA.GetCount(); 03681 03682 m_SelRect.lo.x = 0; 03683 m_SelRect.lo.y = 0; 03684 m_SelRect.hi.x = 0; 03685 m_SelRect.hi.y = 0; 03686 03687 INT32 BlobSize = 0; 03688 BlobManager * pBlobMgr = GetApplication()->GetBlobManager(); 03689 if (pBlobMgr) 03690 BlobSize = pBlobMgr->GetBlobSize(); 03691 03692 // calculate the rect from the paths 03693 for (i = 0 ; i < m_NumPaths; i++) 03694 { 03695 // Karim 19/04/2000 03696 // don't complain if a path has less than two coords, just ignore it. 03697 if (m_pPathList[i].GetNumCoords() < 2) 03698 { 03699 // ERROR3("Less than 2 points in path"); 03700 } 03701 else 03702 { 03703 // m_SelRect = m_SelRect.Union(m_pPathList[i].GetBoundingRect()); MRH 19/5/00 03704 m_pPathList[i].GetTrueBoundingRect(&dr); 03705 m_SelRect = m_SelRect.Union(dr); 03706 } 03707 } 03708 03709 // increase the size of the selection rect to take into account the blobs 03710 m_SelRect.Inflate(BlobSize); 03711 03712 return TRUE; 03713 }
|
|
Reimplemented from Operation. Definition at line 148 of file cntrtool.h. 00148 { return FALSE; }
|
|
Definition at line 200 of file cntrtool.h. |
|
Definition at line 177 of file cntrtool.h. |
|
Definition at line 182 of file cntrtool.h. |
|
Definition at line 203 of file cntrtool.h. |
|
Definition at line 194 of file cntrtool.h. |
|
Definition at line 178 of file cntrtool.h. |
|
Definition at line 189 of file cntrtool.h. |
|
Definition at line 198 of file cntrtool.h. |
|
Definition at line 220 of file cntrtool.h. |
|
Definition at line 175 of file cntrtool.h. |
|
Definition at line 193 of file cntrtool.h. |
|
Definition at line 188 of file cntrtool.h. |
|
Definition at line 192 of file cntrtool.h. |
|
Definition at line 197 of file cntrtool.h. |
|
Definition at line 174 of file cntrtool.h. |
|
Definition at line 185 of file cntrtool.h. |
|
Definition at line 223 of file cntrtool.h. |
|
Definition at line 179 of file cntrtool.h. |