Commit a42490e0 authored by Dick Hollenbeck's avatar Dick Hollenbeck

work on footprint plugin API

parent add53213
...@@ -116,15 +116,6 @@ void BASE_SCREEN::SetScalingFactor(double aScale ) ...@@ -116,15 +116,6 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
} }
void BASE_SCREEN::SetZoomList( const wxArrayDouble& zoomlist )
{
if( !m_ZoomList.IsEmpty() )
m_ZoomList.Empty();
m_ZoomList = zoomlist;
}
bool BASE_SCREEN::SetFirstZoom() bool BASE_SCREEN::SetFirstZoom()
{ {
if( m_ZoomList.IsEmpty() ) if( m_ZoomList.IsEmpty() )
......
...@@ -369,7 +369,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) ...@@ -369,7 +369,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
else else
{ {
id--; id--;
int selectedZoom = GetScreen()->m_ZoomList[id]; double selectedZoom = GetScreen()->m_ZoomList[id];
if( GetScreen()->GetZoom() == selectedZoom ) if( GetScreen()->GetZoom() == selectedZoom )
return; return;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <richio.h> #include <richio.h>
#include <filter_reader.h> #include <filter_reader.h>
#include <footprint_info.h> #include <footprint_info.h>
#include <io_mgr.h>
#include <class_pad.h> #include <class_pad.h>
#include <class_module.h> #include <class_module.h>
...@@ -39,9 +40,8 @@ ...@@ -39,9 +40,8 @@
* ...... other data (pads, outlines ..) * ...... other data (pads, outlines ..)
* $Endmodule * $Endmodule
*/ */
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames ) bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
{ {
FILE* file;
wxFileName filename; wxFileName filename;
wxString libname; wxString libname;
...@@ -50,7 +50,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames ) ...@@ -50,7 +50,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
m_filesInvalid.Empty(); m_filesInvalid.Empty();
m_List.clear(); m_List.clear();
/* Parse Libraries Listed */ PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
// Parse Libraries Listed
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ ) for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
{ {
filename = aFootprintsLibNames[ii]; filename = aFootprintsLibNames[ii];
...@@ -64,82 +66,28 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames ) ...@@ -64,82 +66,28 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
continue; continue;
} }
/* Open library file */ try
file = wxFopen( libname, wxT( "rt" ) );
if( file == NULL )
{
m_filesInvalid << libname << _(" (file cannot be opened)") << wxT("\n");
continue;
}
FILE_LINE_READER fileReader( file, libname );
FILTER_READER reader( fileReader );
/* Read header. */
reader.ReadLine();
char * line = reader.Line();
StrPurge( line );
if( strnicmp( line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 )
{ {
wxString msg; wxArrayString fpnames = pi->FootprintEnumerate( libname );
msg.Printf( _( "<%s> is not a valid KiCad PCB footprint library." ),
GetChars( libname ) );
m_filesInvalid << msg << wxT("\n");
continue;
}
// Read library for( unsigned i=0; i<fpnames.GetCount(); ++i )
bool end = false;
while( !end && reader.ReadLine() )
{
line = reader.Line();
StrPurge( line );
if( strnicmp( line, "$EndLIBRARY", 11 ) == 0 )
{
end = true;
break;
}
if( strnicmp( line, "$MODULE", 7 ) == 0 )
{ {
std::auto_ptr<MODULE> m( pi->FootprintLoad( libname, fpnames[i] ) );
line += 7; FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
FOOTPRINT_INFO* ItemLib = new FOOTPRINT_INFO();
ItemLib->m_Module = FROM_UTF8( StrPurge( line ) );
ItemLib->m_LibName = libname;
AddItem( ItemLib );
while( reader.ReadLine() )
{
line = reader.Line();
StrPurge( line );
if( strnicmp( line, "$EndMODULE", 10 ) == 0 )
break;
if( strnicmp( line, "$PAD", 4 ) == 0 ) fpinfo->m_Module = fpnames[i];
ItemLib->m_padCount++; fpinfo->m_LibName = libname;
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
int id = ((line[0] & 0xFF) << 8) + (line[1] & 0xFF); AddItem( fpinfo );
switch( id )
{
/* KeyWords */
case (('K'<<8) + 'w'):
ItemLib->m_KeyWord = FROM_UTF8( StrPurge( line + 3 ) );
break;
/* Doc */
case (('C'<<8) + 'd'):
ItemLib->m_Doc = FROM_UTF8( StrPurge( line + 3 ) );
break;
}
}
} }
} }
catch( IO_ERROR ioe )
if( !end )
{ {
m_filesInvalid << libname << _(" (Unexpected end of file)") << wxT("\n"); m_filesInvalid << ioe.errorText << wxT("\n");
} }
} }
...@@ -147,3 +95,4 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames ) ...@@ -147,3 +95,4 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
return true; return true;
} }
...@@ -39,7 +39,6 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY() ...@@ -39,7 +39,6 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
*/ */
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg() void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
{ {
SetFocus();
m_AliasLocation = -1; m_AliasLocation = -1;
LIB_COMPONENT* component = m_Parent->GetComponent(); LIB_COMPONENT* component = m_Parent->GetComponent();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -50,6 +50,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -50,6 +50,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxALL, 5 ); m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxALL, 5 );
bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 ); bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 );
m_staticline3 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline3 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
...@@ -70,6 +71,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -70,6 +71,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 ); m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 );
bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 ); bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer17; wxBoxSizer* bSizer17;
...@@ -84,8 +86,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -84,8 +86,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 ); bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 );
bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 ); bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
...@@ -101,6 +105,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -101,6 +105,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 ); bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 );
m_PanelBasic->SetSizer( bSizerBasicPanel ); m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout(); m_PanelBasic->Layout();
bSizerBasicPanel->Fit( m_PanelBasic ); bSizerBasicPanel->Fit( m_PanelBasic );
...@@ -145,8 +150,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -145,8 +150,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_buttonBrowseDocFiles = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse DocFiles"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonBrowseDocFiles = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse DocFiles"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 ); bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 );
m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_PanelDoc->SetSizer( m_PanelDocBoxSizer ); m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout(); m_PanelDoc->Layout();
m_PanelDocBoxSizer->Fit( m_PanelDoc ); m_PanelDocBoxSizer->Fit( m_PanelDoc );
...@@ -167,6 +174,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -167,6 +174,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PartAliasListCtrl = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_PartAliasListCtrl = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 ); bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizerPanelAlias; wxBoxSizer* bRightBoxSizerPanelAlias;
...@@ -181,8 +189,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -181,8 +189,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 ); bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 );
bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelAlias->SetSizer( bSizerMainPanelAlias ); m_PanelAlias->SetSizer( bSizerMainPanelAlias );
m_PanelAlias->Layout(); m_PanelAlias->Layout();
bSizerMainPanelAlias->Fit( m_PanelAlias ); bSizerMainPanelAlias->Fit( m_PanelAlias );
...@@ -203,6 +213,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -203,6 +213,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_FootprintFilterListBox = new wxListBox( m_PanelFootprintFilter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_FootprintFilterListBox = new wxListBox( m_PanelFootprintFilter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 ); bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bFpFilterRightBoxSizer; wxBoxSizer* bFpFilterRightBoxSizer;
...@@ -217,8 +228,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -217,8 +228,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 ); bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer ); m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer );
m_PanelFootprintFilter->Layout(); m_PanelFootprintFilter->Layout();
bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter ); bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter );
...@@ -226,6 +239,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -226,6 +239,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 ); bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 ); bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_stdSizerButton = new wxStdDialogButtonSizer(); m_stdSizerButton = new wxStdDialogButtonSizer();
...@@ -234,10 +248,13 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -234,10 +248,13 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_stdSizerButtonCancel = new wxButton( this, wxID_CANCEL ); m_stdSizerButtonCancel = new wxButton( this, wxID_CANCEL );
m_stdSizerButton->AddButton( m_stdSizerButtonCancel ); m_stdSizerButton->AddButton( m_stdSizerButtonCancel );
m_stdSizerButton->Realize(); m_stdSizerButton->Realize();
bMainSizer->Add( m_stdSizerButton, 0, wxEXPAND|wxALL, 5 ); bMainSizer->Add( m_stdSizerButton, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
// Connect Events // Connect Events
m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocToAlias ), NULL, this ); m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocToAlias ), NULL, this );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -47,7 +48,7 @@ ...@@ -47,7 +48,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE /// Class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public wxDialog class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
{ {
private: private:
...@@ -106,7 +107,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public wxDialog ...@@ -106,7 +107,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public wxDialog
public: public:
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id = ID_LIBEDIT_NOTEBOOK, const wxString& title = _("Lib Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 465,384 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id = ID_LIBEDIT_NOTEBOOK, const wxString& title = _("Lib Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE(); ~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE();
}; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -46,6 +46,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -46,6 +46,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer2->Add( 30, 0, 0, wxEXPAND, 3 ); bSizer2->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer2, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer2, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer3; wxBoxSizer* bSizer3;
...@@ -69,6 +70,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -69,6 +70,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer3->Add( 30, 0, 0, wxEXPAND, 5 ); bSizer3->Add( 30, 0, 0, wxEXPAND, 5 );
bSizer5->Add( bSizer3, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer3, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer4; wxBoxSizer* bSizer4;
...@@ -92,6 +94,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -92,6 +94,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer4->Add( 30, 0, 0, wxEXPAND, 3 ); bSizer4->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer4, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer4, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer7; wxBoxSizer* bSizer7;
...@@ -101,11 +104,11 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -101,11 +104,11 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer7->Add( 12, 0, 0, wxEXPAND, 3 ); bSizer7->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkHasConversion = new wxCheckBox( this, wxID_ANY, _("Create component with &alternate body style (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkHasConversion = new wxCheckBox( this, wxID_ANY, _("Create component with &alternate body style (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkHasConversion->SetToolTip( _("Check this option for components that have a De Morgan representation.\nThis is usual for gates.") ); m_checkHasConversion->SetToolTip( _("Check this option for components that have a De Morgan representation.\nThis is usual for gates.") );
bSizer7->Add( m_checkHasConversion, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer7->Add( m_checkHasConversion, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer7, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer7, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer8; wxBoxSizer* bSizer8;
...@@ -115,11 +118,11 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -115,11 +118,11 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer8->Add( 12, 0, 0, wxEXPAND, 3 ); bSizer8->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create component as power &symbol"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create component as power &symbol"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkIsPowerSymbol->SetToolTip( _("Check this option for power symbols.\nPower symbols have specific properties for Eeschema:\n- Value cannot be edited (to avoid mistakes) because this is the pin name that is important for a power symbol\n- Reference is updated automatically when a netlist is created (no need to run Annotate)") ); m_checkIsPowerSymbol->SetToolTip( _("Check this option for power symbols.\nPower symbols have specific properties for Eeschema:\n- Value cannot be edited (to avoid mistakes) because this is the pin name that is important for a power symbol\n- Reference is updated automatically when a netlist is created (no need to run Annotate)") );
bSizer8->Add( m_checkIsPowerSymbol, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer8->Add( m_checkIsPowerSymbol, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer8, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer8, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer9; wxBoxSizer* bSizer9;
...@@ -129,11 +132,11 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -129,11 +132,11 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer9->Add( 12, 0, 0, wxEXPAND, 3 ); bSizer9->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Parts in package locked (cannot be swapped)"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Parts in package locked (cannot be swapped)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkLockItems->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") ); m_checkLockItems->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") );
bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer9, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer9, 0, wxALL|wxEXPAND, 0 );
...@@ -167,6 +170,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -167,6 +170,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_staticText5->Wrap( -1 ); m_staticText5->Wrap( -1 );
bSizer6->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL, 3 ); bSizer6->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL, 3 );
bSizer5->Add( bSizer6, 1, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer6, 1, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer10; wxBoxSizer* bSizer10;
...@@ -177,9 +181,9 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -177,9 +181,9 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_checkShowPinNumber = new wxCheckBox( this, wxID_ANY, _("Show pin n&umber text"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowPinNumber = new wxCheckBox( this, wxID_ANY, _("Show pin n&umber text"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNumber->SetValue(true); m_checkShowPinNumber->SetValue(true);
bSizer10->Add( m_checkShowPinNumber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer10->Add( m_checkShowPinNumber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer10, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer10, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer12; wxBoxSizer* bSizer12;
...@@ -190,9 +194,9 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -190,9 +194,9 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_checkShowPinName = new wxCheckBox( this, wxID_ANY, _("Show pin name te&xt"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowPinName = new wxCheckBox( this, wxID_ANY, _("Show pin name te&xt"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinName->SetValue(true); m_checkShowPinName->SetValue(true);
bSizer12->Add( m_checkShowPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer12->Add( m_checkShowPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer12, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( bSizer12, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer121; wxBoxSizer* bSizer121;
...@@ -203,9 +207,9 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -203,9 +207,9 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_checkShowPinNameInside = new wxCheckBox( this, wxID_ANY, _("Pin name &inside"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowPinNameInside = new wxCheckBox( this, wxID_ANY, _("Pin name &inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNameInside->SetValue(true); m_checkShowPinNameInside->SetValue(true);
bSizer121->Add( m_checkShowPinNameInside, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer121->Add( m_checkShowPinNameInside, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer121, 1, wxEXPAND, 5 ); bSizer5->Add( bSizer121, 1, wxEXPAND, 5 );
...@@ -217,10 +221,13 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -217,10 +221,13 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize(); m_sdbSizer->Realize();
bSizer5->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 0 ); bSizer5->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 0 );
mainSizer->Add( bSizer5, 1, wxALL|wxEXPAND, 12 ); mainSizer->Add( bSizer5, 1, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer ); this->SetSizer( mainSizer );
this->Layout(); this->Layout();
mainSizer->Fit( this ); mainSizer->Fit( this );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_lib_new_component_base__ #ifndef __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#define __dialog_lib_new_component_base__ #define __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -28,55 +30,37 @@ ...@@ -28,55 +30,37 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LIB_NEW_COMPONENT_BASE /// Class DIALOG_LIB_NEW_COMPONENT_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_NEW_COMPONENT_BASE : public wxDialog class DIALOG_LIB_NEW_COMPONENT_BASE : public DIALOG_SHIM
{ {
private: private:
protected: protected:
wxStaticText* m_staticText6; wxStaticText* m_staticText6;
wxStaticText* m_staticText2; wxStaticText* m_staticText2;
wxTextCtrl* m_textName; wxTextCtrl* m_textName;
wxStaticText* m_staticText3; wxStaticText* m_staticText3;
wxTextCtrl* m_textReference; wxTextCtrl* m_textReference;
wxStaticText* m_staticText4; wxStaticText* m_staticText4;
wxSpinCtrl* m_spinPartCount; wxSpinCtrl* m_spinPartCount;
wxCheckBox* m_checkHasConversion; wxCheckBox* m_checkHasConversion;
wxCheckBox* m_checkIsPowerSymbol; wxCheckBox* m_checkIsPowerSymbol;
wxCheckBox* m_checkLockItems; wxCheckBox* m_checkLockItems;
wxStaticText* m_staticText7; wxStaticText* m_staticText7;
wxStaticText* m_staticText41; wxStaticText* m_staticText41;
wxSpinCtrl* m_spinPinTextPosition; wxSpinCtrl* m_spinPinTextPosition;
wxStaticText* m_staticText5; wxStaticText* m_staticText5;
wxCheckBox* m_checkShowPinNumber; wxCheckBox* m_checkShowPinNumber;
wxCheckBox* m_checkShowPinName; wxCheckBox* m_checkShowPinName;
wxCheckBox* m_checkShowPinNameInside; wxCheckBox* m_checkShowPinNameInside;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
public: public:
DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_NEW_COMPONENT_BASE(); ~DIALOG_LIB_NEW_COMPONENT_BASE();
}; };
#endif //__dialog_lib_new_component_base__ #endif //__DIALOG_LIB_NEW_COMPONENT_BASE_H__
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#include <dialogs/dialog_edit_component_in_lib.h> #include <dialogs/dialog_edit_component_in_lib.h>
#include <dialogs/dialog_libedit_dimensions.h> #include <dialogs/dialog_libedit_dimensions.h>
#include <dialog_helpers.h> //#include <dialog_helpers.h>
#include <menus_helpers.h> #include <menus_helpers.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
......
...@@ -296,13 +296,6 @@ public: ...@@ -296,13 +296,6 @@ public:
*/ */
bool SetZoom( double coeff ); bool SetZoom( double coeff );
/**
* Function SetZoomList
* sets the list of zoom factors.
* @param aZoomList An array of zoom factors in ascending order, zero terminated
*/
void SetZoomList( const wxArrayDouble& aZoomList );
bool SetNextZoom(); bool SetNextZoom();
bool SetPreviousZoom(); bool SetPreviousZoom();
bool SetFirstZoom(); bool SetFirstZoom();
......
...@@ -182,72 +182,4 @@ public: ...@@ -182,72 +182,4 @@ public:
} }
}; };
/**
* Template DIALOG_SHIM
* is a way to have a common way of handling KiCad dialog windows:
* <ul>
* <li>class specific: static s_LastPos and static s_LastSize for retentative
* dialog window positioning, per class.
* <li> invocation of SetFocus() to allow ESC key to work on Linux.
* <li> future others...
* </ul>
* by wedging in a class (a SHIM) between the wxFormbuilder coded base class and
* our derived dialog classes. Use it via the macro named DIALOG_EXTEND_WITH_SHIM
* and be sure to code your constructor to invoke *_SHIM() base class constructor,
* not the one from wxFormbuilder.
* @author Dick Hollenbeck
*/
template <class T>
class DIALOG_SHIM : public T
{
public:
DIALOG_SHIM( wxFrame* aParent ) :
T( aParent )
{
wxDialog::SetFocus();
}
// overload wxDialog::Show
bool Show( bool show )
{
bool ret;
if( show )
{
ret = wxDialog::Show( show );
if( s_LastPos.x != -1 )
wxDialog::SetSize( s_LastPos.x, s_LastPos.y, s_LastSize.x, s_LastSize.y, 0 );
}
else
{
// Save the dialog's position before hiding
s_LastPos = wxDialog::GetPosition();
s_LastSize = wxDialog::GetSize();
ret = wxDialog::Show( show );
}
return ret;
}
private:
static wxPoint s_LastPos;
static wxSize s_LastSize;
};
template<class T>
wxPoint DIALOG_SHIM<T>::s_LastPos( -1, -1 );
template<class T>
wxSize DIALOG_SHIM<T>::s_LastSize( 0, 0 );
/**
* Macro DIALOG_EXTEND_WITH_SHIM
* instantiates the template DIALOG_SHIM<> and thereby declares a shim class.
* @author Dick Hollenbeck
*/
#define DIALOG_EXTEND_WITH_SHIM( DERRIVED, BASE ) \
typedef DIALOG_SHIM<BASE> BASE##_SHIM; \
class DERRIVED : public BASE##_SHIM
#endif // DIALOG_HELPERS_H_ #endif // DIALOG_HELPERS_H_
...@@ -32,6 +32,7 @@ public: ...@@ -32,6 +32,7 @@ public:
} }
}; };
class FOOTPRINT_LIST class FOOTPRINT_LIST
{ {
public: public:
......
...@@ -3,13 +3,8 @@ ...@@ -3,13 +3,8 @@
* @brief Classes and definitions used in Pcbnew. * @brief Classes and definitions used in Pcbnew.
*/ */
#ifndef PCBSTRUCT_H #ifndef PCBSTRUCT_H_
#define PCBSTRUCT_H #define PCBSTRUCT_H_
// Definitions relatives aux libraries
#define FOOTPRINT_LIBRARY_HEADER "PCBNEW-LibModule-V1"
#define FOOTPRINT_LIBRARY_HEADER_CNT 18
/// Values for m_DisplayViaMode member: /// Values for m_DisplayViaMode member:
...@@ -83,4 +78,4 @@ public: ...@@ -83,4 +78,4 @@ public:
DISPLAY_OPTIONS(); DISPLAY_OPTIONS();
}; };
#endif // PCBSTRUCT_H #endif // PCBSTRUCT_H_
...@@ -96,7 +96,7 @@ set(PCBNEW_SRCS ...@@ -96,7 +96,7 @@ set(PCBNEW_SRCS
block.cpp block.cpp
block_module_editor.cpp block_module_editor.cpp
build_BOM_from_board.cpp build_BOM_from_board.cpp
class_footprint_library.cpp # class_footprint_library.cpp
class_pcb_layer_widget.cpp class_pcb_layer_widget.cpp
clean.cpp clean.cpp
connect.cpp connect.cpp
......
...@@ -11,15 +11,16 @@ class FOOTPRINT_LIBRARY ...@@ -11,15 +11,16 @@ class FOOTPRINT_LIBRARY
public: public:
wxArrayString m_List; // list of footprints, used to read/write INDEX section wxArrayString m_List; // list of footprints, used to read/write INDEX section
wxString m_LibraryName; // the full library name wxString m_LibraryName; // the full library name
int m_LineNum; // the line count
private: private:
FILTER_READER * m_reader; // FILTER_READER to read file. If NULL, use m_file FILTER_READER * m_reader; // FILTER_READER to read file. If NULL, use m_file
FILE * m_file; // footprint file to read/write. FILE * m_file; // footprint file to read/write.
int m_LineNum; // the line count
public: public:
/** /**
* ctor * Constructor FOOTPRINT_LIBRARY
* @param aFile = a FILE * pointer used for write operations, * @param aFile = a FILE * pointer used for write operations,
* and read operations when aReader = NULL * and read operations when aReader = NULL
* @param aReader = a FILTER_READER pointer used for read operations * @param aReader = a FILTER_READER pointer used for read operations
...@@ -27,7 +28,11 @@ public: ...@@ -27,7 +28,11 @@ public:
*/ */
FOOTPRINT_LIBRARY( FILE * aFile, FILTER_READER * aReader = NULL ); FOOTPRINT_LIBRARY( FILE * aFile, FILTER_READER * aReader = NULL );
~FOOTPRINT_LIBRARY() { } FOOTPRINT_LIBRARY() :
m_reader( 0 ),
m_file( 0 ),
m_LineNum( 0 )
{}
/** /**
* function IsLibrary * function IsLibrary
......
...@@ -332,6 +332,12 @@ public: ...@@ -332,6 +332,12 @@ public:
*/ */
D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS ); D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
/**
* GetPadCount
* returns the number of pads.
*/
unsigned GetPadCount() const { return m_Pads.GetCount() ; }
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
......
...@@ -18,23 +18,40 @@ ...@@ -18,23 +18,40 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
/* Default Pcbnew zoom values. /**
* Limited to 19 values to keep a decent size to menus Default Pcbnew zoom values.
* 15 it better but does not allow a sufficient number of values Limited to 19 values to keep a decent size to menus.
* roughtly a 1.5 progression. Roughly a 1.5 progression.
* The last 2 values is handy when somebody uses a library import of a module The last 2 values are handy when somebody uses a library import of a module
* (or foreign data) which has a bad coordinate (or foreign data) which has a bad coordinate.
* Also useful in GerbView for this reason. Also useful in GerbView for this reason.
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic
* functions ) functions )
*/ */
static const double pcbZoomList[] = static const double pcbZoomList[] =
{ {
0.5, 1.0, 1.5, 2.0, 3.0, 4.5, 7.0, 0.5,
10.0, 15.0, 22.0, 35.0, 50.0, 80.0, 120.0, 1.0,
200.0, 350.0, 500.0, 1000.0, 2000.0 1.5,
2.0,
3.0,
4.5,
7.0,
10.0,
15.0,
22.0,
35.0,
50.0,
80.0,
120.0,
200.0,
350.0,
500.0,
1000.0,
2000.0
}; };
#define MM_TO_PCB_UNITS (10000.0 / 25.4) #define MM_TO_PCB_UNITS (10000.0 / 25.4)
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include <kicad_plugin.h> #include <kicad_plugin.h>
#define FMT_UNIMPLEMENTED _( "Plugin '%s' does not implement the '%s' function." )
#define FMT_NOTFOUND _( "Plugin type '%s' is not found." )
// Some day plugins might be in separate DLL/DSOs, simply because of numbers of them // Some day plugins might be in separate DLL/DSOs, simply because of numbers of them
// and code size. Until then, use the simplest method: // and code size. Until then, use the simplest method:
...@@ -40,8 +44,8 @@ ...@@ -40,8 +44,8 @@
// plugins coexisting. // plugins coexisting.
// static LEGACY_PLUGIN kicad_plugin; // a secret // static LEGACY_PLUGIN kicad_plugin;
//static EAGLE_PLUGIN eagle_plugin; // static EAGLE_PLUGIN eagle_plugin;
PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType ) PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType )
{ {
...@@ -118,7 +122,7 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName, ...@@ -118,7 +122,7 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName,
return pi->Load( aFileName, aAppendToMe, aProperties ); // virtual return pi->Load( aFileName, aAppendToMe, aProperties ); // virtual
} }
THROW_IO_ERROR( wxString::Format( _( "Plugin type '%s' is not found." ), ShowType( aFileType ).GetData() ) ); THROW_IO_ERROR( wxString::Format( FMT_NOTFOUND, ShowType( aFileType ).GetData() ) );
} }
...@@ -133,25 +137,56 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar ...@@ -133,25 +137,56 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar
return; return;
} }
THROW_IO_ERROR( wxString::Format( _( "Plugin type '%s' is not found." ), ShowType( aFileType ).GetData() ) ); THROW_IO_ERROR( wxString::Format( FMT_NOTFOUND, ShowType( aFileType ).GetData() ) );
} }
BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties )
{ {
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface, // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
// e.g. Load() or Save() but not both. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) );
THROW_IO_ERROR( wxString::Format(
_( "Plugin %s does not implement the BOARD Load() function." ), PluginName().GetData() ) );
} }
void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties )
{ {
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface, // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
// e.g. Load() or Save() but not both. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) );
}
wxArrayString PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
}
THROW_IO_ERROR( wxString::Format( MODULE* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
_( "Plugin %s does not implement the BOARD Save() function." ), PluginName().GetData() ) ); PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
} }
void PLUGIN::FootprintSave( const wxString& aLibraryPath, MODULE* aFootprint, PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
}
void PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
}
bool PLUGIN::IsLibraryWritable( const wxString& aLibraryPath )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
class BOARD; class BOARD;
class PLUGIN; class PLUGIN;
class MODULE;
/** /**
...@@ -237,13 +238,102 @@ public: ...@@ -237,13 +238,102 @@ public:
virtual void Save( const wxString& aFileName, BOARD* aBoard, virtual void Save( const wxString& aFileName, BOARD* aBoard,
PROPERTIES* aProperties = NULL ); PROPERTIES* aProperties = NULL );
/**
* Function FootprintEnumerate
* returns a list of footprint names contained within the library at @a aLibraryPath.
*
* @param aLibraryPath is locator for the "library", usually a directory
* or file containing several footprints.
*
* @param aProperties is an associative array that can be used to tell the
* plugin how to access the library.
* The caller continues to own this object (plugin may not delete it), and
* plugins should expect it to be optionally NULL.
*
* @return wxArrayString - is the array of available footprint names inside
* a library
*
* @throw IO_ERROR if the library cannot be found, or footprint cannot be loaded.
*/
virtual wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL);
/**
* Function FootprintLoad
* loads a MODULE having @a aFootprintName from the @a aLibraryPath containing
* a library format that this PLUGIN knows about.
*
* @param aLibraryPath is locator for the "library", usually a directory
* or file containing several footprints.
*
* @param aFootprintName is the name of the footprint to load.
*
* @param aProperties is an associative array that can be used to tell the
* saver how to save the file, because it can take any number of
* additional named tuning arguments that the plugin is known to support.
* The caller continues to own this object (plugin may not delete it), and
* plugins should expect it to be optionally NULL.
*
* @return MODULE* - caller owns it. Never NULL because exception thrown if error.
*
* @throw IO_ERROR if the PLUGIN cannot be found, library cannot be found,
* or footprint cannot be loaded.
*/
virtual MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
PROPERTIES* aProperties = NULL );
/**
* Function FootprintSave
* will write @a aModule to an existing library located at @a aLibraryPath,
* and create the library if it doesn't exist then perform the write. If a
* footprint by the same name already exists, it is replaced.
*
* @param aLibraryPath is locator for the "library", usually a directory
* or file containing several footprints. This is where the footprint is
* to be stored.
*
* @param aFootprint is what to store in the library.
* The caller continues to own the footprint.
*
* @param aProperties is an associative array that can be used to tell the
* saver how to save the file, because it can take any number of
* additional named tuning arguments that the plugin is known to support.
* The caller continues to own this object (plugin may not delete it), and
* plugins should expect it to be optionally NULL.
*
* @throw IO_ERROR if there is a problem saving.
*/
virtual void FootprintSave( const wxString& aLibraryPath, MODULE* aFootprint,
PROPERTIES* aProperties = NULL );
/**
* Function FootprintDelete
* deletes the @a aFootprintName from the library at @a aLibraryPath.
*
* @param aLibraryPath is locator for the "library", usually a directory
* or file containing several footprints.
*
* @param aFootprintName is the name of a footprint to delete from the specificed library.
*
* @throw IO_ERROR if there is a problem finding the footprint or the library, or deleting it.
*/
virtual void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName );
/**
* Function IsLibraryWritable
* returns true iff the library at @a aLibraryPath is writable. (Often
* system libraries are read only because of where they are installed.)
*/
virtual bool IsLibraryWritable( const wxString& aLibraryPath );
//-----</PUBLIC PLUGIN API>------------------------------------------------ //-----</PUBLIC PLUGIN API>------------------------------------------------
/* The compiler writes the "zero argument" constructor for a PLUGIN /* The compiler writes the "zero argument" constructor for a PLUGIN
automatically if you do not provide one. If you decide you need to 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. provide a zero argument constructor of your own design, that is allowed.
It must be public, and it is what the IO_MGR uses. Parameters may be It must be public, and it is what the IO_MGR uses. Parameters may be
passed into a PLUGIN via the PROPERTIES variable for either Save() and Load(). passed into a PLUGIN via the PROPERTIES variable for any of the public
API functions which take one.
*/ */
virtual ~PLUGIN() {} virtual ~PLUGIN() {}
......
This diff is collapsed.
...@@ -44,6 +44,8 @@ class EDGE_MODULE; ...@@ -44,6 +44,8 @@ class EDGE_MODULE;
class TRACK; class TRACK;
class SEGZONE; class SEGZONE;
class D_PAD; class D_PAD;
class FPL_CACHE;
/** /**
* Class LEGACY_PLUGIN * Class LEGACY_PLUGIN
...@@ -55,7 +57,7 @@ class LEGACY_PLUGIN : public PLUGIN ...@@ -55,7 +57,7 @@ class LEGACY_PLUGIN : public PLUGIN
public: public:
//-----<PLUGIN>------------------------------------------------------------- //-----<PLUGIN IMPLEMENTATION>----------------------------------------------
const wxString& PluginName() const const wxString& PluginName() const
{ {
...@@ -73,7 +75,35 @@ public: ...@@ -73,7 +75,35 @@ public:
void Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties = NULL ); // overload void Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties = NULL ); // overload
//-----</PLUGIN>------------------------------------------------------------ wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL);
MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
PROPERTIES* aProperties = NULL );
void FootprintSave( const wxString& aLibraryPath, MODULE* aFootprint,
PROPERTIES* aProperties = NULL );
void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName );
bool IsLibraryWritable( const wxString& aLibraryPath );
//-----</PLUGIN IMPLEMENTATION>---------------------------------------------
LEGACY_PLUGIN() :
m_board( 0 ),
m_props( 0 ),
m_reader( 0 ),
m_fp( 0 ),
m_cache( 0 )
{}
~LEGACY_PLUGIN();
void SetReader( LINE_READER* aReader ) { m_reader = aReader; }
void SetFilePtr( FILE* aFile ) { m_fp = aFile; }
MODULE* LoadMODULE();
protected: protected:
...@@ -87,6 +117,8 @@ protected: ...@@ -87,6 +117,8 @@ protected:
wxString m_field; ///< reused to stuff MODULE fields. wxString m_field; ///< reused to stuff MODULE fields.
int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing? int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing?
FPL_CACHE* m_cache;
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void init( PROPERTIES* aProperties ); void init( PROPERTIES* aProperties );
...@@ -131,11 +163,11 @@ protected: ...@@ -131,11 +163,11 @@ protected:
void loadAllSections( bool doAppend ); void loadAllSections( bool doAppend );
void loadGENERAL(); void loadGENERAL();
void loadSETUP(); void loadSETUP();
void loadSHEET(); void loadSHEET();
void loadMODULE();
void load3D( MODULE* aModule ); void load3D( MODULE* aModule );
void loadPAD( MODULE* aModule ); void loadPAD( MODULE* aModule );
void loadMODULE_TEXT( TEXTE_MODULE* aText ); void loadMODULE_TEXT( TEXTE_MODULE* aText );
...@@ -235,6 +267,8 @@ protected: ...@@ -235,6 +267,8 @@ protected:
//-----</save functions>---------------------------------------------------- //-----</save functions>----------------------------------------------------
/// we only cache one footprint library for now, this determines which one.
void cacheLib( const wxString& aLibraryPath );
}; };
#endif // LEGACY_PLUGIN_H_ #endif // LEGACY_PLUGIN_H_
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <class_module.h> #include <class_module.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <class_footprint_library.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
...@@ -225,122 +224,15 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname ) ...@@ -225,122 +224,15 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname )
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
return; return;
oldFileName = aLibname; try
if( ( lib_module = wxFopen( oldFileName.GetFullPath(), wxT( "rt" ) ) ) == NULL )
{
wxString msg;
msg.Printf( _( "Library <%s> not found" ), GetChars(oldFileName.GetFullPath() ) );
DisplayError( NULL, msg );
return;
}
FOOTPRINT_LIBRARY input_lib( lib_module );
// Read header.
if( ! input_lib.IsLibrary() )
{
fclose( lib_module );
wxString msg;
msg.Printf( _( "<%s> is not a valid footprint library file" ),
GetChars( oldFileName.GetFullPath() ) );
DisplayError( NULL, msg );
return;
}
// Read module names.
input_lib.RebuildIndex();
bool found = input_lib.FindInList( CmpName );
if( !found )
{
fclose( lib_module );
msg.Printf( _( "Module [%s] not found" ), GetChars( CmpName ) );
DisplayError( NULL, msg );
return;
}
// Create new library.
newFileName = oldFileName;
newFileName.SetExt( FILETMP_EXT );
if( ( out_file = wxFopen( newFileName.GetFullPath(), wxT( "wt" ) ) ) == NULL )
{
fclose( lib_module );
msg.Printf( _( "Unable to create %s" ), GetChars( newFileName.GetFullPath() ) );
DisplayError( NULL, msg );
return;
}
wxBeginBusyCursor();
FOOTPRINT_LIBRARY output_lib( out_file );
output_lib.m_List = input_lib.m_List;
output_lib.WriteHeader();
output_lib.RemoveFromList( CmpName );
output_lib.SortList();
output_lib.WriteSectionIndex();
// Copy modules.
rewind( lib_module );
LineNum = input_lib.m_LineNum;
bool copylines = false;
while( GetLine( lib_module, Line, &LineNum ) )
{
StrPurge( Line );
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
{ {
copylines = true; PLUGIN::HOLDER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
sscanf( Line + 7, " %s", Name );
msg = FROM_UTF8( Name );
if( msg.CmpNoCase( CmpName ) == 0 ) pi->FootprintDelete( aLibname, CmpName );
{
// Delete old module (i.e. do not copy description to out_file).
while( GetLine( lib_module, Line, &LineNum ) )
{
if( strnicmp( Line, "$EndMODULE", 9 ) == 0 )
break;
}
continue;
}
} }
catch( IO_ERROR ioe )
if( copylines )
fprintf( out_file, "%s\n", Line );
}
fclose( lib_module );
fclose( out_file );
wxEndBusyCursor();
// The old library file is renamed .bak
wxFileName backupFileName = oldFileName;
backupFileName.SetExt( BACKUP_EXT );
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( oldFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{ {
msg.Printf( _( "Could not create library back up file <%s>." ), DisplayError( NULL, ioe.errorText );
GetChars( backupFileName.GetFullName() ) );
DisplayError( this, msg );
return;
}
// The temporary file is renamed as the previous library.
if( !wxRenameFile( newFileName.GetFullPath(), oldFileName.GetFullPath() ) )
{
msg.Printf( _("Could not create temporary library file <%s>."),
GetChars( oldFileName.GetFullName() ) );
DisplayError( this, msg );
return; return;
} }
......
...@@ -153,7 +153,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, ...@@ -153,7 +153,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
static wxArrayString HistoryList; static wxArrayString HistoryList;
static wxString lastComponentName; static wxString lastComponentName;
/* Ask for a component name or key words */ // Ask for a component name or key words
DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList, DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList,
_( "Load Module" ), aUseFootprintViewer ); _( "Load Module" ), aUseFootprintViewer );
...@@ -171,7 +171,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, ...@@ -171,7 +171,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
moduleName = dlg.GetComponentName(); moduleName = dlg.GetComponentName();
} }
if( moduleName.IsEmpty() ) /* Cancel command */ if( moduleName.IsEmpty() ) // Cancel command
{ {
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
return NULL; return NULL;
...@@ -185,7 +185,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, ...@@ -185,7 +185,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
keys = moduleName; keys = moduleName;
moduleName = Select_1_Module_From_List( this, aLibrary, wxEmptyString, keys ); moduleName = Select_1_Module_From_List( this, aLibrary, wxEmptyString, keys );
if( moduleName.IsEmpty() ) /* Cancel command */ if( moduleName.IsEmpty() ) // Cancel command
{ {
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
return NULL; return NULL;
...@@ -200,13 +200,13 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, ...@@ -200,13 +200,13 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
if( moduleName.IsEmpty() ) if( moduleName.IsEmpty() )
{ {
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
return NULL; /* Cancel command. */ return NULL; // Cancel command.
} }
} }
module = GetModuleLibrary( aLibrary, moduleName, false ); module = GetModuleLibrary( aLibrary, moduleName, false );
if( ( module == NULL ) && AllowWildSeach ) /* Search with wild card */ if( ( module == NULL ) && AllowWildSeach ) // Search with wild card
{ {
AllowWildSeach = false; AllowWildSeach = false;
wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' ); wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' );
...@@ -216,7 +216,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary, ...@@ -216,7 +216,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& aLibrary,
if( moduleName.IsEmpty() ) if( moduleName.IsEmpty() )
{ {
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
return NULL; /* Cancel command. */ return NULL; // Cancel command.
} }
else else
{ {
...@@ -376,7 +376,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, ...@@ -376,7 +376,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
const wxString& aMask, const wxString& aMask,
const wxString& aKeyWord ) const wxString& aKeyWord )
{ {
static wxString OldName; /* Save the name of the last module loaded. */ static wxString OldName; // Save the name of the last module loaded.
wxString CmpName; wxString CmpName;
wxString msg; wxString msg;
wxArrayString libnames_list; wxArrayString libnames_list;
...@@ -386,7 +386,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, ...@@ -386,7 +386,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
else else
libnames_list.Add( aLibraryFullFilename ); libnames_list.Add( aLibraryFullFilename );
/* Find modules in libraries. */ // Find modules in libraries.
MList.ReadFootprintFiles( libnames_list ); MList.ReadFootprintFiles( libnames_list );
wxArrayString footprint_names_list; wxArrayString footprint_names_list;
...@@ -461,7 +461,7 @@ static void DisplayCmpDoc( wxString& Name ) ...@@ -461,7 +461,7 @@ static void DisplayCmpDoc( wxString& Name )
MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb ) MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb )
{ {
MODULE* module; MODULE* module;
static wxString OldName; /* Save name of last module selected. */ static wxString OldName; // Save name of last module selected.
wxString CmpName, msg; wxString CmpName, msg;
wxArrayString listnames; wxArrayString listnames;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <class_footprint_library.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
class wxSashLayoutWindow; class wxSashLayoutWindow;
class wxListBox; class wxListBox;
class wxSemaphore; class wxSemaphore;
class FOOTPRINT_LIBRARY;
/** /**
......
...@@ -543,7 +543,6 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) ...@@ -543,7 +543,6 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
/// data type used to ensure unique-ness of pin names, holding (wxString and int) /// data type used to ensure unique-ness of pin names, holding (wxString and int)
//typedef std::map<wxString, int, wxString_less_than> PINMAP;
typedef std::map<wxString, int> PINMAP; typedef std::map<wxString, int> PINMAP;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment