21 #include "wx/luawraps/luawrap.h"
23 #include "wx/editor/candoc.h"
27 #include "wxbind/include/wxbinddefs.h"
28 #include "wxbind/include/wxcore_bind.h"
29 #include "wxlua/wxlstate.h"
30 #include "wxlua/wxlbind.h"
32 #include "wx/luawraps/luabind.h"
42 a2dCanvasObjectLua::a2dCanvasObjectLua(
double x,
double y, const wxString& script, const wxString& function ):
a2dCanvasObject()
44 m_function =
function;
67 void a2dCanvasObjectLua::SetField( wxLuaState lst,
const wxString& name,
const wxString& value )
69 lst.lua_PushString( name );
70 lst.lua_PushString( value );
71 lst.lua_SetTable( -3 );
74 void a2dCanvasObjectLua::SetField( wxLuaState lst,
const wxString& name,
double value )
76 lst.lua_PushString( name );
77 lst.lua_PushNumber( value );
79 lst.lua_SetTable( -3 );
82 void a2dCanvasObjectLua::SetField( wxLuaState lst,
const wxString& name,
long value )
84 lst.lua_PushString( name );
85 lst.lua_PushInteger( value );
86 lst.lua_SetTable( -3 );
89 void a2dCanvasObjectLua::SetField( wxLuaState lst,
const wxString& name,
bool value )
91 lst.lua_PushString( name );
92 lst.lua_PushBoolean( value );
93 lst.lua_SetTable( -3 );
96 void a2dCanvasObjectLua::SetField( wxLuaState lst,
const wxString& name, wxColour value )
98 lst.lua_PushString( name );
100 wxColour* returns =
new wxColour( value );
102 wxluaO_addgcobject( lst.GetLuaState(), returns, wxluatype_TSTRING );
104 wxluaT_pushuserdatatype( lst.GetLuaState(), returns, wxluatype_wxColour );
105 lst.lua_SetTable( -3 );
114 wxLuaState lst = a2dLuaWP->GetLuaState();
115 lua_State* L = lst.GetLuaState();
116 if ( 0 != lst.RunString( m_script ) )
118 wxLogWarning( _(
"Error in Lua Script" ) );
122 lua_getglobal( L, wx2lua( m_function ) );
123 lst.wxluaT_PushUserDataType(
this, wxluatype_a2dCanvasObject,
true );
125 lst.lua_PushNumber( m_xoffset );
126 lst.lua_PushNumber( m_yoffset );
131 CollectProperties2( &allprops, NULL );
132 a2dNamedPropertyList::const_iterator iter;
133 for( iter = allprops.begin(); iter != allprops.end(); ++iter )
155 SetField( lst, prop->
GetName(), p->GetColour() );
163 if ( lst.lua_PCall( 4, 0, 0 ) != 0 )
166 error.Printf( wxT(
"%s %s" ), m_function.c_str() , lua_tostring( L, -1 ) );
167 wxLuaEvent event( wxEVT_LUA_ERROR, lst.GetId(), lst );
168 event.SetString( error );
169 lst.SendEvent( event );
184 #if wxART2D_USE_CVGIO
188 if ( xmlparts == a2dXmlSer_attrib )
199 if ( xmlparts == a2dXmlSer_attrib )
206 #endif //wxART2D_USE_CVGIO
222 return m_luaExecDlg != NULL && m_luaExecDlg->IsShown();
238 m_interp = wxLuaState( wxTheApp, wxID_ANY );
240 m_interp.SetEventHandler( wxTheApp );
250 m_luaExecDlg->Destroy();
254 m_interp.CloseLuaState(
true );
262 m_luaExecDlg->Destroy();
268 bool a2dLuaCentralCommandProcessor::ExecuteF(
bool withUndo, wxChar* Format, ... )
273 va_start( ap, Format );
275 commands.PrintfV( Format, ap );
278 return Execute( commands, withUndo );
282 bool a2dLuaCentralCommandProcessor::Execute(
const wxString& commandsString,
bool withUndo )
290 if ( 0 != m_interp.RunString( commandsString ) )
293 wxLogWarning( _(
"Error in Lua Command: %s \n" ), commandsString.c_str() );
302 bool a2dLuaCentralCommandProcessor::ExecuteFile(
const wxString& fileName )
309 if ( 0 != m_interp.RunFile( fileName ) )
313 wxLogWarning( _(
"Error in Lua File: %s \n" ), fileName.c_str() );
327 wxWindow* frame = drawer->
GetCanvas()->GetParent();
336 bool a2dLuaCentralCommandProcessor::ShowLuaExecDlg()
341 if ( m_luaExecDlg->IsShown() )
343 m_luaExecDlg->Show(
false );
347 m_luaExecDlg->Show(
true );
354 bool a2dLuaCentralCommandProcessor::ShowDlg(
const a2dCommandId* comID,
bool modal,
bool onTop )
356 if ( comID == &a2dLuaCentralCommandProcessor::COMID_ShowLuaExecDlg )
361 if ( m_luaExecDlg->IsShown() )
363 m_luaExecDlg->Show(
false );
367 m_luaExecDlg->Show(
true );
373 return a2dCentralCanvasCommandProcessor::ShowDlg( comID, modal, onTop );
377 bool a2dLuaCentralCommandProcessor::FileNew()
389 bool a2dLuaCentralCommandProcessor::FileOpen(
const wxString& path )
396 bool a2dLuaCentralCommandProcessor::FileSaveAs(
const wxString& path,
bool silent )
401 bool a2dLuaCentralCommandProcessor::FileImport(
const wxString& path,
const wxString& description )
406 bool a2dLuaCentralCommandProcessor::FileExport(
const wxString& path,
const wxString& description,
bool silent )
411 bool a2dLuaCentralCommandProcessor::Message(
const wxString& message )
413 wxFrame* pf = ( wxFrame* ) wxTheApp->GetTopWindow();
414 wxMessageBox( message, wxT(
"Gedi::Message" ), (
int )wxOK | wxCENTRE, pf, 0, 0 );
418 bool a2dLuaCentralCommandProcessor::PushTool(
const a2dCommandId& which,
bool shiftadd,
bool oneshot )
423 bool a2dLuaCentralCommandProcessor::SetDocumentLayers(
const wxString& propertyname,
const wxString& value )
436 a2dLayers* a2dLuaCentralCommandProcessor::GetLayersDocument()
444 a2dLayers* a2dLuaCentralCommandProcessor::GetLayersGlobal()
449 bool a2dLuaCentralCommandProcessor::SetLayersDocument(
a2dLayers* layers )
459 bool a2dLuaCentralCommandProcessor::SetLayersGlobal(
a2dLayers* layers )
465 a2dLayers* a2dLuaCentralCommandProcessor::LoadLayers(
const wxString& filename )
476 bool a2dLuaCentralCommandProcessor::SaveLayersDocument(
const wxString& filename )
487 bool a2dLuaCentralCommandProcessor::SaveLayersGlobal(
const wxString& filename )
494 bool a2dLuaCentralCommandProcessor::SetLayer( wxUint16 layer )
500 bool a2dLuaCentralCommandProcessor::SetTarget( wxUint16 target )
506 bool a2dLuaCentralCommandProcessor::ClearGroup(
const wxString& group )
513 void a2dLuaCentralCommandProcessor::AddGroupA( wxUint16 layer )
518 void a2dLuaCentralCommandProcessor::AddGroupB( wxUint16 layer )
523 bool a2dLuaCentralCommandProcessor::DeleteGroupA()
538 bool a2dLuaCentralCommandProcessor::MoveGroupA()
554 bool a2dLuaCentralCommandProcessor::CopyGroupA()
569 bool a2dLuaCentralCommandProcessor::ConvertToArcsGroupA(
bool detectCircle )
583 bool a2dLuaCentralCommandProcessor::ConvertPolygonToArcsGroupA(
bool detectCircle )
598 bool a2dLuaCentralCommandProcessor::ConvertToPolygonPolylinesWithArcsGroupA()
613 bool a2dLuaCentralCommandProcessor::ConvertToPolygonPolylinesWithoutArcsGroupA()
628 bool a2dLuaCentralCommandProcessor::ConvertPolylineToArcsGroupA()
643 bool a2dLuaCentralCommandProcessor::ConvertToVPathsGroupA()
658 bool a2dLuaCentralCommandProcessor::ConvertLinesArcsGroupA()
673 bool a2dLuaCentralCommandProcessor::ConvertToPolylinesGroupA()
688 bool a2dLuaCentralCommandProcessor::RemoveRedundantGroupA()
703 bool a2dLuaCentralCommandProcessor::DetectSmallGroupA()
714 what( a2dCommand_GroupAB::DetectSmall ) );
718 #if wxART2D_USE_KBOOL
719 bool a2dLuaCentralCommandProcessor::BoolOperation_GroupAB(
a2dCommand_GroupAB::a2dDoWhat operation,
bool clearTarget,
bool selectedA,
bool selectedB )
731 clearTarget( clearTarget ).
732 selectedA( selectedA ).
733 selectedB( selectedB )
738 #endif //wxART2D_USE_KBOOL
740 bool a2dLuaCentralCommandProcessor::UnGroup(
bool selected,
bool deep )
754 bool a2dLuaCentralCommandProcessor::SetVariable(
const wxString& varnamep,
const wxString& varvaluep )
760 wxString a2dLuaCentralCommandProcessor::GetVariable(
const wxString& varname )
766 return _(
"NOT_A_VARIABLE" );
772 void a2dLuaCentralCommandProcessor::AddConfigPath(
const wxString& path )
777 void a2dLuaCentralCommandProcessor::AddLayersPath(
const wxString& path )
782 void a2dLuaCentralCommandProcessor::AddFontPath(
const wxString& path )
787 void a2dLuaCentralCommandProcessor::AddImagePath(
const wxString& path )
792 void a2dLuaCentralCommandProcessor::AddIconPath(
const wxString& path )
797 bool a2dLuaCentralCommandProcessor::SetSnap(
bool snap )
803 bool a2dLuaCentralCommandProcessor::SetSnapFeatures( wxUint32 features )
809 bool a2dLuaCentralCommandProcessor::ViewAsImageAdv(
const wxFileName& file, wxBitmapType type,
bool onView )
817 if ( !drawer->GetDrawingPart()->
GetDrawing() )
823 void a2dLuaCentralCommandProcessor::SetCursor(
double x,
double y )
829 bool a2dLuaCentralCommandProcessor::Find(
const wxString& objectname )
840 name( objectname ) );
844 bool a2dLuaCentralCommandProcessor::Ask(
const wxString& variablename,
const wxString& mes )
846 wxString text = wxGetTextFromUser( mes );
852 bool a2dLuaCentralCommandProcessor::AskFile(
const wxString& storeInVariable,
853 const wxString& message,
854 const wxString& defaultDir,
855 const wxString& extension,
856 const wxString& fileFilter
864 wxFileName a2dLuaCentralCommandProcessor::AskFile2(
865 const wxString& message,
866 const wxString& defaultDir,
867 const wxString& extension,
868 const wxString& fileFilter
871 wxString storeInVariable = _T(
"ask_file_result" );
873 return wxFileName( file );
876 bool a2dLuaCentralCommandProcessor::ShowVariable(
const wxString& variableName,
877 const wxString& message
885 wxMessageBox( mes , _(
"ShowVariable" ), wxOK , NULL );
1013 wxString foundfile = imagefile;
1015 path.Add( wxT(
"." ) );
1016 if ( !path.ExpandPath( foundfile ) )
1021 if ( foundfile.IsEmpty() )
1055 bool a2dLuaCentralCommandProcessor::Add_Point(
double x,
double y )
1063 if ( !drawer->GetDrawingPart()->
GetDrawing() )
1072 bool a2dLuaCentralCommandProcessor::Move_Point(
int index ,
double x,
double y )
1080 if ( !drawer->GetDrawingPart()->
GetDrawing() )
1095 bool a2dLuaCentralCommandProcessor::DrawWireFrame(
bool onOff )
1104 bool a2dLuaCentralCommandProcessor::DrawGridLines(
bool onOff )
1109 bool a2dLuaCentralCommandProcessor::DrawGridAtFront(
bool onOff )
1114 bool a2dLuaCentralCommandProcessor::DrawGrid(
bool onOff )
1119 bool a2dLuaCentralCommandProcessor::ZoomOut()
1124 bool a2dLuaCentralCommandProcessor::Refresh()
1137 bool a2dLuaCentralCommandProcessor::InsertGroupRef(
double x,
double y )
1153 if ( groups.ShowModal() == wxID_OK )
1162 bool a2dLuaCentralCommandProcessor::AddGroupObject(
const wxString& groupName,
double x,
double y, wxUint16 layer )
1179 bool a2dLuaCentralCommandProcessor::NewPin(
double x,
double y,
const wxString& groupname )
1191 wxString name = groupname;
1192 if ( name.IsEmpty() )
1193 name = wxGetTextFromUser( _(
"give name of new pin:" ) );
1194 long ang = wxGetNumberFromUser( _(
"Give pin angle:" ), _(
"angle:" ), _(
"pin angle" ), 0, -360, 360 );
1202 bool a2dLuaCentralCommandProcessor::PushInto(
const wxString& name )
1214 if ( name.IsEmpty() )
1227 (
void )wxMessageBox( _(
"Does not contain a group, unable to push into" ), _(
"push into" ), wxICON_INFORMATION | wxOK );
1232 bool a2dLuaCentralCommandProcessor::SelectAll()
1246 bool a2dLuaCentralCommandProcessor::DeSelectAll()
1259 bool a2dLuaCentralCommandProcessor::SelectedChangeLayer(
long layer )
1273 bool a2dLuaCentralCommandProcessor::SetFillStrokeSelected()
1290 bool a2dLuaCentralCommandProcessor::ToTop()
1302 bool a2dLuaCentralCommandProcessor::ToBack()
1314 bool a2dLuaCentralCommandProcessor::DeleteSelected()
1326 bool a2dLuaCentralCommandProcessor::MoveSelected(
double x,
double y,
long layer )
1339 bool a2dLuaCentralCommandProcessor::CopySelected(
double x,
double y,
long layer )
1352 bool a2dLuaCentralCommandProcessor::TransformSelected(
const wxString& str )
1373 bool a2dLuaCentralCommandProcessor::Group()
1386 bool a2dLuaCentralCommandProcessor::UnGroup()
1399 bool a2dLuaCentralCommandProcessor::SetUrl()
1424 const wxPoint& pos, const wxSize& size,
1425 long style,
long options, const wxString& name )
1426 :
wxLuaIDE( parent,
id, pos, size, style | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE, options, name )
1430 wxFrame* pf = ( wxFrame* ) wxTheApp->GetTopWindow();
1432 wxMenuBar* menuBar = 0;
1433 wxToolBar* toolBar = 0;
1435 GetEditorNotebook()->GetOptions().SetMenuBar( menuBar );
1436 GetLuaOutputWin()->GetOptions().SetMenuBar( menuBar );
1437 GetLuaShellWin()->GetOptions().SetMenuBar( menuBar );
1439 GetEditorNotebook()->GetOptions().SetToolBar( toolBar );
1440 GetLuaOutputWin()->GetOptions().SetToolBar( toolBar );
1441 GetLuaShellWin()->GetOptions().SetToolBar( toolBar );
1444 a2dLuaConsole::~a2dLuaConsole()
1448 void a2dLuaConsole::OnLua( wxLuaEvent& event )
1450 if ( event.GetwxLuaState() == m_cmdh->GetLuaState() )
1451 OutputLuaEvent( event, m_luaOutput );
1453 wxLuaIDE::OnLua( event );
1466 wxDialog( parent, -1, title, wxDefaultPosition, wxDefaultSize, style, name )
1470 wxBoxSizer* itemBoxSizer =
new wxBoxSizer( wxVERTICAL );
1471 SetSizer( itemBoxSizer );
1473 m_commandProcessor = commandProcessor;
1475 m_luaConsole =
new a2dLuaConsole( commandProcessor,
this, wxID_ANY, wxDefaultPosition, wxSize( 400, 400 ) );
1476 itemBoxSizer->Add( m_luaConsole, 1, wxGROW | wxALL, 0 );
1478 SetSizeHints( wxSize( 400, 400 ) );
1479 GetSizer()->Fit(
this );
1480 GetSizer()->SetSizeHints(
this );
1483 wxSplitterWindow* splitWin = m_luaConsole->GetSplitterWin();
1484 splitWin->SetSashPosition( splitWin->GetSize().y / 2 );
1487 a2dLuaExecDlg::~a2dLuaExecDlg()
1491 void a2dLuaExecDlg::OnCloseWindow( wxCloseEvent& WXUNUSED( event ) )
1498 wxString cmdName =
event.GetRecord();
1510 void a2dLuaExecDlg::OnCharHook( wxKeyEvent& event )
1517 if ( event.GetKeyCode() == WXK_ESCAPE )
1519 wxCommandEvent eventc;
1537 extern const long SCRIPT_luawrap = wxNewId();
1538 extern const long EXECDLG_lua = wxNewId();
1545 EVT_INIT_EVENT( a2dLuaEditorFrame::OnInit )
1550 #define DOC ((a2dCanvasView*)m_view.Get())->GetCanvasDocument()
1555 m_initialized =
false;
1559 wxFrame* parent,
const wxPoint& pos,
const wxSize& size,
long style )
1562 m_initialized =
false;
1565 Create(
true, isParent, parent, pos, size, style );
1568 a2dLuaEditorFrame::~a2dLuaEditorFrame()
1582 wxMenu* dlg_menu =
new wxMenu;
1583 m_menuBar->Append( dlg_menu, _(
"&Lua Dialogs" ) );
1585 AddFunctionToMenu( EXECDLG_lua, dlg_menu, _(
"&Lua Commandline Dialog" ), _(
"interactive lua command dialog" ), ( wxObjectEventFunctionM ) &a2dLuaEditorFrame::OnShowExecDlg2,
true );
1586 AddFunctionToMenu( SCRIPT_luawrap, dlg_menu, _T(
"Run Lua Script" ), _T(
"choose a wxLua script to run" ), ( wxObjectEventFunctionM ) &a2dLuaEditorFrame::OnRunScript ,
true );
1591 void a2dLuaEditorFrame::OnShowExecDlg2( wxCommandEvent& event )
1595 luacmd->
Submit( command );
1598 void a2dLuaEditorFrame::OnRunScript( wxCommandEvent& event )
1603 ( void )wxMessageBox( _(
"For this function a a2dLuaCentralCommandProcessor is needed" ), _(
"Lua Scripts" ), wxICON_INFORMATION | wxOK );
1609 wxString fullPath = wxFileSelector( _(
"Select a script file" ),
1618 if ( !fullPath.IsEmpty() && ::wxFileExists( fullPath ) )
1620 if ( !luacmd->ExecuteFile( fullPath ) )
1622 wxLogWarning( _(
"Error in Lua Script" ) );
1628 void a2dLuaEditorFrame::OnUpdateUI( wxUpdateUIEvent& event )
1631 if ( event.GetId() == EXECDLG_lua )
1638 bool a2dLuaEditorFrame::CallLuaScriptThemeFunction(
const wxString& fileName,
const wxString&
function )
1642 wxLuaState lst = luacmd->GetLuaState();
1643 lua_State* L = lst.GetLuaState();
1644 if ( 0 != lst.RunFile( fileName ) )
1646 wxLogWarning( _(
"Error in Lua Script" ) );
1651 lua_getglobal( L, wx2lua(
function ) );
1652 lst.wxluaT_PushUserDataType(
this, wxluatype_a2dLuaEditorFrame,
true );
1653 if ( lst.lua_PCall( 1, 0, 0 ) != 0 )
1656 error.Printf( wxT(
"%s %s" ),
function.c_str() , lua_tostring( L, -1 ) );
1657 wxLuaEvent event( wxEVT_LUA_ERROR, lst.GetId(), lst );
1658 event.SetString( error );
1659 lst.SendEvent( event );
virtual double GetDouble() const
when a2dDoubleProperty, return its value else assert
a2dCircle at x,y, and with radius
a2dCanvasObject * GetCurrentCanvasObject()
get the current canvas object to add to parent as child
wxString AskFile(const wxString &message, const wxString &default_path="", const wxString &default_filename="", const wxString &default_extension="", const wxString &wildcard="*.*", int flags=0, int x=-1, int y=-1)
ask for a file using a file selector.
property to hold an unsigned 4 byte integer type variable to be associated with a a2dObject ...
(In) Visible property that can be added to Docview Objects.
virtual wxString GetString() const
when a2dStringProperty, return its value else assert
#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.
objects which fit the mask to bottom in parent (rendered first)
a2dCanvasObjectReference is a reference to any a2dCanvasObject derived class.
a2dEllipticArc * Add_a2dEllipticArc(double xc, double yc, double width, double height, double start, double end)
add specific object
a2dPolygonL * Add_a2dPolygonL(a2dVertexList *points, bool spline=false)
add specific object
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
const a2dError a2dError_CommandError
used to move start or end point in line objects
virtual void OnExit()
cleaup modeless dialogs created from here
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
convert segments in polygon/polyline with width objects in group A to Arcs where possible ...
bool IsShowna2dLuaExecDlg()
if m_luaExecDlg is visible or not
~a2dLuaCentralCommandProcessor()
destructor
void SetLayer(wxUint16 layer, bool setStyleOfLayer=false)
a2dPolylineL * Add_a2dPolylineL(a2dVertexList *points, bool spline=false)
add specific object
const a2dError a2dError_GetVar
a2dCanvasCommandProcessor * GetDrawingCmdProcessor()
get commandprocessor of document
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
class to map references to objects stored in XML, in order to make the connection later on...
a2dDrawing * m_root
root group for rendering and accessing the canvas's also contains layer settings
virtual wxInt32 GetInt32() const
when a2dInt32Property, return its value else assert
#define EVT_RECORD(func)
event sent to a2dDocumentCommandProcessor when a document has been added to the a2dDocumentCommandPro...
View on a a2dCanvasDocument.
const a2dError a2dError_CouldNotEvaluatePath
static a2dPropertyIdTyped< basetype, proptype > * GetDummy()
returns a dummy property id of this type, that can be used in non-id applications ...
a2dArrow * Add_a2dArrow(double xt, double yt, double l1, double l2, double b, bool spline=false)
add specific object
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
a2dArc * Add_a2dArc(double xc, double yc, double radius, double start, double end)
add specific object
a2dPin is used in a2dCanvasObject to add pins to it.
polygon defined with list of points.
a2dError FileOpen(a2dDocumentPtr &doc, const wxFileName &file=wxFileName(wxT("")), a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE|a2dTemplateFlag::LOAD)
Creates a new document and reads in the selected file.
used to add points to polygon objects
a2dRectC * Add_a2dRectC(double xc, double yc, double w, double h, double angle=0, double radius=0)
add specific object
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
const a2dError a2dError_NoError
objects which fit the mask to top in parent (rendered last)
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
property to hold a double type variable to be associated with a a2dObject
convert segments in polygon/polyline objects in group A to Arcs where possible
property to hold a bool type variable to be associated with a a2dObject
bool SetPropertyToObject(const wxString &objectname, const wxString &propertyname, const wxString &value=wxT(""))
To set a property by to a certain 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 wxUint32 GetUint32() const
when a2dUint32Property, return its value else assert
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
bool ParseCvgTransForm(a2dAffineMatrix &matrix, const wxString &str, wxString &error)
function to parse a string in SVG/CVG format and return the resulting matrix
convert shapes to polylines even if polygons
convert to simple polygons and polylines
a2dGlobal * a2dGlobals
global a2dCanvasGlobal to have easy access to global settings
a2dOrigin * Add_a2dOrigin(double w, double h)
add specific object
a2dDrawing * GetDrawing() const
get the root object, which holds the objects in the document.
a2dPathList & GetIconPathList()
Path for Icons and small bitmaps.
a2dRectC is a centered rectangle
a2dCanvas * GetCanvas() const
Get the Display window of the a2dView. But casted to a a2dCanvas.
wxString GetName() const
Get the name of the a2dPropertyId object.
list of a2dNamedProperty objects
convert shapes to vector paths
a2dError FileNew(a2dDocumentPtr &doc, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE)
Creates a document from a list of templates (if more than one template).
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
set layer of objects which fit the mask
a2dCanvasObject is the base class for Canvas Objects.
a2dCanvasObjectList m_found
objects found
a2dCanvasView * CheckDrawer() const
is a view with a2dCanvasView active
property to hold a FileName type variable to be associated with a a2dObject
a2dEndsLine * Add_a2dEndsLine(double x1, double y1, double x2, double y2)
add specific object
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
vertex list of line and arc segments.
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
bool SaveLayers(const wxString &filename)
save layer object to CVG file
const a2dNamedProperty * GetVariable(const wxString &variableName)
get an existing variable of unknown type (not cloned)
virtual void Update(unsigned int hint=0, wxObject *hintObject=NULL)
force a2dDocumentEvent ::wxEVT_UPDATE_VIEWS event
clear all layers in operation group B
bool Create(bool createCanvas, bool isParent, wxFrame *parent, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE)
delayed creation of window.
objects which fit the mask are grouped into a new object
clear all layers in operation group A
used to theme a a2dEditorFrame
property to hold a 2 byte integer type variable to be associated with a a2dObject ...
static a2dErrorVector & GetErrors()
get the errors found sofar.
bool SetVariable(const wxString &variableName, a2dNamedProperty *property)
set a new or replace an existing variable of arbitrary type
a2dText is an abstract base class.
collect a2dCanvasObject's in a hierarchy of a a2dCanvasDocument
a2dPathList & GetFontPathList()
Path for Fonts.
command on selected objects
a2dOrigin stays at World Coordinate Zero (0,0) not matter what.
const a2dStroke & GetStroke() const
get the current stroke
delete objects which fit the mask
virtual void ReportError(const a2dError &error, const wxString &errorstr=wxEmptyString)
concatenate to the the error report the given error.
a2dCanvasDocument * CheckCanvasDocument() const
is a view with a2dCanvasView active and does it have a document
a2dEllipse centered at x,y.
polyline defined with list of points.
bool FileSaveAs(const wxFileName &file=wxFileName(wxT("")), a2dDocumentFlagMask flags=a2dREFDOC_NON)
Calls wxDocument::SaveAs for the current document.
bool SubmitToDrawing(a2dCommand *command, bool storeIt=true)
Submit a command to the active drawing.
a2dCanvasObjectReference * Add_a2dCanvasObjectReference(double x, double y, a2dCanvasObject *obj)
add specific object
virtual bool GetBool() const
when a2dBoolProperty, return its value else assert
a2dEllipse * Add_a2dEllipse(double xc, double yc, double width, double height)
add specific object
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
a2dImage (will scale/rotate image when needed)
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
Set a string variable inside wxDocview.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
void SetTarget(wxUint16 target)
set target layer in operation
void Translate(double x, double y)
relative translate the object to position x,y in world coordinates
objects which fit the mask are copied to target and translated
convert to simple polygons and polylines
void Prepend(a2dCanvasObject *obj)
prepend a a2dCanvasObject to the childobjects
Input and output handler for the XmlSer format.
static const a2dCanvasObjectFlagsMask SELECTED
a2dLuaEditorFrame * GetActiveEditorFrame()
if active view has as display frame a a2dLuaEditorFrame, return it.
a2dVariablesHash & GetVariablesHash()
aliases list for setting internal variables
virtual wxUint16 GetUint16() const
when a2dUint16Property, return its value else assert
bool FileImport(const wxFileName &file=wxFileName(wxT("")), const wxString &description=wxT(""), a2dDocumentFlagMask flags=a2dREFDOC_NON)
Calls a2dDocument::Import for the current document.
#define EVT_THEME_EVENT(func)
static wxEvtHandler for theme event, send from a2dEditorFrame
a2dCircle * Add_a2dCircle(double x, double y, double radius)
add specific object
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
bool GetDoLog()
Is logging to wxLog target on or off?
a2dArrow is used for having line begin and ends on specific objects.
Each a2dCommand is given a command id at construction.
a2dPathList & GetImagePathList()
Path for Images.
sepcialized Frame for editor of a2dCanvas
a2dText * Add_a2dText(const wxString &text, double x, double y, double angle, const a2dFont &font)
add specific object
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
property to hold a wxString type variable to be associated with a a2dObject
A 2x3 affine matrix class for 2D transformations.
bool LoadLayers(const wxString &filename)
save layers to a file
void AddGroupB(wxUint16 layer)
add layer to group B layers
virtual wxWindow * GetAssociatedWindow() const
Returns a window that can be used as a parent for document-related dialogs. Override if necessary...
convert segments in polyline objects in group A to Arcs where possible
while iterating a a2dCanvasDocument, this holds the context.
bool Start(a2dCanvasObject *object)
All updates of these modes force an update (e.g. update non-pending valid bounding boxes) ...
void AddGroupA(wxUint16 layer)
add layer to group A layers
a2dCommandProcessor * GetCommandProcessor() const
Returns a pointer to the command processor associated with this document.
virtual float GetFloat() const
when a2dFloatProperty, return its value else assert
const a2dFill & GetFill() const
get the current fill
virtual bool Submit(a2dCommand *command, bool storeIt=true)
a2dDocviewGlobal * a2dDocviewGlobals
a global pointer to get to global instance of important classes.
a2dCanvasObject * Add_a2dCanvasObject(double x=0, double y=0)
add specific object
a2dLuaEditorFrame()
this makes dynamic creation possible ( e.g. a derived a2dLuaEditorFrame )
virtual wxInt16 GetInt16() const
when a2dInt16Property, return its value else assert
a2dDoWhat
defines what to do
bool FileExport(const wxFileName &file=wxFileName(wxT("")), const wxString &description=wxT(""), a2dDocumentFlagMask flags=a2dREFDOC_NON)
Calls a2dDocument::Export for the current document.
a2dCanvasObjectLua(double x=0, double y=0, const wxString &script=wxT(""), const wxString &function=wxT(""))
construct at given position
void SetDoLog(bool onOff)
Set logging to wxLog target on or off.
Lua script used to draw the object.
a2dRestrictionEngine * GetRestrictionEngine()
Get restriction engine (grid snapping)
virtual bool SetOrAddPropertyToObject(a2dObject *propRefObject, const wxString &name, const wxString &value=wxT(""), bool withUndo=true)
set a named property to the given object
a2dCanvasObject * AddCurrent(a2dCanvasObject *objectToAdd, bool withUndo=false, a2dPropertyIdList *setStyles=NULL, a2dCanvasObject *parentObject=NULL)
add the current canvas object to parent as child
sepcialized Frame for editor of a2dCanvas
a2dLayers * GetLayerSetup()
Get the central layersettings for the canvas library.
Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data. ...
bool SaveViewAsImage(a2dCanvasDocument *doc, const wxString &file, wxBitmapType type, a2dCanvasObject *from)
Save current view as an image of the given type.
virtual void OnExit()
cleaup modeless dialogs created from here
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
a2dPathList & GetConfigPathList()
Path(s) for configuration file(s) in an application.
a2dEndsLine with begin and/or end object.
bool SetVariableString(const wxString &variableName, const wxString &value)
set a new or replace an existing wxString variable
a2dCanvasObject * SetShowObject(const wxString &name)
set object available in the a2dDrawing to be shown on the drawer
void AddFunctionToMenu(int id, wxMenu *parentMenu, const wxString &text, const wxString &helpString, wxObjectEventFunctionM func, bool check=false)
add a menu which executes a function
static a2dPinClass * Standard
Pins of this class can only connect to pins of the same class.
virtual ~a2dCanvasObjectLua()
destructor
a2dImage * Add_a2dImage(const wxImage &image, double xc, double yc, double w, double h)
add specific object
virtual void ReportErrorF(const a2dError &error, const wxChar *Format,...)
concatenate to the the error report the given error.
layer group A and B commands
a2dPathList & GetLayersPathList() const
Path for Icons and small bitmaps.
Event sent to a2dCommandProcessor.
bool m_withUndo
if set, for commands which can undo, will be submitted like that.
a2dRect * Add_a2dRect(double x, double y, double w, double h, double radius=0)
add specific object
const a2dError a2dError_NotSpecified
void SetLayerSetup(a2dLayers *layersetup)
set the layersettings for the canvas library.
virtual wxString StringValueRepresentation() const
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
a2dSLine * Add_a2dSLine(double x1, double y1, double x2, double y2)
add specific object
a2dDrawing * GetDrawing() const
get drawing via top object
bool SetDrawerStyle(const a2dFill &brush, const a2dStroke &stroke, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
set only in this list fill and stroke of objects with the given mask
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.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
objects which fit the mask are grouped into a new object
#define EVT_UNDO(func)
event sent from a2DocumentCommandProcessor when a command is undone
a command wrapper specially designed to work with wxArt2D docview classes and rest.
all headers in the editor module
void SetSnap(bool snap)
enable all snapping features or not
static const a2dCanvasObjectFlagsMask ALL
command on selected objects
objects which fit the mask are moved to target and translated
a2dCanvasObject * Find(const wxString &objectname, const wxString &classname=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *propid=NULL, const wxString &valueAsString=wxT(""), wxUint32 id=0) const
return the object which fits the filter.
property to hold a FileName type variable to be associated with a a2dObject
objects which fit the mask are given an Url property
property to hold a float type variable to be associated with a a2dObject
CloneOptions
options for cloning
convert shapes to seperate lines and arcs
Contain one drawing as hierarchical tree of a2dCanvasObject's.
property to hold an unsigned 2 byte integer type variable to be associated with a a2dObject ...
void SetSnapTargetFeatures(wxUint32 snapTargetFeatures)
a2dEllipticArc centered at x,y
void SetLayerSetup(a2dLayers *layersetup)
set the layersettings for the canvas.
< generate a report of small objects