ContourInfoBarOp Class Reference

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

#include <cntrtool.h>

Inheritance diagram for ContourInfoBarOp:

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

Public Member Functions

 ContourInfoBarOp ()
virtual void UpdateState ()
 Overrides the empty UpdateState function provided by InformationBarOp making a call to the function in DialogBarOp.
MsgResult Message (Msg *Msg)
 Blend info bar dialog message handler.
void SetSliderValue (UINT32 Width, BOOL bMany)
 Sets the slider & edit controls in the info bar.
void SetUpdateState (BOOL bUpdateState)
BOOL GetInsetPathFlag ()

Public Attributes

ContourToolm_pTool
BOOL m_BetweenViews
CBiasGainGadget m_BiasGainObjectGadget
CBiasGainGadget m_BiasGainAttrGadget

Private Member Functions

void ChangeBitmapButtonState (CGadgetID GadgetID, BOOL *CurrentState)
 utility used by ContourInfoBarOp::Message, if a button is depressed and clicked again then un-depress it For some reason the bitmap button custom control does not do this by itself..
void InitialiseObjectGainGadget (CGadgetID GadgetID, UINT32 BubbleID, UINT32 StatusID)
void InitialiseAttrGainGadget (CGadgetID GadgetID, UINT32 BubbleID, UINT32 StatusID)
void ChangeProfile (CProfileBiasGain *Profile, CGadgetID GadgetID)
 See InformationBarOp::ChangeProfile () for an explanation of this function. See Also: InformationBarOp::ChangeProfile ().
void ChangeProfileOnIdle (CProfileBiasGain *Profile, CGadgetID GadgetID)
 See InformationBarOp::ChangeProfileOnIdle () for an explanation of this function. See Also: InformationBarOp::ChangeProfileOnIdle ().
void DealWithContourOuterClick ()
 Deals with the contour outer button click message.
void DealWithContourInnerClick ()
 Deals with the contour inner button click message.
void DealWithWidthChange (UINT32 Width)
 Deals with the contour width changes without changing the direction of the contours.
void DealWithInsetPathClick ()
 Deals with the contour outer button click message.
BOOL ConvertValueToString (String_256 &In, const INT32 value, UnitType type=NOTYPE)
 TRUE if the function was able to convert the INT32 to a string.
BOOL ConvertStringToValue (CGadgetID ID, INT32 &value)
 TRUE if the function was able to convert the INT32 to a string See Also: ShadowBarOp::ConvertStringToValue().
void HandleJoinTypeMitreClicked ()
 Handles the user clicking on the mitre join-type button on our infobar.
void HandleJoinTypeRoundClicked ()
 Handles the user clicking on the round join-type button on our infobar.
void HandleJoinTypeBevelClicked ()
 Handles the user clicking on the bevel join-type button on our infobar.
void ChangeJoinType (JointType jt)
 Apply the given join type to the selection.
void UpdateJoinTypeControls ()
 Update our infobar join type buttons. This method is currently called only in response to a SelChanging message.
void EnableDisableJoinTypeControls ()
 Enable/disable the join type buttons on the info bar, according to the contents of the selection.
CProfileBiasGainGetProfileFromSelection (CGadgetID ProfileGadgetID, BOOL *bMany, BOOL *bAllSameType)
 See InformationBarOp::GetProfileFromSelection () for a description of this function.
MILLIPOINT GetSliderLogValue ()
 Sets the position of the slider given the value The slider is logarithmic - i.e. it uses the profile to set & retreive its values.
BOOL SetSliderLogValue (MILLIPOINT Width)
 Sets the position of the slider given the value The slider is logarithmic - i.e. it uses the profile to set & retreive its values.
void UpdateGadgetHelp ()
 Updates the help in this info bar.
BOOL CheckForBevels ()

Private Attributes

BOOL m_DetachBlendPath
BOOL m_EditBlendSteps
BOOL m_BlendAntiAlias
BOOL m_OneToOne
BOOL m_Tangential
BOOL m_BlendedOnCurve
Spreadm_BlobsSpread
BOOL m_bOuterIsSelected
BOOL m_bInnerIsSelected
BOOL m_bUpdateState
BOOL m_bDragging
MILLIPOINT m_LastDragWidth
BOOL m_bInsetPath

Detailed Description

Class for handling the tool's information bar.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/94 changed 16/9/99 Diccon Yamanaka

Definition at line 350 of file cntrtool.h.


Constructor & Destructor Documentation

ContourInfoBarOp::ContourInfoBarOp  )  [inline]
 

Definition at line 354 of file cntrtool.h.

00355     {   
00356         DlgResID = _R(IDD_CONTOURINFOBAR);
00357         m_DetachBlendPath = FALSE; 
00358         m_EditBlendSteps = TRUE; 
00359         m_BlendAntiAlias = TRUE; 
00360         m_OneToOne = FALSE; 
00361         m_Tangential = FALSE; 
00362         m_BlendedOnCurve = FALSE;
00363         m_bUpdateState = TRUE; 
00364         m_pTool = NULL;
00365         m_bDragging = FALSE;
00366         m_LastDragWidth = 0;
00367         m_bInsetPath = FALSE;
00368         m_bOuterIsSelected = TRUE;
00369     }


Member Function Documentation

void ContourInfoBarOp::ChangeBitmapButtonState CGadgetID  GadgetID,
BOOL *  CurrentState
[private]
 

utility used by ContourInfoBarOp::Message, if a button is depressed and clicked again then un-depress it For some reason the bitmap button custom control does not do this by itself..

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/99

Definition at line 3063 of file cntrtool.cpp.

03064 {
03065     /*BOOL test =*/  GetBoolGadgetSelected(GadgetID);
03066     if (!*CurrentState)
03067     {
03068         *CurrentState = TRUE;
03069     }
03070     else
03071     {
03072         *CurrentState = FALSE;
03073         SetLongGadgetValue(GadgetID, FALSE);
03074     }
03075     
03076 }

void ContourInfoBarOp::ChangeJoinType JointType  jt  )  [private]
 

Apply the given join type to the selection.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
11 September 2000
Parameters:
jt the join type to apply to the selection. [INPUTS]
An attribute describing the given join type is applied to the selection. [OUTPUTS]
Returns:
Errors: Shows a warning if we run out of memory.
See also: AttributeManager::AttributeSelected().

Definition at line 2101 of file cntrtool.cpp.

02102 {
02103     // Create the appropriate join type attribute.
02104     AttrJoinType* pJoinAttr = new AttrJoinType;
02105     if (pJoinAttr == NULL)
02106     {
02107         InformWarning(_R(IDS_UNDO_MEMORY_FAILURE), _R(IDS_OK));
02108         return;
02109     }
02110     pJoinAttr->Value.JoinType = jt;
02111 
02112     // Let the attribute manager apply it to the selection.
02113     AttributeManager::AttributeSelected(pJoinAttr);
02114 }

void ContourInfoBarOp::ChangeProfile CProfileBiasGain Profile,
CGadgetID  GadgetID
[private, virtual]
 

See InformationBarOp::ChangeProfile () for an explanation of this function. See Also: InformationBarOp::ChangeProfile ().

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/1/2000

Reimplemented from DialogOp.

Definition at line 2370 of file cntrtool.cpp.

02371 {
02372     OpDescriptor* pOpDesc = NULL;
02373 
02374     BOOL FireOp = TRUE;
02375 
02376     // we only want to generate one bit of undo information - so decided whether
02377     // we have to fire the above op, or whether we just 'pump' the values into
02378     // our nodes (thereby nolonger generating infinite undo information) ....
02379 
02380     Operation* pLastOp = NULL;
02381 
02382     if (Profile->GetGeneratesInfiniteUndo ())   // only do if they didn't select a preset profile
02383     {
02384         pLastOp = Document::GetSelected()->GetOpHistory().FindLastOp();
02385     }
02386 
02387     if (GadgetID == _R(IDC_CONTOUROBJECTBIASGAIN))
02388     {
02389         if (pLastOp)
02390         {
02391             if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeContourObjectProfile))
02392             {
02393                 FireOp = FALSE;
02394             }
02395         }
02396             
02397         if (FireOp == TRUE)
02398         {
02399             pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOUROBJPROFILE);
02400         }
02401         else
02402         {   
02403             // we don't need/want any undo information - so just change the value ....
02404 
02405             ChangeContourObjectProfileAction Action;
02406             Action.ChangeObjectProfileWithNoUndo (*Profile);
02407         }
02408     }
02409     else if (GadgetID == _R(IDC_CONTOURATTRBIASGAIN))
02410     {
02411         if (pLastOp)
02412         {
02413             if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeContourAttributeProfile))
02414             {   
02415                 FireOp = FALSE;
02416             }
02417         }
02418 
02419         if (FireOp == TRUE)
02420         {
02421             pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOURATTRPROFILE);
02422         }
02423         else
02424         {
02425             ChangeContourAttributeProfileAction Action;
02426             Action.ChangeAttributeProfileWithNoUndo (*Profile);
02427         }
02428     }
02429     else        // some mistake surely !!!!
02430     {
02431         return;
02432     }
02433     
02434     if ((pOpDesc != NULL) && (FireOp == TRUE))
02435     {
02436         ChangeContourProfileParam Param (*Profile);
02437         pOpDesc->Invoke(&Param);
02438     }
02439 }

void ContourInfoBarOp::ChangeProfileOnIdle CProfileBiasGain Profile,
CGadgetID  GadgetID
[private, virtual]
 

See InformationBarOp::ChangeProfileOnIdle () for an explanation of this function. See Also: InformationBarOp::ChangeProfileOnIdle ().

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/2000

Reimplemented from DialogOp.

Definition at line 2454 of file cntrtool.cpp.

02455 {
02456     if (GadgetID == _R(IDC_CONTOUROBJECTBIASGAIN))
02457     {
02458         // we don't need/want any undo information - so just change the value ....
02459         
02460         ChangeContourObjectProfileAction Action;
02461         Action.ChangeObjectProfileWithNoUndo (*Profile);
02462     }
02463     else if (GadgetID == _R(IDC_CONTOURATTRBIASGAIN))
02464     {
02465         // we don't need/want any undo information - so just change the value ....
02466         
02467         ChangeContourAttributeProfileAction Action;
02468         Action.ChangeAttributeProfileWithNoUndo (*Profile);
02469     }
02470     else
02471     {
02472         return;     // what planet are you on?
02473     }
02474 }

BOOL ContourInfoBarOp::CheckForBevels  )  [private]
 

Definition at line 1611 of file cntrtool.cpp.

01612 {
01613     List BevelList;
01614     BevelTools::BuildListOfSelectedNodes(&BevelList, CC_RUNTIME_CLASS(NodeBevelController));
01615     
01616     if (!BevelList.IsEmpty())
01617     {
01618         BevelList.DeleteAll();
01619         return TRUE;
01620     }
01621 
01622     return FALSE;
01623 }

BOOL ContourInfoBarOp::ConvertStringToValue CGadgetID  ID,
INT32 &  Value
[private]
 

TRUE if the function was able to convert the INT32 to a string See Also: ShadowBarOp::ConvertStringToValue().

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/2/99
Parameters:
The value to convert to a string (In) [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 2615 of file cntrtool.cpp.

02616 {
02617     BOOL Valid = FALSE;
02618     
02619     DimScale *pDimScale = DimScale::GetPtrDimScale(Document::GetSelectedSpread());
02620     String_128 FieldContents = GetStringGadgetValue(ID, &Valid);
02621     Valid = pDimScale->ConvertToMillipoints(FieldContents, &Value);
02622 
02623     return Valid;
02624 }

BOOL ContourInfoBarOp::ConvertValueToString String_256 In,
const INT32  value,
UnitType  type = NOTYPE
[private]
 

TRUE if the function was able to convert the INT32 to a string.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/12/96
Parameters:
The value to convert to a string (In) [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 2576 of file cntrtool.cpp.

02577 {
02578     BOOL Converted = FALSE; // True when a value has been converted
02579     
02580     Spread * CurrentSpread = Document::GetSelectedSpread();
02581 
02582     if (CurrentSpread)
02583     {
02584         // Get the dimension scaling object (units) associated with the given spread
02585         // and convert to its units.
02586         DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread);
02587         pDimScale->ConvertToUnits((INT32)value , &In);
02588         Converted = TRUE;
02589     }
02590 
02591     if (In.Length() == 0)
02592     {
02593         In = _T("0");
02594     }
02595 
02596     return Converted;
02597         
02598 }

void ContourInfoBarOp::DealWithContourInnerClick  )  [private]
 

Deals with the contour inner button click message.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/99

Definition at line 3173 of file cntrtool.cpp.

03174 {
03175     // do nothing if the button is already selected
03176     if (m_bInnerIsSelected)
03177         return;
03178 
03179     // invoke the operation
03180     OpDescriptor* pOpDesc = NULL;
03181 
03182     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOUR_INNER);
03183 
03184     if (pOpDesc)
03185     {
03186         pOpDesc->Invoke();
03187     }                       
03188 }

void ContourInfoBarOp::DealWithContourOuterClick  )  [private]
 

Deals with the contour outer button click message.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/99

Definition at line 3087 of file cntrtool.cpp.

03088 {
03089     // do nothing if the button is already selected
03090     if (m_bOuterIsSelected)
03091         return;
03092 
03093     // invoke the operation
03094     OpDescriptor* pOpDesc = NULL;
03095 
03096     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOUR_OUTER);
03097 
03098     if (pOpDesc)
03099     {
03100         pOpDesc->Invoke();
03101     }                       
03102 }

void ContourInfoBarOp::DealWithInsetPathClick  )  [private]
 

Deals with the contour outer button click message.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/99

Definition at line 3113 of file cntrtool.cpp.

03114 {
03115     // do we have any contours at the moment ?
03116     List ContourList;
03117     BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContour));
03118 
03119     if (ContourList.IsEmpty())
03120     {
03121         // then just flip the flag
03122         if (m_bInsetPath)
03123         {
03124             m_bInsetPath = FALSE;
03125             SetBoolGadgetSelected(_R(IDC_BTN_INSETPATH), FALSE);
03126         }
03127         else
03128         {
03129             m_bInsetPath = TRUE;
03130             SetBoolGadgetSelected(_R(IDC_BTN_INSETPATH), TRUE);
03131         }
03132 
03133         return;
03134     }
03135 
03136     ContourList.DeleteAll();
03137         
03138     // invoke the operation
03139     OpDescriptor* pOpDesc = NULL;
03140 
03141     pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_TOGGLEINSETPATH);
03142 
03143     BOOL bSet = FALSE;
03144 
03145     if (GetBoolGadgetSelected(_R(IDC_BTN_INSETPATH)))
03146     {
03147         bSet = TRUE;
03148     }
03149     else
03150     {
03151         bSet = FALSE;
03152     }
03153 
03154     OpParam Param;
03155     Param.Param1 = bSet;
03156 
03157     if (pOpDesc)
03158     {
03159         pOpDesc->Invoke(&Param);
03160     }                       
03161 }

void ContourInfoBarOp::DealWithWidthChange UINT32  Width  )  [private]
 

Deals with the contour width changes without changing the direction of the contours.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/99

Definition at line 3200 of file cntrtool.cpp.

03201 {
03202     // make the list of nodes out of the selection
03203     List ContourList;
03204     BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController));
03205 
03206     if (!ContourList.IsEmpty())
03207     {   
03208         ChangeContourWidthParam Param(&ContourList, Width, TRUE);
03209         
03210         OpDescriptor * pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpChangeContourWidth));
03211         
03212         if (pOpDesc)
03213         {
03214             pOpDesc->Invoke(&Param);
03215         }   
03216         
03217         ContourList.DeleteAll();
03218     }
03219     else
03220     {
03221         // build the creation list
03222         SelRange* pSel = GetApplication()->FindSelection();
03223 
03224         if (pSel)
03225         {
03226             if (!pSel->IsEmpty())
03227             {
03228                 EffectsStack* pStack = pSel->GetEffectsStack();
03229                 ENSURE(pStack, "Argh!");
03230                 Range* pSelList = pStack->GetBaseLevelRange();
03231                 ENSURE(pSelList, "Argh!");
03232 
03233                 Node* pNode = pSelList->FindFirst();
03234                 NodeListItem* pItem = NULL;
03235                 while (pNode)
03236                 {
03237                     pItem = new NodeListItem(pNode);
03238                     ContourList.AddTail(pItem);
03239                     
03240                     pNode = pSelList->FindNext(pNode);
03241                 }
03242 
03243                 CreateContourParam Param(&ContourList, 3, -Width, m_bInsetPath);
03244 
03245                 OpDescriptor * pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpCreateContour));
03246         
03247                 if (pOpDesc)
03248                 {
03249                     pOpDesc->Invoke(&Param);
03250                 }   
03251         
03252                 ContourList.DeleteAll();
03253             }
03254         }
03255     }
03256 }

void ContourInfoBarOp::EnableDisableJoinTypeControls  )  [private]
 

Enable/disable the join type buttons on the info bar, according to the contents of the selection.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
12 September 2000

Definition at line 2215 of file cntrtool.cpp.

02216 {
02217     // our join type buttons act only upon the selection.
02218     SelRange* pSel = GetApplication()->FindSelection();
02219     if (pSel == NULL || pSel->IsEmpty())
02220     {
02221         EnableGadget(_R(IDC_CONTOURJOINTYPEMITRE), FALSE);
02222         EnableGadget(_R(IDC_CONTOURJOINTYPEROUND), FALSE);
02223         EnableGadget(_R(IDC_CONTOURJOINTYPEBEVEL), FALSE);
02224     }
02225     else
02226     {
02227         EnableGadget(_R(IDC_CONTOURJOINTYPEMITRE), TRUE);
02228         EnableGadget(_R(IDC_CONTOURJOINTYPEROUND), TRUE);
02229         EnableGadget(_R(IDC_CONTOURJOINTYPEBEVEL), TRUE);
02230     }
02231 }

BOOL ContourInfoBarOp::GetInsetPathFlag  )  [inline]
 

Definition at line 416 of file cntrtool.h.

00416 { return m_bInsetPath; }

CProfileBiasGain * ContourInfoBarOp::GetProfileFromSelection CGadgetID  GadgetID,
BOOL *  bMany,
BOOL *  bAllSameType
[private, virtual]
 

See InformationBarOp::GetProfileFromSelection () for a description of this function.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/1/2000
Parameters:
The GadgetID of the CBiasGainGadget that we are dealing with. [INPUTS]
bMany - returned as TRUE if we have MANY profiles selected. [OUTPUTS] bAllSameType - returned as TRUE if objects within selection are all of the same type. returns Ptr to common CProfileBiasGain, or NULL if there is NOT one.

Reimplemented from InformationBarOp.

Definition at line 2251 of file cntrtool.cpp.

02252 {
02253     BOOL ok = ((GadgetID == _R(IDC_CONTOUROBJECTBIASGAIN)) || (GadgetID == _R(IDC_CONTOURATTRBIASGAIN)));
02254 
02255     ERROR2IF(ok==FALSE, FALSE, "Invalid gadgetID passed");
02256 
02257     UINT32 TotalNumberSelected = (GetApplication()->FindSelection()->Count ());
02258 
02259     // get the list of all the shadows
02260     List ContourList;
02261     BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController));
02262 
02263     NodeContour* pFirstNodeCountour = NULL;
02264     CProfileBiasGain* pFirstProfile = NULL;
02265 
02266     /*if (ContourList.IsEmpty())
02267     {
02268         // the list is empty - er trick the code into closing the dialog
02269         *bAllSameType = FALSE;
02270         ContourList.DeleteAll();
02271         return (NULL);
02272     }*/
02273 
02274     if (TotalNumberSelected != (UINT32) ContourList.GetCount ())
02275     {
02276         // totals differ - so the user MUST have selected someother type of node as well
02277         *bAllSameType = FALSE;
02278         ContourList.DeleteAll();
02279         return (NULL);
02280     }
02281 
02282     NodeListItem * pItem = (NodeListItem *)ContourList.GetHead();
02283 
02284     // many flag
02285     *bMany = FALSE;
02286 
02287     while (pItem)
02288     {
02289         if (pFirstNodeCountour == NULL)
02290         {
02291             pFirstNodeCountour = (NodeContour*) pItem->pNode;
02292             
02293             if (GadgetID == _R(IDC_CONTOUROBJECTBIASGAIN))
02294             {
02295                 pFirstProfile = ((NodeContourController *)pItem->pNode)->GetObjectProfilePtr();
02296             }
02297             else if (GadgetID == _R(IDC_CONTOURATTRBIASGAIN))
02298             {
02299                 pFirstProfile = ((NodeContourController *)pItem->pNode)->GetAttrProfilePtr();
02300             }
02301         }
02302         else
02303         {
02304             if (GadgetID == _R(IDC_CONTOUROBJECTBIASGAIN))
02305             {
02306                 CProfileBiasGain* pOtherProfile = NULL;
02307 
02308                 pOtherProfile = ((NodeContourController *)pItem->pNode)->GetObjectProfilePtr();
02309 
02310                 if (pOtherProfile)
02311                 {
02312                     if (*pFirstProfile == *pOtherProfile)
02313                     {
02314                         // all ok
02315                     }
02316                     else
02317                     {
02318                         *bMany = TRUE;
02319                     }
02320                 }
02321             }
02322             else if (GadgetID == _R(IDC_CONTOURATTRBIASGAIN))
02323             {
02324                 CProfileBiasGain* pOtherProfile = NULL;
02325 
02326                 pOtherProfile = ((NodeContourController *)pItem->pNode)->GetAttrProfilePtr();
02327                 
02328                 if (pOtherProfile)
02329                 {
02330                     if (*pFirstProfile == *pOtherProfile)
02331                     {
02332                         // all ok
02333                     }
02334                     else
02335                     {
02336                         *bMany = TRUE;
02337                     }
02338                 }
02339             }
02340         }
02341 
02342         pItem = (NodeListItem *)ContourList.GetNext(pItem);
02343     }
02344 
02345     ContourList.DeleteAll();
02346     
02347     if (*bMany == TRUE)
02348     {
02349         return (NULL);
02350     }
02351     else
02352     {
02353         return (pFirstProfile);
02354     }
02355 }

MILLIPOINT ContourInfoBarOp::GetSliderLogValue  )  [private]
 

Sets the position of the slider given the value The slider is logarithmic - i.e. it uses the profile to set & retreive its values.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com> Mc
Date:
7/12/99
Parameters:
- [INPUTS]
The slider width in millipoints [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2537 of file cntrtool.cpp.

02538 {
02539     SetGadgetRange(_R(IDC_CONTOURSLIDER), CONTOUR_DEPTH_MIN, CONTOUR_DEPTH_MAX);
02540     MILLIPOINT Value = GetLongGadgetValue(_R(IDC_CONTOURSLIDER), CONTOUR_DEPTH_MIN,
02541         CONTOUR_DEPTH_MAX);
02542     
02543     // make the value appear between 0 and 1
02544     if (Value > CONTOUR_DEPTH_MAX)
02545         Value = CONTOUR_DEPTH_MAX;
02546 
02547     double dValue = Value - CONTOUR_DEPTH_MIN;
02548     dValue /= (double)(CONTOUR_DEPTH_MAX - CONTOUR_DEPTH_MIN);
02549 //  dValue = 1.0 - dValue;
02550 
02551     // change the profile
02552     SliderProfile.SetBias(-SliderProfile.GetBias());
02553     double dSliderValue = SliderProfile.MapZeroToOne((AFp)(dValue));
02554     SliderProfile.SetBias(-SliderProfile.GetBias());
02555         
02556     dSliderValue *= (double)(CONTOUR_DEPTH_MAX - CONTOUR_DEPTH_MIN);
02557     dSliderValue += CONTOUR_DEPTH_MIN;
02558 
02559     return (INT32)dSliderValue; 
02560 }

void ContourInfoBarOp::HandleJoinTypeBevelClicked  )  [private]
 

Handles the user clicking on the bevel join-type button on our infobar.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
08 September 2000
Parameters:
We ensure that all objects in the selection have a bevel join type. [OUTPUTS]
Notes: This method assumes that an object must have a join type; ie if none of the other join types apply to the selection, then the whole selection must have this join type, so there is no point in reapplying it in this case.

Definition at line 2069 of file cntrtool.cpp.

02070 {
02071     BOOL fRound = GetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEROUND));
02072     BOOL fMitre = GetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEMITRE));
02073 
02074     // only bother changing to a mitre join type if any selected objects
02075     // use the other join types.
02076     if (fRound || fMitre)
02077         ChangeJoinType(BevelledJoin);
02078     else
02079         SetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEBEVEL), TRUE);
02080 }

void ContourInfoBarOp::HandleJoinTypeMitreClicked  )  [private]
 

Handles the user clicking on the mitre join-type button on our infobar.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
08 September 2000
Parameters:
We ensure that all objects in the selection have a mitre join type. [OUTPUTS]
Notes: This method assumes that an object must have a join type; ie if none of the other join types apply to the selection, then the whole selection must have this join type, so there is no point in reapplying it in this case.

Definition at line 2005 of file cntrtool.cpp.

02006 {
02007     BOOL fRound = GetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEROUND));
02008     BOOL fBevel = GetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEBEVEL));
02009 
02010     // only bother changing to a mitre join type if any selected objects
02011     // use the other join types.
02012     if (fRound || fBevel)
02013         ChangeJoinType(MitreJoin);
02014     else
02015         SetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEMITRE), TRUE);
02016 }

void ContourInfoBarOp::HandleJoinTypeRoundClicked  )  [private]
 

Handles the user clicking on the round join-type button on our infobar.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
08 September 2000
Parameters:
We ensure that all objects in the selection have a round join type. [OUTPUTS]
Notes: This method assumes that an object must have a join type; ie if none of the other join types apply to the selection, then the whole selection must have this join type, so there is no point in reapplying it in this case.

Definition at line 2037 of file cntrtool.cpp.

02038 {
02039     BOOL fMitre = GetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEMITRE));
02040     BOOL fBevel = GetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEBEVEL));
02041 
02042     // only bother changing to a mitre join type if any selected objects
02043     // use the other join types.
02044     if (fMitre || fBevel)
02045         ChangeJoinType(RoundJoin);
02046     else
02047         SetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEROUND), TRUE);
02048 }

void ContourInfoBarOp::InitialiseAttrGainGadget CGadgetID  GadgetID,
UINT32  BubbleID,
UINT32  StatusID
[inline, private]
 

Definition at line 393 of file cntrtool.h.

00394     {
00395         m_BiasGainAttrGadget.Init(this, GadgetID, BubbleID, StatusID);
00396     };   // DY 16/9/99

void ContourInfoBarOp::InitialiseObjectGainGadget CGadgetID  GadgetID,
UINT32  BubbleID,
UINT32  StatusID
[inline, private]
 

Definition at line 388 of file cntrtool.h.

00389     {
00390              m_BiasGainObjectGadget.Init(this, GadgetID, BubbleID, StatusID);   // DY 16/9/99
00391     };

MsgResult ContourInfoBarOp::Message Msg Message  )  [virtual]
 

Blend info bar dialog message handler.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94 changed 13/9/99 Diccon Yamanaka
Parameters:
Message = The message to handle [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from InformationBarOp.

Definition at line 1640 of file cntrtool.cpp.

01641 {
01642     CProfileBiasGain Profile;
01643 //  BOOL bMany = FALSE;
01644     UINT32 Width = 0;
01645     INT32 LWidth = 0;
01646     
01647     if (IS_OUR_DIALOG_MSG(Message))
01648     {
01649         DialogMsg* Msg = (DialogMsg*)Message;
01650 
01651         switch (Msg->DlgMsg)
01652         {
01653 
01654             case DIM_CREATE:
01655                 m_BetweenViews = FALSE;
01656                 // Initialise the infobar controls here
01657                 // This is sent when you create the infobar in your tool startup code
01658 //              m_BiasGainObjectGadget.LinkControlButton ( this, _R(IDC_CONTOUROBJECTBIASGAIN), _R(IDBBL_CONTOUROBJECTBIASGAIN), _R(IDS_CONTOUROBJECTBIASGAIN) );
01659 //              m_BiasGainAttrGadget.LinkControlButton ( this, _R(IDC_CONTOURATTRBIASGAIN), _R(IDBBL_CONTOURATTRBIASGAIN), _R(IDS_CONTOURATTRBIASGAIN) );
01660                 m_BiasGainObjectGadget.Init(this, _R(IDC_CONTOUROBJECTBIASGAIN), _R(IDBBL_CONTOUROBJECTBIASGAIN), _R(IDS_CONTOUROBJECTBIASGAIN));
01661                 m_BiasGainAttrGadget.Init(this, _R(IDC_CONTOURATTRBIASGAIN), _R(IDBBL_CONTOURATTRBIASGAIN), _R(IDS_CONTOURATTRBIASGAIN));
01662                 m_BiasGainAttrGadget.ToggleFillProfile ();
01663                 
01664                 DisallowInteractiveProfiles ();
01665                 
01666                 SetGadgetHelp(_R(IDC_BTN_CONTOURSTEPS), _R(IDBBL_CONTOURSTEPSEDIT), _R(IDS_CONTOURSTEPSEDIT));
01667 
01668                 // set the slider bitmap
01669                 SetGadgetBitmaps(_R(IDC_CONTOURSLIDER), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
01670                 
01671                 // these two buttons different buttons for their selected and 
01672                 // SELECTED states, set them here.
01673                 UpdateState();
01674                 break;
01675 
01676             case DIM_LFT_BN_CLICKED:
01677             {
01678                 if (Msg->GadgetID == _R(IDC_CONTOUROBJECTBIASGAIN))
01679                     HandleProfileButtonClick (m_BiasGainObjectGadget, _R(IDC_CONTOUROBJECTBIASGAIN));
01680                 else if (Msg->GadgetID == _R(IDC_CONTOURATTRBIASGAIN))
01681                     HandleProfileButtonClick (m_BiasGainAttrGadget, _R(IDC_CONTOURATTRBIASGAIN));
01682                 else if (Msg->GadgetID == _R(IDC_REMOVECONTOUR))
01683                 {
01684                     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_REMOVECONTOUR);
01685                     if (pOpDesc != NULL) pOpDesc->Invoke();
01686                 }
01687                 /* DY 13/9/99 buttons to select whether blend steps or blend distance
01688                     is to be edited in the edit box */
01689                 else if (Msg->GadgetID == _R(IDC_BTN_CONTOURDISTANCE))
01690                 {
01691                     // set the steps control    
01692                     SetLongGadgetValue(_R(IDC_BTN_CONTOURSTEPS), FALSE);
01693                     m_EditBlendSteps = FALSE;
01694                     UpdateState();      // tell the infobar something has changed
01695                 }
01696                 else if (Msg->GadgetID == _R(IDC_BTN_CONTOURSTEPS))
01697                 {   
01698                     // set the distance control
01699                     SetLongGadgetValue(_R(IDC_BTN_CONTOURDISTANCE), FALSE);
01700                     m_EditBlendSteps = TRUE;
01701                     UpdateState();  
01702                 }
01703                 else if (Msg->GadgetID == _R(IDC_BTN_CONTOUROUTER))
01704                 {
01705                     // deal with the button click
01706                     DealWithContourOuterClick();
01707                 }
01708                 else if (Msg->GadgetID == _R(IDC_BTN_CONTOURINNER))
01709                 {
01710                     DealWithContourInnerClick();
01711                 }
01712                 else if (Msg->GadgetID == _R(IDC_BTN_INSETPATH))
01713                 {
01714                     DealWithInsetPathClick();
01715                 }
01716                 else if (Msg->GadgetID == _R(IDC_CONTOURJOINTYPEMITRE))
01717                 {
01718                     if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
01719                     {
01720                         HandleJoinTypeMitreClicked();
01721                     }
01722                 }
01723                 else if (Msg->GadgetID == _R(IDC_CONTOURJOINTYPEROUND))
01724                 {
01725                     if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
01726                     {
01727                         HandleJoinTypeRoundClicked();
01728                     }
01729                 }
01730                 else if (Msg->GadgetID == _R(IDC_CONTOURJOINTYPEBEVEL))
01731                 {
01732                     if (Msg->DlgMsg == DIM_LFT_BN_CLICKED)
01733                     {
01734                         HandleJoinTypeBevelClicked();
01735                     }
01736                 }
01737             }
01738             break;
01739 
01740             case DIM_SLIDER_POS_SET:
01741             {
01742                 if (Msg->GadgetID == _R(IDC_CONTOURSLIDER))
01743                 {
01744                     // slider has been dropped therefore invoke the op
01745                     Width = GetSliderLogValue();
01746 
01747                     // get rid of the drag blobs
01748                     ContourTool::m_pOpContourNodes->RenderDragBlobs(m_LastDragWidth, 
01749                             Document::GetSelectedSpread(), TRUE);   
01750                     
01751                     m_bDragging = FALSE;
01752 
01753                     DealWithWidthChange(Width);
01754                 }
01755             }
01756             break;
01757             
01758             case DIM_SLIDER_POS_CHANGING:
01759 
01760                 // deal with the slider being dragged about
01761                 if (Msg->GadgetID == _R(IDC_CONTOURSLIDER))
01762                 {
01763                     // slider changed !
01764                     // get the slider value & put it into the edit box
01765                     Width = GetSliderLogValue();
01766 
01767                     SetSliderValue(Width, FALSE);
01768 
01769                     if (ContourTool::m_pOpContourNodes)
01770                     {
01771                         if(m_bOuterIsSelected)
01772                             Width = -Width;
01773 
01774                         if (!m_bDragging)
01775                         {
01776                             // set up the drag information for the blob rendering
01777                             ContourTool::m_pOpContourNodes->SetupDragInfo();
01778                             m_bDragging = TRUE;
01779                         }
01780                         else
01781                         {
01782                             // render drag blobs off
01783                             ContourTool::m_pOpContourNodes->RenderDragBlobs(m_LastDragWidth,Document::GetSelectedSpread());
01784                         }
01785 
01786                         // render drag blobs with the new width
01787                         ContourTool::m_pOpContourNodes->RenderDragBlobs(Width,Document::GetSelectedSpread());
01788 
01789                         // set the last drag width
01790                         m_LastDragWidth = Width;
01791                     }
01792                 }
01793                 break;
01794             
01795             case DIM_SELECTION_CHANGED:
01796             {
01797                 if (FALSE) {}
01798                 else if (Msg->GadgetID == _R(IDC_CONTOURSTEPS))
01799                 {
01800                     BOOL Valid = TRUE;
01801 
01802                     // get the correct number of steps depending on the buttons which are
01803                     // activated (either step width or number of steps)
01804                     if (GetBoolGadgetSelected(_R(IDC_BTN_CONTOURSTEPS)))
01805                     {                       
01806                         INT32 NumSteps = GetLongGadgetValue(_R(IDC_CONTOURSTEPS),0,999,_R(IDS_BLENDSTEPS_INVALID),&Valid);
01807 
01808                         if (NumSteps <= 0)
01809                             NumSteps = 1;
01810 
01811                         NumSteps --;
01812 
01813                         if (Valid)
01814                         {
01815                             OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOURSTEPS);
01816                             if (pOpDesc != NULL)
01817                             {
01818                                 OpParam Param(NumSteps,0);
01819                                 pOpDesc->Invoke(&Param);
01820                             }
01821                         }
01822                     }
01823                     else if (GetBoolGadgetSelected(_R(IDC_BTN_CONTOURDISTANCE)))
01824                     {
01825                         // convert to units
01826                         INT32 Dist = 0;
01827                         Valid = ConvertStringToValue(_R(IDC_CONTOURSTEPS), Dist);
01828 
01829                         // Make sure the value is suitable, ie. greater than a pixel or 750 MILLIPOINTS
01830                         if(Dist <= 0)
01831                         {
01832                             InformWarning(_R(IDS_CONTOUR_DISTANCE_WARNING));
01833                         }
01834                         else if(Valid)
01835                         {
01836                             OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOURSTEPDISTANCE);
01837                             if (pOpDesc != NULL)
01838                             {
01839                                 OpParam Param(Dist,0);
01840                                 pOpDesc->Invoke(&Param);
01841                             }
01842                         }               
01843                     }
01844                 }
01845                 else if (Msg->GadgetID == _R(IDC_EFFECT))
01846                 {
01847                     WORD Index;
01848                     GetValueIndex(_R(IDC_EFFECT),&Index); 
01849                     ColourBlendType ColBlendType = (ColourBlendType)Index;
01850 
01851                     if (ColBlendType <= COLOURBLEND_ALTRAINBOW)
01852                     {
01853                         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGECONTOURCOLOURTYPE);
01854                         if (pOpDesc != NULL)
01855                         {
01856                             OpParam Param;
01857                             Param.Param1 = (UINT32)ColBlendType;
01858                             pOpDesc->Invoke(&Param);
01859                         }
01860                     }
01861                 }
01862                 else if (Msg->GadgetID == _R(IDC_CONTOURSLIDEREDIT))
01863                 {
01864                     // get the value from the editable control
01865                     BOOL Valid = ConvertStringToValue(_R(IDC_CONTOURSLIDEREDIT), LWidth);
01866 
01867                     // make sure that the specified contour width is a valid value.
01868                     // Make the lowest value a pixel or 750 MILLIPOINTs
01869                     if(LWidth <= 0)
01870                     {
01871                         InformWarning(_R(IDS_CONTOUR_WIDTH_WARNING));
01872                     }
01873                     else if(Valid)
01874                     {
01875                         // ok, deal with this change
01876                         if (LWidth > 0)
01877                         {
01878                             Width = (UINT32)LWidth;
01879 
01880                             DealWithWidthChange(Width);
01881                         }
01882                     }
01883                 }
01884             }
01885             break;
01886 
01887             default:
01888                 break;
01889 
01890         }
01891 
01892         if (( Msg->GadgetID == _R(IDC_CONTOUROBJECTBIASGAIN) ) || ( Msg->GadgetID == _R(IDC_CONTOURATTRBIASGAIN) ))
01893         {  
01894             ProfileSelectionChange( Msg, Msg->GadgetID );
01895         }
01896     }
01897     else if (MESSAGE_IS_A(Message, SelChangingMsg))
01898     {
01899         UpdateState();
01900         Spread* pSelected = Document::GetSelectedSpread();
01901 
01902         // render the tool blobs off
01903         if (m_pTool && pSelected && ContourTool::IsCurrent() && !m_BetweenViews)
01904         {
01905             BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01906             ENSURE(BlobMgr, "Can't get BlobManager");
01907             BlobMgr->RenderToolBlobsOff(m_pTool, pSelected, NULL);
01908             m_pTool->SetupToolBlobs();
01909             BlobMgr->RenderToolBlobsOn(m_pTool, pSelected, NULL);
01910 
01911             TRACEUSER( "MarkH", _T("Selected Spread = 0x%x\n"),pSelected);
01912         
01913             HandleProfileSelChangingMsg (m_BiasGainObjectGadget, _R(IDC_CONTOUROBJECTBIASGAIN));
01914             HandleProfileSelChangingMsg (m_BiasGainAttrGadget, _R(IDC_CONTOURATTRBIASGAIN));
01915         }
01916     }
01917     else if (MESSAGE_IS_A(Message, DocViewMsg))
01918     {
01919         DocViewMsg* msg = (DocViewMsg*) Message;
01920 
01921         // Render the tool blobs off the old view just before it changes
01922         if ((msg->State == DocViewMsg::SELABOUTTOCHANGE || msg->State == DocViewMsg::SELCHANGED ) 
01923             && msg->pOldDocView && m_pTool && ContourTool::IsCurrent() && !GetApplication()->CamelotIsDying())
01924         {
01925             // Do additional checks here to avoid ensures!
01926             CCamView* pOilView = msg->pOldDocView->GetConnectionToOilView();
01927             BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01928             ENSURE(BlobMgr, "Can't get BlobManager");
01929 
01930             PORTNOTE("other", "Removed IsScreenCamView test");
01931             if (pOilView!=NULL /*&& pOilView->IsScreenCamView()*/)
01932             {
01933                 // handle the view will/has changed msgs and do NOT process and selection changes msgs between times (sjk 22/11/00)
01934                 if (msg->State == DocViewMsg::SELABOUTTOCHANGE)
01935                 {
01936                     m_pTool->SetupToolBlobs();
01937                     BlobMgr->RenderToolBlobsOff(m_pTool, msg->pOldDocView->GetVisibleSpread(), NULL);
01938                     //TRACE( _T("View about to change\n"));
01939                     m_BetweenViews = TRUE;
01940                 }
01941                 else
01942                 {
01943                     m_pTool->SetupToolBlobs();
01944                     BlobMgr->RenderToolBlobsOn(m_pTool, msg->pOldDocView->GetVisibleSpread(), NULL);
01945                     //TRACE( _T("View has just changed\n"));
01946                     m_BetweenViews = FALSE;
01947                 }
01948             }
01949 
01950         }
01951     }
01952     else if (MESSAGE_IS_A(Message,OpMsg))   // Check for undo/redo
01953     {
01954         // update the gadgets
01955         UpdateState();
01956         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01957         ENSURE(BlobMgr, "Can't get BlobManager");
01958         
01959         if ( (((OpMsg*)Message)->MsgType == OpMsg::BEFORE_UNDO) ||
01960                                         (((OpMsg*)Message)->MsgType == OpMsg::BEFORE_REDO))
01961         {
01962             // render the tool blobs off
01963             if (m_pTool && Document::GetSelectedSpread() && ContourTool::IsCurrent())
01964             {
01965                 BlobMgr->RenderToolBlobsOff(m_pTool, Document::GetSelectedSpread(), NULL);
01966                 m_pTool->SetBlobRendering(FALSE);
01967             }
01968         }
01969         else if ( (((OpMsg*)Message)->MsgType == OpMsg::AFTER_UNDO) ||
01970                                         (((OpMsg*)Message)->MsgType == OpMsg::AFTER_REDO))
01971         {
01972             // render the tool blobs back on
01973             if (m_pTool && Document::GetSelectedSpread() && ContourTool::IsCurrent())
01974             {
01975                 m_pTool->SetBlobRendering(TRUE);
01976                 m_pTool->SetupToolBlobs();
01977                 BlobMgr->RenderToolBlobsOn(m_pTool, Document::GetSelectedSpread(), NULL);
01978             }
01979         }
01980     }
01981 
01982     // Pass the message on to the immediate base class
01983     return (InformationBarOp::Message(Message));
01984 }

BOOL ContourInfoBarOp::SetSliderLogValue MILLIPOINT  Value  )  [private]
 

Sets the position of the slider given the value The slider is logarithmic - i.e. it uses the profile to set & retreive its values.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com> Mc
Date:
7/12/99
Parameters:
The new width to set the slider to [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2494 of file cntrtool.cpp.

02495 {
02496     // make the value appear between 0 and 1
02497     if (Value > CONTOUR_DEPTH_MAX)
02498         Value = CONTOUR_DEPTH_MAX;
02499 
02500     if (Value < CONTOUR_DEPTH_MIN)
02501         Value = CONTOUR_DEPTH_MIN;
02502 
02503     double dValue = Value - CONTOUR_DEPTH_MIN;
02504     dValue /= (double)(CONTOUR_DEPTH_MAX - CONTOUR_DEPTH_MIN);
02505 
02506     // change the profile
02507     double dSliderValue = SliderProfile.MapZeroToOne((AFp)(dValue));
02508 //  dSliderValue = 1.0 - dSliderValue;
02509         
02510     dSliderValue *= (double)CONTOUR_DEPTH_MAX;
02511     dSliderValue += CONTOUR_DEPTH_MIN;
02512 
02513     BOOL ok = SetGadgetRange(_R(IDC_CONTOURSLIDER), CONTOUR_DEPTH_MIN, CONTOUR_DEPTH_MAX);
02514 
02515     if (ok)
02516         ok = SetLongGadgetValue(_R(IDC_CONTOURSLIDER), (INT32)dSliderValue);
02517 
02518     return ok;
02519 }

void ContourInfoBarOp::SetSliderValue UINT32  Value,
BOOL  bMany
 

Sets the slider & edit controls in the info bar.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/11/99

Definition at line 3006 of file cntrtool.cpp.

03007 {
03008     // now do the slider
03009     SetGadgetRange(_R(IDC_CONTOURSLIDER), CONTOUR_DEPTH_MIN, CONTOUR_DEPTH_MAX);
03010 
03011     // slider goes from 0 on the right, so invert the width
03012 //  UINT32 SliderValue = (CONTOUR_DEPTH_MAX - (Value - CONTOUR_DEPTH_MIN));
03013     
03014     BOOL ok = SetSliderLogValue(Value);
03015 
03016     String_256 WidthStr;
03017     
03018     // now do the edit control
03019     if (bMany)
03020     {
03021         WidthStr.Load(_R(IDS_MANY));
03022 
03023         if (ok)
03024             ok = SetStringGadgetValue(_R(IDC_CONTOURSLIDEREDIT), WidthStr);
03025         
03026         if (ok)
03027         {
03028             PaintGadgetNow(_R(IDC_CONTOURSLIDER));
03029             PaintGadgetNow(_R(IDC_CONTOURSLIDEREDIT));
03030         }
03031     }
03032     else
03033     {
03034         // convert to whatever value we're dealing with
03035         if (ok)
03036             ok = ConvertValueToString(WidthStr, Value);
03037         
03038         if (ok)
03039             ok = SetStringGadgetValue(_R(IDC_CONTOURSLIDEREDIT), WidthStr);
03040 
03041         if (ok)
03042         {
03043             PaintGadgetNow(_R(IDC_CONTOURSLIDER));
03044             PaintGadgetNow(_R(IDC_CONTOURSLIDEREDIT));
03045         }
03046     }
03047 }

void ContourInfoBarOp::SetUpdateState BOOL  bUpdateState  )  [inline]
 

Definition at line 379 of file cntrtool.h.

00379 { m_bUpdateState = bUpdateState; }

void ContourInfoBarOp::UpdateGadgetHelp  )  [private]
 

Updates the help in this info bar.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/11/99

Definition at line 2990 of file cntrtool.cpp.

02991 {
02992 
02993 }

void ContourInfoBarOp::UpdateJoinTypeControls  )  [private]
 

Update our infobar join type buttons. This method is currently called only in response to a SelChanging message.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
11 September 2000
Parameters:
The join type buttons on the infobar are updated to reflect the join types [OUTPUTS] contained in the selection.

Definition at line 2132 of file cntrtool.cpp.

02133 {
02134 // DEBUG:
02135 //  TRACEUSER( "Karim", _T("ContourInfoBarOp::UpdateJoinTypeControls\n"));
02136 
02137     // the check for join types is possibly time-consuming, as we may need to scan the
02138     // selection if there are multiple join types in use on selected objects.
02139 
02140     // Determine if there is a common attribute.
02141     NodeAttribute* pAttr;
02142     SelRange::CommonAttribResult eResult;
02143     eResult = GetApplication()->
02144                  FindSelection()->
02145                      FindCommonAttribute(CC_RUNTIME_CLASS(AttrJoinType), &pAttr);
02146 
02147     // initialise all button-states to FALSE - they will be set to TRUE appropriately below.
02148     BOOL fMitre = FALSE;
02149     BOOL fRound = FALSE;
02150     BOOL fBevel = FALSE;
02151 
02152     switch (eResult)
02153     {
02154         // uncheck all buttons.
02155         case SelRange::ATTR_NONE:
02156             break;
02157 
02158         // only check the common join type.
02159         case SelRange::ATTR_COMMON:
02160             if (pAttr != NULL)
02161             {
02162                 fMitre = ( ((AttrJoinType*)pAttr)->Value.JoinType == MitreJoin );
02163                 fRound = ( ((AttrJoinType*)pAttr)->Value.JoinType == RoundJoin );
02164                 fBevel = ( ((AttrJoinType*)pAttr)->Value.JoinType == BevelledJoin );
02165             }
02166             break;
02167 
02168         // test the selection for all common line attr types.
02169         case SelRange::ATTR_MANY:
02170             {
02171                 // scan the selection, quitting as soon as all three states get set.
02172                 SelRange* pSel = GetApplication()->FindSelection();
02173                 for (Node*  pSelNode =  pSel->FindFirst();
02174                             pSelNode != NULL && !(fMitre && fRound && fBevel);
02175                             pSelNode =  pSel->FindNext(pSelNode))
02176                 {
02177                     if (!pSelNode->IsAnObject())
02178                         continue;
02179 
02180                     ((NodeRenderableInk*)pSelNode)->
02181                         FindAppliedAttribute(CC_RUNTIME_CLASS(AttrJoinType), &pAttr);
02182                     if (pAttr != NULL)
02183                     {
02184                         fMitre |= ( ((AttrJoinType*)pAttr)->Value.JoinType == MitreJoin );
02185                         fRound |= ( ((AttrJoinType*)pAttr)->Value.JoinType == RoundJoin );
02186                         fBevel |= ( ((AttrJoinType*)pAttr)->Value.JoinType == BevelledJoin );
02187                     }
02188                 }
02189             }
02190             break;
02191 
02192         // error - unrecognised return option from FindCommonAttribute().
02193         default:
02194             ERROR3("ContourInfoBarOp::UpdateJoinTypeControls; invalid result from FindCommonAttribute()");
02195             break;
02196     }
02197 
02198     SetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEMITRE), fMitre);
02199     SetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEROUND), fRound);
02200     SetBoolGadgetSelected(_R(IDC_CONTOURJOINTYPEBEVEL), fBevel);
02201 }

void ContourInfoBarOp::UpdateState  )  [virtual]
 

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

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/11/94, changed 13/9/99 Diccon Yamanaka

Reimplemented from DialogBarOp.

Definition at line 2637 of file cntrtool.cpp.

02638 {
02639     if(this == NULL)
02640         return;
02641 
02642     if(!this->HasWindow() || !m_bUpdateState || !ContourTool::IsCurrent())
02643         return ;
02644 
02645     DialogBarOp::UpdateState();     // This updates all controls that have OpDescs attached
02646 
02647 //  BOOL OneToOne = FALSE;
02648 //  BOOL Antialias = NodeBlend::GetDefaultAntialias();
02649     INT32 NumSteps = 0;
02650     UINT32 NumSelBlends = 0;
02651     ColourBlendType ColBlendType = COLOURBLEND_FADE;
02652     UINT32 StepDistance = 0;
02653     BOOL OnlyBlendsSelected         = TRUE;
02654 //  BOOL AllSelectedBlendsAreOnCurve= TRUE;
02655 //  BOOL AtLeastOneBlendIsOnCurve   = FALSE;
02656 //  BOOL Tangential                 = FALSE;
02657 //  BOOL EditSteps                  = TRUE;
02658 //  UINT32 NumBlendsOnCurve         = 0;
02659     CProfileBiasGain Profile;
02660 //  BOOL bMany                      = FALSE;
02661     UINT32 NumInsets = 0;
02662     UINT32 NumNonInsets = 0;
02663 
02664     // build a list of all contour nodes in the selection
02665     List ContourList;
02666     BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController),TRUE);
02667     NodeListItem * pItem = (NodeListItem *)ContourList.GetHead();
02668     Node* pNode = NULL;
02669     
02670     if (pItem)
02671         pNode = pItem->pNode;
02672 
02673     // booleans to say whether there are inner or outer (or both) contours in 
02674     // the selection
02675     BOOL bHasInner = FALSE;
02676     BOOL bHasOuter = TRUE;
02677     BOOL bManySteps = FALSE;
02678     BOOL bFirst = TRUE;
02679     UINT32 LastNumSteps = 0;
02680     BOOL bManyDistances = FALSE;
02681     UINT32 LastStepDistance = FALSE;
02682     UINT32 ThisWidth = 0;
02683     BOOL bManyWidths = FALSE;
02684     UINT32 ThisNumSteps = 0;
02685     UINT32 ThisStepDistance = 0;
02686 
02687     NodeContourController* pControl = NULL;
02688     Node* pParent = NULL;
02689 
02690     // We need to check for contours in Blends! If we have then we need to disable the Inset Path function!
02691     BOOL DoEnableInsetPaths = TRUE;
02692     
02693     // If there`s no contours in the list then we must also check to see if there any nodes selected
02694     // inside blends as the inset path function will crash if there is!
02695     if(pNode == NULL)
02696     {
02697         // Get the current selection
02698         SelRange* pSelection = GetApplication()->FindSelection();
02699         Node* pSelected = pSelection->FindFirst();
02700 
02701         while(pSelected && DoEnableInsetPaths)
02702         {
02703             pParent = pSelected->FindParent();
02704 
02705             while(pParent && pParent->IsCompound() && DoEnableInsetPaths)
02706             {
02707                 DoEnableInsetPaths = !pParent->IsABlend();
02708                 pParent = pParent->FindParent();
02709             }
02710 
02711             pSelected = pSelection->FindNext(pSelected);
02712         }
02713     }
02714 
02715     // run through the list, setting variables
02716     while (pNode != NULL)
02717     {
02718         if (pNode->IsAContourController())
02719         {
02720             pControl = (NodeContourController *)pNode;
02721 
02722             // Find out if this contour is sitting inside a blend
02723             if(DoEnableInsetPaths)
02724             {
02725                 pParent = pControl->FindParent();
02726                 while(pParent && pParent->IsCompound() && DoEnableInsetPaths)
02727                 {
02728                     DoEnableInsetPaths = !pParent->IsABlend();
02729                     pParent = pParent->FindParent();
02730                 }
02731             }
02732 
02733             NumSelBlends++;
02734             
02735             ThisNumSteps = pControl->GetNumberOfSteps();
02736             ColourBlendType ThisColBlendType = pControl->GetColourBlendType();
02737 
02738             if (pControl->GetInsetPathFlag())
02739                 NumInsets ++;
02740             else
02741                 NumNonInsets ++;
02742 
02743             ThisStepDistance = (UINT32)(abs(pControl->GetWidth()) / (pControl->GetNumberOfSteps() + 1));
02744 
02745             // check for many's
02746             if (bFirst)
02747             {
02748                 bFirst = FALSE;
02749                 LastNumSteps = ThisNumSteps;
02750                 LastStepDistance = ThisStepDistance;
02751                 ThisWidth = abs(pControl->GetWidth());
02752             }
02753             else
02754             {
02755                 if (LastNumSteps != ThisNumSteps)
02756                     bManySteps = TRUE;
02757 
02758                 if (LastStepDistance != ThisStepDistance)
02759                     bManyDistances = TRUE;
02760 
02761                 if (ThisWidth != (UINT32)abs(pControl->GetWidth()))
02762                     bManyWidths = TRUE;
02763             }
02764             
02765             NumSteps     = ThisNumSteps;
02766             ColBlendType = ThisColBlendType;
02767             StepDistance = ThisStepDistance;
02768             
02769             if (pControl->GetWidth() < 0)
02770                 bHasOuter = TRUE;
02771 
02772             if (pControl->GetWidth() > 0)
02773                 bHasInner = TRUE;
02774         }
02775         else
02776             OnlyBlendsSelected = FALSE;
02777         
02778         pItem = (NodeListItem *)ContourList.GetNext(pItem);
02779 
02780         if (pItem)
02781             pNode = pItem->pNode;
02782         else
02783             pNode = NULL;
02784     }
02785 
02786     ContourList.DeleteAll();
02787 
02788     BOOL HasBevels = CheckForBevels();
02789 
02790     if ((NumInsets == 0 || (NumInsets > 0 && NumNonInsets > 0) || (NumInsets == 0 && NumNonInsets == 0)) && !HasBevels)
02791     {
02792         EnableGadget(_R(IDC_BTN_CONTOURDISTANCE), NumSelBlends > 0);
02793         EnableGadget(_R(IDC_BTN_CONTOURSTEPS), NumSelBlends > 0);
02794         EnableGadget(_R(IDC_CONTOUROBJECTBIASGAIN), NumSelBlends > 0);
02795         EnableGadget(_R(IDC_CONTOURATTRBIASGAIN), NumSelBlends > 0);
02796         EnableGadget(_R(IDC_CONTOURSTEPS), NumSelBlends > 0);
02797 PORTNOTE("other", "_R(IDC_BTN_CONTOURANTIALIAS) removed as not in the resources")
02798 #ifndef EXCLUDE_FROM_XARALX
02799         EnableGadget(_R(IDC_BTN_CONTOURANTIALIAS),NumSelBlends > 0);
02800 #endif
02801         EnableGadget(_R(IDC_EFFECT), NumSelBlends > 0);
02802 
02803         if (NumSelBlends > 0)
02804         {
02805             EnableGadget(_R(IDC_BTN_INSETPATH), DoEnableInsetPaths);
02806             SetBoolGadgetSelected(_R(IDC_BTN_INSETPATH), m_bInsetPath);
02807         }
02808         else
02809         {
02810             SetBoolGadgetSelected(_R(IDC_BTN_INSETPATH), m_bInsetPath);
02811             EnableGadget(_R(IDC_BTN_INSETPATH), DoEnableInsetPaths);
02812         }
02813     }
02814     else
02815     {
02816         EnableGadget(_R(IDC_BTN_CONTOURDISTANCE), FALSE);
02817         EnableGadget(_R(IDC_BTN_CONTOURSTEPS), FALSE);
02818         EnableGadget(_R(IDC_CONTOUROBJECTBIASGAIN), FALSE);
02819         EnableGadget(_R(IDC_CONTOURATTRBIASGAIN), FALSE);
02820         EnableGadget(_R(IDC_CONTOURSTEPS), FALSE);
02821 PORTNOTE("other", "_R(IDC_BTN_CONTOURANTIALIAS) removed as not in the resources")
02822 #ifndef EXCLUDE_FROM_XARALX
02823         EnableGadget(_R(IDC_BTN_CONTOURANTIALIAS),FALSE);
02824 #endif
02825         EnableGadget(_R(IDC_EFFECT), FALSE);
02826         EnableGadget(_R(IDC_BTN_INSETPATH), DoEnableInsetPaths);
02827         SetBoolGadgetSelected(_R(IDC_BTN_INSETPATH), TRUE);
02828     }
02829 
02830     if (GetApplication()->FindSelection())
02831     {
02832         if (GetApplication()->FindSelection()->IsEmpty() || HasBevels)
02833         {
02834             EnableGadget(_R(IDC_CONTOURSLIDER), FALSE);
02835             EnableGadget(_R(IDC_CONTOURSLIDEREDIT), FALSE);
02836         }
02837         else
02838         {
02839             EnableGadget(_R(IDC_CONTOURSLIDER), TRUE);
02840             EnableGadget(_R(IDC_CONTOURSLIDEREDIT), TRUE);
02841         }
02842     }
02843     
02844     String_64 Str;
02845 
02846     DeleteAllValues(_R(IDC_EFFECT));
02847 
02848     Str.Load(_R(IDS_FILLTOOL_FADE));
02849     SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_FADE);
02850     Str.Load(_R(IDS_FILLTOOL_RAINBOW));
02851     SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_RAINBOW);
02852     Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));
02853     SetStringGadgetValue(_R(IDC_EFFECT),Str,TRUE, FEMENU_ALTRAINBOW);
02854 
02855     SetComboListLength(_R(IDC_EFFECT));
02856 
02857     if (NumSelBlends == 0)
02858     {
02859         Str = _T("");
02860         SetStringGadgetValue(_R(IDC_CONTOURSTEPS),Str);
02861     }
02862     else
02863     {
02864         if (GetBoolGadgetSelected(_R(IDC_BTN_CONTOURSTEPS)))
02865         {
02866             if (NumSteps >= 0 && !bManySteps)
02867             {
02868                 SetLongGadgetValue(_R(IDC_CONTOURSTEPS),NumSteps+1);
02869                 PaintGadgetNow(_R(IDC_CONTOURSTEPS));
02870             }
02871             else if (bManySteps)
02872             {
02873                 String_256 ManyString;
02874                 ManyString.Load(_R(IDS_MANY));
02875                 SetStringGadgetValue(_R(IDC_CONTOURSTEPS),ManyString);
02876                 PaintGadgetNow(_R(IDC_CONTOURSTEPS));
02877             }
02878         }
02879         else if (GetBoolGadgetSelected(_R(IDC_BTN_CONTOURDISTANCE)))
02880         {
02881             if (!bManyDistances)
02882             {
02883                 // do the conversion to whatever the document intends
02884                 String_256 DistString;
02885                 ConvertValueToString(DistString, StepDistance);
02886                 SetStringGadgetValue(_R(IDC_CONTOURSTEPS), DistString);
02887 
02888             }
02889             else
02890             {
02891                 String_256 ManyString;
02892                 ManyString.Load(_R(IDS_MANY));
02893                 SetStringGadgetValue(_R(IDC_CONTOURSTEPS),ManyString);
02894                 PaintGadgetNow(_R(IDC_CONTOURSTEPS));
02895             }
02896         }
02897 
02898         switch (ColBlendType)
02899         {
02900             case COLOURBLEND_FADE:          Str.Load(_R(IDS_FILLTOOL_FADE));        break;
02901             case COLOURBLEND_RAINBOW:       Str.Load(_R(IDS_FILLTOOL_RAINBOW));     break;
02902             case COLOURBLEND_ALTRAINBOW:    Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));  break;
02903             case COLOURBLEND_NONE:          Str.Load(_R(IDS_MANY));                 break;
02904 
02905             default:ERROR3("Unknown colour blend type"); Str.Load(_R(IDS_FILLTOOL_FADE)); break;
02906         }
02907         
02908         SetStringGadgetValue(_R(IDC_EFFECT),Str, FALSE, -1);
02909         
02910         // ensure immediate update
02911         PaintGadgetNow(_R(IDC_EFFECT));
02912     }
02913 
02914     // depress the profile buttons (or NOT) as the case may be ....
02915     if (NumSelBlends != GetApplication()->FindSelection()->Count())
02916     {
02917         EnableGadget (_R(IDC_CONTOUROBJECTBIASGAIN), FALSE);
02918         EnableGadget (_R(IDC_CONTOURATTRBIASGAIN), FALSE);
02919     }
02920 
02921     // depress either the edit steps or edit distance button
02922     if (m_EditBlendSteps == TRUE)
02923     {
02924         SetLongGadgetValue(_R(IDC_BTN_CONTOURSTEPS), TRUE);
02925         SetGadgetHelp(_R(IDC_CONTOURSTEPS), _R(IDBBL_CONTOURSTEPSEDITVALUE), _R(IDS_CONTOURSTEPSEDITVALUE));
02926     }
02927     else
02928     {
02929         SetLongGadgetValue(_R(IDC_BTN_CONTOURDISTANCE), TRUE);
02930         SetGadgetHelp(_R(IDC_CONTOURSTEPS), _R(IDBBL_CONTOURDISTANCEEDITVALUE), _R(IDS_CONTOURDISTANCEEDITVALUE));
02931     }
02932 
02933     // now, lets do the inner & outer buttons
02934     if (!bHasInner && bHasOuter)
02935     {
02936         EnableGadget(_R(IDC_BTN_CONTOUROUTER), TRUE);
02937         EnableGadget(_R(IDC_BTN_CONTOURINNER), TRUE);
02938         SetBoolGadgetSelected(_R(IDC_BTN_CONTOUROUTER), TRUE);
02939         SetBoolGadgetSelected(_R(IDC_BTN_CONTOURINNER), FALSE);
02940         m_bOuterIsSelected = TRUE;
02941         m_bInnerIsSelected = FALSE;
02942     }
02943     else if (bHasInner && !bHasOuter)
02944     {
02945         EnableGadget(_R(IDC_BTN_CONTOUROUTER), TRUE);
02946         EnableGadget(_R(IDC_BTN_CONTOURINNER), TRUE);
02947         SetBoolGadgetSelected(_R(IDC_BTN_CONTOUROUTER), FALSE);
02948         SetBoolGadgetSelected(_R(IDC_BTN_CONTOURINNER), TRUE);
02949         m_bOuterIsSelected = FALSE;
02950         m_bInnerIsSelected = TRUE;
02951     } 
02952     else if (bHasInner && bHasOuter)
02953     {
02954         EnableGadget(_R(IDC_BTN_CONTOUROUTER), TRUE);
02955         EnableGadget(_R(IDC_BTN_CONTOURINNER), TRUE);
02956         SetBoolGadgetSelected(_R(IDC_BTN_CONTOUROUTER), FALSE);
02957         SetBoolGadgetSelected(_R(IDC_BTN_CONTOURINNER), FALSE);
02958         m_bOuterIsSelected = FALSE;
02959         m_bInnerIsSelected = FALSE;
02960     }
02961     else if (!bHasInner && !bHasOuter)
02962     {
02963         EnableGadget(_R(IDC_BTN_CONTOUROUTER), FALSE);
02964         EnableGadget(_R(IDC_BTN_CONTOURINNER), FALSE);
02965         SetBoolGadgetSelected(_R(IDC_BTN_CONTOUROUTER), FALSE);
02966         SetBoolGadgetSelected(_R(IDC_BTN_CONTOURINNER), FALSE);
02967         m_bOuterIsSelected = FALSE;
02968         m_bInnerIsSelected = FALSE;
02969     }
02970 
02971     // Mark, do something similar here as well for _R(IDC_CONTOURJOINTYPEMITRE), ROUND, BEVEL....
02972     SetSliderValue(ThisWidth, bManyWidths); 
02973 
02974     // update the state of our join-type controls.
02975     UpdateJoinTypeControls();
02976     EnableDisableJoinTypeControls();
02977 
02978     UpdateGadgetHelp();
02979 }


Member Data Documentation

BOOL ContourInfoBarOp::m_bDragging [private]
 

Definition at line 451 of file cntrtool.h.

BOOL ContourInfoBarOp::m_BetweenViews
 

Definition at line 383 of file cntrtool.h.

CBiasGainGadget ContourInfoBarOp::m_BiasGainAttrGadget
 

Definition at line 414 of file cntrtool.h.

CBiasGainGadget ContourInfoBarOp::m_BiasGainObjectGadget
 

Definition at line 413 of file cntrtool.h.

BOOL ContourInfoBarOp::m_bInnerIsSelected [private]
 

Definition at line 422 of file cntrtool.h.

BOOL ContourInfoBarOp::m_bInsetPath [private]
 

Definition at line 462 of file cntrtool.h.

BOOL ContourInfoBarOp::m_BlendAntiAlias [private]
 

Definition at line 405 of file cntrtool.h.

BOOL ContourInfoBarOp::m_BlendedOnCurve [private]
 

Definition at line 408 of file cntrtool.h.

Spread* ContourInfoBarOp::m_BlobsSpread [private]
 

Definition at line 410 of file cntrtool.h.

BOOL ContourInfoBarOp::m_bOuterIsSelected [private]
 

Definition at line 421 of file cntrtool.h.

BOOL ContourInfoBarOp::m_bUpdateState [private]
 

Definition at line 448 of file cntrtool.h.

BOOL ContourInfoBarOp::m_DetachBlendPath [private]
 

Definition at line 401 of file cntrtool.h.

BOOL ContourInfoBarOp::m_EditBlendSteps [private]
 

Definition at line 402 of file cntrtool.h.

MILLIPOINT ContourInfoBarOp::m_LastDragWidth [private]
 

Definition at line 454 of file cntrtool.h.

BOOL ContourInfoBarOp::m_OneToOne [private]
 

Definition at line 406 of file cntrtool.h.

ContourTool* ContourInfoBarOp::m_pTool
 

Definition at line 381 of file cntrtool.h.

BOOL ContourInfoBarOp::m_Tangential [private]
 

Definition at line 407 of file cntrtool.h.


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