Eeschema: fix a bug that prevents duplicate timestamps to be corrected by annotate function.

very minor enhancement in netlist dialog.
Gerbview: remove useless  code I wrote specific to Windows in BOARD::Draw()  function, because Wayne has fixed the bug.
common_plotPS_functions.cpp: remove a potential bug.
Rename some classes according to coding style policy.
This commit is contained in:
jean-pierre charras 2011-02-09 13:06:42 +01:00
commit 2d2c73efc7
9 changed files with 97 additions and 141 deletions

View File

@ -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 );
}

View File

@ -1149,8 +1149,7 @@ bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
}
/* Comparison routine for sorting by NumSheet table of elements
* connected (TabPinSort) by qsort ()
/* Comparison routine for sorting items by Sheet Number ( used by qsort )
*/
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,

View File

@ -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 )
{

View File

@ -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 );

View File

@ -548,7 +548,7 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
}
void SCH_SCREEN::GetHierarchicalItems( std::vector <SCH_ITEM*> aItems )
void SCH_SCREEN::GetHierarchicalItems( std::vector <SCH_ITEM*>& aItems )
{
SCH_ITEM* item = GetDrawItems();
@ -786,7 +786,7 @@ static bool SortByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 )
int ii = item1->m_TimeStamp - item2->m_TimeStamp;
/* If the time stamps are the same, compare type in order to have component objects
* before sheet object. This is done because the changing the sheet time stamp
* before sheet object. This is done because changing the sheet time stamp
* before the component time stamp could cause the current annotation to be lost.
*/
if( ( ii == 0 && ( item1->Type() != item2->Type() ) ) && ( item1->Type() == SCH_SHEET_T ) )
@ -918,7 +918,6 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
item = items[ii];
SCH_ITEM* nextItem = items[ii + 1];
if( item->m_TimeStamp == nextItem->m_TimeStamp )
{
count++;

View File

@ -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 );

View File

@ -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;

View File

@ -251,9 +251,9 @@ public:
/**
* Function GetHierarchicalItems
* adds all schematic sheet and component object in the screen to \a aItems.
* @param aItems Hierarchical item list.
* @param aItems Hierarchical item list to fill.
*/
void GetHierarchicalItems( std::vector <SCH_ITEM*> aItems );
void GetHierarchicalItems( std::vector <SCH_ITEM*>& aItems );
/**
* Function SelectBlockItems

View File

@ -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() )