#include <beztool.h>
Inheritance diagram for BezToolInfoBarOp:

Public Member Functions | |
| BezToolInfoBarOp (ResourceID r=_R(IDD_BEZTOOLBAR)) | |
| BOOL | CheckClassData () |
| MsgResult | Message (Msg *Msg) |
| Bezier tool info bar dialog message handler. | |
| void | InitControls () |
| void | EnableControls () |
| virtual void | UpdateState () |
| Overrides the empty UpdateState function provided by InformationBarOp making a call to the function in DialogBarOp. | |
| NodeBlend * | GetBlendOnCurve () |
| To determine if the current selection is a blend on a curve. | |
Public Attributes | |
| BezierTool * | pBezTool |
Protected Member Functions | |
| void | UpdateCurveButton () |
| Sets the grey and select status of the curve button on the infobar. | |
| void | UpdateLineButton () |
| Sets the grey and select status of the line button on the infobar. | |
| void | UpdateReversePathsButton () |
| Sets the grey and select status of the reverse paths button on the infobar. | |
| void | UpdateSmoothButton () |
| Sets the grey and select status of the smooth button on the infobar. | |
| void | UpdateCuspButton () |
| Sets the grey and select status of the cusp button on the infobar. | |
| void | UpdateTextIndicator () |
| Updates the text in the "Add/Change/New" field. If there is a floating endpoint then the field says "New", if the first or last point on an open path is selected then it says "Add", otherwise it says "Change". | |
| void | UpdateStartArrowButton () |
| Sets the grey and select status of the arrow extents button on the infobar. | |
| void | UpdateEndArrowButton () |
| Sets the grey and select status of the arrow extents button on the infobar. | |
| void | UpdatePositionFields (BOOL ForceUpdate=FALSE, BOOL ScanForCurrent=TRUE) |
| Sets the grey and select status of the point position icons on the infobar. If there is one selected point on a path then the fields are enabled, in all other cases they are greyed. | |
| void | UpdateEditFieldsFromPath (Path *pPath, Spread *pSpread, INT32 Index, BOOL ForceUpdate, BOOL EnableData[18]) |
| void | HandleClickOnCurveButton () |
| Called by the message handler to handle clicks on the curve button on the infobar. | |
| void | HandleClickOnLineButton () |
| Called by the message handler to handle clicks on the line button on the infobar. | |
| void | HandleClickOnReversePathButton () |
| Called by the message handler to handle clicks on the reverse path button on the infobar. | |
| void | HandleClickOnSmoothButton () |
| Called by the message handler to handle clicks on the smooth button on the infobar. | |
| void | HandleClickOnCuspButton (BOOL WithConstrain) |
| Called by the message handler to handle clicks on the cusp button on the infobar. | |
| void | HandleClickOnStartArrowButton () |
| Called by the message handler to handle clicks on the arrow extends button on the infobar. | |
| void | HandleClickOnEndArrowButton () |
| Called by the message handler to handle clicks on the arrow extends button on the infobar. | |
| BOOL | HandleBumpClick (CGadgetID GadgetID) |
| Called by the message handler to handle clicks on any of the bump buttons. | |
| BOOL | HandleEditFieldCommit (CGadgetID CommitField) |
| Called by the message handler when RETURN is pressed in one of the point position edit fields. | |
| void | ScanPointsForToggleSmooth (BOOL MakeSmooth, BOOL WithConstrain) |
| Called by the click handlers for the smooth and cusp buttons. Calls DoTogglePoint to do the work. | |
| BOOL | ScanPointsForJoins (BOOL *AllSmooth, BOOL *AllCusp) |
| Scan the selected points on all paths to see the type of the points. | |
| BOOL | SetEditLength (CGadgetID gid, INT32 nValue, Spread *pSpread, BOOL PaintNow=FALSE) |
| Converts the given value to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-field. | |
| BOOL | SetEditPosition (CGadgetID gid, INT32 nValue, Spread *pSpread, BOOL PaintNow=FALSE) |
| Converts the given value to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-field. | |
| BOOL | SetEditPosition (CGadgetID gidX, CGadgetID gidY, DocCoord loc, Spread *pSpread, BOOL PaintNow=FALSE) |
| Converts the given coordinate to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-fields. | |
| INT32 | GetCurrentIndex () |
| To enable other classes to see which endpoint is currently selected for display. | |
| double | GetAngle (DocCoord Origin, DocCoord Offset) |
| Common code for calculating the angle between two endpoints. | |
| BOOL | HandleLAFieldCommit (CGadgetID, CGadgetID, CGadgetID, DocCoord, DocCoord, DocCoord *) |
| BOOL | HandleCoordFieldCommit (UINT32 UpperID, UINT32 LowerID, INT32 Index, DocCoord *NewPos, BOOL *Valid) |
| Common code for handling a commit in a pait of edit fields that contain a coordinate. If the fields haven't been edited then no change is required. | |
| INT32 | GetPrevLineIndex (Path *pPath, INT32 Index) |
| Gets the index of the 'other' end of the line ending at the current index, accounting for closed and sub-paths. | |
| INT32 | GetNextLineIndex (Path *pPath, INT32 Index) |
| Gets the index of the 'other' end of the line starting at the current index, accounting for closed and sub-paths. | |
| MsgResult | InfobarMessage (Msg *Message) |
| Deals with messages sent to the Shape editor tools infobar. | |
Private Attributes | |
| INT32 | CurrentIndex |
| NodePath * | CurrentNodePath |
| Path * | CurrentInkPath |
| Spread * | CurrentSpread |
| BOOL | IgnoreNextUpdate |
| INT32 | LastShownPrevLength |
| INT32 | LastShownNextLength |
Friends | |
| class | BezierTool |
Definition at line 162 of file beztool.h.
|
|
Definition at line 167 of file beztool.h. 00167 {DlgResID = r;} // Dummy default constructor for DYNCREATE
|
|
|
Definition at line 4142 of file beztool.cpp. 04143 { 04144 if ((CurrentNodePath) && (CurrentInkPath) && (CurrentSpread)) 04145 { 04146 return (TRUE); 04147 } 04148 return (FALSE); 04149 }
|
|
|
|
|
||||||||||||
|
Common code for calculating the angle between two endpoints.
Definition at line 4065 of file beztool.cpp. 04066 { 04067 const DocCoord Outer = Offset - Origin; 04068 double Angle = atan2((double)Outer.y, (double)Outer.x); 04069 04070 if (Angle == HUGE_VAL) 04071 return 0.0; 04072 else 04073 return Angle; 04074 }
|
|
|
To determine if the current selection is a blend on a curve.
Definition at line 801 of file beztool.cpp. 00802 { 00803 // first get the selection 00804 SelRange Sel(*( GetApplication()->FindSelection())); 00805 NodeBlend* pNodeBlend = NULL; 00806 NodeBlendPath* pNodeBlendPath = NULL; 00807 // get the node blend 00808 if (!Sel.IsEmpty()) 00809 { 00810 Node* pNode = Sel.FindFirst(); 00811 while (pNode != NULL) 00812 { 00813 if (pNode->IS_KIND_OF(NodeBlendPath)) 00814 { 00815 pNodeBlendPath = (NodeBlendPath*)pNode; 00816 break; 00817 } 00818 pNode = Sel.FindNext(pNode); 00819 } 00820 } 00821 00822 if (pNodeBlendPath == NULL) // if no blend node then there won't be a blender 00823 return NULL; 00824 else 00825 pNodeBlend = (NodeBlend*)pNodeBlendPath->FindParent(); 00826 00827 ERROR2IF(!(pNodeBlend->IS_KIND_OF(NodeBlend)), FALSE, "Node is a not a NodeBlend"); 00828 return pNodeBlend; 00829 00830 }
|
|
|
To enable other classes to see which endpoint is currently selected for display.
Definition at line 1694 of file beztool.cpp. 01695 { 01696 return CurrentIndex; 01697 }
|
|
||||||||||||
|
Gets the index of the 'other' end of the line starting at the current index, accounting for closed and sub-paths.
Definition at line 4439 of file beztool.cpp. 04440 { 04441 if (pPath == NULL) 04442 { 04443 ERROR3("NULL path pointer"); 04444 return -1; 04445 } 04446 04447 // Get info on this subpath 04448 INT32 SubPathStart = Index; 04449 INT32 SubPathEnd = Index; 04450 pPath->FindStartOfSubPath(&SubPathStart); 04451 pPath->FindEndOfSubPath(&SubPathEnd); 04452 BOOL SubPathClosed = (pPath->GetVerbArray()[SubPathEnd] & PT_CLOSEFIGURE); 04453 04454 // If the sub-path is closed and we're at the end then we must skip to the start 04455 if (SubPathClosed && (Index == SubPathEnd) ) 04456 { 04457 if ((pPath->GetVerbArray()[SubPathStart+1] & ~PT_CLOSEFIGURE) == PT_LINETO) 04458 return SubPathStart+1; 04459 else 04460 return -1; 04461 } 04462 04463 // no worries about looping around ends of paths 04464 if ((Index < SubPathEnd) && ((pPath->GetVerbArray()[CurrentIndex+1] & ~PT_CLOSEFIGURE) == PT_LINETO) ) 04465 return Index+1; 04466 else 04467 return -1; 04468 }
|
|
||||||||||||
|
Gets the index of the 'other' end of the line ending at the current index, accounting for closed and sub-paths.
Definition at line 4393 of file beztool.cpp. 04394 { 04395 if (pPath == NULL) 04396 { 04397 ERROR3("NULL path pointer"); 04398 return -1; 04399 } 04400 04401 // Get info on this subpath 04402 INT32 SubPathStart = Index; 04403 INT32 SubPathEnd = Index; 04404 pPath->FindStartOfSubPath(&SubPathStart); 04405 pPath->FindEndOfSubPath(&SubPathEnd); 04406 BOOL SubPathClosed = (pPath->GetVerbArray()[SubPathEnd] & PT_CLOSEFIGURE); 04407 04408 // If the sub-path is closed and we're at the start then we must skip to the end 04409 if (SubPathClosed && (Index == SubPathStart) ) 04410 { 04411 if ((pPath->GetVerbArray()[SubPathEnd] & ~PT_CLOSEFIGURE) == PT_LINETO) 04412 return SubPathEnd; 04413 else 04414 return -1; 04415 } 04416 04417 // no worries about looping around ends of paths 04418 if ((Index > SubPathStart) && ((pPath->GetVerbArray()[CurrentIndex] & ~PT_CLOSEFIGURE) == PT_LINETO) ) 04419 return Index-1; 04420 else 04421 return -1; 04422 }
|
|
|
Called by the message handler to handle clicks on any of the bump buttons.
Definition at line 2502 of file beztool.cpp. 02503 { 02504 ERROR2IF(((CurrentNodePath == NULL) || (CurrentInkPath == NULL) || (&(CurrentNodePath->InkPath) != CurrentInkPath)), FALSE, "HandleClickOnBump found CurrentPath(s) was NULL"); 02505 // PathVerb* Verbs = CurrentInkPath->GetVerbArray(); 02506 // DocCoord* Coords = CurrentInkPath->GetCoordArray(); 02507 02508 UINT32 ChangeField = 0; // ID of edit field with value 02509 BOOL IsCoordChange = FALSE; // TRUE if is coord change 02510 BOOL IsLengthChange = FALSE; // TRUE if is line length change 02511 BOOL IsAngleChange = FALSE; // TRUE if is line angle change 02512 INT32 ChangeValue = 0; // Amount of change 02513 02514 // switch (GadgetID) 02515 if ( 02516 // Bumping the currently selected path endpoint 02517 (GadgetID == _R(IDC_PATH_BUMP_ENDX_LESS)) || 02518 (GadgetID == _R(IDC_PATH_BUMP_ENDX_MORE)) || 02519 (GadgetID == _R(IDC_PATH_BUMP_ENDY_LESS)) || 02520 (GadgetID == _R(IDC_PATH_BUMP_ENDY_MORE)) 02521 ) 02522 { 02523 ERROR2IF(CurrentIndex == -1, FALSE, "Attempt to nudge unspecified endpoint"); 02524 IsCoordChange = TRUE; 02525 // Set the coord nudge ammount 02526 if ((GadgetID == _R(IDC_PATH_BUMP_ENDY_LESS)) || (GadgetID == _R(IDC_PATH_BUMP_ENDX_MORE))) 02527 ChangeValue = OpNudge::GetNudgeStep(); 02528 else 02529 ChangeValue = -OpNudge::GetNudgeStep(); 02530 // Set the edit field 02531 if ((GadgetID == _R(IDC_PATH_BUMP_ENDX_LESS)) || (GadgetID == _R(IDC_PATH_BUMP_ENDX_MORE))) 02532 ChangeField = _R(IDC_PATH_EDIT_ENDPOINTX); 02533 else 02534 ChangeField = _R(IDC_PATH_EDIT_ENDPOINTY); 02535 } 02536 else if ( 02537 // Bumping the previous endpoint 02538 (GadgetID == _R(IDC_PATH_BUMP_FIRSTX_LESS)) || 02539 (GadgetID == _R(IDC_PATH_BUMP_FIRSTX_MORE)) || 02540 (GadgetID == _R(IDC_PATH_BUMP_FIRSTY_LESS)) || 02541 (GadgetID == _R(IDC_PATH_BUMP_FIRSTY_MORE)) 02542 ) 02543 { 02544 if (CurrentInkPath->FindPrevControlPoint(CurrentIndex) != -1) 02545 { 02546 // Bumping control point position 02547 IsCoordChange = TRUE; 02548 // Set the coord nudge ammount 02549 if ((GadgetID == _R(IDC_PATH_BUMP_FIRSTX_MORE)) || (GadgetID == _R(IDC_PATH_BUMP_FIRSTY_LESS))) 02550 ChangeValue = OpNudge::GetNudgeStep(); 02551 else 02552 ChangeValue = -OpNudge::GetNudgeStep(); 02553 // Set the edit field 02554 if ((GadgetID == _R(IDC_PATH_BUMP_FIRSTX_LESS)) || (GadgetID == _R(IDC_PATH_BUMP_FIRSTX_MORE))) 02555 ChangeField = _R(IDC_PATH_EDIT_FIRSTX); 02556 else 02557 ChangeField = _R(IDC_PATH_EDIT_FIRSTY); 02558 } 02559 else 02560 { 02561 if ((GadgetID == _R(IDC_PATH_BUMP_FIRSTX_LESS)) || (GadgetID == _R(IDC_PATH_BUMP_FIRSTX_MORE))) 02562 { 02563 // Change the length of the line by the bump amount 02564 IsLengthChange = TRUE; 02565 // Set the length nudge ammount 02566 if (GadgetID == _R(IDC_PATH_BUMP_FIRSTX_MORE)) 02567 ChangeValue = OpNudge::GetNudgeStep(); 02568 else 02569 ChangeValue = -OpNudge::GetNudgeStep(); 02570 ChangeField = _R(IDC_PATH_EDIT_FIRSTX); 02571 } 02572 else 02573 { 02574 // Change the angle of the line by the bump amount 02575 ERROR3IF((GadgetID != _R(IDC_PATH_BUMP_FIRSTY_LESS)) && (GadgetID != _R(IDC_PATH_BUMP_FIRSTY_MORE)),"What's that gadget?"); 02576 IsAngleChange = TRUE; 02577 // Set the angle nudge ammount 02578 if (GadgetID == _R(IDC_PATH_BUMP_FIRSTY_MORE)) 02579 ChangeValue = 5; 02580 else 02581 ChangeValue = -5; 02582 ChangeField = _R(IDC_PATH_EDIT_FIRSTY); 02583 } 02584 } 02585 } 02586 else if ( 02587 // Bumping the next endpoint 02588 (GadgetID == _R(IDC_PATH_BUMP_SECONDX_LESS)) || 02589 (GadgetID == _R(IDC_PATH_BUMP_SECONDX_MORE)) || 02590 (GadgetID == _R(IDC_PATH_BUMP_SECONDY_LESS)) || 02591 (GadgetID == _R(IDC_PATH_BUMP_SECONDY_MORE)) 02592 ) 02593 { 02594 if (CurrentInkPath->FindNextControlPoint(CurrentIndex) != -1) 02595 { 02596 // Bumping control point position 02597 IsCoordChange = TRUE; 02598 // Set the coord nudge ammount 02599 if ((GadgetID == _R(IDC_PATH_BUMP_SECONDX_MORE)) || (GadgetID == _R(IDC_PATH_BUMP_SECONDY_LESS))) 02600 ChangeValue = OpNudge::GetNudgeStep(); 02601 else 02602 ChangeValue = -OpNudge::GetNudgeStep(); 02603 // Set the edit field 02604 if ((GadgetID == _R(IDC_PATH_BUMP_SECONDX_LESS)) || (GadgetID == _R(IDC_PATH_BUMP_SECONDX_MORE))) 02605 ChangeField = _R(IDC_PATH_EDIT_SECONDX); 02606 else 02607 ChangeField = _R(IDC_PATH_EDIT_SECONDY); 02608 } 02609 else 02610 { 02611 if ((GadgetID == _R(IDC_PATH_BUMP_SECONDX_LESS)) || (GadgetID == _R(IDC_PATH_BUMP_SECONDX_MORE))) 02612 { 02613 // Change the length of the line by the bump amount 02614 IsLengthChange = TRUE; 02615 // Set the length nudge ammount 02616 if (GadgetID == _R(IDC_PATH_BUMP_SECONDX_MORE)) 02617 ChangeValue = OpNudge::GetNudgeStep(); 02618 else 02619 ChangeValue = -OpNudge::GetNudgeStep(); 02620 ChangeField = _R(IDC_PATH_EDIT_SECONDX); 02621 } 02622 else 02623 { 02624 // Change the angle of the line by the bump amount 02625 ERROR3IF((GadgetID != _R(IDC_PATH_BUMP_SECONDY_LESS)) && (GadgetID != _R(IDC_PATH_BUMP_SECONDY_MORE)),"What's that gadget?"); 02626 IsAngleChange = TRUE; 02627 // Set the angle nudge ammount 02628 if (GadgetID == _R(IDC_PATH_BUMP_SECONDY_MORE)) 02629 ChangeValue = 5; 02630 else 02631 ChangeValue = -5; 02632 ChangeField = _R(IDC_PATH_EDIT_SECONDY); 02633 } 02634 } 02635 } 02636 02637 // Now update the edit field 02638 BOOL Valid = TRUE; 02639 if (IsCoordChange || IsLengthChange) 02640 { 02641 // Read the current field value 02642 ERROR2IF(CurrentSpread == NULL, FALSE, "HandleClickOnBump found CurrentSpread was NULL"); 02643 DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread); 02644 ERROR2IF(pDimScale == NULL, FALSE, "NULL DimScalePtr"); 02645 String_32 FieldContents = GetStringGadgetValue(ChangeField, &Valid); 02646 MILLIPOINT CurrentPos = 0; 02647 02648 if (Valid) 02649 Valid = pDimScale->ConvertToMillipoints(FieldContents, &CurrentPos); 02650 if (Valid) 02651 { 02652 CurrentPos += ChangeValue; 02653 if (IsLengthChange && (CurrentPos<0)) 02654 CurrentPos = 0; 02655 02656 // Put this new value back into the edit field. 02657 SetEditLength(ChangeField, CurrentPos, CurrentSpread, TRUE); 02658 } 02659 } 02660 else if (IsAngleChange) 02661 { 02662 // Read the current field value 02663 double RequiredAngle = GetDoubleGadgetValue(ChangeField, -360.0, 360.0, _R(IDE_INVALID_ANGLE), &Valid); 02664 if (Valid) 02665 { 02666 RequiredAngle += ChangeValue; 02667 02668 // Get the angle to lie between -180 and 180 02669 while (RequiredAngle < -180) 02670 RequiredAngle += 360; 02671 while (RequiredAngle > 180) 02672 RequiredAngle -= 360; 02673 02674 SetDoubleGadgetValue(ChangeField, RequiredAngle); 02675 } 02676 } 02677 02678 return TRUE; 02679 }
|
|
|
Called by the message handler to handle clicks on the curve button on the infobar.
Definition at line 2230 of file beztool.cpp. 02231 { 02232 if (pBezTool==NULL) 02233 return; 02234 02235 if (pBezTool->CurrentToolMode != BezierTool::Change) 02236 { 02237 pBezTool->CreateCurve = TRUE; 02238 } 02239 else 02240 { 02241 02242 SelRange* Selected = GetApplication()->FindSelection(); 02243 if (Selected != NULL) 02244 { 02245 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpMakeSegmentsCurves)); 02246 if (pOpDesc != NULL) 02247 { 02248 OpState State = OpMakeSegmentsCurves::GetState(NULL,pOpDesc); 02249 if (!State.Greyed) 02250 pOpDesc->Invoke(); 02251 } 02252 } 02253 02254 if (AttributeManager::LastAttrAppliedBecomesCurrent) 02255 pBezTool->CreateCurve = TRUE; 02256 } 02257 UpdateLineButton(); 02258 UpdateCurveButton(); 02259 UpdateCuspButton(); 02260 UpdateSmoothButton(); 02261 }
|
|
|
Called by the message handler to handle clicks on the cusp button on the infobar.
Definition at line 2466 of file beztool.cpp. 02467 { 02468 if (pBezTool==NULL) 02469 return; 02470 02471 if (pBezTool->CurrentToolMode != BezierTool::Change) 02472 { 02473 pBezTool->CreateCusp = TRUE; 02474 } 02475 else 02476 { 02477 BOOL Smooth = TRUE; 02478 BOOL Cusp = TRUE; 02479 02480 if (ScanPointsForJoins(&Smooth, &Cusp)) 02481 ScanPointsForToggleSmooth(FALSE, !WithConstrain); // invert WithConstrain 02482 02483 if (AttributeManager::LastAttrAppliedBecomesCurrent) 02484 pBezTool->CreateCusp = TRUE; 02485 } 02486 UpdateCuspButton(); 02487 UpdateSmoothButton(); 02488 }
|
|
|
Called by the message handler to handle clicks on the arrow extends button on the infobar.
Definition at line 2301 of file beztool.cpp. 02302 { 02303 // invoke the op 02304 #ifdef ARROWHEADS 02305 OpDescriptor * pOpDesc = 02306 OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpChangeEndArrowExtendsDesc)); 02307 02308 if (pOpDesc) 02309 { 02310 pOpDesc->Invoke(); 02311 } 02312 #endif 02313 }
|
|
|
Called by the message handler to handle clicks on the line button on the infobar.
Definition at line 2327 of file beztool.cpp. 02328 { 02329 if (pBezTool==NULL) 02330 return; 02331 02332 if (pBezTool->CurrentToolMode != BezierTool::Change) 02333 { 02334 pBezTool->CreateCurve = FALSE; 02335 } 02336 else 02337 { 02338 SelRange* Selected = GetApplication()->FindSelection(); 02339 if (Selected != NULL) 02340 { 02341 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpMakeSegmentsLines)); 02342 if (pOpDesc != NULL) 02343 { 02344 OpState State = OpMakeSegmentsLines::GetState(NULL,pOpDesc); 02345 if (!State.Greyed) 02346 pOpDesc->Invoke(); 02347 } 02348 } 02349 02350 if (AttributeManager::LastAttrAppliedBecomesCurrent) 02351 pBezTool->CreateCurve = FALSE; 02352 } 02353 02354 UpdateLineButton(); 02355 UpdateCurveButton(); 02356 UpdateCuspButton(); 02357 UpdateSmoothButton(); 02358 }
|
|
|
Called by the message handler to handle clicks on the reverse path button on the infobar.
Definition at line 2375 of file beztool.cpp. 02376 { 02377 if (pBezTool==NULL) 02378 { 02379 return; 02380 } 02381 02382 /* if (pBezTool->CurrentToolMode != BezierTool::Change) 02383 { 02384 pBezTool->CreateCurve = FALSE; 02385 } 02386 else 02387 {*/ 02388 02389 // if this function is called - then the button MUST be enabled (thereby proving that we 02390 // have a selection). BUT lets just make sure of this fact .... 02391 02392 SelRange* Selected = GetApplication()->FindSelection(); 02393 02394 if (Selected != NULL) 02395 { 02396 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor (CC_RUNTIME_CLASS (OpReversePath)); 02397 02398 if (pOpDesc != NULL) 02399 { 02400 OpState State = OpReversePath::GetState (NULL, pOpDesc); 02401 02402 if (!State.Greyed) 02403 { 02404 pOpDesc->Invoke (); 02405 } 02406 } 02407 } 02408 02409 /* if (AttributeManager::LastAttrAppliedBecomesCurrent) 02410 { 02411 pBezTool->CreateCurve = FALSE; 02412 }*/ 02413 //} 02414 }
|
|
|
Called by the message handler to handle clicks on the smooth button on the infobar.
Definition at line 2430 of file beztool.cpp. 02431 { 02432 if (pBezTool==NULL) 02433 return; 02434 02435 if (pBezTool->CurrentToolMode != BezierTool::Change) 02436 { 02437 pBezTool->CreateCusp = FALSE; 02438 } 02439 else 02440 { 02441 BOOL Smooth; 02442 BOOL Cusp; 02443 02444 if (ScanPointsForJoins(&Smooth, &Cusp)) 02445 ScanPointsForToggleSmooth(TRUE, FALSE); 02446 02447 if (AttributeManager::LastAttrAppliedBecomesCurrent) 02448 pBezTool->CreateCusp = FALSE; 02449 } 02450 UpdateCuspButton(); 02451 UpdateSmoothButton(); 02452 }
|
|
|
Called by the message handler to handle clicks on the arrow extends button on the infobar.
Definition at line 2275 of file beztool.cpp. 02276 { 02277 // invoke the op 02278 #ifdef ARROWHEADS 02279 OpDescriptor * pOpDesc = 02280 OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpChangeStartArrowExtendsDesc)); 02281 02282 if (pOpDesc) 02283 { 02284 pOpDesc->Invoke(); 02285 } 02286 #endif 02287 }
|
|
||||||||||||||||||||||||
|
Common code for handling a commit in a pait of edit fields that contain a coordinate. If the fields haven't been edited then no change is required.
Definition at line 4094 of file beztool.cpp. 04096 { 04097 // Exit now if there is no infobar 04098 if (WindowID == NULL) 04099 return TRUE; 04100 04101 // Check parameters and member variables 04102 ERROR2IF(((CurrentNodePath == NULL) || (CurrentInkPath == NULL)), FALSE, "HandleCoordFieldCommit found CurrentPath was NULL"); 04103 ERROR2IF(&(CurrentNodePath->InkPath) != CurrentInkPath, FALSE, "HandleCoordFieldCommit found InkPath/NodePath mismatch"); 04104 ERROR2IF(CurrentSpread == NULL, FALSE, "HandleCoordFieldCommit found CurrentSpread was NULL"); 04105 ERROR2IF(Index < 0, FALSE, "-ve index supplied to HandleCoordFieldCommit"); 04106 ERROR2IF(Index >= CurrentInkPath->GetNumCoords(), FALSE, "index supplied to HandleCoordFieldCommit was too large"); 04107 04108 DocCoord PreviousPos = CurrentInkPath->GetCoordArray()[Index]; 04109 *NewPos = PreviousPos; 04110 BOOL FieldsValid = TRUE; 04111 04112 // Work out what the fields showed before the edit 04113 String_256 OldXText; 04114 String_256 OldYText; 04115 if (!CurrentSpread->SpreadCoordToText(&OldXText, &OldYText, PreviousPos)) 04116 return FALSE; 04117 04118 // And what is actually in them now 04119 String_256 NewXText; 04120 String_256 NewYText; 04121 DocCoord NewPosition; 04122 NewXText = GetStringGadgetValue(UpperID, &FieldsValid); 04123 if (FieldsValid) 04124 NewYText = GetStringGadgetValue(LowerID, &FieldsValid); 04125 if (FieldsValid) 04126 FieldsValid = CurrentSpread->TextToSpreadCoord(&NewPosition, &NewXText, &NewYText); 04127 04128 // Update the coord 04129 if (FieldsValid) 04130 { 04131 if (OldXText != NewXText) 04132 NewPos->x = NewPosition.x; 04133 if (OldYText != NewYText) 04134 NewPos->y = NewPosition.y; 04135 } 04136 04137 *Valid = FieldsValid; 04138 04139 return TRUE; 04140 }
|
|
|
Called by the message handler when RETURN is pressed in one of the point position edit fields.
Definition at line 2697 of file beztool.cpp. 02698 { 02699 ERROR2IF(((CurrentNodePath == NULL) || (CurrentInkPath == NULL)), FALSE, "HandleEditFieldCommit found CurrentPath was NULL"); 02700 ERROR2IF(CurrentSpread == NULL, FALSE, "HandleEditFieldCommit found CurrentSpread was NULL"); 02701 02702 // Get path info 02703 // const INT32 NumCoords = CurrentInkPath->GetNumCoords(); 02704 const INT32 FirstIndex = CurrentInkPath->FindPrevControlPoint(CurrentIndex); 02705 const INT32 SecondIndex = CurrentInkPath->FindNextControlPoint(CurrentIndex); 02706 DocCoord* Coords = CurrentInkPath->GetCoordArray(); 02707 02708 INT32 LineAnglePrevIndex = GetPrevLineIndex(CurrentInkPath, CurrentIndex); 02709 INT32 LineAngleNextIndex = GetNextLineIndex(CurrentInkPath, CurrentIndex); 02710 if (LineAnglePrevIndex==-2 || LineAngleNextIndex==-2) 02711 return FALSE; 02712 02713 BOOL Valid = TRUE; 02714 INT32 NumChanges = 0; 02715 ElementCoord NewPos[3]; 02716 02717 // Check the centre edit fields which is always the coordinate of the selected endpoint 02718 BOOL EndPointMoved = FALSE; 02719 DocCoord NewEndPoint; 02720 DocCoord OldEndPoint = Coords[CurrentIndex]; 02721 if (!HandleCoordFieldCommit(_R(IDC_PATH_EDIT_ENDPOINTX), _R(IDC_PATH_EDIT_ENDPOINTY), CurrentIndex, &NewEndPoint, &Valid)) 02722 return FALSE; 02723 if (Valid && (OldEndPoint != NewEndPoint)) 02724 { 02725 NewPos[NumChanges].Element = CurrentIndex; 02726 NewPos[NumChanges].Coordinate = NewEndPoint; 02727 NumChanges ++; 02728 EndPointMoved = TRUE; 02729 } 02730 02731 // Now check the left hand pair, either the previous control point OR length & angle to previous line 02732 if (Valid && 0==NumChanges) 02733 { 02734 if (FirstIndex != -1) 02735 { 02736 DocCoord NewLeftPoint; 02737 DocCoord OldLeftPoint = Coords[FirstIndex]; 02738 if (!HandleCoordFieldCommit(_R(IDC_PATH_EDIT_FIRSTX), _R(IDC_PATH_EDIT_FIRSTY), FirstIndex, &NewLeftPoint, &Valid)) 02739 return FALSE; 02740 if (Valid && (OldLeftPoint != NewLeftPoint)) 02741 { 02742 NewPos[NumChanges].Element = FirstIndex; 02743 NewPos[NumChanges].Coordinate = NewLeftPoint; 02744 NumChanges ++; 02745 } 02746 } 02747 else 02748 { 02749 if (LineAnglePrevIndex!=-1) 02750 { 02751 DocCoord OtherEnd = Coords[LineAnglePrevIndex]; 02752 DocCoord NewLoc = OldEndPoint; 02753 if (!HandleLAFieldCommit(_R(IDC_PATH_EDIT_FIRSTX), _R(IDC_PATH_EDIT_FIRSTY), CommitField, OldEndPoint, OtherEnd, &NewLoc)) 02754 return FALSE; 02755 02756 if (NewLoc != Coords[CurrentIndex]) 02757 { 02758 NewPos[NumChanges].Element = CurrentIndex; 02759 NewPos[NumChanges].Coordinate = NewLoc; 02760 NumChanges++; 02761 } 02762 } 02763 } 02764 } 02765 02766 // Now check the right hand pair 02767 if (Valid && 0==NumChanges) 02768 { 02769 if (SecondIndex != -1) 02770 { 02771 DocCoord NewRightPoint; 02772 DocCoord OldRightPoint = Coords[SecondIndex]; 02773 if (!HandleCoordFieldCommit(_R(IDC_PATH_EDIT_SECONDX), _R(IDC_PATH_EDIT_SECONDY), SecondIndex, &NewRightPoint, &Valid)) 02774 return FALSE; 02775 if (Valid && (OldRightPoint != NewRightPoint)) 02776 { 02777 NewPos[NumChanges].Element = SecondIndex; 02778 NewPos[NumChanges].Coordinate = NewRightPoint; 02779 NumChanges ++; 02780 } 02781 } 02782 else 02783 { 02784 if (LineAngleNextIndex!=-1) 02785 { 02786 DocCoord OtherEnd = Coords[LineAngleNextIndex]; 02787 DocCoord NewLoc = OldEndPoint; 02788 if (!HandleLAFieldCommit(_R(IDC_PATH_EDIT_SECONDX), _R(IDC_PATH_EDIT_SECONDY), CommitField, OldEndPoint, OtherEnd, &NewLoc)) 02789 return FALSE; 02790 02791 if (NewLoc != Coords[CurrentIndex]) 02792 { 02793 NewPos[NumChanges].Element = CurrentIndex; 02794 NewPos[NumChanges].Coordinate = NewLoc; 02795 NumChanges++; 02796 } 02797 } 02798 } 02799 } 02800 02801 // Now fire off a MovePoints operation to do the movement with undo. 02802 if (Valid) 02803 { 02804 if (NumChanges > 0) 02805 { 02806 // Accumulate the bounds of the changed point[s] 02807 DocRect NewBounds(NewPos[0].Coordinate.x, NewPos[0].Coordinate.y, 02808 NewPos[0].Coordinate.x, NewPos[0].Coordinate.y); 02809 02810 for (INT32 loop = 1; loop < NumChanges; loop++) 02811 NewBounds.IncludePoint(NewPos[loop].Coordinate); 02812 02813 // Expand the pasteboard as necessary to include any moved points 02814 // If this doesn't work, we'll tell the user below that the points still fall off 02815 // the available pasteboard area. 02816 BOOL AllOK = CurrentSpread->ExpandPasteboardToInclude(NewBounds); 02817 02818 // Check that the new coords are on the spread 02819 DocRect SpreadBounds = CurrentSpread->GetPasteboardRect(FALSE); 02820 SpreadBounds = SpreadBounds.ToSpread(CurrentSpread, DocView::GetSelected()); 02821 02822 if (AllOK) 02823 { 02824 MovePointsParams MoveParams(CurrentNodePath, NewPos, NumChanges); 02825 02826 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpMovePathPoint)); 02827 if (pOpDesc != NULL) 02828 { 02829 // Invoke the operation 02830 pOpDesc->Invoke(&MoveParams); 02831 02832 // If the endpoint has been moved then scroll to show it 02833 if (EndPointMoved == TRUE) 02834 { 02835 DocView* pDocView = DocView::GetSelected(); 02836 if (pDocView != NULL) 02837 { 02838 pDocView->ScrollToShowWithMargin(&NewEndPoint); 02839 } 02840 } 02841 } 02842 } 02843 else 02844 { 02845 Error::SetError(_R(IDE_MOVEPOINTSOFFSPREAD)); 02846 InformError(); 02847 UpdatePositionFields(); 02848 } 02849 } 02850 } 02851 else 02852 { 02853 // Positions were not correct. Inform user and reset 02854 Error::SetError(_R(IDE_PATHMOVE_DUFFFIELD)); 02855 InformError(); 02856 UpdatePositionFields(); 02857 } 02858 return TRUE; 02859 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 3970 of file beztool.cpp. 03972 { 03973 // Set return value to sensible value 03974 *Result = SelectedPoint; 03975 03976 // Exit now if there is no infobar 03977 if (WindowID == NULL) 03978 return TRUE; 03979 03980 // if the commited ID was not one of the two fields then exit 03981 if ((CommitID!=LengthID) && (CommitID!=AngleID)) 03982 return TRUE; 03983 03984 DimScale* pDimScale = DimScale::GetPtrDimScale((Node |