From e3637dd369f806584f39178ac75249b3fd1a7748 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 8 Feb 2011 19:39:41 +0100 Subject: [PATCH] Code cleaning and minor enhancements --- common/common_plotPS_functions.cpp | 13 ++-- eeschema/netlist_control.cpp | 103 +++++++++++++++-------------- eeschema/netlist_control.h | 16 ++--- eeschema/schframe.cpp | 2 +- gerbview/draw_gerber_screen.cpp | 54 +-------------- pcbnew/loadcmp.cpp | 38 +++++------ 6 files changed, 92 insertions(+), 134 deletions(-) diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp index 820ba224d6..02e85e62d0 100644 --- a/common/common_plotPS_functions.cpp +++ b/common/common_plotPS_functions.cpp @@ -426,16 +426,17 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, GRTraceMode modetrace ) { wxASSERT( output_file ); + + set_current_line_width( -1 ); + if( current_pen_width >= diametre ) + set_current_line_width( diametre ); + if( modetrace == FILLED ) - { - set_current_line_width( -1 ); circle( pos, diametre - current_pen_width, FILLED_SHAPE ); - } else - { - set_current_line_width( -1 ); circle( pos, diametre - current_pen_width, NO_FILL ); - } + + set_current_line_width( -1 ); } diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index 362d32f344..5a91b15ae7 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -65,15 +65,15 @@ wxString ReturnUserNetlistTypeName( bool first_item ) } -BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog ) - EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick ) - EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist ) - EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData ) - EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel ) - EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel ) +BEGIN_EVENT_TABLE( NETLIST_DIALOG, wxDialog ) + EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG::OnCancelClick ) + EVT_BUTTON( ID_CREATE_NETLIST, NETLIST_DIALOG::GenNetlist ) + EVT_BUTTON( ID_SETUP_PLUGIN, NETLIST_DIALOG::AddNewPluginPanel ) + EVT_BUTTON( ID_DELETE_PLUGIN, NETLIST_DIALOG::DeletePluginPanel ) + EVT_BUTTON( ID_VALIDATE_PLUGIN, NETLIST_DIALOG::ValidatePluginPanel ) EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT, - WinEDA_NetlistFrame::SelectNetlistType ) - EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator ) + NETLIST_DIALOG::SelectNetlistType ) + EVT_BUTTON( ID_RUN_SIMULATOR, NETLIST_DIALOG::RunSimulator ) END_EVENT_TABLE() @@ -85,7 +85,7 @@ END_EVENT_TABLE() /* Contructor to create a setup page for one netlist format. * Used in Netlist format Dialog box creation */ -EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, +NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title, int id_NetType, int idCheckBox, @@ -163,7 +163,7 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, /*************************************************************************************/ -WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : +NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) : wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition, wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER ) /*************************************************************************************/ @@ -193,7 +193,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : // Add Panel FORMAT PCBNEW m_PanelNetType[PANELPCBNEW] = - new EDA_NoteBookPage( m_NoteBook, + new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Pcbnew" ), NET_TYPE_PCBNEW, ID_CURRENT_FORMAT_IS_DEFAULT, @@ -202,7 +202,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : // Add Panel FORMAT ORCADPCB2 m_PanelNetType[PANELORCADPCB2] = - new EDA_NoteBookPage( m_NoteBook, + new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ), NET_TYPE_ORCADPCB2, ID_CURRENT_FORMAT_IS_DEFAULT, @@ -211,7 +211,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : // Add Panel FORMAT CADSTAR m_PanelNetType[PANELCADSTAR] = - new EDA_NoteBookPage( m_NoteBook, + new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ), NET_TYPE_CADSTAR, ID_CURRENT_FORMAT_IS_DEFAULT, @@ -232,17 +232,17 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : /*************************************************/ -void WinEDA_NetlistFrame::InstallPageSpice() +void NETLIST_DIALOG::InstallPageSpice() /*************************************************/ /* Create the spice page */ { wxButton* Button; - EDA_NoteBookPage* page; + NETLIST_PAGE_DIALOG* page; page = m_PanelNetType[PANELSPICE] = - new EDA_NoteBookPage( m_NoteBook, + new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE, 0, 0, @@ -282,7 +282,7 @@ void WinEDA_NetlistFrame::InstallPageSpice() /*************************************************/ -void WinEDA_NetlistFrame::InstallCustomPages() +void NETLIST_DIALOG::InstallCustomPages() /*************************************************/ /* create the pages for custom netlist format selection: @@ -291,7 +291,7 @@ void WinEDA_NetlistFrame::InstallCustomPages() bool selected; int ii, CustomCount; wxString title, previoustitle, msg; - EDA_NoteBookPage* CurrPage; + NETLIST_PAGE_DIALOG* CurrPage; CustomCount = CUSTOMPANEL_COUNTMAX; previoustitle = wxT( "dummy_title" ); @@ -310,7 +310,7 @@ void WinEDA_NetlistFrame::InstallCustomPages() if( title.IsEmpty() ) CurrPage = m_PanelNetType[PANELCUSTOMBASE + ii] = - new EDA_NoteBookPage( m_NoteBook, + new NETLIST_PAGE_DIALOG( m_NoteBook, _( "Add Plugin" ), NET_TYPE_CUSTOM1 + ii, ID_CURRENT_FORMAT_IS_DEFAULT, @@ -319,7 +319,7 @@ void WinEDA_NetlistFrame::InstallCustomPages() else /* Install a plugin panel */ CurrPage = m_PanelNetType[PANELCUSTOMBASE + ii] = - new EDA_NoteBookPage( m_NoteBook, + new NETLIST_PAGE_DIALOG( m_NoteBook, title, NET_TYPE_CUSTOM1 + ii, ID_CURRENT_FORMAT_IS_DEFAULT, @@ -344,12 +344,11 @@ void WinEDA_NetlistFrame::InstallCustomPages() } -/***********************************************************/ -void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) -/***********************************************************/ - -/* Browse the plugin files and set the m_CommandStringCtrl field +/* + * Browse plugin files, add a new panel + * and set m_CommandStringCtrl field */ +void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event ) { wxString FullFileName, Mask, Path; @@ -367,15 +366,23 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) if( FullFileName.IsEmpty() ) return; - EDA_NoteBookPage* CurrPage; - CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); + NETLIST_PAGE_DIALOG* CurrPage; + CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); if( CurrPage == NULL ) return; // Creates a default command line, suitable for external tool xslproc: - // TODO: build better default command lines depending on plugin extension + // try to build a default command line depending on plugin extension wxString cmdLine; - cmdLine.Printf(wxT("xsltproc -o %%O %s %%I"), GetChars(FullFileName) ); + wxFileName fn( FullFileName ); + wxString ext = fn.GetExt(); + if( ext == wxT("xsl" ) ) + cmdLine.Printf(wxT("xsltproc -o %%O \"%s\" %%I"), GetChars(FullFileName) ); + else if( ext == wxT("exe" ) || ext.IsEmpty() ) + cmdLine.Printf(wxT("\"%s\" > %%O < %%I"), GetChars(FullFileName) ); + else + cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) ); + CurrPage->m_CommandStringCtrl->SetValue( cmdLine ); /* Get a title for this page */ @@ -388,20 +395,20 @@ netlist control page" /*****************************************************************/ -void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event ) +void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event ) /*****************************************************************/ /* Called when the check box "default format" is clicked */ { int ii; - EDA_NoteBookPage* CurrPage; + NETLIST_PAGE_DIALOG* CurrPage; for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ ) if( m_PanelNetType[ii] ) m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( FALSE ); - CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); + CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); if( CurrPage == NULL ) return; @@ -411,7 +418,7 @@ void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event ) /***********************************************/ -void WinEDA_NetlistFrame::NetlistUpdateOpt() +void NETLIST_DIALOG::NetlistUpdateOpt() /***********************************************/ { int ii; @@ -435,7 +442,7 @@ void WinEDA_NetlistFrame::NetlistUpdateOpt() /**********************************************************/ -void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event ) +void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) /**********************************************************/ /** @@ -452,8 +459,8 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event ) NetlistUpdateOpt(); - EDA_NoteBookPage* CurrPage; - CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); + NETLIST_PAGE_DIALOG* CurrPage; + CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); /* Calculate the netlist filename */ fn = g_RootSheet->GetScreen()->GetFileName(); @@ -556,13 +563,13 @@ Do you want to annotate schematic?" ) ) ) } -void WinEDA_NetlistFrame::OnCancelClick( wxCommandEvent& event ) +void NETLIST_DIALOG::OnCancelClick( wxCommandEvent& event ) { EndModal( NET_ABORT ); } -void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event ) +void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) { wxFileName fn; wxString ExecFile, CommandLine; @@ -580,8 +587,8 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event ) CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" ); g_OptNetListUseNames = m_UseNetNamesInNetlist->GetSelection() == 0; - EDA_NoteBookPage* CurrPage; - CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); + NETLIST_PAGE_DIALOG* CurrPage; + CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); if( ! m_Parent->CreateNetlist( CurrPage->m_IdNetType, fn.GetFullPath(), g_OptNetListUseNames ) ) return; @@ -591,7 +598,7 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event ) /*********************************************************/ -void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void ) +void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) /*********************************************************/ /** @@ -607,7 +614,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void ) // Update the new titles for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ ) { - EDA_NoteBookPage* CurrPage = m_PanelNetType[ii + PANELCUSTOMBASE]; + NETLIST_PAGE_DIALOG* CurrPage = m_PanelNetType[ii + PANELCUSTOMBASE]; if( CurrPage == NULL ) break; msg = wxT( "Custom" ); @@ -635,7 +642,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void ) /******************************************************************/ -void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event ) +void NETLIST_DIALOG::DeletePluginPanel( wxCommandEvent& event ) /******************************************************************/ /** @@ -643,8 +650,8 @@ void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event ) * Remove a panel relative to a netlist plugin */ { - EDA_NoteBookPage* CurrPage = - (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); + NETLIST_PAGE_DIALOG* CurrPage = + (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString ); CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString ); @@ -659,7 +666,7 @@ void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event ) /******************************************************************/ -void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event ) +void NETLIST_DIALOG::ValidatePluginPanel( wxCommandEvent& event ) /******************************************************************/ /** @@ -667,8 +674,8 @@ void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event ) * Validate the panel info relative to a new netlist plugin */ { - EDA_NoteBookPage* CurrPage = - (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); + NETLIST_PAGE_DIALOG* CurrPage = + (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString ) { diff --git a/eeschema/netlist_control.h b/eeschema/netlist_control.h index 903103ef39..9dd382017f 100644 --- a/eeschema/netlist_control.h +++ b/eeschema/netlist_control.h @@ -40,7 +40,7 @@ enum gen_netlist_diag { /* wxPanels for creating the NoteBook pages for each netlist format: */ -class EDA_NoteBookPage : public wxPanel +class NETLIST_PAGE_DIALOG : public wxPanel { public: int m_IdNetType; @@ -63,10 +63,10 @@ public: * @param selected = true to have this notebook page selected when the dialog is opened * Only one page can be created with selected = true. */ - EDA_NoteBookPage( wxNotebook* parent, const wxString& title, + NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title, int id_NetType, int idCheckBox, int idCreateFile, bool selected ); - ~EDA_NoteBookPage() { }; + ~NETLIST_PAGE_DIALOG() { }; }; @@ -89,19 +89,19 @@ enum TypeNetForm { /* Dialog frame for creating netlists */ -class WinEDA_NetlistFrame : public wxDialog +class NETLIST_DIALOG : public wxDialog { public: SCH_EDIT_FRAME* m_Parent; wxNotebook* m_NoteBook; - EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; + NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; wxRadioBox* m_UseNetNamesInNetlist; public: // Constructor and destructor - WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ); - ~WinEDA_NetlistFrame() { }; + NETLIST_DIALOG( SCH_EDIT_FRAME* parent ); + ~NETLIST_DIALOG() { }; private: void InstallCustomPages(); @@ -111,7 +111,7 @@ private: void NetlistUpdateOpt(); void OnCancelClick( wxCommandEvent& event ); void SelectNetlistType( wxCommandEvent& event ); - void SetupPluginData( wxCommandEvent& event ); + void AddNewPluginPanel( wxCommandEvent& event ); void DeletePluginPanel( wxCommandEvent& event ); void ValidatePluginPanel( wxCommandEvent& event ); diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 302f4e4811..636e1913e0 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event ) do { - WinEDA_NetlistFrame* dlg = new WinEDA_NetlistFrame( this ); + NETLIST_DIALOG* dlg = new NETLIST_DIALOG( this ); i = dlg->ShowModal(); dlg->Destroy(); } while( i == NET_PLUGIN_CHANGE ); diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index dbf0377957..cc697ba77a 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -18,14 +18,6 @@ #include "class_gerber_draw_item.h" #include "class_GERBER.h" -#ifdef __WINDOWS__ -// Blit function seems have problems when scale != 1 and/or offsets -#define AVOID_BLIT_SCALE_BUG true -#else -#define AVOID_BLIT_SCALE_BUG false // not needed on Linux -#endif - - /** * Function PrintPage (virtual) @@ -130,23 +122,10 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin int bitmapWidth, bitmapHeight; wxDC* plotDC = aDC; -#if AVOID_BLIT_SCALE_BUG - // Blit function used below seems to work OK only with scale = 1 and no offsets - // at least under Windows - // Store device context scale and origins: - double dc_scalex, dc_scaley; - wxPoint dev_org; - wxPoint logical_org; - - aDC->GetDeviceOrigin( &dev_org.x, &dev_org.y ); - aDC->GetLogicalOrigin( &logical_org.x, &logical_org.y ); - aDC->GetUserScale( &dc_scalex, &dc_scaley ); -#endif - aPanel->GetClientSize( &bitmapWidth, &bitmapHeight ); - wxBitmap* layerBitmap; - wxBitmap* screenBitmap; + wxBitmap* layerBitmap = NULL; + wxBitmap* screenBitmap = NULL; wxMemoryDC layerDC; // used sequentially for each gerber layer wxMemoryDC screenDC; @@ -185,12 +164,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin // layers are drawn in background color. if( gerber->HasNegativeItems() && doBlit ) { - -#if AVOID_BLIT_SCALE_BUG - layerDC.SetUserScale( 1.0, 1.0 ); - layerDC.SetDeviceOrigin( 0, 0 ); - layerDC.SetLogicalOrigin( 0, 0 ); -#endif if( aDrawMode == GR_COPY ) { // Use the layer bitmap itself as a mask when blitting. The bitmap @@ -217,12 +190,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin layerDC.Clear(); } -#if AVOID_BLIT_SCALE_BUG - layerDC.SetUserScale( dc_scalex, dc_scaley ); - layerDC.SetDeviceOrigin( dev_org.x, dev_org.y ); - layerDC.SetLogicalOrigin( logical_org.x, logical_org.y ); -#endif - if( gerber->m_ImageNegative ) { // Draw background negative (i.e. in graphic layer color) for negative images. @@ -271,15 +238,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin { // this is the last transfert to screenDC. If there are no negative items, this is // the only one - -#if AVOID_BLIT_SCALE_BUG - if( aDrawMode != -1 ) - { - layerDC.SetUserScale( 1.0, 1.0 ); - layerDC.SetDeviceOrigin( 0, 0 ); - layerDC.SetLogicalOrigin( 0, 0 ); - } -#endif if( aDrawMode == GR_COPY ) { layerDC.SelectObject( wxNullBitmap ); @@ -296,14 +254,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin if( aDrawMode != -1 ) { aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY ); - -#if AVOID_BLIT_SCALE_BUG - // Restore scale and offsets values: - aDC->SetUserScale( dc_scalex, dc_scaley ); - aDC->SetDeviceOrigin( dev_org.x, dev_org.y ); - aDC->SetLogicalOrigin( logical_org.x, logical_org.y ); -#endif - layerDC.SelectObject( wxNullBitmap ); screenDC.SelectObject( wxNullBitmap ); delete layerBitmap; diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 1e3e9297fd..ad86c1e432 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -20,19 +20,19 @@ #include "richio.h" #include "filter_reader.h" -class ModList +class FOOTPRINT_ITEM { public: - ModList* Next; + FOOTPRINT_ITEM* Next; wxString m_Name, m_Doc, m_KeyWord; public: - ModList() + FOOTPRINT_ITEM() { Next = NULL; } - ~ModList() + ~FOOTPRINT_ITEM() { } }; @@ -42,7 +42,7 @@ static void DisplayCmpDoc( wxString& Name ); static void ReadDocLib( const wxString& ModLibName ); -static ModList* MList; +static FOOTPRINT_ITEM* MList; /** * Function Load_Module_From_BOARD @@ -373,7 +373,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow char* Line; wxFileName fn; static wxString OldName; /* Save the name of the last module loaded. */ - wxString CmpName, tmp; + wxString CmpName; + wxString libFullName; FILE* file; wxString msg; wxArrayString itemslist; @@ -392,9 +393,9 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow else fn = aLibraryFullFilename; - tmp = wxGetApp().FindLibraryPath( fn ); + libFullName = wxGetApp().FindLibraryPath( fn ); - if( !tmp ) + if( libFullName.IsEmpty() ) { msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ), GetChars( fn.GetFullName() ) ); @@ -403,7 +404,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow continue; } - ReadDocLib( tmp ); + ReadDocLib( libFullName ); if( !aKeyWord.IsEmpty() ) /* Don't read the library if selection * by keywords, already read. */ @@ -413,7 +414,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow continue; } - file = wxFopen( tmp, wxT( "rt" ) ); + file = wxFopen( libFullName, wxT( "rt" ) ); if( file == NULL ) { @@ -422,7 +423,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow continue; } - FILE_LINE_READER fileReader( file, tmp ); + FILE_LINE_READER fileReader( file, libFullName ); FILTER_READER reader( fileReader ); @@ -437,9 +438,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) { msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ), - GetChars( tmp ) ); - wxMessageBox( msg, _( "Library Load Error" ), - wxOK | wxICON_ERROR, this ); + GetChars( libFullName ) ); + wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this ); continue; } @@ -478,7 +478,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow /* Create list of modules if search by keyword. */ if( !aKeyWord.IsEmpty() ) { - ModList* ItemMod = MList; + FOOTPRINT_ITEM* ItemMod = MList; while( ItemMod != NULL ) { if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) ) @@ -502,7 +502,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow while( MList != NULL ) { - ModList* NewMod = MList->Next; + FOOTPRINT_ITEM* NewMod = MList->Next; delete MList; MList = NewMod; } @@ -519,7 +519,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow */ static void DisplayCmpDoc( wxString& Name ) { - ModList* Mod = MList; + FOOTPRINT_ITEM* Mod = MList; if( !Mod ) { @@ -551,7 +551,7 @@ static void DisplayCmpDoc( wxString& Name ) */ static void ReadDocLib( const wxString& ModLibName ) { - ModList* NewMod; + FOOTPRINT_ITEM* NewMod; char* Line; FILE* LibDoc; wxFileName fn = ModLibName; @@ -579,7 +579,7 @@ static void ReadDocLib( const wxString& ModLibName ) break; ; if( Line[1] == 'M' ) /* Debut decription 1 module */ { - NewMod = new ModList(); + NewMod = new FOOTPRINT_ITEM(); NewMod->Next = MList; MList = NewMod; while( reader.ReadLine() )