BlendInfoBarOp Class Reference

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

#include <blndtool.h>

Inheritance diagram for BlendInfoBarOp:

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

Public Member Functions

 BlendInfoBarOp ()
virtual void UpdateState ()
 This scans the selected blends setting the one-to-one flag state to "State"This scans the selected blends setting the antialias flag state to "State"Overrides the empty UpdateState function provided by InformationBarOp making a call to the function in DialogBarOp.
void UpdateInfoBarState ()
 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.
NodeBlendGetBlendOnCurve ()
 To determine if the current selection is a blend on a curve.
void EnableBlendSelectedGadgets (BOOL Enable)
void LoadStringsIntoEffectCombo ()
void ShowEffectComboString (ColourBlendType Type)

Static Public Member Functions

static BOOL NonBlendsSelected ()
 To find out if there is anything in the selection apart from blends.

Public Attributes

CBiasGainGadget m_BiasGainGadgetPosition
CBiasGainGadget m_BiasGainGadgetAttribute

Private Member Functions

void ChangeBitmapButtonState (CGadgetID GadgetID, BOOL *CurrentState)
 utility used by BlendInfoBarOp::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 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::ChangeProfile () for an explanation of this function. See Also: InformationBarOp::ChangeProfile ().
void SetBlendStepsEditText (INT32 NumSteps)
 converts the number of steps into a string and concatenates it with the string "steps" before writing it into the control
void SetBlendDistanceEditText (INT32 NumSteps)
 works out the distance between each blend step in the selected blend concatenates with the current units used in the spread and writes it to the edit box
BOOL GetDistanceEntered (double *Distance)
 retrieve what the user entered in the edit field
BOOL IsStepDistanceValid (UINT32 MinValue, UINT32 MaxValue, double Distance)
 to see if this step distance will give us a valid number of blend steps
NodeBlenderGetBlender ()
 To find the first nodeblender node in a given blend.
NodeBlendGetNodeBlend ()
 To find the first nodeblend node in the selection.
BOOL GetNumSteps (UINT32 MinValue, UINT32 MaxValue, INT32 *NumSteps)
 to retrieve an INT32 value for the number of steps and check its validity. Strips out any chars following the numerical value
BOOL GetNumStepsFromDistance (UINT32 MinValue, UINT32 MaxValue, INT32 *NumSteps)
 When the Distance between steps in a blend is edited we need to recalculate the number of steps. This function retrieves the distance value from the edit box, converts to Mps and works out the number of steps needed to get closest to that distance value. If the specified distance leads to an invalid number of steps then the user is warned.
BOOL GetMeanBlendDistance (double *Distance)
 To find the mean length of the currently selected blend. That is to say if this is a multistage blend then it returns the mean blend stage length.
BOOL AllBlendsHaveSameNumSteps ()
 find out if all selected blends have the same number of steps
BOOL AllBlendsHaveSameDistance ()
 find out if all selected blends have the same distance between steps
void SetBlendEditState (EditState State)
 to set the edit state of all selected blends to the given value
BOOL CheckSelectionAndSet ()
 If we have a situation where there is a blend on a path and the user changes to the Bezier or FreeHand tool in order to edit the path, if they return to the Blend we wish to have that blend reselected. This is accomplished by checking to see whether the currently selected node is a NodeBlendPath, if it is then we reset the selection to its parent. A bit hacky but what can you do...
CProfileBiasGainGetProfileFromSelection (CGadgetID GadgetID, BOOL *bMany, BOOL *bAllSameType)
 See InformationBarOp::GetProfileFromSelection () for a description of this function.
NodeBlendGetCurrentNodeBlend ()
 utility function to retrieve the first nodeblend in the current selection
INT32 AttributeIndexModifier (INT32 CurrentIndex)

Private Attributes

BOOL m_DetachBlendPath
BOOL m_EditBlendSteps
BOOL m_BlendAntiAlias
BOOL m_OneToOne
BOOL m_Tangential
BOOL m_BlendedOnCurve

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 364 of file blndtool.h.


Constructor & Destructor Documentation

BlendInfoBarOp::BlendInfoBarOp  )  [inline]
 

Definition at line 369 of file blndtool.h.


Member Function Documentation

BOOL BlendInfoBarOp::AllBlendsHaveSameDistance  )  [private]
 

find out if all selected blends have the same distance between steps

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : - outputs: returns: TRUE if all blends in selection have the same distance between steps FALSE otherwise

Definition at line 2531 of file blndtool.cpp.

02532 {
02533     double FirstDistance = 0.0;
02534     double FirstStepDistance = 0.0;
02535     
02536     BOOL FoundFirst = FALSE;
02537     BOOL SameNumber = FALSE;
02538     SelRange* pSel = GetApplication()->FindSelection();
02539     if (pSel != NULL)
02540     {
02541         Node* pNode = pSel->FindFirst();
02542         while (pNode != NULL)
02543         {
02544             if (pNode->IS_KIND_OF(NodeBlend))   
02545                 if (!FoundFirst)
02546                 {
02547                     if (!((NodeBlend*)pNode)->GetBlendDistance(FALSE, &FirstDistance))
02548                         return FALSE;
02549                     UINT32 NumSteps = ((NodeBlend*)pNode)->GetNumBlendSteps();
02550                     FirstStepDistance = FirstDistance/NumSteps;
02551                     FoundFirst = TRUE;
02552                     SameNumber = TRUE;
02553                 }
02554                 else
02555                 {
02556                     double NextDistance;
02557                     if (!((NodeBlend*)pNode)->GetBlendDistance(FALSE, &NextDistance))
02558                         return FALSE;
02559                     
02560                     UINT32 NumSteps = ((NodeBlend*)pNode)->GetNumBlendSteps();
02561                     double ThisStepDistance = FirstDistance/NumSteps;
02562 
02563                     if (ThisStepDistance != FirstStepDistance)
02564                         return FALSE;
02565                 }
02566                 pNode = pSel->FindNext(pNode);
02567         }
02568     }
02569     return SameNumber;
02570 }

BOOL BlendInfoBarOp::AllBlendsHaveSameNumSteps  )  [private]
 

find out if all selected blends have the same number of steps

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : - outputs: returns: TRUE if all blends in selection have the same number of steps, FALSE otherwise

Definition at line 2488 of file blndtool.cpp.

02489 {
02490     UINT32 NumSteps = 0;
02491     BOOL FoundFirst = FALSE;
02492     BOOL SameNumber = FALSE;
02493     SelRange* pSel = GetApplication()->FindSelection();
02494     if (pSel != NULL)
02495     {
02496         Node* pNode = pSel->FindFirst();
02497         while (pNode != NULL)
02498         {
02499             if (pNode->IS_KIND_OF(NodeBlend))   
02500                 if (!FoundFirst)
02501                 {
02502                     NumSteps = ((NodeBlend*)pNode)->GetNumBlendSteps();
02503                     FoundFirst = TRUE;
02504                     SameNumber = TRUE;
02505                 }
02506                 else
02507                 {
02508                     if (((NodeBlend*)pNode)->GetNumBlendSteps() != NumSteps)
02509                         return FALSE;
02510                 }
02511                 pNode = pSel->FindNext(pNode);
02512         }
02513     }
02514     return SameNumber;
02515 }

INT32 BlendInfoBarOp::AttributeIndexModifier INT32  CurrentIndex  )  [private]
 

Definition at line 2903 of file blndtool.cpp.

02904 {
02905     INT32 retval = 1;
02906 
02907     switch (CurrentIndex)
02908     {
02909     case 1:
02910         retval = 1;
02911         break;
02912     case 2:
02913         retval=  3;
02914         break;
02915     case 3:
02916         retval = 2;
02917         break;
02918     case 4:
02919         retval=  5;
02920         break;
02921     case 5:
02922         retval = 4; 
02923         break;
02924     case 6:
02925         retval = 6;
02926         break;
02927     }
02928     return retval;
02929 }

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

utility used by BlendInfoBarOp::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 2351 of file blndtool.cpp.

02352 {
02353     /*BOOL test =*/  GetBoolGadgetSelected(GadgetID);
02354     if (*CurrentState == FALSE)
02355     {
02356         *CurrentState = TRUE;
02357     }
02358     else
02359     {
02360         *CurrentState = FALSE;
02361         SetLongGadgetValue(GadgetID, FALSE);
02362     }
02363     
02364 }

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

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

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

Reimplemented from DialogOp.

Definition at line 1681 of file blndtool.cpp.

01682 {
01683                 
01684     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLEND);
01685     if (pOpDesc != NULL)
01686     {
01687         BOOL FireOp = TRUE;
01688 
01689         // we only want to generate one bit of undo information - so decided whether
01690         // we have to fire the above op, or whether we just 'pump' the values into
01691         // our nodes (thereby nolonger generating infinite undo information) ....
01692 
01693         Operation* pLastOp = NULL;
01694 
01695         if (Profile->GetGeneratesInfiniteUndo ())   // only do if they didn't select a preset profile
01696         {
01697             pLastOp = Document::GetSelected()->GetOpHistory().FindLastOp();
01698         }
01699         
01700         ChangeBlendOpParam Param;
01701         
01702         if (GadgetID == _R(IDC_BLENDOBJECTBIASGAIN))
01703         {
01704             if (pLastOp)
01705             {
01706                 if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeBlend))
01707                 {
01708                     OpChangeBlend* pLastBlendOp = (OpChangeBlend*) pLastOp;
01709                     
01710                     if (pLastBlendOp->GetChangeType () == CHANGEBLEND_OBJECTPROFILE)
01711                     {
01712                         if (Profile->GetGeneratesInfiniteUndo ())
01713                         {
01714                             FireOp = FALSE;
01715                         }
01716                     }
01717                 }
01718             }
01719             
01720             if (FireOp == TRUE)
01721             {
01722                 Param.ChangeType  = CHANGEBLEND_OBJECTPROFILE;
01723                 Param.NewObjectProfile = *Profile;
01724             }
01725             else
01726             {   
01727                 // we don't need/want any undo information - so just change the value ....
01728 
01729                 ChangeBlendAction Action;
01730                 Action.ChangeObjectProfileWithNoUndo (*Profile);
01731             }
01732         }
01733         else if (GadgetID == _R(IDC_BLENDATTRBIASGAIN))
01734         {
01735             if (pLastOp)
01736             {
01737                 if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeBlend))
01738                 {
01739                     OpChangeBlend* pLastBlendOp = (OpChangeBlend*) pLastOp;
01740                     
01741                     if (pLastBlendOp->GetChangeType () == CHANGEBLEND_ATTRPROFILE)
01742                     {
01743                         FireOp = FALSE;
01744                     }
01745                 }
01746             }
01747             
01748             if (FireOp == TRUE)
01749             {
01750                 Param.ChangeType  = CHANGEBLEND_ATTRPROFILE;
01751                 Param.NewAttrProfile = *Profile;
01752             }
01753             else
01754             {   
01755                 // we don't need/want any undo information - so just change the value ....
01756             
01757                 ChangeBlendAction Action;
01758                 Action.ChangeAttributeProfileWithNoUndo (*Profile);
01759             }
01760         }
01761         else
01762             return;  // shome mishtake shurely, lets go
01763         
01764         if (FireOp == TRUE)
01765         {
01766             pOpDesc->Invoke(&Param);
01767         }
01768     }               
01769 }

void BlendInfoBarOp::ChangeProfileOnIdle 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:
8/9/2000

Reimplemented from DialogOp.

Definition at line 1782 of file blndtool.cpp.

01783 {
01784     if (GadgetID == _R(IDC_BLENDOBJECTBIASGAIN))
01785     {   
01786         // we don't need/want any undo information - so just change the value ....
01787 
01788         ChangeBlendAction Action;
01789         Action.ChangeObjectProfileWithNoUndo (*Profile, TRUE);
01790     }
01791 
01792     // NOTE: not doing anything for the attribute profiles here, since it does not appear as
01793     // though we have to ....
01794 }

BOOL BlendInfoBarOp::CheckSelectionAndSet  )  [private]
 

If we have a situation where there is a blend on a path and the user changes to the Bezier or FreeHand tool in order to edit the path, if they return to the Blend we wish to have that blend reselected. This is accomplished by checking to see whether the currently selected node is a NodeBlendPath, if it is then we reset the selection to its parent. A bit hacky but what can you do...

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/9/99 inputs : - outputs: - returns: TRUE if the selection is changed, FALSE otherwise

Definition at line 2986 of file blndtool.cpp.

02987 {
02988     SelRange* pSel = GetApplication()->FindSelection();
02989 
02990     if (pSel == NULL)
02991         return FALSE;
02992 
02993     Node* pNode = pSel->FindFirst();
02994     
02995     if (pNode != NULL)
02996     {
02997         if (pNode->IS_KIND_OF(NodeBlendPath))
02998         {
02999             Node* pParent = pNode->FindParent();
03000 
03001             if (pParent->IS_KIND_OF(NodeBlend))
03002             {   
03003                 NodeRenderableInk::DeselectAll();
03004                 ((NodeRenderable*)pParent)->Select(TRUE);
03005                 pSel->Update();
03006             
03007                 return TRUE;
03008             }
03009         }
03010     }
03011     return FALSE;
03012 
03013 }

void BlendInfoBarOp::EnableBlendSelectedGadgets BOOL  Enable  ) 
 

Definition at line 2329 of file blndtool.cpp.

02330 {
02331     EnableGadget(_R(IDC_BLENDOBJECTBIASGAIN), Enable);
02332     EnableGadget(_R(IDC_BLENDATTRBIASGAIN), Enable);
02333     EnableGadget(_R(IDC_BLENDSTEPS),    Enable);
02334     EnableGadget(_R(IDC_BTN_ONETOONE),      Enable);
02335     EnableGadget(_R(IDC_BTN_BLENDANTIALIAS),Enable);
02336     EnableGadget(_R(IDC_EFFECT),        Enable);
02337 }

NodeBlender * BlendInfoBarOp::GetBlender  )  [private]
 

To find the first nodeblender node in a given blend.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : - outputs: pointer to the first nodeblender node in the current selection or NULL if there isn't one

Definition at line 2585 of file blndtool.cpp.

02586 {
02587     // first get the selection
02588     SelRange Sel(*( GetApplication()->FindSelection()));
02589     NodeBlend* pNodeBlend = NULL;
02590     
02591     // get the node blend
02592     if (!Sel.IsEmpty())
02593     {
02594         Node* pNode = Sel.FindFirst();
02595         while (pNode != NULL)
02596         {
02597             if (pNode->IS_KIND_OF(NodeBlend))
02598             {
02599                  pNodeBlend = (NodeBlend*)pNode;
02600                 break;
02601             }
02602             pNode = Sel.FindNext(pNode);
02603         }
02604     }
02605 
02606     if (pNodeBlend == NULL)  // if no blend node then there won't be a blender
02607         return NULL;
02608 
02609     //  now get the blender
02610     NodeBlender* pBlender = NULL;
02611 
02612     Node* pNode = pNodeBlend->FindFirstChild();
02613     while (pNode != NULL)
02614     {
02615         if (pNode->IS_KIND_OF(NodeBlender))
02616         {
02617             pBlender = (NodeBlender*)pNode;
02618             break;
02619         }
02620         pNode = pNode->FindNext();
02621     }
02622     
02623     return pBlender;
02624 }

NodeBlend * BlendInfoBarOp::GetBlendOnCurve  ) 
 

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

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : - outputs: returns: pointer to the first nodeblend in the selection if successful, NULL otherwise

Definition at line 2675 of file blndtool.cpp.

02676 {
02677     // first get the selection
02678     SelRange Sel(*( GetApplication()->FindSelection()));
02679     NodeBlend* pNodeBlend = NULL;
02680     
02681     // get the node blend
02682     if (!Sel.IsEmpty())
02683     {
02684         Node* pNode = Sel.FindFirst();
02685         while (pNode != NULL)
02686         {
02687             if (pNode->IS_KIND_OF(NodeBlend))
02688             {
02689                  pNodeBlend = (NodeBlend*)pNode;
02690                 break;
02691             }
02692             pNode = Sel.FindNext(pNode);
02693         }
02694     }
02695 
02696     if (pNodeBlend == NULL)  // if no blend node then there won't be a blender
02697         return NULL;
02698     
02699     if (pNodeBlend->IsOnACurve())
02700         return pNodeBlend;
02701     else 
02702         return NULL;
02703 
02704 }

NodeBlend * BlendInfoBarOp::GetCurrentNodeBlend  )  [private]
 

utility function to retrieve the first nodeblend in the current selection

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/9/99 inputs : - outputs: - returns: the first nodeblend in the current selection, or null if there isn't one

Definition at line 2944 of file blndtool.cpp.

02945 {
02946     // first get the selection
02947     SelRange Sel(*( GetApplication()->FindSelection()));
02948     NodeBlend* pNodeBlend = NULL;
02949     
02950     // get the node blend
02951     if (!Sel.IsEmpty())
02952     {
02953         Node* pNode = Sel.FindFirst();
02954         while (pNode != NULL)
02955         {
02956             if (pNode->IS_KIND_OF(NodeBlend))
02957             {
02958                  pNodeBlend = (NodeBlend*)pNode;
02959                 break;
02960             }
02961             pNode = Sel.FindNext(pNode);
02962         }
02963     }
02964 
02965     return pNodeBlend;
02966 }

BOOL BlendInfoBarOp::GetDistanceEntered double *  Distance  )  [private]
 

retrieve what the user entered in the edit field

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/9/99
Parameters:
- [INPUTS]
the distance entered in millipoints [OUTPUTS] returns: TRUE if a distance value can be retrieved

Definition at line 1863 of file blndtool.cpp.

01865 {
01866 
01867     SelRange* pSel = GetApplication()->FindSelection();
01868     BOOL Valid = FALSE;
01869     if (pSel != NULL)
01870     {
01871         Node* pNode = pSel->FindFirst();  // only used to pass to the gadget function
01872         
01873         double UnitValue = 0.0;
01874         UnitType TheUnit;
01875         Valid = GetDoubleAndUnitGadgetValue(Distance, &UnitValue, &TheUnit, _R(IDC_BLENDSTEPS), pNode);
01876         if (!Valid)
01877             InformWarning(_R(IDS_INVALIDDISTANCE));
01878     }
01879     return Valid;
01880 }

BOOL BlendInfoBarOp::GetMeanBlendDistance double *  Distance  )  [private]
 

To find the mean length of the currently selected blend. That is to say if this is a multistage blend then it returns the mean blend stage length.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : outputs: double value of length of blend, zero if fails returns: TRUE if successful, FALSE otherwise

Definition at line 2447 of file blndtool.cpp.

02448 {
02449     BOOL Valid = FALSE; // the return value
02450     *Distance = 0.0;
02451     NodeBlend* pNodeBlend = GetNodeBlend();
02452 
02453     if (pNodeBlend == NULL)
02454         return FALSE;
02455 
02456     UINT32 NumBlenders = pNodeBlend->GetNumBlenders();
02457     if (NumBlenders == 0)
02458     {
02459         ERROR3("This blend has zero blenders");
02460         return FALSE;
02461     }
02462     double TempDistance = 0.0;
02463 
02464     Valid = pNodeBlend->GetBlendDistance(FALSE, &TempDistance);
02465     if (Valid)
02466     {
02467         TempDistance = TempDistance / NumBlenders;
02468         *Distance = TempDistance;
02469     }
02470 
02471     return Valid;
02472 }

NodeBlend * BlendInfoBarOp::GetNodeBlend  )  [private]
 

To find the first nodeblend node in the selection.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/9/99 inputs : - outputs: pointer to the first nodeblend node in the current selection or NULL if there isn't one

Definition at line 2639 of file blndtool.cpp.

02640 {
02641     SelRange* pSel = GetApplication()->FindSelection();
02642     NodeBlend* pNodeBlend = NULL;
02643     
02644     if (pSel != NULL)
02645     {
02646         Node* pNode = pSel->FindFirst();
02647 
02648         while (pNode != NULL)
02649         {
02650             if (pNode->IS_KIND_OF(NodeBlend))
02651             {
02652                 pNodeBlend = (NodeBlend*)pNode;
02653                 return pNodeBlend;
02654             }
02655             pNode = pSel->FindNext(pNode);
02656         }
02657     }
02658     return pNodeBlend;
02659 }

BOOL BlendInfoBarOp::GetNumSteps UINT32  MinValue,
UINT32  MaxValue,
INT32 *  NumSteps
[private]
 

to retrieve an INT32 value for the number of steps and check its validity. Strips out any chars following the numerical value

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/9/99
Parameters:
pointer to INT32 to store the result, minimum and maximum valid values [INPUTS]
returns TRUE if value can be retrieved and is within the valid range. [OUTPUTS] This value will be assigned to LNumSteps, if a number cannot be retreived or it is invalid then FALSE.

Definition at line 1812 of file blndtool.cpp.

01813 {
01814     BOOL Valid = TRUE;  // the return value
01815     // first get the string from the gadget
01816     String_256 StrNumSteps = GetStringGadgetValue(_R(IDC_BLENDSTEPS), &Valid);
01817     
01818     
01819     if (Valid)
01820     {   
01821         INT32 Position = 0;
01822         double DNumSteps = 0.0;
01823 
01824         // get the numerical value from the string
01825         Valid = Convert::ReadNumber(StrNumSteps, &Position, &DNumSteps);
01826 
01827         if (Valid)
01828         {
01829             // check to see if it is in bounds, if not send a warning
01830             if (DNumSteps < MinValue || DNumSteps > MaxValue)
01831             {
01832                 InformWarning(_R(IDS_BLENDSTEPS_INVALID));
01833                 Valid = FALSE;
01834             }
01835             else
01836             {
01837                 *NumSteps = (INT32)DNumSteps;  // success
01838                 return Valid;
01839             }
01840         }
01841     }
01842 
01843     // if we reach here we have failed
01844     NumSteps = 0;
01845     return Valid;                       
01846         
01847 }

BOOL BlendInfoBarOp::GetNumStepsFromDistance UINT32  MinValue,
UINT32  MaxValue,
INT32 *  NumSteps
[private]
 

When the Distance between steps in a blend is edited we need to recalculate the number of steps. This function retrieves the distance value from the edit box, converts to Mps and works out the number of steps needed to get closest to that distance value. If the specified distance leads to an invalid number of steps then the user is warned.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99
Parameters:
pointer to INT32 to store the result, minimum and maximum valid values [INPUTS]
returns TRUE if value can be retrieved and is within the valid range. [OUTPUTS] This value will be assigned to NumSteps, if a number cannot be retreived or it is invalid then FALSE.

Definition at line 1902 of file blndtool.cpp.

01903 {
01904     
01905     SelRange* pSel = GetApplication()->FindSelection();
01906     BOOL Valid = FALSE;
01907     if (pSel != NULL)
01908     {
01909         Node* pNode = pSel->FindFirst();  // only used to pass to the gadget function
01910         double MPValue = 0.0;
01911         double UnitValue = 0.0;
01912         UnitType TheUnit;
01913         Valid = GetDoubleAndUnitGadgetValue(&MPValue, &UnitValue, &TheUnit, _R(IDC_BLENDSTEPS), pNode);
01914     
01915         if (Valid)
01916         {
01917         
01918                 if (pNode->IS_KIND_OF(NodeBlend))
01919                 {
01920                     double Distance = 0.0;
01921                     Valid = ((NodeBlend*)pNode)->GetBlendDistance(FALSE, &Distance);
01922                     if (Valid)
01923                     {
01924                         UINT32 TempNumSteps = (UINT32)(Distance/MPValue);
01925                         if (TempNumSteps < MinValue)
01926                         {
01927                             InformWarning(_R(IDS_BLENDDISTANCE_TOOBIG));
01928                             Valid = FALSE;
01929                         }
01930                         else if (TempNumSteps > MaxValue)
01931                         {
01932                             InformWarning(_R(IDS_BLENDDISTANCE_TOOSMALL));
01933                             Valid = FALSE;
01934                         }
01935                         else
01936                         {
01937                             *NumSteps = TempNumSteps;
01938                         }
01939                     }
01940                     else
01941                         InformWarning(_R(IDS_BLENDDISTANCE_INVALID));
01942                 }
01943                 else
01944                     InformWarning(_R(IDS_BLENDDISTANCE_INVALID));
01945             }
01946         }
01947         return Valid;
01948 }

CProfileBiasGain * BlendInfoBarOp::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 2815 of file blndtool.cpp.

02816 {
02817     BOOL ok = ((GadgetID == _R(IDC_BLENDOBJECTBIASGAIN)) || (GadgetID == _R(IDC_BLENDATTRBIASGAIN)));
02818 
02819     ERROR2IF(ok==FALSE, FALSE, "Invalid gadgetID passed");
02820 
02821     //BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE);
02822     // NOTE:  we could make use of the above function (and base the code around that); BUT since
02823     // this code works fine - why bother changing it?  If you wan't to change it, then take a look
02824     // at SoftShadowInfoBarOp::GetProfileFromSelection () ....
02825 
02826     SelRange Sel(*( GetApplication()->FindSelection()));
02827     
02828     NodeBlend* pFirstNodeBlend = NULL;
02829     CProfileBiasGain* pFirstProfile = NULL;
02830     
02831     // get the node blend
02832     if (!Sel.IsEmpty())
02833     {
02834         Node* pNode = Sel.FindFirst();
02835         while (pNode != NULL)                       // code for comment 1) ....
02836         {
02837             if (pNode->IS_KIND_OF(NodeBlend))       // part of condition 3 check
02838             {
02839                 if (pFirstNodeBlend == NULL)        // code for comment 2) ....
02840                 {
02841                     pFirstNodeBlend = (NodeBlend*) pNode;
02842 
02843                     if (GadgetID == _R(IDC_BLENDOBJECTBIASGAIN))
02844                     {
02845                         pFirstProfile = pFirstNodeBlend->GetObjectProfile();
02846                     }
02847                     else if (GadgetID == _R(IDC_BLENDATTRBIASGAIN))
02848                     {
02849                         pFirstProfile = pFirstNodeBlend->GetAttrProfile();
02850                     }
02851                 }
02852                 else
02853                 {
02854                     // code for comment 3) ....
02855                     // condition 1/2 check ....
02856                     // taking into account multiple profile controls ....
02857 
02858                     if (GadgetID == _R(IDC_BLENDOBJECTBIASGAIN))
02859                     {
02860                         if (*pFirstProfile == *((NodeBlend*) pNode)->GetObjectProfile())
02861                         {
02862                             // all ok
02863                         }
02864                         else
02865                         {
02866                             *bMany = TRUE;
02867                         }
02868                     }
02869                     else if (GadgetID == _R(IDC_BLENDATTRBIASGAIN))
02870                     {
02871                         if (*pFirstProfile == *((NodeBlend*) pNode)->GetAttrProfile())
02872                         {
02873                             // all ok
02874                         }
02875                         else
02876                         {
02877                             *bMany = TRUE;
02878                         }
02879                     }
02880                 }
02881             }
02882             else    // part of condition 3 check
02883             {
02884                 *bAllSameType = FALSE;
02885                 return (NULL);
02886             }
02887             pNode = Sel.FindNext(pNode);
02888         }
02889     }
02890 
02891     if (*bMany == TRUE)
02892     {
02893         return (NULL);
02894     }
02895     else
02896     {
02897         return (pFirstProfile);
02898     }
02899 }

BOOL BlendInfoBarOp::IsStepDistanceValid UINT32  MinValue,
UINT32  MaxValue,
double  Distance
[private]
 

to see if this step distance will give us a valid number of blend steps

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : the step distance to set, values for the minimum and maximum valid number of steps that are allowed outputs: - returns: TRUE if this distance can be set, FALSE if the distance will cause an invalid number of blend steps

Definition at line 2754 of file blndtool.cpp.

02755 {
02756     // first get the selection
02757     SelRange Sel(*( GetApplication()->FindSelection()));
02758 //  NodeBlend* pNodeBlend = NULL;
02759     
02760     if (Distance <= 0)
02761     {
02762         InformWarning(_R(IDS_BLENDDISTANCE_TOOSMALL));
02763         return FALSE;
02764     }
02765     // get the node blend
02766     if (!Sel.IsEmpty())
02767     {
02768         Node* pNode = Sel.FindFirst();
02769         while (pNode != NULL)
02770         {
02771             if (pNode->IS_KIND_OF(NodeBlend))
02772             {
02773                 // check to make sure this distance will not cause
02774                 // an illegal number of steps
02775                 UINT32 NumSteps = 0;
02776                 BOOL Valid = ((NodeBlend*)pNode)->GetNumStepsFromDistance(Distance, &NumSteps);
02777                 if (Valid)
02778                 {
02779                     if (NumSteps < MinValue)
02780                     {
02781                         InformWarning(_R(IDS_BLENDDISTANCE_TOOBIG));
02782                         return FALSE;
02783                     }
02784                     else if (NumSteps > MaxValue)
02785                     {
02786                         InformWarning(_R(IDS_BLENDDISTANCE_TOOSMALL));
02787                         return FALSE;
02788                     }
02789                 }
02790                 else
02791                     return FALSE;  
02792             }
02793             pNode = Sel.FindNext(pNode);
02794         }
02795     }
02796     return TRUE;
02797 }

void BlendInfoBarOp::LoadStringsIntoEffectCombo  ) 
 

Definition at line 2303 of file blndtool.cpp.

02304 {
02305     String_64 Str;
02306     DeleteAllValues(_R(IDC_EFFECT));
02307     Str.Load(_R(IDS_FILLTOOL_FADE));
02308     SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_FADE);
02309     Str.Load(_R(IDS_FILLTOOL_RAINBOW));
02310     SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_RAINBOW);
02311     Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));
02312     SetStringGadgetValue(_R(IDC_EFFECT),Str,TRUE, FEMENU_ALTRAINBOW);
02313 
02314     SetComboListLength(_R(IDC_EFFECT));
02315 }

MsgResult BlendInfoBarOp::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 1412 of file blndtool.cpp.

01413 {
01414     if (IS_OUR_DIALOG_MSG(Message))
01415     {
01416         DialogMsg* Msg = (DialogMsg*)Message;
01417 //      BOOL SetProfile = FALSE;   // these must be declared here even though they are only used in WM_CREATE
01418 //      INT32 ProfileIndex = 1;
01419         switch (Msg->DlgMsg)
01420         {   
01421             
01422 
01423             case DIM_CANCEL:
01424                 // Check if the message is a CANCEL
01425                 Close(); // Close the dialog 
01426                 break;
01427 
01428             case DIM_CREATE:
01429             {
01430 
01431                 // code added Diccon Yamanaka 9/99
01432                 // init profile gadgets
01433 //              m_BiasGainGadgetPosition.LinkControlButton ( this, _R(IDC_BLENDOBJECTBIASGAIN), _R(IDBBL_BLENDOBJECTBIASGAIN), _R(IDS_BLENDOBJECTBIASGAIN)  );
01434 //              m_BiasGainGadgetAttribute.LinkControlButton ( this, _R(IDC_BLENDATTRBIASGAIN),  _R(IDBBL_BLENDATTRBIASGAIN),   _R(IDS_BLENDATTRBIASGAIN)    );
01435                 m_BiasGainGadgetPosition.Init(this, _R(IDC_BLENDOBJECTBIASGAIN), _R(IDBBL_BLENDOBJECTBIASGAIN), _R(IDS_BLENDOBJECTBIASGAIN));
01436                 m_BiasGainGadgetAttribute.Init(this, _R(IDC_BLENDATTRBIASGAIN), _R(IDBBL_BLENDATTRBIASGAIN), _R(IDS_BLENDATTRBIASGAIN));
01437                 m_BiasGainGadgetAttribute.ToggleFillProfile ();
01438                 
01439                 SetGadgetHelp(_R(IDC_BTN_BLENDSTEPS), _R(IDBBL_BLENDSTEPSEDIT), _R(IDS_BLENDSTEPSEDIT));
01440 
01441                 // these two buttons need different bitmaps for their selected and 
01442                 // unselected states, set them here.
01443                 SetBitmapButtonIndexes(_R(IDC_ADDREMOVEBLENDPATH), 79, 80);
01444                 SetBitmapButtonIndexes(_R(IDC_TANGENTIAL), 81, 84);
01445                 
01446                 // if we were editing a blend on a path then make the blend selected
01447                 CheckSelectionAndSet();  
01448 
01449                 // solve the sticky button problem
01450                 if (GetBlendOnCurve() != NULL)
01451                     m_BlendedOnCurve = TRUE;
01452                 else
01453                     m_BlendedOnCurve = FALSE;
01454                 
01455                 // ensure we have the correct edit button depressed 
01456                 NodeBlend* pNodeBlend = GetNodeBlend();
01457                 if (pNodeBlend != NULL)
01458                 {
01459                     if (pNodeBlend->GetEditState() == EDIT_STEPS)
01460                     {
01461                         m_EditBlendSteps = TRUE;
01462                         SetLongGadgetValue(_R(IDC_BTN_BLENDDISTANCE), FALSE);
01463                     }
01464                     else
01465                     {
01466                         m_EditBlendSteps = FALSE;
01467                         SetLongGadgetValue(_R(IDC_BTN_BLENDDISTANCE), FALSE);
01468                     }
01469                 }
01470 
01471                 UpdateInfoBarState();
01472             }
01473             break;
01474 
01475             case DIM_LFT_BN_CLICKED:
01476             {
01477                 if (FALSE) {}
01478                 else if (Msg->GadgetID == _R(IDC_ADDREMOVEBLENDPATH))
01479                 {
01480                     // DY 13/9/99 if button is down then pop it up 
01481                     BOOL OnPath = (GetBlendOnCurve() != NULL);
01482                     m_BlendedOnCurve = OnPath;
01483                     ChangeBitmapButtonState(_R(IDC_ADDREMOVEBLENDPATH), &m_BlendedOnCurve);
01484 
01485                     OpDescriptor* pOpDesc = NULL;
01486 
01487                     if (!m_BlendedOnCurve)
01488                         pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_DETACHBLENDPATH);
01489                     else
01490                         pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_ADDBLENDPATH);
01491                 
01492                     if (pOpDesc != NULL) 
01493                         pOpDesc->Invoke();          
01494                 }
01495                 else if (Msg->GadgetID ==_R(IDC_REMOVEBLEND))
01496                 {
01497                     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_REMOVEBLEND);
01498                     if (pOpDesc != NULL) 
01499                         pOpDesc->Invoke();
01500                 
01501                     m_BlendedOnCurve = FALSE;
01502 
01503                 }
01504                 else if (Msg->GadgetID == _R(IDC_BLENDOBJECTBIASGAIN))
01505                     HandleProfileButtonClick (m_BiasGainGadgetPosition, _R(IDC_BLENDOBJECTBIASGAIN));
01506                 else if (Msg->GadgetID == _R(IDC_BLENDATTRBIASGAIN))
01507                     HandleProfileButtonClick (m_BiasGainGadgetAttribute, _R(IDC_BLENDATTRBIASGAIN));
01508                 else if (Msg->GadgetID == _R(IDC_BTN_ONETOONE))
01509                 {
01510                     // DY 13/9/99 if button is down then pop it up 
01511                     ChangeBitmapButtonState(_R(IDC_BTN_ONETOONE), &m_OneToOne); 
01512 
01513                     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLEND);
01514                     if (pOpDesc != NULL)
01515                     {
01516                         ChangeBlendOpParam Param;
01517                         Param.ChangeType  = CHANGEBLEND_ONETOONE;
01518                         Param.NewOneToOne = GetBoolGadgetSelected(_R(IDC_BTN_ONETOONE));
01519                         pOpDesc->Invoke(&Param);
01520                     }
01521                 }
01522                 else if (Msg->GadgetID == _R(IDC_BTN_BLENDANTIALIAS))
01523                 {
01524                     // DY 13/9/99 if button is down then pop it up 
01525                     ChangeBitmapButtonState(_R(IDC_BTN_BLENDANTIALIAS), &m_BlendAntiAlias);
01526                         
01527                     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLEND);
01528                     if (pOpDesc != NULL)
01529                     {
01530                         ChangeBlendOpParam Param;
01531                         Param.ChangeType   = CHANGEBLEND_ANTIALIAS;
01532                         Param.NewAntiAlias = GetBoolGadgetSelected(_R(IDC_BTN_BLENDANTIALIAS));
01533                         pOpDesc->Invoke(&Param);
01534                     }
01535                 }
01536                 else if (Msg->GadgetID == _R(IDC_TANGENTIAL))
01537                 {
01538                     // DY 13/9/99 if button is down then pop it up 
01539                     ChangeBitmapButtonState(_R(IDC_TANGENTIAL), &m_Tangential);             
01540                             
01541                     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLEND);
01542                     if (pOpDesc != NULL)
01543                     {
01544                         ChangeBlendOpParam Param;
01545                         Param.ChangeType  = CHANGEBLEND_TANGENTIAL;
01546                         Param.NewTangential = GetBoolGadgetSelected(_R(IDC_TANGENTIAL));
01547                         pOpDesc->Invoke(&Param);
01548                     }
01549                 }
01550                 // DY 13/9/99 buttons to select whether blend steps or blend distance
01551                 // is to be edited in the edit box
01552                 else if (Msg->GadgetID == _R(IDC_BTN_BLENDDISTANCE))
01553                 {
01554                     // set the steps control    
01555                     SetLongGadgetValue(_R(IDC_BTN_BLENDSTEPS), FALSE);
01556                     m_EditBlendSteps = FALSE;
01557                     SetBlendEditState(EDIT_DISTANCE);  // let the blend know we are editing distance
01558                     UpdateInfoBarState();      // tell the infobar something has changed
01559                     
01560                 }
01561                 else if (Msg->GadgetID == _R(IDC_BTN_BLENDSTEPS))
01562                 {   
01563                     // set the distance control
01564                     SetLongGadgetValue(_R(IDC_BTN_BLENDDISTANCE), FALSE);
01565                     m_EditBlendSteps = TRUE;
01566                     SetBlendEditState(EDIT_STEPS);   // let the blend know we are editing state
01567                     UpdateInfoBarState();                    // update toolbar
01568                 }
01569 
01570             }
01571             break;
01572 
01573             case DIM_SELECTION_CHANGED:
01574             {
01575                 if (FALSE) {}
01576                 else if (Msg->GadgetID == _R(IDC_BLENDSTEPS))
01577                 {
01578                     BOOL Valid = FALSE;
01579                     INT32 NumSteps = 0;
01580                     
01581                     // either change the number of blend steps or
01582                     // the distance between steps
01583                     if (m_EditBlendSteps)
01584                     {
01585                         Valid = GetNumSteps(1, 999, &NumSteps);
01586                         if (Valid)
01587                         {
01588                             OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLENDSTEPS);
01589                             if (pOpDesc != NULL)
01590                             {
01591                                 OpParam Param(NumSteps,0);
01592                                 pOpDesc->Invoke(&Param);
01593                             }
01594                         }
01595                         UpdateInfoBarState();
01596                     }
01597                     else
01598                     {
01599                         double Distance = 0.0;
01600                         Valid = GetDistanceEntered( &Distance);
01601                         if (Valid)
01602                         {
01603                             
01604                             Valid = IsStepDistanceValid(1, 999, Distance);
01605                             if (Valid)
01606                             {
01607                                 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLENDDISTANCE);
01608                                 if (pOpDesc != NULL)
01609                                 {
01610                                     OpParam Param((INT32)Distance, 0);
01611                                     pOpDesc->Invoke(&Param);
01612                                 }
01613                             }
01614                         }
01615                         UpdateInfoBarState();
01616                     }
01617                     
01618                 }
01619                 else if (Msg->GadgetID == _R(IDC_EFFECT))
01620                 {
01621                     WORD Index;
01622                     GetValueIndex(_R(IDC_EFFECT),&Index); 
01623                     ColourBlendType ColBlendType = (ColourBlendType)Index;
01624 
01625                     if (ColBlendType <= COLOURBLEND_ALTRAINBOW)
01626                     {
01627                         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBLEND);
01628                         if (pOpDesc != NULL)
01629                         {
01630                             ChangeBlendOpParam Param;
01631                             Param.ChangeType      = CHANGEBLEND_COLOURBLENDTYPE;
01632                             Param.NewColBlendType = ColBlendType;
01633                             pOpDesc->Invoke(&Param);
01634                         }
01635                     }
01636                 }
01637             }
01638             break;
01639 
01640             default:
01641                 break;
01642         }
01643 
01644 
01645         if (( Msg->GadgetID == _R(IDC_BLENDOBJECTBIASGAIN)) || (Msg->GadgetID == _R(IDC_BLENDATTRBIASGAIN)))
01646         {  
01647             ProfileSelectionChange( Msg, Msg->GadgetID );
01648         }
01649 
01650     }
01651     // do we have a selection change message? 
01652     if (MESSAGE_IS_A(Message, SelChangingMsg))
01653     {
01654         UpdateInfoBarState();
01655         
01656         if (this != NULL && this->HasWindow())
01657         {
01658             if (BlendTool::IsCurrent())
01659             {
01660                 HandleProfileSelChangingMsg (m_BiasGainGadgetPosition, _R(IDC_BLENDOBJECTBIASGAIN));
01661                 HandleProfileSelChangingMsg (m_BiasGainGadgetAttribute, _R(IDC_BLENDATTRBIASGAIN));
01662             }
01663         }
01664     }
01665 
01666     // Pass the message on to the immediate base class
01667     return (InformationBarOp::Message(Message));
01668 }    

BOOL BlendInfoBarOp::NonBlendsSelected  )  [static]
 

To find out if there is anything in the selection apart from blends.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs :
Returns:
TRUE if there are not only blends in the current selection, otherwise FALSE

Definition at line 3026 of file blndtool.cpp.

03027 {
03028     SelRange* pSel = GetApplication()->FindSelection();
03029 
03030     if (pSel == NULL)
03031         return FALSE;
03032 
03033     Node* pNode = pSel->FindFirst();
03034     while (pNode != NULL)
03035     {
03036         if (pNode->IsAnObject())
03037         {
03038             
03039             if (pNode->IsCompound())
03040             {
03041                 if (!pNode->IS_KIND_OF(NodeBlend))
03042                 {
03043                     // look inside bevels, contours, etc.
03044                     if (pNode->IS_KIND_OF(NodeBevelController) || 
03045                         pNode->IS_KIND_OF(NodeShadowController) ||
03046                         pNode->IS_KIND_OF(NodeContourController))
03047                     {
03048                         Node* pChild = pNode->FindFirstChild(CC_RUNTIME_CLASS(NodeBlend));
03049                         if (pChild == NULL)
03050                             return TRUE;
03051                     }
03052                 }
03053             }
03054             else 
03055                 return TRUE;
03056         }
03057         pNode = pSel->FindNext(pNode);
03058     }
03059     return FALSE;
03060 
03061 }

void BlendInfoBarOp::SetBlendDistanceEditText INT32  NumSteps  )  [private]
 

works out the distance between each blend step in the selected blend concatenates with the current units used in the spread and writes it to the edit box

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/9/99 inputs : NumSteps - number of steps in the currently selected blend

Definition at line 2400 of file blndtool.cpp.

02401 {   
02402     double Distance = 0.0;
02403     
02404     BOOL Valid = GetMeanBlendDistance(&Distance);
02405 
02406     if (!Valid)
02407         return;
02408 
02409     double DistanceBetweenSteps = Distance/NumSteps;
02410 
02411     // get the current spread 
02412     SelRange* pSel = GetApplication()->FindSelection();
02413     if (pSel == NULL)
02414         return;
02415     Spread* pCurrentSpread = pSel->FindFirst()->FindParentSpread();
02416 
02417     if (pCurrentSpread != NULL)
02418     {
02419         // get the unit type
02420         DimScale* pDimScale = DimScale::GetPtrDimScale((Node*)pCurrentSpread);
02421         if (pDimScale == NULL)
02422             return;
02423 
02424         String_256 Str;
02425         pDimScale->ConvertToUnits(DistanceBetweenSteps, &Str, TRUE, 4);
02426         
02427         SetStringGadgetValue(_R(IDC_BLENDSTEPS), Str);// set it
02428     }
02429     
02430     return;
02431 }

void BlendInfoBarOp::SetBlendEditState EditState  State  )  [private]
 

to set the edit state of all selected blends to the given value

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/9/99 inputs : edit state to set (EDIT_STEPS or EDIT_DISTANCE) outputs: -

Definition at line 2718 of file blndtool.cpp.

02719 {
02720     // first get the selection
02721     SelRange Sel(*( GetApplication()->FindSelection()));
02722 //  NodeBlend* pNodeBlend = NULL;
02723     
02724     // get the node blend
02725     if (!Sel.IsEmpty())
02726     {
02727         Node* pNode = Sel.FindFirst();
02728         while (pNode != NULL)
02729         {
02730             if (pNode->IS_KIND_OF(NodeBlend))
02731             {
02732                 ((NodeBlend*)pNode)->SetEditState(State);
02733             }
02734             pNode = Sel.FindNext(pNode);
02735         }
02736     }
02737 }

void BlendInfoBarOp::SetBlendStepsEditText INT32  NumSteps  )  [private]
 

converts the number of steps into a string and concatenates it with the string "steps" before writing it into the control

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/9/99 inputs : number of steps in the currently selected blend

Definition at line 2377 of file blndtool.cpp.

02378 {
02379         String_256 StepString(_R(IDS_BLENDSTEPS_POSTFIX));  // = " Steps";
02380         String_256 StrNumSteps = _T("");
02381         Convert::LongToString(NumSteps, &StrNumSteps);
02382         StrNumSteps += StepString;
02383 
02384         /*BOOL ok =*/ SetStringGadgetValue(_R(IDC_BLENDSTEPS), StrNumSteps);
02385         //  error code to go here
02386 }

void BlendInfoBarOp::ShowEffectComboString ColourBlendType  Type  ) 
 

Definition at line 2277 of file blndtool.cpp.

02278 {
02279     String_64 Str;
02280     switch (Type)
02281     {
02282         case COLOURBLEND_FADE:          Str.Load(_R(IDS_FILLTOOL_FADE));        break;
02283         case COLOURBLEND_RAINBOW:       Str.Load(_R(IDS_FILLTOOL_RAINBOW));     break;
02284         case COLOURBLEND_ALTRAINBOW:    Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));  break;
02285         case COLOURBLEND_NONE:          Str.Load(_R(IDS_MANY));                 break;
02286 
02287         default:ERROR3("Unknown colour blend type"); Str.Load(_R(IDS_FILLTOOL_FADE)); break;
02288     }
02289     SetStringGadgetValue(_R(IDC_EFFECT),Str, FALSE, -1);
02290 }

void BlendInfoBarOp::UpdateInfoBarState  ) 
 

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

Definition at line 2055 of file blndtool.cpp.

02056 {
02057     if(this== NULL)
02058         return;
02059     if(!this->HasWindow())
02060         return ;
02061 
02062     if (!BlendTool::IsCurrent()) return;
02063 
02064     DialogBarOp::UpdateState();     // This updates all controls that have OpDescs attached
02065 
02066     BOOL OneToOne = FALSE;
02067     BOOL Antialias = NodeBlend::GetDefaultAntialias();
02068     INT32 NumSteps = 0;
02069     UINT32 NumSelBlends = 0;
02070     ColourBlendType ColBlendType = COLOURBLEND_FADE;
02071 
02072     BOOL OnlyBlendsSelected         = TRUE;
02073     BOOL AllSelectedBlendsAreOnCurve= TRUE;
02074 //  BOOL AtLeastOneBlendIsOnCurve   = FALSE;
02075     BOOL Tangential                 = FALSE;
02076     BOOL EditSteps                  = TRUE;
02077     UINT32 NumBlendsOnCurve         = 0;
02078     BOOL NonLinearProfile           = FALSE;
02079     BOOL MultiStageBlendOnCurve     = FALSE;
02080     List BlendList;
02081 
02082     BOOL ok = BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlend), FALSE);
02083     if (!ok)
02084     {
02085         OnlyBlendsSelected = FALSE;
02086         AllSelectedBlendsAreOnCurve = FALSE;
02087     }
02088     else
02089     {
02090         NodeListItem* pListItem = (NodeListItem*)BlendList.GetHead();
02091         
02092         while (pListItem != NULL)
02093         {
02094             NodeBlend* pNodeBlend = (NodeBlend*)pListItem->pNode;
02095             // exclude blends that are part of a group as we don't want to put 
02096             // them on a path
02097             if (!pNodeBlend->IsChildOfGroup())
02098             {
02099                 NumSelBlends++; 
02100 
02101                 if (pNodeBlend->GetEditState() == EDIT_DISTANCE)
02102                     EditSteps = FALSE;
02103                 
02104                 UINT32          ThisNumSteps    = pNodeBlend->GetNumBlendSteps();
02105                 ColourBlendType ThisColBlendType= pNodeBlend->GetColourBlendType();
02106 
02107                 if (NumSelBlends == 1)
02108                 {
02109                     NumSteps     = ThisNumSteps;
02110                     ColBlendType = ThisColBlendType;
02111                 }
02112                 else
02113                 {
02114                     if (NumSteps >= 0 && NumSteps != INT32(ThisNumSteps))
02115                         NumSteps = -1;
02116                     if (ColBlendType != ThisColBlendType)
02117                             ColBlendType = COLOURBLEND_NONE;
02118                 }
02119 
02120                 if (!OneToOne && pNodeBlend->IsOneToOne())
02121                     OneToOne = TRUE;
02122 
02123                 if (Antialias && pNodeBlend->IsNotAntialiased())
02124                     Antialias = FALSE;
02125 
02126                 if (!Tangential && pNodeBlend->IsTangential())
02127                     Tangential = TRUE;
02128 
02129                 if (pNodeBlend->GetNodeBlendPath(0) != NULL)
02130                     NumBlendsOnCurve++;
02131                 else
02132                     AllSelectedBlendsAreOnCurve = FALSE;    
02133 
02134                 if (pNodeBlend->NonLinearObjectProfile())
02135                     NonLinearProfile = TRUE;
02136                 
02137                 if (pNodeBlend->GetNumNodeBlendPaths() > 1)
02138                     MultiStageBlendOnCurve = TRUE;
02139             }
02140 
02141             pListItem = (NodeListItem*)BlendList.GetNext(pListItem);
02142             
02143         }
02144     }
02145     BlendList.DeleteAll();
02146 
02147     OnlyBlendsSelected = !NonBlendsSelected();
02148     
02149     EnableBlendSelectedGadgets(NumSelBlends > 0);
02150 
02151     // if we have a non-linear profile it makes no sense to enable distance editing so 
02152     // send a message to switch it off
02153     // also as we cannot currently deal with distance editing for blends with multiple 
02154     // curves then do the same thing
02155     // Likewise if we are not on a curve, and our operations are not allowed to move the end
02156     // objects then it makes no sense to allow this
02157     if (NonLinearProfile == TRUE || MultiStageBlendOnCurve == TRUE || NumBlendsOnCurve == 0)
02158     {
02159         EnableGadget(_R(IDC_BTN_BLENDDISTANCE), FALSE);
02160         // only send the message once
02161         if (m_EditBlendSteps == FALSE)
02162             BROADCAST_TO_CLASS( DialogMsg(NULL, DIM_LFT_BN_CLICKED, _R(IDC_BTN_BLENDSTEPS), 0, 0 ), DialogOp);
02163     }
02164     else
02165         EnableGadget(_R(IDC_BTN_BLENDDISTANCE), TRUE);
02166 
02167     EnableGadget(_R(IDC_BTN_BLENDSTEPS),    TRUE);
02168     EnableGadget(_R(IDC_ADDREMOVEBLENDPATH), !(NumSelBlends == 0 || (OnlyBlendsSelected && NumBlendsOnCurve==0)));
02169     EnableGadget(_R(IDC_TANGENTIAL),    (NumSelBlends > 0) && (NumBlendsOnCurve > 0));
02170 
02171     SetBoolGadgetSelected(_R(IDC_BTN_ONETOONE),OneToOne);
02172     SetBoolGadgetSelected(_R(IDC_BTN_BLENDANTIALIAS),Antialias);
02173     SetBoolGadgetSelected(_R(IDC_TANGENTIAL), Tangential); 
02174 
02175     LoadStringsIntoEffectCombo();
02176 
02177     if (m_EditBlendSteps != EditSteps)
02178     {
02179         if (EditSteps)
02180         {
02181             SetLongGadgetValue(_R(IDC_BTN_BLENDDISTANCE), FALSE);   
02182         }
02183         else
02184         {
02185             SetLongGadgetValue(_R(IDC_BTN_BLENDSTEPS), FALSE);
02186         }
02187     }
02188 
02189     if (NumSelBlends != GetApplication()->FindSelection()->Count())
02190     {
02191         EnableGadget (_R(IDC_BLENDOBJECTBIASGAIN), FALSE);
02192         EnableGadget (_R(IDC_BLENDATTRBIASGAIN), FALSE);
02193     }
02194 
02195     if (NumSelBlends == 0)
02196     {
02197         // make the effect combo and the blendsteps text blank
02198         String_64 Str;
02199         Str = _T("");
02200         SetStringGadgetValue(_R(IDC_BLENDSTEPS),Str);
02201         SetStringGadgetValue(_R(IDC_EFFECT),Str, FALSE, -1);
02202     }
02203     else
02204     {
02205         ShowEffectComboString(ColBlendType);
02206         // determine whether to display number of steps or distance
02207         // in the edit box and display appropriate value
02208         if (NumSelBlends == 1)
02209         {   
02210             if (m_EditBlendSteps)
02211                 SetBlendStepsEditText((INT32)NumSteps);
02212             else
02213                 SetBlendDistanceEditText((INT32)NumSteps);
02214         }
02215 
02216         else if (NumSelBlends > 1)
02217         {
02218             if (m_EditBlendSteps)
02219             {
02220                 if (AllBlendsHaveSameNumSteps())
02221                     SetBlendStepsEditText((INT32)NumSteps);
02222                 else
02223                     SetStringGadgetValue(_R(IDC_BLENDSTEPS),_R(IDS_MANY));
02224             }
02225             else 
02226             { 
02227                 if (AllBlendsHaveSameDistance())
02228                     SetBlendDistanceEditText((INT32)NumSteps);
02229                 else
02230                     SetStringGadgetValue(_R(IDC_BLENDSTEPS),_R(IDS_MANY));
02231             }
02232         }
02233     }
02234 
02235 
02236     // For some reason the add blend to curve button doesn't like
02237     // to stay depressed, so force it.
02238     if (NumSelBlends > 0)
02239     {
02240         if (NumBlendsOnCurve > 0)
02241         {
02242             SetLongGadgetValue(_R(IDC_ADDREMOVEBLENDPATH), TRUE);
02243             if (Tangential)
02244             {
02245                 SetLongGadgetValue(_R(IDC_TANGENTIAL), TRUE);
02246             }
02247         }
02248     
02249     }
02250 
02251     // depress either the edit steps or edit distance button and
02252     // change the bubble strings displayed in the edit box according
02253     // to which button is currently selected
02254     if (m_EditBlendSteps == TRUE)
02255     {
02256         SetLongGadgetValue(_R(IDC_BTN_BLENDSTEPS), TRUE);
02257         SetGadgetHelp(_R(IDC_BLENDSTEPS), _R(IDBBL_BLENDSTEPSEDITVALUE), _R(IDS_BLENDSTEPSEDITVALUE));
02258     }
02259     else
02260     {
02261         SetLongGadgetValue(_R(IDC_BTN_BLENDDISTANCE), TRUE);
02262         SetGadgetHelp(_R(IDC_BLENDSTEPS), _R(IDBBL_BLENDDISTANCEEDITVALUE), _R(IDS_BLENDDISTANCEEDITVALUE));
02263     }
02264 }

void BlendInfoBarOp::UpdateState  )  [virtual]
 

This scans the selected blends setting the one-to-one flag state to "State"This scans the selected blends setting the antialias flag state to "State"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 2037 of file blndtool.cpp.

02038 {
02039     // NOTE:  all of the functionality of updatestate has been moved to 
02040     // UpdateInfoBarState.  This is because we were getting flickering whenver
02041     // you used a scroll bar.
02042 }


Member Data Documentation

CBiasGainGadget BlendInfoBarOp::m_BiasGainGadgetAttribute
 

Definition at line 431 of file blndtool.h.

CBiasGainGadget BlendInfoBarOp::m_BiasGainGadgetPosition
 

Definition at line 430 of file blndtool.h.

BOOL BlendInfoBarOp::m_BlendAntiAlias [private]
 

Definition at line 423 of file blndtool.h.

BOOL BlendInfoBarOp::m_BlendedOnCurve [private]
 

Definition at line 426 of file blndtool.h.

BOOL BlendInfoBarOp::m_DetachBlendPath [private]
 

Definition at line 419 of file blndtool.h.

BOOL BlendInfoBarOp::m_EditBlendSteps [private]
 

Definition at line 420 of file blndtool.h.

BOOL BlendInfoBarOp::m_OneToOne [private]
 

Definition at line 424 of file blndtool.h.

BOOL BlendInfoBarOp::m_Tangential [private]
 

Definition at line 425 of file blndtool.h.


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