a2dObjectEditTool Class Reference
[Objects used for interactive manipulation.]

This tool is for editing a single object. More...

#include <edit.h>

Inheritance diagram for a2dObjectEditTool:

Inheritance graph
[legend]
Collaboration diagram for a2dObjectEditTool:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 a2dObjectEditTool (a2dStToolContr *controller, int editmode=1, bool SingleClickToEnd=true)
 constructor
 a2dObjectEditTool (a2dStToolContr *controller, a2dIterC &ic, int editmode=1, bool SingleClickToEnd=true)
 constructor
 ~a2dObjectEditTool ()
 destuctor
bool SetContext (a2dIterC &ic, a2dCanvasObject *startObject)
 start editing object within the given iteration context its coordinate system
void StartToEdit (a2dCanvasObject *startObject)
 start editing this object
bool ReStartEdit (wxUint16 editmode)
 restart editing (after undo event or when changing editing mode )
virtual void TriggerReStartEdit (wxUint16 editmode)
 trigger restart editing (after undo event or when changing editing mode )
bool ZoomSave ()
 save to zoom
void SetMode (int mode)
 set editing mode to start editing objects
void SetActive (bool active)
 used extarnal by controller to activate or deactivate this tool.
void SetSingleClickToEnd (bool SingleClickToEnd)
 a single non hit Left Down click is enough to end editing of an object.
void SetDisableOtherViews (bool disableOtherViews)
 when set true, other views on the document are disabled when editing a object.
void Render ()
 implement rendering

Static Public Attributes

static const a2dCommandId COMID_PushTool_ObjectEdit
 push this tool on the tools stack
static const wxEventType sm_toolStartEditObject
 when starting editing an object, this event is sent to tool

Protected Member Functions

void DoStopTool (bool abort)
 To stop this tools from inside or from the outside, sets m_stop = true.
void OnUndoEvent (a2dCommandProcessorEvent &event)
 handler for Undo event
void OnRedoEvent (a2dCommandProcessorEvent &event)
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
virtual void AdjustRenderOptions ()
 Adjust the rendering options to the needs of this tool.
virtual bool EnterBusyMode ()
 starts a new action (e.g drawing something ) in a tool that is already pushed.
virtual void FinishBusyMode ()
virtual void AbortBusyMode ()
 Called when the user aborts editing a distinct object */.
void SetEditObject (a2dCanvasObject *objectToEdit)
 send an event with id sm_toolComEventSetEditObject to this tool.
bool RedirectToEditObject (wxMouseEvent &event)
 redirect event to editng object or to a captured object ( handle or object itself. )
virtual bool CreateToolObjects ()
 start editing at m_canvasobject
virtual void CleanupToolObjects ()
 stop editing of m_canvasobject if busy editing
void OnIdle (wxIdleEvent &event)
 handler for idle events
void OnComEvent (a2dComEvent &event)
 called when a tool has changed (fill stroke layer spline )
void OnMouseEvent (wxMouseEvent &event)
 called on mouse events
void OnDoEvent (a2dCommandProcessorEvent &event)
 handler for Do event
virtual wxString GetCommandGroupName ()
 return the command group name for commands of a derived class

Protected Attributes

bool m_preserve_select
 preserve the a2dCANVAS_SELECT flag after editing.
bool m_SingleClickToEnd
 a single non hit Left Down click is enough to end editing of an object.
bool m_disableOtherViews
bool m_triggerRestart
a2dCanvasObjectList m_connectedwirecopies
 List of wires connected to the draged object.


Detailed Description

This tool is for editing a single object.

The object its EditStart member is called, this generates a Clone of the object to be edited. And event processing is redirected to the Cloned object to edit it.

The cloned edit copy, issues commands to the command processor of the document, and this changes the original a2dCanvasObject that is being edited. This then changes to make it in sync with editing clone. Undo is possible because of this, but it is possible to not use commands and choose to directly modify the original object.

After editing is done a double click will call the EditEnd member of the a2dCanvasObject. In the end the Cloned editing object is Released.

If SetSingleClickToEnd() is set, a Left Down mouse event outside the object being edited, also stops editing of the current object, and if subediting it even ends this tool. This makes it easy to go to sublevel editing and back with just one click.

The object itself is in control of all editing facilities of that specific object. This might mean that other tools will be pushed on the tool stack, for editing of subobjects.

The EditStart member initializes the a2dCanvasObject for editing, but only if editing is allowed by it.

The editing Clone will have as children editing handles, which can be dragged in order to modify the object. Those handles depend on the object its editing implementation. Rendering of the Cloned editing object can be changed on the basis of the m_editingCopy flag if needed.

The default editing functionality of a2dCanvasObject, is just editing its local matrix.

The TAB charecter should be used to switch between this mode and the object specific editing mode.

Adding editing functionality to an object is implemented by intercepting events using a static event table. When the m_editingCopy is set, we know it is the cloned edit copy we are dealing with. The events in this case should be handled in such a manner that the edit clone and the original object will be modified. Hits on child objects of the editing clone ( e.g a2dHandle ), may generate new events for the editng clone object itself. a2dHandleMouseEvent is such an event. You can intercept this event in the parent event table like this EVT_CANVASHANDLE_MOUSE_EVENT( OnHandleEvent ). In the OnHandleEvent you can define what change a specific handle will have on the object that is edited.

Definition at line 73 of file edit.h.


Constructor & Destructor Documentation

a2dObjectEditTool::a2dObjectEditTool ( a2dStToolContr controller,
int  editmode = 1,
bool  SingleClickToEnd = true 
)

constructor

Parameters:
controller controller to which the editing tool was pushed.
editmode starting editing mode for objects
SingleClickToEnd stop editing with a single Left Down, else double click.

Definition at line 1405 of file edit.cpp.

a2dObjectEditTool::a2dObjectEditTool ( a2dStToolContr controller,
a2dIterC ic,
int  editmode = 1,
bool  SingleClickToEnd = true 
)

constructor

Parameters:
controller controller to which the editing tool was pushed.
ic iteration context to setup the corridor
editmode starting editing mode for objects
SingleClickToEnd stop editing with a single Left Down, else double click.

Definition at line 1384 of file edit.cpp.


Member Function Documentation

bool a2dObjectEditTool::SetContext ( a2dIterC ic,
a2dCanvasObject startObject 
)

start editing object within the given iteration context its coordinate system

Start editing the object within the coordinate system defined by ic (iterative context). Parent of startobject is defined in ic.

The ic is used to calculate the editworld matrix, meaning relative to what coordinates system the editing takes place. This becomes important when editing children of objects directly.

Remarks:
at the top level (ShowObject of view) the editorWorld is always a2dIDENTITY_MATRIX else it depends on the structure of the document.

Reimplemented from a2dStTool.

Definition at line 1429 of file edit.cpp.

void a2dObjectEditTool::SetActive ( bool  active  )  [virtual]

used extarnal by controller to activate or deactivate this tool.

If deactivated this tool, m_halted is set true.

Reimplemented from a2dStTool.

Reimplemented in a2dMultiEditTool.

Definition at line 2001 of file edit.cpp.

void a2dObjectEditTool::SetSingleClickToEnd ( bool  SingleClickToEnd  )  [inline]

a single non hit Left Down click is enough to end editing of an object.

If set false, a double click is needed.

Definition at line 139 of file edit.h.

void a2dObjectEditTool::SetDisableOtherViews ( bool  disableOtherViews  )  [inline]

when set true, other views on the document are disabled when editing a object.

This option is default set true, this prevents from showing editing handles in other views while editing an object in a view.

Definition at line 146 of file edit.h.

void a2dObjectEditTool::Render (  )  [virtual]

implement rendering

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

Reimplemented from a2dStTool.

Definition at line 1777 of file edit.cpp.

void a2dObjectEditTool::DoStopTool ( bool  abort  )  [protected, virtual]

To stop this tools from inside or from the outside, sets m_stop = true.

The a2dStToolContr will test this with GetStopTool()

Reimplemented from a2dBaseTool.

Reimplemented in a2dMultiEditTool.

Definition at line 1486 of file edit.cpp.

bool a2dObjectEditTool::EnterBusyMode (  )  [protected, 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 a2dStTool.

Definition at line 1537 of file edit.cpp.

void a2dObjectEditTool::AbortBusyMode (  )  [protected, 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 a2dStTool.

Definition at line 1551 of file edit.cpp.

void a2dObjectEditTool::SetEditObject ( a2dCanvasObject objectToEdit  )  [protected]

send an event with id sm_toolComEventSetEditObject to this tool.

Use this event to do actions when a specific object was clicked for editing.

Definition at line 1464 of file edit.cpp.

bool a2dObjectEditTool::RedirectToEditObject ( wxMouseEvent &  event  )  [protected]

redirect event to editng object or to a captured object ( handle or object itself. )

return if event is processed or not.

Reimplemented in a2dMultiEditTool.

Definition at line 1622 of file edit.cpp.

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

start editing at m_canvasobject

event to make it possible to set style in for instance modeless style dialog

Reimplemented from a2dStTool.

Definition at line 1685 of file edit.cpp.

virtual wxString a2dObjectEditTool::GetCommandGroupName (  )  [inline, protected, virtual]

return the command group name for commands of a derived class

this defaults to the class name

Reimplemented from a2dBaseTool.

Reimplemented in a2dRecursiveEditTool.

Definition at line 196 of file edit.h.


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