BevelInfoBarOp Class Reference

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

#include <bevinfo.h>

Inheritance diagram for BevelInfoBarOp:

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

Public Member Functions

 BevelInfoBarOp ()
 Sets the info bars vars to NULL defaults.
MsgResult Message (Msg *Msg)
 Takes a look at the message and if it is for me it responds to it. Here the scroll bar for the freehand tool is Created and closed. It also responds to changes in the sliders position and tells the freehand tool to set its smoothing factor to something appropriate.
void SetToolActiveState (BOOL IsToolActive)
 Allows the info bar to know if it is valid or not.
void SetRetroState (BOOL CanRetroFit)
 Sets the Flag CanRetroFit and gets the infobar to redraw the static text item that says this.
void SetRetroString ()
 Sets the static text item in the freehand info bar to say either 'Retro' or nothing, depending on the state of the flag CanRetroFit.
virtual void UpdateState ()
 Sets the state of button on the bar to keep them up to date.
void UpdateControls ()
 Updates the controls on the info bar.
void SliderUpdate (BOOL bIntoVariables, BOOL bTestMany=TRUE)
 Updates the variables in me depending on the slider position.
void DoBevel ()
 Does the business with the bevelling !
void SetUpBevelInfo (BevelInfo *pBevelInfo)
 Initialises the bevel info class based on the dialog's settings.
void BeginDrag (BevelBlob *pBlob)
 starts the drag on a particular blob Notes: Called by the BevelTool when the user begins a drag on a bevel blob arrowhead
void DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL bSolidDrag)
 Deals with pointer movement messages whilst dragging.
void DragFinished (DocCoord PointerPos, ClickModifiers ClickMods, Spread *pSpread, BOOL Success, BOOL bSolidDrag)
 Finishes or quits the dragging.
BOOL AmDragging ()
BOOL AmDraggingSlider ()
void UpdateInnerOuterButtons (BOOL bMany, BOOL bOuter, BOOL bNoSelection)
 Updates the inner / outer buttons on the info bar.
MILLIPOINT GetSliderDepth ()
 Sets the slider for depth settings (logarithmic).
void SetSliderDepth (MILLIPOINT Depth)
 Sets the slider for depth settings (logarithmic).

Static Public Member Functions

static BevelInfoBarOpGetCurrentBevelInfoBar ()

Public Attributes

BevelTool * pTool
BOOL CanRetroFit
BOOL ControlsExist
INT32 m_Depth
INT32 m_LightAngle
INT32 m_Contrast
INT32 m_SliderComboIndex
INT32 m_LightTilt
BOOL m_BetweenViews

Static Public Attributes

static BevelInfoBarOppCurrentBar = NULL

Private Member Functions

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 HandleBevelTypeChanged ()
 Updates the bevel type.
void HandleSliderChanged ()
 Updates the bevel type.
void HandleBevelDirectionChanged ()
 Updates the bevel direction.
void HandleBevelDirectionsToInner ()
 Updates the bevel direction.
void HandleBevelDirectionsToOuter ()
 Updates the bevel direction.
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.
void RedrawBlobs (BOOL bAngle=TRUE, BOOL bTilt=FALSE)
 Redraws the object blobs.
void SetBlobNodesAngle (INT32 Angle)
void DoBevelAttrChange (BevelInfo *pBI)
 Applies the attributes to the selection.
void LoadBevelTypeComboStrings (BOOL bMany)
 Loads the values into the bevel type combo.
void LoadBevelDirectionComboStrings (BOOL bMany)
 Loads the values into the bevel type combo.

Private Attributes

BOOL m_bControlsEnabled
BOOL m_bComboChanged
BevelBlob * m_pDragBlob
INT32 m_BlobAngle
BOOL m_bAmDragging
BOOL m_bUserSet
INT32 m_UserIndent
BOOL m_bButtonIsInner
BOOL m_bButtonIsOuter
BOOL m_bAmDraggingSlider
MILLIPOINT m_LastDragWidth

Detailed Description

Class for handling the Bevel tool's information bar.

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

Definition at line 119 of file bevinfo.h.


Constructor & Destructor Documentation

BevelInfoBarOp::BevelInfoBarOp  ) 
 

Sets the info bars vars to NULL defaults.

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

Definition at line 222 of file bevinfo.cpp.

00223 {
00224     DlgResID = _R(IDD_BEVELINFOBAR);
00225     // The Controls hasve not been created yet
00226     ControlsExist = FALSE;
00227     
00228     // variable to stop controls from flickering
00229     m_bControlsEnabled = FALSE;
00230 
00231     // slider values
00232     m_Depth = 0;
00233     m_LightAngle = 0;
00234     m_Contrast = 100;
00235     m_SliderComboIndex = 1;
00236     m_bComboChanged = FALSE;
00237     m_bAmDragging = FALSE;
00238     m_pDragBlob = NULL;
00239     m_BlobAngle = 0;
00240     m_bUserSet = FALSE;
00241     m_UserIndent = FALSE;
00242     m_bButtonIsInner = FALSE;
00243     m_bButtonIsOuter = FALSE;
00244     m_bAmDraggingSlider = FALSE;
00245     pTool = NULL;
00246     CanRetroFit = FALSE;
00247     m_LightTilt = 0;
00248     m_LastDragWidth = 0;
00249     m_BetweenViews = FALSE;
00250 }


Member Function Documentation

BOOL BevelInfoBarOp::AmDragging  )  [inline]
 

Definition at line 182 of file bevinfo.h.

00182 { return m_bAmDragging; }

BOOL BevelInfoBarOp::AmDraggingSlider  )  [inline]
 

Definition at line 185 of file bevinfo.h.

00185 { return m_bAmDraggingSlider; }

void BevelInfoBarOp::BeginDrag BevelBlob *  pBlob  ) 
 

starts the drag on a particular blob Notes: Called by the BevelTool when the user begins a drag on a bevel blob arrowhead

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

Definition at line 2379 of file bevinfo.cpp.

02380 {
02381     if (!pBlob)
02382     {
02383         ERROR3("BevelInfoBarOp::BeginDrag - blob passed in is NULL");
02384         return;
02385     }
02386     
02387     m_pDragBlob = pBlob;
02388     m_bAmDragging = TRUE;
02389     m_BlobAngle = pBlob->GetAngle();
02390 
02391     StartDrag( DRAGTYPE_AUTOSCROLL );
02392 }

void BevelInfoBarOp::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 2157 of file bevinfo.cpp.

02158 {
02159         // update my variables first
02160     BevelInfo BI;
02161     
02162     SetUpBevelInfo(&BI);
02163 
02164     BI.m_bJointTypeChanged = TRUE;
02165     BI.m_JointType = jt;
02166 
02167     // check for zero selection
02168     Range               Sel(*(GetApplication()->FindSelection()));  
02169     RangeControl        rg = Sel.GetRangeControlFlags();
02170     rg.PromoteToParent = TRUE;
02171     Sel.SetRangeControl(rg);
02172 
02173     AttrJoinType*       pJoinType = NULL;
02174     if (Sel.IsEmpty())
02175     {
02176         // do the default attribute
02177         pJoinType = new AttrJoinType;
02178 
02179         if (!pJoinType)
02180         {
02181             ERROR3("Can't create bevel indent");
02182             return;
02183         }
02184 
02185         pJoinType->Value.JoinType = BI.m_JointType;
02186 
02187         AttributeManager::AttributeSelected( pJoinType );
02188         return;
02189     }
02190 
02191     // get the operation descriptor for the bevel change
02192     DoBevelAttrChange(&BI);
02193 }

BOOL BevelInfoBarOp::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 1522 of file bevinfo.cpp.

01523 {
01524     String_64 Str;
01525     Str.Load(_R(IDS_BEVELSTRING_MANY));
01526 
01527     BOOL Valid = FALSE; // True when a value has been converted
01528 
01529     Spread * CurrentSpread = Document::GetSelectedSpread();
01530 
01531     DimScale* pDimScale = NULL;
01532     String_128 FieldContents;
01533     String_128 NumberString;
01534     INT32 i = 0;
01535     BOOL bUpdate = FALSE;
01536 
01537     // find out if it reads 'many'
01538     FieldContents = GetStringGadgetValue(ID, &Valid);
01539 
01540     if (Str == FieldContents)
01541         return FALSE;
01542 
01543     if (CurrentSpread != NULL)
01544     {
01545         // Get the dimension scaling object (units) associated with the given spread
01546         // and convert to its units.
01547         switch (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)))
01548         {
01549         case 0:
01550             // depth
01551             pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread);
01552             //String_128 FieldContents = GetStringGadgetValue(_R(IDC_SOFTSHADOWCENTRE_EDIT_X), &Valid);
01553             FieldContents = GetStringGadgetValue(ID, &Valid);
01554             Valid = pDimScale->ConvertToMillipoints(FieldContents, &Value);
01555 
01556             if (Value > BEVEL_DEPTH_MAX)
01557                 Value = BEVEL_DEPTH_MAX;
01558             break;
01559         case 1:
01560             FieldContents = GetStringGadgetValue(ID, &Valid);
01561             
01562             for (i = 0 ; i < FieldContents.Length(); i++)
01563             {
01564                 if (FieldContents[i] >= '0' && FieldContents[i] <= '9')
01565                 {
01566                     NumberString += FieldContents[i];
01567                 }
01568                 else
01569                 {
01570                     i = FieldContents.Length();
01571                 }
01572             }
01573             
01574             SetStringGadgetValue(ID, NumberString);
01575             Value = GetLongGadgetValue(ID, BEVEL_CONTRAST_MIN, BEVEL_CONTRAST_MAX);
01576             SetStringGadgetValue(ID, FieldContents);
01577             break;
01578         case 2:
01579         case 3:
01580             FieldContents = GetStringGadgetValue(ID, &Valid);
01581             
01582             for (i = 0 ; i < FieldContents.Length(); i++)
01583             {
01584                 if (FieldContents[i] >= '0' && FieldContents[i] <= '9')
01585                 {
01586                     NumberString += FieldContents[i];
01587                 }
01588                 else
01589                 {
01590                     // deal with a negative angle
01591                     if (i == 0 && FieldContents[i] == '-')
01592                     {
01593                         NumberString += FieldContents[i];
01594                     }
01595                     else
01596                     {                       
01597                         i = FieldContents.Length();
01598                     }
01599                 }
01600             }
01601             
01602             SetStringGadgetValue(ID, NumberString);
01603             Value = GetLongGadgetValue(ID, -1000, 1000);
01604             
01605             while (Value < BEVEL_LIGHTANGLE_MIN)
01606             {
01607                 bUpdate = TRUE;
01608                 Value += 360;
01609             }
01610             
01611             while (Value > BEVEL_LIGHTANGLE_MAX)
01612             {
01613                 bUpdate = TRUE;
01614                 Value -= 360;
01615             }
01616             
01617             if (!bUpdate)
01618             {
01619                 SetStringGadgetValue(ID, FieldContents);
01620             }
01621             else
01622             {
01623                 SetLongGadgetValue(ID, Value);
01624                 NumberString = GetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT));
01625                 NumberString += _T(" ");
01626                 SetStringGadgetValue(_R(IDC_BEVEL_SLIDER_EDIT),
01627                     NumberString);
01628             }       
01629             
01630             break;
01631         }
01632     }
01633     else
01634     { 
01635         //TODO ??
01636     }
01637     
01638     return Valid;
01639 }

BOOL BevelInfoBarOp::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 1483 of file bevinfo.cpp.

01484 {
01485     BOOL Converted = FALSE; // True when a value has been converted
01486     
01487     Spread * CurrentSpread = Document::GetSelectedSpread();
01488 
01489     if (CurrentSpread)
01490     {
01491         // Get the dimension scaling object (units) associated with the given spread
01492         // and convert to its units.
01493         DimScale* pDimScale = DimScale::GetPtrDimScale((Node*) CurrentSpread);
01494         pDimScale->ConvertToUnits((INT32)value , &In);
01495         Converted = TRUE;
01496     }
01497 
01498     if (In.Length() == 0)
01499     {
01500         In = _T("0");
01501     }
01502 
01503     return Converted;
01504         
01505 }

void BevelInfoBarOp::DoBevel  ) 
 

Does the business with the bevelling !

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

Definition at line 1019 of file bevinfo.cpp.

01020 {
01021     // create a bevel
01022     BevelInfo BI;
01023 
01024     OpDescriptor* pOpDesc = NULL;
01025 
01026     if(m_Depth == 0)
01027     {
01028         SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO),0);
01029     }
01030 
01031     BI.m_BevelType = BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO))].TypeNum;
01032     BI.m_bBevelTypeChanged = TRUE;
01033     BI.m_LightAngle = m_LightAngle;
01034     BI.m_Indent = m_Depth;
01035 
01036     if (pTool->AreManyBevelTypes())
01037     {
01038         // ok, 'many' is selected so alter the type accordingly
01039         BI.m_BevelType = BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO)) - 1].TypeNum;
01040     }
01041 
01042     TRACEUSER( "DavidM", _T("Bevel type change %d\n"), BI.m_BevelType);
01043 
01044     BlobManager* BlobMgr = GetApplication()->GetBlobManager();
01045 
01046     BI.m_bOuter = GetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER));
01047     BI.m_Contrast   = m_Contrast;
01048     BI.m_bCreateNewBevels = TRUE;
01049 
01050     Spread * pSpread = Document::GetSelectedSpread();
01051 
01052     if (BI.m_BevelType >= 0)
01053     {
01054         pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpCreateBevel));
01055         
01056         if (pTool && pSpread && BlobMgr)
01057         {
01058             pTool->RenderToolBlobs(pSpread, NULL);
01059             pTool->SetBlobRendering(FALSE);
01060         }
01061         
01062         if (pOpDesc)
01063         {
01064             pOpDesc->Invoke(&BI);
01065         }
01066 
01067         if (pTool && pSpread && BlobMgr)
01068         {
01069             pTool->SetupBlobList();
01070             pTool->SetBlobRendering(TRUE);
01071             pTool->RenderToolBlobs(pSpread, NULL);
01072         }
01073     }
01074     else
01075     {
01076         // do a remove bevel operation !
01077         // tell my tool to remove its blobs
01078         pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpRemoveBevel));
01079         
01080         // tell my tool to update its blobs
01081     
01082         if (pTool && pSpread && BlobMgr)
01083         {
01084             // turn off all the tool blobs
01085             pTool->RenderToolBlobs(pSpread, NULL);
01086             pTool->SetBlobRendering(FALSE);
01087         }   
01088     
01089         if (pOpDesc)
01090         {
01091             pOpDesc->Invoke();
01092         }
01093 
01094         if (pTool && pSpread && BlobMgr)
01095         {
01096             pTool->SetBlobRendering(TRUE);
01097             pTool->SetupBlobList();
01098             pTool->RenderToolBlobs(pSpread, NULL);
01099         }   
01100     
01101     }
01102 
01103     UpdateControls();
01104 }

void BevelInfoBarOp::DoBevelAttrChange BevelInfo *  pBevParam  )  [private]
 

Applies the attributes to the selection.

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

Definition at line 1680 of file bevinfo.cpp.

01681 {
01682     // use the create bevel (which is kinda an universal function) to change all the
01683     // indents in the selection
01684     Spread * pSpread = Document::GetSelectedSpread();
01685 
01686     pBevParam->m_bCreateNewBevels = FALSE;
01687 
01688     // render the tool blobs off
01689     if (pTool && pSpread)
01690     {
01691         pTool->RenderToolBlobs(pSpread, NULL);
01692         pTool->SetBlobRendering(FALSE);
01693     }       
01694 
01695     OpDescriptor * pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpCreateBevel));
01696     
01697     if (pOpDesc)
01698     {
01699         pOpDesc->Invoke(pBevParam);
01700     }   
01701 
01702     // render them back on
01703     // render the tool blobs off
01704     if (pTool && pSpread)
01705     {
01706         pTool->SetBlobRendering(TRUE);
01707         pTool->SetupBlobList();
01708         pTool->RenderToolBlobs(pSpread, NULL);
01709     }       
01710 
01711     
01712 }

void BevelInfoBarOp::DragFinished DocCoord  PointerPos,
ClickModifiers  ClickMods,
Spread pSpread,
BOOL  Success,
BOOL  bSolidDrag
[virtual]
 

Finishes or quits the dragging.

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

Reimplemented from Operation.

Definition at line 2452 of file bevinfo.cpp.

02454 {
02455     if (!pTool || !m_pDragBlob)
02456     {
02457         EndDrag();
02458         return;
02459     }
02460     
02461 //  AttrBevelLightAngle * pAttr = NULL;
02462 //  NodeListItem * pItem = NULL;
02463 
02464     BlobManager* pBlobMgr = GetApplication()->GetBlobManager();
02465 
02466     if (!pBlobMgr)
02467     {
02468         ERROR3("DragFinished - no blob manager\n");
02469         return;
02470     }
02471 
02472     OpDescriptor * pOpDesc = NULL;
02473 
02474     OpChangeLightAnglesParam Param;
02475     
02476     if (!Success)
02477     {
02478         // user clicked ESC or some other reason for the drag to not complete properly
02479         // restore the blob's angle
02480         pTool->RenderBlob(m_pDragBlob);
02481         m_pDragBlob->SetAngle(m_BlobAngle);
02482 
02483         // re-render the bitmaps back to what they were
02484         NodeListItem * pItem = (NodeListItem *)m_pDragBlob->GetList()->GetHead();
02485 
02486         Document * pDoc = Document::GetCurrent();
02487 
02488         while (pItem)
02489         {
02490             ((NodeBevelController *)pItem->pNode)->RegenerateNode(NULL, FALSE);
02491             ((NodeBevelController *)pItem->pNode)->ReleaseCached();
02492 
02493             pItem = (NodeListItem *)m_pDragBlob->GetList()->GetNext(pItem);
02494         }
02495         
02496         if (pDoc)
02497         {
02498             if (pSpread)
02499             {
02500                 pDoc->ForceRedraw(pSpread, 
02501                     m_pDragBlob->GetRect());
02502             }
02503             else
02504             {
02505                 pSpread = Document::GetSelectedSpread();
02506 
02507                 pDoc->ForceRedraw(pSpread, 
02508                     m_pDragBlob->GetRect());
02509             }
02510         }       
02511 
02512         pTool->RenderBlob(m_pDragBlob);
02513 
02514         // GetApplication()->ServiceRendering();
02515     }
02516     else
02517     {
02518         // success ! replace all attributes in the blob's list with the new angle
02519         // get the operation descriptor for the bevel change
02520         pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpChangeBevelLightAngle));
02521 
02522         Param.pNodes         = m_pDragBlob->GetList();
02523         Param.NewLightAngle  = m_pDragBlob->GetAngle();
02524         Param.OldLightAngle  = m_BlobAngle;
02525 
02526         if (pTool)
02527         {
02528             pTool->RenderToolBlobs(pSpread, NULL);
02529             pTool->SetBlobRendering(FALSE);
02530         }
02531 
02532         // invoke the op
02533         if (pOpDesc)
02534         {
02535             pOpDesc->Invoke(&Param);
02536         }
02537         
02538         if (pTool)
02539         {
02540             pTool->SetBlobRendering(TRUE);
02541             pTool->SetupBlobList();
02542             pTool->RenderToolBlobs(pSpread, NULL);
02543         }
02544     }
02545 
02546     m_bAmDragging = FALSE;
02547 
02548     EndDrag();
02549 }

void BevelInfoBarOp::DragPointerMove DocCoord  PointerPos,
ClickModifiers  ClickMods,
Spread pSpread,
BOOL  bSolidDrag
[virtual]
 

Deals with pointer movement messages whilst dragging.

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

Reimplemented from Operation.

Definition at line 2409 of file bevinfo.cpp.

02411 {
02412     // first, render my blob off
02413     if (!pTool || !m_pDragBlob)
02414         return;
02415 
02416     // now, get the blob to recalculate its angle
02417     m_pDragBlob->CalculateAngle(PointerPos, ClickMods.Constrain);
02418 
02419     m_pDragBlob->RenderNodes();
02420 
02421     Document * pDoc = Document::GetCurrent();
02422 
02423     if (pDoc)
02424     {
02425         pDoc->ForceRedraw(pSpread, m_pDragBlob->GetRect());
02426     }
02427     
02428     GetApplication()->ServiceRendering();
02429     
02430     // update our controls
02431 //  m_LightAngle = m_pDragBlob->GetAngle();
02432     m_LightAngle = BEVEL_LIGHTANGLE_MAX - m_pDragBlob->GetAngle();
02433 
02434     SliderUpdate(FALSE);
02435 }

void BevelInfoBarOp::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 2297 of file bevinfo.cpp.

02298 {
02299     // our join type buttons act only upon the selection.
02300     SelRange* pSel = GetApplication()->FindSelection();
02301     if (pSel == NULL || pSel->IsEmpty())
02302     {
02303         EnableGadget(_R(IDC_BEVELJOINTYPEMITRE), FALSE);
02304         EnableGadget(_R(IDC_BEVELJOINTYPEROUND), FALSE);
02305         EnableGadget(_R(IDC_BEVELJOINTYPEBEVEL), FALSE);
02306     }
02307     else
02308     {
02309         EnableGadget(_R(IDC_BEVELJOINTYPEMITRE), TRUE);
02310         EnableGadget(_R(IDC_BEVELJOINTYPEROUND), TRUE);
02311         EnableGadget(_R(IDC_BEVELJOINTYPEBEVEL), TRUE);
02312     }
02313 }

static BevelInfoBarOp* BevelInfoBarOp::GetCurrentBevelInfoBar  )  [inline, static]
 

Definition at line 168 of file bevinfo.h.

00168 { return pCurrentBar; }

MILLIPOINT BevelInfoBarOp::GetSliderDepth  ) 
 

Sets the slider for depth settings (logarithmic).

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

Definition at line 2705 of file bevinfo.cpp.

02706 {
02707     SetGadgetRange(_R(IDC_BEVELSLIDER), BEVEL_DEPTH_MIN, BEVEL_DEPTH_MAX);
02708     MILLIPOINT Value = GetLongGadgetValue(_R(IDC_BEVELSLIDER), BEVEL_DEPTH_MIN,
02709         BEVEL_DEPTH_MAX);
02710     
02711     // make the value appear between 0 and 1
02712     if (Value > BEVEL_DEPTH_MAX)
02713         Value = BEVEL_DEPTH_MAX;
02714 
02715     double dValue = Value - BEVEL_DEPTH_MIN;
02716     dValue /= (double)(BEVEL_DEPTH_MAX - BEVEL_DEPTH_MIN);
02717     // dValue = 1.0 - dValue;
02718 
02719     // change the profile
02720     BevelSliderProfile.SetBias(-BevelSliderProfile.GetBias());
02721     double dSliderValue = BevelSliderProfile.MapZeroToOne((AFp)dValue);
02722     BevelSliderProfile.SetBias(-BevelSliderProfile.GetBias());
02723         
02724     dSliderValue *= (double)(BEVEL_DEPTH_MAX - BEVEL_DEPTH_MIN);
02725     dSliderValue += BEVEL_DEPTH_MIN;
02726 
02727     return (INT32)dSliderValue;
02728 }

void BevelInfoBarOp::HandleBevelDirectionChanged  )  [private]
 

Updates the bevel direction.

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

Definition at line 1983 of file bevinfo.cpp.

01984 {
01985     // check for 'many' being selected
01986     /*
01987     if (pTool->AreManyBevelDirections())
01988     {
01989         if (GetSelectedValueIndex(_R(IDC_BEVEL_INNER_COMBO)) == 0)
01990         {
01991             // do nothing - '<Many>' has been selected again
01992             return;
01993         }
01994     }
01995     */
01996     
01997     // update my variables first
01998     BevelInfo BI;
01999     
02000     SetUpBevelInfo(&BI);
02001 
02002     BI.m_bBevelDirectionChanged = TRUE;
02003 
02004     // check for zero selection
02005     Range Sel(*(GetApplication()->FindSelection()));
02006     RangeControl rg = Sel.GetRangeControlFlags();
02007     rg.PromoteToParent = TRUE;
02008     Sel.SetRangeControl(rg);
02009 
02010     AttrBevelIndent * pIndent = NULL;
02011     if (Sel.IsEmpty())
02012     {
02013         // do the default attribute
02014         pIndent = new AttrBevelIndent;
02015 
02016         if (!pIndent)
02017         {
02018             ERROR3("Can't create bevel indent");
02019             return;
02020         }
02021 
02022         pIndent->Value.m_Indent = BI.m_Indent;
02023 
02024         m_bUserSet = TRUE;
02025         m_UserIndent = BI.m_Indent;
02026 
02027         if (BI.m_bOuter)
02028         {
02029             pIndent->Value.m_Indent = -BI.m_Indent;
02030             m_UserIndent = -m_UserIndent;
02031         }
02032 
02033         AttributeManager::AttributeSelected(pIndent);
02034 
02035         return;
02036     }
02037 
02038     // get the operation descriptor for the bevel change
02039     DoBevelAttrChange(&BI);
02040 }

void BevelInfoBarOp::HandleBevelDirectionsToInner  )  [private]
 

Updates the bevel direction.

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

Definition at line 1920 of file bevinfo.cpp.

01921 {
01922     // update my variables first
01923     BevelInfo BI;
01924     
01925     SetUpBevelInfo(&BI);
01926 
01927     BI.m_bBevelDirectionChanged = TRUE;
01928     BI.m_bOuter = FALSE;
01929 
01930     // check for zero selection
01931     Range Sel(*(GetApplication()->FindSelection()));    
01932     RangeControl rg = Sel.GetRangeControlFlags();
01933     rg.PromoteToParent = TRUE;
01934     Sel.SetRangeControl(rg);
01935 
01936     AttrBevelIndent * pIndent = NULL;
01937     if (Sel.IsEmpty())
01938     {
01939         // do the default attribute
01940         pIndent = new AttrBevelIndent;
01941         if (!pIndent)
01942         {
01943             ERROR3("Can't create bevel indent");
01944             return ;
01945         }
01946 
01947         pIndent->Value.m_Indent = BI.m_Indent;
01948 
01949         m_bUserSet = TRUE;
01950         m_UserIndent = BI.m_Indent;
01951 
01952         if (BI.m_bOuter)
01953         {
01954             pIndent->Value.m_Indent = -BI.m_Indent;
01955             m_UserIndent = -m_UserIndent;
01956         }
01957 
01958         AttributeManager::AttributeSelected(pIndent);
01959 
01960         return;
01961     }
01962 
01963     // get the operation descriptor for the bevel change
01964     DoBevelAttrChange(&BI);
01965 }

void BevelInfoBarOp::HandleBevelDirectionsToOuter  )  [private]
 

Updates the bevel direction.

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

Definition at line 1859 of file bevinfo.cpp.

01860 {
01861         // update my variables first
01862     BevelInfo BI;
01863     
01864     SetUpBevelInfo(&BI);
01865 
01866     BI.m_bBevelDirectionChanged = TRUE;
01867     BI.m_bOuter = TRUE;
01868 
01869     // check for zero selection
01870     Range Sel(*(GetApplication()->FindSelection()));    
01871     RangeControl rg = Sel.GetRangeControlFlags();
01872     rg.PromoteToParent = TRUE;
01873     Sel.SetRangeControl(rg);
01874 
01875     AttrBevelIndent * pIndent = NULL;
01876     if (Sel.IsEmpty())
01877     {
01878         // do the default attribute
01879         pIndent = new AttrBevelIndent;
01880 
01881         if (!pIndent)
01882         {
01883             ERROR3("Can't create bevel indent");
01884             return;
01885         }
01886 
01887         pIndent->Value.m_Indent = BI.m_Indent;
01888 
01889         m_bUserSet = TRUE;
01890         m_UserIndent = BI.m_Indent;
01891 
01892         if (BI.m_bOuter)
01893         {
01894             pIndent->Value.m_Indent = -BI.m_Indent;
01895             m_UserIndent = -m_UserIndent;
01896         }
01897 
01898         AttributeManager::AttributeSelected(pIndent);
01899 
01900         return;
01901     }
01902 
01903     // get the operation descriptor for the bevel change
01904     DoBevelAttrChange(&BI);
01905 
01906 }

void BevelInfoBarOp::HandleBevelTypeChanged  )  [private]
 

Updates the bevel type.

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

Definition at line 1654 of file bevinfo.cpp.

01655 {
01656     if (!pTool)
01657         return;
01658     
01659     if(m_Depth == 0)
01660     {
01661         m_Depth = 3000;
01662         SetBoolGadgetSelected(_R(IDC_BTN_BEVELOUTER),TRUE);
01663     }
01664 
01665     DoBevel();
01666 }

void BevelInfoBarOp::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 2125 of file bevinfo.cpp.

02126 {
02127     BOOL fRound = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEROUND));
02128     BOOL fMitre = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEMITRE));
02129 
02130     // only bother changing to a mitre join type if any selected objects
02131     // use the other join types.
02132     if (fRound || fMitre)
02133         ChangeJoinType(BevelledJoin);
02134     else
02135         SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEBEVEL), TRUE);
02136 }

void BevelInfoBarOp::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 2061 of file bevinfo.cpp.

02062 {
02063     BOOL fRound = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEROUND));
02064     BOOL fBevel = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEBEVEL));
02065 
02066     // only bother changing to a mitre join type if any selected objects
02067     // use the other join types.
02068     if (fRound || fBevel)
02069         ChangeJoinType(MitreJoin);
02070     else
02071         SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEMITRE), TRUE);
02072 }

void BevelInfoBarOp::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 2093 of file bevinfo.cpp.

02094 {
02095     BOOL fMitre = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEMITRE));
02096     BOOL fBevel = GetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEBEVEL));
02097 
02098     // only bother changing to a mitre join type if any selected objects
02099     // use the other join types.
02100     if (fMitre || fBevel)
02101         ChangeJoinType(RoundJoin);
02102     else
02103         SetBoolGadgetSelected(_R(IDC_BEVELJOINTYPEROUND), TRUE);
02104 }

void BevelInfoBarOp::HandleSliderChanged  )  [private]
 

Updates the bevel type.

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

Definition at line 1727 of file bevinfo.cpp.

01728 {
01729     // has the edit field got 'many' in it ? if so, exit
01730     String_64 Str;
01731 
01732     // find out if the selection is null
01733     Range Sel(*(GetApplication()->FindSelection()));
01734     RangeControl rg = Sel.GetRangeControlFlags();
01735     rg.PromoteToParent = TRUE;
01736     Sel.SetRangeControl(rg);
01737 
01738     // update sliders & member variables first
01739     BevelInfo BI;
01740     
01741     SetUpBevelInfo(&BI);
01742 
01743 //  AttrBevelIndent     *pIndent      = NULL;
01744 //  AttrBevelType       *pType        = NULL;
01745 //  AttrBevelContrast   * pContrast   = NULL;
01746 //  AttrBevelLightAngle * pLightAngle = NULL;
01747 
01748     switch (GetSelectedValueIndex(_R(IDC_BEVEL_SLIDER_COMBO)))
01749     {
01750     case 0:
01751         // are there no bevels in the selection ? if so, make it an outer flat bevel
01752         if (!(NodeBevelController::SelectionHasBevelNode() ||
01753             NodeBevelController::SelectionHasBevelInkNode()) ||
01754             m_Depth == 0)
01755         {
01756             if(m_Depth > 0 && BevelTypes[GetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO))].TypeNum == -1)
01757             {
01758                 SetSelectedValueIndex(_R(IDC_BEVEL_TYPE_COMBO),1);
01759                 UpdateInnerOuterButtons(FALSE,TRUE,FALSE);
01760             }
01761 
01762             DoBevel();
01763             return;
01764         }
01765         
01766         // the depth/indent setting
01767         BI.m_bBevelIndentChanged = TRUE;
01768         m_bUserSet = TRUE;
01769         m_UserIndent = BI.m_Indent;
01770         
01771         if (BI.m_bOuter)
01772         {
01773             m_UserIndent = -m_UserIndent;
01774         }
01775         
01776         break;
01777     case 1:
01778         // the contrast setting
01779         BI.m_bBevelContrastChanged = TRUE;
01780         break;
01781     case 2:
01782         BI.m_bBevelLightAngleChanged = TRUE;
01783         break;
01784     case 3:
01785         BI.m_bBevelLightTiltChanged = TRUE;
01786         break;
01787     default:
01788         ERROR3("Bevel infobar slider combo has invalid value");
01789         return;
01790     }   
01791     
01792     // render the blobs off
01793 //  Spread * pSpread = Document::GetSelectedSpread();
01794 
01795     DoBevelAttrChange(&BI); 
01796 }