wxArt2D
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
a2dStToolContr Class Reference

The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView. More...

#include <sttool.h>

Inheritance diagram for a2dStToolContr:
Inheritance graph
[legend]
Collaboration diagram for a2dStToolContr:
Collaboration graph
[legend]

Public Member Functions

 a2dStToolContr (a2dDrawingPart *drawingPart, wxFrame *where, bool noStatusEvent=true)
 Constructor. More...
 
 ~a2dStToolContr ()
 destructor
 
virtual void ReStart ()
 sets the m_toptool (if set ) as first tool.
 
wxMenu * GetMousePopupMenu ()
 to get the current mouse menu of the controller More...
 
void SetMousePopupMenu (wxMenu *mousemenu)
 to set the current mouse menu of the controller More...
 
bool PushTool (a2dBaseTool *tool)
 specialize to keep first tool on the stack active More...
 
virtual bool PopTool (a2dSmrtPtr< a2dBaseTool > &poped, bool force=true)
 specialize to keep m_topTool tool active More...
 
void SetZoomoutCentered (bool center)
 if true a zoomout is centered to the view.
 
bool GetZoomoutCentered ()
 see SetZoomoutCentered()
 
void SetZoomFirst (bool zoomfirst)
 first tool on the tool stack is the zoom tool. More...
 
void SetTopTool (a2dBaseTool *toolOnTop)
 when all tools are poped, this tool will be pushed. More...
 
void SetZoomTool (a2dBaseTool *toolForZoom)
 for zooming purposes this tool wil be used More...
 
void SetDragMode (DRAGMODE mode)
 drag mode used in drag tool (if used) More...
 
DRAGMODE GetDragMode ()
 Returns drag mode. More...
 
void SetDrawMode (a2dDrawStyle drawstyle)
 
a2dDrawStyle GetDrawMode ()
 
void SetDefaultBehavior (unsigned int behavior)
 Control the default behavior. More...
 
unsigned int GetDefaultBehavior ()
 
void Undo (wxCommandEvent &)
 redirect to command processor of document
 
void Redo (wxCommandEvent &)
 redirect to command processor of document
 
void EndTool (wxCommandEvent &)
 End the current active tool if not busy.
 
void EditProperties (wxCommandEvent &)
 default implementation for property editing
 
void OnSetmenuStrings (a2dCommandProcessorEvent &event)
 how to set mouse menu undo/redo
 
void ZoomWindow ()
 start one shot zoomtool from popup menu (used while another tool is active)
 
void ZoomPan ()
 zoompan from popup menu (used while another tool is active)
 
void ZoomUndo ()
 go to previous zoom area (used while another tool is active)
 
void Zoomout ()
 show all on canvas
 
void Zoomout2 ()
 zoom out two times the current visible area
 
void Zoomin2 ()
 zoom in two half the current visible area
 
void Zoom (double x, double y, double uppx, double uppy)
 
void ZoomOut2AtMouse ()
 zoom out two times the current visible area at mouse position
 
void ZoomIn2AtMouse ()
 zoom in two half the current visible area at mouse position
 
wxZoomList & GetZoomList ()
 Get zoom stack list, that is use to store zooming areas.
 
void SetFormat (const wxString &format)
 set the format for double to be this
 
wxString GetFormat ()
 
void ClearStateStrings ()
 set all state string to empty.
 
virtual void SetStateString (const wxString &message=wxEmptyString, size_t field=3)
 function called at mouse events, the default displays cursor in statusbar. More...
 
wxPoint GetMousePosition ()
 return mouse position in device coordinates
 
wxFrame * GetFrame ()
 what frame has the statusbar
 
std::vector< wxString > & GetStatusStrings ()
 Get the array containing statusbar strings.
 
virtual bool StartEditingObject (a2dCanvasObject *objectToEdit)
 start editing this object
 
virtual bool StartEditingObject (a2dCanvasObject *objectToEdit, a2dIterC &ic)
 start editing this object
 
bool TriggerReStartEdit (wxUint16 editmode)
 when edit tool is firsttool, restart it.
 
bool RotateObject90LeftRight (bool Right)
 rotate object of first tool on the stack, when appropriate.
 
void SetOpacityFactorEditcopy (wxUint8 editOpacity)
 when enabling m_useEditOpaque, this is how transparent the editcopy will be made. More...
 
wxUint8 GetOpacityFactorEditcopy ()
 see SetOpacityFactorEditcopy()
 
void SetUseOpaqueEditcopy (bool editOpaque)
 When set true, instead of using a special style for editcopies, a clone of the. More...
 
bool GetUseOpaqueEditcopy ()
 see SetUseOpaqueEditcopy()
 
void SetDraggingCanvasOption (bool draggingCanvasOption)
 
bool GetDraggingCanvasOption ()
 
void SetNoSnapKey (int keyCode)
 set key to disable snapping in tools
 
int GetNoSnapKey ()
 what is the key to disable snapping in tools
 
bool GetSelectionStateUndo () const
 set if selection state of tools object is set during undo.
 
void SetSelectionStateUndo (bool selectionStateUndo)
 
bool GetSelectAtEnd () const
 set tool object as selected at end of action
 
void SetSelectAtEnd (bool selectedAtEnd)
 
- Public Member Functions inherited from a2dToolContr
 a2dToolContr (a2dDrawingPart *drawingPart)
 
virtual ~a2dToolContr ()
 destructor
 
void SetDrawingPart (a2dDrawingPart *drawingPart)
 sets the a2dDrawingPart on which the controller will work. More...
 
a2dDrawingPartGetDrawingPart ()
 Get the a2dDrawingPart object that the controller is plugged into.
 
void StopAllTools (bool abort=true)
 all tools currently on the tool stack will be terminated and poped ( forced ) More...
 
void Disable ()
 can be used by a2dCanvas or a2dDrawingPart to disable this class More...
 
a2dBaseToolGetFirstTool () const
 get currently used eventhandler (always the first in the list)
 
const a2dToolListGetToolList () const
 return reference to tool list
 
bool ProcessEvent (wxEvent &event)
 process an event for the object, if the event is not handled by More...
 
void AppendTool (a2dBaseTool *handler)
 append a tool to the list, this tool will recieve an event if the other skipped the event to process. */
 
bool EnableTool (const wxString &tool, bool disableothers)
 enable the tool with the given name More...
 
bool EnableTool (a2dBaseTool *tool, bool disableothers)
 enable the given tool More...
 
bool DisableTool (const wxString &tool)
 disable the tool with the given name More...
 
bool DisableTool (a2dBaseTool *tool)
 disable the tool with the given name More...
 
a2dBaseToolSearchTool (const wxString &tool)
 search for the tools in the tool list with the given name. More...
 
void ActivateTop (bool active)
 (de)activate the first tool in the list. More...
 
bool Activate (const wxString &tool, bool disableothers)
 Activate the tool with the given name. More...
 
bool SetCorridor (const a2dCorridor &corridor)
 define corridor for the controller its first tool
 
virtual void Render ()
 render the tool chain More...
 
void SetSnap (bool doSnap)
 set snap on or off. More...
 
bool GetSnap ()
 get current snap setting ( true or false ).
 
void SetDefaultToolEvtHandler (a2dObject *handler)
 see m_eventHandler
 
a2dObjectGetDefaultToolEventHandler ()
 see m_eventHandler
 
void SetDefaultToolEvtHandlerFixedStyle (a2dObject *handler)
 see m_defaultEventHandlerFixedStyle
 
a2dObjectGetDefaultToolEventHandlerFixedStyle ()
 see m_defaultEventHandlerFixedStyle
 
- Public Member Functions inherited from a2dObject
bool SearchDynamicEventTable (wxEvent &event)
 
void Connect (int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL)
 
bool Disconnect (int winid, int lastId, wxEventType eventType, wxObjectEventFunction func=NULL, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL)
 
void ProcessConnectedEvent (wxEvent &event)
 wxCHECK_VERSION(2,9,0) More...
 
void ConnectEvent (wxEventType type, wxEvtHandler *eventSink)
 
bool DisconnectEvent (wxEventType type, wxEvtHandler *eventSink)
 
bool DisconnectEventAll (wxEvtHandler *eventSink)
 Remove all dynamic events in classA, going to classB (eventSink) More...
 
 a2dObject ()
 constructor
 
virtual ~a2dObject ()
 destructor
 
void operator= (const a2dObject &other)
 assignment operator
 
int GetOwnedBy ()
 like it to be protected, but this does not work with wxList macros More...
 
virtual a2dObjectSetNonDynamic ()
 Call to mark this object as non-dynamic (static/local/auto) More...
 
void CheckReferences ()
 Check zero reference count and delete if count is 0. More...
 
a2dObjectClone (CloneOptions options, a2dRefMap *refs=NULL) const
 create an exact copy of this property
 
 a2dObject (const a2dObject &other, CloneOptions options, a2dRefMap *refs)
 
virtual wxString GetName () const
 Returns the name of this object, if no name is given the internal id will be returned. More...
 
virtual void SetName (const wxString &name)
 Creates the a2dStringProperty PROPID_Name. More...
 
virtual bool IsTemporary_DontSave () const
 Check if this is a temporary object, which should not be saved.
 
void SaveAsDocument (a2dIOHandlerXmlSerOut &out)
 Save this object and all below as an XML document. More...
 
virtual void Save (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
 write all needed to an XML type of file called the CVG format More...
 
void LoadFromDocument (a2dIOHandlerXmlSerIn &parser)
 Load this object and all below from an XML document. More...
 
virtual void Load (wxObject *parent, a2dIOHandlerXmlSerIn &parser)
 load object from CVG file More...
 
wxInt64 GetUniqueSerializationId () const
 return a unique id for this object More...
 
virtual bool AlwaysWriteSerializationId () const
 If true, always write an id. More...
 
virtual bool LinkReference (a2dObject *other)
 link a reference in the object to the given value More...
 
virtual void ResolveInform ()
 inform an object that reference resolution was done More...
 
void Walker (wxObject *parent, a2dWalkerIOHandler &handler)
 This is used to recursively walk through an object tree.
 
void SetCheck (bool check)
 general flag use at will. More...
 
bool GetCheck () const
 general flag use at will.
 
void SetRelease (bool value)
 set release flag More...
 
bool GetRelease () const
 get release flag More...
 
a2dAutoZeroPtr< a2dObject > ** GetAutoZeroPtrList ()
 return the list head pointer for autozero pointers to this object More...
 
 DECLARE_PROPERTIES ()
 
a2dNamedPropertyGetProperty (const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
 get property on this object More...
 
void SetProperty (a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
 Set the property to the this object. More...
 
void SetProperty (const a2dNamedProperty &propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
 Set the property to the this object and if enabled, to all childs and object members. More...
 
virtual a2dNamedPropertyFindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none)
 Find a dynamic property with given id in the property list. More...
 
virtual const a2dNamedPropertyFindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
 Find a dynamic property with given id in the property list. More...
 
virtual bool HasProperty (const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const
 Check if the object has a property with given id and string representation. More...
 
virtual void OnPropertyChanged (const a2dPropertyId *id)
 This function is called after a property changed. More...
 
virtual bool EditProperties (const a2dPropertyId *id, bool withUndo=true)
 edit properties of the object More...
 
void TakeOverProperties (a2dObject *from, a2dPropertyIdList *listOfIds)
 Properties in the id list are taken from the given object, en set to this. More...
 
wxURI GetURI () const
 quick way to get to PROPID_URI property More...
 
void SetURI (const wxURI &url)
 quickly set a property PROPID_URI More...
 
const a2dNamedPropertyListGetPropertyList () const
 Get the Property List. More...
 
bool HasDynamicProperties () const
 test if there are dynamic properties in the m_propertylist
 
virtual bool RemoveProperty (const a2dPropertyId *id, bool all=true)
 This function is called by a2dPropertyId to remove a property from the list. More...
 
void RemoveTemporaryProperties ()
 remove all temporary properties
 
virtual bool AddProperty (a2dNamedProperty *property)
 This function is called by a2dPropertyId to add a property to the list. More...
 

Static Public Attributes

static const a2dPropertyIdBool PROPID_zoomfirst
 
static const wxEventType sm_showCursor
 
- Static Public Attributes inherited from a2dObject
static a2dPropertyIdBoolPROPID_Check = NULL
 used for linking multiple referenced objects when serializing
 
static a2dPropertyIdUriPROPID_URI = NULL
 attach an URL to the object
 
static a2dPropertyIdStringPROPID_Name = NULL
 Name property, to return name of this object.
 
static a2dPropertyIdVoidPtrPROPID_autozeroptrlist = NULL
 
static const a2dSignal sm_Edit_properties = wxNewId()
 edit properties event, see EditProperties()
 

Protected Member Functions

void ZoomWindowMenu (wxCommandEvent &)
 start one shot zoomtool from popup menu (used while another tool is active)
 
void ZoomPanMenu (wxCommandEvent &)
 zoompan from popup menu (used while another tool is active)
 
void ZoomUndoMenu (wxCommandEvent &)
 go to previous zoom area (used while another tool is active)
 
void ZoomoutMenu (wxCommandEvent &)
 show all on canvas
 
void Zoomout2Menu (wxCommandEvent &)
 zoom out two times the current visible area
 
void Zoomin2Menu (wxCommandEvent &)
 zoom in two half the current visible area
 
void OnComEvent (a2dComEvent &event)
 handler for this event
 
void OnMouseEvent (wxMouseEvent &event)
 called on mouse events
 
void OnChar (wxKeyEvent &event)
 called on key events
 
void OnKeyDown (wxKeyEvent &event)
 called on keydown events
 
void OnKeyUp (wxKeyEvent &event)
 called on keyup events
 
- Protected Member Functions inherited from a2dToolContr
bool ToolsProcessEvent (wxEvent &event)
 Event not handled in this class are redirected to the chain of tools. More...
 
void OnEnter (wxMouseEvent &event)
 sets the focus to the display window.
 
void OnPaint (wxPaintEvent &event)
 window Onpaint is received here before the window Onpaint where this controller is plugged into. More...
 
void OnIdle (wxIdleEvent &event)
 
- Protected Member Functions inherited from a2dObject
virtual bool DoIgnoreIfNotMember (const a2dPropertyId *id) const
 used to decide if a property shall be ignored, if it is not a member More...
 
virtual void DoWalker (wxObject *parent, a2dWalkerIOHandler &handler)
 iterate over this object and its children More...
 
virtual void DoSave (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
 Save settings.
 
virtual void DoLoad (wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
 Load settings.
 

Protected Attributes

bool m_noStatusEvent
 if set no event is send to m_where, instead a statusbar text is set directly
 
wxFrame * m_where
 statusbar frame
 
std::vector< wxString > m_statusStrings
 
wxString m_format
 
wxZoomList m_zoomstack
 zoom stack containing previous zooms
 
wxMenu * m_mousemenu
 popup menu
 
int m_mouse_x
 mouse position
 
int m_mouse_y
 mouse position
 
int m_mouse_xprev
 previous x of mouse in device
 
int m_mouse_yprev
 previous y of mouse in device
 
bool m_draggingCanvas
 used to indicate that dragging canvas is in action.
 
bool m_draggingCanvasOption
 can canvas be dragged using RightMouse.
 
int m_dragstartx
 x of mouse in device at start drag
 
int m_dragstarty
 y of mouse in device at start drag
 
bool m_zoomoutCentered
 when true zoom out and center to middle of the view
 
DRAGMODE m_dragmode
 manner to drag
 
a2dDrawStyle m_drawmode
 manner to draw
 
unsigned int m_defaultBehavior
 control the default behavior
 
a2dSmrtPtr< a2dBaseToolm_topTool
 tool always on top of the stack, or non if NULL
 
a2dSmrtPtr< a2dBaseToolm_toolForZoom
 tool used for zooming
 
wxUint8 m_editOpacityFactor
 when using cloned style for editcopy, use this opacity.
 
bool m_useEditOpaque
 when true editcopies are using a half transparent cloned style.
 
int m_noSnapkey
 
bool m_selectionStateUndo
 
bool m_selectedAtEnd
 
- Protected Attributes inherited from a2dToolContr
a2dToolList m_tools
 tool list
 
a2dDrawingPartm_drawingPart
 a2dDrawingPart where tool is plugged into
 
bool m_bussyPoping
 
bool m_snap
 snap is on or off
 
a2dSmrtPtr< a2dObjectm_defaultEventHandler
 use to define default handlers in tools. More...
 
a2dSmrtPtr< a2dObjectm_defaultEventHandlerFixedStyle
 use to define default handlers in tools. More...
 
- Protected Attributes inherited from a2dObject
a2dNamedPropertyList m_propertylist
 properties
 
int m_refcount
 how many references to this object do exist
 
bool m_check: 1
 used for linking multiple referenced objects when serializing
 
bool m_release: 1
 when set object is treated as being deleted, and wil be deleted in idle time.
 
bool m_recursion_active: 1
 this is used as a recursion stopper
 
bool m_pendingDisconnects: 1
 
unsigned int m_iteratorCount
 
a2dAutoZeroPtr< a2dObject > * m_autozeroptrlist
 this is a list of all a2dAutoZeroPtr object pointing to this object
 

Additional Inherited Members

- Public Types inherited from a2dObject
enum  CloneOptions {
  clone_members = 0x00000001, clone_properties = 0x00000002, clone_childs = 0x00000004, clone_unused = 0x00000008,
  clone_setoriginal = 0x00000010, clone_seteditcopy = 0x00000020, clone_noReference = 0x00000040, clone_noCameleonRef = 0x00000080,
  clone_toDrag = 0x00000100, clone_flat = 0x00000000, clone_deep = clone_members | clone_properties | clone_childs
}
 options for cloning More...
 
typedef a2dAutoZeroPtr< a2dObjectTAutoZeroPtrListClass
 this is needed inside the smart pointer template code
 
- Protected Types inherited from a2dObject
enum  { refcount_nondynamic = 0x76543210 }
 special refcount value for non-dynamic objects
 

Detailed Description

The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView.

It maintains tools that allows zooming while drawing is in progress. It has a stack of tools, some tools remain on the stack, while other or pushed and poped from it. A tool to show the cursor is a tool that is always on the stack and active, a tool to draw something is only on the stack as long the user wants. Zooming while drawing something is done by temporarily pushing a zoomtool to the stack. When the zoom as done, the tools is removed again. You can develop new tools by deriving new tools from a2dStTool.

See Also
a2dToolContr
a2dStTool
a2dCanvasView
a2dCanvas

Definition at line 485 of file sttool.h.

Constructor & Destructor Documentation

a2dStToolContr::a2dStToolContr ( a2dDrawingPart drawingPart,
wxFrame *  where,
bool  noStatusEvent = true 
)

Constructor.

Parameters
viewa2dCanvasView where the controller takes events from
wherewxFrame to display statusbar text in.
noStatusEventif true use, m_where to set statusbar text in first field. Else a a2dComEvent sm_showCursor is send to the m_where.

Definition at line 139 of file sttool.cpp.

Member Function Documentation

DRAGMODE a2dStToolContr::GetDragMode ( )
inline

Returns drag mode.

See Also
SetDragMode

Definition at line 567 of file sttool.h.

wxMenu* a2dStToolContr::GetMousePopupMenu ( )
inline

to get the current mouse menu of the controller

/return NULL if no menu is set, else the menu.

Definition at line 509 of file sttool.h.

bool a2dStToolContr::PopTool ( a2dSmrtPtr< a2dBaseTool > &  poped,
bool  force = true 
)
virtual

specialize to keep m_topTool tool active

It the new first tool was already stopped for some reason, this tool will also be poped, this continues recursive until a tool is found which does not want to be stopped.

Reimplemented from a2dToolContr.

Definition at line 461 of file sttool.cpp.

bool a2dStToolContr::PushTool ( a2dBaseTool tool)
virtual

specialize to keep first tool on the stack active

Parameters
toolThe tools to push, also checks if it is a a2dStTool derived tools, else an assert.

Reimplemented from a2dToolContr.

Definition at line 451 of file sttool.cpp.

void a2dStToolContr::SetDefaultBehavior ( unsigned int  behavior)
inline

Control the default behavior.

See Also
wxTC_BEHAVIOR

Definition at line 575 of file sttool.h.

void a2dStToolContr::SetDragMode ( DRAGMODE  mode)
inline

drag mode used in drag tool (if used)

Choose one of the three different drag methods see DRAGMODE

Definition at line 563 of file sttool.h.

void a2dStToolContr::SetMousePopupMenu ( wxMenu *  mousemenu)

to set the current mouse menu of the controller

NULL sets the menu to non.

Definition at line 237 of file sttool.cpp.

void a2dStToolContr::SetOpacityFactorEditcopy ( wxUint8  editOpacity)
inline

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

Parameters
editOpacityReal opacity is set opacity * m_OpacityFactor/255

Definition at line 655 of file sttool.h.

void a2dStToolContr::SetStateString ( const wxString &  message = wxEmptyString,
size_t  field = 3 
)
virtual

function called at mouse events, the default displays cursor in statusbar.

Override in a derived class to change behaviour.

Definition at line 753 of file sttool.cpp.

void a2dStToolContr::SetTopTool ( a2dBaseTool toolOnTop)

when all tools are poped, this tool will be pushed.

The effect is that this tool always stays on top of the stack. This call also makes this the top tool right now.

Parameters
toolOnToppointer to a tool you want to habve on top, NULL if non.

Definition at line 302 of file sttool.cpp.

void a2dStToolContr::SetUseOpaqueEditcopy ( bool  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 666 of file sttool.h.

void a2dStToolContr::SetZoomFirst ( bool  zoomfirst)

first tool on the tool stack is the zoom tool.

This is the same as SetTopTool( new a2dZoomTool( MyController ) )

Definition at line 293 of file sttool.cpp.

void a2dStToolContr::SetZoomTool ( a2dBaseTool toolForZoom)

for zooming purposes this tool wil be used

This only sets for future use.

Parameters
toolForZoompointer to a tool you want to use for zooming

Definition at line 309 of file sttool.cpp.


The documentation for this class was generated from the following files:
a2dStToolContr Class Reference -- Sun Oct 12 2014 17:04:49 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation