#include <cntrtool.h>
Inheritance diagram for ContourTool:
Public Member Functions | |
ContourTool () | |
Default Constructor. Other initialisation is done in ContourTool::Init which is called by the Tool Manager. | |
~ContourTool () | |
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. | |
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 | AreToolBlobsRenderedOnSelection () |
void | SetupToolBlobs () |
Sets up the tool blobs for the current selection. | |
void | SetBlobRendering (BOOL b) |
Static Public Member Functions | |
static ContourInfoBarOp * | GetContourInfoBarOp () |
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 ContourTool. | |
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. | |
static INT32 | CalculateContourWidth (DocRect &br, DocCoord &PointerPos) |
Calculates the contour width for a given rect. | |
static INT32 | CalculateContourWidth (Node *pNode, DocCoord &PointerPos) |
Calculates the contour width for a given node given a pointer position. | |
Static Public Attributes | |
static OpContourNodes * | m_pOpContourNodes = NULL |
Private Member Functions | |
CC_DECLARE_MEMDUMP (ContourTool) | |
BOOL | CreateCursors () |
Creates all the blend tool cursors. | |
void | DestroyCursors () |
Destroys all the blend tool cursors. | |
BOOL | IsPointOverBlob (DocCoord &Point, DocRect *pBlobRect=NULL) |
Creates all the blend tool cursors. | |
void | InformWarningBevelExistsInSelection () |
Brings up the associated warning dialog. | |
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 | |
DocCoord | m_BlobPoints [8] |
BOOL | m_bDisableBlobRenderingFlag |
Static Private Attributes | |
static ContourInfoBarOp * | pContourInfoBarOp = NULL |
static Cursor * | pcNormalCursor = NULL |
static Cursor * | pcOverBlob = NULL |
static Cursor * | pcCurrentCursor = NULL |
static INT32 | CurrentCursorID = 0 |
static UINT32 | StatusID = _R(IDS_CONTOURDRAGHELP) |
static BlendToolRef * | pRefStart = NULL |
static BlendToolRef * | pRefEnd = NULL |
static TCHAR * | FamilyName = _T("Contour Tools") |
static TCHAR * | ToolName = _T("Contour Tool") |
static TCHAR * | Purpose = _T("Contour manipulation") |
static TCHAR * | Author = _T("David Mc") |
Definition at line 238 of file cntrtool.h.
|
Default Constructor. Other initialisation is done in ContourTool::Init which is called by the Tool Manager.
Definition at line 216 of file cntrtool.cpp. 00217 { 00218 pcCurrentCursor = NULL; 00219 m_bDisableBlobRenderingFlag = FALSE; 00220 }
|
|
Destructor.
Definition at line 232 of file cntrtool.cpp. 00233 { 00234 if (pRefStart != NULL) 00235 { 00236 delete pRefStart; 00237 pRefStart = NULL; 00238 } 00239 00240 if (pRefEnd != NULL) 00241 { 00242 delete pRefEnd; 00243 pRefEnd = NULL; 00244 } 00245 00246 if (m_pOpContourNodes) 00247 { 00248 delete m_pOpContourNodes; 00249 m_pOpContourNodes = NULL; 00250 } 00251 }
|
|
Reimplemented from Tool_v1. Definition at line 275 of file cntrtool.h. 00275 { return TRUE; }
|
|
Calculates the contour width for a given node given a pointer position.
Definition at line 1580 of file cntrtool.cpp. 01581 { 01582 // get the bounding rect of the node to be contoured 01583 DocRect br = ((NodeRenderableBounded *)pNode)->GetBoundingRect(); 01584 01585 Node * pParent = pNode; 01586 01587 BOOL bContourExists = FALSE; 01588 01589 while (pParent && !bContourExists) 01590 { 01591 if (pParent->IsKindOf(CC_RUNTIME_CLASS(NodeContourController))) 01592 { 01593 pNode = pParent; 01594 bContourExists = TRUE; 01595 01596 br = ((NodeContourController *)pNode)->GetInsideBoundingRect(); 01597 } 01598 01599 pParent = pParent->FindParent(); 01600 } 01601 01602 return CalculateContourWidth(br, PointerPos); 01603 01604 01605 }
|
|
Calculates the contour width for a given rect.
Definition at line 1289 of file cntrtool.cpp. 01290 { 01291 DocCoord Centre = br.Centre(); 01292 01293 INT32 Width = 0; 01294 01295 INT32 OffsetX = 0; 01296 INT32 OffsetY = 0; 01297 01298 double dOffsetX = 0; 01299 double dOffsetY = 0; 01300 01301 // try to work out the width of the contour 01302 // first, are we dragging inside or outside the bounding rect ? 01303 if (!br.ContainsCoord(PointerPos)) 01304 { 01305 // outside the bounding rect 01306 if (PointerPos.x < br.lo.x && PointerPos.y >= br.lo.y && 01307 PointerPos.y <= br.hi.y) 01308 { 01309 Width = br.lo.x - PointerPos.x; 01310 } 01311 else if (PointerPos.x > br.hi.x && PointerPos.y >= br.lo.y && 01312 PointerPos.y <= br.hi.y) 01313 { 01314 Width = PointerPos.x - br.hi.x; 01315 } 01316 else if (PointerPos.x >= br.lo.x && PointerPos.x <= br.hi.x && 01317 PointerPos.y < br.lo.y) 01318 { 01319 Width = br.lo.y - PointerPos.y; 01320 } 01321 else if (PointerPos.x >= br.lo.x && PointerPos.x <= br.hi.x && 01322 PointerPos.y > br.hi.y) 01323 { 01324 Width = PointerPos.y - br.hi.y; 01325 } 01326 else if (PointerPos.x < br.lo.x && PointerPos.y < br.lo.y) 01327 { 01328 OffsetX = br.lo.x - PointerPos.x; 01329 OffsetY = br.lo.y - PointerPos.y; 01330 01331 if (OffsetX > OffsetY) 01332 { 01333 Width = OffsetX; 01334 } 01335 else 01336 { 01337 Width = OffsetY; 01338 } 01339 } 01340 else if (PointerPos.x > br.hi.x && PointerPos.y < br.lo.y) 01341 { 01342 OffsetX = PointerPos.x - br.hi.x ; 01343 OffsetY = br.lo.y - PointerPos.y; 01344 01345 if (OffsetX > OffsetY) 01346 { 01347 Width = OffsetX; 01348 } 01349 else 01350 { 01351 Width = OffsetY; 01352 } 01353 } 01354 else if (PointerPos.x > br.hi.x && PointerPos.y > br.hi.y) 01355 { 01356 OffsetX = PointerPos.x - br.hi.x ; 01357 OffsetY = PointerPos.y - br.hi.y; 01358 01359 if (OffsetX > OffsetY) 01360 { 01361 Width = OffsetX; 01362 } 01363 else 01364 { 01365 Width = OffsetY; 01366 } 01367 } 01368 else if (PointerPos.x < br.lo.x && PointerPos.y > br.hi.y) 01369 { 01370 OffsetX = br.lo.x - PointerPos.x ; 01371 OffsetY = PointerPos.y - br.hi.y; 01372 01373 if (OffsetX > OffsetY) 01374 { 01375 Width = OffsetX; 01376 } 01377 else 01378 { 01379 Width = OffsetY; 01380 } 01381 } 01382 01383 Width = -Width; 01384 } 01385 else 01386 { 01387 // inside the bounding rect then 01388 01389 // work out which quadrant to access 01390 dOffsetX = ((double)(PointerPos.x - Centre.x)); 01391 dOffsetY = ((double)(PointerPos.y - Centre.y)); 01392 01393 INT32 RWidth = br.Width()/2; 01394 INT32 RHeight = br.Height()/2; 01395 01396 if (RWidth > RHeight) 01397 { 01398 INT32 DistX = RWidth - RHeight; 01399 01400 if (PointerPos.x < Centre.x + DistX && 01401 PointerPos.x > Centre.x - DistX) 01402 { 01403 if (dOffsetY > 0) 01404 { 01405 Width = br.hi.y - PointerPos.y; 01406 } 01407 else 01408 { 01409 Width = PointerPos.y - br.lo.y; 01410 } 01411 } 01412 else if (PointerPos.x > Centre.x + DistX) 01413 { 01414 dOffsetX -= (double)DistX; 01415 01416 if (dOffsetY > 0) 01417 { 01418 if (dOffsetX > dOffsetY) 01419 { 01420 Width = br.hi.x - PointerPos.x; 01421 } 01422 else 01423 { 01424 Width = br.hi.y - PointerPos.y; 01425 } 01426 } 01427 else 01428 { 01429 if (dOffsetX > -dOffsetY) 01430 { 01431 Width = br.hi.x - PointerPos.x; 01432 } 01433 else 01434 { 01435 Width = PointerPos.y - br.lo.y; 01436 } 01437 } 01438 } 01439 else 01440 { 01441 dOffsetX += (double)DistX; 01442 dOffsetX = -dOffsetX; 01443 01444 if (dOffsetY > 0) 01445 { 01446 if (dOffsetX > dOffsetY) 01447 { 01448 Width = PointerPos.x - br.lo.x; 01449 } 01450 else 01451 { 01452 Width = br.hi.y - PointerPos.y; 01453 } 01454 } 01455 else 01456 { 01457 if (dOffsetX > -dOffsetY) 01458 { 01459 Width = PointerPos.x - br.lo.x; 01460 } 01461 else 01462 { 01463 Width = PointerPos.y - br.lo.y; 01464 } 01465 } 01466 } 01467 } 01468 else 01469 { 01470 INT32 DistY = RHeight - RWidth; 01471 01472 if (PointerPos.y < Centre.y + DistY && 01473 PointerPos.y > Centre.y - DistY) 01474 { 01475 if (dOffsetX > 0) 01476 { 01477 Width = br.hi.x - PointerPos.x; 01478 } 01479 else 01480 { 01481 Width = PointerPos.x - br.lo.x; 01482 } 01483 } 01484 else if (PointerPos.y > Centre.y + DistY) 01485 { 01486 dOffsetY -= (double)DistY; 01487 01488 if (dOffsetX > 0) 01489 { 01490 if (dOffsetY > dOffsetX) 01491 { 01492 Width = br.hi.y - PointerPos.y; 01493 } 01494 else 01495 { 01496 Width = br.hi.x - PointerPos.x; 01497 } 01498 } 01499 else 01500 { 01501 if (dOffsetY > -dOffsetX) 01502 { 01503 Width = br.hi.y - PointerPos.y; 01504 } 01505 else 01506 { 01507 Width = PointerPos.x - br.lo.x; 01508 } 01509 } 01510 } 01511 else 01512 { 01513 dOffsetY += (double)DistY; 01514 dOffsetY = -dOffsetY; 01515 01516 if (dOffsetX > 0) 01517 { 01518 if (dOffsetY > dOffsetX) 01519 { 01520 Width = PointerPos.y - br.lo.y; 01521 } 01522 else 01523 { 01524 Width = br.hi.x - PointerPos.x; 01525 } 01526 } 01527 else 01528 { 01529 if (dOffsetY > -dOffsetX) 01530 { 01531 Width = PointerPos.y - br.lo.y; 01532 } 01533 else 01534 { 01535 Width = PointerPos.x - br.lo.x; 01536 } 01537 } 01538 } 01539 } 01540 } 01541 01542 // check for max's and min's 01543 if (Width > 0) 01544 { 01545 if (Width > CONTOUR_DEPTH_MAX) 01546 Width = CONTOUR_DEPTH_MAX; 01547 01548 if (Width < CONTOUR_DEPTH_MIN) 01549 Width = CONTOUR_DEPTH_MIN; 01550 } 01551 else 01552 { 01553 if (Width < -CONTOUR_DEPTH_MAX) 01554 Width = -CONTOUR_DEPTH_MAX; 01555 01556 if (Width > -CONTOUR_DEPTH_MIN) 01557 Width = -CONTOUR_DEPTH_MIN; 01558 } 01559 01560 return Width; 01561 }
|
|
|
|
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 1130 of file cntrtool.cpp. 01131 { 01132 ERROR3IF(pRefStart == NULL,"pRefStart == NULL"); 01133 ERROR3IF(pRefEnd == NULL,"pRefEnd == NULL"); 01134 }
|
|
Creates all the blend tool cursors.
Definition at line 577 of file cntrtool.cpp. 00578 { 00579 // This tool has just been selected. Create the cursors. 00580 pcNormalCursor = new Cursor(this, _R(IDC_POINTER_CONTOUR)); 00581 pcOverBlob = new Cursor(this, _R(IDC_SELECT_CONTOUR)); 00582 00583 if ( pcNormalCursor ==NULL || !pcNormalCursor->IsValid() || 00584 pcOverBlob== NULL || !pcOverBlob->IsValid() 00585 ) 00586 { 00587 DestroyCursors(); 00588 return FALSE; 00589 } 00590 else 00591 return TRUE; 00592 }
|
|
Allows the tool manager to extract information about the tool.
Reimplemented from Tool_v1. Definition at line 347 of file cntrtool.cpp. 00348 { 00349 // Cast structure into the latest one we understand. 00350 ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr; 00351 00352 Info->InfoVersion = 1; 00353 00354 Info->InterfaceVersion = GetToolInterfaceVersion(); // You should always have this line. 00355 00356 // These are all arbitrary at present. 00357 Info->Version = 1; 00358 Info->ID = GetID(); 00359 Info->TextID = _R(IDS_CONTOUR_TOOL); 00360 00361 Info->Family = FamilyName; 00362 Info->Name = ToolName; 00363 Info->Purpose = Purpose; 00364 Info->Author = Author; 00365 00366 Info->BubbleID = _R(IDBBL_CONTOUR_TOOLBOX); 00367 }
|
|
Destroys all the blend tool cursors.
Definition at line 654 of file cntrtool.cpp. 00655 { 00656 if (pcNormalCursor != NULL) delete pcNormalCursor; 00657 if (pcOverBlob != NULL) delete pcOverBlob; 00658 00659 pcNormalCursor = NULL; 00660 pcOverBlob = NULL; 00661 }
|
|
Displays the given status help string in the status bar.
Definition at line 1249 of file cntrtool.cpp. 01250 { 01251 String_256 StatusMsg(""); 01252 StatusMsg.Load(StatusIDX); 01253 GetApplication()->UpdateStatusBarText(&StatusMsg); 01254 ContourTool::StatusID = StatusIDX; 01255 }
|
|
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 1152 of file cntrtool.cpp. 01153 { 01154 return NodeRenderableInk::FindCompoundAtPoint(pSpread,PointerPos,NULL); 01155 }
|
|
Definition at line 261 of file cntrtool.h. 00261 { return pContourInfoBarOp; }
|
|
Reimplemented from Tool_v1. Definition at line 250 of file cntrtool.h. 00250 { return TOOLID_CONTOURTOOL; };
|
|
Definition at line 266 of file cntrtool.h. 00266 { return pRefEnd; }
|
|
Definition at line 265 of file cntrtool.h. 00265 { return pRefStart; }
|
|
Each tool should override this function to return valid status line text.
Reimplemented from Tool_v1. Definition at line 977 of file cntrtool.cpp. 00978 { 00979 if (StatusID != 0) 00980 { 00981 *pStr = String_256(StatusID); 00982 } 00983 else 00984 { 00985 *pStr = String_256(_R(IDS_CONTOURDRAGHELP)); 00986 } 00987 00988 return TRUE; 00989 }
|
|
Brings up the associated warning dialog.
Definition at line 825 of file cntrtool.cpp. 00826 { 00827 String_256 QueryString(_R(IDS_CANTCONTOURBEVEL)); 00828 00829 Error::SetError(0, QueryString, 0); 00830 // The only way of bringing up a box with a string in it 00831 INT32 DlgResult = InformError(_R(IDS_CANTCONTOURBEVEL), 00832 _R(IDS_OK), _R(IDS_HELP)); 00833 00834 if (DlgResult == 2) 00835 { 00836 HelpUserTopic(_R(IDS_HELPPATH_Message__Bevel_already_applied)); 00837 } 00838 }
|
|
Used to check if the Tool was properly constructed.
Reimplemented from Tool_v1. Definition at line 266 of file cntrtool.cpp. 00267 { 00268 // Declare all your ops here and only succeed if all declarations succeed 00269 BOOL ok = OpContourNodes::Declare() && 00270 OpChangeContourToInner::Declare() && 00271 OpChangeContourToOuter::Declare() && 00272 OpRemoveContour::Declare() && 00273 OpChangeContourSteps::Declare() && 00274 OpChangeContourColourType::Declare() && 00275 OpChangeContourAttributeProfile::Declare() && 00276 OpChangeContourObjectProfile::Declare() && 00277 OpChangeContourStepDistance::Declare() && 00278 OpToggleContourInsetPath::Declare(); 00279 00280 if (!ok) return FALSE; 00281 00282 m_pOpContourNodes = new OpContourNodes; 00283 00284 if (!m_pOpContourNodes) 00285 return FALSE; 00286 00287 // We need two BlendToolRef objects 00288 ContourTool::pRefStart = new BlendToolRef; 00289 ContourTool::pRefEnd = new BlendToolRef; 00290 00291 ok = (ContourTool::pRefStart != NULL && ContourTool::pRefEnd != NULL); 00292 00293 // This section reads in the infobar definition and creates an instance of 00294 // ContourInfoBarOp. Also pContourInfoBarOp, the ptr to the tool's infobar, is set up 00295 // after the infobar is successfully read and created. 00296 if (ok) 00297 { 00298 #if 0 00299 CCResTextFile file; // Resource File 00300 ContourInfoBarOpCreate BarCreate; // Object that creates ContourInfoBarOp objects 00301 00302 // ok = file.open(_R(IDM_BLEND_BAR), _R(IDT_INFO_BAR_RES)); // Open resource 00303 ok = file.open( _R(IDM_CONTOUR_BAR), _R(IDT_INFO_BAR_RES) ); 00304 if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate); // Read and create info bar 00305 if (ok) file.close(); // Close resource 00306 00307 ENSURE(ok,"Unable to load blendbar.ini from resource\n"); 00308 00309 if (ok) 00310 { 00311 // Info bar now exists. Now get a pointer to it 00312 String_32 str = String_32(_R(IDS_CONTOURTOOL_INFOBARNAME)); 00313 DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str); 00314 00315 ok = (pDialogBarOp != NULL); 00316 if (ok) ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(ContourInfoBarOp)); 00317 if (ok) pContourInfoBarOp = (ContourInfoBarOp*)pDialogBarOp; 00318 00319 ENSURE(ok,"Error finding the blend tool info bar"); 00320 } 00321 #endif 00322 pContourInfoBarOp = new ContourInfoBarOp(); 00323 ok = (pContourInfoBarOp != NULL); 00324 00325 } 00326 00327 return (ok); 00328 }
|
|
Is the blend tool the current one? Call this to find out.
Definition at line 1271 of file cntrtool.cpp. 01272 { 01273 return (Tool::GetCurrentID() == TOOLID_CONTOURTOOL); 01274 }
|
|
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 1070 of file cntrtool.cpp. 01071 { 01072 if (pRef == NULL) return FALSE; 01073 01074 // Find the selected range of objects 01075 SelRange* pSelRange = GetApplication()->FindSelection(); 01076 Node* pNode = pSelRange->FindFirst(); 01077 01078 BOOL BlobFound = FALSE; 01079 01080 // Scan the selection for NodePath objects 01081 while (pNode != NULL && !BlobFound) 01082 { 01083 if (pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeBlend)) 01084 { 01085 NodeBlend* pNodeBlend = (NodeBlend*)pNode; 01086 01087 if (pNodeBlend->GetUnionBlobBoundingRect().ContainsCoord(*pPointerPos)) 01088 { 01089 BlobFound = pNodeBlend->IsPointOverBlob(pPointerPos, 01090 &(pRef->pBlendPath), 01091 &(pRef->Index), 01092 &(pRef->AStartNode), 01093 &(pRef->RemapRef)); 01094 01095 if (BlobFound) 01096 { 01097 pRef->pNode = pNodeBlend; 01098 pRef->pNodeBlend = pNodeBlend; 01099 // *pPointerPos = pRef->pBlendPath->GetPathCoord(pRef->Index); 01100 } 01101 } 01102 } 01103 01104 // Now find the next selected node 01105 pNode = pSelRange->FindNext(pNode); 01106 } 01107 01108 return BlobFound; 01109 }
|
|
Creates all the blend tool cursors.
Definition at line 608 of file cntrtool.cpp. 00609 { 00610 // check to see if I'm over a blob 00611 BlobManager * pBlobMgr = GetApplication()->GetBlobManager(); 00612 00613 INT32 BlobSize = 0; 00614 00615 // Karim 18/09/2000 00616 // The contour blobs are about twice the size of normal blobs, 00617 // so I'm doubling the value of BlobSize when checking for them. 00618 if (pBlobMgr) 00619 BlobSize = pBlobMgr->GetBlobSize(); 00620 // BlobSize = pBlobMgr->GetBlobSize()/2; 00621 00622 for (INT32 i = 0; i < 8; i++) 00623 { 00624 DocRect dr( m_BlobPoints[i].x - BlobSize, 00625 m_BlobPoints[i].y - BlobSize, 00626 m_BlobPoints[i].x + BlobSize, 00627 m_BlobPoints[i].y + BlobSize); 00628 00629 if (dr.ContainsCoord(Point)) 00630 { 00631 if (pBlobRect) 00632 *pBlobRect = dr; 00633 return TRUE; 00634 } 00635 } 00636 00637 return FALSE; 00638 }
|
|
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 1009 of file cntrtool.cpp. 01010 { 01011 if (pRef == NULL) return FALSE; 01012 01013 // Find the selected range of objects 01014 SelRange* pSelRange = GetApplication()->FindSelection(); 01015 Node* pNode = pSelRange->FindFirst(); 01016 01017 BOOL BlobFound = FALSE; 01018 01019 // Scan the selection for NodePath objects 01020 while (!BlobFound && pNode != NULL && pNode->FindParent() != NULL) 01021 { 01022 // Only look at selected NodePaths that are NOT selected inside another node. 01023 if (IS_A(pNode,NodePath) && IS_A(pNode->FindParent(),Layer)) 01024 { 01025 NodePath* pNodePath = (NodePath*)pNode; 01026 01027 if (pNodePath->GetUnionBlobBoundingRect().ContainsCoord(*pPointerPos)) 01028 { 01029 // Get a pointer to the Path object within the NodePath 01030 Path* pPath = &(pNodePath->InkPath); 01031 01032 // Is it over a blob? (Only check end points. Forget about control points) 01033 BlobFound = pPath->FindNearestPoint(*pPointerPos,POINTFLAG_ENDPOINTS,&(pRef->Index)); 01034 01035 // If a blob is found, store ptr to the node 01036 if (BlobFound) 01037 { 01038 pRef->pNode = pNodePath; 01039 pPath->SetPathPosition(pRef->Index); 01040 *pPointerPos = pPath->GetCoord(); 01041 } 01042 } 01043 } 01044 01045 // Now find the next selected node 01046 pNode = pSelRange->FindNext(pNode); 01047 } 01048 01049 return BlobFound; 01050 }
|
|
To handle a Mouse Click event for the Blend Tool.
Reimplemented from DragTool. Definition at line 748 of file cntrtool.cpp. 00750 { 00751 // Stub out this function if the tool isn't wanted 00752 #ifndef NO_ADVANCED_TOOLS 00753 if (ClickMods.Menu) return; // Don't do anything if the user clicked the Menu button 00754 00755 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL")); 00756 00757 // NodeCompound * pCompound = NULL; 00758 00759 DocRect BlobRect; 00760 00761 switch (Click) 00762 { 00763 // if a drag was started, we alter or create a contour. 00764 case CLICKTYPE_DRAG: 00765 { 00766 if (m_pOpContourNodes) 00767 { 00768 m_pOpContourNodes->DoDrag(this, pContourInfoBarOp, PointerPos, 00769 IsPointOverBlob(PointerPos, &BlobRect), &BlobRect); 00770 return; 00771 } 00772 } 00773 break; 00774 00775 // we ignore all other click types, but note that they aren't drag-clicks. 00776 case CLICKTYPE_SINGLE: 00777 { 00778 // check for bevels existing 00779 List BevelList; 00780 BevelTools::BuildListOfSelectedNodes(&BevelList, CC_RUNTIME_CLASS(NodeBevelController)); 00781 00782 if (!BevelList.IsEmpty()) 00783 { 00784 BevelList.DeleteAll(); 00785 00786 DocRect BlobRect; 00787 00788 // disable the drag 00789 if (IsPointOverBlob(PointerPos, &BlobRect)) 00790 { 00791 DocView * pView = DocView::GetCurrent(); 00792 00793 if (pView) 00794 pView->EndDrag(NULL); 00795 00796 InformWarningBevelExistsInSelection(); 00797 } 00798 } 00799 00800 // call the base class .... 00801 00802 DragTool::OnClick (PointerPos, Click, ClickMods, pSpread); 00803 } 00804 break; 00805 00806 default: 00807 // call the base class .... 00808 00809 DragTool::OnClick (PointerPos, Click, ClickMods, pSpread); 00810 break; 00811 } 00812 #endif // NO_ADVANCED_TOOLS 00813 }
|
|
To handle keypress events for the Blend Tool.
Reimplemented from Tool_v1. Definition at line 675 of file cntrtool.cpp. 00676 { 00677 #ifdef _DEBUG 00678 if (pKeyPress == NULL) 00679 return FALSE; 00680 00681 if (pKeyPress->IsRepeat()) 00682 return FALSE; 00683 00684 if (pKeyPress->IsRelease()) 00685 return FALSE; 00686 00687 AFp BiasDelta = 0.0; 00688 AFp GainDelta = 0.0; 00689 BOOL Reset = FALSE; 00690 if (*pKeyPress == KeyPress(CAMKEY(Z))) { BiasDelta = -0.1; TRACEUSER( "Markn", _T("Decrease Bias by 0.1\n"));} 00691 if (*pKeyPress == KeyPress(CAMKEY(X))) { BiasDelta = 0.1; TRACEUSER( "Markn", _T("Increase Bias by 0.1\n"));} 00692 if (*pKeyPress == KeyPress(CAMKEY(N))) { GainDelta = -0.1; TRACEUSER( "Markn", _T("Decrease Gain by 0.1\n"));} 00693 if (*pKeyPress == KeyPress(CAMKEY(M))) { GainDelta = 0.1; TRACEUSER( "Markn", _T("Increase Gain by 0.1\n"));} 00694 00695 if (*pKeyPress == KeyPress(CAMKEY(R))) { Reset = TRUE; TRACEUSER( "Markn", _T("Resetting Bias and Gain\n"));} 00696 00697 SelRange* pSelRange = GetApplication()->FindSelection(); 00698 Node* pNode = pSelRange->FindFirst(); 00699 while (pNode) 00700 { 00701 if (IS_A(pNode,NodeBlend)) 00702 { 00703 NodeBlend* pNodeBlend = (NodeBlend*)pNode; 00704 00705 // This alters the Attribute profile, but can easily be modified to alter the Object profile if necessary 00706 CProfileBiasGain* pProfile = pNodeBlend->GetAttrProfile(); 00707 if (pProfile) 00708 { 00709 AFp Bias = pProfile->GetBias() + BiasDelta; 00710 AFp Gain = pProfile->GetGain() + GainDelta; 00711 if (Reset) 00712 Bias = Gain = 0.0; 00713 00714 if (Bias < -0.9) Bias = -0.9; 00715 if (Bias > 0.9) Bias = 0.9; 00716 if (Gain < -0.9) Gain = -0.9; 00717 if (Gain > 0.9) Gain = 0.9; 00718 00719 pProfile->SetBiasGain(Bias,Gain); 00720 } 00721 } 00722 // Now find the next selected node 00723 pNode = pSelRange->FindNext(pNode); 00724 } 00725 #endif // _DEBUG 00726 00727 return FALSE; 00728 }
|
|
To handle a Mouse Move event for the Blend Tool.
Reimplemented from Tool_v1. Definition at line 855 of file cntrtool.cpp. 00856 { 00857 // Stub out this function if the tool isn't wanted 00858 #ifndef NO_ADVANCED_TOOLS 00859 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL")); 00860 00861 // BlobManager * pBlobMgr = GetApplication()->GetBlobManager(); 00862 // INT32 BlobSize = pBlobMgr->GetBlobSize(); 00863 00864 if (IsPointOverBlob(PointerPos)) 00865 { 00866 // change the cursor 00867 if (pcCurrentCursor != pcOverBlob ) 00868 { 00869 if (pcCurrentCursor) 00870 { 00871 CursorStack::GPop(CurrentCursorID); 00872 } 00873 00874 CurrentCursorID = CursorStack::GPush(pcOverBlob, TRUE); 00875 pcCurrentCursor = pcOverBlob; 00876 DisplayStatusBarHelp(_R(IDS_CONTOUROVERBLOBHELP)); 00877 } 00878 } 00879 else 00880 { 00881 // change the cursor back 00882 if (pcCurrentCursor != pcNormalCursor ) 00883 { 00884 if (pcCurrentCursor) 00885 { 00886 CursorStack::GPop(CurrentCursorID); 00887 } 00888 00889 CurrentCursorID = CursorStack::GPush(pcNormalCursor, TRUE); 00890 pcCurrentCursor = pcNormalCursor; 00891 DisplayStatusBarHelp(_R(IDS_CONTOURDRAGHELP)); 00892 } 00893 } 00894 #endif // NO_ADVANCED_TOOLS 00895 }
|
|
Handles the RenderToolBlobs method. Renders the tool's blobs into the current doc view.
2 4 3 6 * 7 0 5 1
Reimplemented from Tool_v1. Definition at line 1180 of file cntrtool.cpp. 01181 { 01182 // BlobManager * pBlobMgr = GetApplication()->GetBlobManager(); 01183 01184 if (m_bDisableBlobRenderingFlag) 01185 return; 01186 01187 // check the blobs to see if they're valid 01188 BOOL bZeroBlobs = TRUE; 01189 01190 for (UINT32 i = 0 ; i < 8; i++) 01191 { 01192 if (m_BlobPoints[i].x != 0 || 01193 m_BlobPoints[i].y != 0) 01194 { 01195 bZeroBlobs = FALSE; 01196 break; 01197 } 01198 } 01199 01200 if (bZeroBlobs) 01201 return; 01202 01203 DocView* pDocView = DocView::GetCurrent(); 01204 01205 // Get a render region on the spread. We need to render EORd stuff on top of the current view 01206 RenderRegion* pRender = pDocView->RenderOnTop(pDocRect,pSpread,UnclippedEOR); 01207 01208 while (pRender != NULL) 01209 { 01210 pRender->SaveContext(); 01211 01212 // left and right. 01213 pRender->DrawBitmapBlob(m_BlobPoints[6], _R(IDBMP_CONTOUR_LEFTRIGHT)); 01214 pRender->DrawBitmapBlob(m_BlobPoints[7], _R(IDBMP_CONTOUR_LEFTRIGHT)); 01215 01216 // up and down. 01217 pRender->DrawBitmapBlob(m_BlobPoints[4], _R(IDBMP_CONTOUR_UPDOWN)); 01218 pRender->DrawBitmapBlob(m_BlobPoints[5], _R(IDBMP_CONTOUR_UPDOWN)); 01219 01220 // acute accent (bl to tr). 01221 pRender->DrawBitmapBlob(m_BlobPoints[0], _R(IDBMP_CONTOUR_ACUTE)); 01222 pRender->DrawBitmapBlob(m_BlobPoints[3], _R(IDBMP_CONTOUR_ACUTE)); 01223 01224 // grave accent (tl to br). 01225 pRender->DrawBitmapBlob(m_BlobPoints[2], _R(IDBMP_CONTOUR_GRAVE)); 01226 pRender->DrawBitmapBlob(m_BlobPoints[1], _R(IDBMP_CONTOUR_GRAVE)); 01227 01228 pRender->RestoreContext(); 01229 01230 // get the next render region 01231 pRender = pDocView->GetNextOnTop(pDocRect); 01232 } 01233 }
|
|
Starts up and closes down the blend tool.
Reimplemented from Tool_v1. Definition at line 385 of file cntrtool.cpp. 00386 { 00387 // Stub out this function if the tool isn't wanted 00388 #ifndef NO_ADVANCED_TOOLS 00389 if (isSelected) 00390 { 00391 if (!CreateCursors()) return; 00392 CurrentCursorID = CursorStack::GPush(pcNormalCursor, FALSE); // Push cursor but don't display now 00393 pcCurrentCursor = pcNormalCursor; 00394 00395 // Create and display the tool's info bar 00396 pContourInfoBarOp->Create(); 00397 00398 // Which blobs do I want displayed 00399 BlobManager* BlobMgr = GetApplication()->GetBlobManager(); 00400 if (BlobMgr != NULL) 00401 { 00402 // Decide which blobs we will display 00403 BlobStyle MyBlobs; 00404 MyBlobs.Object = FALSE; 00405 MyBlobs.Tiny = TRUE; 00406 // Tell the blob manager 00407 BlobMgr->ToolInterest(MyBlobs); 00408 } 00409 00410 Document* pDoc = Document::GetCurrent(); 00411 SetupToolBlobs(); 00412 00413 if (pDoc != NULL) 00414 RenderToolBlobs(pDoc->GetSelectedSpread(),NULL); 00415 00416 pContourInfoBarOp->m_pTool = this; 00417 } 00418 else 00419 { 00420 // Deselection - destroy the tool's cursors, if they exist. 00421 if (pcCurrentCursor != NULL) 00422 { 00423 CursorStack::GPop(CurrentCursorID); 00424 pcCurrentCursor = NULL; 00425 CurrentCursorID = 0; 00426 } 00427 DestroyCursors(); 00428 00429 pContourInfoBarOp->CloseProfileDialog (pContourInfoBarOp->m_BiasGainObjectGadget); 00430 pContourInfoBarOp->CloseProfileDialog (pContourInfoBarOp->m_BiasGainAttrGadget); 00431 00432 // Remove the info bar from view by deleting the actual underlying window 00433 pContourInfoBarOp->Delete(); 00434 00435 // ensure any tool object blobs are removed. 00436 BlobManager* BlobMgr = GetApplication()->GetBlobManager(); 00437 if (BlobMgr != NULL) 00438 { 00439 BlobStyle bsRemoves; 00440 bsRemoves.ToolObject = TRUE; 00441 BlobMgr->RemoveInterest(bsRemoves); 00442 } 00443 00444 Document* pDoc = Document::GetCurrent(); 00445 if (pDoc != NULL) 00446 RenderToolBlobs(pDoc->GetSelectedSpread(),NULL); 00447 } 00448 #endif // NO_ADVANCED_TOOLS 00449 }
|
|
Definition at line 280 of file cntrtool.h. 00281 { 00282 if (b) 00283 m_bDisableBlobRenderingFlag = FALSE; 00284 else 00285 m_bDisableBlobRenderingFlag = TRUE; 00286 }
|
|
Sets up the tool blobs for the current selection.
2 4 3 6 * 7 0 5 1 with corner blobs positioned 1 pixel out from the bounds rect and middle blobs positioned 2 pixels out from the bounds rect.
Definition at line 477 of file cntrtool.cpp. 00478 { 00479 // reset the blob positions. 00480 for (INT32 i = 0 ; i < 8; i++) 00481 { 00482 m_BlobPoints[i].x = 0; 00483 m_BlobPoints[i].y = 0; 00484 } 00485 00486 // give up if we there is no selection or we can't get the info we need. 00487 if (GetApplication()->FindSelection() == NULL) 00488 return; 00489 00490 if (GetApplication()->FindSelection()->IsEmpty()) 00491 return; 00492 00493 BlobManager * pBlobMgr = GetApplication()->GetBlobManager(); 00494 if (pBlobMgr == NULL) 00495 return; 00496 00497 // figure out the blob offsets, in millipoints. 00498 INT32 BlobGap = 0; 00499 DocView* pDocView = DocView::GetSelected(); 00500 if (pDocView != NULL) 00501 BlobGap = pDocView->GetScaledPixelWidth().MakeLong(); 00502 00503 // ok, get the bounds of the selection, including contours. 00504 SelRange Sel(*(GetApplication()->FindSelection())); 00505 DocRect drBounds; 00506 Node* pN = Sel.FindFirst(); 00507 while (pN != NULL) 00508 { 00509 if (pN->IsBounded()) 00510 { 00511 Node* pParent = pN->FindParent(); 00512 while (pParent != NULL && pParent->IS_KIND_OF(NodeContourController)) 00513 { 00514 pN = pParent; 00515 pParent = pN->FindParent(); 00516 } 00517 00518 drBounds = drBounds.Union( ((NodeRenderableBounded*)pN)->GetBoundingRect() ); 00519 } 00520 pN = Sel.FindNext(pN); 00521 } 00522 00523 // lets set up those blobs! 00524 DocCoord dc; 00525 drBounds.Inflate(BlobGap); 00526 INT32 BlobSize = pBlobMgr->GetBlobSize(); 00527 00528 dc.x = drBounds.lo.x - BlobSize; 00529 dc.y = drBounds.lo.y - BlobSize; 00530 m_BlobPoints[0] = dc; 00531 00532 dc.x = drBounds.hi.x + BlobSize; 00533 dc.y = drBounds.lo.y - BlobSize; 00534 m_BlobPoints[1] = dc; 00535 00536 dc.x = drBounds.lo.x - BlobSize; 00537 dc.y = drBounds.hi.y + BlobSize; 00538 m_BlobPoints[2] = dc; 00539 00540 dc.x = drBounds.hi.x + BlobSize; 00541 dc.y = drBounds.hi.y + BlobSize; 00542 m_BlobPoints[3] = dc; 00543 00544 dc.x = (drBounds.lo.x + drBounds.hi.x) / 2; 00545 dc.y = drBounds.hi.y + BlobSize + BlobGap; 00546 m_BlobPoints[4] = dc; 00547 00548 dc.x = (drBounds.lo.x + drBounds.hi.x) / 2; 00549 dc.y = drBounds.lo.y - BlobSize - BlobGap; 00550 m_BlobPoints[5] = dc; 00551 00552 dc.x = drBounds.lo.x - BlobSize - BlobGap; 00553 dc.y = (drBounds.lo.y + drBounds.hi.y) / 2; 00554 m_BlobPoints[6] = dc; 00555 00556 dc.x = drBounds.hi.x + BlobSize + BlobGap; 00557 dc.y = (drBounds.lo.y + drBounds.hi.y) / 2; 00558 m_BlobPoints[7] = dc; 00559 }
|
|
This will update the cursor and status line text depending on the data in the two blend tool references within ContourTool.
Definition at line 951 of file cntrtool.cpp. 00952 { 00953 ERROR3IF_PF(pRefStart==NULL,("pRefStart is NULL")); 00954 ERROR3IF_PF(pRefEnd ==NULL,("pRefEnd is NULL")); 00955 00956 DisplayStatusBarHelp(StatusID); 00957 }
|
|
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 918 of file cntrtool.cpp. 00919 { 00920 ERROR3IF_PF(pRef ==NULL,("pRef is NULL")); 00921 ERROR3IF_PF(pSpread==NULL,("pSpread is NULL")); 00922 00923 // Set the spread and pointer pos members 00924 pRef->pSpread = pSpread; 00925 pRef->PointerPos = PointerPos; 00926 }
|
|
Reimplemented from DragTool. Definition at line 321 of file cntrtool.h. |
|
Definition at line 308 of file cntrtool.h. |
|
Reimplemented from DragTool. Definition at line 318 of file cntrtool.h. |
|
Definition at line 329 of file cntrtool.h. |
|
Definition at line 324 of file cntrtool.h. |
|
Definition at line 290 of file cntrtool.h. |
|
Definition at line 307 of file cntrtool.h. |
|
Definition at line 304 of file cntrtool.h. |
|
Definition at line 301 of file cntrtool.h. |
|
Definition at line 305 of file cntrtool.h. |
|
Definition at line 315 of file cntrtool.h. |
|
Definition at line 314 of file cntrtool.h. |
|
Reimplemented from DragTool. Definition at line 320 of file cntrtool.h. |
|
Definition at line 311 of file cntrtool.h. |
|
Reimplemented from DragTool. Definition at line 319 of file cntrtool.h. |