diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 3bc63971f7..d7c30627d7 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -126,9 +126,9 @@ set(PCBNEW_SRCS hotkeys_board_editor.cpp hotkeys_module_editor.cpp initpcb.cpp -# io_mgr.cpp + io_mgr.cpp ioascii.cpp -# kicad_plugin.cpp + kicad_plugin.cpp layer_widget.cpp librairi.cpp loadcmp.cpp diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index a9828eb68a..25578613c2 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -49,6 +49,7 @@ #include "class_board.h" #include "build_version.h" // BOARD_FILE_VERSION + static const wxString pcbBackupFileExtension( wxT( "000" ) ); @@ -200,6 +201,7 @@ the changes?" ) ) ) GetScreen()->SetFileName( fileName.GetFullPath() ); #if 1 + // Start read PCB file FILE* source = wxFopen( GetScreen()->GetFileName(), wxT( "rt" ) ); diff --git a/pcbnew/io_mgr.cpp b/pcbnew/io_mgr.cpp index fd5b90c179..2690807ba9 100644 --- a/pcbnew/io_mgr.cpp +++ b/pcbnew/io_mgr.cpp @@ -39,7 +39,7 @@ // plugins coexisting. -static KICAD_PLUGIN kicad_plugin; // a secret +// static KICAD_PLUGIN kicad_plugin; // a secret //static EAGLE_PLUGIN eagle_plugin; PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType ) @@ -49,9 +49,14 @@ PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType ) switch( aFileType ) { - case KICAD: return &kicad_plugin; + case KICAD: + return new KICAD_PLUGIN(); -// case EAGLE: return &eagle_plugin; + +/* + case EAGLE: + return &eagle_plugin; +*/ } return NULL; @@ -63,6 +68,8 @@ void IO_MGR::PluginRelease( PLUGIN* aPlugin ) // This function is a place holder for a future point in time where // the plugin is a DLL/DSO. It could do reference counting, and then // unload the DLL/DSO when count goes to zero. + + delete aPlugin; } diff --git a/pcbnew/io_mgr.h b/pcbnew/io_mgr.h index 63f197dc56..59e4647f4d 100644 --- a/pcbnew/io_mgr.h +++ b/pcbnew/io_mgr.h @@ -225,6 +225,14 @@ public: //----------------------------------------------------- + /* The compiler writes the "zero argument" constructor for a PLUGIN + automatically if you do not provide one. If you decide you need to + provide a zero argument constructor of your own design, that is allowed, + but there can only be one constructor and it must be a "zero argument" + version. Normally you can do your initialization in a function like + KICAD_PLUGIN::init( PROPERTIES* aProperties ) instead. + */ + virtual ~PLUGIN() {} /** diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 14ac053716..be17ec50c8 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -277,7 +277,7 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader ) data = strtok( NULL, delims ); int y2 = atoi( data ); - EDA_RECT bbbox( wxPoint( x1, x2 ), wxSize( x2-x1, y2-y1 ) ); + EDA_RECT bbbox( wxPoint( x1, y1 ), wxSize( x2-x1, y2-y1 ) ); GetBoard()->SetBoundingBox( bbbox ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 7b1779768a..feb1707beb 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -406,7 +406,7 @@ void KICAD_PLUGIN::loadGENERAL() BIU x2 = biuParse( data, &data ); BIU y2 = biuParse( data ); - EDA_RECT bbbox( wxPoint( x1, x2 ), wxSize( x2-x1, y2-y1 ) ); + EDA_RECT bbbox( wxPoint( x1, y1 ), wxSize( x2-x1, y2-y1 ) ); m_board->SetBoundingBox( bbbox ); } @@ -1339,8 +1339,8 @@ void KICAD_PLUGIN::loadTEXTE_MODULE( TEXTE_MODULE* aText ) int type = intParse( line+1, &data ); BIU pos0_x = biuParse( data, &data ); BIU pos0_y = biuParse( data, &data ); + BIU size0_y = biuParse( data, &data ); // why y? BIU size0_x = biuParse( data, &data ); - BIU size0_y = biuParse( data, &data ); double orient = degParse( data, &data ); BIU thickn = biuParse( data, &data );