Commit e3637dd3 authored by jean-pierre charras's avatar jean-pierre charras

Code cleaning and minor enhancements

parent e01f8967
...@@ -426,16 +426,17 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, ...@@ -426,16 +426,17 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode modetrace ) GRTraceMode modetrace )
{ {
wxASSERT( output_file ); wxASSERT( output_file );
if( modetrace == FILLED )
{
set_current_line_width( -1 ); set_current_line_width( -1 );
if( current_pen_width >= diametre )
set_current_line_width( diametre );
if( modetrace == FILLED )
circle( pos, diametre - current_pen_width, FILLED_SHAPE ); circle( pos, diametre - current_pen_width, FILLED_SHAPE );
}
else else
{
set_current_line_width( -1 );
circle( pos, diametre - current_pen_width, NO_FILL ); circle( pos, diametre - current_pen_width, NO_FILL );
}
set_current_line_width( -1 );
} }
......
...@@ -65,15 +65,15 @@ wxString ReturnUserNetlistTypeName( bool first_item ) ...@@ -65,15 +65,15 @@ wxString ReturnUserNetlistTypeName( bool first_item )
} }
BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog ) BEGIN_EVENT_TABLE( NETLIST_DIALOG, wxDialog )
EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, NETLIST_DIALOG::OnCancelClick )
EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist ) EVT_BUTTON( ID_CREATE_NETLIST, NETLIST_DIALOG::GenNetlist )
EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData ) EVT_BUTTON( ID_SETUP_PLUGIN, NETLIST_DIALOG::AddNewPluginPanel )
EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel ) EVT_BUTTON( ID_DELETE_PLUGIN, NETLIST_DIALOG::DeletePluginPanel )
EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel ) EVT_BUTTON( ID_VALIDATE_PLUGIN, NETLIST_DIALOG::ValidatePluginPanel )
EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT, EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT,
WinEDA_NetlistFrame::SelectNetlistType ) NETLIST_DIALOG::SelectNetlistType )
EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator ) EVT_BUTTON( ID_RUN_SIMULATOR, NETLIST_DIALOG::RunSimulator )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -85,7 +85,7 @@ END_EVENT_TABLE() ...@@ -85,7 +85,7 @@ END_EVENT_TABLE()
/* Contructor to create a setup page for one netlist format. /* Contructor to create a setup page for one netlist format.
* Used in Netlist format Dialog box creation * Used in Netlist format Dialog box creation
*/ */
EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
const wxString& title, const wxString& title,
int id_NetType, int id_NetType,
int idCheckBox, int idCheckBox,
...@@ -163,7 +163,7 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, ...@@ -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, wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition,
wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER ) wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
/*************************************************************************************/ /*************************************************************************************/
...@@ -193,7 +193,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : ...@@ -193,7 +193,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) :
// Add Panel FORMAT PCBNEW // Add Panel FORMAT PCBNEW
m_PanelNetType[PANELPCBNEW] = m_PanelNetType[PANELPCBNEW] =
new EDA_NoteBookPage( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "Pcbnew" ), wxT( "Pcbnew" ),
NET_TYPE_PCBNEW, NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
...@@ -202,7 +202,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : ...@@ -202,7 +202,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) :
// Add Panel FORMAT ORCADPCB2 // Add Panel FORMAT ORCADPCB2
m_PanelNetType[PANELORCADPCB2] = m_PanelNetType[PANELORCADPCB2] =
new EDA_NoteBookPage( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "OrcadPCB2" ), wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2, NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
...@@ -211,7 +211,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : ...@@ -211,7 +211,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) :
// Add Panel FORMAT CADSTAR // Add Panel FORMAT CADSTAR
m_PanelNetType[PANELCADSTAR] = m_PanelNetType[PANELCADSTAR] =
new EDA_NoteBookPage( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "CadStar" ), wxT( "CadStar" ),
NET_TYPE_CADSTAR, NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
...@@ -232,17 +232,17 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) : ...@@ -232,17 +232,17 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) :
/*************************************************/ /*************************************************/
void WinEDA_NetlistFrame::InstallPageSpice() void NETLIST_DIALOG::InstallPageSpice()
/*************************************************/ /*************************************************/
/* Create the spice page /* Create the spice page
*/ */
{ {
wxButton* Button; wxButton* Button;
EDA_NoteBookPage* page; NETLIST_PAGE_DIALOG* page;
page = m_PanelNetType[PANELSPICE] = page = m_PanelNetType[PANELSPICE] =
new EDA_NoteBookPage( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook,
wxT( "Spice" ), wxT( "Spice" ),
NET_TYPE_SPICE, NET_TYPE_SPICE,
0, 0, 0, 0,
...@@ -282,7 +282,7 @@ void WinEDA_NetlistFrame::InstallPageSpice() ...@@ -282,7 +282,7 @@ void WinEDA_NetlistFrame::InstallPageSpice()
/*************************************************/ /*************************************************/
void WinEDA_NetlistFrame::InstallCustomPages() void NETLIST_DIALOG::InstallCustomPages()
/*************************************************/ /*************************************************/
/* create the pages for custom netlist format selection: /* create the pages for custom netlist format selection:
...@@ -291,7 +291,7 @@ void WinEDA_NetlistFrame::InstallCustomPages() ...@@ -291,7 +291,7 @@ void WinEDA_NetlistFrame::InstallCustomPages()
bool selected; bool selected;
int ii, CustomCount; int ii, CustomCount;
wxString title, previoustitle, msg; wxString title, previoustitle, msg;
EDA_NoteBookPage* CurrPage; NETLIST_PAGE_DIALOG* CurrPage;
CustomCount = CUSTOMPANEL_COUNTMAX; CustomCount = CUSTOMPANEL_COUNTMAX;
previoustitle = wxT( "dummy_title" ); previoustitle = wxT( "dummy_title" );
...@@ -310,7 +310,7 @@ void WinEDA_NetlistFrame::InstallCustomPages() ...@@ -310,7 +310,7 @@ void WinEDA_NetlistFrame::InstallCustomPages()
if( title.IsEmpty() ) if( title.IsEmpty() )
CurrPage = CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] = m_PanelNetType[PANELCUSTOMBASE + ii] =
new EDA_NoteBookPage( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook,
_( "Add Plugin" ), _( "Add Plugin" ),
NET_TYPE_CUSTOM1 + ii, NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
...@@ -319,7 +319,7 @@ void WinEDA_NetlistFrame::InstallCustomPages() ...@@ -319,7 +319,7 @@ void WinEDA_NetlistFrame::InstallCustomPages()
else /* Install a plugin panel */ else /* Install a plugin panel */
CurrPage = CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] = m_PanelNetType[PANELCUSTOMBASE + ii] =
new EDA_NoteBookPage( m_NoteBook, new NETLIST_PAGE_DIALOG( m_NoteBook,
title, title,
NET_TYPE_CUSTOM1 + ii, NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
...@@ -344,12 +344,11 @@ void WinEDA_NetlistFrame::InstallCustomPages() ...@@ -344,12 +344,11 @@ void WinEDA_NetlistFrame::InstallCustomPages()
} }
/***********************************************************/ /*
void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) * Browse plugin files, add a new panel
/***********************************************************/ * and set m_CommandStringCtrl field
/* Browse the plugin files and set the m_CommandStringCtrl field
*/ */
void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
{ {
wxString FullFileName, Mask, Path; wxString FullFileName, Mask, Path;
...@@ -367,15 +366,23 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) ...@@ -367,15 +366,23 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
EDA_NoteBookPage* CurrPage; NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL ) if( CurrPage == NULL )
return; return;
// Creates a default command line, suitable for external tool xslproc: // 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; 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 ); CurrPage->m_CommandStringCtrl->SetValue( cmdLine );
/* Get a title for this page */ /* Get a title for this page */
...@@ -388,20 +395,20 @@ netlist control 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 /* Called when the check box "default format" is clicked
*/ */
{ {
int ii; int ii;
EDA_NoteBookPage* CurrPage; NETLIST_PAGE_DIALOG* CurrPage;
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ ) for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
if( m_PanelNetType[ii] ) if( m_PanelNetType[ii] )
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( FALSE ); m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( FALSE );
CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage == NULL ) if( CurrPage == NULL )
return; return;
...@@ -411,7 +418,7 @@ void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event ) ...@@ -411,7 +418,7 @@ void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event )
/***********************************************/ /***********************************************/
void WinEDA_NetlistFrame::NetlistUpdateOpt() void NETLIST_DIALOG::NetlistUpdateOpt()
/***********************************************/ /***********************************************/
{ {
int ii; int ii;
...@@ -435,7 +442,7 @@ void WinEDA_NetlistFrame::NetlistUpdateOpt() ...@@ -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 ) ...@@ -452,8 +459,8 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
NetlistUpdateOpt(); NetlistUpdateOpt();
EDA_NoteBookPage* CurrPage; NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
/* Calculate the netlist filename */ /* Calculate the netlist filename */
fn = g_RootSheet->GetScreen()->GetFileName(); fn = g_RootSheet->GetScreen()->GetFileName();
...@@ -556,13 +563,13 @@ Do you want to annotate schematic?" ) ) ) ...@@ -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 ); EndModal( NET_ABORT );
} }
void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event ) void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
{ {
wxFileName fn; wxFileName fn;
wxString ExecFile, CommandLine; wxString ExecFile, CommandLine;
...@@ -580,8 +587,8 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event ) ...@@ -580,8 +587,8 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" ); CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
g_OptNetListUseNames = m_UseNetNamesInNetlist->GetSelection() == 0; g_OptNetListUseNames = m_UseNetNamesInNetlist->GetSelection() == 0;
EDA_NoteBookPage* CurrPage; NETLIST_PAGE_DIALOG* CurrPage;
CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); CurrPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( ! m_Parent->CreateNetlist( CurrPage->m_IdNetType, fn.GetFullPath(), g_OptNetListUseNames ) ) if( ! m_Parent->CreateNetlist( CurrPage->m_IdNetType, fn.GetFullPath(), g_OptNetListUseNames ) )
return; return;
...@@ -591,7 +598,7 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event ) ...@@ -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 ) ...@@ -607,7 +614,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
// Update the new titles // Update the new titles
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ ) 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 ) if( CurrPage == NULL )
break; break;
msg = wxT( "Custom" ); msg = wxT( "Custom" );
...@@ -635,7 +642,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void ) ...@@ -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 ) ...@@ -643,8 +650,8 @@ void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event )
* Remove a panel relative to a netlist plugin * Remove a panel relative to a netlist plugin
*/ */
{ {
EDA_NoteBookPage* CurrPage = NETLIST_PAGE_DIALOG* CurrPage =
(EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString ); CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString );
CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString ); CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString );
...@@ -659,7 +666,7 @@ void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event ) ...@@ -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 ) ...@@ -667,8 +674,8 @@ void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event )
* Validate the panel info relative to a new netlist plugin * Validate the panel info relative to a new netlist plugin
*/ */
{ {
EDA_NoteBookPage* CurrPage = NETLIST_PAGE_DIALOG* CurrPage =
(EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString ) if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString )
{ {
......
...@@ -40,7 +40,7 @@ enum gen_netlist_diag { ...@@ -40,7 +40,7 @@ enum gen_netlist_diag {
/* wxPanels for creating the NoteBook pages for each netlist format: */ /* wxPanels for creating the NoteBook pages for each netlist format: */
class EDA_NoteBookPage : public wxPanel class NETLIST_PAGE_DIALOG : public wxPanel
{ {
public: public:
int m_IdNetType; int m_IdNetType;
...@@ -63,10 +63,10 @@ public: ...@@ -63,10 +63,10 @@ public:
* @param selected = true to have this notebook page selected when the dialog is opened * @param selected = true to have this notebook page selected when the dialog is opened
* Only one page can be created with selected = true. * 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, int id_NetType, int idCheckBox, int idCreateFile,
bool selected ); bool selected );
~EDA_NoteBookPage() { }; ~NETLIST_PAGE_DIALOG() { };
}; };
...@@ -89,19 +89,19 @@ enum TypeNetForm { ...@@ -89,19 +89,19 @@ enum TypeNetForm {
/* Dialog frame for creating netlists */ /* Dialog frame for creating netlists */
class WinEDA_NetlistFrame : public wxDialog class NETLIST_DIALOG : public wxDialog
{ {
public: public:
SCH_EDIT_FRAME* m_Parent; SCH_EDIT_FRAME* m_Parent;
wxNotebook* m_NoteBook; wxNotebook* m_NoteBook;
EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
wxRadioBox* m_UseNetNamesInNetlist; wxRadioBox* m_UseNetNamesInNetlist;
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ); NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
~WinEDA_NetlistFrame() { }; ~NETLIST_DIALOG() { };
private: private:
void InstallCustomPages(); void InstallCustomPages();
...@@ -111,7 +111,7 @@ private: ...@@ -111,7 +111,7 @@ private:
void NetlistUpdateOpt(); void NetlistUpdateOpt();
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void SelectNetlistType( wxCommandEvent& event ); void SelectNetlistType( wxCommandEvent& event );
void SetupPluginData( wxCommandEvent& event ); void AddNewPluginPanel( wxCommandEvent& event );
void DeletePluginPanel( wxCommandEvent& event ); void DeletePluginPanel( wxCommandEvent& event );
void ValidatePluginPanel( wxCommandEvent& event ); void ValidatePluginPanel( wxCommandEvent& event );
......
...@@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event ) ...@@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
do do
{ {
WinEDA_NetlistFrame* dlg = new WinEDA_NetlistFrame( this ); NETLIST_DIALOG* dlg = new NETLIST_DIALOG( this );
i = dlg->ShowModal(); i = dlg->ShowModal();
dlg->Destroy(); dlg->Destroy();
} while( i == NET_PLUGIN_CHANGE ); } while( i == NET_PLUGIN_CHANGE );
......
...@@ -18,14 +18,6 @@ ...@@ -18,14 +18,6 @@
#include "class_gerber_draw_item.h" #include "class_gerber_draw_item.h"
#include "class_GERBER.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) * Function PrintPage (virtual)
...@@ -130,23 +122,10 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -130,23 +122,10 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
int bitmapWidth, bitmapHeight; int bitmapWidth, bitmapHeight;
wxDC* plotDC = aDC; 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 ); aPanel->GetClientSize( &bitmapWidth, &bitmapHeight );
wxBitmap* layerBitmap; wxBitmap* layerBitmap = NULL;
wxBitmap* screenBitmap; wxBitmap* screenBitmap = NULL;
wxMemoryDC layerDC; // used sequentially for each gerber layer wxMemoryDC layerDC; // used sequentially for each gerber layer
wxMemoryDC screenDC; wxMemoryDC screenDC;
...@@ -185,12 +164,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -185,12 +164,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
// layers are drawn in background color. // layers are drawn in background color.
if( gerber->HasNegativeItems() && doBlit ) 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 ) if( aDrawMode == GR_COPY )
{ {
// Use the layer bitmap itself as a mask when blitting. The bitmap // 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 ...@@ -217,12 +190,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
layerDC.Clear(); 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 ) if( gerber->m_ImageNegative )
{ {
// Draw background negative (i.e. in graphic layer color) for negative images. // 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 ...@@ -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 // this is the last transfert to screenDC. If there are no negative items, this is
// the only one // 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 ) if( aDrawMode == GR_COPY )
{ {
layerDC.SelectObject( wxNullBitmap ); layerDC.SelectObject( wxNullBitmap );
...@@ -296,14 +254,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -296,14 +254,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
if( aDrawMode != -1 ) if( aDrawMode != -1 )
{ {
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY ); 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 ); layerDC.SelectObject( wxNullBitmap );
screenDC.SelectObject( wxNullBitmap ); screenDC.SelectObject( wxNullBitmap );
delete layerBitmap; delete layerBitmap;
......
...@@ -20,19 +20,19 @@ ...@@ -20,19 +20,19 @@
#include "richio.h" #include "richio.h"
#include "filter_reader.h" #include "filter_reader.h"
class ModList class FOOTPRINT_ITEM
{ {
public: public:
ModList* Next; FOOTPRINT_ITEM* Next;
wxString m_Name, m_Doc, m_KeyWord; wxString m_Name, m_Doc, m_KeyWord;
public: public:
ModList() FOOTPRINT_ITEM()
{ {
Next = NULL; Next = NULL;
} }
~ModList() ~FOOTPRINT_ITEM()
{ {
} }
}; };
...@@ -42,7 +42,7 @@ static void DisplayCmpDoc( wxString& Name ); ...@@ -42,7 +42,7 @@ static void DisplayCmpDoc( wxString& Name );
static void ReadDocLib( const wxString& ModLibName ); static void ReadDocLib( const wxString& ModLibName );
static ModList* MList; static FOOTPRINT_ITEM* MList;
/** /**
* Function Load_Module_From_BOARD * Function Load_Module_From_BOARD
...@@ -373,7 +373,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -373,7 +373,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
char* Line; char* Line;
wxFileName fn; wxFileName fn;
static wxString OldName; /* Save the name of the last module loaded. */ static wxString OldName; /* Save the name of the last module loaded. */
wxString CmpName, tmp; wxString CmpName;
wxString libFullName;
FILE* file; FILE* file;
wxString msg; wxString msg;
wxArrayString itemslist; wxArrayString itemslist;
...@@ -392,9 +393,9 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -392,9 +393,9 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
else else
fn = aLibraryFullFilename; 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." ), msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
GetChars( fn.GetFullName() ) ); GetChars( fn.GetFullName() ) );
...@@ -403,7 +404,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -403,7 +404,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue; continue;
} }
ReadDocLib( tmp ); ReadDocLib( libFullName );
if( !aKeyWord.IsEmpty() ) /* Don't read the library if selection if( !aKeyWord.IsEmpty() ) /* Don't read the library if selection
* by keywords, already read. */ * by keywords, already read. */
...@@ -413,7 +414,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -413,7 +414,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue; continue;
} }
file = wxFopen( tmp, wxT( "rt" ) ); file = wxFopen( libFullName, wxT( "rt" ) );
if( file == NULL ) if( file == NULL )
{ {
...@@ -422,7 +423,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -422,7 +423,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue; continue;
} }
FILE_LINE_READER fileReader( file, tmp ); FILE_LINE_READER fileReader( file, libFullName );
FILTER_READER reader( fileReader ); FILTER_READER reader( fileReader );
...@@ -437,9 +438,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -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 ) if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
{ {
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ), msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ),
GetChars( tmp ) ); GetChars( libFullName ) );
wxMessageBox( msg, _( "Library Load Error" ), wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
wxOK | wxICON_ERROR, this );
continue; continue;
} }
...@@ -478,7 +478,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -478,7 +478,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
/* Create list of modules if search by keyword. */ /* Create list of modules if search by keyword. */
if( !aKeyWord.IsEmpty() ) if( !aKeyWord.IsEmpty() )
{ {
ModList* ItemMod = MList; FOOTPRINT_ITEM* ItemMod = MList;
while( ItemMod != NULL ) while( ItemMod != NULL )
{ {
if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) ) if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) )
...@@ -502,7 +502,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -502,7 +502,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
while( MList != NULL ) while( MList != NULL )
{ {
ModList* NewMod = MList->Next; FOOTPRINT_ITEM* NewMod = MList->Next;
delete MList; delete MList;
MList = NewMod; MList = NewMod;
} }
...@@ -519,7 +519,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -519,7 +519,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
*/ */
static void DisplayCmpDoc( wxString& Name ) static void DisplayCmpDoc( wxString& Name )
{ {
ModList* Mod = MList; FOOTPRINT_ITEM* Mod = MList;
if( !Mod ) if( !Mod )
{ {
...@@ -551,7 +551,7 @@ static void DisplayCmpDoc( wxString& Name ) ...@@ -551,7 +551,7 @@ static void DisplayCmpDoc( wxString& Name )
*/ */
static void ReadDocLib( const wxString& ModLibName ) static void ReadDocLib( const wxString& ModLibName )
{ {
ModList* NewMod; FOOTPRINT_ITEM* NewMod;
char* Line; char* Line;
FILE* LibDoc; FILE* LibDoc;
wxFileName fn = ModLibName; wxFileName fn = ModLibName;
...@@ -579,7 +579,7 @@ static void ReadDocLib( const wxString& ModLibName ) ...@@ -579,7 +579,7 @@ static void ReadDocLib( const wxString& ModLibName )
break; ; break; ;
if( Line[1] == 'M' ) /* Debut decription 1 module */ if( Line[1] == 'M' ) /* Debut decription 1 module */
{ {
NewMod = new ModList(); NewMod = new FOOTPRINT_ITEM();
NewMod->Next = MList; NewMod->Next = MList;
MList = NewMod; MList = NewMod;
while( reader.ReadLine() ) while( reader.ReadLine() )
......
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