OpSelectBrush Class Reference

This operation can take place only in the Freehand tool. If there is a single selected brush then it makes that brush selected in the combo so that the user can draw with it straight away rather than having to select it in the combo themselves. Note that it is not undoable because a) it makes no change to anything in the document and b) it can only be called whilst in the Freehand tool (and what would happen if it were undone outside of the Freehand tool is rather hard to define). More...

#include <brushop.h>

Inheritance diagram for OpSelectBrush:

Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpSelectBrush ()
 Constructor.
 ~OpSelectBrush ()
 destructor
virtual void Do (OpDescriptor *)
 the all-important Do function
virtual void GetOpName (String_256 *OpName)
 like the title says

Static Public Member Functions

static BOOL Declare ()
 Adds the operation to the list of all known operations.
static OpState GetState (String_256 *Description, OpDescriptor *)
 Find out the state of the operation at the specific time, in this instance the operation can only be launched when we are in the freehand tool.

Detailed Description

This operation can take place only in the Freehand tool. If there is a single selected brush then it makes that brush selected in the combo so that the user can draw with it straight away rather than having to select it in the combo themselves. Note that it is not undoable because a) it makes no change to anything in the document and b) it can only be called whilst in the Freehand tool (and what would happen if it were undone outside of the Freehand tool is rather hard to define).

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/5/2000
See also:
-

Definition at line 257 of file brushop.h.


Constructor & Destructor Documentation

OpSelectBrush::OpSelectBrush  ) 
 

Constructor.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Returns:
-

Definition at line 1523 of file brushop.cpp.

01524 {
01525      
01526 }

OpSelectBrush::~OpSelectBrush  ) 
 

destructor

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Returns:
-

Definition at line 1539 of file brushop.cpp.

01540 {
01541     
01542 }


Member Function Documentation

BOOL OpSelectBrush::Declare  )  [static]
 

Adds the operation to the list of all known operations.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Returns:
TRUE if all went OK, FALSE otherwise

Definition at line 1555 of file brushop.cpp.

01556 {
01557     return (RegisterOpDescriptor(
01558                                 0, 
01559                                 _R(IDS_BRUSH_MAKESELECTED),
01560                                 CC_RUNTIME_CLASS(OpSelectBrush), 
01561                                 OPTOKEN_SELECTBRUSH,
01562                                 OpSelectBrush::GetState,
01563                                 0,  /* help ID */
01564                                 0,  /* bubble ID */
01565                                 0   /* bitmap ID */
01566                                 ));
01567 }

void OpSelectBrush::Do OpDescriptor pOpDesc  )  [virtual]
 

the all-important Do function

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

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 1647 of file brushop.cpp.

01648 {
01649 
01650     AttrBrushType* pSelBrush = CBrushEditDlg::GetSingleSelectedBrushAttribute();
01651 
01652     if (pSelBrush == NULL)
01653     {
01654         ERROR3("No selected brush in OpSelectBrush::Do");
01655         return;
01656     }
01657 
01658     BrushHandle SelHandle = pSelBrush->GetBrushHandle();
01659     
01660     // all we need to do is send a message
01661     BROADCAST_TO_ALL(BrushMsg(SelHandle));
01662 
01663     End();
01664 }

void OpSelectBrush::GetOpName String_256 OpName  )  [virtual]
 

like the title says

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Parameters:
- [INPUTS]
The undo string for the operation [OUTPUTS]
Returns:

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 1626 of file brushop.cpp.

01627 {
01628     *OpName = String_256(_R(IDS_BRUSH_MAKESELECTED));
01629 }  

OpState OpSelectBrush::GetState String_256 Description,
OpDescriptor
[static]
 

Find out the state of the operation at the specific time, in this instance the operation can only be launched when we are in the freehand tool.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Parameters:
Description - GetState fills this string with an approriate description [OUTPUTS] of the current state of the operation
Returns:
The state of the operation, so that menu items (ticks and greying) can be done properly

Definition at line 1586 of file brushop.cpp.

01587 {
01588     OpState State;
01589     
01590     // make sure we have one and only one brush in the selection before we launch the op
01591     AttrBrushType* pAttrBrush = CBrushEditDlg::GetSingleSelectedBrushAttribute();
01592     BrushHandle Handle = BrushHandle_NoBrush;
01593     if (pAttrBrush != NULL)
01594         Handle = pAttrBrush->GetBrushHandle();
01595 
01596     // likewise we must be in the freehand tool
01597     Tool* pTool = Tool::GetCurrent();
01598     if (pTool != NULL && pTool->GetID() != TOOLID_FREEHAND)
01599         pTool = NULL;
01600 
01601     // plus its only worth doing if we are selecting an actual brush
01602     if (Handle != BrushHandle_NoBrush && pTool != NULL)
01603         State.Greyed = FALSE;
01604     else
01605         State.Greyed = TRUE;
01606     
01607     return State;
01608 
01609 }


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