00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef CHANDBAS_H
00015 #define CHANDBAS_H
00016
00017 #ifdef __GNUG__
00018 #pragma interface
00019 #endif
00020
00021 #include "misc.h"
00022 #include "wxwin.h"
00023 #include "_dl_itr.h"
00024 #include "units.h"
00025
00026
00027 #include <stdarg.h>
00028 #include <fstream.h>
00029 #include "alias.h"
00030
00031 #define MAXHISTORY 10
00032 enum OperationMethod{GROUP_LAYER,GROUP_SELECTED,SELECTED_ELEMENTS};
00033
00034
00035 class AliasList;
00036 class GdsII;
00037 class Structure;
00038 class ElementList;
00039 class Command;
00040 class group;
00041 class Setup;
00042 class wxColour;
00043 class bbox;
00044 class DDEHandler;
00045 class Handler;
00046
00047
00048
00049 typedef bool (CommandHandler::*lfp) ();
00050
00052
00063 class CommandHandler
00064 {
00065 public:
00066
00067 CommandHandler();
00069 ~CommandHandler();
00070
00071
00073 bool Replace_Setup(Setup* new_setup);
00074
00076
00077
00078
00079 int ExecuteCommand();
00080
00082 bool DoCommand(char* Format,...);
00083
00085 bool GetStepMode() {return m_stepmode;};
00087 bool StepMode();
00088
00090 bool GetContinue() {return m_continue;};
00092 bool SetContinue(bool a){m_continue=a;return true;};
00094 bool SetContinueFlag();
00095
00097 double Get_ScaleFactor();
00099 int Get_ZoomHistoryEmpty();
00101 bool ZoomOut();
00103 bool ZoomOut2();
00105 bool ZoomBack();
00107 bool Draw();
00108
00110 bool GetSpline(){return m_spline;};
00111
00113 bool SetSpline();
00114
00115
00117 bool Get_Record();
00119 group* Get_A();
00121 group* Get_B();
00123 int Get_Destination();
00125 bool Get_Destination_Add(){return m_destination_add;};
00127 GdsII* Get_GDSII();
00129 void Set_GDSII(GdsII* a_gdsii);
00130
00131
00132 bool GetViewer(){return m_viewer;}
00133
00135 Structure* Get_TopStructure();
00136
00138 wxString Get_FileName();
00140 void Set_FileName(const wxString& filename);
00141
00143 bool SetWidth();
00145 wxUnit& GetWidth();
00146
00148 bool SetPathtype();
00149
00151 int GetPathtype();
00152
00154 bool GetViewCoord();
00156 bool SetViewCoord(bool value);
00157
00159 bool GetViewOutline();
00161 bool SetViewOutline(bool value);
00162
00164 bool GetSelectedOnly();
00165
00167 bool GetVisibleOnly();
00168
00170 bool GetSaveSetUpOnExit();
00171
00173 bool GetGridVisible();
00174
00176 bool GetEnv(const wxString& envname,wxString& envstring);
00178 bool SetEnv();
00180 bool GetAlias(const wxString& aliasname,wxString& aliasstring);
00182 bool SetAlias();
00183
00185 int GetNrAlias();
00187 bool GetAliasNr(int i,wxString& aliasname,wxString& aliasstring);
00188
00190 bool GetMirrorX();
00192 bool GetMirrorY();
00194 wxUnit& GetMoveHor();
00196 wxUnit& GetMoveVer();
00198 double GetScale();
00200 double GetRotate();
00202 bool GetDirection();
00203
00205 long GetGridColour();
00207 long GetBackColour();
00209 wxUnit& GetGridSpace();
00210
00212 int GetGridPlacement();
00213
00215 double GetSelectmarge(){return _selectmarge;};
00217 wxUnit& GetSnapfactor();
00219 wxUnit& GetCorrectionfactor();
00221 wxUnit& GetCorrectionaber();
00223 double GetRoundfactor();
00225 wxString& GetRoundtype();
00226
00228 wxUnit& GetPoly2ArcRmin();
00230 wxUnit& GetPoly2ArcRmax();
00232 wxUnit& GetPoly2ArcAber();
00234 wxUnit& GetArc2PolyAber();
00235
00237 wxUnit& GetSmoothAber();
00239 wxUnit& GetDisplayaber();
00241 int GetStrucThres();
00243 int GetPrimThres();
00245 bool GetDrawSmallPrim();
00247 wxUnit& GetMaxlinemerge();
00248
00250 double GetDefaultAcc(){return _default_acc;};
00252 wxUnit GetDefaultUnit(){return _default_unit;};
00253
00255 void AddSlash(wxString& _filename);
00257 void StripSlash(wxString& _filename);
00258
00260 bool SetFileType(const wxString& _filetype);
00261
00263 wxString GetFileType();
00264
00266 bool SetFileEnv(const wxString& _filetoload);
00268 bool SetProcEnv(const wxString& _processfile);
00270 void SetupEnv();
00271
00273 bool SetStartPoint();
00275 bool SetRelPoint();
00276
00278 bool KeyString();
00279
00281 bool Select();
00283 bool ReplaceStruct();
00284
00286 ElementList* GetTopElementList();
00288 bool ToHistory(char* Format,...);
00290 bool ToHistory(Command* a_command);
00292 int GetCurrentLayer();
00293
00295 bool AddFileToHistory(const wxString& file,const wxString& type);
00297 bool CommandHandler::SaveHistory();
00298
00301 DL_List<Alias*>* _file_history;
00302
00303 private:
00304
00306 int maxpointer;
00307
00309 void SetOperationFlags(bool explode);
00310
00312 bool Select(double,double,double,double,int);
00313
00315
00317 bool Operation_transform();
00319 bool Operation_undotrans();
00321 bool Operation_move_a();
00323 bool Operation_copy_a();
00325 bool Operation_delete_a();
00327 bool Operation_addproperty_a();
00329 bool Operation_transform_a();
00331 bool Operation_undotrans_a();
00333 bool Operation_calcarea_a();
00335 bool Operation_makering();
00337 bool Operation_correction();
00339 bool Operation_toarcs();
00341 bool Operation_tolines();
00343 bool Operation_smoothen();
00345 bool Operation_intersect();
00347 bool Operation_merge();
00349 bool Operation_a_subtract_b();
00351 bool Operation_b_subtract_a();
00353 bool Operation_exor();
00354
00355
00356 bool SetWindingRule();
00357
00359 bool Tool();
00361 bool EndCommand();
00363 bool UndoCommand();
00365 bool Delete();
00367 bool MakeStructure();
00369 bool DeSelect();
00371 bool Begin();
00373 bool End();
00375 bool SetCursor();
00377 bool AddPoint();
00379 bool Move();
00380
00382 bool NewFile();
00384 bool LoadFile();
00386 bool MergeFile();
00387
00389 bool ScrollScreen();
00390
00392 bool IsZoomed();
00394 void EmptyZoomHistory();
00396 bool Zoom();
00398 bool PrintFile();
00400 double Zoom(double,double,double,double,int);
00401
00403 bool ClearScreen();
00404
00406 bool ShowCoords();
00407
00409 bool AddMenuFile();
00411 bool CloseFile();
00413 bool Flatten();
00415 bool ViewStructure();
00417 int View_Structure(Structure*);
00419 bool DrawOutline();
00421 bool SetSelectedOnly();
00423 bool SetVisibleOnly();
00424
00426 bool SetSaveSetUpOnExit();
00427
00429 bool ShowGrid();
00431 bool ResetTrans();
00433 bool ShowBrowser();
00435 bool Exit();
00436
00438 bool SetLogFile();
00439
00440
00441 bool SetViewer();
00442
00444 bool AskFile();
00446 bool Ask();
00447
00449 bool Load_Process_File();
00451 bool LoadSetup();
00453 bool SaveSetup();
00455 bool SaveFile();
00456
00458 bool GetFileType(const wxString& filename, GdsII* gdsii,const wxString& type);
00459
00461 bool SaveFileGDS(const wxString& filename);
00463 bool SaveFilePNG(const wxString& filename);
00465 bool SaveFileBMP(const wxString& filename);
00467 bool SaveFileKEY(const wxString& filename);
00469 bool SaveFileSVG(const wxString& filename);
00471 bool SaveFileFLASH(const wxString& filename);
00473 bool SaveFileEMASK(const wxString& filename);
00475 bool SaveFileExelon(const wxString& filename);
00477 bool SaveFileGerber(const wxString& filename);
00479 bool SaveFileCnc(const wxString& filename);
00480
00482 bool Define_A();
00484 bool Define_B();
00486 bool DefineDestination();
00487
00489 bool AddProperty();
00490
00492 bool Record();
00494 bool Pause();
00495
00497 bool SetMirrorX();
00499 bool SetMirrorY();
00501 bool SetMoveHor();
00503 bool SetMoveVer();
00505 bool SetScale();
00507 bool SetRotate();
00509 bool SetDirection();
00510
00512 bool SetGridSpace();
00514 bool SetGridColour();
00516 bool SetBackColour();
00518 bool SetGridPlacement();
00520 bool SetSelectmarge();
00522 bool SetSnapfactor();
00524 bool SetCorrectionfactor();
00526 bool SetCorrectionaber();
00528 bool SetRoundfactor();
00530 bool SetRoundtype();
00532 bool SetPoly2ArcRmin();
00534 bool SetPoly2ArcRmax();
00536 bool SetPoly2ArcAber();
00538 bool SetArc2PolyAber();
00540 bool SetSmoothAber();
00542 bool SetDisplayaber();
00544 bool SetStrucThres();
00546 bool SetPrimThres();
00548 bool SetMaxlinemerge();
00550 bool SetDefaultAcc();
00552 bool SetDefaultUnit();
00553
00555 void ParameterError(const wxString& );
00557 bool SetCurrentLayer();
00559 bool SetCurrentLayerByName();
00561 bool SetLayerName();
00563 bool SetGdsInMap();
00565 bool SetGdsOutMap();
00567 bool SetLayerVisible();
00569 bool SetLayerSelectable();
00571 bool SetLayerBorderColor();
00573 bool SetLayerFillColor();
00575 bool SetLayerBrush();
00577 bool SetLayerOrder();
00579 bool SetLayerRead();
00580
00582 bool ShowTextDlg();
00584 bool ShowPathtypeDlg();
00586
00587 bool ShowCursorDlg();
00589 bool ShowFactors();
00591 bool ShowOrder();
00593 bool ShowGroups();
00595 bool ShowAlias();
00597 bool ShowEnv();
00599 bool ShowLayers();
00601 bool ShowFilename();
00603 bool ShowKeyBNF();
00605 bool ShowProcessBNF();
00607 bool ShowTopStructure();
00609 bool ShowExecDlg();
00611 bool ShowInsertLayerDlg();
00613 bool ShowDistDlg();
00615 bool ShowIdentDlg();
00617 bool ShowHelp();
00618
00620 GdsII* _gdsii;
00622 GdsII* _gdsii_merge;
00624 Setup* _setup;
00625
00627 bool _view_coord;
00629 bool _view_outline;
00631 bool _view_debug;
00633 bool _selected_only;
00635 bool _visible_only;
00637 bool _savesetuponexit;
00639 bool _show_grid;
00640
00642 bool _mirror_x;
00644 bool _mirror_y;
00646 wxUnit _move_hor;
00648 wxUnit _move_ver;
00650 wxUnit _scaling;
00652 double _rotate;
00654 bool _direction;
00655
00657 wxUnit m_grid_space;
00659 char _str_grid_colour[30];
00661 char _str_back_colour[30];
00662
00664 double _selectmarge;
00666 wxUnit _snapfactor;
00668 wxUnit _correctionfactor;
00670 wxUnit _correctionaber;
00672 double _roundfactor;
00674 wxUnit _poly2arcrmin;
00676 wxUnit _poly2arcrmax;
00678 wxUnit _poly2arcaber;
00680 wxUnit _arc2polyaber;
00682 wxUnit _smoothaber;
00684 wxUnit _displayaber;
00686 wxUnit _maxlinemerge;
00687
00688 wxString _roundtype;
00689
00691 int _structhres;
00693 int _primthres;
00695 bool _drawsmallprim;
00696
00698 wxUnit _default_width;
00700 wxUnit _default_height;
00702 wxUnit _default_unit;
00703
00705 double _default_acc;
00706
00708 bool m_stepmode;
00710 bool m_continue;
00711
00712
00714 ofstream* _processing_file;
00715
00717 int _CurrentLayer;
00718
00720 group* _group_A;
00722 group* _group_B;
00723
00725 int _destination;
00726
00728 bool m_destination_add;
00729
00730
00731 bool m_viewer;
00732
00734 wxString _filename;
00735
00737 wxString _file_type;
00738
00740 wxString _name_backup;
00741
00743 const wxString* _keyword;
00744
00745 long _grid_colour;
00746 long _back_colour;
00747 int _grid_placement;
00748 double _start_point_x;
00749 double _start_point_y;
00750 double _rel_point_x;
00751 double _rel_point_y;
00752 wxUnit _width;
00753 int _pathtype;
00754
00756 bool m_spline;
00757
00759 OperationMethod _operationmethod;
00760
00762 DL_Iter<const wxString*>* _I;
00763
00765 DL_List<Command*>* _commandhistory;
00766
00767 protected:
00768 wxColour ltowxc(long);
00769 DDEHandler* _ddehandler;
00770
00772 DL_List<void*>* _zoom_history;
00774 double _scale;
00775
00777 Handler* _handler[200];
00778 };
00779
00781 class Handler
00782 {
00783 public:
00785 wxString keyword;
00787 lfp fpointer;
00788
00789
00790 Handler(const wxString& keyword,lfp);
00791 ~Handler();
00792 };
00793
00794 #endif
00795
chandbas.h Source File -- Thu Nov 28 21:24:56 2002 -- 28 Nov 2002 -- 1.2.18 -- -- . --