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)