26 #include <wx/tokenzr.h>
28 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
29 #include <wx/msw/msvcrt.h>
41 #if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
45 #endif // (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
51 a2dStyleProperty::a2dStyleProperty( )
67 a2dStyleProperty::~a2dStyleProperty()
98 s = s + wxT(
"fill " );
99 s = s + wxT(
"stroke " );
141 #if wxART2D_USE_CVGIO
144 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
145 if ( xmlparts == a2dXmlSer_attrib )
151 m_fill.Save( parent, out, towrite );
154 m_stroke.Save( parent, out, towrite );
158 void a2dStyleProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag WXUNUSED( xmlparts ) )
174 wxASSERT_MSG( fill, wxT(
"wrong a2dFill" ) );
175 fill->Load( parent, parser );
193 wxASSERT_MSG( stroke, wxT(
"wrong a2dStroke" ) );
194 stroke->Load( parent, parser );
200 #endif //wxART2D_USE_CVGIO
206 a2dShadowStyleProperty::a2dShadowStyleProperty()
221 a2dShadowStyleProperty::~a2dShadowStyleProperty()
225 a2dShadowStyleProperty::a2dShadowStyleProperty(
const a2dShadowStyleProperty& other )
228 m_depth = other.m_depth;
229 m_angle3d = other.m_angle3d;
234 return new a2dShadowStyleProperty( *
this );
237 #if wxART2D_USE_CVGIO
240 a2dStyleProperty::DoSave( parent, out, xmlparts, towrite );
241 if ( xmlparts == a2dXmlSer_attrib )
243 out.WriteAttribute( wxT(
"depth" ), m_depth );
244 out.WriteAttribute( wxT(
"angle" ), m_angle3d );
252 void a2dShadowStyleProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
254 a2dStyleProperty::DoLoad( parent, parser, xmlparts );
255 if ( xmlparts == a2dXmlSer_attrib )
264 #endif //wxART2D_USE_CVGIO
271 a2dClipPathProperty::a2dClipPathProperty()
287 a2dClipPathProperty::~a2dClipPathProperty()
297 m_clip = (
a2dPolygonL* ) other.m_clip->TClone( options );
300 m_clip = other.m_clip;
302 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
304 CurrentSmartPointerOwner =
this;
310 return new a2dClipPathProperty( *
this, options );
315 a2dClipPathProperty* propcast =
wxStaticCast( &other, a2dClipPathProperty );
316 m_clip = propcast->m_clip;
339 m_clip->
Walker(
this, handler );
342 #if wxART2D_USE_CVGIO
345 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
346 if ( xmlparts == a2dXmlSer_attrib )
348 out.WriteAttribute( wxT(
"clippath" ),
GetName() );
353 m_clip->
Save(
this, out, towrite );
357 void a2dClipPathProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
359 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
360 if ( xmlparts == a2dXmlSer_attrib )
363 if ( clipobject != wxT(
"" ) )
374 if ( classname == wxT(
"ref" ) )
385 wxLogError( wxT(
"could not create a2dPolygonL from %s, will be skipped line %d" ),
394 m_clip->
Load(
this, parser );
400 #endif //wxART2D_USE_CVGIO
426 void a2dVisibleProperty::OnPropertyChanged(
a2dComEvent& event )
428 if ( event.GetPropertyId() == m_propId )
454 Connect( wxID_ANY, wxID_ANY, a2dEVT_COM_EVENT, wxObjectEventFunction( &a2dVisibleProperty::OnPropertyChanged ), 0,
this );
459 : a2dText( wxT(
"" ), x, y, font, angle )
466 Connect( wxID_ANY, wxID_ANY, a2dEVT_COM_EVENT, wxObjectEventFunction( &a2dVisibleProperty::OnPropertyChanged ), 0,
this );
470 a2dVisibleProperty::~a2dVisibleProperty()
472 Disconnect( wxID_ANY, wxID_ANY, a2dEVT_COM_EVENT, wxObjectEventFunction( &a2dVisibleProperty::OnPropertyChanged ), 0,
this );
476 : a2dText( other, options, refs )
513 void a2dVisibleProperty::OnChar( wxKeyEvent& event )
523 a2dText::OnChar( event );
550 #if wxART2D_USE_CVGIO
555 if ( xmlparts == a2dXmlSer_attrib )
557 out.WriteAttribute( wxT(
"showname" ),
m_showname,
true );
570 if ( xmlparts == a2dXmlSer_attrib )
584 #endif //wxART2D_USE_CVGIO
590 a2dCanvasObjectPtrProperty::a2dCanvasObjectPtrProperty()
597 m_selectedonly =
false;
607 m_selectedonly =
false;
610 a2dCanvasObjectPtrProperty::~a2dCanvasObjectPtrProperty()
614 a2dCanvasObjectPtrProperty::a2dCanvasObjectPtrProperty(
const a2dCanvasObjectPtrProperty& other,
a2dObject::CloneOptions options )
620 m_object = other.
m_object->TClone( options );
629 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
631 CurrentSmartPointerOwner =
this;
637 return new a2dCanvasObjectPtrProperty( *
this, options );
642 a2dCanvasObjectPtrProperty* propcast =
wxStaticCast( &other, a2dCanvasObjectPtrProperty );
660 void a2dCanvasObjectPtrProperty::DoWalker( wxObject* parent,
a2dWalkerIOHandler& handler )
667 #if wxART2D_USE_CVGIO
670 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
671 if ( xmlparts == a2dXmlSer_attrib )
681 void a2dCanvasObjectPtrProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
683 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
684 if ( xmlparts == a2dXmlSer_attrib )
712 #endif //wxART2D_USE_CVGIO
734 wxStringTokenizer args( value, wxT(
"," ) );
735 while ( args.HasMoreTokens() )
738 args.GetNextToken().ToDouble( &x );
740 args.GetNextToken().ToDouble( &y );
741 m_value.Expand( x, y );
745 a2dBoudingBoxProperty::~a2dBoudingBoxProperty()
752 m_value = other.m_value;
763 m_value = propcast->m_value;
769 wxStringTokenizer args( value );
770 while ( args.HasMoreTokens() )
773 args.GetNextToken().ToDouble( &x );
775 args.GetNextToken().ToDouble( &y );
781 #if wxART2D_USE_CVGIO
784 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
785 if ( xmlparts == a2dXmlSer_attrib )
788 attrib << m_value.
GetMinX() << wxT(
" " );
789 attrib << m_value.
GetMinY() << wxT(
" " );
790 attrib << m_value.
GetMaxX() << wxT(
" " );
793 out.WriteAttribute( wxT(
"value" ), attrib );
800 void a2dBoudingBoxProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
802 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
803 if ( xmlparts == a2dXmlSer_attrib )
810 #endif //wxART2D_USE_CVGIO
812 void a2dBoudingBoxProperty::SetValue(
const a2dBoundingBox& value )
820 attrib << m_value.
GetMinX() << wxT(
" " );
821 attrib << m_value.
GetMinY() << wxT(
" " );
822 attrib << m_value.
GetMaxX() << wxT(
" " );
826 form.Printf( wxT(
"%s = %s" ),
GetName().c_str(), attrib.c_str() );
833 attrib << m_value.
GetMinX() << wxT(
" " );
834 attrib << m_value.
GetMinY() << wxT(
" " );
835 attrib << m_value.
GetMaxX() << wxT(
" " );
839 form.Printf( wxT(
"%s" ), attrib.c_str() );
847 static int a2dTagCount = 0;
852 if ( a2dTagCount >= 255 )
867 a2dTagVecProperty::~a2dTagVecProperty()
871 a2dTagVecProperty::a2dTagVecProperty(
const a2dTagVecProperty& other )
874 m_value = other.m_value;
879 return new a2dTagVecProperty( *
this );
884 a2dTagVecProperty* propcast =
wxStaticCast( &other, a2dTagVecProperty );
885 m_value = propcast->m_value;
892 return new a2dTagVecProperty(
id, result );
895 #if wxART2D_USE_CVGIO
898 a2dNamedProperty::DoSave( parent, out, xmlparts, towrite );
899 if ( xmlparts == a2dXmlSer_attrib )
904 for( a2dTagVec::iterator iter = m_value.begin(); iter != m_value.end(); ++iter )
908 out.WriteAttribute( wxT(
"v" ), tag );
914 void a2dTagVecProperty::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
916 a2dNamedProperty::DoLoad( parent, parser, xmlparts );
917 if ( xmlparts == a2dXmlSer_attrib )
925 m_value.push_back( value );
932 #endif //wxART2D_USE_CVGIO
934 void a2dTagVecProperty::SetValue( a2dTagVec value )
953 void a2dTagVecProperty::PushTag( a2dTag tag )
955 m_value.push_back( tag );
958 a2dTag a2dTagVecProperty::PopTag()
960 a2dTag tag = m_value.back();
965 a2dTag a2dTagVecProperty::Last()
const
967 return m_value.back();
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
bool GetAttributeValueBool(const wxString &attrib, bool defaultv=false)
Returns the boolean value of an attribute.
void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual wxString StringValueRepresentation() const
(In) Visible property that can be added to Docview Objects.
a2dCanvasObject * m_parent
object which contains m_propId
Base class for all types of strokes, understood by a2dDrawer2D classes.
virtual wxString StringValueRepresentation() const
void SetStroke(const wxColour &strokecolor, float width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
bool HasAttribute(const wxString &attrib)
Does the current tag have this attribute?
virtual a2dObject * GetRefObjectNA() const
when a2dProperty, return its value else return NULL
mouse event sent from a2dCanvasObject to itself
wxString StringValueRepresentation() const
XMLeventType Next()
Walks to next element and returns event type.
const a2dFill * a2dINHERIT_FILL
global a2dFill stock object for INHERTED from parent object filling
bool ResolveOrAdd(a2dSmrtPtr< a2dObject > *storedHere, const wxString &id=wxT(""))
try to resolve the object that is in storedHere when it is a reference.
class to map references to objects stored in XML, in order to make the connection later on...
static a2dCanvasObjectPtrProperty * CreatePropertyFromString(const a2dPropertyIdCanvasObject *id, const wxString &value)
Creates a shadow behind a a2dCanvasObject when added as property.
a2dDrawing * m_root
root group for rendering and accessing the canvas's also contains layer settings
virtual wxString GetName() const
Get the ids print and serialization name.
void DoEndEdit()
only used for editable objects and under control of a editing tool.
a2dCanvasOFlags m_flags
holds flags for objects
static a2dTagVecProperty * CreatePropertyFromString(const a2dPropertyIdTagVec *id, const wxString &value)
void WriteStartElementAttributes(const wxString &name, bool newLine=true)
Writes start tag which has attributes.
polygon defined with list of points.
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load object specific CVG data.
a2dVisibleProperty()
constructor
virtual wxString StringRepresentation() const
This template class is for property ids meant for properties that do not encapsulate another type...
virtual int GetCurrentLineNumber()
where in the input was line the current tag
bool GetCanRender() const
return true if the object can be rendered.
bool AllNo()
if IsNoStroke() and IsNoFill() return true
int m_caret
position of caret within text string
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Input and output handler for the XmlSer format.
UpdateMode
Various mode flags for Update.
virtual void SetPending(bool pending)
set this object pending for update
const a2dPropertyId * m_propId
the property id for which the value needs to be displayed.
static a2dBoudingBoxProperty * CreatePropertyFromString(const a2dPropertyIdBoundingBox *id, const wxString &value)
a2dNamedProperty * GetProperty(const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
get property on this object
wxString GetName() const
Get the name of the a2dPropertyId object.
a2dCanvasObject is the base class for Canvas Objects.
property to hold a byte integer type vector to be associated with a a2dObject
virtual wxString StringRepresentation() const
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
virtual wxObject * CreateObject(const wxString &symbolicName)
Creates an specific object by name.
a2dCanvasObjectPtr m_object
object held by this property.
size_t m_firsteditable
The first editable character, usually 0, but may be different for a2dVisibleProperty.
virtual a2dObject * GetRefObject() const
when a2dProperty, return its value else assert
Io handler to iterate through a a2dDocument.
a2dFillStyle
Filling styles for a2dFill.
void SetParent(a2dCanvasObject *parent)
to set the parent where the m_propId is searched for.
a2dText is an abstract base class.
used to change a property on objects
bool m_render
in case of a grahics application, should this property be rendered.
bool GetValid() const
returns true if boundingbox is calculated properly and therefore its valid flag is set...
void Expand(const a2dPoint2D &, const a2dPoint2D &)
expand boundingbox width two points
double GetMinX() const
get minimum X of the boundingbox
bool m_visible
is the object visible (overruled by paranet object in some cases during rendering ...
void SkipSubTree()
Skips all child elements / tags of current element / tag.
void SetObject(wxObject *object)
to set the a2dCanvasObject*
wxString StringRepresentation() const
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
This is used to recursively walk through an object tree.
(In)Visible property that can be added to Canvas Objects.
const a2dError a2dError_XMLparse
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
a2dVertexListPtr GetSegments()
Get the list of points ( this is not a copy! )
a2dTag a2dNewTag()
Generate new tag for grouping.
void SetCanvasObject(a2dPolygonL *clip)
set object to use for clipping
#define EVT_CANVASOBJECT_MOUSE_EVENT(func)
static event table macro for a2dCanvasObject mouse event
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Write object specific CVG data.
a2dDrawer2D * GetDrawer2D()
get the internal m_drawer2D that is used for rendering the document
const a2dStroke * a2dINHERIT_STROKE
global a2dStroke stock object for INHERTED from parent object stroking
Input and output handler for the XmlSer format.
Invisible Style property that can be added to Canvas Objects.
bool m_showname
Indicates if both name and value of the property are visible, or just the value.
bool m_visible
see SetVisible()
bool m_visible
see SetVisible()
bool m_subEditAsChild
allow subedit on this object when child of other object
const a2dFill * a2dNullFILL
global a2dFill stock object for defining NO filling
bool GetSpline()
Get the polygon spline setting.
virtual bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
void WriteEndAttributes(bool close=false)
"Closes" the start tag after writing all attributes (writes the ">" or "/>" bracket).
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
properties specific for a2dCanvasOject
double GetAttributeValueDouble(const wxString &attrib, double defaultv=0)
Returns the double value of an attribute.
const a2dStroke * a2dNullSTROKE
global a2dStroke stock object for NO stroking
virtual void ExtendAndPushClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)=0
push on stack the current clipping region and extend clipping region
double GetMaxX() const
get maximum X of the boundingbox
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
wxUint16 GetAttributeValueUint16(const wxString &attrib, wxUint16 defaultv=0)
cast to wxUint16 of GetAttributeValueInt()
bool m_render
in case of a grahics application, should this property be rendered.
a2dCommandProcessor * GetCommandProcessor() const
Returns a pointer to the command processor associated with this document.
a2dBooleanClip
Used for defining how a ClippingRegion defined as a polygon is combined with.
const a2dFont * a2dDEFAULT_CANVASFONT
global a2dFont stock object for default font
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Write object specific CVG data.
Clipping Path property that can be added to a2dCanvasObject's.
virtual void Load(wxObject *parent, a2dIOHandlerXmlSerIn &parser)
load object from CVG file
wxString GetAttributeValue(const wxString &attrib, const wxString &defaultv=wxT(""))
Returns the value of an attribute.
This is the base class for all kinds of property id's for a2dObject.
double GetMaxY() const
get maximum Y of the boundingbox
void ShowName(bool show=false)
Show both name and value of the property or just the value.
wxPolygonFillMode GetFillRule()
Get Polygon filling mode wxODDEVEN_RULE or wxWINDING_RULE.
XMLeventType GetEventType()
Returns the type of current event.
void Require(const XMLeventType &type, wxString name)
Forces a special tag.
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
wxString GetTagName()
Returns name of the current XML tag.
if set, clone properties (e.g. fill style), otherwise ref-copy them
property to hold a a2dCanvasObject pointer type variable to be associated with a canvasobject ...
bool m_editingCopy
true if the object needs to be rendered in edit mode.
bool m_utbbox_changed
Untransformed bounding box changed.
if set, clone members (e.g. line end styles), otherwise ref-copy them
virtual void PopClippingRegion()=0
pop a previously pushed clipping region
virtual wxString StringValueRepresentation() const
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
all polygon and polyline a2dCanvasObject are here.
double GetMinY() const
get minimum Y of the boundingbox
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
the a2dDrawingPart is a a2dView specially designed for displaying parts of a a2dDrawing. It uses a a2dDrawer2D to actually redraw things from the document, by giving that a2dDrawer2D as drawing context to the document, and telling the document to redraw a certain rectangular area. At that last is what this class is for. It optimizes the areas to be redrawn after object in the document were changed. To do that it combines redraw areas to a minimal set of redrawing areas. All the administration for this and the way things will be redrawn is from this view.
virtual void Save(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
write all needed to an XML type of file called the CVG format
bool m_prerenderaschild
as child this object will be rendered before the parent object itself when true (default) ...
This template class is for property ids with a known data type.
property to hold a a2dBoundingBox type variable to be associated with a canvasobject ...
a2dBoundingBox m_bbox
boundingbox in world coordinates
virtual void Assign(const a2dNamedProperty &other)
Virtual assignment operator.
wxString m_text
the text to display
a2dStrokeStyle
stroke styles for a2dStroke
CloneOptions
options for cloning
bool GetCanRender() const
return true if the object can be rendered.
virtual void DoEndEdit()
only used for editable objects and under control of a editing tool.
virtual a2dNamedProperty * CreatePropertyFromString(const wxString &value) const
Create a new property object from a value string.
general canvas module declarations and classes