#include <blndtool.h>
Inheritance diagram for BlendTool:
Public Member Functions | |
BlendTool () | |
Default Constructor. Other initialisation is done in BlendTool::Init which is called by the Tool Manager. | |
~BlendTool () | |
Destructor. | |
BOOL | Init () |
Used to check if the Tool was properly constructed. | |
void | Describe (void *InfoPtr) |
Allows the tool manager to extract information about the tool. | |
UINT32 | GetID () |
void | SelectChange (BOOL isSelected) |
Starts up and closes down the blend tool. | |
void | OnClick (DocCoord, ClickType, ClickModifiers, Spread *) |
To handle a Mouse Click event for the Blend Tool. If the click is over the central blob of a blend on a path then start a EditEnd operation, otherwise start a createblend operation. | |
void | OnMouseMove (DocCoord PointerPos, Spread *pSpread, ClickModifiers ClickMods) |
To handle a Mouse Move event for the Blend Tool. | |
void | RenderToolBlobs (Spread *pSpread, DocRect *pDocRect) |
Handles the RenderToolBlobs method. Renders the tool's blobs into the current doc view. | |
BOOL | GetStatusLineText (String_256 *ptext, Spread *, DocCoord, ClickModifiers) |
Each tool should override this function to return valid status line text. | |
BOOL | OnKeyPress (KeyPress *pKeyPress) |
To handle keypress events for the Blend Tool. | |
BOOL | EditBlendEndAndUpdateCursor (Spread *pSpread, DocCoord PointerPos) |
To determine whether or not the pointer is the central blob of an end object of a blend on a curve. If so then we change the cursor and set a flag that allows us to begin an OpEditBlendEndobject if the user clicks and drags. | |
BOOL | EditBlendEnd (Spread *pSpread, DocCoord PointerPos) |
To determine whether or not the pointer is the central blob of an end object of a blend on a curve. If so then we change the cursor and set a flag that allows us to begin an OpEditBlendEndobject if the user clicks and drags. | |
BOOL | SelectedBlendIsOnCurve () |
To find out if any selected blends are on a curve. | |
void | UpdateInfobar () |
Asks the infobar to update itself. | |
Static Public Member Functions | |
static BlendInfoBarOp * | GetBlendInfoBarOp () |
static BOOL | IsCurrent () |
Is the blend tool the current one? Call this to find out. | |
static void | DisplayStatusBarHelp (UINT32 StatusID) |
Displays the given status help string in the status bar. | |
static BlendToolRef * | GetPtrRefStart () |
static BlendToolRef * | GetPtrRefEnd () |
static void | UpdateRef (BlendToolRef *pRef, Spread *pSpread, DocCoord PointerPos, BOOL CheckNodeUnderPoint=TRUE) |
This will update the blend tool ref depending on the current pointer pos. If CheckNodeUnderPoint is TRUE, then the routine will revert to a click-detection search to find out which node lies under the given point. This is potentially very time-consuming. | |
static void | UpdateCursorAndStatus () |
This will update the cursor and status line text depending on the data in the two blend tool references within BlendTool. | |
static void | CheckNodeRemapping (BlendToolRef *pRefStart, BlendToolRef *pRefEnd) |
This checks to see if the two references actually represent a node remapping within a blend. In order to cope with multi-stage blends, both references have to be looked at the same time. | |
Private Member Functions | |
CC_DECLARE_MEMDUMP (BlendTool) | |
BOOL | CreateCursors () |
Creates all the blend tool cursors. | |
void | DestroyCursors () |
Destroys all the blend tool cursors. | |
ShapeClickEffect | DetermineClickEffect (DocCoord PointerPos, Spread *pSpread, NodeRegularShape **ReturnShape) |
BOOL | RenderSelectInsideBlobs (RenderRegion *pRender, NodeRenderableInk *pNode) |
To render blobs on selected-inside nodes whilst in the blend tool. The exact blob depends on whether or not the node is a text story. | |
Static Private Member Functions | |
static NodeRenderableInk * | FindObject (Spread *pSpread, DocCoord ClickPos) |
Looks for a (possibly grouped) node(s) in the given spread at the given mouse-click position. Convenient shorthand for the hit-testing functions. | |
static BOOL | IsPointOverPathBlob (DocCoord *pPointerPos, BlendToolRef *pRef) |
Scans for selected paths. If the coord is over a selected path's blob, it returns TRUE and pRef->pNode points to the path, and pRef->Index contains the element index of the blob. Also, *pPointerPos is snapped to the coord of the centre of the blob, if found. | |
static BOOL | IsPointOverBlendBlob (DocCoord *pPointerPos, BlendToolRef *pRef) |
Scans for selected blends. If the coord is over a selected blend's blob, it returns TRUE and pRef->pNode points to the path, pRef->pNodeBlend points to the blend containing the path, and *pIndex contains the element index of the blob. Also, if found, *pPointerPos = centre of blob. | |
Private Attributes | |
BOOL | m_EditEndObject |
Static Private Attributes | |
static BlendInfoBarOp * | pBlendInfoBarOp = NULL |
static Cursor * | pcNormalCursor = NULL |
static Cursor * | pcBlendableCursor = NULL |
static Cursor * | pcBlendableBlobCursor = NULL |
static Cursor * | pcBlendableRemapCursor = NULL |
static Cursor * | pcCurrentCursor = NULL |
static INT32 | CurrentCursorID = 0 |
static UINT32 | StatusID = _R(IDS_BLENDSTATUS_FINDSTART) |
static BlendToolRef * | pRefStart = NULL |
static BlendToolRef * | pRefEnd = NULL |
static TCHAR * | FamilyName = _T("Blend Tools") |
static TCHAR * | ToolName = _T("Blend Tool") |
static TCHAR * | Purpose = _T("Blend manipulation") |
static TCHAR * | Author = _T("Mark Neves") |
Definition at line 262 of file blndtool.h.
|
Default Constructor. Other initialisation is done in BlendTool::Init which is called by the Tool Manager.
Definition at line 219 of file blndtool.cpp. 00220 { 00221 pcCurrentCursor = NULL; 00222 }
|
|
Destructor.
Definition at line 234 of file blndtool.cpp. 00235 { 00236 if (pRefStart != NULL) 00237 { 00238 delete pRefStart; 00239 pRefStart = NULL; 00240 } 00241 00242 if (pRefEnd != NULL) 00243 { 00244 delete pRefEnd; 00245 pRefEnd = NULL; 00246 } 00247 }
|
|
|
|
This checks to see if the two references actually represent a node remapping within a blend. In order to cope with multi-stage blends, both references have to be looked at the same time.
Definition at line 1105 of file blndtool.cpp. 01106 { 01107 ERROR3IF(pRefStart == NULL,"pRefStart == NULL"); 01108 ERROR3IF(pRefEnd == NULL,"pRefEnd == NULL"); 01109 if (pRefStart == NULL || pRefEnd == NULL) 01110 return; 01111 01112 NodeBlend* pNodeBlend = pRefStart->pNodeBlend; 01113 01114 if (pNodeBlend == NULL || pNodeBlend != pRefEnd->pNodeBlend) 01115 return; 01116 01117 Node* pNode = pNodeBlend->FindFirstChild(); 01118 while (pNode != NULL) 01119 { 01120 if (IS_A(pNode,NodeBlender)) 01121 { 01122 NodeBlender* pNodeBlender = (NodeBlender*)pNode; 01123 01124 BOOL StartFound = pNodeBlender->IsPointOverBlob(&(pRefStart->PointerPos), 01125 &(pRefStart->pBlendPath), 01126 &(pRefStart->Index), 01127 &(pRefStart->AStartNode)); 01128 01129 BOOL EndFound = pNodeBlender->IsPointOverBlob(&(pRefEnd ->PointerPos), 01130 &(pRefEnd ->pBlendPath), 01131 &(pRefEnd ->Index), 01132 &(pRefEnd ->AStartNode)); 01133 01134 if (StartFound && EndFound && (pRefStart->AStartNode != pRefEnd->AStartNode)) 01135 { 01136 pRefStart->RemapRef = pNodeBlender->GetTag(); 01137 pRefEnd ->RemapRef = pNodeBlender->GetTag(); 01138 return; 01139 } 01140 } 01141 pNode = pNode->FindNext(); 01142 } 01143 }
|
|
Creates all the blend tool cursors.
Definition at line 451 of file blndtool.cpp. 00452 { 00453 // This tool has just been selected. Create the cursors. 00454 pcNormalCursor = new Cursor(this, _R(IDC_BLENDNORMALCURSOR)); 00455 pcBlendableCursor = new Cursor(this, _R(IDC_BLENDABLECURSOR)); 00456 pcBlendableBlobCursor = new Cursor(this, _R(IDC_BLENDABLEBLOBCURSOR)); 00457 pcBlendableRemapCursor = new Cursor(this, _R(IDC_BLENDABLEREMAPCURSOR)); 00458 00459 if ( pcNormalCursor ==NULL || !pcNormalCursor->IsValid() || 00460 pcBlendableCursor ==NULL || !pcBlendableCursor->IsValid() || 00461 pcBlendableBlobCursor ==NULL || !pcBlendableBlobCursor->IsValid() || 00462 pcBlendableRemapCursor ==NULL || !pcBlendableRemapCursor->IsValid() 00463 ) 00464 { 00465 DestroyCursors(); 00466 return FALSE; 00467 } 00468 else 00469 return TRUE; 00470 }
|
|
Allows the tool manager to extract information about the tool.
Reimplemented from Tool_v1. Definition at line 335 of file blndtool.cpp. 00336 { 00337 // Cast structure into the latest one we understand. 00338 ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr; 00339 00340 Info->InfoVersion = 1; 00341 00342 Info->InterfaceVersion = GetToolInterfaceVersion(); // You should always have this line. 00343 00344 // These are all arbitrary at present. 00345 Info->Version = 1; 00346 Info->ID = GetID(); 00347 Info->TextID = _R(IDS_BLEND_TOOL); 00348 00349 Info->Family = FamilyName; 00350 Info->Name = ToolName; 00351 Info->Purpose = Purpose; 00352 Info->Author = Author; 00353 00354 Info->BubbleID = _R(IDBBL_BLEND_TOOLBOX); 00355 }
|
|
Destroys all the blend tool cursors.
Definition at line 486 of file blndtool.cpp. 00487 { 00488 if (pcNormalCursor != NULL) delete pcNormalCursor; 00489 if (pcBlendableCursor != NULL) delete pcBlendableCursor; 00490 if (pcBlendableBlobCursor != NULL) delete pcBlendableBlobCursor; 00491 if (pcBlendableRemapCursor != NULL) delete pcBlendableRemapCursor; 00492 }
|
|
|
|
Displays the given status help string in the status bar.
Definition at line 1323 of file blndtool.cpp. 01324 { 01325 String_256 StatusMsg(""); 01326 StatusMsg.Load(StatusID); 01327 GetApplication()->UpdateStatusBarText(&StatusMsg); 01328 }
|
|
To determine whether or not the pointer is the central blob of an end object of a blend on a curve. If so then we change the cursor and set a flag that allows us to begin an OpEditBlendEndobject if the user clicks and drags.
Definition at line 731 of file blndtool.cpp. 00732 { 00733 List BlendList; 00734 // make a list of selected nodes 00735 BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE); 00736 if (ok) 00737 { 00738 ok = FALSE; 00739 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead(); 00740 while (pListItem != NULL) 00741 { 00742 00743 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode; 00744 Node* pNode = NULL; 00745 // check to see if there is a hit 00746 ok = pNodeBlend->HitOnEndDragBlob(PointerPos, &pNode); 00747 if (ok) 00748 break; 00749 pListItem = (NodeListItem*)BlendList.GetNext(pListItem); 00750 } 00751 } 00752 BlendList.DeleteAll(); 00753 00754 return ok; 00755 }
|
|
To determine whether or not the pointer is the central blob of an end object of a blend on a curve. If so then we change the cursor and set a flag that allows us to begin an OpEditBlendEndobject if the user clicks and drags.
Definition at line 675 of file blndtool.cpp. 00676 { 00677 Cursor* pcNewCursor = pcNormalCursor; 00678 00679 List BlendList; 00680 // make a list of selected nodes 00681 BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE); 00682 if (ok) 00683 { 00684 ok = FALSE; 00685 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead(); 00686 while (pListItem != NULL) 00687 { 00688 00689 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode; 00690 Node* pNode = NULL; 00691 // check to see if there is a hit 00692 ok = pNodeBlend->HitOnEndDragBlob(PointerPos, &pNode); 00693 if (ok) 00694 { 00695 pcNewCursor = pcBlendableBlobCursor; 00696 StatusID = _R(IDS_BLENDSTATUS_EDITENDS); 00697 break; 00698 } 00699 pListItem = (NodeListItem*)BlendList.GetNext(pListItem); 00700 } 00701 } 00702 BlendList.DeleteAll(); 00703 00704 if (pcCurrentCursor != pcNewCursor) 00705 { 00706 // Current cursor has changed 00707 CursorStack::GSetTop(pcNewCursor, CurrentCursorID); 00708 pcCurrentCursor = pcNewCursor; 00709 } 00710 00711 return ok; 00712 }
|
|
Looks for a (possibly grouped) node(s) in the given spread at the given mouse-click position. Convenient shorthand for the hit-testing functions.
Definition at line 1161 of file blndtool.cpp. 01162 { 01163 return NodeRenderableInk::FindCompoundAtPoint(pSpread,PointerPos,NULL); 01164 }
|
|
Definition at line 285 of file blndtool.h. 00285 { return pBlendInfoBarOp; }
|
|
Reimplemented from Tool_v1. Definition at line 274 of file blndtool.h. 00274 { return TOOLID_BLEND; };
|
|
Definition at line 290 of file blndtool.h. 00290 { return pRefEnd; }
|
|
Definition at line 289 of file blndtool.h. 00289 { return pRefStart; }
|
|
Each tool should override this function to return valid status line text.
Reimplemented from Tool_v1. Definition at line 937 of file blndtool.cpp. 00938 { 00939 *pStr = String_256(StatusID); 00940 return TRUE; 00941 }
|
|
Used to check if the Tool was properly constructed.
Reimplemented from Tool_v1. Definition at line 262 of file blndtool.cpp. 00263 { 00264 // Declare all your ops here and only succeed if all declarations succeed 00265 00266 BOOL ok = ( OpBlendNodes::Declare() && 00267 OpRemoveBlend::Declare() && 00268 OpAddBlendPath::Declare() && 00269 OpDetachBlendPath::Declare() && 00270 OpChangeBlend::Declare() && 00271 OpBlendOneToOne::Declare() && 00272 OpBlendAntialias::Declare() && 00273 OpChangeBlendSteps::Declare()); 00274 00275 if (!ok) return FALSE; 00276 00277 // We need two BlendToolRef objects 00278 BlendTool::pRefStart = new BlendToolRef; 00279 BlendTool::pRefEnd = new BlendToolRef; 00280 00281 ok = (BlendTool::pRefStart != NULL && BlendTool::pRefEnd != NULL); 00282 00283 // This section reads in the infobar definition and creates an instance of 00284 // BlendInfoBarOp. Also pBlendInfoBarOp, the ptr to the tool's infobar, is set up 00285 // after the infobar is successfully read and created. 00286 if (ok) 00287 { 00288 pBlendInfoBarOp = new BlendInfoBarOp(); 00289 ok = (pBlendInfoBarOp != NULL); 00290 #if 0 00291 CCResTextFile file; // Resource File 00292 BlendInfoBarOpCreate BarCreate; // Object that creates BlendInfoBarOp objects 00293 00294 ok = file.open(_R(IDM_BLEND_BAR), _R(IDT_INFO_BAR_RES)); // Open resource 00295 if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate); // Read and create info bar 00296 if (ok) file.close(); // Close resource 00297 00298 ENSURE(ok,"Unable to load blendbar.ini from resource\n"); 00299 00300 if (ok) 00301 { 00302 // Info bar now exists. Now get a pointer to it 00303 String_32 str = String_32(_R(IDS_BLNDTOOL_INFOBARNAME)); 00304 DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str); 00305 00306 ok = (pDialogBarOp != NULL); 00307 if (ok) ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(BlendInfoBarOp)); 00308 if (ok) pBlendInfoBarOp = (BlendInfoBarOp*)pDialogBarOp; 00309 00310 ENSURE(ok,"Error finding the blend tool info bar"); 00311 } 00312 #endif 00313 } 00314 00315 return (ok); 00316 }
|
|
Is the blend tool the current one? Call this to find out.
Definition at line 1344 of file blndtool.cpp. 01345 { 01346 return (Tool::GetCurrentID() == TOOLID_BLEND); 01347 }
|
|
Scans for selected blends. If the coord is over a selected blend's blob, it returns TRUE and pRef->pNode points to the path, pRef->pNodeBlend points to the blend containing the path, and *pIndex contains the element index of the blob. Also, if found, *pPointerPos = centre of blob.
Definition at line 1045 of file blndtool.cpp. 01046 { 01047 if (pRef == NULL) return FALSE; 01048 01049 // Find the selected range of objects 01050 SelRange* pSelRange = GetApplication()->FindSelection(); 01051 Node* pNode = pSelRange->FindFirst(); 01052 01053 BOOL BlobFound = FALSE; 01054 01055 // Scan the selection for NodePath objects 01056 while (pNode != NULL && !BlobFound) 01057 { 01058 if (pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBlend)) 01059 { 01060 NodeBlend* pNodeBlend = (NodeBlend*)pNode; 01061 01062 if (pNodeBlend->GetUnionBlobBoundingRect().ContainsCoord(*pPointerPos)) 01063 { 01064 BlobFound = pNodeBlend->IsPointOverBlob(pPointerPos, 01065 &(pRef->pBlendPath), 01066 &(pRef->Index), 01067 &(pRef->AStartNode), 01068 &(pRef->RemapRef)); 01069 01070 if (BlobFound) 01071 { 01072 pRef->pNode = pNodeBlend; 01073 pRef->pNodeBlend = pNodeBlend; 01074 // *pPointerPos = pRef->pBlendPath->GetPathCoord(pRef->Index); 01075 } 01076 } 01077 } 01078 01079 // Now find the next selected node 01080 pNode = pSelRange->FindNext(pNode); 01081 } 01082 01083 return BlobFound; 01084 }
|
|
Scans for selected paths. If the coord is over a selected path's blob, it returns TRUE and pRef->pNode points to the path, and pRef->Index contains the element index of the blob. Also, *pPointerPos is snapped to the coord of the centre of the blob, if found.
Definition at line 984 of file blndtool.cpp. 00985 { 00986 if (pRef == NULL) return FALSE; 00987 00988 // Find the selected range of objects 00989 SelRange* pSelRange = GetApplication()->FindSelection(); 00990 Node* pNode = pSelRange->FindFirst(); 00991 00992 BOOL BlobFound = FALSE; 00993 00994 // Scan the selection for NodePath objects 00995 while (!BlobFound && pNode != NULL && pNode->FindParent() != NULL) 00996 { 00997 // Only look at selected NodePaths that are NOT selected inside another node. 00998 if (IS_A(pNode,NodePath) && IS_A(pNode->FindParent(),Layer)) 00999 { 01000 NodePath* pNodePath = (NodePath*)pNode; 01001 01002 if (pNodePath->GetUnionBlobBoundingRect().ContainsCoord(*pPointerPos)) 01003 { 01004 // Get a pointer to the Path object within the NodePath 01005 Path* pPath = &(pNodePath->InkPath); 01006 01007 // Is it over a blob? (Only check end points. Forget about control points) 01008 BlobFound = pPath->FindNearestPoint(*pPointerPos,POINTFLAG_ENDPOINTS,&(pRef->Index)); 01009 01010 // If a blob is found, store ptr to the node 01011 if (BlobFound) 01012 { 01013 pRef->pNode = pNodePath; 01014 pPath->SetPathPosition(pRef->Index); 01015 *pPointerPos = pPath->GetCoord(); 01016 } 01017 } 01018 } 01019 01020 // Now find the next selected node 01021 pNode = pSelRange->FindNext(pNode); 01022 } 01023 01024 return BlobFound; 01025 }
|
|
To handle a Mouse Click event for the Blend Tool. If the click is over the central blob of a blend on a path then start a EditEnd operation, otherwise start a createblend operation.
Reimplemented from DragTool. Definition at line 581 of file blndtool.cpp. 00583 { 00584 if (ClickMods.Menu) return; // Don't do anything if the user clicked the Menu button 00585 00586 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL")); 00587 00588 if (Click == CLICKTYPE_DRAG) 00589 { 00590 // are we over the middle blob of a blend on a curve? 00591 BOOL MoveEndObject = EditBlendEnd(pSpread, PointerPos); 00592 00593 // Diccon 9/99, do we wish to create a blend or move an object? 00594 if (!MoveEndObject) // create a blend 00595 { 00596 UpdateRef(pRefStart,pSpread,PointerPos); 00597 UpdateRef(pRefEnd ,pSpread,PointerPos); 00598 CheckNodeRemapping(pRefStart,pRefEnd); 00599 UpdateCursorAndStatus(); 00600 00601 if (pRefStart->pNode != NULL) 00602 { 00603 // Start a drag 00604 OpBlendNodes* pOpBlendNodes = new OpBlendNodes; 00605 if (pOpBlendNodes != NULL) 00606 { 00607 // Start the drag operation and pass in the Anchor Point to the push operation 00608 if (!pOpBlendNodes->DoDrag(this)) 00609 delete pOpBlendNodes; 00610 } 00611 } 00612 } 00613 else // drag end object 00614 { 00615 OpEditBlendEndObject* pEditEnd = new OpEditBlendEndObject(this); 00616 00617 if (pEditEnd != NULL) 00618 { 00619 StatusID = _R(IDS_BLENDSTATUS_MOVEEND); 00620 DisplayStatusBarHelp(StatusID); 00621 pEditEnd->DoDrag(PointerPos, pSpread); 00622 } 00623 } 00624 } 00625 00626 // call the base class .... 00627 00628 DragTool::OnClick (PointerPos, Click, ClickMods, pSpread); 00629 }
|
|
To handle keypress events for the Blend Tool.
Reimplemented from Tool_v1. Definition at line 506 of file blndtool.cpp. 00507 { 00508 #if defined(_DEBUG) && 0 00509 if (pKeyPress == NULL) 00510 return FALSE; 00511 00512 if (pKeyPress->IsRepeat()) 00513 return FALSE; 00514 00515 if (pKeyPress->IsRelease()) 00516 return FALSE; 00517 00518 AFp BiasDelta = 0.0; 00519 AFp GainDelta = 0.0; 00520 BOOL Reset = FALSE; 00521 if (*pKeyPress == KeyPress(CAMKEY(Z))) { BiasDelta = -0.1; TRACEUSER( "Markn", _T("Decrease Bias by 0.1\n"));} 00522 if (*pKeyPress == KeyPress(CAMKEY(X))) { BiasDelta = 0.1; TRACEUSER( "Markn", _T("Increase Bias by 0.1\n"));} 00523 if (*pKeyPress == KeyPress(CAMKEY(N))) { GainDelta = -0.1; TRACEUSER( "Markn", _T("Decrease Gain by 0.1\n"));} 00524 if (*pKeyPress == KeyPress(CAMKEY(M))) { GainDelta = 0.1; TRACEUSER( "Markn", _T("Increase Gain by 0.1\n"));} 00525 00526 if (*pKeyPress == KeyPress(CAMKEY(R))) { Reset = TRUE; TRACEUSER( "Markn", _T("Resetting Bias and Gain\n"));} 00527 00528 SelRange* pSelRange = GetApplication()->FindSelection(); 00529 Node* pNode = pSelRange->FindFirst(); 00530 while (pNode) 00531 { 00532 if (IS_A(pNode,NodeBlend)) 00533 { 00534 NodeBlend* pNodeBlend = (NodeBlend*)pNode; 00535 00536 // This alters the Attribute profile, but can easily be modified to alter the Object profile if necessary 00537 CProfileBiasGain* pProfile = pNodeBlend->GetAttrProfile(); 00538 if (pProfile) 00539 { 00540 AFp Bias = pProfile->GetBias() + BiasDelta; 00541 AFp Gain = pProfile->GetGain() + GainDelta; 00542 if (Reset) 00543 Bias = Gain = 0.0; 00544 00545 if (Bias < -0.9) Bias = -0.9; 00546 if (Bias > 0.9) Bias = 0.9; 00547 if (Gain < -0.9) Gain = -0.9; 00548 if (Gain > 0.9) Gain = 0.9; 00549 00550 pProfile->SetBiasGain(Bias,Gain); 00551 } 00552 } 00553 // Now find the next selected node 00554 pNode = pSelRange->FindNext(pNode); 00555 } 00556 #endif // _DEBUG 00557 00558 return FALSE; 00559 }
|
|
To handle a Mouse Move event for the Blend Tool.
Reimplemented from Tool_v1. Definition at line 645 of file blndtool.cpp. 00646 { 00647 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL")); 00648 00649 pRefEnd->Reset(); 00650 UpdateRef(pRefStart,pSpread,PointerPos,FALSE); 00651 // Diccon added - check first to see if there is a hit on an edit end blob 00652 m_EditEndObject = EditBlendEndAndUpdateCursor(pSpread, PointerPos); 00653 // if not then check for new blend/remapping etc. 00654 if (m_EditEndObject == FALSE) 00655 UpdateCursorAndStatus(); 00656 }
|
|
To render blobs on selected-inside nodes whilst in the blend tool. The exact blob depends on whether or not the node is a text story.
Definition at line 1251 of file blndtool.cpp. 01252 { 01253 // some checks 01254 if (pRender == NULL) 01255 { 01256 ERROR3("No render region"); 01257 return FALSE; 01258 } 01259 01260 if (pNode == NULL) 01261 { 01262 ERROR3("node is NULL"); 01263 return FALSE; 01264 } 01265 01266 01267 // if the node is a text node we want a red blob, otherwise a black cross 01268 if (pNode->IsABaseTextClass()) 01269 { 01270 pRender->SetLineColour(COLOUR_BEZIERBLOB); 01271 pRender->SetFillColour(COLOUR_BEZIERBLOB); 01272 } 01273 else 01274 { 01275 pRender->SetLineColour(COLOUR_UNSELECTEDBLOB); 01276 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 01277 } 01278 01279 // Draw a blob at the centre point 01280 DocRect BlobSize; 01281 BlobManager* pBlobMgr = GetApplication()->GetBlobManager(); 01282 if (pBlobMgr != NULL) 01283 { 01284 DocRect BoundingRect = ((NodeRenderableBounded*)pNode)->GetBoundingRect(); 01285 DocCoord Point = BoundingRect.Centre(); 01286 pBlobMgr->GetBlobRect(Point, &BlobSize); 01287 01288 if (pNode->IsABaseTextClass()) 01289 { 01290 pRender->DrawBlob(Point, BT_UNSELECTED); 01291 } 01292 else 01293 { 01294 pRender->DrawLine(DocCoord(BlobSize.hi.x, BlobSize.hi.y), DocCoord(BlobSize.lo.x, BlobSize.lo.y)); 01295 pRender->DrawLine(DocCoord(BlobSize.lo.x, BlobSize.hi.y), DocCoord(BlobSize.hi.x, BlobSize.lo.y)); 01296 pRender->DrawPixel(DocCoord(BlobSize.hi.x, BlobSize.lo.y)); 01297 pRender->DrawPixel(DocCoord(BlobSize.lo.x, BlobSize.lo.y)); 01298 } 01299 return TRUE; 01300 } 01301 01302 ERROR3("Couldn't get BlobManager"); 01303 return FALSE; 01304 }
|
|
Handles the RenderToolBlobs method. Renders the tool's blobs into the current doc view.
Reimplemented from Tool_v1. Definition at line 1182 of file blndtool.cpp. 01183 { 01184 // Render into the current doc view 01185 DocView* pDocView = DocView::GetCurrent(); 01186 01187 if (pDocView != NULL && pSpread != NULL) 01188 { 01189 SelRange* pSel = GetApplication()->FindSelection(); 01190 if (pSel == NULL) return; 01191 01192 List BlendList; 01193 BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE); 01194 if (ok) 01195 { 01196 // Get a render region on the spread. We need to render EORd stuff on top of the current view 01197 RenderRegion* pRender = pDocView->RenderOnTop(pDocRect,pSpread,UnclippedEOR); 01198 01199 // two possibilities here: either we have a selected blend in which case we can 01200 // collect it in the list that we compile, or we have a selected inside object which is 01201 // a member of a blend. 01202 while (pRender != NULL) 01203 { 01204 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead(); 01205 01206 while (pListItem != NULL) 01207 { 01208 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode; 01209 pNodeBlend->RenderBlendBlobs(pRender); 01210 pListItem = (NodeListItem*)BlendList.GetNext(pListItem); 01211 } 01212 01213 Node *pNode = pSel->FindFirst(); 01214 while (pNode != NULL) 01215 { 01216 Node* pParent = pNode->FindParentOfSelected(); 01217 01218 if ((pParent != NULL) && (IS_A(pParent, NodeBlend))) 01219 { 01220 RenderSelectInsideBlobs(pRender, (NodeRenderableInk*)pNode); 01221 } 01222 // get next in selection 01223 pNode = pSel->FindNext(pNode); 01224 } 01225 // get the next render region 01226 pRender = pDocView->GetNextOnTop(pDocRect); 01227 } 01228 } 01229 BlendList.DeleteAll(); 01230 } 01231 }
|
|
Starts up and closes down the blend tool.
Reimplemented from Tool_v1. Definition at line 373 of file blndtool.cpp. 00374 { 00375 if (isSelected) 00376 { 00377 if (!CreateCursors()) return; 00378 CurrentCursorID = CursorStack::GPush(pcNormalCursor, FALSE); // Push cursor but don't display now 00379 pcCurrentCursor = pcNormalCursor; 00380 00381 // Create and display the tool's info bar 00382 pBlendInfoBarOp->Create(); 00383 m_EditEndObject = FALSE; 00384 // Which blobs do I want displayed 00385 BlobManager* BlobMgr = GetApplication()->GetBlobManager(); 00386 if (BlobMgr != NULL) 00387 { 00388 // Decide which blobs we will display 00389 BlobStyle MyBlobs; 00390 00391 MyBlobs.Object = TRUE; 00392 MyBlobs.Tiny = FALSE; 00393 00394 BlobMgr->ToolInterest(MyBlobs); 00395 } 00396 00397 Document* pDoc = Document::GetCurrent(); 00398 if (pDoc != NULL) 00399 BlobMgr->RenderToolBlobsOn(this, pDoc->GetSelectedSpread(),NULL); 00400 } 00401 else 00402 { 00403 // Deselection - destroy the tool's cursors, if they exist. 00404 if (pcCurrentCursor != NULL) 00405 { 00406 CursorStack::GPop(CurrentCursorID); 00407 pcCurrentCursor = NULL; 00408 CurrentCursorID = 0; 00409 } 00410 DestroyCursors(); 00411 00412 // we need to close down any profile dialogs that are currently open .... 00413 pBlendInfoBarOp->CloseProfileDialog (pBlendInfoBarOp->m_BiasGainGadgetPosition); 00414 pBlendInfoBarOp->CloseProfileDialog (pBlendInfoBarOp->m_BiasGainGadgetAttribute); 00415 00416 // BEFORE we do the next call !!!! Cause otherwise pBlendInfoBarOp will 00417 // have been "deleted", and the above will access violate! 00418 00419 // ensure any tool object blobs are removed. 00420 BlobManager* BlobMgr = GetApplication()->GetBlobManager(); 00421 if (BlobMgr != NULL) 00422 { 00423 BlobStyle bsRemoves; 00424 bsRemoves.ToolObject = TRUE; 00425 BlobMgr->RemoveInterest(bsRemoves); 00426 } 00427 00428 // Remove the info bar from view by deleting the actual underlying window 00429 pBlendInfoBarOp->Delete(); 00430 00431 Document* pDoc = Document::GetCurrent(); 00432 if (pDoc != NULL) 00433 BlobMgr->RenderToolBlobsOff(this, pDoc->GetSelectedSpread(),NULL); 00434 } 00435 }
|
|
To find out if any selected blends are on a curve.
Definition at line 1365 of file blndtool.cpp. 01366 { 01367 List BlendList; 01368 01369 BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE); 01370 if (ok) 01371 { 01372 NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead(); 01373 while (pListItem != NULL) 01374 { 01375 NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode; 01376 // Node* pNode = NULL; 01377 if (pNodeBlend->IsOnACurve()) 01378 { 01379 BlendList.DeleteAll(); 01380 return TRUE; 01381 } 01382 01383 pListItem = (NodeListItem*)BlendList.GetNext(pListItem); 01384 } 01385 } 01386 BlendList.DeleteAll(); 01387 return FALSE; 01388 }
|
|
This will update the cursor and status line text depending on the data in the two blend tool references within BlendTool.
Definition at line 849 of file blndtool.cpp. 00850 { 00851 ERROR3IF_PF(pRefStart==NULL,("pRefStart is NULL")); 00852 ERROR3IF_PF(pRefEnd ==NULL,("pRefEnd is NULL")); 00853 00854 // Default to standard pointer and status line text 00855 Cursor* pcNewCursor = pcNormalCursor; 00856 StatusID = _R(IDS_BLENDSTATUS_FINDSTART); // StatusID is a member var 00857 00858 if (pRefStart->RemapRef > 0) 00859 { 00860 // The pointer is either over a blend blob, or user started a drag over a blend blob 00861 pcNewCursor = pcBlendableBlobCursor; 00862 StatusID = _R(IDS_BLENDSTATUS_REMAPSTART); 00863 00864 if (pRefStart->RemapRef == pRefEnd->RemapRef && pRefStart->AStartNode != pRefEnd->AStartNode) 00865 { 00866 // Dragged to a corresponding blob in the other blend 00867 StatusID = _R(IDS_BLENDSTATUS_REMAPEND); 00868 pcNewCursor = pcBlendableRemapCursor; 00869 } 00870 } 00871 else if (pRefStart->pNode != NULL) 00872 { 00873 if (pRefEnd->pSpread == NULL) 00874 { 00875 if (pRefStart->Index >= 0) 00876 { 00877 // We are over a blob of a selected path 00878 pcNewCursor = pcBlendableBlobCursor; 00879 StatusID = _R(IDS_BLENDSTATUS_OVERBLOB); 00880 } 00881 else 00882 { 00883 // We are over a blendable node 00884 pcNewCursor = pcBlendableCursor; 00885 StatusID = _R(IDS_BLENDSTATUS_FINDEND); 00886 } 00887 } 00888 else if (pRefStart->pSpread == pRefEnd->pSpread) 00889 { 00890 // Dragging, and start and end are in the same spread 00891 if (pRefStart->pNode != pRefEnd->pNode && pRefEnd->pNode != NULL) 00892 { 00893 StatusID = _R(IDS_BLENDSTATUS_OVEREND); 00894 00895 if (pRefEnd->Index >= 0 && pRefStart->Index >= 0) 00896 // We are over a blob of a selected path, for both start & end objects 00897 // so display the remap cursor 00898 pcNewCursor = pcBlendableRemapCursor; 00899 else 00900 // We are over a blendable node 00901 pcNewCursor = pcBlendableCursor; 00902 } 00903 else 00904 StatusID = _R(IDS_BLENDSTATUS_FINDEND); 00905 } 00906 } 00907 00908 if (pcCurrentCursor != pcNewCursor) 00909 { 00910 // Current cursor has changed 00911 CursorStack::GSetTop(pcNewCursor, CurrentCursorID); 00912 pcCurrentCursor = pcNewCursor; 00913 } 00914 00915 // Always update the status bar text 00916 DisplayStatusBarHelp(StatusID); 00917 }
|
|
Asks the infobar to update itself.
Definition at line 958 of file blndtool.cpp. 00959 { 00960 pBlendInfoBarOp->UpdateInfoBarState(); 00961 }
|
|
This will update the blend tool ref depending on the current pointer pos. If CheckNodeUnderPoint is TRUE, then the routine will revert to a click-detection search to find out which node lies under the given point. This is potentially very time-consuming.
Definition at line 780 of file blndtool.cpp. 00781 { 00782 ERROR3IF_PF(pRef ==NULL,("pRef is NULL")); 00783 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL")); 00784 00785 // Reset the reference 00786 pRef->Reset(); 00787 00788 // See if point is over a blob of a selected path 00789 // if IsPointOverPathBlob() fails, it inits pNode to NULL and Index to -1 00790 if (!IsPointOverPathBlob(&PointerPos,pRef)) 00791 { 00792 // Reset the reference in case above call altered it 00793 pRef->Reset(); 00794 00795 // See if point is over a blob is a selected blend 00796 // if IsPointOverBlendBlob() fails, it inits pNode & pNodeBlend to NULL and Index to -1 00797 if (!IsPointOverBlendBlob(&PointerPos,pRef)) 00798 { 00799 // Reset the reference in case above call altered it 00800 pRef->Reset(); 00801 00802 if (CheckNodeUnderPoint) 00803 { 00804 // See if we are over an object 00805 NodeRenderableInk* pNodeUnderPoint = FindObject(pSpread,PointerPos); 00806 00807 if (pNodeUnderPoint != NULL) 00808 { 00809 BecomeA TestBecomeA(BECOMEA_TEST, CC_RUNTIME_CLASS(NodePath)); 00810 // We are over an object. Can we blend it? 00811 if (pNodeUnderPoint->CanBecomeA(&TestBecomeA)) 00812 { 00813 // We are over a NodePath or a node that can become a NodePath 00814 pRef->pNode = pNodeUnderPoint; 00815 } 00816 } 00817 } 00818 } 00819 } 00820 00821 // Set the spread and pointer pos members 00822 pRef->pSpread = pSpread; 00823 pRef->PointerPos = PointerPos; 00824 }
|
|
Reimplemented from DragTool. Definition at line 344 of file blndtool.h. |
|
Definition at line 331 of file blndtool.h. |
|
Reimplemented from DragTool. Definition at line 341 of file blndtool.h. |
|
Definition at line 322 of file blndtool.h. |
|
Definition at line 320 of file blndtool.h. |
|
Definition at line 327 of file blndtool.h. |
|
Definition at line 326 of file blndtool.h. |
|
Definition at line 328 of file blndtool.h. |
|
Definition at line 330 of file blndtool.h. |
|
Definition at line 325 of file blndtool.h. |
|
Definition at line 338 of file blndtool.h. |
|
Definition at line 337 of file blndtool.h. |
|
Reimplemented from DragTool. Definition at line 343 of file blndtool.h. |
|
Definition at line 334 of file blndtool.h. |
|
Reimplemented from DragTool. Definition at line 342 of file blndtool.h. |