a2dStTool Class Reference
[Objects used for interactive manipulation.]

The a2dStTool is used to derive tools from. More...

#include <sttool.h>

Inheritance diagram for a2dStTool:

Inheritance graph
[legend]
Collaboration diagram for a2dStTool:

Collaboration graph
[legend]

List of all members.

Public Types

enum  a2dOpaqueMode { a2dOpaqueMode_Off = 0x00000000, a2dOpaqueMode_Tool = 0x00000001, a2dOpaqueMode_Tool_FixedStyle = 0x00000002, a2dOpaqueMode_Controller = 0x00000004 }
 how editing transparency will be handled More...

Public Member Functions

 a2dStTool (a2dStToolContr *controller)
 a2dStTool (const a2dStTool &other, CloneOptions options)
 constructor
virtual ~a2dStTool ()
 destructor
virtual bool OnPushNewTool (a2dBaseTool *newtool)
 halts the tool is busy
virtual void SetActive (bool active=true)
 set the tool active or inactive.
virtual bool EnterBusyMode ()
 starts a new action (e.g drawing something ) in a tool that is already pushed.
virtual void FinishBusyMode (bool closeCommandGroup=true)
 Called when the user finishes editing a distinct object */.
virtual void AbortBusyMode ()
 Called when the user aborts editing a distinct object */.
void AddCurrent (a2dCanvasObject *objectToAdd)
 add the current canvas object to parent as child
virtual void Render ()
 implement rendering
void RenderAnotation ()
 to render the tools its anotation text.
a2dStToolContrGetStToolContr ()
 return the staacked tool controller
a2dObjectEditToolStartEditTool (a2dCanvasObject *objecttoedit)
 to start editing tool when wanted
void SetEditAtEnd (bool editatend)
 flag for setting editing tool after drawing a primitive.
bool GetEditAtEnd ()
 see SetEditAtEnd
void SetOpacityFactorEditcopy (wxUint8 editOpacity)
 when enabling m_useEditOpaque, this is how transparent the editcopy will be made.
void SetUseOpaqueEditcopy (a2dOpaqueMode editOpaque)
 When set true, instead of using a special style for editcopies, a clone of the.
void SetConnectionGenerator (a2dConnectionGenerator *connectionGenerator)
 Set class for generating new connection objects between object and pins.
a2dConnectionGeneratorGetConnectionGenerator () const
 Get class for generating new connection objects between object and pins.
a2dCanvasObjectGetOriginal ()
 object to draw or edit
bool SetContext (a2dIterC &ic, a2dCanvasObject *startObject=NULL)
 defines the context, relative to which this tools works.

Static Public Attributes

static const wxEventType sm_toolComEventAddObject
static const wxEventType sm_toolComEventSetEditObject

Protected Member Functions

a2dPinFindUnConnectedPin (a2dCanvasObject *root, double x, double y, a2dPinClass *withPinClass=NULL)
 return the first pin which is not connected at position.
void MouseToToolWorld (int x, int y, double &xWorldLocal, double &yWorldLocal)
 calculate world coordinates from devide coordinates
wxRect GetAbsoluteArea (a2dCanvasObject *object)
 area occupied by this object
void GetTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *descent=NULL, wxCoord *externalLeading=NULL)
 return text extends of string
void OnPaint (wxPaintEvent &event)
 handler for paint event
void OnIdle (wxIdleEvent &event)
 handler for idle events
void OnUndoEvent (a2dCommandProcessorEvent &event)
 handler for Undo event
void OnDoEvent (a2dCommandProcessorEvent &event)
 handler for Do event
void OnComEvent (a2dComEvent &event)
 called when a tool has changed (fill stroke layer spline )
virtual void GenerateAnotation ()
 to display a string along with a tool drawing.
void AddAnotationToPendingUpdateArea ()
 after calculating anotation position and string, extend the boundingbox of the tools with it.
void GetKeyIncrement (double *xIncr, double *yIncr, bool altDown)
 get the increments used when moving is done with cursor keys
void OnKeyDown (wxKeyEvent &event)
 called on key down events
void OnKeyUp (wxKeyEvent &event)
 called on key up events
void OnChar (wxKeyEvent &event)
 called on key events
void OnMouseEvent (wxMouseEvent &event)
 called on mouse events
virtual void AdjustRenderOptions ()
 Adjust the rendering options to the needs of this tool.
virtual bool CreateToolObjects ()
 Create the editcopy and other tool objects (e.g. decorations).
virtual void CleanupToolObjects ()
 Cleanup the editcopy other tool objects (e.g. decorations).

Protected Attributes

wxString m_anotation
 anotation string, which is in general modified by the tools to display position etc.
int m_xanotation
 x position of anotation text
int m_yanotation
 y position of anotation text
int m_prevxanotation
int m_prevyanotation
int m_x
 x of mouse in device
int m_y
 y of mouse in device
int m_xprev
 previous x of mouse in device
int m_yprev
 previous y of mouse in device
double m_xwprev
 x world coordinates old or new value of mouse
double m_ywprev
 y world coordinates old or new value of mouse
int m_dragstartx
 x of mouse in device at start drag
int m_dragstarty
 y of mouse in device at start drag
bool m_dragStarted
 used to indicate that a first drag event has arrived.
a2dCanvasObjectPtr m_canvasobject
 This is the object currently edited.
a2dCanvasObjectPtr m_original
 This is the original object selected for editing.
a2dStToolContrm_stcontroller
 controller for canvas
a2dConnectionGeneratorm_connectionGenerator
 Use this connection generator for wires and pins.
bool m_renderOriginal
 if yes, the original object is rendered in place
bool m_renderEditcopy
 if yes, the editcopy is rendered in place
bool m_renderEditcopyOnTop
 if yes, the editcopy is rendered on top in usual style
bool m_renderEditcopyEdit
 if yes, the editcopy is rendered on top in edit style
bool m_renderEditcopyRectangle
 if yes, the editcopy is rendered on top as bounding box rectangle
bool m_editatend
 when drawing something editing must follow, using the a2dRecursiveEditTool
wxUint8 m_editOpacityFactor
 when using cloned style for editcopy, use this opacity.
a2dOpaqueMode m_useEditOpaque
 when true editcopies are using a half transparent cloned style.

Friends

class a2dStToolEvtHandler
class a2dStToolFixedToolStyleEvtHandler


Detailed Description

The a2dStTool is used to derive tools from.

Those are controlled by a a2dStToolContr class. Those type of tools understand zooming and stacked redraw.

See also:
a2dStToolContr

Definition at line 113 of file sttool.h.


Member Enumeration Documentation

how editing transparency will be handled

Enumerator:
a2dOpaqueMode_Off  tool will not use apaque edit mode
a2dOpaqueMode_Tool  tool will apaque edit mode and setting are from the tool
a2dOpaqueMode_Tool_FixedStyle  tool will apaque edit mode and setting are from the tool but style is fixed
a2dOpaqueMode_Controller  tool will use apaque edit mode as set in Controller

Definition at line 189 of file sttool.h.


Constructor & Destructor Documentation

a2dStTool::a2dStTool ( a2dStToolContr controller  ) 

Parameters:
controller Pointer to a a2dStToolContr controller.

Definition at line 795 of file sttool.cpp.


Member Function Documentation

void a2dStTool::SetActive ( bool  active = true  )  [virtual]

set the tool active or inactive.

If the tool needs initializing after it was inactive for a while, override this function to re-initialize the tool. This function can be used to distribute its settings for style etc. to the documents

See also:
a2dCanvasDocument::GetCanvasCommandProcessor(). The default implementation sets fill, stroke to the commandprocessor, but only when m_doSetStyleToCommandProc is true. If you need more complicated behaviour just override.

Reimplemented from a2dBaseTool.

Reimplemented in a2dObjectEditTool, a2dMultiEditTool, and a2dDrawWirePolylineLTool.

Definition at line 903 of file sttool.cpp.

bool a2dStTool::EnterBusyMode (  )  [virtual]

starts a new action (e.g drawing something ) in a tool that is already pushed.

Opens a new a2dCommandGroup, which will be closed at the end of an action. This is normally in FinishBusyMode(), but might be delayed when other tools are pushed, like the edit tool to further edit the drawn figure. This should become part of the same command group.

Reimplemented from a2dBaseTool.

Reimplemented in a2dObjectEditTool, a2dSimpleEditPolygonTool, a2dStDrawTool, a2dDragTool, a2dDragNewTool, a2dRotateTool, a2dDrawWirePolylineLTool, a2dDragMultiTool, and a2dFastDragMultiTool.

Definition at line 950 of file sttool.cpp.

void a2dStTool::FinishBusyMode ( bool  closeCommandGroup = true  )  [virtual]

Called when the user finishes editing a distinct object */.

See also:
EnterBusyMode,

GetActive You should call the base class (this) version at the END of your function

Reimplemented from a2dBaseTool.

Reimplemented in a2dStDrawTool, a2dDragTool, a2dDragNewTool, a2dRotateTool, a2dDrawWirePolylineLTool, and a2dDragMultiTool.

Definition at line 964 of file sttool.cpp.

void a2dStTool::AbortBusyMode (  )  [virtual]

Called when the user aborts editing a distinct object */.

See also:
EnterBusyMode This is supposed to undo aeverything the tool did since entering busy mode

Reimplemented from a2dBaseTool.

Reimplemented in a2dObjectEditTool, a2dSimpleEditPolygonTool, a2dStDrawTool, a2dDragTool, a2dRotateTool, a2dDrawWirePolylineLTool, a2dDragMultiTool, and a2dFastDragMultiTool.

Definition at line 980 of file sttool.cpp.

void a2dStTool::AddCurrent ( a2dCanvasObject objectToAdd  ) 

add the current canvas object to parent as child

Parameters:
objectToAdd this is the object to add to the current parentobject

Definition at line 890 of file sttool.cpp.

void a2dStTool::Render (  )  [virtual]

implement rendering

in general is rendering for tools just to draw/render m_canvasobject when set.

Reimplemented from a2dBaseTool.

Reimplemented in a2dObjectEditTool, a2dMasterDrawZoomFirst, a2dDragTool, a2dDragMultiTool, a2dStDrawToolFast, a2dZoomFast, a2dFastSelect, and a2dFastDragMultiTool.

Definition at line 1186 of file sttool.cpp.

void a2dStTool::RenderAnotation (  ) 

to render the tools its anotation text.

Tools can have a line of text displayed while in action, this is done in pixel size.

Definition at line 1263 of file sttool.cpp.

a2dStToolContr* a2dStTool::GetStToolContr (  )  [inline]

return the staacked tool controller

this cast is save, because a2dStTool takes a a2dStToolContr as constructor argument

Definition at line 172 of file sttool.h.

void a2dStTool::SetEditAtEnd ( bool  editatend  )  [inline]

flag for setting editing tool after drawing a primitive.

Parameters:
editatend when true the drawing tool will start a editing tool after drawing a primitive.
Remarks:
it depends on the implementatian of the tool if this flag is used.

Definition at line 183 of file sttool.h.

void a2dStTool::SetOpacityFactorEditcopy ( wxUint8  editOpacity  )  [inline]

when enabling m_useEditOpaque, this is how transparent the editcopy will be made.

Parameters:
editOpacity Real opacity is set opacity * m_OpacityFactor/255

Definition at line 201 of file sttool.h.

void a2dStTool::SetUseOpaqueEditcopy ( a2dOpaqueMode  editOpaque  )  [inline]

When set true, instead of using a special style for editcopies, a clone of the.

fill and stroke of the original are made, and used for the editcopy, but its transparancy is set using m_editOpacityFactor. The effect is that when dragging such an object, that in the editcopy mode, a half transparent object is shown.

Definition at line 209 of file sttool.h.

bool a2dStTool::SetContext ( a2dIterC ic,
a2dCanvasObject startObject = NULL 
)

defines the context, relative to which this tools works.

The more advanged usage of tools is in situation where the tools is used inside a2dCanvasObjects. So the context a2dIterC is in such a situation relative to that object its position.

Reimplemented in a2dObjectEditTool.

Definition at line 855 of file sttool.cpp.

a2dPin * a2dStTool::FindUnConnectedPin ( a2dCanvasObject root,
double  x,
double  y,
a2dPinClass withPinClass = NULL 
) [protected]

return the first pin which is not connected at position.

if withPinClass is set, the pin must have this pinclass. Else m_connectionGenerator->GetPinClassForTask( pin->GetPinClass(), obj ) must be oke, or if no m_connectionGenerator was set, the pin is returned without a check.

Definition at line 1445 of file sttool.cpp.

bool a2dStTool::CreateToolObjects (  )  [protected, virtual]

Create the editcopy and other tool objects (e.g. decorations).

m_original must be set before this function is called

Reimplemented in a2dObjectEditTool, a2dSimpleEditPolygonTool, a2dStDrawTool, a2dSelectTool, a2dDragTool, a2dCopyTool, a2dDragMultiTool, a2dStDrawToolFast, a2dFastDragMultiTool, a2dDrawRectangleToolFast, a2dDrawCircleToolFast, a2dDrawPolygonLToolFast, and a2dDrawPolylineLToolFast.

Definition at line 1053 of file sttool.cpp.


Member Data Documentation

This is the object currently edited.

This is usually a clone of m_original, if m_original exists. This object is directly (without commands) edited by the tool. The m_original is in this case edited indirectly via commands.

Definition at line 333 of file sttool.h.

This is the original object selected for editing.

If there is an original and an editcopy, this is the original. Tools creating objects do not always have an original and an editcopy. This object only manipulated via commands

Definition at line 340 of file sttool.h.

bool a2dStTool::m_renderEditcopy [protected]

if yes, the editcopy is rendered in place

this is not yet supported

Definition at line 352 of file sttool.h.


The documentation for this class was generated from the following files:
a2dStTool Class Reference -- Tue Aug 31 18:34:49 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation