#include <tools.h>


Public Member Functions | |
| bool | ProcessEvent (wxEvent &event) |
| events recieved from controller processed here | |
| void | SetEvtHandler (a2dEvtHandler *handler) |
| to reroute events to this event handler | |
| a2dEvtHandler * | GetEventHandler () |
| a2dBaseTool (a2dToolContr *controller) | |
| construct a new tool for the given controller. | |
| a2dBaseTool (const a2dBaseTool &other, CloneOptions options) | |
| constructor initializing partly from other tool | |
| virtual | ~a2dBaseTool () |
| destructor | |
| a2dBaseTool * | TClone (CloneOptions options) |
| virtual bool | StartTool (a2dBaseTool *currenttool) |
| called to initiate while pushing tool to toolcontroller | |
| void | SetOneShot () |
| Only one action of the tool, after that it will ask the controller to stop this tool. | |
| virtual bool | ZoomSave ()=0 |
| Is Zooming while the tool is busy Save. | |
| virtual bool | AllowPop () |
| tells if a tool can be poped from the stack. | |
| void | StopTool (bool abort=false) |
| call to stop a tool, internal and external. | |
| bool | GetStopTool () |
| checked by controller to see if the tool needs to be stopped e.g. after a oneshot. | |
| bool | GetActive () |
| is the tool active? | |
| virtual void | SetActive (bool active=true) |
| set the tool active or inactive. | |
| bool | GetBusy () |
| Check if the tool is busy editing a distinct object */. | |
| virtual bool | EnterBusyMode () |
| Called when the user selects a distinct object for editing */. | |
| 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 | SetFill (const a2dFill &fill) |
| set fill if used inside a tool | |
| const a2dFill & | GetFill () const |
| get the current fill | |
| void | SetStroke (const a2dStroke &stroke) |
| set stroke if used inside a tool | |
| const a2dStroke & | GetStroke () const |
| get the current stroke | |
| void | SetLayer (wxUint16 layer) |
| layer set for the object that is drawn using a tool | |
| wxUint16 | GetLayer () |
| layer set for new objects. | |
| void | SetShowAnotation (bool show) |
| when true anotation will be shown, if used inside a tool | |
| void | SetAnotationFont (const wxFont &font) |
| font to use for anotation | |
| void | SetCursorType (const wxCursor &cursor) |
| Sets cursor which the tool should use when started. | |
| void | SetBusyCursorType (const wxCursor &cursor) |
| Sets cursor which the tool should use when busy. | |
| wxCursor | GetCursorType () |
| what cursor is used when tool is started | |
| wxCursor | GetBusyCursorType () |
| what cursor is used when tool is busy | |
| virtual void | SetMode (int mode) |
| general integer to set operation modes for a tool (e.g the way it draws) | |
| int | GetMode () |
| can be used to modify the behaviour of the derived tool. | |
| void | SetPending (bool pending=true) |
| a tool is set pending when it needs to be redrawn. | |
| bool | GetPending () |
| return if the tool is set pending for redraw. | |
| virtual void | Render () |
| render the tool chain | |
| a2dToolContr * | GetToolController () |
| to get the tool controller to which this tool is attached. | |
| a2dCanvasView * | GetCanvasView () |
| Access to the tool controllers drawer. | |
| a2dDrawer2D * | GetDrawer2D () |
| Access to the tool controllers drawers drawer2d. | |
| wxWindow * | GetDisplayWindow () |
| Access to the tool controllers drawers canvas. | |
| a2dCanvasDocument * | GetCanvasDocument () |
| Returns a pointer to the document. | |
| a2dCanvasCommandProcessor * | GetCanvasCommandProcessor () |
| Returns a pointer to the command processor associated with this document. | |
| virtual void | OpenCommandGroup (bool restart) |
| called when starting an editing operation (e.g. on mouse down) | |
| virtual void | OpenCommandGroupNamed (const wxString &name) |
| called when starting an editing operation with another than the default name | |
| virtual void | CloseCommandGroup () |
| called when ending an editing operation (e.g. mouse up) | |
| virtual wxString | GetCommandGroupName () |
| return the command group name for commands of a derived class | |
| a2dCommandGroup * | GetCommandgroup () |
| return the command group that is open else NULL. | |
| wxMenu * | GetMousePopupMenu () |
| to get the current mouse menu of the tool | |
| void | SetMousePopupMenu (wxMenu *mousemenu) |
| to set the current mouse menu of the tool | |
| a2dCanvasObject * | GetParentObject () |
| parent object relative to which the actions take place. | |
| void | AddEditobject (a2dCanvasObject *object) |
| Add an editcopy object to the tool/document. | |
| void | RemoveEditobject (a2dCanvasObject *object) |
| Remove an editcopy object to the tool/document. | |
| void | AddDecorationObject (a2dCanvasObject *object) |
| Add a decoration object to be rendered by the tool. | |
| void | RemoveAllDecorations () |
| remove all object that were added as decorations. | |
| void | SetIgnorePendingObjects (bool onoff) |
| Switches ignorance of pending objects on and off. | |
| bool | GetIgnorePendingObjects () |
| get setting of ignore pending objects /sa GetUpdatesPending() | |
| a2dCorridor & | GetCorridor () |
| get reference to the corridor list | |
| void | SetCorridor (const a2dCorridor &corridor) |
| set a corridor from a list of objects | |
| void | SetContourWidth (double width) |
| double | GetContourWidth () const |
| get the Contour width of the shape | |
| void | ResetContext () |
| context like corridor and parentobject are reset | |
Public Attributes | |
| bool | m_halted |
| if a tool is deactivated while m_busy is true, this flag is set | |
| bool | m_pending |
| set when tool needs an redraw (after a a2dCanvas Repaint etc.) | |
| bool | m_oneshot |
| do it only once | |
| bool | m_stop |
| stop the tool | |
| a2dFill | m_fill |
| fill for new object | |
| a2dStroke | m_stroke |
| stroke for new object | |
| double | m_contourwidth |
| if != 0 the polygon is contoured at distance m_contourwidth/2 | |
| wxUint16 | m_layer |
| layer for a new object | |
| bool | m_canvas_mouseevents_restore |
| used to save the a2dCanvas mouse event setting. | |
| bool | m_anotate |
| when true anotation will be shown, if used inside a tool | |
| wxFont | m_annotateFont |
| font to use for anotation | |
| int | m_mode |
| general operation mode setting for a tool. | |
| a2dCommandGroup * | m_commandgroup |
| the command group of the command processor | |
| wxMenu * | m_mousemenu |
| popup menu | |
| a2dCanvasObjectPtr | m_parentobject |
| ( if needed ) parent a2dCanvasObject relative to which the tool actions take place. | |
Static Public Attributes | |
| static const wxEventType | sm_toolPushed |
| sent to new first tool when tool was pushed | |
| static const wxEventType | sm_toolPoped |
| sent to new first tool when last first tool was poped | |
| static const wxEventType | sm_toolBeforePush |
| static const wxEventType | sm_toolDoPopBeforePush |
| return id after a sm_toolBeforePush, to tell current tool needs to be poped. | |
| static const wxEventType | sm_toolComEvent |
| not yet used. | |
| static a2dPropertyIdBool * | PROPID_Oneshot = NULL |
| static a2dPropertyIdBool * | PROPID_Stop = NULL |
| static a2dPropertyIdFill * | PROPID_Fill = NULL |
| static a2dPropertyIdStroke * | PROPID_Stroke = NULL |
| static a2dPropertyIdUint16 * | PROPID_Layer = NULL |
Protected Member Functions | |
| void | OnComEvent (a2dComEvent &event) |
| default handler for a2dComEvent event | |
| void | OnRemoveView (a2dDocumentEvent &event) |
| when a view is removed from a document, the tool becomes invalid and will be stopped | |
| void | OnDoEvent (a2dCommandProcessorEvent &event) |
| void | OnUndoEvent (a2dCommandProcessorEvent &event) |
| void | OnRedoEvent (a2dCommandProcessorEvent &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 | |
| virtual void | DoStopTool (bool abort) |
| to do tool specific stuff to stop a tool. Called from StopTool(). | |
Protected Attributes | |
| wxCursor | m_toolcursor |
| cursor to use | |
| wxCursor | m_toolBusyCursor |
| cursor to use when the tool is busy doing something. | |
| a2dToolContr * | m_controller |
| under control of this toolcontroller, to give me events. | |
| bool | m_active |
| tool is operational | |
| wxUint8 | m_bussyStopping |
| if > 0, the tool is in the process of stopping, which means it can not be poped yet by controller. | |
| a2dSmrtPtr< a2dEvtHandler > | m_eventHandler |
| when set called before own event handler | |
| bool | m_ignorePendingObjects |
| if set ignore all setting for pendingobjects | |
| a2dCorridor | m_corridor |
a a2dToolContr derived class.
The basetool does not implement default behaviour for events in many cases, instead it is possible to set m_eventHandler to take care of action which are the same for a set of tools. a2dBaseTool::ProcessEvent() first redirect incoming events to m_eventHandler, and if not handled there it goes to the tools its own event handler.
Definition at line 352 of file tools.h.
| bool a2dBaseTool::ProcessEvent | ( | wxEvent & | event | ) | [virtual] |
events recieved from controller processed here
first m_eventHandler is tried, if not set or not processed, try object itself.
Reimplemented from a2dEvtHandler.
| bool a2dBaseTool::StartTool | ( | a2dBaseTool * | currenttool | ) | [virtual] |
| virtual bool a2dBaseTool::ZoomSave | ( | ) | [pure virtual] |
Is Zooming while the tool is busy Save.
If so, the active tool will redraw itself in the new Mapping state
Implemented in a2dCurveZoomTool, a2dObjectEditTool, a2dMultiEditTool, a2dGraphicsMasterTool, a2dSimpleEditPolygonTool, a2dSubDrawMasterTool, a2dMasterDrawBase, a2dDrawRectangleTool, a2dZoomTool, a2dSelectTool, a2dImageTool, a2dDragTool, a2dDragNewTool, a2dCopyTool, a2dRotateTool, a2dDeleteTool, a2dDrawCircleTool, a2dDrawLineTool, a2dDrawEllipseTool, a2dDrawEllipticArcTool, a2dDrawArcTool, a2dDrawPolygonLTool, a2dDragMultiTool, a2dDrawTextTool, a2dPropertyTool, a2dDrawVPathTool, a2dZoomFast, a2dFastSelect, a2dFastSelect2, a2dFastDragMultiTool, a2dDrawRectangleToolFast, a2dDrawCircleToolFast, a2dDrawPolygonLToolFast, a2dRenderImageZoomTool, and a2dMeasureTool.
| virtual bool a2dBaseTool::AllowPop | ( | ) | [inline, virtual] |
| void a2dBaseTool::StopTool | ( | bool | abort = false |
) |
call to stop a tool, internal and external.
The stop flag within the tool will be set, triggering deletion of the tool from the outside by the a2dToolContr. Stopping one tool often means activating another which is on the tool stack of the a2dToolContr. Therefore the tools are really stopped and removed from the tool stack from the outside.
After this call the tool must be left in a state that allows the controller to pop the tool.
Override DoStopTool() function, if there is cleaning up to do before stopping a tool. Understand that stopping the tool is something else then (de)activating a tool. A tool can be de-activated, but still in action or at least on the toolstack. Stopping a tools really removes the tool from the stack by the controller.
To prevent poping the tool from the outside before it is really stopped, m_bussyStopping is incremented, when recursive calling this function. GetStopTool() only returns true when all recursive StopTool() calls have returned.
Stopping a tools will indirectly lead to the a2dToolContr Popping the tool from the stack, and that action at least de-activates the tool just stopped. So indirectly SetActive( false ) is called on this tool, when it is really stopped.
| abort | if true the tool is calling AbortBusyMode() instead FinishBusyMode(), the effect is that the tool does directly Undo what it was doing, but not yet did finish. |
| bool a2dBaseTool::GetStopTool | ( | ) |
checked by controller to see if the tool needs to be stopped e.g. after a oneshot.
or when wanted. The stop flag is in general set after a tool has received and handled an event which should stop the tool. A tool should not stop itself, since the tool will be deleted. The StopTool() function is called in such a case to trigger the stopping of the tool.
| bool a2dBaseTool::GetActive | ( | ) | [inline] |
is the tool active?
A tool is "active", when it receives mouse input. Usually this is only the top tool on the tool stack. This is something completely different then "busy". A tool is "busy", when it currently focuses on editing a specific object. Toolstates change like this: 1. Created 2. Pushed on the tool stack -> set active 3. User clicks on an object to edit -> set busy 4. User starts a different tool (e.g. zoom) -> busy but not active (halted) 5. subtool is stopped -> set active again (and busy) 6. User continues editing the object selected in 3. -> still busy 7. User finishes editing the object selected in 3. -> no longer busy, but still active "One-shot" tools are stopped in this situations, other tools continue. 8. User clicks on a different object, repeat step 3..7 -> busy again 9. User stops tool (end tool menu or ESC or 2x double-click ...) -> stopped 10 Tool gets popped from the tool stack
| void a2dBaseTool::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
Reimplemented in a2dObjectEditTool, a2dMultiEditTool, a2dStTool, and a2dDrawWirePolylineLTool.
| bool a2dBaseTool::GetBusy | ( | ) | [inline] |
| bool a2dBaseTool::EnterBusyMode | ( | ) | [virtual] |
Called when the user selects a distinct object for editing */.
Reimplemented in a2dObjectEditTool, a2dSimpleEditPolygonTool, a2dStTool, a2dStDrawTool, a2dDragTool, a2dDragNewTool, a2dRotateTool, a2dDrawWirePolylineLTool, a2dDragMultiTool, and a2dFastDragMultiTool.
| void a2dBaseTool::FinishBusyMode | ( | bool | closeCommandGroup = true |
) | [virtual] |
Called when the user finishes editing a distinct object */.
GetActive You should call the base class (this) version at the END of your function
Reimplemented in a2dStTool, a2dStDrawTool, a2dDragTool, a2dDragNewTool, a2dRotateTool, a2dDrawWirePolylineLTool, and a2dDragMultiTool.
| void a2dBaseTool::AbortBusyMode | ( | ) | [virtual] |
Called when the user aborts editing a distinct object */.
Reimplemented in a2dObjectEditTool, a2dSimpleEditPolygonTool, a2dStTool, a2dStDrawTool, a2dDragTool, a2dRotateTool, a2dDrawWirePolylineLTool, a2dDragMultiTool, and a2dFastDragMultiTool.
| const a2dFill& a2dBaseTool::GetFill | ( | ) | const [inline] |
| const a2dStroke& a2dBaseTool::GetStroke | ( | ) | const [inline] |
| void a2dBaseTool::SetShowAnotation | ( | bool | show | ) | [inline] |
| void a2dBaseTool::SetCursorType | ( | const wxCursor & | cursor | ) | [inline] |
Sets cursor which the tool should use when started.
You may change the predefined cursor which the tool uses when it becomes active.
| cursor | the tool cursor |
| void a2dBaseTool::SetBusyCursorType | ( | const wxCursor & | cursor | ) | [inline] |
| virtual void a2dBaseTool::SetMode | ( | int | mode | ) | [inline, virtual] |
general integer to set operation modes for a tool (e.g the way it draws)
tools most check the mode and handle in accordance In general Tab should be used to tab/switch/circle between modes understood by a tool.
Reimplemented in a2dObjectEditTool, a2dDrawCircleTool, a2dDrawEllipseTool, a2dDrawEllipticArcTool, a2dDrawArcTool, a2dDrawPolygonLTool, a2dDrawVPathTool, a2dFastDragMultiTool, a2dDrawCircleToolFast, and a2dDrawPolygonLToolFast.
| int a2dBaseTool::GetMode | ( | ) | [inline] |
| virtual void a2dBaseTool::Render | ( | ) | [inline, virtual] |
render the tool chain
A tool chain gets rendered when a2dCanvasView is updating areas that are changed in a document.
Reimplemented in a2dObjectEditTool, a2dMasterDrawZoomFirst, a2dStTool, a2dDragTool, a2dDragMultiTool, a2dStDrawToolFast, a2dZoomFast, a2dFastSelect, and a2dFastDragMultiTool.
| void a2dBaseTool::OpenCommandGroup | ( | bool | restart | ) | [virtual] |
| wxString a2dBaseTool::GetCommandGroupName | ( | ) | [virtual] |
return the command group name for commands of a derived class
this defaults to the class name
Reimplemented in a2dCurveZoomTool, a2dObjectEditTool, a2dRecursiveEditTool, a2dSimpleEditPolygonTool, a2dDrawRectangleTool, a2dZoomTool, a2dSelectTool, a2dDragTool, a2dDragNewTool, a2dCopyTool, a2dRotateTool, a2dDeleteTool, a2dDrawArcTool, a2dDrawPolygonLTool, a2dDrawWirePolylineLTool, a2dDragMultiTool, a2dCopyMultiTool, a2dDrawVPathTool, a2dZoomFast, a2dFastSelect, a2dFastSelect2, a2dFastDragMultiTool, a2dFastCopyMultiTool, a2dDrawRectangleToolFast, a2dDrawPolygonLToolFast, and a2dMeasureTool.
| wxMenu* a2dBaseTool::GetMousePopupMenu | ( | ) | [inline] |
| void a2dBaseTool::SetMousePopupMenu | ( | wxMenu * | mousemenu | ) |
| a2dCanvasObject* a2dBaseTool::GetParentObject | ( | ) | [inline] |
parent object relative to which the actions take place.
Tools can do there work on child objects of some parent a2dCanvasObject. In such cases the context of the tool is set with SetCorridor(), and the last object in the corridor is the m_parentobject.
| void a2dBaseTool::AddDecorationObject | ( | a2dCanvasObject * | object | ) |
| void a2dBaseTool::SetIgnorePendingObjects | ( | bool | onoff | ) |
Switches ignorance of pending objects on and off.
If set to true pending objects won't be updated. This method is used by several tools (i.e. a2dDragTool) to avoid updates while the tool is working.
| onoff | true to ignore pending objects, else false |
| void a2dBaseTool::OnComEvent | ( | a2dComEvent & | event | ) | [protected] |
default handler for a2dComEvent event
Event id a2dCanvasView::sm_changedShowObject makes the tools corridor change to keep the tool active. In derived tools one can implement different behaviour if needed.
Reimplemented in a2dObjectEditTool, a2dRecursiveEditTool, a2dMultiEditTool, a2dStTool, a2dDragNewTool, a2dDrawRectangleToolFast, and a2dDrawCircleToolFast.
const wxEventType a2dBaseTool::sm_toolBeforePush [static] |
a2dSmrtPtr<a2dEvtHandler> a2dBaseTool::m_eventHandler [protected] |
a2dCorridor a2dBaseTool::m_corridor [protected] |
used in tools that can do nested editing/drawing. the corridor is a copy of the a2dCanvasObject in the a2dDocument that form the corridor path. re-activating a tool, this list can be used to re-instantiate the corridor path for the tool.