36 a2dToolList::~a2dToolList()
44 for( a2dToolList::const_iterator iter = begin(); iter != end(); ++iter )
46 a2dToolList::value_type toolobj = *iter;
51 a->push_back( objnew );
54 a->push_back( toolobj );
71 :m_drawingPart( drawingPart )
74 m_bussyPoping =
false;
78 if ( m_drawingPart->GetDrawing() && !m_drawingPart->GetDrawing()->GetCanvasCommandProcessor() )
79 m_drawingPart->GetDrawing()->CreateCommandProcessor();
80 m_drawingPart->SetCanvasToolContr(
this );
81 SetEvtHandlerEnabled(
true );
84 SetEvtHandlerEnabled(
false );
105 SetEvtHandlerEnabled(
false );
113 SetEvtHandlerEnabled(
true );
116 SetEvtHandlerEnabled(
false );
136 SetEvtHandlerEnabled(
false );
144 for( a2dToolList::reverse_iterator iter =
m_tools.rbegin(); iter !=
m_tools.rend(); ++iter )
146 a2dToolList::value_type toolobj = *iter;
147 if ( *iter ==
m_tools.front() )
148 toolobj->SetActive( active );
150 toolobj->SetActive(
false );
158 for( a2dToolList::iterator iter =
m_tools.begin(); iter !=
m_tools.end(); ++iter )
160 a2dToolList::value_type toolobj = *iter;
161 if ( !tool.CmpNoCase( toolobj->GetClassInfo()->GetClassName() ) )
163 toolobj->SetActive(
true );
166 else if ( disableothers )
167 toolobj->SetActive(
false );
176 for( a2dToolList::iterator iter =
m_tools.begin(); iter !=
m_tools.end(); ++iter )
178 a2dToolList::value_type toolobj = *iter;
180 if ( !tool.CmpNoCase( toolobj->GetClassInfo()->GetClassName() ) )
182 toolobj->SetEvtHandlerEnabled(
true );
185 else if ( disableothers )
186 toolobj->SetEvtHandlerEnabled(
false );
194 for( a2dToolList::iterator iter =
m_tools.begin(); iter !=
m_tools.end(); ++iter )
196 a2dToolList::value_type toolobj = *iter;
197 if ( tool == toolobj )
199 toolobj->SetEvtHandlerEnabled(
true );
202 else if ( disableothers )
203 toolobj->SetEvtHandlerEnabled(
false );
211 for( a2dToolList::iterator iter =
m_tools.begin(); iter !=
m_tools.end(); ++iter )
213 a2dToolList::value_type toolobj = *iter;
214 if ( !tool.CmpNoCase( toolobj->GetClassInfo()->GetClassName() ) )
216 toolobj->SetEvtHandlerEnabled(
false );
226 for( a2dToolList::iterator iter =
m_tools.begin(); iter !=
m_tools.end(); ++iter )
228 a2dToolList::value_type toolobj = *iter;
229 if ( toolobj == tooldis )
231 tooldis->SetEvtHandlerEnabled(
false );
240 for( a2dToolList::iterator iter =
m_tools.begin(); iter !=
m_tools.end(); ++iter )
242 a2dToolList::value_type toolobj = *iter;
243 if ( !toolsearch.CmpNoCase( toolobj->GetClassInfo()->GetClassName() ) )
272 if ( active->GetEvtHandlerEnabled() )
280 if ( a2dObject::ProcessEvent( event ) )
291 bool handled =
false;
299 size_t nrTools =
m_tools.size();
306 a2dToolList::iterator iter =
m_tools.begin();
307 while( !handled && iter !=
m_tools.end() )
312 if ( nrTools <
m_tools.size() )
417 void a2dToolContr::OnIdle( wxIdleEvent& event )
442 for( a2dToolList::reverse_iterator iter =
m_tools.rbegin(); iter !=
m_tools.rend(); ++iter )
448 wxASSERT_MSG(
GetFirstTool(), wxT(
"No tool set in controller" ) );
486 AddPropertyId( PROPID_Fill );
493 AddPropertyId( PROPID_Stroke );
503 DEFINE_MENU_ITEMID( CmdMenu_NoMenu, wxTRANSLATE(
"No menu"), wxTRANSLATE(
"No Menu") )
506 EVT_MOUSE_EVENTS( a2dBaseTool::OnMouseEvent )
507 EVT_CHAR( a2dBaseTool::OnChar )
508 EVT_KEY_DOWN( a2dBaseTool::OnKeyDown )
509 EVT_KEY_UP( a2dBaseTool::OnKeyUp )
511 EVT_DO( a2dBaseTool::OnDoEvent )
512 EVT_UNDO( a2dBaseTool::OnUndoEvent )
513 EVT_REDO( a2dBaseTool::OnRedoEvent )
518 : m_initiatingMenuId( &initiatingMenuId )
527 m_annotateFont = wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL );
535 m_controller = controller;
544 m_canvas_mouseevents_restore = GetDrawingPart()->GetMouseEvents();
549 if ( !m_corridor.empty() )
551 m_parentobject = m_corridor.back();
552 wxASSERT_MSG( m_parentobject->GetRoot() != 0 , wxT(
"parentobject of tools has no drawing root set" ) );
556 m_eventHandler = NULL;
558 m_ignorePendingObjects =
false;
614 wxString a2dBaseTool::GetToolString()
const
616 return GetClassInfo()->GetClassName();
676 return a2dObject::ProcessEvent( event );
692 corridor.
Push( newtop );
720 OnUndoEvent( event );
729 wxLogWarning( _T(
"You may not edit this drawing" ) );
740 bool a2dBaseTool::EnterBusyModeNoGroup()
745 wxLogWarning( _T(
"You may not edit this drawing" ) );
760 if ( closeCommandGroup )
822 void a2dBaseTool::SetContourWidth(
double width )
861 name += _(
" (continued)" );
897 return GetClassInfo()->GetClassName();
912 wxASSERT_MSG(
m_parentobject->
GetRoot() != 0 , wxT(
"parentobject of tools has no drawing root set" ) );
918 object->SetAlgoSkip(
true );
921 wxASSERT_MSG(
m_parentobject->
GetRoot() != 0 , wxT(
"parentobject of tools has no drawing root set" ) );
923 object->SetSnapTo(
false );
934 object->SetAlgoSkip(
true );
939 wxASSERT_MSG(
m_parentobject->
GetRoot() != 0 , wxT(
"parentobject of tools has no drawing root set" ) );
941 object->SetSnapTo(
false );
986 return GetDrawing()->GetHabitat()->GetPinSize()/2.0;
1003 void a2dToolEvtHandler::OnComEvent(
a2dComEvent& event )
1010 if ( a2dObject::ProcessEvent( event ) )
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Base class for all types of strokes, understood by a2dDrawer2D classes.
void Push(a2dCanvasObject *object)
push object onto existing corridor
void ClearCorridorPath(bool uncapture)
Reset all corridor paths and uncapture object.
class to map references to objects stored in XML, in order to make the connection later on...
transfer this property via a command processor
static a2dPropertyIdVoidPtr * PROPID_ToolObject
set for objects that act as tool object, when a tool is in action.
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
When cloning, and this flag is set, the property is cloned deep, else not.
if set, clone childs, otherwise ref-copy them
a command processor specially designed to work with a a2dCanvasDocument
#define EVT_REDO(func)
event sent from a2DocumentCommandProcessor when a command is redone
bool SetCanvasToolContr(a2dToolContr *controller)
set toolcontroller ( reset with NULL )
a2dCanvasObject is the base class for Canvas Objects.
#define A2D_PROPID_M(type, classname, propname, defaultval, mptr)
to define a get set property more easily
bool GetMouseEvents() const
return true if this a2dDrawingPart allows mouse events to be processed.
virtual a2dObject * GetRefObject() const
when a2dProperty, return its value else assert
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
int ReleaseChild(a2dCanvasObject *obj, bool backwards=false, bool all=false, bool now=false, bool undoCommands=false)
remove the given object from the childobjects
static a2dPropertyIdRefObject * PROPID_ViewSpecific
void SetIgnorePendingObjects(bool onoff)
Switches ignorance of pending objects on and off.
static const a2dSignal sig_changedShowObject
void CommandGroupEnd(a2dCommandGroup *group)
End a command group.
void SetPropertyToObject(a2dObject *obj, const basetype &value, SetFlags setflags=set_none) const
Set the property in obj to value.
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
a2dCommandGroup * CommandGroupBegin(const wxString &name)
Start a new command group.
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
a2dSignal GetEventComIdReturn()
after proecssin the event, on return an id can be set to communicate back to sender.
Drawing context abstraction.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
void SetMouseEvents(bool onoff)
If not set do not process mouse events.
virtual bool Undo()
Undo one command or command group.
int Release(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const wxString &classname=wxT(""), const a2dPropertyId *id=NULL, const wxString &name=wxT(""), bool now=true)
release only objects with the given mask and classname and has property named propertyname and object...
Restriction engine for editing restrictions like snapping.
a2dDrawer2D * GetDrawer2D()
get the internal m_drawer2D that is used for rendering the document
const a2dFill * a2dNullFILL
global a2dFill stock object for defining NO filling
corridor as a direct event path to a a2dCanvasObject
const a2dStroke * a2dNullSTROKE
global a2dStroke stock object for NO stroking
while iterating a a2dCanvasDocument, this holds the context.
a2dRestrictionEngine * GetRestrictionEngine()
Get restriction engine (grid snapping)
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
bool ReleaseObject(T *object)
release a certain object from the list
Event sent to a2dCommandProcessor.
void SetCorridorPath(const a2dCorridor &corridor)
find object on the current corridor path.
a2dDrawing * GetDrawing() const
get drawing via top object
static bool GetWorldBased()
get if pin sizes are in world coordinates, else it is in pixels.
bool AddPendingUpdatesOldNew()
adds current and future boundingbox of the objects with pending flag set, to the pendinglist of all a...
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
all headers of the canvas module
#define EVT_UNDO(func)
event sent from a2DocumentCommandProcessor when a command is undone
static a2dPropertyIdBool * PROPID_ToolDecoration
set for objects that act as tool decorations, when a tool is in action.
This template class is for property ids with a known data type.
void SetSnap(bool snap)
enable all snapping features or not
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
double DeviceToWorldXRel(double x) const
convert x relative from device to world coordinates
CloneOptions
options for cloning
Contain one drawing as hierarchical tree of a2dCanvasObject's.
#define a2dREFOBJECTPTR_KEEPALIVE