FreeHandInfoBarOp Class Reference

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

#include <freeinfo.h>

Inheritance diagram for FreeHandInfoBarOp:

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

Public Member Functions

 FreeHandInfoBarOp ()
 Sets the info bars vars to NULL defaults.
 ~FreeHandInfoBarOp ()
 destructor
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.
void AddBrush ()
 Tells the infobar that a new brush has been added to the brush component. This function finds the last created brush and selects it as the head of the list of brushes to be displayed in the brush combo.
void AddBrush (BrushHandle Handle)
 Overridden version of above function. In this version we specify the handle of the brush to add, plus we do not select the new brush.
virtual void UpdateState ()
 Sets the state of button on the bar to keep them up to date.
BrushData GetBrushDataFromSelection (BOOL *pSelEmpty=NULL)
 if there is one and only one brush in the selection the this function returns a brush data object representing its current state. If there is any other number then a data item is still returned but it will not be valid
void SetDefaultStrokeInCombo ()
 Sets the bitmap showing in the brush combo to be that of the default stroke !!! Note - not actually working at the moment.
void RemoveBrush (BrushHandle Handle)
 to remove the specified brush from the brush list

Static Public Member Functions

static CBrushGadgetGetBrushGadget ()

Public Attributes

FreeHandToolpTool
BOOL CanRetroFit

Protected Member Functions

BOOL InitBrushList ()
 creates the brush list if it does not exist, if it already exists then we just empty it. Then we fill it with brush handles in the order that they exist in the brush component.
BOOL ReInitBrushList ()
 This takes care of a situation where we might add a number of brushes at once and want to update the brush list without forgetting the order of the list. This kind of thing arises when we load in a new document. Anyway what we do is compare the number of brushes with the number of items in the list, and if there is a mismatch we add the new ones to the end of the list.
BOOL SetBrushListToControl ()
 Goes through the brush list in order, creating attribute nodes from the brush handles and setting them into the combo.
BOOL SetStrokesToControl ()
 Creates stroke shape items and adds them to the stroke combo.
void HandleBrushSelectChange ()
 Called when a DIM_SELECTION message is received from _R(IDC_BRUSHTYPE).
void HandleCreate ()
 Called when a DIM_CREATE message is received.
void HandleSliderPosChanging ()
 Called when a SLIDER_POS_CHANGING message is received.
void HandleStrokeSelectChange ()
 Called when a DIM_SELECTION message is received from _R(IDC_STROKETYPE).
void LaunchBrushEditDialog ()
void SetHeadOfListSelected ()
void SetDisplayBrush ()
void SetBrushComboFromSelection ()
BrushHandle GetBrushHandleFromSelection (BOOL *pSelEmpty=NULL)
 To find out if there are any brushed objects in the selection.
void SetStrokeComboFromSelection ()
INT32 GetStrokeIndexFromValueFunctionID (ValueFunctionID ID)
 Bit of a last minute bodge this, as we are trying to implement a small subset of the value functions into the stroke combo at fixed indexes. We will map the ValueFunctionID used by the ValueFunctions to the index into the combo.
BrushHandle GetBrushHandleFromControlIndex (BrushHandle Index)
 Retrieves the brushhandle of the Indexth item in the list.
INT32 GetControlIndexFromBrushHandle (BrushHandle Handle)
 Retrieves the list position of the handle.
void SetHeadOfList (BrushHandle Handle)
 Sets the given handle to the head of the 'most popular brush' list, also goes through the rest of the list and removes other instances of it, so as not to duplicate.

Protected Attributes

BOOL ControlsExist
BOOL DropDownInited
INT32 m_LastSmoothness
BrushListm_pBrushList
BrushHandle m_DisplayBrush
CBitmapGridDropDown m_bgddBrushType
CBitmapGridDropDown m_bgddStrokes
INT32 m_SelectedStroke

Static Protected Attributes

static CBrushGadget BrushGadget

Detailed Description

Class for handling the FreeHand tool's information bar.

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

Definition at line 127 of file freeinfo.h.


Constructor & Destructor Documentation

FreeHandInfoBarOp::FreeHandInfoBarOp  ) 
 

Sets the info bars vars to NULL defaults.

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

Definition at line 200 of file freeinfo.cpp.

00201 {
00202     DlgResID = _R(IDD_FREEHANDTOOL);
00203 
00204     // Don't know about the tool and can not retro fit to start with
00205     pTool = NULL;
00206     CanRetroFit = FALSE;
00207 
00208     // The Controls hasve not been created yet
00209     ControlsExist = FALSE;
00210 
00211     m_pBrushList = NULL;
00212 
00213     m_DisplayBrush = BrushHandle_NoBrush;
00214 
00215 /*  m_pStrokeList = NULL;
00216 
00217     m_DisplayStroke = StrokeHandle_NoStroke;
00218     */
00219 
00220     m_SelectedStroke = CONSTANT; // we want to start by displaying the constant stroke
00221 }

FreeHandInfoBarOp::~FreeHandInfoBarOp  ) 
 

destructor

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/2000

Definition at line 234 of file freeinfo.cpp.

00235 {
00236     if (m_pBrushList != NULL)
00237     {
00238         m_pBrushList->clear();
00239         delete m_pBrushList;
00240         m_pBrushList = NULL;
00241     }
00242 
00243     /*
00244     if (m_pStrokeList != NULL)
00245     {
00246         m_pStrokeList->RemoveAll();
00247         delete m_pStrokeList;
00248         m_pStrokeList = NULL;
00249     }
00250     */
00251 }


Member Function Documentation

void FreeHandInfoBarOp::AddBrush BrushHandle  Handle  ) 
 

Overridden version of above function. In this version we specify the handle of the brush to add, plus we do not select the new brush.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
Handle of the brush to add [INPUTS]
Returns:
-

Definition at line 612 of file freeinfo.cpp.

00613 {
00614     // Simply add this to the head of the list
00615     if (m_pBrushList == NULL)
00616     {
00617         // we might get here on start-up before the list is generated so just leave
00618         return;
00619     }
00620     m_pBrushList->push_back(Handle);
00621 
00622     if (ControlsExist)
00623     {
00624         SetBrushListToControl();
00625         SetDisplayBrush();
00626     }
00627 }

void FreeHandInfoBarOp::AddBrush  ) 
 

Tells the infobar that a new brush has been added to the brush component. This function finds the last created brush and selects it as the head of the list of brushes to be displayed in the brush combo.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
- [INPUTS]
Returns:
-

Definition at line 578 of file freeinfo.cpp.

00579 {
00580         UINT32 BrushNum = BrushComponent::GetNumberOfBrushes() - 1;
00581         
00582         // Simply add this to the head of the list
00583         if (m_pBrushList == NULL)
00584         {
00585             ERROR3("Brush list is null in FreeHandInfoBarOp::AddBrush");
00586         }
00587         SetHeadOfList((BrushHandle)BrushNum);
00588         m_DisplayBrush = 2;
00589         // display the new list
00590         if (ControlsExist)
00591         {
00592             SetBrushListToControl();
00593             SetHeadOfListSelected();
00594         }
00595         
00596 }

BrushData FreeHandInfoBarOp::GetBrushDataFromSelection BOOL *  pSelEmpty = NULL  ) 
 

if there is one and only one brush in the selection the this function returns a brush data object representing its current state. If there is any other number then a data item is still returned but it will not be valid

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
- [INPUTS]
pSelectionEmpty - flag is set if the selection is empty [OUTPUTS]
Returns:
brush data object representing a selected brush, you can tell if there are no real brushes selected by looking at the m_BrushHandle member of the returned data

Definition at line 1644 of file freeinfo.cpp.

01645 {
01646     // find all the brushes in the current selection
01647     List NodeList;
01648     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(AttrBrushType));
01649     BrushData Data; // initialises to default values
01650     INT32 NumItems = NodeList.GetCount();
01651     
01652     // we can only retrieve a valid data item if there is a single item selected,
01653     // if there is any other number then we must return
01654     switch (NumItems)
01655     {
01656         case 0:
01657             if (pSelEmpty != NULL)
01658                 *pSelEmpty = TRUE;
01659             NodeList.DeleteAll();
01660             return Data;
01661         case 1:
01662             if (pSelEmpty != NULL)
01663                 *pSelEmpty = FALSE;
01664             break;
01665         default:
01666             if (pSelEmpty != NULL)
01667                 *pSelEmpty = FALSE;
01668             NodeList.DeleteAll();
01669             return Data;
01670     }
01671 
01672     // we've got an item, so find its applied brush attribute
01673     NodeListItem * pItem = (NodeListItem *)NodeList.GetHead();
01674 
01675     if (pItem)
01676     {
01677         Node* pBrush = pItem->pNode;
01678         if (pBrush)
01679         {
01680             AttrBrushType* pAttrBrush = (AttrBrushType*)pBrush;
01681             if (pAttrBrush->GetBrushHandle() != BrushHandle_NoBrush)
01682             {
01683                 Data = pAttrBrush->GetBrushData();
01684                 
01685             }
01686         }
01687     }
01688     NodeList.DeleteAll();
01689     return Data;
01690 }

static CBrushGadget* FreeHandInfoBarOp::GetBrushGadget  )  [inline, static]
 

Definition at line 155 of file freeinfo.h.

00155 { return &BrushGadget;}

BrushHandle FreeHandInfoBarOp::GetBrushHandleFromControlIndex BrushHandle  Index  )  [protected]
 

Retrieves the brushhandle of the Indexth item in the list.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
Index - the index selected from _R(IDC_BRUSHTYPE) [INPUTS]
Returns:
the brush handle in our 'most popular brushes' list

Definition at line 2521 of file freeinfo.cpp.

02522 {
02523     BrushHandle RetVal = BrushHandle_NoBrush;
02524     if (m_pBrushList != NULL)
02525     {
02526         size_t i = (size_t)Index; // No, I don't know why it's declared to take a BrushHandle - bizarre - amb
02527         if (i<m_pBrushList->size())
02528         {
02529             BrushList::const_iterator iter = m_pBrushList->begin();
02530             for (size_t n=0; n<i; n++) iter++;
02531             return *iter;
02532         }
02533     }
02534     return RetVal;
02535 }

BrushHandle FreeHandInfoBarOp::GetBrushHandleFromSelection BOOL *  pSelEmpty = NULL  )  [protected]
 

To find out if there are any brushed objects in the selection.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
- [INPUTS]
pSelectionEmpty - flag is set if the selection is empty [OUTPUTS]
Returns:
handle of the brush in the selection. Note that if there are many different brushes selected then BrushHandle_NoBrush will be returned

Definition at line 1707 of file freeinfo.cpp.

01708 {
01709     // find all the brushes in the current selection
01710     List NodeList;
01711     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(AttrBrushType), TRUE);
01712     BrushData Data; // initialises to default values
01713     INT32 NumItems = NodeList.GetCount();
01714 
01715     BrushHandle SelHandle = BrushHandle_NoBrush;
01716 
01717     if (NumItems != 0)
01718     {
01719         if (pSelEmpty !=NULL)
01720             *pSelEmpty = FALSE;
01721         // we've got an item, so find its applied brush attribute
01722         NodeListItem * pItem = (NodeListItem *)NodeList.GetHead();
01723 //      BrushHandle LastHandle = BrushHandle_NoBrush;
01724         BOOL bFirst = TRUE;
01725 
01726         AttrBrushType* pAttrBrush = NULL;
01727         Node* pBrush = NULL;
01728         while (pItem)
01729         {
01730             pBrush = pItem->pNode;
01731             if (pBrush)
01732             {
01733                 pAttrBrush = (AttrBrushType*)pBrush;
01734                 if (bFirst)
01735                 {
01736                     SelHandle = pAttrBrush->GetBrushHandle();
01737                     bFirst = FALSE;
01738                 }
01739                 else
01740                 {
01741                     // if we have different brushes then show the 'many' string
01742                     if (pAttrBrush->GetBrushHandle() != SelHandle)
01743                     {
01744                         SelHandle = BrushHandle_Many;
01745                         break;
01746                     }
01747                 }
01748             }
01749             pItem = (NodeListItem *)NodeList.GetNext(pItem);
01750         }
01751     }
01752     else
01753     {
01754         // see if we actually have anything in the selection
01755         SelRange* pSel = GetApplication()->FindSelection();
01756         if (pSel && pSel->IsEmpty())
01757         {
01758             if (pSelEmpty != NULL)
01759                 *pSelEmpty = TRUE;
01760         }
01761     }
01762     NodeList.DeleteAll();
01763     return SelHandle;
01764 }

INT32 FreeHandInfoBarOp::GetControlIndexFromBrushHandle BrushHandle  Handle  )  [protected]
 

Retrieves the list position of the handle.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
Handle - the brush handle that we want to locate [INPUTS]
Returns:
the position of Handle within our brush list, or - 1 if its not there

Definition at line 2549 of file freeinfo.cpp.

02550 {
02551     INT32 Retval = -1;
02552     if (m_pBrushList != NULL)
02553     {
02554         INT32 Counter = 0;
02555         BrushList::const_iterator iter;
02556         for (iter = m_pBrushList->begin(); iter != m_pBrushList->end(); iter++)
02557         {
02558             if (*iter == Handle)
02559             {
02560                 Retval = Counter;
02561                 break;
02562             }
02563             Counter++;
02564         }
02565     }
02566     return Retval;
02567 }

INT32 FreeHandInfoBarOp::GetStrokeIndexFromValueFunctionID ValueFunctionID  ID  )  [protected]
 

Bit of a last minute bodge this, as we are trying to implement a small subset of the value functions into the stroke combo at fixed indexes. We will map the ValueFunctionID used by the ValueFunctions to the index into the combo.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
ID of the value function [INPUTS]
Returns:
the corresponding index of this stroke into the stroke combo, if we get an unrecognised ID to be on the safe side we will return CONSTANT

Definition at line 2395 of file freeinfo.cpp.

02396 {
02397     INT32 ReturnVal = CONSTANT;  // if we get an invalid ID we will just stick to this
02398     switch (ID)
02399     {
02400         case ValueFunctionID_None:
02401             break;
02402         case ValueFunctionID_Constant:
02403             break;
02404         case ValueFunctionID_RampS:
02405             ReturnVal = RAMPS;
02406             break;  
02407         case ValueFunctionID_RampS2:
02408             ReturnVal = RAMPS2;
02409             break;  
02410         case ValueFunctionID_Teardrop:
02411             ReturnVal = TEARDROP;
02412             break;
02413         case ValueFunctionID_Ellipse:
02414             ReturnVal = ELLIPSE;
02415             break;
02416         case ValueFunctionID_Blip:
02417             ReturnVal = BLIP;
02418             break;
02419         case ValueFunctionID_RampL:
02420             ReturnVal = RAMPL;
02421             break;
02422         case ValueFunctionID_RampL2:
02423             ReturnVal = RAMPL2;
02424             break;
02425         case ValueFunctionID_DoubleRampS:
02426             ReturnVal = DOUBLERAMPS;
02427             break;  
02428         case ValueFunctionID_TeardropCurvedEnd:
02429             ReturnVal = TEARDROPCURVEDEND;
02430             break;
02431         case ValueFunctionID_SawTooth:
02432             ReturnVal = SAWTOOTH;
02433             break;  
02434         case ValueFunctionID_Propeller:
02435             ReturnVal = PROPELLER;
02436             break;  
02437         case ValueFunctionID_Intestine:
02438             ReturnVal = INTESTINE;
02439             break;  
02440         case ValueFunctionID_Decay:
02441             ReturnVal = DECAY;
02442             break;  
02443         case ValueFunctionID_BevelEnds:
02444             ReturnVal = BEVELENDS;
02445             break;  
02446         case ValueFunctionID_SS_Yacht:
02447             ReturnVal = SS_Yacht;
02448             break;  
02449         case ValueFunctionID_SS_Iron:
02450             ReturnVal = SS_Iron;
02451             break;  
02452         case ValueFunctionID_SS_Reed:
02453             ReturnVal = SS_Reed;
02454             break;  
02455         case ValueFunctionID_SS_Meteor:
02456             ReturnVal = SS_Meteor;
02457             break;  
02458         case ValueFunctionID_SS_Petal:
02459             ReturnVal = SS_Petal;
02460             break;  
02461         case ValueFunctionID_SS_Comet:
02462             ReturnVal = SS_Comet;
02463             break;  
02464         case ValueFunctionID_SS_Fallout:
02465             ReturnVal = SS_Fallout;
02466             break;  
02467         case ValueFunctionID_SS_Torpedo:
02468             ReturnVal = SS_Torpedo;
02469             break;  
02470         case ValueFunctionID_SS_Missile:
02471             ReturnVal = SS_Missile;
02472             break;  
02473         case ValueFunctionID_SS_Convex:
02474             ReturnVal = SS_Convex;
02475             break;  
02476         case ValueFunctionID_SS_Concave:
02477             ReturnVal = SS_Concave;
02478             break;
02479         case ValueFunctionID_SS_SlimBlip:
02480             ReturnVal = SS_SlimBlip;
02481             break;  
02482         case ValueFunctionID_SS_Cigar:
02483             ReturnVal = SS_Cigar;
02484             break;  
02485         case ValueFunctionID_SS_Cigar2:
02486             ReturnVal = SS_Cigar2;
02487             break;  
02488         case ValueFunctionID_SS_Cigar3:
02489             ReturnVal = SS_Cigar3;
02490             break;  
02491         case ValueFunctionID_SS_OceanLiner:
02492             ReturnVal = SS_OceanLiner;
02493             break;  
02494         case ValueFunctionID_SS_Goldfish:
02495             ReturnVal = SS_Goldfish;
02496             break;  
02497         case ValueFunctionID_SS_Barb:
02498             ReturnVal = SS_Barb;
02499             break;  
02500 
02501         default:
02502             ERROR3("Illegal ValueFunction ID");
02503             break;
02504     }
02505 
02506     return ReturnVal;
02507 }

void FreeHandInfoBarOp::HandleBrushSelectChange  )  [protected]
 

Called when a DIM_SELECTION message is received from _R(IDC_BRUSHTYPE).

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
- [INPUTS]
Returns:
-
Notes: 10/10/2000 We have been through a few variants of this, but the current version is that when we select a brush from the drop down it is selected to draw with as well as being used to apply to the selection.

Definition at line 755 of file freeinfo.cpp.

00756 {
00757 //#ifdef BUILDNEWBRUSHES
00758     
00759     // if we don't have a document then forget it, though its not erroneous
00760     Document* pDoc = Document::GetCurrent();
00761     if (!pDoc)
00762         return;
00763 
00764     // Someone selected a new brush
00765     INT32 iIndex = m_bgddBrushType.GetSelected();
00766 
00767     BrushHandle SelHandle;
00768     
00769     // the zeroth index is always reserved for the 'no-brush' 
00770 //  if (iIndex == 0)
00771 //      SelHandle = BrushHandle_NoBrush;
00772 //  else
00773         SelHandle = GetBrushHandleFromControlIndex(iIndex);
00774     //TRACEUSER( "Diccon", _T("Brush Combo: Handle = %d, Index = %d\n"), SelHandle, Index); 
00775 
00776     // tell the tool our selection has changed
00777     if (pTool != NULL)
00778     {
00779         pTool->SetBrushUpdateState(UPDATE_ONIDLE);
00780         pTool->BrushSelected(SelHandle);
00781     }
00782             
00783     if (SelHandle != BrushHandle_NoBrush)
00784     {
00785         SetHeadOfList(SelHandle);
00786         SetBrushListToControl();
00787         m_DisplayBrush = SelHandle;
00788     //  TRACEUSER( "Diccon", _T("Brush Combo: Handle = %d, Index = %d\n"), SelHandle, Index);SetBrushListToControl();   
00789         SetHeadOfListSelected();
00790     }
00791     else
00792     {
00793         m_DisplayBrush = SelHandle;
00794     //  SetDisplayBrush();
00795     }
00796         
00797     
00798 
00799 //#endif
00800 }

void FreeHandInfoBarOp::HandleCreate  )  [protected]
 

Called when a DIM_CREATE message is received.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
- [INPUTS]
Returns:
-

Definition at line 677 of file freeinfo.cpp.

00678 {
00679     if (WindowID!=NULL)
00680     {
00681         // Set the state of the pressure button according to the Op's state.
00682         // Why buttons on infobars can't dynamically auto-connect to their ops is beyond me
00683         UpdateState();
00684 
00685         // Set the range of the control
00686         SetGadgetRange(_R(IDC_FREEHANDSLIDER), 0, 100, 5);
00687         SetGadgetBitmaps(_R(IDC_FREEHANDSLIDER), _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER));
00688 
00689         // and its position
00690         INT32 Smoothness = 50;
00691         if (pTool!=NULL)
00692             Smoothness = pTool->GetSmoothness();
00693         SetLongGadgetValue(_R(IDC_FREEHANDSLIDER), Smoothness);
00694     
00695         // Set the percentage string
00696         TCHAR Str[32];
00697         String_32 jcf(_R(IDS_PERCENT_FORMAT));
00698         camSnprintf(Str, 32, jcf, (INT32) Smoothness);
00699         String_32 PercentStr(Str);
00700         SetStringGadgetValue(_R(IDC_FREEHANDPERCENT), PercentStr);
00701     
00702         // Set the Retro field (Will be empty initially)
00703         if (pTool!=NULL)
00704             CanRetroFit = pTool->IsRetroPathStillValid();
00705         SetRetroString();
00706         
00707         // only initialise the brush list once otherwise we upset the order
00708         if (m_pBrushList == NULL || m_pBrushList->size() == 0)
00709             InitBrushList();
00710 
00711         // Create the brush type combobox.
00712         m_bgddBrushType.Init(WindowID, _R(IDC_BRUSHTYPE));
00713         m_bgddBrushType.SetColumns(3);
00714         m_bgddBrushType.SetItemSize(wxSize(75, 40));
00715 
00716         // Create the stroke type combobox.
00717         m_bgddStrokes.Init(WindowID, _R(IDC_STROKETYPE));
00718         m_bgddStrokes.SetColumns(3);
00719         m_bgddStrokes.SetItemSize(wxSize(50, 50));
00720 
00721         // create our brush list objects and put them in the control
00722         SetBrushListToControl();
00723 
00724         // make sure the combo shows the right thing
00725         SetBrushComboFromSelection();
00726 //#ifdef BUILDNEWBRUSHES
00727         // set up the brush gadget
00728 PORTNOTE("other", "Disabled BrushGadget")
00729 #ifndef EXCLUDE_FROM_XARALX
00730         BrushGadget.LinkControlButton (this, _R(IDC_EDITBRUSH), _R(IDBBL_BRUSHEDIT), _R(IDS_BRUSHEDITDLG));
00731         BrushGadget.DisableTimeStamping ();
00732 #endif
00733 //#endif    
00734     
00735     }
00736     // Mark the controls as existing
00737     ControlsExist = TRUE;
00738 }

void FreeHandInfoBarOp::HandleSliderPosChanging  )  [protected]
 

Called when a SLIDER_POS_CHANGING message is received.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
- [INPUTS]
Returns:
-

Definition at line 1581 of file freeinfo.cpp.

01582 {
01583     // Find the current scrollers position
01584     TCHAR Str[32];
01585     BOOL Valid;
01586     INT32 Result = GetLongGadgetValue(_R(IDC_FREEHANDSLIDER), 0, 100, 0, &Valid);
01587 
01588     // Build the Percentage string and set it
01589     String_32 jcf(_R(IDS_PERCENT_FORMAT));
01590     camSnprintf(Str, 32, jcf, (INT32) Result);
01591     String_8 PercentStr(Str);
01592     SetStringGadgetValue(_R(IDC_FREEHANDPERCENT), PercentStr);
01593 
01594     // Tell the freehand tool about the new smoothness
01595     if (Valid)
01596     {
01597         // Set the smoothness and re-fit the path if possible
01598         pTool->SetSmoothness(Result);
01599         pTool->RetroFitChanging();
01600     }
01601 
01602 }

void FreeHandInfoBarOp::HandleStrokeSelectChange  )  [protected]
 

Called when a DIM_SELECTION message is received from _R(IDC_STROKETYPE).

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/3/2000
Parameters:
- [INPUTS]
Returns:
-

Definition at line 814 of file freeinfo.cpp.

00815 {
00816     // if we don't have a document then forget it, though its not erroneous
00817     Document* pDoc = Document::GetCurrent();
00818     if (!pDoc)
00819         return;
00820 
00821     // Someone selected a new brush
00822     INT32 Index = m_bgddStrokes.GetSelected();
00823 
00824 
00825     // what we are going to do is apply a stroke attribute and a variable width attribute at the 
00826     // same time via the attribute manager. This will require making a list
00827 
00828     List AttribsList;
00829     
00830     // create new list items
00831     NodeAttributePtrItem* pStrokeItem = new NodeAttributePtrItem;
00832     if (pStrokeItem == NULL)
00833     {
00834         ERROR3("Unable to create new stroke item in FreeHandInfoBarOp::HandleStrokeSelectChange");
00835         return;
00836     }
00837     
00838 
00839     NodeAttributePtrItem* pVarWidthItem = new NodeAttributePtrItem;
00840     if (pVarWidthItem == NULL)
00841     {
00842         ERROR3("Unable to create new variable width item in FreeHandInfoBarOp::HandleStrokeSelectChange");
00843         delete pStrokeItem;
00844         return;
00845     }
00846 
00847     NodeAttribute* pVarWidth = NULL;    
00848     NodeAttribute* pStrokeType = NULL;
00849 
00850     // now make a pathprocessor and a stroke attribute, note that if we apply a CONSTANT stroke we don't need to
00851     PathProcessorStroke* PPS = NULL;
00852     if (Index != CONSTANT)
00853     {
00854         PPS = new PathProcessorStroke;
00855         if (PPS == NULL)
00856         {
00857             ERROR3("Unable to create new path processor in FreeHandInfoBarOp::HandleStrokeSelectChange");
00858             delete pStrokeItem;
00859             delete pVarWidthItem;
00860             return;
00861         }
00862     }
00863 
00864     StrokeTypeAttrValue NewStroke(PPS);
00865     pStrokeType = NewStroke.MakeNode();
00866     
00867     if (pStrokeType == NULL)
00868     {
00869         ERROR3("Unable to create new stroke attribute in FreeHandInfoBarOp::HandleStrokeSelectChange");
00870         delete pStrokeItem;
00871         delete pVarWidthItem;
00872         delete PPS;
00873         return;
00874     }
00875 
00876     pStrokeItem->NodeAttribPtr = pStrokeType;
00877     
00878 
00879     switch (Index)
00880     {
00881         case CONSTANT:
00882         {
00883             // Create a default variable width value (should get optimised out when applied to the doc)
00884             VariableWidthAttrValue VarWidth; // creates a CONSTANT variable width
00885             
00886             pVarWidth = VarWidth.MakeNode();
00887 
00888             if (pVarWidth)
00889             {
00890                 pVarWidthItem->NodeAttribPtr = pVarWidth;
00891             }
00892             else
00893             {
00894                 delete pVarWidthItem;
00895                 return;
00896             }
00897         }
00898         break;
00899         
00900         case RAMPL:
00901         {
00902             // create our attrval with a valuefunction
00903             VariableWidthAttrValue VarWidth(new ValueFunctionRampL);
00904 
00905             pVarWidth = VarWidth.MakeNode();
00906 
00907             if (pVarWidth)
00908             {
00909                 pVarWidthItem->NodeAttribPtr = pVarWidth;
00910             }
00911             else
00912             {
00913                 delete pStrokeItem;
00914                 delete pVarWidthItem;
00915                 delete pStrokeType;
00916                 return;
00917             }
00918         }
00919         break;
00920 
00921         case RAMPL2:
00922         {
00923             // create our attrval with a valuefunction
00924             VariableWidthAttrValue VarWidth(new ValueFunctionRampL2);
00925 
00926             pVarWidth = VarWidth.MakeNode();
00927 
00928             if (pVarWidth)
00929             {
00930                 pVarWidthItem->NodeAttribPtr = pVarWidth;
00931             }
00932             else
00933             {
00934                 delete pStrokeItem;
00935                 delete pVarWidthItem;
00936                 delete pStrokeType;
00937                 return;
00938             }
00939         }
00940         break;
00941 
00942         case RAMPS:
00943         {
00944             // create our attrval with a valuefunction
00945             VariableWidthAttrValue VarWidth(new ValueFunctionRampS);
00946 
00947             pVarWidth = VarWidth.MakeNode();
00948 
00949             if (pVarWidth)
00950             {
00951                 pVarWidthItem->NodeAttribPtr = pVarWidth;
00952             }
00953             else
00954             {
00955                 delete pStrokeItem;
00956                 delete pVarWidthItem;
00957                 delete pStrokeType;
00958                 return;
00959             }
00960         }
00961         break;
00962 
00963         case RAMPS2:
00964         {
00965             // create our attrval with a valuefunction
00966             VariableWidthAttrValue VarWidth(new ValueFunctionRampS2);
00967 
00968             pVarWidth = VarWidth.MakeNode();
00969 
00970             if (pVarWidth)
00971             {
00972                 pVarWidthItem->NodeAttribPtr = pVarWidth;
00973             }
00974             else
00975             {
00976                 delete pStrokeItem;
00977                 delete pVarWidthItem;
00978                 delete pStrokeType;
00979                 return;
00980             }
00981         }
00982         break;
00983 
00984         case BLIP:
00985         {
00986             // create our attrval with a valuefunction
00987             VariableWidthAttrValue VarWidth(new ValueFunctionBlip);
00988 
00989             pVarWidth = VarWidth.MakeNode();
00990 
00991             if (pVarWidth)
00992             {
00993                 pVarWidthItem->NodeAttribPtr = pVarWidth;
00994             }
00995             else
00996             {
00997                 delete pStrokeItem;
00998                 delete pVarWidthItem;
00999                 delete pStrokeType;
01000                 return;
01001             }
01002         }
01003         break;
01004 
01005         case ELLIPSE:
01006         {
01007             // create our attrval with a valuefunction
01008             VariableWidthAttrValue VarWidth(new ValueFunctionEllipse);
01009 
01010             pVarWidth = VarWidth.MakeNode();
01011 
01012             if (pVarWidth)
01013             {
01014                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01015             }
01016             else
01017             {
01018                 delete pStrokeItem;
01019                 delete pVarWidthItem;
01020                 delete pStrokeType;
01021                 return;
01022             }
01023 
01024         }
01025         break;
01026 
01027         case TEARDROP:
01028         {
01029             // create our attrval with a valuefunction
01030             VariableWidthAttrValue VarWidth(new ValueFunctionTeardrop);
01031 
01032             pVarWidth = VarWidth.MakeNode();
01033 
01034             if (pVarWidth)
01035             {
01036                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01037             }
01038             else
01039             {
01040                 delete pStrokeItem;
01041                 delete pVarWidthItem;
01042                 delete pStrokeType;
01043                 return;
01044             }
01045         }
01046         break;
01047 
01048         case TEARDROPCURVEDEND:
01049         {
01050             // create our attrval with a valuefunction
01051             VariableWidthAttrValue VarWidth(new ValueFunctionTeardropCurvedEnd);
01052 
01053             pVarWidth = VarWidth.MakeNode();
01054 
01055             if (pVarWidth)
01056             {
01057                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01058             }
01059             else
01060             {
01061                 delete pStrokeItem;
01062                 delete pVarWidthItem;
01063                 delete pStrokeType;
01064                 return;
01065             }
01066         }
01067         break;
01068 
01069         case DOUBLERAMPS:
01070         {
01071             // create our attrval with a valuefunction
01072             VariableWidthAttrValue VarWidth(new ValueFunctionDoubleRampS);
01073 
01074             pVarWidth = VarWidth.MakeNode();
01075 
01076             if (pVarWidth)
01077             {
01078                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01079             }
01080             else
01081             {
01082                 delete pStrokeItem;
01083                 delete pVarWidthItem;
01084                 delete pStrokeType;
01085                 return;
01086             }
01087         }
01088         break;
01089 
01090         case SAWTOOTH:
01091         {
01092             // create our attrval with a valuefunction
01093             VariableWidthAttrValue VarWidth(new ValueFunctionSawTooth);
01094 
01095             pVarWidth = VarWidth.MakeNode();
01096 
01097             if (pVarWidth)
01098             {
01099                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01100             }
01101             else
01102             {
01103                 delete pStrokeItem;
01104                 delete pVarWidthItem;
01105                 delete pStrokeType;
01106                 return;
01107             }
01108         }
01109         break;
01110 
01111         case PROPELLER:
01112         {
01113             // create our attrval with a valuefunction
01114             VariableWidthAttrValue VarWidth(new ValueFunctionPropeller);
01115 
01116             pVarWidth = VarWidth.MakeNode();
01117 
01118             if (pVarWidth)
01119             {
01120                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01121             }
01122             else
01123             {
01124                 delete pStrokeItem;
01125                 delete pVarWidthItem;
01126                 delete pStrokeType;
01127                 return;
01128             }
01129         }
01130         break;
01131 
01132         case INTESTINE:
01133         {
01134             // create our attrval with a valuefunction
01135             VariableWidthAttrValue VarWidth(new ValueFunctionIntestine);
01136 
01137             pVarWidth = VarWidth.MakeNode();
01138 
01139             if (pVarWidth)
01140             {
01141                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01142             }
01143             else
01144             {
01145                 delete pStrokeItem;
01146                 delete pVarWidthItem;
01147                 delete pStrokeType;
01148                 return;
01149             }
01150         }
01151         break;
01152 
01153         case DECAY:
01154         {
01155             // create our attrval with a valuefunction
01156             VariableWidthAttrValue VarWidth(new ValueFunctionDecay);
01157 
01158             pVarWidth = VarWidth.MakeNode();
01159 
01160             if (pVarWidth)
01161             {
01162                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01163             }
01164             else
01165             {
01166                 delete pStrokeItem;
01167                 delete pVarWidthItem;
01168                 delete pStrokeType;
01169                 return;
01170             }
01171         }
01172         break;
01173 
01174         case BEVELENDS:
01175         {
01176             // create our attrval with a valuefunction
01177             VariableWidthAttrValue VarWidth(new ValueFunctionBevelEnds);
01178 
01179             pVarWidth = VarWidth.MakeNode();
01180 
01181             if (pVarWidth)
01182             {
01183                 pVarWidthItem->NodeAttribPtr = pVarWidth;
01184             }
01185             else
01186             {
01187                 delete pStrokeItem;
01188                 delete pVarWidthItem;
01189                 delete pStrokeType;
01190                 return;
01191             }
01192         }
01193         break;
01194 
01195         case SS_Yacht:
01196         {
01197             // create our attrval with a valuefunction
01198             VariableWidthAttrValue VarWidth(new ValueFunctionSS_Yacht);
01199 
01200             pVarWidth = VarWidth.MakeNode();
01201 
01202             if (pVarWidth)  { pVarWidthItem->NodeAttribPtr = pVarWidth; }
01203             else
01204             {
01205                 delete pStrokeItem;
01206                 delete pVarWidthItem;
01207                 delete pStrokeType;
01208                 return;
01209             }
01210         }
01211         break;
01212 
01213         case SS_Iron:
01214         {
01215             // create our attrval with a valuefunction
01216             VariableWidthAttrValue VarWidth(new ValueFunctionSS_Iron);
01217 
01218             pVarWidth = VarWidth.MakeNode();
01219 
01220             if (pVarWidth)  { pVarWidthItem->NodeAttribPtr = pVarWidth; }
01221             else
01222             {
01223                 delete pStrokeItem;
01224                 delete pVarWidthItem;
01225                 delete pStrokeType;
01226                 return;
01227             }
01228         }
01229         break;
01230 
01231         case SS_Reed:
01232         {
01233             // create our attrval with a valuefunction
01234             VariableWidthAttrValue VarWidth(new ValueFunctionSS_Reed);
01235 
01236             pVarWidth = VarWidth.MakeNode();
01237 
01238             if (pVarWidth)  { pVarWidthItem->NodeAttribPtr = pVarWidth; }
01239             else
01240             {
01241                 delete pStrokeItem;
01242                 delete pVarWidthItem;
01243                 delete pStrokeType;
01244                 return;
01245             }
01246         }
01247         break;
01248 
01249         case SS_Meteor:
01250         {
01251             // create our attrval with a valuefunction
01252             VariableWidthAttrValue VarWidth(new ValueFunctionSS_Meteor);
01253 
01254             pVarWidth = VarWidth.MakeNode();
01255 
01256             if (pVarWidth)  { pVarWidthItem->NodeAttribPtr = pVarWidth; }
01257             else
01258             {
01259                 delete pStrokeItem;
01260                 delete pVarWidthItem;
01261                 delete pStrokeType;
01262                 return;
01263             }
01264         }
01265         break;
01266 
01267         case SS_Petal:
01268         {
01269             // create our attrval with a valuefunction
01270             VariableWidthAttrValue VarWidth(new ValueFunctionSS_Petal);
01271 
01272             pVarWidth = VarWidth.MakeNode();
01273 
01274             if (pVarWidth)  { pVarWidthItem->NodeAttribPtr = pVarWidth; }
01275             else
01276             {
01277                 delete pStrokeItem;
01278                 delete pVarWidthItem;
01279                 delete pStrokeType;
01280                 return;
01281             }
01282         }
01283         break;
01284 
01285         case SS_Comet:
01286         {
01287             // create our attrval with a valuefunction
01288             VariableWidthAttrValue VarWidth(new ValueFunctionSS_Comet);
01289 
01290             pVarWidth = VarWidth.MakeNode();
01291 
01292             if (pVarWidth)  { pVarWidthItem->NodeAttribPtr = pVarWidth; }
01293             else
01294             {
01295                 delete pStrokeItem;
01296                 delete pVarWidthItem;
01297                 delete pStrokeType;
01298                 return;
01299             }
01300         }
01301         break;
01302 
01303         case SS_Fallout:
01304         {
01305             // create our attrval with a valuefunction
01306             VariableWidthAttrValue VarWidth(new ValueFunctionSS_Fallout);
01307 
01308             pVarWidth = VarWidth.MakeNode();
01309 
01310             if (pVarWidth)  { pVarWidthItem->NodeAttribPtr = pVarWidth; }
01311             else
01312             {
01313                 delete pStrokeItem;
01314                 delete pVarWidthItem;
01315                 delete pStrokeType;
01316                 return;
01317             }
01318         }
01319         break;
01320 
01321         case SS_Torpedo:
01322         {
01323             // create our attrval with a valuefunction
01324