BezToolInfoBarOp Class Reference

Class for handling the bezier tool's information bar. More...

#include <beztool.h>

Inheritance diagram for BezToolInfoBarOp:

InformationBarOp DialogBarOp DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

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.
NodeBlendGetBlendOnCurve ()
 To determine if the current selection is a blend on a curve.

Public Attributes

BezierToolpBezTool

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
NodePathCurrentNodePath
PathCurrentInkPath
SpreadCurrentSpread
BOOL IgnoreNextUpdate
INT32 LastShownPrevLength
INT32 LastShownNextLength

Friends

class BezierTool

Detailed Description

Class for handling the bezier tool's information bar.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/94

Definition at line 162 of file beztool.h.


Constructor & Destructor Documentation

BezToolInfoBarOp::BezToolInfoBarOp ResourceID  r = _R(IDD_BEZTOOLBAR)  )  [inline]
 

Definition at line 167 of file beztool.h.

00167 {DlgResID = r;}             // Dummy default constructor for DYNCREATE


Member Function Documentation

BOOL BezToolInfoBarOp::CheckClassData  ) 
 

Definition at line 4142 of file beztool.cpp.

04143 {
04144     if ((CurrentNodePath) && (CurrentInkPath) && (CurrentSpread))
04145     {
04146         return (TRUE);
04147     }
04148     return (FALSE);
04149 }

void BezToolInfoBarOp::EnableControls  ) 
 

double BezToolInfoBarOp::GetAngle DocCoord  Origin,
DocCoord  Offset
[protected]
 

Common code for calculating the angle between two endpoints.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/1/95
Parameters:
Origin - the point to calculate the angle around [INPUTS] Offset - a point on the line to calculate the angle for
- [OUTPUTS]
Returns:
The angle (in radians) from the positive x-axis and the line

Errors: -

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 }

NodeBlend * BezToolInfoBarOp::GetBlendOnCurve  ) 
 

To determine if the current selection is a blend on a curve.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : - outputs: returns: pointer to the first nodeblend in the selection if successful, NULL otherwise
NOTE this function exists for the purposes of getting the editing of paths of blends on a curve to work. it should probably be located elsewhere but for the time being...

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 }

INT32 BezToolInfoBarOp::GetCurrentIndex  )  [protected]
 

To enable other classes to see which endpoint is currently selected for display.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/11/94
Parameters:
- [INPUTS]
Returns:
The index of the Endpoint currently being displayed in the infobar.

Definition at line 1694 of file beztool.cpp.

01695 {
01696     return CurrentIndex;
01697 }

INT32 BezToolInfoBarOp::GetNextLineIndex Path pPath,
INT32  Index
[protected]
 

Gets the index of the 'other' end of the line starting at the current index, accounting for closed and sub-paths.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/1/96
Parameters:
pPath - points to the path [INPUTS] Index - the index of the current endpoint
- [OUTPUTS]
Returns:
The index of the next line endpoint, -1 if there isn't one
See also:
INT32 BezToolInfoBarOp::GetPrevLineIndex()

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 }

INT32 BezToolInfoBarOp::GetPrevLineIndex Path pPath,
INT32  Index
[protected]
 

Gets the index of the 'other' end of the line ending at the current index, accounting for closed and sub-paths.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/1/96
Parameters:
pPath - points to the path [INPUTS] Index - the index of the current endpoint
- [OUTPUTS]
Returns:
The index of the previous line endpoint, -1 if there isn't one, -2 for error
See also:
INT32 BezToolInfoBarOp::GetNextLineIndex()

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 }

BOOL BezToolInfoBarOp::HandleBumpClick CGadgetID  GadgetID  )  [protected]
 

Called by the message handler to handle clicks on any of the bump buttons.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/95
Parameters:
GadgetID - the gadget ID of the clicked bump button [INPUTS]
Returns:
TRUE/FALSE for success/failure

Errors: If an invalid gadget code is detected or if current path is NULL

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 }

void BezToolInfoBarOp::HandleClickOnCurveButton  )  [protected]
 

Called by the message handler to handle clicks on the curve button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/94
Parameters:
- [INPUTS]
Returns:
-

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 }

void BezToolInfoBarOp::HandleClickOnCuspButton BOOL  WithConstrain  )  [protected]
 

Called by the message handler to handle clicks on the cusp button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/94
Parameters:
WithConstrain - TRUE if the control points should not be moved [INPUTS]
Returns:
-

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 }

void BezToolInfoBarOp::HandleClickOnEndArrowButton  )  [protected]
 

Called by the message handler to handle clicks on the arrow extends button on the infobar.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/2/99
Parameters:
- [INPUTS]
Returns:
-

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 }

void BezToolInfoBarOp::HandleClickOnLineButton  )  [protected]
 

Called by the message handler to handle clicks on the line button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/94
Parameters:
- [INPUTS]
Returns:
-

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 }

void BezToolInfoBarOp::HandleClickOnReversePathButton  )  [protected]
 

Called by the message handler to handle clicks on the reverse path button on the infobar.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
Parameters:
- [INPUTS]
Returns:
-

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 }

void BezToolInfoBarOp::HandleClickOnSmoothButton  )  [protected]
 

Called by the message handler to handle clicks on the smooth button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/94
Parameters:
- [INPUTS]
Returns:
-

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 }

void BezToolInfoBarOp::HandleClickOnStartArrowButton  )  [protected]
 

Called by the message handler to handle clicks on the arrow extends button on the infobar.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/2/99
Parameters:
- [INPUTS]
Returns:
-

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 }

BOOL BezToolInfoBarOp::HandleCoordFieldCommit UINT32  UpperID,
UINT32  LowerID,
INT32  Index,
DocCoord NewPos,
BOOL *  Valid
[protected]
 

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.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/95
Parameters:
UpperID - the resource ID of the upper edit field (X pos) [INPUTS] LowerID - the resource IS of the lower edit field (Y pos) Index - the index of the cordinate being edited.
NewPos - DocCoord set to the new coordinate [OUTPUTS] Valid - TRUE/FALSE if the coord is valid (ie edit fields were ok)
Returns:
TRUE/FALSE for success/failure

Errors: -

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 }

BOOL BezToolInfoBarOp::HandleEditFieldCommit CGadgetID  CommitField  )  [protected]
 

Called by the message handler when RETURN is pressed in one of the point position edit fields.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/10/1994
Parameters:
CommitField is the gadget code of the field that was committed [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the fields were read sucessfully, FALSE if they wern't

Errors: Checks if CurrentPath and CurrentSpread are not NULL.

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 }

BOOL BezToolInfoBarOp::HandleLAFieldCommit CGadgetID  ,
CGadgetID  ,
CGadgetID  ,
DocCoord  ,
DocCoord  ,
DocCoord
[protected]
 

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*) CurrentSpread);
03985     ERROR2IF(pDimScale == NULL, FALSE, "NULL DimScalePtr");
03986 
03987     // See what the edit fields were showing before the edit
03988     String_256 OldLength;
03989     String_256 OldAngle;
03990     const INT32 OldLengthVal = (INT32)(SelectedPoint.Distance(UnselectedPoint));
03991     const double OldAngleVal = GetAngle(UnselectedPoint, SelectedPoint)*(180/PI);
03992     pDimScale->ConvertToUnits((INT32) OldLengthVal, &OldLength);
03993     if (!Convert::DoubleToString(OldAngleVal, &OldAngle))
03994         return FALSE;
03995 
03996     // Get the current edit field strings
03997     INT32 RequiredLength = 0;
03998     double RequiredAngle = 0;
03999     BOOL Valid = TRUE;
04000     String_16 NewLength;
04001     String_16 NewAngle;
04002     if (Valid)
04003         NewLength = GetStringGadgetValue(LengthID, &Valid);
04004     if (Valid)
04005         NewAngle = GetStringGadgetValue(AngleID, &Valid);
04006 
04007     // Get the required length
04008     if (Valid && (NewLength != OldLength))
04009         Valid = pDimScale->ConvertToMillipoints(NewLength, &RequiredLength); 
04010     else
04011         RequiredLength = OldLengthVal;
04012 
04013     // Get the required angle
04014     if (Valid && (NewAngle != OldAngle))
04015     {
04016         RequiredAngle = GetDoubleGadgetValue(AngleID, -360.0, 360.0, _R(IDE_INVALID_ANGLE), &Valid);
04017         if (Valid)
04018         {
04019             // Get the angle to lie between -180 and 180
04020             while (RequiredAngle < -180)
04021                 RequiredAngle += 360;
04022             while (RequiredAngle > 180)
04023                 RequiredAngle -= 360;
04024         }
04025 
04026         // Flip the angle around
04027         RequiredAngle -= 180;
04028         if (RequiredAngle < -180)
04029             RequiredAngle += 360;
04030     }
04031     else
04032         RequiredAngle = OldAngleVal;
04033 
04034 
04035     // Generate a new position if fields have been edited
04036     if (Valid && ((RequiredLength != OldLengthVal) || (RequiredAngle != OldAngleVal)))
04037     {
04038         DocCoord NewLoc(0,0);
04039         RequiredAngle = RequiredAngle * (PI/180);
04040 
04041         NewLoc.x = (INT32)(RequiredLength*cos(RequiredAngle));
04042         NewLoc.y = (INT32)(RequiredLength*sin(RequiredAngle));
04043         *Result = UnselectedPoint + NewLoc;
04044     }
04045 
04046     return TRUE;
04047 }

MsgResult BezToolInfoBarOp::InfobarMessage Msg Message  )  [protected]
 

Deals with messages sent to the Shape editor tools infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/95
Parameters:
Msg - points to the message [INPUTS]
- [OUTPUTS]
Returns:
MsgResult code

Errors: -

See also:
MsgResult

Definition at line 4164 of file beztool.cpp.

04165 {
04166     ERROR2IF(!(IS_OUR_DIALOG_MSG(Message)), FAIL, "Message not sent to the shape editor infobar");
04167     ERROR2IF(pBezTool==NULL, FAIL, "NULL tool pointer");
04168 
04169     DialogMsg* Msg = (DialogMsg*)Message;
04170 
04171     if (Msg->DlgMsg == DIM_CANCEL)
04172     {
04173         Close();
04174     }
04175     else if (Msg->DlgMsg == DIM_CREATE)
04176     {
04177         // Set the range of the slider control
04178         SetGadgetRange(_R(IDC_SMOOTHSLIDER), 0, 100, 1);
04179         SetGadgetBitmaps(_R(IDC_SMOOTHSLIDER), _R(IDB_QUALITYBASE), _R(IDB_QUALITYSLIDER));
04180         SetLongGadgetValue(_R(IDC_SMOOTHSLIDER), 0);
04181         
04182         // Set the percentage string
04183         TCHAR Str[32];
04184         String_32 jcf(_R(IDS_PERCENT_FORMAT));
04185         camSnprintf(Str, 31, jcf, (INT32) 0);
04186         String_32 PercentStr(Str);
04187         SetStringGadgetValue(_R(IDC_SMOOTHPERCENT), PercentStr);
04188 
04189         // Update all the buttons
04190         UpdateTextIndicator();  
04191         UpdateLineButton();
04192         UpdateCurveButton();
04193         UpdateReversePathsButton ();
04194         UpdateSmoothButton();
04195         UpdateCuspButton();
04196         UpdatePositionFields();
04197     }
04198     else if (Msg->DlgMsg == DIM_SELECTION_CHANGED)
04199     {
04200         if (CheckClassData())
04201         {
04202             if (!HandleEditFieldCommit(Msg->GadgetID))
04203                 InformError();
04204         }
04205     }
04206     else if ((Msg->DlgMsg == DIM_LFT_BN_CLICKED) || (Msg->DlgMsg == DIM_LFT_BN_UP))
04207     {
04208         //switch (Msg->GadgetID)
04209     
04210         if (Msg->GadgetID == _R(IDC_BTN_MAKELINE))
04211         {
04212             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04213                 HandleClickOnLineButton();
04214         }
04215         else if (Msg->GadgetID == _R(IDC_BTN_MAKECURVE))
04216         {
04217             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04218                 HandleClickOnCurveButton();
04219         }
04220         else if (Msg->GadgetID == _R(IDC_BTN_SMOOTHPOINT))
04221         {
04222             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04223                 HandleClickOnSmoothButton();
04224         }
04225         else if (Msg->GadgetID == _R(IDC_BTN_CUSPPOINT))
04226         {
04227             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04228                 HandleClickOnCuspButton(KeyPress::IsConstrainPressed());
04229         }
04230         else if (
04231             (Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTX_LESS)) ||
04232             (Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTX_MORE)) ||
04233             (Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTY_LESS)) ||
04234             (Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTY_MORE)) ||
04235             (Msg->GadgetID == _R(IDC_PATH_BUMP_ENDX_LESS)) ||
04236             (Msg->GadgetID == _R(IDC_PATH_BUMP_ENDX_MORE)) ||
04237             (Msg->GadgetID == _R(IDC_PATH_BUMP_ENDY_LESS)) ||
04238             (Msg->GadgetID == _R(IDC_PATH_BUMP_ENDY_MORE)) ||
04239             (Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDX_LESS)) ||
04240             (Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDX_MORE)) ||
04241             (Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDY_LESS)) ||
04242             (Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDY_MORE))
04243             )
04244         {
04245             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04246             {
04247                 if (!HandleBumpClick(Msg->GadgetID))
04248                     InformError();
04249             }
04250             else
04251             {
04252                 if (Msg->DlgMsg == DIM_LFT_BN_UP)
04253                 {
04254                     if (CheckClassData ())
04255                     {
04256                         // Pretend the user has pressed return in the field
04257                         BOOL ok = TRUE;
04258                         if ((Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTX_LESS)) || (Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTX_MORE)))
04259                         {
04260                             ok = HandleEditFieldCommit(_R(IDC_PATH_EDIT_FIRSTX));
04261                         }
04262                         else if ((Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTY_LESS)) || (Msg->GadgetID == _R(IDC_PATH_BUMP_FIRSTY_MORE)))
04263                         {
04264                             ok = HandleEditFieldCommit(_R(IDC_PATH_EDIT_FIRSTY));
04265                         }
04266                         else if ((Msg->GadgetID == _R(IDC_PATH_BUMP_ENDX_LESS)) || (Msg->GadgetID == _R(IDC_PATH_BUMP_ENDX_MORE)))
04267                         {   
04268                             ok = HandleEditFieldCommit(_R(IDC_PATH_EDIT_ENDPOINTX));
04269                         }
04270                         else if ((Msg->GadgetID == _R(IDC_PATH_BUMP_ENDY_LESS)) || (Msg->GadgetID == _R(IDC_PATH_BUMP_ENDY_MORE)))
04271                         {
04272                             ok = HandleEditFieldCommit(_R(IDC_PATH_EDIT_ENDPOINTY));
04273                         }
04274                         else if ((Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDX_LESS)) || (Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDX_MORE)))
04275                         {
04276                             ok = HandleEditFieldCommit(_R(IDC_PATH_EDIT_SECONDX));
04277                         }
04278                         else if ((Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDY_LESS)) || (Msg->GadgetID == _R(IDC_PATH_BUMP_SECONDY_MORE)))
04279                         {
04280                             ok = HandleEditFieldCommit(_R(IDC_PATH_EDIT_SECONDY));
04281                         }
04282 
04283                         if (!ok)
04284                             InformError();
04285                     }
04286                 }
04287             }
04288         }
04289         else if (Msg->GadgetID == _R(IDC_BTN_BEZ_REVERSE_PATH))
04290         {
04291             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04292             {
04293                 HandleClickOnReversePathButton ();
04294             }
04295         }
04296 #ifdef ARROWHEADS
04297         else if (Msg->GadgetID == _R(IDC_BTN_BEZ_END_ARROW))
04298         {
04299             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04300             {
04301                 HandleClickOnEndArrowButton();
04302                 UpdateEndArrowButton();
04303             }
04304         }
04305         else if (Msg->GadgetID == _R(IDC_BTN_BEZ_START_ARROW))
04306         {
04307             if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
04308             {
04309                 HandleClickOnStartArrowButton();
04310                 UpdateStartArrowButton();
04311             }
04312         }
04313 #endif
04314     }
04315     else if (Msg->DlgMsg == DIM_SLIDER_POS_CHANGING)
04316     {
04317         // Messages to all the controls, handled individually
04318         if (Msg->GadgetID == _R(IDC_SMOOTHSLIDER))
04319         {
04320             // Find the current scrollers position
04321             TCHAR Str[32];
04322             BOOL Valid;
04323             INT32 Result = GetLongGadgetValue(_R(IDC_SMOOTHSLIDER), 0, 100, 0, &Valid);
04324 
04325             // Build the Percentage string and set it
04326             String_32 jcf(_R(IDS_PERCENT_FORMAT));
04327             camSnprintf(Str, 31, jcf, Result);
04328             String_32 PercentStr(Str);
04329             SetStringGadgetValue(_R(IDC_SMOOTHPERCENT), PercentStr);
04330 
04331             // Tell the bezier tool about the new smoothness
04332             if (Valid)
04333                 // Set the smoothness and resmooth the points if possible
04334                 pBezTool->RetroSmoothChanging(Result);
04335         }
04336     }
04337     else if (Msg->DlgMsg == DIM_SLIDER_POS_SET)
04338     {
04339         if (Msg->GadgetID == _R(IDC_SMOOTHSLIDER))
04340         {
04341             // Tell the tool that things are all finished with
04342             pBezTool->RetroSmoothFinished();
04343         }
04344     }
04345 
04346     return OK; 
04347 }

void BezToolInfoBarOp::InitControls  ) 
 

MsgResult BezToolInfoBarOp::Message Msg Message  )  [virtual]
 

Bezier tool info bar dialog message handler.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/94
Parameters:
Message,: The message to handle [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from InformationBarOp.

Definition at line 610 of file beztool.cpp.

00611 {
00612     if (IS_OUR_DIALOG_MSG(Message))
00613     {
00614         // Message aimed at out infobar
00615         MsgResult TempResult = BezToolInfoBarOp::InfobarMessage(Message);
00616         if (TempResult != OK)
00617             return TempResult;      
00618     }
00619     else if (MESSAGE_IS_A(Message,OpMsg))   // Check for undo/redo
00620     {
00621         if ( (((OpMsg*)Message)->MsgType == OpMsg::AFTER_UNDO) ||
00622                                         (((OpMsg*)Message)->MsgType == OpMsg::AFTER_REDO) )
00623         {
00624             if (pBezTool != NULL)
00625             {
00626                 pBezTool->SetModeFlag();
00627                 pBezTool->ResetRetroSlider();
00628             }
00629         }
00630     }
00631     else if (MESSAGE_IS_A(Message,SelChangingMsg)) 
00632     {
00633         if ( (((SelChangingMsg*)Message)->State == SelChangingMsg::SELECTIONCHANGED) ||
00634                          (((SelChangingMsg*)Message)->State == SelChangingMsg::NODECHANGED) )
00635         {
00636             if (pBezTool != NULL)
00637             {
00638                 pBezTool->SetModeFlag();
00639                 BezToolInfoBarOp::UpdateState();
00640                 pBezTool->ResetRetroSlider();
00641             }
00642         }
00643     }
00644     else if (MESSAGE_IS_A(Message,UnitMsg))     // Update the bar as someone has changd a unit
00645     {
00646         if (pBezTool != NULL)
00647         {
00648             pBezTool->SetModeFlag();
00649             BezToolInfoBarOp::UpdateState();
00650         }
00651     }
00652     else if (MESSAGE_IS_A(Message,DocChangingMsg)) 
00653     {                                                                           
00654         // Remove the floating endpoint from the old document
00655         DocChangingMsg* msg = (DocChangingMsg*)Message;
00656         if ((msg->State == DocChangingMsg::SELCHANGED) && pBezTool!=NULL && pBezTool->FloatingEndpoint)
00657         {
00658             if ((msg->pOldDoc != NULL) && (msg->pNewDoc != msg->pOldDoc) && !GetApplication()->CamelotIsDying())
00659             {
00660                 // Clear the floating endpoint condition
00661                 pBezTool->DontDrawOnClearMoveTo = TRUE;
00662                 pBezTool->RemoveFloater(&(pBezTool->MoveToPoint), pBezTool->MoveToSpread, msg->pOldDoc);
00663                 pBezTool->DontDrawOnClearMoveTo = FALSE;
00664             }
00665         }
00666     }
00667     else if (MESSAGE_IS_A(Message,DocViewMsg)) 
00668     {                                                                           
00669         DocViewMsg* msg = (DocViewMsg*) Message;
00670         BlobManager* pBlobManager = GetApplication()->GetBlobManager();
00671         ENSURE(pBlobManager, "Can't get BlobManager");
00672 
00673         // Render the floating endpoint off the old view just before it changes
00674         if (msg->State == DocViewMsg::SELABOUTTOCHANGE)
00675         {
00676             if (msg->pNewDocView!=NULL && pBezTool!=NULL)
00677                 pBlobManager->RenderToolBlobsOff(pBezTool, pBezTool->MoveToSpread, NULL);
00678         }
00679 
00680         // Render the floating endpoint onto the new view
00681         if (msg->State == DocViewMsg::SELCHANGED)
00682         {
00683             if (msg->pNewDocView!=NULL && pBezTool!=NULL)
00684                 pBlobManager->RenderToolBlobsOn(pBezTool, pBezTool->MoveToSpread, NULL);
00685         }
00686     }
00687     else if (MESSAGE_IS_A(Message,NewPathCreatedMsg)) 
00688     {
00689         // When this message arrives the OpNewPath is still active so we can insert an
00690         // InsertFloaterAction into its undo record.
00691         DocCoord OldPos;
00692         Spread*  OldpSpread;
00693         Document* OldpDoc;
00694         NewPathCreatedMsg* Msg = (NewPathCreatedMsg*)Message;
00695 
00696         if (pBezTool != NULL)
00697         {
00698             if (pBezTool->GetMoveTo(&OldpSpread, &OldPos, &OldpDoc))
00699             {
00700                 ERROR3IF((OldpDoc != Document::GetCurrent()),"Current doc was not doc with the floating endpoint!");
00701                 if (!InsertFloaterAction::DoInsert(Msg->CurrentOp, Msg->UndoActs, pBezTool, &OldPos, OldpSpread))
00702                 {
00703                     FailAndExecute();
00704                 }
00705             }
00706             pBezTool->ClearMoveTo();
00707         }
00708     }
00709     else if (MESSAGE_IS_A(Message,PathEditedMsg)) 
00710     {
00711         // We can use this message to update the edit fields in the infobar
00712         PathEditedMsg* Msg = (PathEditedMsg*)Message;
00713         CurrentSpread = Msg->EditSpread;
00714         CurrentNodePath = NULL;         // We will rely on updating on the SelChange message at the end of the drag
00715         CurrentInkPath = Msg->EditPath;
00716         CurrentIndex = Msg->EndPoint;
00717         UpdatePositionFields(TRUE, FALSE);
00718         
00719         /*
00720         // DY 27/9/99 if we are editing a blend on a path then update the number of blend steps
00721         NodeBlend* pNodeBlend = GetBlendOnCurve();
00722         if (pNodeBlend != NULL)
00723         {
00724             
00725             if (pNodeBlend->GetEditState() == EDIT_DISTANCE)
00726             {
00727                 UINT32 NumSteps = 0;
00728                 double StepDistance = pNodeBlend->GetStepDistance();
00729                 BOOL Valid = pNodeBlend->GetNumStepsFromDistance(StepDistance, &NumSteps);
00730                 if (Valid)
00731                 {
00732                     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLENDSTEPS);
00733                     if (pOpDesc != NULL)
00734                     {
00735                         OpParam Param((INT32)NumSteps,0);
00736                         pOpDesc->Invoke(&Param);
00737                     }
00738                             
00739                 }
00740             }
00741             else
00742                 pNodeBlend->UpdateStepDistance();
00743                 
00744         } */
00745 //      IgnoreNextUpdate = TRUE;
00746     }
00747 
00748     // Pass the message on
00749     return (DialogBarOp::Message(Message));
00750 }    

BOOL BezToolInfoBarOp::ScanPointsForJoins BOOL *  AllSmooth,
BOOL *  AllCusp
[protected]
 

Scan the selected points on all paths to see the type of the points.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/94
Parameters:
AllSmooth - pointer to a BOOL. [INPUTS] AllCusp - pointer to a BOOL.
Returns:
*AllSmooth is set to TRUE if all selected points are smooth. AllCusp is set to TRUE if all selected points are not smooth. FALSE if there are no selected objects, otherwise true

Definition at line 2907 of file beztool.cpp.

02908 {
02909     ERROR2IF(pBezTool==NULL, FALSE, "No tool pointer");
02910 
02911     SelRange*   Selected = GetApplication()->FindSelection();
02912     Node*       pNode = Selected->FindFirst();
02913     BOOL        FoundSome = FALSE;
02914 
02915     *AllSmooth = TRUE;
02916     *AllCusp = TRUE;
02917     
02918     while (pNode != NULL)
02919     {
02920         NodePath* pSelected = pBezTool->FindEditablePath(pNode);
02921 
02922         if (pSelected)
02923         {
02924             Path*   ThisPath = &(pSelected->InkPath);
02925             INT32   UsedSlots = ThisPath->GetNumCoords();
02926             PathFlags*  Flags = ThisPath->GetFlagArray();
02927 
02928             for (INT32 i=0; i<UsedSlots; i++)
02929             {
02930                 if (Flags[i].IsSelected && Flags[i].IsEndPoint)
02931                 {
02932                     if (Flags[i].IsRotate)
02933                         *AllCusp = FALSE;
02934                     else
02935                         *AllSmooth = FALSE;
02936                     FoundSome = TRUE;
02937                 }
02938             }
02939         }
02940         pNode = Selected->FindNext(pNode);
02941     }
02942     if (!FoundSome)
02943     {
02944         *AllSmooth = FALSE;
02945         *AllCusp = FALSE;
02946         return FALSE;
02947     }
02948     return TRUE;
02949 }

void BezToolInfoBarOp::ScanPointsForToggleSmooth BOOL  MakeSmooth,
BOOL  WithConstrain
[protected]
 

Called by the click handlers for the smooth and cusp buttons. Calls DoTogglePoint to do the work.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/94
Parameters:
MakeSmooth - TRUE if selected cusp points should be made smooth. [INPUTS] FALSE if selected smooth points should be made cusps. WithConstrain - TRUE if the control points should not be moved when making smooth cusp
Returns:
-
See also:
OpToggleSmooth::DoTogglePoint

Definition at line 2877 of file beztool.cpp.

02878 {
02879     OpToggleSmooth* pOpToggle = new OpToggleSmooth;
02880     if (!pOpToggle)
02881     {   // Inform the user that we are out of memory
02882         InformError();
02883     }
02884     else
02885     {   // Call the function that actually does something
02886         pOpToggle->DoTogglePoint(NULL, -1, NULL, MakeSmooth, WithConstrain);
02887     }
02888 }

BOOL BezToolInfoBarOp::SetEditLength CGadgetID  gid,
INT32  nValue,
Spread pSpread,
BOOL  PaintNow = FALSE
[protected]
 

Converts the given value to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-field.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/1/95
Parameters:
gid gadget identifier [INPUTS] nValue the value to set in the edit field (in millipoints pUnitSpread the spread containing the distance PaintNow - TRUE if the edit filed should be redrawn immediatly.
- [OUTPUTS]
Returns:
TRUE if everything suceeded, FALSE if an error occured

Errors: -

See also:
BezToolInfoBarOp::SetEditPosition

Definition at line 2108 of file beztool.cpp.

02109 {
02110     ERROR2IF(pSpread == NULL, FALSE, "Spread was NULL in SetEditLength");
02111 
02112     // Get the dimension scaling object (units) associated with the given spread
02113     // and convert to its units.
02114     DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) pSpread);
02115     ERROR2IF (pDimScale == NULL, FALSE, "Null DimScale* in SelectorInfoBarOp::SetEdit");
02116 
02117     // Convert to units & text and display.
02118     String_256 str;
02119     pDimScale->ConvertToUnits((INT32) nValue, &str);
02120 
02121     if (!UpdateStringGadgetValue(gid, &str))
02122         PaintNow = FALSE;
02123 
02124     if (PaintNow)
02125         PaintGadgetNow(gid);
02126 
02127     return TRUE;
02128 }

BOOL BezToolInfoBarOp::SetEditPosition CGadgetID  gidX,
CGadgetID  gidY,
DocCoord  loc,
Spread pSpread,
BOOL  PaintNow = FALSE
[protected]
 

Converts the given coordinate to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-fields.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/1/95
Parameters:
gidX - X coordinate gadget identifier [INPUTS] gidY - Y coordinate gadget identifier loc - the SpreadCoord to show in the edit fields pUnitSpread - the spread containing the object (so its units can be extracted). PaintNow - TRUE if the edit field should be redrawn immediatly.
- [OUTPUTS]
Returns:
TRUE if everything suceeded, FALSE if an error occured

Errors: -

See also:
-

Definition at line 2193 of file beztool.cpp.

02194 {
02195     ERROR2IF(pSpread == NULL, FALSE, "Current spread was NULL");
02196 
02197     String_256  XText;
02198     String_256  YText;
02199 
02200     pSpread->SpreadCoordToText(&XText, &YText, loc);
02201     BOOL UpdatedX = UpdateStringGadgetValue(gidX, &XText) ;
02202     BOOL UpdatedY = UpdateStringGadgetValue(gidY, &YText) ;
02203 
02204     if (PaintNow)
02205     {
02206         if (UpdatedX)
02207             PaintGadgetNow(gidX);
02208         if (UpdatedY)
02209             PaintGadgetNow(gidY);
02210     }
02211 
02212     return TRUE;
02213 }

BOOL BezToolInfoBarOp::SetEditPosition CGadgetID  gid,
INT32  nValue,
Spread pSpread,
BOOL  PaintNow = FALSE
[protected]
 

Converts the given value to the appropriate units, as contained in the spread, converts it to text and writes in into the edit-field.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> (copied from the selector tool by JustinF)
Date:
31/8/94
Parameters:
gid gadget identifier [INPUTS] nValue the value to set in the edit field (in millipoints pUnitSpread the spread containing the object (so its units can be extracted). If this parameter is NULL then no unit conversion is performed. PaintNow - TRUE if the edit filed should be redrawn immediatly.
- [OUTPUTS]
Returns:
TRUE if everything suceeded, FALSE if an error occured

Errors: -

See also:
SelectorInfoBarOp::SetEdit

Definition at line 2153 of file beztool.cpp.

02154 {
02155     ERROR2IF(pSpread == NULL, FALSE, "Current spread was NULL");
02156 
02157     DocCoord    FakePoint(nValue, 0);
02158     String_256  XText;
02159     String_256  YText;
02160 
02161     pSpread->SpreadCoordToText(&XText, &YText, FakePoint);
02162     if (!UpdateStringGadgetValue(gid, &XText))
02163         PaintNow = FALSE;
02164 
02165     if (PaintNow)
02166         PaintGadgetNow(gid);
02167 
02168     return TRUE;
02169 }

void BezToolInfoBarOp::UpdateCurveButton  )  [protected]
 

Sets the grey and select status of the curve button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/9/94
Parameters:
- [INPUTS]

Definition at line 1753 of file beztool.cpp.

01754 {
01755     // Exit now if there is no infobar
01756     if (WindowID==NULL || pBezTool==NULL)
01757         return;
01758 
01759     if (pBezTool->CurrentToolMode != BezierTool::Change)
01760     {
01761         SetLongGadgetValue(_R(IDC_BTN_MAKECURVE), pBezTool->CreateCurve, FALSE);
01762         EnableGadget(_R(IDC_BTN_MAKECURVE), TRUE);
01763     }
01764     else
01765     {
01766         OpState State = OpMakeSegmentsCurves::GetState(NULL, NULL);
01767 
01768         EnableGadget(_R(IDC_BTN_MAKECURVE), !State.Greyed);
01769         SetLongGadgetValue(_R(IDC_BTN_MAKECURVE), (State.Ticked==FALSE ? 0 : 1), FALSE);
01770     }
01771 }

void BezToolInfoBarOp::UpdateCuspButton  )  [protected]
 

Sets the grey and select status of the cusp button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/9/94
Parameters:
- [INPUTS]

Definition at line 1955 of file beztool.cpp.

01956 {
01957     // Exit now if there is no infobar
01958     if (WindowID==NULL || pBezTool==NULL)
01959         return;
01960 
01961     if (pBezTool->CurrentToolMode != BezierTool::Change)
01962     {
01963         SetLongGadgetValue(_R(IDC_BTN_CUSPPOINT), pBezTool->CreateCusp, FALSE);
01964         EnableGadget(_R(IDC_BTN_CUSPPOINT), TRUE);
01965     }
01966     else
01967     {
01968         BOOL    Smooth;
01969         BOOL    Cusp;
01970 
01971         if (ScanPointsForJoins(&Smooth, &Cusp))
01972         {
01973             SetLongGadgetValue(_R(IDC_BTN_CUSPPOINT), Cusp, FALSE);
01974             EnableGadget(_R(IDC_BTN_CUSPPOINT), TRUE);
01975         }
01976         else
01977         {
01978             SetLongGadgetValue(_R(IDC_BTN_CUSPPOINT), FALSE, FALSE);
01979             EnableGadget(_R(IDC_BTN_CUSPPOINT), FALSE);
01980         }
01981     }
01982 }

void BezToolInfoBarOp::UpdateEditFieldsFromPath Path pPath,
Spread pSpread,
INT32  Index,
BOOL  ForceUpdate,
BOOL  EnableData[18]
[protected]
 

void BezToolInfoBarOp::UpdateEndArrowButton  )  [protected]
 

Sets the grey and select status of the arrow extents button on the infobar.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/2/99
Parameters:
- [INPUTS]

Definition at line 1925 of file beztool.cpp.

01926 {
01927     // Exit now if there is no infobar
01928     if (WindowID==NULL || pBezTool==NULL)
01929         return;
01930 #ifdef ARROWHEADS
01931     if (pBezTool->CurrentToolMode != BezierTool::Change)
01932     {
01933         SetLongGadgetValue(_R(IDC_BTN_BEZ_END_ARROW), FALSE, FALSE);
01934         EnableGadget(_R(IDC_BTN_BEZ_END_ARROW), TRUE);
01935     }
01936     else
01937     {
01938         SetLongGadgetValue(_R(IDC_BTN_BEZ_END_ARROW), FALSE, FALSE);
01939         EnableGadget(_R(IDC_BTN_BEZ_END_ARROW), TRUE);  
01940     }
01941 #endif
01942 }

void BezToolInfoBarOp::UpdateLineButton  )  [protected]
 

Sets the grey and select status of the line button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/9/94
Parameters:
- [INPUTS]

Definition at line 1786 of file beztool.cpp.

01787 {
01788     // Exit now if there is no infobar
01789     if (WindowID==NULL || pBezTool==NULL)
01790         return;
01791 
01792     if (pBezTool->CurrentToolMode != BezierTool::Change)
01793     {
01794         SetLongGadgetValue(_R(IDC_BTN_MAKELINE), !pBezTool->CreateCurve, FALSE);
01795         EnableGadget(_R(IDC_BTN_MAKELINE), TRUE);
01796     }
01797     else
01798     {
01799         OpState State = OpMakeSegmentsLines::GetState(NULL, NULL);
01800 
01801         EnableGadget(_R(IDC_BTN_MAKELINE), !State.Greyed);
01802         SetLongGadgetValue(_R(IDC_BTN_MAKELINE), (State.Ticked==FALSE ? 0 : 1) , FALSE);
01803     }
01804 }

void BezToolInfoBarOp::UpdatePositionFields BOOL  ForceUpdate = FALSE,
BOOL  ScanForCurrent = TRUE
[protected]
 

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.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/10/1994
Parameters:
ScanForCurrent - TRUE to scan the SelRange to update CurrentPath, CurrentIndex, etc.. [INPUTS] FALSE to use the existing values

Definition at line 2000 of file beztool.cpp.

02001 {
02002     // Exit now if there is no infobar
02003     if (WindowID==NULL || pBezTool==NULL)
02004         return;
02005 
02006     INT32   SelectedPoints = 0;
02007     if (ScanForCurrent)
02008     {
02009         SelRange* Selection = GetApplication()->FindSelection();
02010         Node* pNode = Selection->FindFirst();
02011 
02012         while ( (pNode != NULL) && (SelectedPoints<2) )
02013         {
02014             NodePath* pSelected = pBezTool->FindEditablePath(pNode);
02015 
02016             if (pSelected)
02017             {
02018                 Path*   ThisPath = &(pSelected->InkPath);
02019                 INT32   UsedSlots = ThisPath->GetNumCoords();
02020                 PathFlags*  Flags = ThisPath->GetFlagArray();
02021                 PathVerb*   Verbs = ThisPath->GetVerbArray();
02022 
02023                 // Now scan the path and count the number of selected points
02024                 for (INT32 i=0; i<UsedSlots; i++)
02025                 {
02026                     if (Flags[i].IsSelected && Flags[i].IsEndPoint)
02027                     {
02028                         // if it's a closed path the first point is selected
02029                         // as well as the last. We have to account for this.
02030                         if (! ((Verbs[i] == PT_MOVETO) && ThisPath->IsSubPathClosed(i)) )
02031                         {
02032                             SelectedPoints++;
02033                             CurrentSpread = pSelected->FindParentSpread();
02034                             CurrentNodePath = pSelected;
02035                             CurrentInkPath = &(CurrentNodePath->InkPath);
02036                             CurrentIndex = i;
02037                         }
02038                     }
02039                 }
02040             }
02041             pNode = Selection->FindNext(pNode);
02042         }
02043     }
02044 
02045     String_8 NullString = _T("");
02046     BOOL EnableArray[NumberIconIDs];
02047     for (INT32 loop = 0; loop < NumberIconIDs; loop++)
02048         EnableArray[loop] = TRUE;
02049 
02050     if (IgnoreNextUpdate)
02051         IgnoreNextUpdate = FALSE;
02052     else
02053     {
02054         if ((SelectedPoints == 1) || !ScanForCurrent)
02055         {   // Enable and update things
02056             UpdateEditFieldsFromPath(CurrentInkPath, CurrentSpread, CurrentIndex, ForceUpdate, EnableArray);
02057 
02058             for (INT32 i = 0; i < NumberIconIDs; i++)
02059             {
02060                 EnableGadget(AllIconIDs[i], EnableArray[i]);
02061             }
02062         }
02063         else
02064         {   // Disable and clear everything
02065             CurrentNodePath = NULL;
02066             CurrentInkPath = NULL;
02067             for (INT32 loop = 0; loop < NumberIconIDs; loop++)
02068                 EnableArray[loop] = FALSE;
02069             SetStringGadgetValue(_R(IDC_PATH_EDIT_ENDPOINTX), NullString);
02070             SetStringGadgetValue(_R(IDC_PATH_EDIT_ENDPOINTY), NullString);
02071             SetStringGadgetValue(_R(IDC_PATH_EDIT_FIRSTX), NullString);
02072             SetStringGadgetValue(_R(IDC_PATH_EDIT_FIRSTY), NullString);
02073             SetStringGadgetValue(_R(IDC_PATH_EDIT_SECONDX), NullString);
02074             SetStringGadgetValue(_R(IDC_PATH_EDIT_SECONDY), NullString);
02075             SetStringGadgetValue(_R(IDC_PATH_STATIC_FIRSTX), NullString);
02076             SetStringGadgetValue(_R(IDC_PATH_STATIC_FIRSTY), NullString);
02077             SetStringGadgetValue(_R(IDC_PATH_STATIC_SECONDX), NullString);
02078             SetStringGadgetValue(_R(IDC_PATH_STATIC_SECONDY), NullString);
02079 
02080             for (INT32 i = 0; i < NumberIconIDs; i++)
02081             {
02082                 EnableGadget(AllIconIDs[i], FALSE);//EnableArray[i]);
02083             }
02084         }
02085     }
02086 }

void BezToolInfoBarOp::UpdateReversePathsButton  )  [protected]
 

Sets the grey and select status of the reverse paths button on the infobar.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/2000
Parameters:
- [INPUTS]

Definition at line 1819 of file beztool.cpp.

01820 {
01821     // Exit now if there is no infobar
01822     if (WindowID==NULL || pBezTool==NULL)
01823         return;
01824 
01825     /*if ((pBezTool->CurrentToolMode != BezierTool::Change) && (pBezTool->CurrentToolMode != BezierTool::Add))
01826     {
01827         SetLongGadgetValue(_R(IDC_BTN_BEZ_REVERSE_PATH), !pBezTool->CreateCurve, FALSE);
01828         EnableGadget(_R(IDC_BTN_BEZ_REVERSE_PATH), FALSE);
01829     }
01830     else
01831     {*/
01832         OpState State = OpReversePath::GetState(NULL, NULL);
01833 
01834         EnableGadget(_R(IDC_BTN_BEZ_REVERSE_PATH), !State.Greyed);
01835     //  SetLongGadgetValue(_R(IDC_BTN_BEZ_REVERSE_PATH), (State.Ticked==FALSE ? 0 : 1) , FALSE);
01836     //}
01837 }

void BezToolInfoBarOp::UpdateSmoothButton  )  [protected]
 

Sets the grey and select status of the smooth button on the infobar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/9/94
Parameters:
- [INPUTS]

Definition at line 1852 of file beztool.cpp.

01853 {
01854     // Exit now if there is no infobar
01855     if (WindowID==NULL || pBezTool==NULL)
01856         return;
01857 
01858     if (pBezTool->CurrentToolMode != BezierTool::Change)
01859     {
01860         SetLongGadgetValue(_R(IDC_BTN_SMOOTHPOINT), !pBezTool->CreateCusp, FALSE);
01861         EnableGadget(_R(IDC_BTN_SMOOTHPOINT), TRUE);
01862     }
01863     else
01864     {
01865         BOOL    Smooth;
01866         BOOL    Cusp;
01867 
01868         if (ScanPointsForJoins(&Smooth, &Cusp))
01869         {
01870             SetLongGadgetValue(_R(IDC_BTN_SMOOTHPOINT), Smooth, FALSE);
01871             EnableGadget(_R(IDC_BTN_SMOOTHPOINT), TRUE);
01872         }
01873         else
01874         {
01875             SetLongGadgetValue(_R(IDC_BTN_SMOOTHPOINT), FALSE, FALSE);
01876             EnableGadget(_R(IDC_BTN_SMOOTHPOINT), FALSE);
01877         }
01878     }
01879 }

void BezToolInfoBarOp::UpdateStartArrowButton  )  [protected]
 

Sets the grey and select status of the arrow extents button on the infobar.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/2/99
Parameters:
- [INPUTS]

Definition at line 1893 of file beztool.cpp.

01894 {
01895     // Exit now if there is no infobar
01896     if (WindowID==NULL || pBezTool==NULL)
01897         return;
01898 #ifdef ARROWHEADS
01899 
01900     if (pBezTool->CurrentToolMode != BezierTool::Change)
01901     {
01902         SetLongGadgetValue(_R(IDC_BTN_BEZ_START_ARROW), FALSE, FALSE);
01903         EnableGadget(_R(IDC_BTN_BEZ_START_ARROW), TRUE);
01904     }
01905     else
01906     {
01907         SetLongGadgetValue(_R(IDC_BTN_BEZ_START_ARROW), FALSE, FALSE);
01908         EnableGadget(_R(IDC_BTN_BEZ_START_ARROW), TRUE);    
01909     }
01910 
01911 #endif
01912 }

void BezToolInfoBarOp::UpdateState  )  [virtual]
 

Overrides the empty UpdateState function provided by InformationBarOp making a call to the function in DialogBarOp.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/94

Reimplemented from DialogBarOp.

Definition at line 765 of file beztool.cpp.

void BezToolInfoBarOp::UpdateTextIndicator  )  [protected]
 

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".

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/10/94
Parameters:
- [INPUTS]

Definition at line 1713 of file beztool.cpp.

01714 {
01715     // Exit now if there is no infobar
01716     if (WindowID==NULL || pBezTool==NULL)
01717         return;
01718 
01719     String_16 DisplayWord;
01720 
01721     switch (pBezTool->CurrentToolMode)
01722     {
01723         case BezierTool::New:
01724             DisplayWord.Load(_R(IDS_BEZTOOL_NEW),Tool::GetModuleID(pBezTool->GetID()));
01725             break;
01726         case BezierTool::Add:
01727             DisplayWord.Load(_R(IDS_BEZTOOL_ADD),Tool::GetModuleID(pBezTool->GetID()));
01728             break;
01729         case BezierTool::Change:
01730             DisplayWord.Load(_R(IDS_BEZTOOL_CHANGE),Tool::GetModuleID(pBezTool->GetID()));
01731             break;
01732         default:
01733             ERROR3("Unknown tool mode encountered");
01734     }
01735 
01736     SetStringGadgetValue(_R(IDC_BEZTOOLADDCHANGE), DisplayWord);
01737     PaintGadgetNow(_R(IDC_BEZTOOLADDCHANGE));
01738 }


Friends And Related Function Documentation

friend class BezierTool [friend]
 

Definition at line 164 of file beztool.h.


Member Data Documentation

INT32 BezToolInfoBarOp::CurrentIndex [private]
 

Definition at line 222 of file beztool.h.

Path* BezToolInfoBarOp::CurrentInkPath [private]
 

Definition at line 224 of file beztool.h.

NodePath* BezToolInfoBarOp::CurrentNodePath [private]
 

Definition at line 223 of file beztool.h.

Spread* BezToolInfoBarOp::CurrentSpread [private]
 

Definition at line 225 of file beztool.h.

BOOL BezToolInfoBarOp::IgnoreNextUpdate [private]
 

Definition at line 226 of file beztool.h.

INT32 BezToolInfoBarOp::LastShownNextLength [private]
 

Definition at line 228 of file beztool.h.

INT32 BezToolInfoBarOp::LastShownPrevLength [private]
 

Definition at line 227 of file beztool.h.

BezierTool* BezToolInfoBarOp::pBezTool
 

Definition at line 219 of file beztool.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:04 2007 for Camelot by  doxygen 1.4.4