21 #include <wx/wfstream.h>
23 #include <wx/tokenzr.h>
24 #include <wx/metafile.h>
28 #if wxUSE_STD_IOSTREAM
29 #include "wx/ioswrap.h"
36 #include "wx/wfstream.h"
40 #include "wx/editor/candoc.h"
41 #include "wx/editor/cancom.h"
48 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
49 #include <wx/msw/msvcrt.h>
60 #if wxUSE_PRINTING_ARCHITECTURE
66 m_pageSetupData( pageSetupData ),
91 dc->GetSize( &pw, &ph );
93 GetPageSizeMM(&mw, &mh);
94 float mmToDeviceX = float(pw) / mw;
95 float mmToDeviceY = float(ph) / mh;
98 wxRect paperRect = wxRect( 0,0,pw,ph);
101 wxPoint topLeft = m_pageSetupData.GetMarginTopLeft();
102 wxPoint bottomRight = m_pageSetupData.GetMarginBottomRight();
105 wxRect pageMarginsRect(
106 paperRect.x + wxRound(mmToDeviceX * topLeft.x),
107 paperRect.y + wxRound(mmToDeviceY * topLeft.y),
108 paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
109 paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
112 dc->SetBrush( *wxWHITE_BRUSH );
113 dc->SetBackground( *wxWHITE_BRUSH );
115 dc->SetBackgroundMode( wxTRANSPARENT );
116 dc->SetTextForeground( *wxBLACK );
117 dc->SetBrush( *wxTRANSPARENT_BRUSH );
120 int marginX = ( int )( ph * 0.015 );
121 int marginY = marginX;
122 int fontMarginYTop = 0;
123 int fontMarginYBottom = 0;
124 wxFont fontTitle = wxFont( marginY, wxDEFAULT, wxNORMAL, wxNORMAL );
125 wxFont fontFilename = wxFont(
int( marginY / 2. + 0.5 ), wxDEFAULT, wxNORMAL, wxNORMAL );
129 dc->SetFont( fontTitle );
130 fontMarginYTop += 2 * fontTitle.GetPointSize();
131 wxCoord xExtent, yExtent;
132 dc->GetTextExtent(
m_title, &xExtent, &yExtent );
133 dc->DrawText(
m_title, pw / 2 - xExtent / 2, marginY );
138 dc->SetFont( fontFilename );
139 fontMarginYBottom += 2 * fontFilename.GetPointSize();
140 dc->DrawText(
m_filename, marginX, ph - marginY - fontMarginYBottom );
144 int widthX = pageMarginsRect.GetWidth();
145 int widthY = pageMarginsRect.GetHeight();
146 int orgX = pageMarginsRect.GetTopLeft().x;
147 int orgY = pageMarginsRect.GetTopLeft().y;
149 dc->SetBackgroundMode( wxSOLID );
150 dc->SetFont( wxNullFont );
189 drawPart->SetEvtHandlerEnabled(
false );
230 dc->SetDeviceOrigin( orgX, orgY );
265 dcb.SelectObject( buffer );
266 dc->Blit( orgX, orgY, widthX, widthY, &dcb, 0, 0, wxCOPY,
false );
267 dcb.SelectObject( wxNullBitmap );
286 dc->SetDeviceOrigin( 0, 0 );
287 dc->SetBrush( *wxTRANSPARENT_BRUSH );
288 dc->SetPen( *wxRED_PEN );
289 dc->DrawRectangle( orgX, orgY, widthX, widthY );
290 const wxPen& aPenForFrame = dc->GetPen();
302 #endif //wxUSE_PRINTING_ARCHITECTURE
314 const wxPoint& pos, const wxSize& size,
long style,
a2dDrawer2D* drawer2D )
316 a2dCanvas( parent,
id, pos, size, style, drawer2D )
322 const wxPoint& pos,
const wxSize& size,
long style )
324 a2dCanvas( drawingpart, parent, id, pos, size, style )
336 if ( m_drawingPart && doc )
344 if ( m_drawingPart && theView->GetDrawingPart() == m_drawingPart )
346 if ( m_drawingPart->GetCanvasToolContr() )
355 void a2dViewCanvas::OnActivate(
a2dViewEvent& viewevent )
372 if ( activate && m_drawingPart && m_drawingPart->
GetDrawing() && view == m_view )
395 if ( m_drawingPart && view->GetDrawingPart() == m_drawingPart )
413 a2dCanvasView::a2dCanvasView( const wxSize& size ):
a2dView()
423 void a2dCanvasView::Init()
436 SetEvtHandlerEnabled(
false );
472 bool processed =
false;
476 ( event.GetEventType() == wxEVT_ENABLE_VIEW ) ||
477 ( event.GetEventType() == wxEVT_ENABLE_VIEWS )
482 processed =
m_display->GetEventHandler()->ProcessEvent( event );
496 wxFAIL_MSG( wxT(
"a2dCanvasView::OnDraw is not implemented, see a2dViewPrintout::OnPrintPage(int)" ) );
499 #if wxUSE_PRINTING_ARCHITECTURE
512 EVT_PAINT( a2dZoomedView::OnPaint )
513 EVT_SIZE( a2dZoomedView::OnSize )
517 a2dZoomedView::a2dZoomedView( wxWindow* parent, wxWindowID
id, const wxPoint& pos, const wxSize& size,
long style,
a2dCanvasView* canvasview ):
518 wxWindow( parent,
id, pos, size, style )
520 m_canvasDocview = canvasview;
533 if ( !GetEvtHandlerEnabled() )
542 void a2dZoomedView::OnPaint( wxPaintEvent& WXUNUSED( event ) )
546 wxPaintDC dc(
this );
550 wxPaintDC dc(
this );
553 GetClientSize( &dvx, &dvy );
554 if ( dvx == 0 ) dvx = 1;
555 if ( dvy == 0 ) dvy = 1;
565 if ( h * dvx / w < dvy )
568 dc.DrawRectangle( 0, 0, dvx, (
int ) ( h * dvx / w ) );
569 dc.DrawRectangle( (
int ) ( xview * dvx / w ), (
int ) ( yview * dvx / w ), (
int ) ( wview * dvx / w ), (
int ) ( hview * dvx / w ) );
574 dc.DrawRectangle( 0, 0, (
int ) ( w * dvx / h ), dvy );
575 dc.DrawRectangle( (
int ) ( xview * dvy / h ), (
int ) ( yview * dvy / h ), (
int ) ( wview * dvy / h ), (
int ) ( hview * dvy / h ) );
580 void a2dZoomedView::OnSize( wxSizeEvent& WXUNUSED( event ) )
611 EVT_IDLE( a2dCanvasDocument::OnIdle )
613 EVT_DO( a2dCanvasDocument::OnDoEvent )
614 EVT_UNDO( a2dCanvasDocument::OnUndoEvent )
615 EVT_REDO( a2dCanvasDocument::OnRedoEvent )
621 m_documentModified = 0;
626 m_drawing->
SetName( wxT(
"top") );
627 m_drawing->SetDrawingId( a2dDrawing::sm_physical );
628 m_drawing->SetParent(
this );
632 m_layersetup->SetRoot( NULL );
634 m_askSaveWhenOwned =
false;
636 m_units_accuracy = 0.001;
638 m_normalize_scale = 1.0;
640 m_units = wxT(
"non" );
641 m_units_measure = wxT(
"non" );
643 m_description = wxT(
"a2dCanvasDocument generated by wxArt2D" );
644 m_libraryname = wxT(
"Not specified" );
645 m_version = wxT(
"1" );
647 m_accesstime = wxDateTime::Now();
648 m_changedInternalAccesstime = wxDateTime::Now();
650 m_documentTypeName = wxT(
"a2dCanvasDocument" );
686 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
688 CurrentSmartPointerOwner =
this;
776 wxASSERT_MSG( newRoot, wxT(
"a2dCanvasDocument its root object can not be NULL" ) );
787 ProcessEvent( changedlayers );
804 wxString oldLocale = wxSetlocale( LC_NUMERIC, NULL );
806 wxSetlocale( LC_NUMERIC, wxString( wxT(
"English" ) ) );
808 wxSetlocale( LC_NUMERIC, wxString( wxT(
"en_US" ) ) );
811 bool ownhandler =
false;
814 #if wxART2D_USE_CVGIO
820 #endif //wxART2D_USE_CVGIO
823 #if wxUSE_STD_IOSTREAM
824 bool isOK = ( stream.fail() || stream.bad() ) == 0;
826 bool isOK = stream.IsOk ();
836 if ( !handler->
Load( stream,
this ) )
865 Update( a2dCanvasObject::updatemask_force_and_count );
868 event.SetEventObject(
this );
869 ProcessEvent( event );
877 wxSetlocale( LC_NUMERIC, oldLocale );
884 #if wxUSE_STD_IOSTREAM
885 a2dDocumentFileInputStream stream( filename.mb_str(), wxSTD ios_base::in | wxSTD ios_base::binary );
886 if ( stream.fail() || stream.bad() )
888 wxFileInputStream stream( filename );
889 if ( !stream.IsOk() )
900 if ( !handler->
Load( stream,
this ) )
925 #if wxART2D_USE_CVGIO
960 if ( parser.
GetTagName() == wxT(
"version" ) )
1002 #endif //wxART2D_USE_CVGIO
1006 wxASSERT_MSG(
m_layersetup, wxT(
"no a2dLayers set for a2dCanvasDocument" ) );
1013 #if wxUSE_STD_IOSTREAM
1014 a2dDocumentFileInputStream stream( filename.mb_str(), wxSTD ios_base::in | wxSTD ios_base::binary );
1015 if ( stream.fail() || stream.bad() )
1017 wxFileInputStream stream( filename );
1035 #if wxART2D_USE_CVGIO
1055 wxFAIL_MSG( wxT(
"wxART2D_USE_CVGIO is needed to load layers from a file CVG file" ) );
1056 #endif //wxART2D_USE_CVGIO
1058 #if wxART2D_USE_CVGIO
1060 #endif //wxART2D_USE_CVGIO
1075 wxString oldLocale = wxSetlocale( LC_NUMERIC, NULL );
1077 wxSetlocale( LC_NUMERIC, wxString( wxT(
"English" ) ) );
1079 wxSetlocale( LC_NUMERIC, wxString( wxT(
"en_US" ) ) );
1082 #if wxUSE_STD_IOSTREAM
1083 bool isOK = ( stream.fail() || stream.bad() ) == 0;
1085 bool isOK = stream.IsOk ();
1088 bool ownhandler =
false;
1091 #if wxART2D_USE_CVGIO
1096 wxFAIL_MSG( wxT(
"wxART2D_USE_CVGIO is needed to load object from a file CVG file" ) );
1097 #endif //wxART2D_USE_CVGIO
1104 if ( handler->
CanSave(
this ) )
1106 if ( !handler->
Save( stream,
this ) )
1133 wxSetlocale( LC_NUMERIC, oldLocale );
1140 #if wxUSE_STD_IOSTREAM
1141 a2dDocumentFileOutputStream stream( filename.mb_str(), wxSTD ios_base::out | wxSTD ios_base::binary );
1142 if ( stream.fail() || stream.bad() )
1144 wxFileOutputStream stream( filename );
1145 if ( stream.GetLastError() != wxSTREAM_NO_ERROR )
1156 if ( handler->
CanSave(
this ) )
1158 if ( handler->
Save( stream,
this ) )
1172 #if wxART2D_USE_CVGIO
1183 out.WriteAttribute( wxT(
"classname" ), GetClassInfo()->GetClassName() );
1215 out.WriteAttribute( wxT(
"classname" ), GetClassInfo()->GetClassName() );
1240 #endif //wxART2D_USE_CVGIO
1244 wxASSERT_MSG( drawer, wxT(
"no a2dCanvasView set for a2dCanvasDocument" ) );
1252 #if wxART2D_USE_SVGIO
1254 a2dIterC ic( drawer->GetDrawingPart() );
1256 handler->SetIterC( ic );
1258 done =
Save( filename, handler );
1262 wxFAIL_MSG( wxT(
"wxART2D_USE_SVGIO is needed to write doc into SVG file" ) );
1263 #endif //wxART2D_USE_SVGIO
#define EVT_UPDATE_VIEWS(func)
event from a document when its views need to be updated
virtual void SetYaxis(bool up)
set if the Yaxis goes up or down
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
set check on a2dObject flag false or true
a2dObject * DoClone(a2dObject::CloneOptions options, a2dRefMap *refs) const
Clone document.
a2dSmrtPtr< a2dCommandProcessor > m_commandProcessor
A pointer to the command processor associated with this document.
void SetDrawing(a2dDrawing *newRoot)
set new root object ( may not ne NULL )
a2dError m_lastError
error code used when LoadObject is returning.
~a2dViewPrintout(void)
destructor
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
void SetRoot(a2dDrawing *root, bool recurse=true)
Sets this object to a a2dCanvasDocument.
#define EVT_OPEN_DOCUMENT(func)
event for document when a document has been opened
void WriteElement(const wxString &name, const wxString &content=wxT(""), bool newLine=true)
Writes start and end tag.
const a2dError a2dError_NoDocTemplateRef
wxString m_units_measure
measuring unit (e.g. Meters Inch Microns etc.)
bool HasAttribute(const wxString &attrib)
Does the current tag have this attribute?
double m_printscalelimit
Set the scaling limit for printing, so that small stuff is not zoomed to full page.
wxString m_description
description for document
void SetFileName(const wxFileName &filename)
set filename based on file where layers were read from
wxString m_units
unit (e.g. Meters Inch Microns etc.)
wxString m_documentTypeName
The document type name given to the a2dDocumentTemplate constructor,.
double m_units_scale
scaling factor (how many "m_units_measure" is one unit)
#define EVT_ACTIVATE_VIEW(func)
event sent to view and document manager
a2dCanvasDocument()
Construct a a2dCanvasDocument to store a complete drawing in.
virtual void OnDraw(wxDC *)
Not implemented, use a2dViewPrintout to print.
output handler for the SVG format
XMLeventType Next()
Walks to next element and returns event type.
void SetRealScale(bool realScale)
If true use real scale else different scale by x and y.
virtual bool Load(a2dDocumentInputStream &stream, wxObject *obj)=0
override to read the stream and store (part of) the contents in to a specific a2dDocument or othere o...
bool m_multiRoot
multi root document
double GetVisibleMinX() const
get Minimal X of the visible part in world coordinates
bool m_printtitle
if true, a printout is done with title (document name (description?)), otherwise not ...
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...
View on a a2dCanvasDocument.
a2dCommand * GetCommand()
the command ( if there was one ) that did it.
wxBitmap GetBuffer() const
Return the buffer as a bitmap.
a2dView * GetView()
Gives the a2dView in case of event types concerning a view.
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
void WriteStartElementAttributes(const wxString &name, bool newLine=true)
Writes start tag which has attributes.
a2dSmrtPtr< a2dCameleon > m_main
what is the root a2dcameleon in the drawing to display after opening a document, when m_show is not s...
a2dCanvasObjectPtr m_show
what to display when document is openened
#define EVT_CHANGEDMODIFY_DRAWING(func)
event from a drawing when changed by commands
virtual bool ProcessEvent(wxEvent &event)
Special event handling for a2dCanvasView class.
virtual void UpdateLoadedLayerSetup()
Update a loaded layer setup.
virtual void SetDisplayWindow(wxWindow *display)
Set the display window.
a2dIOHandlerCVGIn and a2dIOHandlerCVGOut - XML I/O classes for the CVG format.
void SetRenderDC(wxDC *dc)
set the DC that is used for rendering
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
const a2dError a2dError_NoError
void OnSetDocument(a2dViewEvent &event)
called when document of the a2dView has changed.
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
wxString m_version
version of library or document
wxOutputStream a2dDocumentOutputStream
output stream based wxStreams
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
const a2dError a2dError_FileCouldNotOpen
Input and output handler for the XmlSer format.
UpdateMode
Various mode flags for Update.
#define EVT_SET_DOCUMENT(func)
event sent to view when a new document is ser for it.
This class implements drawing functions for wxDC based drawing.
void Load(wxObject *parent, a2dIOHandlerXmlSerIn &parser)
used by CVG parser
void Update(unsigned int how=(a2dCANVIEW_UPDATE_ALL|a2dCANVIEW_UPDATE_BLIT), wxObject *hintObject=NULL)
see OnUpdate
#define EVT_REDO(func)
event sent from a2DocumentCommandProcessor when a command is redone
bool GetYaxis() const
get y axis orientation
This class implements drawing functions for wxDC based drawing.
a2dDrawing * GetDrawing() const
get the root object, which holds the objects in the document.
void SetGrid(bool grid)
Set grid on/off.
double m_normalize_scale
normalization factor to scale normalized objects.
double GetVisibleMinY() const
get Minimal X of the visible part in world coordinates
a2dCanvas * GetCanvas() const
Get the Display window of the a2dView. But casted to a a2dCanvas.
using a file stream for input, stream the file into a a2dDocument or other object ...
void SetDocumentDrawStyle(wxUint32 drawstyle)
set drawstyles to use for drawing the document
static const a2dSignal sig_changedLayer
when an object is removed from a layer,
virtual a2dDocumentInputStream & LoadObject(a2dDocumentInputStream &stream, a2dIOHandlerStrIn *handler)
load form a file containing the a2dCanvas specific XML called CVG format
virtual void UpdateArea(int x, int y, int width, int height, wxUint8 id=0)
update/redraw part of the buffer, using the given a2dDrawing and ShowObject within that root...
a2dView event, to report events in the a2dView class
virtual bool CanLoad(a2dDocumentInputStream &stream, const wxObject *obj=NULL, wxClassInfo *docClassInfo=NULL)=0
Should return true if the handler can read from the stream.
a2dCanvasObject is the base class for Canvas Objects.
std::vector< a2dLayerInfoPtr > & GetLayerIndex()
return array index on Layer
wxString GetContent()
Returns the current content.
a2dPrintWhat m_typeOfPrint
type of print requested
output handler for the CVG format.
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
bool GetActive()
when ::wxEVT_ACTIVATE_VIEW get activation value of the event
bool SaveLayers(const wxString &filename)
save layer object to CVG file
bool m_viewEnabled
Is the view enabled?
void OnOpenDocument(a2dDocumentEvent &event)
load a document from a file into this document
void Update(a2dCanvasObject::UpdateMode mode)
update all pending objects in the document
virtual void SetName(const wxString &name)
Creates the a2dStringProperty PROPID_Name.
void CreateCommandProcessor()
create a command processor and set it for the document.
void WriteEndElement(bool newLine=true)
Writes correspondending end tag for the current start tag.
a2dDocumentOutputStream & SaveObject(a2dDocumentOutputStream &stream, a2dIOHandlerStrOut *handler)
save as the a2dCanvas specific XML called CVG format
#define EVT_CREATE_VIEW(func)
event sent to view from template when a view has been created
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
double GetBboxWidth()
get width of the boundingbox in world coordinates relative to its parents
const a2dError a2dError_IOHandler
bool WriteSVG(a2dCanvasView *drawer, const wxString &filename, a2dCanvasObject *top, double Width, double Height, wxString unit)
write as SVG to a file starting at given object
void WriteStartDocument(const wxString &version, const wxString &encoding, bool standalone)
Writes the XML header declaration.
virtual double GetVisibleHeight() const
get Height of visible part in world coordinates
virtual void UpdateAllViews(a2dView *sender=(a2dView *) NULL, unsigned int hint=a2dVIEW_UPDATE_ALL, wxObject *objecthint=(wxObject *) NULL)
sent Update events to all a2dView which display or use this document.
bool IsClosed()
A closed flag is set when a view is closed.
void OnUpdate(a2dDocumentEvent &event)
calls a2dDrawingpart::Update()
Holds a view on a a2dDocument.
double m_scalelimit
limit scaling to this value (world/pixel)
~a2dCanvasDocument()
destructor
void OnRedoEvent(a2dCommandProcessorEvent &event)
track modification of document
virtual bool CanLoad(a2dDocumentInputStream &stream, const wxObject *obj=NULL, wxClassInfo *docClassInfo=NULL)
test header of the file to see if its CVG format
bool m_drawframe
draw a frame around the page
static const a2dSignal sig_layersetupChanged
layer info changed id sent around when m_layersetup is changed.
void OnDoEvent(a2dCommandProcessorEvent &event)
track modification of document
The document class can be used to model an application's file-based data.
wxDateTime m_accesstime
when was the document last accessed.
const a2dError a2dError_SaveFile
wxString m_documentTitle
Document title.
void SetParent(a2dObject *parent)
set parent object of the drawing ( in case there is always only one )
wxUint16 a2dPrintWhat
defines what to print
long m_documentModified
modified flag
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
void SetAvailable()
check which layers do contain objects as seen from the ShowObject()
virtual double GetVisibleWidth() const
get Width of visible part in world coordinates
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
const a2dError a2dError_CouldNotLoad
Drawing context abstraction.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
void SetActiveDrawingPart(a2dDrawingPart *part)
get the drawing part that has the focus/is active in a window.
#define EVT_CLOSE_VIEW(func)
event sent to document and view when a view needs to be closed ( can veto)
void SetCommandProcessor(a2dCommandProcessor *proc)
Sets the command processor to be used for this document.
a2dCanvas and a2dCanvasView meet eachother here.
to print what is displayed on a a2dCanvasView or the whole document as seen from the showobject of th...
a2dCanvasView(int width=1000, int height=1000)
constructor
void SetShowObjectAndRender(a2dCanvasObject *obj)
Used temporarely in rendering bitmas or in printing, to Set the show object and redraw the whole part...
a2dDrawer2D * GetDrawer2D()
get the internal m_drawer2D that is used for rendering the document
const a2dError a2dError_LoadObject
void OnIdle(wxIdleEvent &event)
Called by ProcessEvent(wxEvent& event) of document.
Input and output handler for the XmlSer format.
view to display the size of a2dCanvasView compared to the whole of the a2dCanvasDocument that is view...
virtual void CreateCommandProcessor()
create a command processor and set it for the document.
bool LoadLayers(a2dDocumentInputStream &stream, a2dLayers *layers)
load a layer definition from a CVG file.
virtual bool Save(a2dDocumentOutputStream &stream, const wxObject *obj)=0
Override to write to the stream and store (part of) of the document contents in the stream...
void WriteEndAttributes(bool close=false)
"Closes" the start tag after writing all attributes (writes the ">" or "/>" bracket).
const a2dPrintWhat a2dPRINT_Print
general print
wxFileName GetFilename() const
Get the file name in use for this document.
using a file stream for output, stream a a2dDocument or other wxObject into a stream.
wxString m_title
title put above printout
const a2dError a2dError_SaveObject
const a2dError a2dError_ImportObject
a2dCanvas is used to display one of the a2dCanvasObjects which are part of a a2dCanvasDocument object...
void OnOpenDocument(a2dDocumentEvent &event)
uses wxBufferedInputStream instead of a2dDocumentInputStream
virtual wxPrintout * OnCreatePrintout(a2dPrintWhat typeOfPrint, const wxPageSetupDialogData &pageSetupData)
to create a a2dViewPrintout, used to print a view or its document
a2dSmrtPtr< a2dLayers > m_layersetup
setup for layers in this document
double m_units_accuracy
how many decimal places in fraction are valid
bool LoadLayers(const wxString &filename)
load layers from another file
void OnChangeDrawings(a2dDrawingEvent &event)
called when a drawing in a document did change.
static const a2dSignal sig_changedZoom
while iterating a a2dCanvasDocument, this holds the context.
wxInputStream a2dDocumentInputStream
input stream based wxStreams
wxString m_libraryname
name of library or document
virtual bool CanSave(const wxObject *obj=NULL)=0
Should return true if the handler can write this document to a stream.
a2dWalker based algorithms
wxString & GetDescription()
Returns the description of the document.
bool ReleaseChildObjects(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
removes and release only from the childobjects the objects with the given mask
static bool m_printAsBitmap
if set print a bitmap that was drawn into
a2dDocument * GetDocument() const
get the document of the view
a2dDocviewGlobal * a2dDocviewGlobals
a global pointer to get to global instance of important classes.
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.
virtual void Load(wxObject *parent, a2dIOHandlerXmlSerIn &parser)
load object from CVG file
a2dCanvasView * m_canvasDocview
the view to view zoomed
a2dLayers * GetLayerSetup()
Get the central layersettings for the canvas library.
Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data. ...
void SetPrintMode(bool onOff)
to modify drawing feature when used as context for printing
void WriteEndDocument()
Checks if all open tags are closed.
bool m_printfilename
if true, a printout is done with filename (document file path), otherwise not
a2dCanvasView * m_drawingView
maping defined by this canvas
a2dCanvasObject * SetShowObject(const wxString &name)
set object available in the a2dDrawing to be shown on the drawer
const a2dError a2dError_LoadLayers
void Require(const XMLeventType &type, wxString name)
Forces a special tag.
bool OnPrintPage(int)
called for every page to print, for a2dCanvasDocument in general just one.
wxString GetTagName()
Returns name of the current XML tag.
virtual bool ProcessEvent(wxEvent &event)
Extend event processing to search the view's event table.
void DoSave(a2dIOHandlerCVGOut &out, a2dCanvasObjectList *towrite)
do not use directly, part of CVG format writing
virtual void ReportErrorF(const a2dError &error, const wxChar *Format,...)
concatenate to the the error report the given error.
void OnUndoEvent(a2dCommandProcessorEvent &event)
track modification of document
wxString GetPrintableName() const
Get title, or filename if no title, else [unnamed].
double GetBboxHeight()
get height of the boundingbox in world coordinates relative to its parents
bool SaveLayers(const wxString &filename)
save layer settings to CVG file
Event sent to a2dCommandProcessor.
bool DisconnectEventAll(wxEvtHandler *eventSink)
Remove all dynamic events in classA, going to classB (eventSink)
a2dViewPrintout(const wxPageSetupDialogData &pageSetupData, a2dCanvasView *drawer, const wxString &title, const wxString &filename, a2dPrintWhat typeOfPrint, bool drawframe, double scalelimit, bool fitToPage)
initialize mapping based on an existing canvas
bool m_printfittopage
If true, draw a view on all page without real scale.
used to report a2dDocument events
void SetLayerSetup(a2dLayers *layersetup)
set the layersettings for the canvas.
a2dDrawing * GetDrawing() const
get drawing via top object
virtual ~a2dCanvasView()
destructor
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.
Input handler for the CVG format.
virtual ~a2dZoomedView()
destructor
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
virtual void Save(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
write all needed to an XML type of file called the CVG format
#define EVT_UNDO(func)
event sent from a2DocumentCommandProcessor when a command is undone
const a2dPrintWhat a2dPRINT_PreviewView
preview print a2dView
wxUint32 GetDocumentDrawStyle()
get drawstyles used for drawing the document
const a2dPrintWhat a2dPRINT_PrintView
print a2dView
bool Save()
Saves the document by sending a a2dDocumentEvent ::wxEVT_SAVE_DOCUMENT event.
void SetShowOrigin(bool show)
Set showorigin on/off.
void SetDrawer2D(a2dDrawer2D *drawer2d, bool noDelete=false)
set the internal m_drawer2D to be used for rendering the document
wxWindow * m_display
In case of using a window for displaying the view, this holds the window.
virtual void DeleteContents()
delete all object in this document (also nested groups etc.)
bool Start(a2dObject *object)
start removing properties from the object given, and down.
a2dDocumentTemplatePtr m_documentTemplate
A pointer to the template from which this document was created.
wxString m_filename
filename put below printout
void SetFormatVersion(wxString formatVersion)
set version of library or document being parsed for
CloneOptions
options for cloning
virtual void SetMappingWidthHeight(double vx1, double vy1, double width, double height)
Give the virtual size to be displayed, the mapping matrix will be calculated.
#define EVT_REMOVE_VIEW(func)
event sent to document when a view will be removed from the document
a2dDrawingPtr m_drawing
start a2dCanvasObject containing all primitives
Contain one drawing as hierarchical tree of a2dCanvasObject's.
void SetMappingShowAll()
use the boundingbox of the ShowObject to set the mapping such that it will be displayed completely on...
wxInt64 GetUniqueSerializationId() const
return a unique id for this object
void OnComEvent(a2dComEvent &event)
called for a2dComEvent events.
void SetLayerSetup(a2dLayers *layersetup)
set the layersettings for the canvas.
general canvas module declarations and classes
bool m_printframe
If true, draw a frame around printouts.