19 #ifndef __WXCANCOM_H__
20 #define __WXCANCOM_H__
26 #include "wx/cmdproc.h"
31 #include "wx/editor/candoc.h"
33 #include <wx/tokenzr.h>
35 #include <wx/numdlg.h>
39 #endif //wxART2D_USE_GDSIO
43 #endif //wxART2D_USE_KEYIO
47 class A2DEDITORDLLEXP ExecDlg;
53 #define CMDP (((a2dCanvasDocument*)GetCurrentDocument())->GetCanvasCommandProcessor())
55 DECLARE_MENU_ITEMID( CmdMenu_GdsIoSaveTextAsPolygon )
56 DECLARE_MENU_ITEMID( CmdMenu_KeyIoSaveTextAsPolygon )
57 DECLARE_MENU_ITEMID( CmdMenu_SetGdsIoSaveFromView )
58 DECLARE_MENU_ITEMID( CmdMenu_SetKeyIoSaveFromView )
60 DECLARE_MENU_ITEMID( CmdMenu_SaveLayers )
61 DECLARE_MENU_ITEMID( CmdMenu_SaveLayersHome )
62 DECLARE_MENU_ITEMID( CmdMenu_SaveLayersLastDir )
63 DECLARE_MENU_ITEMID( CmdMenu_SaveLayersCurrentDir )
64 DECLARE_MENU_ITEMID( CmdMenu_LoadLayers )
65 DECLARE_MENU_ITEMID( CmdMenu_LoadLayersHome )
66 DECLARE_MENU_ITEMID( CmdMenu_LoadLayersLastDir )
67 DECLARE_MENU_ITEMID( CmdMenu_LoadLayersCurrentDir )
69 DECLARE_MENU_ITEMID( CmdMenu_GdsIoSaveFromView )
70 DECLARE_MENU_ITEMID( CmdMenu_KeyIoSaveFromView )
71 DECLARE_MENU_ITEMID( CmdMenu_SetLayersProperty )
73 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgLayers )
74 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgStructureDocument )
75 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgStructureDocumentModal )
76 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgLayersDocument )
77 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgLayerOrderDocument )
79 DECLARE_MENU_ITEMID( CmdMenu_ViewAsImage )
80 DECLARE_MENU_ITEMID( CmdMenu_ViewAsImage_Png )
81 DECLARE_MENU_ITEMID( CmdMenu_ViewAsImage_Bmp )
82 DECLARE_MENU_ITEMID( CmdMenu_ViewAsSvg )
84 DECLARE_MENU_ITEMID( CmdMenu_DocumentAsImage_Png )
85 DECLARE_MENU_ITEMID( CmdMenu_DocumentAsImage_Bmp )
86 DECLARE_MENU_ITEMID( CmdMenu_DocumentAsOdbXml )
88 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Link_OneShot )
89 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Link )
90 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FollowLinkDocDrawCam )
91 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Master3Link )
102 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
103 a2dInitCurrentSmartPointerOwner m_initCurrentSmartPointerOwner;
106 DECLARE_EVENT_TABLE()
115 bool initialize =
true,
116 int maxCommands = -1 );
124 void UpdateAllViews();
126 void OnUpdateUndo( wxUpdateUIEvent& event );
128 void OnUpdateRedo( wxUpdateUIEvent& event );
134 bool ProcessEvent( wxEvent& event );
136 void OnPushToolUpdateMenu( wxUpdateUIEvent& event );
138 void OnUpdateMenu( wxUpdateUIEvent& event );
141 void OnMenu( wxCommandEvent& event );
144 bool SubmitToDrawing(
a2dCommand* command,
bool storeIt =
true );
150 double GetUnitsScaleOfDocument();
153 void SetGridX(
const a2dDoMu& gridX );
155 void SetGridY(
const a2dDoMu& gridY );
160 bool SaveLayers(
const wxFileName& fileName );
162 bool LoadLayers(
const wxFileName& fileName );
174 bool CvgString(
const wxString& cvgString );
187 bool SetPropertyToObject(
const wxString& objectname,
const wxString& propertyname,
const wxString& value = wxT(
"" ) );
199 bool SetPropertyToObject(
const wxString& objectname,
a2dNamedProperty* property );
207 bool SetLayerProperty(
long layer,
const wxString& propertyname,
const wxString& value );
222 bool SetShowObject(
int index );
225 bool Zoom(
double x1,
double y1,
double x2,
double y2,
bool upp );
231 void SetCurrentView(
a2dView* view );
254 void FillLibraryPoints();
259 virtual void OnExit();
261 virtual bool ShowDlg(
const a2dCommandId* comID,
bool modal,
bool onTop );
265 bool IsShownStructureDlg();
268 void SetBooleanEngineMarge(
const a2dDoMu& marge );
270 void SetBooleanEngineGrid(
long grid );
272 void SetBooleanEngineDGrid(
double dgrid );
274 void SetBooleanEngineCorrectionAber(
const a2dDoMu& aber ) ;
276 void SetBooleanEngineCorrectionFactor(
const a2dDoMu& aber );
278 void SetBooleanEngineMaxlinemerge(
const a2dDoMu& maxline );
280 void SetBooleanEngineWindingRule(
bool rule );
282 void SetBooleanEngineRoundfactor(
double roundfac ) ;
283 void SetBooleanEngineSmoothAber(
const a2dDoMu& aber );
284 void SetBooleanEngineLinkHoles(
bool doLinkHoles );
286 void SetRadiusMin(
const a2dDoMu& radiusMin );
288 void SetRadiusMax(
const a2dDoMu& radiusMax ) ;
290 void SetAberPolyToArc(
const a2dDoMu& aber );
292 void SetAberArcToPoly(
const a2dDoMu& aber );
294 void SetSmall(
const a2dDoMu& smallest );
296 bool GdsIoSaveTextAsPolygon(
bool onOff );
297 bool KeyIoSaveTextAsPolygon(
bool onOff );
300 const a2dDoMu& GetRadiusMin()
const ;
302 const a2dDoMu& GetRadiusMax()
const ;
304 const a2dDoMu& GetAberPolyToArc()
const;
306 const a2dDoMu& GetAberArcToPoly()
const ;
308 const a2dDoMu& GetSmall()
const;
311 const a2dDoMu& GetBooleanEngineMarge()
const;
313 long GetBooleanEngineGrid()
const;
315 double GetBooleanEngineDGrid()
const;
317 const a2dDoMu& GetBooleanEngineCorrectionAber()
const ;
319 const a2dDoMu& GetBooleanEngineCorrectionFactor()
const;
321 const a2dDoMu& GetBooleanEngineMaxlinemerge()
const ;
323 bool GetBooleanEngineWindingRule()
const ;
325 double GetBooleanEngineRoundfactor()
const ;
327 const a2dDoMu& GetBooleanEngineSmoothAber()
const;
329 bool GetBooleanEngineLinkHoles()
const;
382 A2DCANVASDLLEXP
extern a2dDrawer2D* a2dGetDrawer2D();
414 a2dDocumentTemplateList::value_type temp = *iter;
415 if ( temp->IsVisible() && wxT(
"GDS-II" ) == temp->GetDescription() )
417 #if wxART2D_USE_GDSIO
419 #endif //wxART2D_USE_GDSIO
459 a2dDocumentTemplateList::value_type temp = *iter;
460 if ( temp->IsVisible() && wxT(
"KEY" ) == temp->GetDescription() )
462 #if wxART2D_USE_KEYIO
464 #endif //wxART2D_USE_KEYIO
484 DECLARE_DYNAMIC_CLASS( a2dCommand_ViewImage )
502 A2D_ARGUMENT_SETTER( wxFileName, file )
503 A2D_ARGUMENT_SETTER( wxBitmapType, btype )
521 if ( args.argSet.file )
522 m_args.file( args.argValue.file );
527 virtual a2dObject* Clone( CloneOptions options = clone_deep )
const
548 path.Add( wxT(
"." ) );
549 wxString foundfile = m_args.argValue.file.GetFullPath();
550 if ( !path.ExpandPath( foundfile ) )
555 if ( foundfile.IsEmpty() )
561 drawer->GetDrawingPart()->
GetDrawer2D()->
GetBuffer().SaveFile( foundfile, m_args.argValue.btype, ( wxPalette* )NULL );
594 A2D_ARGUMENT_SETTER( wxFileName, file )
611 if ( args.argSet.file )
612 m_args.file( args.argValue.file );
617 virtual a2dObject* Clone( CloneOptions options = clone_deep )
const
638 path.Add( wxT(
"." ) );
639 wxString foundfile = m_args.argValue.file.GetFullPath();
640 if ( !path.ExpandPath( foundfile ) )
645 if ( foundfile.IsEmpty() )
688 a2dDocumentTemplateList::value_type temp = *iter;
689 if ( temp->IsVisible() && wxT(
"KEY" ) == temp->GetDescription() )
691 #if wxART2D_USE_KEYIO
695 m_value = currentSetting;
696 #endif //wxART2D_USE_KEYIO
736 a2dDocumentTemplateList::value_type temp = *iter;
737 if ( temp->IsVisible() && wxT(
"GDS-II" ) == temp->GetDescription() )
739 #if wxART2D_USE_GDSIO
743 m_value = currentSetting;
744 #endif //wxART2D_USE_GDSIO
787 this->
argSet.which =
true;
791 A2D_ARGUMENT_SETTER(
bool, modal )
792 A2D_ARGUMENT_SETTER(
bool, onTop )
811 m_args.argSet.which =
true;
812 m_args.argValue.which = &which;
813 m_args.argSet.modal =
true;
814 m_args.argValue.modal = modal;
815 m_args.argValue.onTop = onTop;
823 virtual a2dObject* Clone( CloneOptions options = clone_deep )
const
836 return GetCanvasCmp()->ShowDlg( m_args.argValue.which, m_args.argValue.modal, m_args.argValue.onTop );
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
(In) Visible property that can be added to Docview Objects.
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
static const a2dCommandId Id
Export a document to a file.
bool Undo(void)
Override this to undo a command.
a2dCanvasCommandProcessor * GetDrawingCmdProcessor()
get commandprocessor of document
View on a a2dCanvasDocument.
virtual bool Do()=0
Override this to perform a command.
const a2dError a2dError_CouldNotEvaluatePath
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
a command processor specially designed to work with a a2dCanvasDocument
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
bool GetFromViewAsTop()
/see SetFromViewAsTop()
a2dCanvasObject is the base class for Canvas Objects.
Docview framework its controlling class.
void SetFromViewAsTop(bool fromViewAsTop)
if set, the current view its ShowObject will be saved top down.
virtual bool Undo()
Override this to undo a command.
store and convert number to number with unit and visa versa. e.g. 1.23e-6 => 1.23 * 1e-6 ...
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
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
bool Do(void)
Override this to perform a command.
Holds a view on a a2dDocument.
void SetFromViewAsTop(bool fromViewAsTop)
if set, the current view its ShowObject will be saved top down.
a2dCanvasDocument * GetCanvasDocument()
return current document in the command processor
Export view as ViewAsSvg.
bool Undo(void)
Override this to undo a command.
One object of this class may be created in an application, to manage all the templates and documents...
edit properties of a2dCanvasObject's
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Drawing context abstraction.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
virtual bool Do()
Override this to perform a command.
bool Do(void)
Override this to perform a command.
a2dDrawer2D * GetDrawer2D()
get the internal m_drawer2D that is used for rendering the document
bool Undo(void)
Override this to undo a command.
Each a2dCommand is given a command id at construction.
a2dCommand(bool canUndo=false, const a2dCommandId &commandId=sm_noCommandId, const a2dCommandId &commandTypeId=sm_noCommandTypeId, const wxString &menuString=wxEmptyString)
constructor
Dialog for displaying/editing layers and properties of layers.
a2dDocviewGlobal * a2dDocviewGlobals
a global pointer to get to global instance of important classes.
Output driver for KEY files.
bool Do(void)
Override this to perform a command.
virtual wxBitmap GetBuffer() const =0
Return the buffer as a bitmap.
Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data. ...
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
Output driver for GDSII files.
Definition of class for dialog to specify the layerorder.
virtual void ReportErrorF(const a2dError &error, const wxChar *Format,...)
concatenate to the the error report the given error.
Event sent to a2dCommandProcessor.
const a2dError a2dError_NotSpecified
a2dDrawing * GetDrawing() const
get drawing via top object
wxString GetAsString()
Get all search paths as one string.
#define const_forEachIn(listtype, list)
easy const iteration for a2dlist
bool GetFromViewAsTop()
/see SetFromViewAsTop()
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
all headers of the canvas module
a command wrapper specially designed to work with wxArt2D docview classes and rest.
command on selected objects
bool Do(void)
Override this to perform a command.
GdsII format input and output.
CloneOptions
options for cloning
bool Undo(void)
Override this to undo a command.
For exceptions thrown from commands.
a base command for the a2dCommandProcessor