From 72357970aaa73dec31f6632eb4404a9c8ca5b298 Mon Sep 17 00:00:00 2001 From: charras Date: Sat, 22 Mar 2008 18:08:44 +0000 Subject: [PATCH] Netlist dialog redesigned, netlist.cpp code modified --- change_log.txt | 8 + eeschema/onrightclick.cpp | 4 +- include/wxPcbStruct.h | 2 +- pcbnew/dialog_netlist.cpp | 204 +++++++--- pcbnew/dialog_netlist.h | 64 ++-- pcbnew/dialog_netlist.pjd | 765 ++++++++++++++++++++++++++------------ pcbnew/edit.cpp | 4 +- pcbnew/modules.cpp | 28 +- pcbnew/netlist.cpp | 470 +++++++++++++---------- pcbnew/pcbnew.h | 3 +- pcbnew/ratsnest.cpp | 49 +-- pcbnew/xchgmod.cpp | 12 +- share/dialog_print.cpp | 65 ++-- share/dialog_print.h | 5 +- share/dialog_print.pjd | 225 +++++++++-- 15 files changed, 1290 insertions(+), 618 deletions(-) diff --git a/change_log.txt b/change_log.txt index be7ed235e0..cb0e178e80 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Mar-21 UPDATE Jean-Pierre Charras +================================================================================ ++pcbnew + Netlist dialog redesigned, netlist.cpp code modified + and added an option to remove not locked footprints + when not found in netlist + + 2008-Mar-21 UPDATE Dick Hollenbeck ================================================================================ +pcbnew diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 16277185bd..c49a712ded 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -298,7 +298,9 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) if( !Component->m_Flags ) { - msg = AddHotkeyName( _( "Move Component" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT ); + msg = _( "Move Component" ); + msg << wxT(" ") << Component->GetFieldValue( REFERENCE ); + msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST, msg, move_xpm ); msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG_COMPONENT ); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index e5f64ec5f2..c7b3893a79 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -441,7 +441,7 @@ public: // Footprint edition (see also WinEDA_BasePcbFrame) void StartMove_Module( MODULE* module, wxDC* DC ); - bool Delete_Module( MODULE* module, wxDC* DC ); + bool Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting ); // loading modules: see WinEDA_BasePcbFrame diff --git a/pcbnew/dialog_netlist.cpp b/pcbnew/dialog_netlist.cpp index fd1fab15fe..1818effa4c 100644 --- a/pcbnew/dialog_netlist.cpp +++ b/pcbnew/dialog_netlist.cpp @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////// + // Name: dialog_netlist.cpp -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 26/02/2006 17:42:19 -// RCS-ID: +// RCS-ID: // Copyright: License GNU -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 26/02/2006 17:42:19 - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -31,6 +31,8 @@ ////@begin XPM images ////@end XPM images +static bool DisplayWarning; + /*! * WinEDA_NetlistFrame type definition */ @@ -62,36 +64,55 @@ END_EVENT_TABLE() * WinEDA_NetlistFrame constructors */ -WinEDA_NetlistFrame::WinEDA_NetlistFrame( ) +WinEDA_NetlistFrame::WinEDA_NetlistFrame() { } -WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_PcbFrame* parent, wxDC * DC, - wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) + +WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_PcbFrame* parent, + wxDC* DC, + const wxString& aNetlistFilename, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style ) { m_Parent = parent; m_DC = DC; - /* Setup the NETLIST file name according to the board file name */ - NetNameBuffer = m_Parent->m_CurrentScreen->m_FileName; - ChangeFileNameExt(NetNameBuffer, NetExtBuffer); - Create(parent, id, caption, pos, size, style); + Create( parent, id, caption, pos, size, style ); - wxString title = GetTitle() + NetNameBuffer; - SetTitle(title); + m_NetlistFilenameCtrl->SetValue( aNetlistFilename ); +} + + +/*! + * WinEDA_NetlistFrame destructor + */ + +WinEDA_NetlistFrame::~WinEDA_NetlistFrame() +{ } /*! * WinEDA_NetlistFrame creator */ -bool WinEDA_NetlistFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +bool WinEDA_NetlistFrame::Create( wxWindow* parent, + wxWindowID id, + const wxString& caption, + const wxPoint& pos, + const wxSize& size, + long style ) { ////@begin WinEDA_NetlistFrame member initialisation m_Select_By_Timestamp = NULL; + m_ChangeExistingFootprintCtrl = NULL; m_DeleteBadTracks = NULL; - m_ChangeExistantModuleCtrl = NULL; m_DisplayWarningCtrl = NULL; + m_RemoveExtraFootprintsCtrl = NULL; + m_NetlistFilenameCtrl = NULL; m_MessageWindow = NULL; StdDialogButtonSizer = NULL; ////@end WinEDA_NetlistFrame member initialisation @@ -110,15 +131,17 @@ bool WinEDA_NetlistFrame::Create( wxWindow* parent, wxWindowID id, const wxStrin return true; } + /*! * Control creation for WinEDA_NetlistFrame */ void WinEDA_NetlistFrame::CreateControls() -{ +{ SetFont( *g_DialogFont ); + ////@begin WinEDA_NetlistFrame content construction - // Generated by DialogBlocks, 13/11/2007 15:31:19 (unregistered) + // Generated by DialogBlocks, 22/03/2008 18:44:52 (unregistered) WinEDA_NetlistFrame* itemDialog1 = this; @@ -128,67 +151,103 @@ void WinEDA_NetlistFrame::CreateControls() wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); - wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); + wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW|wxALL, 5); + wxArrayString m_Select_By_TimestampStrings; m_Select_By_TimestampStrings.Add(_("Reference")); m_Select_By_TimestampStrings.Add(_("Timestamp")); - m_Select_By_Timestamp = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Module Selection:"), wxDefaultPosition, wxDefaultSize, m_Select_By_TimestampStrings, 1, wxRA_SPECIFY_COLS ); + m_Select_By_Timestamp = new wxRadioBox( itemDialog1, ID_SELECTION_FOOTPRINT_MODE, _("Module Selection:"), wxDefaultPosition, wxDefaultSize, m_Select_By_TimestampStrings, 1, wxRA_SPECIFY_COLS ); m_Select_By_Timestamp->SetSelection(0); - itemBoxSizer4->Add(m_Select_By_Timestamp, 0, wxGROW|wxALL, 5); + if (WinEDA_NetlistFrame::ShowToolTips()) + m_Select_By_Timestamp->SetToolTip(_("Select how footprints are reconized:\nby their reference (U1, R3...) (normal setting)\nor their time stamp (special setting after a full schematic reannotation)")); + itemBoxSizer5->Add(m_Select_By_Timestamp, 0, wxGROW|wxALL, 5); + + wxArrayString m_ChangeExistingFootprintCtrlStrings; + m_ChangeExistingFootprintCtrlStrings.Add(_("Keep")); + m_ChangeExistingFootprintCtrlStrings.Add(_("Change")); + m_ChangeExistingFootprintCtrl = new wxRadioBox( itemDialog1, ID_KEEP_OR_CHANGE_FOOTPRINTS, _("Exchange Module:"), wxDefaultPosition, wxDefaultSize, m_ChangeExistingFootprintCtrlStrings, 1, wxRA_SPECIFY_COLS ); + m_ChangeExistingFootprintCtrl->SetSelection(0); + if (WinEDA_NetlistFrame::ShowToolTips()) + m_ChangeExistingFootprintCtrl->SetToolTip(_("Keep or change an existing footprint when the netlist gives a different footprint")); + itemBoxSizer5->Add(m_ChangeExistingFootprintCtrl, 0, wxGROW|wxALL, 5); + + itemBoxSizer4->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer4->Add(itemBoxSizer9, 0, wxGROW|wxALL, 5); wxArrayString m_DeleteBadTracksStrings; m_DeleteBadTracksStrings.Add(_("Keep")); m_DeleteBadTracksStrings.Add(_("Delete")); - m_DeleteBadTracks = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Bad Tracks Deletion:"), wxDefaultPosition, wxDefaultSize, m_DeleteBadTracksStrings, 1, wxRA_SPECIFY_COLS ); + m_DeleteBadTracks = new wxRadioBox( itemDialog1, ID_DELETE_TRACKS_OPTION, _("Bad Tracks Deletion:"), wxDefaultPosition, wxDefaultSize, m_DeleteBadTracksStrings, 1, wxRA_SPECIFY_COLS ); m_DeleteBadTracks->SetSelection(0); - itemBoxSizer4->Add(m_DeleteBadTracks, 0, wxGROW|wxALL, 5); + if (WinEDA_NetlistFrame::ShowToolTips()) + m_DeleteBadTracks->SetToolTip(_("Keep or delete bad tracks after a netlist change")); + itemBoxSizer9->Add(m_DeleteBadTracks, 0, wxGROW|wxALL, 5); - wxArrayString m_ChangeExistantModuleCtrlStrings; - m_ChangeExistantModuleCtrlStrings.Add(_("Keep")); - m_ChangeExistantModuleCtrlStrings.Add(_("Change")); - m_ChangeExistantModuleCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Exchange Module:"), wxDefaultPosition, wxDefaultSize, m_ChangeExistantModuleCtrlStrings, 1, wxRA_SPECIFY_COLS ); - m_ChangeExistantModuleCtrl->SetSelection(0); - itemBoxSizer4->Add(m_ChangeExistantModuleCtrl, 0, wxGROW|wxALL, 5); + wxStaticBox* itemStaticBoxSizer11Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options")); + wxStaticBoxSizer* itemStaticBoxSizer11 = new wxStaticBoxSizer(itemStaticBoxSizer11Static, wxVERTICAL); + itemBoxSizer9->Add(itemStaticBoxSizer11, 0, wxGROW|wxALL, 5); - m_DisplayWarningCtrl = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Display Warnings"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + m_DisplayWarningCtrl = new wxCheckBox( itemDialog1, ID_DISPLAY_WARNINGS_OPT, _("Display Warnings"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_DisplayWarningCtrl->SetValue(false); - itemBoxSizer4->Add(m_DisplayWarningCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); + itemStaticBoxSizer11->Add(m_DisplayWarningCtrl, 0, wxGROW|wxALL, 5); + + m_RemoveExtraFootprintsCtrl = new wxCheckBox( itemDialog1, ID_REMOVE_EXTRA_FOOTPRINTS_OPT, _("Remove Extra Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + m_RemoveExtraFootprintsCtrl->SetValue(false); + if (WinEDA_NetlistFrame::ShowToolTips()) + m_RemoveExtraFootprintsCtrl->SetToolTip(_("Remove footprints found on the Board but not in netlist\nNote: only not locked footprints will be removed")); + itemStaticBoxSizer11->Add(m_RemoveExtraFootprintsCtrl, 0, wxGROW|wxALL, 5); itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); + wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer3->Add(itemBoxSizer15, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxButton* itemButton11 = new wxButton( itemDialog1, ID_OPEN_NELIST, _("Select"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton11->SetForegroundColour(wxColour(217, 0, 0)); - itemBoxSizer10->Add(itemButton11, 0, wxGROW|wxALL, 5); + wxButton* itemButton16 = new wxButton( itemDialog1, ID_OPEN_NELIST, _("Browse Netlist Files"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton16->SetForegroundColour(wxColour(217, 0, 0)); + itemBoxSizer15->Add(itemButton16, 0, wxGROW|wxALL, 5); - wxButton* itemButton12 = new wxButton( itemDialog1, ID_READ_NETLIST_FILE, _("Read"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton12->SetForegroundColour(wxColour(0, 128, 0)); - itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5); + wxButton* itemButton17 = new wxButton( itemDialog1, ID_READ_NETLIST_FILE, _("Read Current Netlist"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton17->SetForegroundColour(wxColour(0, 128, 0)); + itemBoxSizer15->Add(itemButton17, 0, wxGROW|wxALL, 5); - wxButton* itemButton13 = new wxButton( itemDialog1, ID_TEST_NETLIST, _("Module Test"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton13->SetForegroundColour(wxColour(0, 128, 128)); - itemBoxSizer10->Add(itemButton13, 0, wxGROW|wxALL, 5); + wxButton* itemButton18 = new wxButton( itemDialog1, ID_TEST_NETLIST, _("Footprints Test"), wxDefaultPosition, wxDefaultSize, 0 ); + if (WinEDA_NetlistFrame::ShowToolTips()) + itemButton18->SetToolTip(_("Read the current neltist file and list missing and extra footprints")); + itemButton18->SetForegroundColour(wxColour(0, 128, 128)); + itemBoxSizer15->Add(itemButton18, 0, wxGROW|wxALL, 5); - wxButton* itemButton14 = new wxButton( itemDialog1, ID_COMPILE_RATSNEST, _("Compile"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton14->SetForegroundColour(wxColour(0, 0, 132)); - itemBoxSizer10->Add(itemButton14, 0, wxGROW|wxALL, 5); + wxButton* itemButton19 = new wxButton( itemDialog1, ID_COMPILE_RATSNEST, _("Rebuild Board Connectivity"), wxDefaultPosition, wxDefaultSize, 0 ); + if (WinEDA_NetlistFrame::ShowToolTips()) + itemButton19->SetToolTip(_("Rebuild the full ratsnest (usefull after a manual pad netname edition)")); + itemButton19->SetForegroundColour(wxColour(0, 0, 132)); + itemBoxSizer15->Add(itemButton19, 0, wxGROW|wxALL, 5); + + wxStaticBox* itemStaticBoxSizer20Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Netlist File:")); + wxStaticBoxSizer* itemStaticBoxSizer20 = new wxStaticBoxSizer(itemStaticBoxSizer20Static, wxVERTICAL); + itemStaticBoxSizer20Static->SetForegroundColour(wxColour(0, 0, 255)); + itemBoxSizer2->Add(itemStaticBoxSizer20, 0, wxGROW|wxALL, 5); + + m_NetlistFilenameCtrl = new wxTextCtrl( itemDialog1, ID_TEXT_NETLIST_FILENAME, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + itemStaticBoxSizer20->Add(m_NetlistFilenameCtrl, 0, wxGROW|wxALL, 5); m_MessageWindow = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 120), wxTE_MULTILINE|wxTE_READONLY ); itemBoxSizer2->Add(m_MessageWindow, 1, wxGROW|wxALL, 10); - wxStaticLine* itemStaticLine16 = new wxStaticLine( itemDialog1, ID_STATICLINE, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemBoxSizer2->Add(itemStaticLine16, 0, wxGROW|wxLEFT|wxRIGHT, 5); + wxStaticLine* itemStaticLine23 = new wxStaticLine( itemDialog1, ID_STATICLINE, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + itemBoxSizer2->Add(itemStaticLine23, 0, wxGROW|wxLEFT|wxRIGHT, 5); StdDialogButtonSizer = new wxStdDialogButtonSizer; itemBoxSizer2->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10); - wxButton* itemButton18 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton18->SetForegroundColour(wxColour(0, 0, 255)); - StdDialogButtonSizer->AddButton(itemButton18); + wxButton* itemButton25 = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + itemButton25->SetForegroundColour(wxColour(0, 0, 255)); + StdDialogButtonSizer->AddButton(itemButton25); StdDialogButtonSizer->Realize(); @@ -197,6 +256,7 @@ void WinEDA_NetlistFrame::CreateControls() ////@end WinEDA_NetlistFrame content construction } + /*! * Should we show tooltips? */ @@ -206,6 +266,7 @@ bool WinEDA_NetlistFrame::ShowToolTips() return true; } + /*! * Get bitmap resources */ @@ -219,6 +280,7 @@ wxBitmap WinEDA_NetlistFrame::GetBitmapResource( const wxString& name ) ////@end WinEDA_NetlistFrame bitmap retrieval } + /*! * Get icon resources */ @@ -231,42 +293,76 @@ wxIcon WinEDA_NetlistFrame::GetIconResource( const wxString& name ) return wxNullIcon; ////@end WinEDA_NetlistFrame icon retrieval } + + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_OPEN_NELIST */ void WinEDA_NetlistFrame::OnOpenNelistClick( wxCommandEvent& event ) { - Set_NetlisteName(event); + wxString fullfilename, mask( wxT( "*" ) ); + + fullfilename = m_NetlistFilenameCtrl->GetValue(); + mask += NetExtBuffer; + + fullfilename = EDA_FileSelector( _( "Netlist Selection:" ), + wxEmptyString, /* Chemin par defaut */ + fullfilename, /* nom fichier par defaut */ + NetExtBuffer, /* extension par defaut */ + mask, /* Masque d'affichage */ + this, + 0, + TRUE + ); + + if( fullfilename.IsEmpty() ) + return; + m_NetlistFilenameCtrl->SetValue( fullfilename ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_READ_NETLIST_FILE */ void WinEDA_NetlistFrame::OnReadNetlistFileClick( wxCommandEvent& event ) { - ReadPcbNetlist(event); + wxString CmpFullFileName; + CmpFullFileName = m_NetlistFilenameCtrl->GetValue(); + ChangeFileNameExt( CmpFullFileName, NetCmpExtBuffer ); + + ReadPcbNetlist( m_Parent, m_NetlistFilenameCtrl->GetValue(), + CmpFullFileName, + m_MessageWindow, + m_ChangeExistingFootprintCtrl->GetSelection() == 1 ? TRUE : FALSE, + m_DeleteBadTracks->GetSelection() == 1 ? TRUE : FALSE, + m_RemoveExtraFootprintsCtrl->IsChecked(), + m_Select_By_Timestamp->GetSelection() == 1 ? TRUE : FALSE, + m_DisplayWarningCtrl->IsChecked()); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_TEST_NETLIST */ void WinEDA_NetlistFrame::OnTestNetlistClick( wxCommandEvent& event ) { - ModulesControle(event); + TestFor_Duplicate_Missing_And_Extra_Footprints( this, m_NetlistFilenameCtrl->GetValue(), m_Parent->m_Pcb); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMPILE_RATSNEST */ void WinEDA_NetlistFrame::OnCompileRatsnestClick( wxCommandEvent& event ) { - m_Parent->Compile_Ratsnest(m_DC, TRUE); + m_Parent->Compile_Ratsnest( m_DC, TRUE ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ diff --git a/pcbnew/dialog_netlist.h b/pcbnew/dialog_netlist.h index 7af6e84845..b229f50824 100644 --- a/pcbnew/dialog_netlist.h +++ b/pcbnew/dialog_netlist.h @@ -1,12 +1,13 @@ ///////////////////////////////////////////////////////////////////////////// + // Name: dialog_netlist.h -// Purpose: +// Purpose: // Author: jean-pierre Charras -// Modified by: +// Modified by: // Created: 26/02/2006 17:42:19 -// RCS-ID: +// RCS-ID: // Copyright: License GNU -// Licence: +// Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), 26/02/2006 17:42:19 @@ -14,7 +15,6 @@ #ifndef _DIALOG_NETLIST_H_ #define _DIALOG_NETLIST_H_ - /*! * Includes */ @@ -38,18 +38,20 @@ class wxStdDialogButtonSizer; ////@begin control identifiers #define ID_DIALOG 10000 -#define ID_RADIOBOX 10005 -#define ID_RADIOBOX1 10006 -#define ID_RADIOBOX2 10007 -#define ID_CHECKBOX 10008 +#define ID_SELECTION_FOOTPRINT_MODE 10005 +#define ID_KEEP_OR_CHANGE_FOOTPRINTS 10007 +#define ID_DELETE_TRACKS_OPTION 10006 +#define ID_DISPLAY_WARNINGS_OPT 10008 +#define ID_REMOVE_EXTRA_FOOTPRINTS_OPT 10011 #define ID_OPEN_NELIST 10001 #define ID_READ_NETLIST_FILE 10002 #define ID_TEST_NETLIST 10003 #define ID_COMPILE_RATSNEST 10004 +#define ID_TEXT_NETLIST_FILENAME 10012 #define ID_TEXTCTRL 10009 #define ID_STATICLINE 10010 #define SYMBOL_WINEDA_NETLISTFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER -#define SYMBOL_WINEDA_NETLISTFRAME_TITLE _("Netlist: ") +#define SYMBOL_WINEDA_NETLISTFRAME_TITLE _("Netlist Dialog") #define SYMBOL_WINEDA_NETLISTFRAME_IDNAME ID_DIALOG #define SYMBOL_WINEDA_NETLISTFRAME_SIZE wxSize(400, 300) #define SYMBOL_WINEDA_NETLISTFRAME_POSITION wxDefaultPosition @@ -63,24 +65,33 @@ class wxStdDialogButtonSizer; #define wxCLOSE_BOX 0x1000 #endif + /*! * WinEDA_NetlistFrame class declaration */ class WinEDA_NetlistFrame: public wxDialog -{ +{ DECLARE_DYNAMIC_CLASS( WinEDA_NetlistFrame ) DECLARE_EVENT_TABLE() public: /// Constructors - WinEDA_NetlistFrame( ); - WinEDA_NetlistFrame( WinEDA_PcbFrame* parent,wxDC * DC, - wxWindowID id = SYMBOL_WINEDA_NETLISTFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_NETLISTFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_NETLISTFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_NETLISTFRAME_SIZE, long style = SYMBOL_WINEDA_NETLISTFRAME_STYLE ); + WinEDA_NetlistFrame(); + WinEDA_NetlistFrame(WinEDA_PcbFrame* parent, + wxDC* DC, + const wxString& aNetlistFilename, + wxWindowID id = SYMBOL_WINEDA_NETLISTFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_NETLISTFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_NETLISTFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_NETLISTFRAME_SIZE, long style = SYMBOL_WINEDA_NETLISTFRAME_STYLE ); /// Creation bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_NETLISTFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_NETLISTFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_NETLISTFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_NETLISTFRAME_SIZE, long style = SYMBOL_WINEDA_NETLISTFRAME_STYLE ); + /// Destructor + ~WinEDA_NetlistFrame(); + + /// Initialises member variables + void Init(); + /// Creates the controls and sizers void CreateControls(); @@ -115,31 +126,20 @@ public: /// Should we show tooltips? static bool ShowToolTips(); - void ReadPcbNetlist(wxCommandEvent& event); - void Set_NetlisteName(wxCommandEvent& event); - bool OpenNetlistFile(wxCommandEvent& event); - int BuildListeNetModules(wxCommandEvent& event, wxArrayString & BufName); - void ModulesControle(wxCommandEvent& event); - int ReadListeModules(const wxString * RefCmp, long TimeStamp, wxString & NameModule); - int SetPadNetName( char * Line, MODULE * Module); - MODULE * ReadNetModule( char * Text, int * UseFichCmp, int TstOnly); - void AddToList(const wxString & NameLibCmp, - const wxString & NameCmp, - int TimeStamp, - const wxString& path); - void LoadListeModules(wxDC *DC); - ////@begin WinEDA_NetlistFrame member variables wxRadioBox* m_Select_By_Timestamp; + wxRadioBox* m_ChangeExistingFootprintCtrl; wxRadioBox* m_DeleteBadTracks; - wxRadioBox* m_ChangeExistantModuleCtrl; wxCheckBox* m_DisplayWarningCtrl; + wxCheckBox* m_RemoveExtraFootprintsCtrl; + wxTextCtrl* m_NetlistFilenameCtrl; wxTextCtrl* m_MessageWindow; wxStdDialogButtonSizer* StdDialogButtonSizer; ////@end WinEDA_NetlistFrame member variables - WinEDA_PcbFrame * m_Parent; - wxDC * m_DC; + WinEDA_PcbFrame* m_Parent; + wxDC* m_DC; }; #endif - // _DIALOG_NETLIST_H_ + +// _DIALOG_NETLIST_H_ diff --git a/pcbnew/dialog_netlist.pjd b/pcbnew/dialog_netlist.pjd index 963f15f9ea..baa5a445b1 100644 --- a/pcbnew/dialog_netlist.pjd +++ b/pcbnew/dialog_netlist.pjd @@ -108,10 +108,12 @@ 0 0 1 + 0 1 1 0 1 + 0 @@ -199,7 +201,7 @@ 0 1 - "Netlist: " + "Netlist Dialog" "dialog-document" "" "dialog" @@ -224,7 +226,7 @@ "dialog_netlist.cpp" "dialog_netlist.h" "" - "Netlist: " + "Netlist Dialog" 1 "" 0 @@ -246,7 +248,6 @@ 1 0 1 - 0 0 0 0 @@ -319,7 +320,7 @@ 0 "<Any platform>" - "wxBoxSizer V" + "wxBoxSizer H" "dialog-control-document" "" "sizer" @@ -329,7 +330,7 @@ 0 "26/3/2006" "wbBoxSizerProxy" - "Vertical" + "Horizontal" "" "Centre" "Centre" @@ -344,56 +345,20 @@ 0 "<Any platform>" - "wxRadioBox: ID_RADIOBOX" + "wxBoxSizer V" "dialog-control-document" "" - "radiobox" + "sizer" 0 1 0 0 - "26/3/2006" - "wbRadioBoxProxy" - "ID_RADIOBOX" - 10005 - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_Select_By_Timestamp" - "Module Selection:" - 1 - "Reference|Timestamp" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" + "22/3/2008" + "wbBoxSizerProxy" + "Vertical" + "" + "Centre" + "Expand" 0 5 1 @@ -403,60 +368,179 @@ 0 0 0 - "" - "" + "<Any platform>" + + "wxRadioBox: ID_SELECTION_FOOTPRINT_MODE" + "dialog-control-document" + "" + "radiobox" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbRadioBoxProxy" + "ID_SELECTION_FOOTPRINT_MODE" + 10005 + "" + "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" + "m_Select_By_Timestamp" + "Module Selection:" + 1 + "Reference|Timestamp" + 0 + "" + "Select how footprints are reconized: +by their reference (U1, R3...) (normal setting) +or their time stamp (special setting after a full schematic reannotation)" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxRadioBox: ID_KEEP_OR_CHANGE_FOOTPRINTS" + "dialog-control-document" + "" + "radiobox" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbRadioBoxProxy" + "ID_KEEP_OR_CHANGE_FOOTPRINTS" + 10007 + "" + "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" + "m_ChangeExistingFootprintCtrl" + "Exchange Module:" + 1 + "Keep|Change" + 0 + "" + "Keep or change an existing footprint when the netlist gives a different footprint" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + - "wxRadioBox: ID_RADIOBOX1" + "Spacer" "dialog-control-document" "" - "radiobox" + "spacer" 0 1 0 0 - "26/3/2006" - "wbRadioBoxProxy" - "ID_RADIOBOX1" - 10006 - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_DeleteBadTracks" - "Bad Tracks Deletion:" - 1 - "Keep|Delete" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" + "22/3/2008" + "wbSpacerProxy" + 5 + 5 + "Centre" "Centre" + 1 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + + + "wxBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbBoxSizerProxy" + "Vertical" + "" + "Centre" + "Expand" 0 5 1 @@ -466,134 +550,235 @@ 0 0 0 - "" - "" - - - "wxRadioBox: ID_RADIOBOX2" - "dialog-control-document" - "" - "radiobox" - 0 - 1 - 0 - 0 - "26/3/2006" - "wbRadioBoxProxy" - "ID_RADIOBOX2" - 10007 - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_ChangeExistantModuleCtrl" - "Exchange Module:" - 1 - "Keep|Change" - 0 - "" - "" - "" - "" - "" - 0 - 1 "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "26/3/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX" - 10008 - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_DisplayWarningCtrl" - "Display Warnings" - 0 - "" - "" - "DisplayWarning" - "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - "" - "" + + "wxRadioBox: ID_DELETE_TRACKS_OPTION" + "dialog-control-document" + "" + "radiobox" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbRadioBoxProxy" + "ID_DELETE_TRACKS_OPTION" + 10006 + "" + "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" + "m_DeleteBadTracks" + "Bad Tracks Deletion:" + 1 + "Keep|Delete" + 0 + "" + "Keep or delete bad tracks after a netlist change" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxStaticBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbStaticBoxSizerProxy" + "wxID_ANY" + -1 + "Options" + "" + "" + "" + "" + 0 + 1 + "wxStaticBox" + "Vertical" + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + + "wxCheckBox: ID_DISPLAY_WARNINGS_OPT" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbCheckBoxProxy" + "ID_DISPLAY_WARNINGS_OPT" + 10008 + "" + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_DisplayWarningCtrl" + "Display Warnings" + 0 + "" + "" + "DisplayWarning" + "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 1 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + + "wxCheckBox: ID_REMOVE_EXTRA_FOOTPRINTS_OPT" + "dialog-control-document" + "" + "checkbox" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbCheckBoxProxy" + "ID_REMOVE_EXTRA_FOOTPRINTS_OPT" + 10011 + "" + "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" + "m_RemoveExtraFootprintsCtrl" + "Remove Extra Footprints" + 0 + "" + "Remove footprints found on the Board but not in netlist +Note: only not locked footprints will be removed" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + @@ -661,6 +846,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnOpenNelistClick|||" "ID_OPEN_NELIST" 10001 + "" "wxButton" "wxButton" 1 @@ -668,7 +854,7 @@ "" "" "" - "Select" + "Browse Netlist Files" 0 "" "" @@ -727,6 +913,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnReadNetlistFileClick" "ID_READ_NETLIST_FILE" 10002 + "" "wxButton" "wxButton" 1 @@ -734,7 +921,7 @@ "" "" "" - "Read" + "Read Current Netlist" 0 "" "" @@ -793,6 +980,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnTestNetlistClick" "ID_TEST_NETLIST" 10003 + "" "wxButton" "wxButton" 1 @@ -800,10 +988,10 @@ "" "" "" - "Module Test" + "Footprints Test" 0 "" - "" + "Read the current neltist file and list missing and extra footprints" "" "" "" @@ -859,6 +1047,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnCompileRatsnestClick" "ID_COMPILE_RATSNEST" 10004 + "" "wxButton" "wxButton" 1 @@ -866,10 +1055,10 @@ "" "" "" - "Compile" + "Rebuild Board Connectivity" 0 "" - "" + "Rebuild the full ratsnest (usefull after a manual pad netname edition)" "" "" "" @@ -913,6 +1102,123 @@ + + "wxStaticBoxSizer V" + "dialog-control-document" + "" + "sizer" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbStaticBoxSizerProxy" + "wxID_ANY" + -1 + "Netlist File:" + "" + "" + "0000FF" + "" + 0 + 1 + "wxStaticBox" + "Vertical" + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "<Any platform>" + + "wxTextCtrl: ID_TEXT_NETLIST_FILENAME" + "dialog-control-document" + "" + "textctrl" + 0 + 1 + 0 + 0 + "22/3/2008" + "wbTextCtrlProxy" + "ID_TEXT_NETLIST_FILENAME" + 10012 + "" + "wxTextCtrl" + "wxTextCtrl" + 1 + 0 + "" + "" + "m_NetlistFilenameCtrl" + "" + 0 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + "" + "" + + "wxTextCtrl: ID_TEXTCTRL" "dialog-control-document" @@ -926,6 +1232,7 @@ "wbTextCtrlProxy" "ID_TEXTCTRL" 10009 + "" "wxTextCtrl" "wxTextCtrl" 1 @@ -1007,6 +1314,7 @@ "wbStaticLineProxy" "ID_STATICLINE" 10010 + "" "wxStaticLine" "wxStaticLine" 1 @@ -1094,6 +1402,7 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick|NONE||" "wxID_CANCEL" 5101 + "" "wxButton" "wxButton" 1 @@ -1101,7 +1410,7 @@ "" "" "" - "&Cancel" + "&Close" 0 "" "" diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index d18caf1e1b..08b279d483 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -592,7 +592,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE ) break; - if( Delete_Module( (MODULE*) GetCurItem(), &dc ) ) + if( Delete_Module( (MODULE*) GetCurItem(), &dc, true ) ) { SetCurItem( NULL ); } @@ -1023,7 +1023,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) switch( Item->Type() ) { case TYPEMODULE: - Delete_Module( (MODULE*) Item, DC ); + Delete_Module( (MODULE*) Item, DC, true ); break; case TYPECOTATION: diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index f37276cbae..1c992a7f2f 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -263,9 +263,9 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) } -/**************************************************************/ -bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC ) -/**************************************************************/ +/*****************************************************************************************/ +bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting ) +/******************************************************************************************/ /** * Function Delete Module @@ -273,6 +273,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC ) * The net rastenes and pad list are recalcualed * @param module = footprint to delete * @param DC = currentDevice Context. if NULL: do not redraw new ratsnets and dirty rectange + * @param aPromptBeforeDeleting : if true: ask for confirmation before deleting */ { EDA_BaseStruct* PtBack, * PtNext; @@ -285,12 +286,15 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC ) /* Confirmation de l'effacement */ module->Display_Infos( this ); - msg << _( "Delete Module" ) << wxT( " " ) << module->m_Reference->m_Text - << wxT( " (" ) << _( "Value " ) << module->m_Value->m_Text - << wxT( ") ?" ); - if( !IsOK( this, msg ) ) + if ( aAskBeforeDeleting ) { - return FALSE; + msg << _( "Delete Module" ) << wxT( " " ) << module->m_Reference->m_Text + << wxT( " (" ) << _( "Value " ) << module->m_Value->m_Text + << wxT( ") ?" ); + if( !IsOK( this, msg ) ) + { + return FALSE; + } } m_CurrentScreen->SetModify(); @@ -332,7 +336,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC ) void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) /****************************************************************************/ -/** +/** * Function Change_Side_Module * Filp a footprint (switch layer from component or component to copper) * The mirroring is made from X axis @@ -483,7 +487,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) pt_texte->m_Miroir = 1; NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient ); - pt_texte->SetLayer( Module->GetLayer() ); + pt_texte->SetLayer( Module->GetLayer() ); pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) ); if( Module->GetLayer() == COPPER_LAYER_N ) @@ -517,7 +521,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC ) if( DC && m_PcbFrame ) { Module->Draw( m_PcbFrame->DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); - + /* affichage chevelu general si necessaire */ m_PcbFrame->ReCompile_Ratsnest_After_Changes( DC ); } @@ -753,7 +757,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module, if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */ { module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); - + /* Reaffichage chevelu general si necessaire */ ReCompile_Ratsnest_After_Changes( DC ); } diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 1f34459417..247a75d14a 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -28,7 +28,8 @@ #include "protos.h" #define TESTONLY 1 /* ctes utilisees lors de l'appel a */ -#define READMODULE 0 /* ReadNetModuleORCADPCB */ +#define READMODULE 0 /* ReadPcbNetlist() */ + /* Structures locales */ class MODULEtoLOAD : public EDA_BaseStruct @@ -41,22 +42,53 @@ public: public: MODULEtoLOAD( const wxString& libname, const wxString& cmpname, - int timestamp, - const wxString& path); + int timestamp, + const wxString& path ); ~MODULEtoLOAD() { }; MODULEtoLOAD* Next() { return (MODULEtoLOAD*) Pnext; } }; /* Fonctions locales : */ -static void SortListModulesToLoadByLibname( int NbModules ); +static void SortListModulesToLoadByLibname( int NbModules ); +static void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* frame, + const wxString& NetlistFullFilename, + BOARD* Pcb ); +static int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename, + wxArrayString& aBufName ); +static bool OpenNetlistFile( const wxString& aFullFileName ); +static void AddToList( const wxString& NameLibCmp, + const wxString& NameCmp, + int TimeStamp, + const wxString& path ); +static int SetPadNetName( wxWindow* aFrame, char* Text, MODULE* Module ); +static void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, + const wxString& aNetlistFullFilename, + const wxString& aCmpFullFileName, + wxTextCtrl* aMessageWindow, + bool aChangeFootprint, + bool aDeleteBadTracks, + bool aDeleteExtraFootprints, + bool aSelect_By_Timestamp, + bool aVerbose ); +static int ReadListeModules( const wxString& CmpFullFileName, + const wxString* RefCmp, + long TimeStamp, + wxString& NameModule ); +static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame, + wxTextCtrl* aMessageWindow, + const wxString& CmpFullFileName, + char* Text, + int* UseFichCmp, + int TstOnly, + bool Select_By_Timestamp, + bool aChangeFootprint ); +static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ); /* Variables locales */ static int s_NbNewModules; static MODULEtoLOAD* s_ModuleToLoad_List; FILE* source; -static bool ChangeExistantModule; -static bool DisplayWarning = TRUE; static int DisplayWarningCount; /*****************************/ @@ -69,49 +101,52 @@ static int DisplayWarningCount; void WinEDA_PcbFrame::InstallNetlistFrame( wxDC* DC, const wxPoint& pos ) /*************************************************************************/ { - WinEDA_NetlistFrame* frame = new WinEDA_NetlistFrame( this, DC ); + /* Setup the default netlist file name according to the board file name */ + wxString default_netfilename = GetScreen()->m_FileName; + + ChangeFileNameExt( default_netfilename, NetExtBuffer ); + + WinEDA_NetlistFrame* frame = new WinEDA_NetlistFrame( this, DC, default_netfilename ); frame->ShowModal(); frame->Destroy(); } -/***************************************************************/ -bool WinEDA_NetlistFrame::OpenNetlistFile( wxCommandEvent& event ) -/***************************************************************/ +/************************************************************************/ +bool OpenNetlistFile( const wxString& aFullFileName ) +/************************************************************************/ /* * routine de selection et d'ouverture du fichier Netlist */ { - wxString FullFileName; - wxString msg; + if( aFullFileName.IsEmpty() ) + return FALSE; /* No filename: exit */ - if( NetNameBuffer.IsEmpty() ) /* Pas de nom specifie */ - Set_NetlisteName( event ); - - if( NetNameBuffer.IsEmpty() ) - return FALSE; /* toujours Pas de nom specifie */ - - FullFileName = NetNameBuffer; - - source = wxFopen( FullFileName, wxT( "rt" ) ); + source = wxFopen( aFullFileName, wxT( "rt" ) ); if( source == 0 ) { - msg.Printf( _( "Netlist file %s not found" ), FullFileName.GetData() ); - DisplayError( this, msg ); + wxString msg; + msg.Printf( _( "Netlist file %s not found" ), aFullFileName.GetData() ); + DisplayError( NULL, msg ); return FALSE; } - msg = wxT( "Netlist " ); msg << FullFileName; - SetTitle( msg ); - return TRUE; } -/**************************************************************/ -void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) -/**************************************************************/ +/*******************************************************************************/ +void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, + const wxString& aNetlistFullFilename, + const wxString& aCmpFullFileName, + wxTextCtrl* aMessageWindow, + bool aChangeFootprint, + bool aDeleteBadTracks, + bool aDeleteExtraFootprints, + bool aSelect_By_Timestamp, + bool aVerbose ) +/********************************************************************************/ /* mise a jour des empreintes : * corrige les Net Names, les textes, les "TIME STAMP" @@ -139,37 +174,37 @@ void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) int UseFichCmp = 1; wxString msg; - ChangeExistantModule = m_ChangeExistantModuleCtrl->GetSelection() == 1 ? TRUE : FALSE; - DisplayWarning = m_DisplayWarningCtrl->GetValue(); - if( DisplayWarning ) + if( aVerbose ) DisplayWarningCount = 8; else DisplayWarningCount = 0; - if( !OpenNetlistFile( event ) ) + if( !OpenNetlistFile( aNetlistFullFilename ) ) return; - msg = _( "Read Netlist " ) + NetNameBuffer; - m_MessageWindow->AppendText( msg ); + msg = _( "Read Netlist " ) + aNetlistFullFilename; + if( aMessageWindow ) + aMessageWindow->AppendText( msg ); - m_Parent->m_CurrentScreen->SetModify(); - m_Parent->m_Pcb->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0; + aFrame->m_CurrentScreen->SetModify(); + aFrame->m_Pcb->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0; s_NbNewModules = 0; - /* Premiere lecture de la netliste: etablissement de la liste - * des modules a charger + wxBusyCursor dummy; // Shows an hourglass while calculating + + /* First read of the netlist: Build the list of footprints to load (new footprints) */ while( GetLine( source, Line, &LineNum ) ) { Text = StrPurge( Line ); - if( Comment ) /* Commentaires en cours */ + if( Comment ) /* Comments in progress */ { if( ( Text = strchr( Text, '}' ) ) == NULL ) continue; Comment = 0; } - if( *Text == '{' ) /* Commentaires */ + if( *Text == '{' ) /* Start Comment */ { Comment = 1; if( ( Text = strchr( Text, '}' ) ) == NULL ) @@ -184,7 +219,14 @@ void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) if( State == 2 ) { - Module = ReadNetModule( Text, &UseFichCmp, TESTONLY ); + Module = ReadNetModule( aFrame, + aMessageWindow, + aCmpFullFileName, + Text, + &UseFichCmp, + TESTONLY, + aSelect_By_Timestamp, + aChangeFootprint ); continue; } @@ -194,10 +236,10 @@ void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) } } - /* Chargement des nouveaux modules */ + /* Load new footprints */ if( s_NbNewModules ) { - LoadListeModules( m_DC ); + LoadListeModules( aFrame, NULL ); // Free module list: MODULEtoLOAD* item, * next_item; @@ -210,7 +252,7 @@ void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) s_ModuleToLoad_List = NULL; } - /* Relecture de la netliste, tous les modules sont ici charges */ + /* Second read , All footprints are on board, one must update the schematic info (pad netnames) */ fseek( source, 0, SEEK_SET ); LineNum = 0; while( GetLine( source, Line, &LineNum ) ) { @@ -236,7 +278,14 @@ void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) if( State == 2 ) { - Module = ReadNetModule( Text, &UseFichCmp, READMODULE ); + Module = ReadNetModule( aFrame, + aMessageWindow, + aCmpFullFileName, + Text, + &UseFichCmp, + READMODULE, + aSelect_By_Timestamp, + aChangeFootprint ); if( Module == NULL ) { /* empreinte non trouvee dans la netliste */ continue; @@ -256,7 +305,7 @@ void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) { if( Module ) { - SetPadNetName( Text, Module ); + SetPadNetName( NULL, Text, Module ); } State--; } @@ -264,30 +313,75 @@ void WinEDA_NetlistFrame::ReadPcbNetlist( wxCommandEvent& event ) fclose( source ); - /* Mise a jour et Cleanup du circuit imprime: */ - m_Parent->Compile_Ratsnest( m_DC, TRUE ); - - if( m_Parent->m_Pcb->m_Track ) + // Delete footprints not found in netlist: + if ( aDeleteExtraFootprints ) { - if( m_DeleteBadTracks->GetSelection() == 1 ) + wxArrayString ModuleListFromNetlist; + /* Build list of modules in the netlist */ + int NbModulesNetListe = BuildFootprintsListFromNetlistFile( aNetlistFullFilename, ModuleListFromNetlist ); + if( NbModulesNetListe ) { - wxBeginBusyCursor();; - Netliste_Controle_piste( m_Parent, m_DC, TRUE ); - m_Parent->Compile_Ratsnest( m_DC, TRUE ); - wxEndBusyCursor();; + MODULE * NextModule; + Module = aFrame->m_Pcb->m_Modules; + bool ask_for_confirmation = true; + for( ; Module != NULL; Module = NextModule ) + { + int ii; + NextModule = Module->Next(); + if ( (Module->m_ModuleStatus & MODULE_is_LOCKED) ) + continue; + for( ii = 0; ii < NbModulesNetListe; ii++ ) + { + if( Module->m_Reference->m_Text.CmpNoCase( + ModuleListFromNetlist[ii] ) == 0 ) + { + break; /* Module trouve en netliste */ + } + } + + if( ii == NbModulesNetListe ) /* Module not found in netlist */ + { + if ( ask_for_confirmation ) + { + ask_for_confirmation = false; + if ( ! IsOK( NULL, _("Ok to delete footprints not in netlist ?") ) ) + break; + } + aFrame->Delete_Module( Module, NULL, false ); + } + } } } - m_Parent->m_Pcb->Display_Infos( m_Parent ); + /* Rebuild the connectivity */ + aFrame->Compile_Ratsnest( NULL, TRUE ); + + if( aFrame->m_Pcb->m_Track ) + { + if( aDeleteBadTracks ) // Remove erroneous tracks + { + Netliste_Controle_piste( aFrame, NULL, TRUE ); + aFrame->Compile_Ratsnest( NULL, TRUE ); + } + } + + aFrame->DrawPanel->Refresh(); + aFrame->m_Pcb->Display_Infos( aFrame ); } /****************************************************************************/ -MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp, - int TstOnly ) +MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame, + wxTextCtrl* aMessageWindow, + const wxString& aCmpFullFileName, + char* Text, + int* UseFichCmp, + int TstOnly, + bool aSelect_By_Timestamp, + bool aChangeFootprint ) /****************************************************************************/ -/* charge la description d'une empreinte ,netliste type PCBNEW +/* charge la description d'une empreinte, netliste type PCBNEW * et met a jour le module correspondant * * Si TstOnly == 0 si le module n'existe pas, il est charge @@ -343,19 +437,19 @@ MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp, if( Error > 0 ) return NULL; - wxString LocalTimeStamp = TextTimeStamp.AfterLast('/'); + wxString LocalTimeStamp = TextTimeStamp.AfterLast( '/' ); LocalTimeStamp.ToULong( &TimeStamp, 16 ); /* Tst si composant deja charge */ - Module = (MODULE*) m_Parent->m_Pcb->m_Modules; + Module = aFrame->m_Pcb->m_Modules; MODULE* NextModule; for( Found = FALSE; Module != NULL; Module = NextModule ) { - NextModule = (MODULE*) Module->Pnext; - if( m_Select_By_Timestamp->GetSelection() == 1 ) /* Reconnaissance par signature temporelle */ + NextModule = Module->Next(); + if( aSelect_By_Timestamp ) /* Reconnaissance par signature temporelle */ { //if( TimeStamp == Module->m_TimeStamp ) - if(TextTimeStamp.CmpNoCase(Module->m_Path)) + if( TextTimeStamp.CmpNoCase( Module->m_Path ) ) Found = TRUE; } else /* Reconnaissance par Reference */ @@ -370,35 +464,44 @@ MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp, NameLibCmp = TextNameLibMod; if( *UseFichCmp ) { - if( m_Select_By_Timestamp->GetSelection() == 1 ) + if( aSelect_By_Timestamp ) { /* Reconnaissance par signature temporelle */ - *UseFichCmp = ReadListeModules( NULL, TimeStamp, NameLibCmp ); + *UseFichCmp = ReadListeModules( aCmpFullFileName, + NULL, + TimeStamp, + NameLibCmp ); } else /* Reconnaissance par Reference */ { - *UseFichCmp = ReadListeModules( &TextCmpName, 0l, NameLibCmp ); + *UseFichCmp = ReadListeModules( aCmpFullFileName, + &TextCmpName, + 0l, + NameLibCmp ); } } if( Module->m_LibRef.CmpNoCase( NameLibCmp ) != 0 ) { // Module Mismatch: Current module and module specified in netlist are diff. - if( ChangeExistantModule ) + if( aChangeFootprint ) { MODULE* NewModule = - m_Parent->Get_Librairie_Module( this, wxEmptyString, NameLibCmp, TRUE ); - if( NewModule ) /* Nouveau module trouve : changement de module */ - Module = m_Parent->Exchange_Module( this, Module, NewModule ); + aFrame->Get_Librairie_Module( NULL, wxEmptyString, NameLibCmp, TRUE ); + if( NewModule ) /* Nouveau module trouve : changement de module */ + Module = aFrame->Exchange_Module( NULL, Module, NewModule ); } else { wxString msg; - msg.Printf( - _( "Cmp %s: Mismatch! module is [%s] and netlist said [%s]\n" ), - TextCmpName.GetData(), Module->m_LibRef.GetData(), - NameLibCmp.GetData() ); - m_MessageWindow->AppendText( msg ); + if( aMessageWindow ) + { + msg.Printf( + _( "Cmp %s: Mismatch! module is [%s] and netlist said [%s]\n" ), + TextCmpName.GetData(), Module->m_LibRef.GetData(), + NameLibCmp.GetData() ); + aMessageWindow->AppendText( msg ); + } if( DisplayWarningCount > 0 ) { - DisplayError( this, msg, 2 ); + DisplayError( NULL, msg, 2 ); DisplayWarningCount--; } } @@ -414,13 +517,13 @@ MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp, if( *UseFichCmp ) { - if( m_Select_By_Timestamp->GetSelection() == 1 ) + if( aSelect_By_Timestamp == 1 ) { /* Reconnaissance par signature temporelle */ - *UseFichCmp = ReadListeModules( NULL, TimeStamp, NameLibCmp ); + *UseFichCmp = ReadListeModules( aCmpFullFileName, NULL, TimeStamp, NameLibCmp ); } else /* Reconnaissance par Reference */ { - *UseFichCmp = ReadListeModules( &TextCmpName, 0l, NameLibCmp ); + *UseFichCmp = ReadListeModules( aCmpFullFileName, &TextCmpName, 0l, NameLibCmp ); } } @@ -429,12 +532,12 @@ MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp, AddToList( NameLibCmp, TextCmpName, TimeStamp, TextTimeStamp ); else { - wxString msg; - msg.Printf( _( "Component [%s] not found" ), TextCmpName.GetData() ); - m_MessageWindow->AppendText( msg + wxT( "\n" ) ); - if( DisplayWarningCount> 0 ) + if( aMessageWindow && (DisplayWarningCount> 0) ) { - DisplayError( this, msg, 2 ); + wxString msg; + msg.Printf( _( "Component [%s] not found" ), TextCmpName.GetData() ); + aMessageWindow->AppendText( msg + wxT( "\n" ) ); + DisplayError( NULL, msg, 2 ); DisplayWarningCount--; } } @@ -447,9 +550,9 @@ MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp, Module->m_TimeStamp = TimeStamp; Module->m_Path = TextTimeStamp; -#if defined(DEBUG) - printf("in ReadNetModule() m_Path = %s\n", - CONV_TO_UTF8(Module->m_Path) ); +#if defined (DEBUG) + printf( "in ReadNetModule() m_Path = %s\n", + CONV_TO_UTF8( Module->m_Path ) ); #endif return Module; /* composant trouve */ @@ -457,14 +560,13 @@ MODULE* WinEDA_NetlistFrame::ReadNetModule( char* Text, int* UseFichCmp, /********************************************************************/ -int WinEDA_NetlistFrame::SetPadNetName( char* Text, MODULE* Module ) +int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module ) /********************************************************************/ -/* - * Met a jour le netname de 1 pastille, Netliste ORCADPCB - * entree : - * Text = ligne de netliste lue ( (pad = net) ) - * Module = adresse de la structure MODULE a qui appartient les pads +/** Function SetPadNetName + * Update a pad netname in a given footprint + * @param Text = Text from netlist (format: (pad = net) ) + * @param Module = the given footprint */ { D_PAD* pad; @@ -504,8 +606,8 @@ int WinEDA_NetlistFrame::SetPadNetName( char* Text, MODULE* Module ) { wxString pin_name = CONV_FROM_UTF8( TextPinName ); Msg.Printf( _( "Module [%s]: Pad [%s] not found" ), - Module->m_Reference->m_Text.GetData(), pin_name.GetData() ); - DisplayError( this, Msg, 1 ); + Module->m_Reference->m_Text.GetData(), pin_name.GetData() ); + DisplayError( frame, Msg, 1 ); DisplayWarningCount--; } @@ -514,7 +616,7 @@ int WinEDA_NetlistFrame::SetPadNetName( char* Text, MODULE* Module ) /*****************************************************/ -MODULE* WinEDA_PcbFrame::ListAndSelectModuleName() +MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void ) /*****************************************************/ /* liste les noms des modules du PCB @@ -538,7 +640,7 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName() for( ; Module != NULL; Module = (MODULE*) Module->Pnext ) nb_empr++; - ListNames = (const wxChar**) MyZMalloc( (nb_empr + 1) * sizeof(wxChar *) ); + ListNames = (const wxChar**) MyZMalloc( (nb_empr + 1) * sizeof(wxChar*) ); Module = (MODULE*) m_Pcb->m_Modules; for( ii = 0; Module != NULL; Module = (MODULE*) Module->Pnext, ii++ ) { @@ -546,7 +648,7 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName() } ListBox = new WinEDAListBox( this, _( "Components" ), - ListNames, wxEmptyString ); + ListNames, wxEmptyString ); ii = ListBox->ShowModal(); ListBox->Destroy(); @@ -569,53 +671,54 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName() } -/***************************************************************/ -void WinEDA_NetlistFrame::ModulesControle( wxCommandEvent& event ) -/***************************************************************/ +/*****************************************************************************************/ +void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame, + const wxString& aNetlistFullFilename, + BOARD* aPcb ) +/******************************************************************************************/ -/* donne la liste : - * 1 - des empreintes doubl�es sur le PCB - * 2 - des empreintes manquantes par rapport a la netliste - * 3 - des empreintes suppl�mentaires par rapport a la netliste +/** Function TestFor_Duplicate_Missing_And_Extra_Footprints + * Build a list from the given board and netlist : + * 1 - for duplicate footprints on board + * 2 - for missing footprints + * 3 - for footprints not in netlist + * @param aFrame = current active frame + * @param aNetlistFullFilename = the given netlist + * @param aPcb = the given board */ #define MAX_LEN_TXT 32 { - int ii, NbModulesPcb; + int ii; MODULE* Module, * pt_aux; int NbModulesNetListe, nberr = 0; WinEDA_TextFrame* List; wxArrayString ModuleListFromNetlist; - /* determination du nombre des modules du PCB*/ - NbModulesPcb = 0; Module = (MODULE*) m_Parent->m_Pcb->m_Modules; - for( ; Module != NULL; Module = (MODULE*) Module->Pnext ) - NbModulesPcb++; - - if( NbModulesPcb == 0 ) + if( aPcb->m_Modules == NULL ) { - DisplayError( this, _( "No modules" ), 10 ); return; + DisplayInfo( aFrame, _( "No modules" ), 10 ); return; } /* Construction de la liste des references des modules de la netliste */ - NbModulesNetListe = BuildListeNetModules( event, ModuleListFromNetlist ); + NbModulesNetListe = BuildFootprintsListFromNetlistFile( aNetlistFullFilename, ModuleListFromNetlist ); if( NbModulesNetListe < 0 ) - return; /* fichier non trouve */ + return; /* File not found */ if( NbModulesNetListe == 0 ) { - DisplayError( this, _( "No modules in NetList" ), 10 ); return; + DisplayError( aFrame, _( "No modules in NetList" ), 10 ); return; } - List = new WinEDA_TextFrame( this, _( "Check Modules" ) ); + List = new WinEDA_TextFrame( aFrame, _( "Check Modules" ) ); /* recherche des doubles */ List->Append( _( "Duplicates" ) ); - Module = (MODULE*) m_Parent->m_Pcb->m_Modules; - for( ; Module != NULL; Module = (MODULE*) Module->Pnext ) + Module = aPcb->m_Modules; + for( ; Module != NULL; Module = Module->Next() ) { - pt_aux = (MODULE*) Module->Pnext; - for( ; pt_aux != NULL; pt_aux = (MODULE*) pt_aux->Pnext ) + pt_aux = Module->Next(); + for( ; pt_aux != NULL; pt_aux = pt_aux->Next() ) { if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference->m_Text ) == 0 ) { @@ -631,8 +734,8 @@ void WinEDA_NetlistFrame::ModulesControle( wxCommandEvent& event ) for( ii = 0; ii < NbModulesNetListe; ii++ ) { - Module = (MODULE*) m_Parent->m_Pcb->m_Modules; - for( ; Module != NULL; Module = (MODULE*) Module->Pnext ) + Module = (MODULE*) aPcb->m_Modules; + for( ; Module != NULL; Module = Module->Next() ) { if( Module->m_Reference->m_Text.CmpNoCase( ModuleListFromNetlist[ii] ) == 0 ) @@ -651,7 +754,7 @@ void WinEDA_NetlistFrame::ModulesControle( wxCommandEvent& event ) /* recherche des modules supplementaires (i.e. Non en Netliste) */ List->Append( _( "Not in Netlist:" ) ); - Module = (MODULE*) m_Parent->m_Pcb->m_Modules; + Module = (MODULE*) aPcb->m_Modules; for( ; Module != NULL; Module = Module->Next() ) { for( ii = 0; ii < NbModulesNetListe; ii++ ) @@ -659,7 +762,7 @@ void WinEDA_NetlistFrame::ModulesControle( wxCommandEvent& event ) if( Module->m_Reference->m_Text.CmpNoCase( ModuleListFromNetlist[ii] ) == 0 ) { - break;/* Module trouve en netliste */ + break; /* Module trouve en netliste */ } } @@ -674,13 +777,15 @@ void WinEDA_NetlistFrame::ModulesControle( wxCommandEvent& event ) } -/**************************************************************************************************/ -int WinEDA_NetlistFrame::BuildListeNetModules( wxCommandEvent& event, wxArrayString& BufName ) -/**************************************************************************************************/ +/***************************************************************************************/ +int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename, wxArrayString& aBufName ) +/***************************************************************************************/ -/* - * charge en BufName la liste des noms des modules de la netliste, - * retourne le nombre des modules cit�s dans la netliste +/** Function BuildFootprintsListFromNetlistFile + * Fill BufName with footprints names read from the netlist. + * @param aNetlistFullFilename = netlist file name + * @param BufName = wxArrayString to fill with footprint names + * @return Footprint count, or -1 if netlist file cannot opened */ { int textlen; @@ -688,7 +793,7 @@ int WinEDA_NetlistFrame::BuildListeNetModules( wxCommandEvent& event, wxArrayStr int State, LineNum, Comment; char Line[1024], * Text, * LibModName; - if( !OpenNetlistFile( event ) ) + if( !OpenNetlistFile( aNetlistFullFilename ) ) return -1; State = 0; LineNum = 0; Comment = 0; @@ -720,14 +825,14 @@ int WinEDA_NetlistFrame::BuildListeNetModules( wxCommandEvent& event, wxArrayStr { int Error = 0; if( strtok( Line, " ()\t\n" ) == NULL ) - Error = 1; /* TimeStamp */ + Error = 1; /* TimeStamp */ if( ( LibModName = strtok( NULL, " ()\t\n" ) ) == NULL ) - Error = 1; /* nom Lib */ + Error = 1; /* nom Lib */ /* Lecture du nom (reference) du composant: */ if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL ) Error = 1; nb_modules_lus++; - BufName.Add( CONV_FROM_UTF8( Text ) ); + aBufName.Add( CONV_FROM_UTF8( Text ) ); continue; } @@ -743,8 +848,8 @@ int WinEDA_NetlistFrame::BuildListeNetModules( wxCommandEvent& event, wxArrayStr /*****************************************************************************************/ -int WinEDA_NetlistFrame::ReadListeModules( const wxString* RefCmp, long TimeStamp, - wxString& NameModule ) +int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp, long TimeStamp, + wxString& NameModule ) /*****************************************************************************************/ /* @@ -780,7 +885,6 @@ int WinEDA_NetlistFrame::ReadListeModules( const wxString* RefCmp, long TimeStam * */ { - wxString CmpFullFileName; wxString refcurrcmp, idmod; char ia[1024]; int timestamp; @@ -790,16 +894,13 @@ int WinEDA_NetlistFrame::ReadListeModules( const wxString* RefCmp, long TimeStam if( (RefCmp == NULL) && (TimeStamp == 0) ) return 0; - CmpFullFileName = NetNameBuffer; - ChangeFileNameExt( CmpFullFileName, NetCmpExtBuffer ); - FichCmp = wxFopen( CmpFullFileName, wxT( "rt" ) ); if( FichCmp == NULL ) { wxString msg; msg.Printf( _( "File <%s> not found, use Netlist for lib module selection" ), - CmpFullFileName.GetData() ); - DisplayError( this, msg, 20 ); + CmpFullFileName.GetData() ); + DisplayError( NULL, msg, 20 ); return 0; } @@ -871,38 +972,9 @@ int WinEDA_NetlistFrame::ReadListeModules( const wxString* RefCmp, long TimeStam } -/***************************************************************/ -void WinEDA_NetlistFrame::Set_NetlisteName( wxCommandEvent& event ) -/***************************************************************/ - -/* Selection un nouveau nom de netliste - * Affiche la liste des fichiers netlistes pour selection sur liste - */ -{ - wxString fullfilename, mask( wxT( "*" ) ); - - mask += NetExtBuffer; - - fullfilename = EDA_FileSelector( _( "Netlist Selection:" ), - wxEmptyString, /* Chemin par defaut */ - NetNameBuffer, /* nom fichier par defaut */ - NetExtBuffer, /* extension par defaut */ - mask, /* Masque d'affichage */ - this, - 0, - TRUE - ); - - if( fullfilename.IsEmpty() ) - return; - NetNameBuffer = fullfilename; - SetTitle( fullfilename ); -} - - /***********************************************************************************/ -void WinEDA_NetlistFrame::AddToList( const wxString& NameLibCmp, const wxString& CmpName, - int TimeStamp, const wxString& path) +void AddToList( const wxString& NameLibCmp, const wxString& CmpName, + int TimeStamp, const wxString& path ) /************************************************************************************/ /* Fontion copiant en memoire de travail les caracteristiques @@ -919,7 +991,7 @@ void WinEDA_NetlistFrame::AddToList( const wxString& NameLibCmp, const wxString& /***************************************************************/ -void WinEDA_NetlistFrame::LoadListeModules( wxDC* DC ) +void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) /***************************************************************/ /* Routine de chargement des nouveaux modules en une seule lecture des @@ -931,7 +1003,7 @@ void WinEDA_NetlistFrame::LoadListeModules( wxDC* DC ) MODULEtoLOAD* ref, * cmp; int ii; MODULE* Module = NULL; - wxPoint OldPos = m_Parent->m_CurrentScreen->m_Curseur; + wxPoint OldPos = aPcbFrame->m_CurrentScreen->m_Curseur; if( s_NbNewModules == 0 ) return; @@ -939,47 +1011,47 @@ void WinEDA_NetlistFrame::LoadListeModules( wxDC* DC ) SortListModulesToLoadByLibname( s_NbNewModules ); ref = cmp = s_ModuleToLoad_List; - // Calcul de la coordonn�e de placement des modules: - if( m_Parent->SetBoardBoundaryBoxFromEdgesOnly() ) + // Calculate the footprint "best" position: + if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() ) { - m_Parent->m_CurrentScreen->m_Curseur.x = m_Parent->m_Pcb->m_BoundaryBox.GetRight() + 5000; - m_Parent->m_CurrentScreen->m_Curseur.y = m_Parent->m_Pcb->m_BoundaryBox.GetBottom() + - 10000; + aPcbFrame->m_CurrentScreen->m_Curseur.x = aPcbFrame->m_Pcb->m_BoundaryBox.GetRight() + + 5000; + aPcbFrame->m_CurrentScreen->m_Curseur.y = aPcbFrame->m_Pcb->m_BoundaryBox.GetBottom() + + 10000; } else { - m_Parent->m_CurrentScreen->m_Curseur = wxPoint( 0, 0 ); + aPcbFrame->m_CurrentScreen->m_Curseur = wxPoint( 0, 0 ); } for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() ) { if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) ) - { /* Nouveau Module a charger */ - Module = m_Parent->Get_Librairie_Module( this, wxEmptyString, cmp->m_LibName, FALSE ); + { /* New footprint : must be loaded from a library */ + Module = aPcbFrame->Get_Librairie_Module( NULL, wxEmptyString, cmp->m_LibName, FALSE ); ref = cmp; if( Module == NULL ) { wxString msg; msg.Printf( _( "Component [%s]: footprint <%s> not found" ), - cmp->m_CmpName.GetData(), cmp->m_LibName.GetData() ); - DisplayError( this, msg ); + cmp->m_CmpName.GetData(), cmp->m_LibName.GetData() ); + DisplayError( NULL, msg ); continue; } - m_Parent->Place_Module( Module, DC ); + aPcbFrame->Place_Module( Module, DC ); - /* mise a jour des reperes ( nom et ref "Time Stamp") - * si module charge */ + /* Update schematic links : reference "Time Stamp" and schematic hierarchical path */ Module->m_Reference->m_Text = cmp->m_CmpName; Module->m_TimeStamp = cmp->m_TimeStamp; Module->m_Path = cmp->m_Path; } else { - /* module deja charge, on peut le dupliquer */ + /* Footprint already loaded from a library, duplicate it (faster) */ MODULE* newmodule; if( Module == NULL ) - continue; /* module non existant en libr */ - newmodule = new MODULE( m_Parent->m_Pcb ); + continue; /* module non existant en libr */ + newmodule = new MODULE( aPcbFrame->m_Pcb ); newmodule->Copy( Module ); newmodule->AddToChain( Module ); Module = newmodule; @@ -989,7 +1061,7 @@ void WinEDA_NetlistFrame::LoadListeModules( wxDC* DC ) } } - m_Parent->m_CurrentScreen->m_Curseur = OldPos; + aPcbFrame->m_CurrentScreen->m_Curseur = OldPos; } @@ -1013,7 +1085,7 @@ void SortListModulesToLoadByLibname( int NbModules ) MODULEtoLOAD** base_list, * item; int ii; - base_list = (MODULEtoLOAD**) MyMalloc( NbModules * sizeof(MODULEtoLOAD *) ); + base_list = (MODULEtoLOAD**) MyMalloc( NbModules * sizeof(MODULEtoLOAD*) ); for( ii = 0, item = s_ModuleToLoad_List; ii < NbModules; ii++ ) { @@ -1021,8 +1093,8 @@ void SortListModulesToLoadByLibname( int NbModules ) item = item->Next(); } - qsort( base_list, NbModules, sizeof(MODULEtoLOAD *), - ( int( * ) ( const void*, const void* ) )SortByLibName ); + qsort( base_list, NbModules, sizeof(MODULEtoLOAD*), + ( int( * ) ( const void*, const void* ) )SortByLibName ); // Reconstruction du chainage: s_ModuleToLoad_List = *base_list; @@ -1048,5 +1120,5 @@ MODULEtoLOAD::MODULEtoLOAD( const wxString& libname, const wxString& cmpname, m_LibName = libname; m_CmpName = cmpname; m_TimeStamp = timestamp; - m_Path = path; + m_Path = path; } diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 18d4c462dd..dce48bcc2c 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -169,8 +169,7 @@ eda_global wxString g_SaveFileName // File Name for periodic saving ( wxT( "$savepcb" ) ) #endif ; -eda_global wxString NetNameBuffer; // Netlist file extension -eda_global wxString NetExtBuffer +eda_global wxString NetExtBuffer // Netlist file extension #ifdef MAIN ( wxT( ".net" ) ) #endif diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 7d062047cb..e6bf18db50 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -247,7 +247,7 @@ static int gen_rats_block_to_block( WinEDA_DrawPanel* DrawPanel, wxDC* DC, // we memorise the "best" current values for merging current_num_block = curr_pad->m_logical_connexion; dist_min = current_dist; - + pt_liste_pad_tmp = pt_liste_pad_aux; pt_liste_pad_block1 = pt_liste_pad; } @@ -389,7 +389,7 @@ static int gen_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC, g_pt_chevelu->pad_start = ref_pad; g_pt_chevelu->pad_end = pad; - if( DisplayRastnestInProgress ) + if( DisplayRastnestInProgress && DC ) { GRLine( &DrawPanel->m_ClipBox, DC, g_pt_chevelu->pad_start->m_Pos.x, g_pt_chevelu->pad_start->m_Pos.y, @@ -483,10 +483,10 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) DisplayRastnestInProgress = TRUE; g_pt_chevelu = m_Pcb->m_Ratsnest; pt_liste_pad = pt_start_liste = m_Pcb->m_Pads; - + pt_liste_pad_limite = pt_start_liste + m_Pcb->m_NbPads; current_net_code = 1; // 1er net_code a analyser (net_code = 0 -> no connect) - + equipot = m_Pcb->m_Equipots; noconn = 0; @@ -494,14 +494,14 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) { pt_deb_liste_ch = g_pt_chevelu; pad = *pt_liste_pad; - + /* Skip the not connected pads */ if( pad->GetNet() == 0 ) { pt_liste_pad++; pt_start_liste = pt_liste_pad; continue; } - + /* Search the end of pad list des pads for the current net */ num_block = pad->m_logical_connexion; nbpads = 0; @@ -509,11 +509,11 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) { if( pt_end_liste >= pt_liste_pad_limite ) break; - + pad = *pt_end_liste; if( pad->GetNet() != current_net_code ) break; - + nbpads++; if( num_block < pad->m_logical_connexion ) num_block = pad->m_logical_connexion; @@ -566,8 +566,8 @@ void WinEDA_BasePcbFrame::Build_Board_Ratsnest( wxDC* DC ) // erase the ratsnest displayed on screen if needed CHEVELU* Chevelu = (CHEVELU*) m_Pcb->m_Ratsnest; - GRSetDrawMode( DC, GR_XOR ); - + if ( DC ) GRSetDrawMode( DC, GR_XOR ); + for( ii = m_Pcb->GetNumRatsnests(); ii > 0; ii--, Chevelu++ ) { if( !g_Show_Ratsnest ) @@ -733,7 +733,7 @@ static int tst_rats_pad_to_pad( WinEDA_DrawPanel* DrawPanel, wxDC* DC, for( chevelu = start_rat_list; chevelu < end_rat_list; chevelu++ ) { - pad_start = chevelu->pad_start; + pad_start = chevelu->pad_start; pad_end = chevelu->pad_end; /* Update the block if the 2 pads are not connected : a new block is created @@ -878,7 +878,7 @@ void WinEDA_BasePcbFrame::recalcule_pad_net_code() { if( (*pad_courant)->m_Netname.IsEmpty() ) // pad not connected { - (*pad_courant)->SetNet( 0 ); + (*pad_courant)->SetNet( 0 ); continue; } @@ -965,7 +965,7 @@ void WinEDA_BasePcbFrame::recalcule_pad_net_code() MyFree( BufPtEquipot ); m_Pcb->m_Status_Pcb |= NET_CODES_OK; - + m_Pcb->SetAreasNetCodesFromNetNames(); } @@ -1089,7 +1089,7 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module ) build_liste_pads(); /* Compute the "local" ratsnest if needed (when this footprint starts move) - and the list of external pads to consider, i.e pads in others footprints which are "connected" to + and the list of external pads to consider, i.e pads in others footprints which are "connected" to a pad in the current footprint */ if( (m_Pcb->m_Status_Pcb & CHEVELU_LOCAL_OK) != 0 ) @@ -1127,7 +1127,7 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module ) pad_ref = pt_liste_ref[ii]; if( pad_ref->GetNet() == current_net_code ) continue; - + current_net_code = pad_ref->GetNet(); pt_liste_generale = m_Pcb->m_Pads; @@ -1142,10 +1142,10 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module ) pad_externe->m_logical_connexion = 0; pad_externe->m_physical_connexion = 0; - - *pt_liste_pad = pad_externe; + + *pt_liste_pad = pad_externe; pt_liste_pad++; - + nb_pads_externes++; } } @@ -1164,9 +1164,9 @@ char* WinEDA_BasePcbFrame::build_ratsnest_module( wxDC* DC, MODULE* Module ) g_pt_chevelu = local_liste_chevelu; pt_liste_pad = pt_start_liste = (LISTE_PAD*) adr_lowmem; - + pt_liste_pad_limite = pt_liste_pad + nb_pads_ref; - + current_net_code = (*pt_liste_pad)->GetNet(); for( ; pt_liste_pad < pt_liste_pad_limite; ) @@ -1270,7 +1270,7 @@ calcul_chevelu_ext: local_chevelu->SetNet( pad_ref->GetNet() ); local_chevelu->dist = distance; local_chevelu->status = 0; - + increment = 1; } } @@ -1302,6 +1302,8 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC ) CHEVELU* local_chevelu; int ii; + if ( DC == NULL ) + return; if( (m_Pcb->m_Status_Pcb & CHEVELU_LOCAL_OK) == 0 ) return; @@ -1457,7 +1459,7 @@ int* WinEDA_BasePcbFrame::build_ratsnest_pad( EDA_BaseStruct* ref, else if( nb_local_chevelu ) { - *pt_coord = refpos.x; + *pt_coord = refpos.x; *(pt_coord + 1) = refpos.y; } @@ -1479,6 +1481,9 @@ void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC ) int ii; int refX, refY; + if ( DC == NULL ) + return; + if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) return; diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 8ce9c421c5..78893d28df 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -196,7 +196,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( /* * Met a jour le fichier name.CMP (s'il existe) apres un echange de module * (par la commande changeMod), si les modules sont geres par ce fichier - * + * * Si ShowError != 0 affiche message d'erreur si le fichier .cmp n'est pas * trouve. * Retoure 1 si erreur @@ -211,10 +211,7 @@ int WinEDA_ExchangeModuleFrame::Maj_ListeCmp( return 0; /* pas de changement de nom */ /* Calcul nom fichier CMP par changement de l'extension du nom netliste */ - if( NetNameBuffer == wxEmptyString ) - FileNameCmp = m_Parent->m_CurrentScreen->m_FileName; - else - FileNameCmp = NetNameBuffer; + FileNameCmp = m_Parent->m_CurrentScreen->m_FileName; ChangeFileNameExt( FileNameCmp, NetCmpExtBuffer ); // Modification du fichier .cmp correcpondant @@ -617,10 +614,7 @@ bool WinEDA_PcbFrame::RecreateCmpFileFromBoard() } /* Calcul nom fichier CMP par changement de l'extension du nom netliste */ - if( NetNameBuffer == wxEmptyString ) - FullFileNameCmp = m_CurrentScreen->m_FileName; - else - FullFileNameCmp = NetNameBuffer; + FullFileNameCmp = m_CurrentScreen->m_FileName; ChangeFileNameExt( FullFileNameCmp, NetCmpExtBuffer ); mask = wxT( "*" ) + NetCmpExtBuffer; diff --git a/share/dialog_print.cpp b/share/dialog_print.cpp index 664b976dfc..bf89284426 100644 --- a/share/dialog_print.cpp +++ b/share/dialog_print.cpp @@ -42,7 +42,7 @@ BEGIN_EVENT_TABLE( WinEDA_PrintFrame, wxDialog ) EVT_BUTTON( ID_PRINT_EXECUTE, WinEDA_PrintFrame::OnPrintExecuteClick ) - EVT_BUTTON( wxID_CLOSE, WinEDA_PrintFrame::OnCloseClick ) + EVT_BUTTON( wxID_CANCEL, WinEDA_PrintFrame::OnCancelClick ) ////@end WinEDA_PrintFrame event table entries @@ -91,10 +91,11 @@ bool WinEDA_PrintFrame::Create( wxWindow* parent, wxWindowID id, const wxString& m_ColorOption = NULL; m_PagesOptionPcb = NULL; m_PagesOptionEeschema = NULL; + m_CloseButton = NULL; ////@end WinEDA_PrintFrame member initialisation ////@begin WinEDA_PrintFrame creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + SetExtraStyle(wxWS_EX_BLOCK_EVENTS); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); @@ -116,7 +117,7 @@ void WinEDA_PrintFrame::CreateControls() SetFont(*g_DialogFont); ////@begin WinEDA_PrintFrame content construction - // Generated by DialogBlocks, 24/01/2007 16:36:31 (unregistered) + // Generated by DialogBlocks, 22/03/2008 08:33:38 (unregistered) WinEDA_PrintFrame* itemDialog1 = this; @@ -132,18 +133,17 @@ void WinEDA_PrintFrame::CreateControls() wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer5, 0, wxGROW|wxALL, 5); - wxString m_ScaleOptionStrings[] = { - _("fit in page"), - _("Scale 0.5"), - _("Scale 0.7"), - _("Approx. Scale 1"), - _("Accurate Scale 1"), - _("Scale 1.4"), - _("Scale 2"), - _("Scale 3"), - _("Scale 4") - }; - m_ScaleOption = new wxRadioBox( itemDialog1, ID_SET_PRINT_SCALE, _("Approx. Scale:"), wxDefaultPosition, wxDefaultSize, 9, m_ScaleOptionStrings, 1, wxRA_SPECIFY_COLS ); + wxArrayString m_ScaleOptionStrings; + m_ScaleOptionStrings.Add(_("fit in page")); + m_ScaleOptionStrings.Add(_("Scale 0.5")); + m_ScaleOptionStrings.Add(_("Scale 0.7")); + m_ScaleOptionStrings.Add(_("Approx. Scale 1")); + m_ScaleOptionStrings.Add(_("Accurate Scale 1")); + m_ScaleOptionStrings.Add(_("Scale 1.4")); + m_ScaleOptionStrings.Add(_("Scale 2")); + m_ScaleOptionStrings.Add(_("Scale 3")); + m_ScaleOptionStrings.Add(_("Scale 4")); + m_ScaleOption = new wxRadioBox( itemDialog1, ID_SET_PRINT_SCALE, _("Approx. Scale:"), wxDefaultPosition, wxDefaultSize, m_ScaleOptionStrings, 1, wxRA_SPECIFY_COLS ); m_ScaleOption->SetSelection(0); itemBoxSizer5->Add(m_ScaleOption, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); @@ -179,27 +179,24 @@ void WinEDA_PrintFrame::CreateControls() m_Print_Mirror->SetValue(false); itemStaticBoxSizer13->Add(m_Print_Mirror, 0, wxGROW|wxALL, 5); - wxString m_ColorOptionStrings[] = { - _("Color"), - _("Black") - }; - m_ColorOption = new wxRadioBox( itemDialog1, ID_SET_BW, _("Color Print:"), wxDefaultPosition, wxDefaultSize, 2, m_ColorOptionStrings, 1, wxRA_SPECIFY_COLS ); + wxArrayString m_ColorOptionStrings; + m_ColorOptionStrings.Add(_("Color")); + m_ColorOptionStrings.Add(_("Black")); + m_ColorOption = new wxRadioBox( itemDialog1, ID_SET_BW, _("Color Print:"), wxDefaultPosition, wxDefaultSize, m_ColorOptionStrings, 1, wxRA_SPECIFY_COLS ); m_ColorOption->SetSelection(0); itemBoxSizer12->Add(m_ColorOption, 0, wxGROW|wxALL, 5); - wxString m_PagesOptionPcbStrings[] = { - _("1 page per layer"), - _("Single Page") - }; - m_PagesOptionPcb = new wxRadioBox( itemDialog1, ID_PRINT_ALL_IN_ONE, _("Page Print:"), wxDefaultPosition, wxDefaultSize, 2, m_PagesOptionPcbStrings, 1, wxRA_SPECIFY_COLS ); + wxArrayString m_PagesOptionPcbStrings; + m_PagesOptionPcbStrings.Add(_("1 Page per Layer")); + m_PagesOptionPcbStrings.Add(_("Single Page")); + m_PagesOptionPcb = new wxRadioBox( itemDialog1, ID_PRINT_ALL_IN_ONE, _("Page Print:"), wxDefaultPosition, wxDefaultSize, m_PagesOptionPcbStrings, 1, wxRA_SPECIFY_COLS ); m_PagesOptionPcb->SetSelection(0); itemBoxSizer12->Add(m_PagesOptionPcb, 0, wxGROW|wxALL, 5); - wxString m_PagesOptionEeschemaStrings[] = { - _("Current"), - _("All") - }; - m_PagesOptionEeschema = new wxRadioBox( itemDialog1, ID_PRINT_ALL, _("Page Print:"), wxDefaultPosition, wxDefaultSize, 2, m_PagesOptionEeschemaStrings, 1, wxRA_SPECIFY_COLS ); + wxArrayString m_PagesOptionEeschemaStrings; + m_PagesOptionEeschemaStrings.Add(_("Current")); + m_PagesOptionEeschemaStrings.Add(_("All")); + m_PagesOptionEeschema = new wxRadioBox( itemDialog1, ID_PRINT_ALL, _("Page Print:"), wxDefaultPosition, wxDefaultSize, m_PagesOptionEeschemaStrings, 1, wxRA_SPECIFY_COLS ); m_PagesOptionEeschema->SetSelection(0); itemBoxSizer12->Add(m_PagesOptionEeschema, 0, wxGROW|wxALL, 5); @@ -222,8 +219,9 @@ void WinEDA_PrintFrame::CreateControls() itemButton25->SetForegroundColour(wxColour(0, 128, 64)); itemBoxSizer21->Add(itemButton25, 0, wxGROW|wxALL, 5); - wxButton* itemButton26 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer21->Add(itemButton26, 0, wxGROW|wxALL, 5); + m_CloseButton = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + m_CloseButton->SetDefault(); + itemBoxSizer21->Add(m_CloseButton, 0, wxGROW|wxALL, 5); // Set validators m_ScaleOption->SetValidator( wxGenericValidator(& s_Scale_Select) ); @@ -233,6 +231,7 @@ void WinEDA_PrintFrame::CreateControls() m_PagesOptionEeschema->SetValidator( wxGenericValidator(& s_OptionPrintPage) ); ////@end WinEDA_PrintFrame content construction + m_CloseButton->SetFocus( ); // add this line to close dialog by the escape key m_DialogPenWidth = new WinEDA_ValueCtrl(this, _("Pen width mini"), s_PrintPenMinWidth, g_UnitMetric, m_DialogPenWidthSizer, m_Parent->m_InternalUnits); @@ -304,7 +303,7 @@ void WinEDA_PrintFrame::OnPrintExecuteClick( wxCommandEvent& event ) * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE */ -void WinEDA_PrintFrame::OnCloseClick( wxCommandEvent& event ) +void WinEDA_PrintFrame::OnCancelClick( wxCommandEvent& event ) { OnClosePrintDialog(); } diff --git a/share/dialog_print.h b/share/dialog_print.h index f3a4cfcecd..5f60255f86 100644 --- a/share/dialog_print.h +++ b/share/dialog_print.h @@ -99,8 +99,8 @@ public: /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_EXECUTE void OnPrintExecuteClick( wxCommandEvent& event ); - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE - void OnCloseClick( wxCommandEvent& event ); + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL + void OnCancelClick( wxCommandEvent& event ); ////@end WinEDA_PrintFrame event handler declarations @@ -142,6 +142,7 @@ public: wxRadioBox* m_ColorOption; wxRadioBox* m_PagesOptionPcb; wxRadioBox* m_PagesOptionEeschema; + wxButton* m_CloseButton; ////@end WinEDA_PrintFrame member variables WinEDA_DrawFrame * m_Parent; diff --git a/share/dialog_print.pjd b/share/dialog_print.pjd index 050c00d583..48e93e7aad 100644 --- a/share/dialog_print.pjd +++ b/share/dialog_print.pjd @@ -1,4 +1,4 @@ - +
0 @@ -6,13 +6,14 @@ "" "" "" - 33 "" 0 0 0 + 1 1 1 + 1 0 "jean-pierre Charras" "License GNU" @@ -44,12 +45,6 @@ // Licence: ///////////////////////////////////////////////////////////////////////////// -" - " -/*! - * %BODY% - */ - " "///////////////////////////////////////////////////////////////////////////// // Name: %SYMBOLS-FILENAME% @@ -83,6 +78,14 @@ #include "wx/wx.h" #endif +" + " /// %BODY% +" + " +/*! + * %BODY% + */ + " "app_resources.h" "app_resources.cpp" @@ -94,6 +97,7 @@ "" "<None>" "<System>" + "utf-8" "<System>" "" 0 @@ -104,9 +108,12 @@ 0 0 1 + 0 1 1 + 0 1 + 0
@@ -183,7 +190,7 @@ 1 1 0 - 0 + 1 "Windows" "html-document" @@ -207,7 +214,10 @@ 10000 0 "" + 0 + "" 0 + 0 "ID_DIALOG" 10000 "WinEDA_PrintFrame" @@ -228,10 +238,16 @@ 0 1 "<Any platform>" + "" + "" + "" + "" + "" + "" + "Tiled" 0 1 0 - 0 1 0 0 @@ -260,6 +276,7 @@ -1 400 300 + 0 "" "wxBoxSizer H" @@ -368,7 +385,13 @@ "wxEVT_COMMAND_RADIOBOX_SELECTED|OnSetPrintScaleSelected" "ID_SET_PRINT_SCALE" 10004 + "" "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" "m_ScaleOption" "Approx. Scale:" 1 @@ -384,6 +407,11 @@ "<Any platform>" "s_Scale_Select" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" 0 1 0 @@ -421,7 +449,13 @@ "wbStaticTextProxy" "wxID_STATIC" 5105 + "" "wxStaticText" + "wxStaticText" + 1 + 0 + "" + "" "m_FineAdjustXscaleTitle" "X Scale Adjust" -1 @@ -435,6 +469,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -480,7 +519,13 @@ "wbTextCtrlProxy" "ID_TEXTCTRL" 10009 + "" "wxTextCtrl" + "wxTextCtrl" + 1 + 0 + "" + "" "m_FineAdjustXscaleOpt" "" 0 @@ -494,6 +539,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -507,8 +557,9 @@ 0 0 0 - 0 + 0 0 + 0 0 0 0 @@ -550,7 +601,13 @@ "wbStaticTextProxy" "wxID_STATIC" 5105 + "" "wxStaticText" + "wxStaticText" + 1 + 0 + "" + "" "m_FineAdjustYscaleTitle" "Y Scale Adjust" -1 @@ -564,6 +621,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -609,7 +671,13 @@ "wbTextCtrlProxy" "ID_TEXTCTRL1" 10010 + "" "wxTextCtrl" + "wxTextCtrl" + 1 + 0 + "" + "" "m_FineAdjustYscaleOpt" "" 0 @@ -623,6 +691,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 0 0 @@ -636,8 +709,9 @@ 0 0 0 - 0 + 0 0 + 0 0 0 0 @@ -665,6 +739,7 @@ 0 "" "" + 0 @@ -732,13 +807,14 @@ "wxID_ANY" -1 "Options:" + "" "" "" "" 0 1 + "wxStaticBox" "Vertical" - "" "Expand" "Centre" 0 @@ -763,7 +839,7 @@ "24/1/2007" "wbBoxSizerProxy" "Vertical" - "m_ButtPenWidthSizer" + "m_DialogPenWidthSizer" "Expand" "Centre" 0 @@ -790,7 +866,13 @@ "wbCheckBoxProxy" "ID_PRINT_REF" 10006 + "" "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_Print_Sheet_Ref" "Print Sheet Ref" 0 @@ -798,6 +880,11 @@ "" "s_Print_Sheet_Ref" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" "" "" "" @@ -843,7 +930,13 @@ "wbCheckBoxProxy" "ID_CHECK_PRINT_MIROR" 10011 + "" "wxCheckBox" + "wxCheckBox" + 1 + 0 + "" + "" "m_Print_Mirror" "Mirror" 0 @@ -851,6 +944,11 @@ "" "s_PrintMirror" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" "" "" "" @@ -898,7 +996,13 @@ "wxEVT_COMMAND_RADIOBOX_SELECTED|OnSetBwSelected" "ID_SET_BW" 10007 + "" "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" "m_ColorOption" "Color Print:" 1 @@ -914,6 +1018,11 @@ "<Any platform>" "" "" + "" + "" + "" + "" + "" 0 1 0 @@ -951,11 +1060,17 @@ "wbRadioBoxProxy" "ID_PRINT_ALL_IN_ONE" 10008 + "" "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" "m_PagesOptionPcb" "Page Print:" 1 - "1 page per layer|Single Page" + "1 Page per Layer|Single Page" 0 "" "" @@ -967,6 +1082,11 @@ "<Any platform>" "s_OptionPrintPage" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" 0 1 0 @@ -1004,7 +1124,13 @@ "wbRadioBoxProxy" "ID_PRINT_ALL" 10008 + "" "wxRadioBox" + "wxRadioBox" + 1 + 0 + "" + "" "m_PagesOptionEeschema" "Page Print:" 1 @@ -1020,6 +1146,11 @@ "<Any platform>" "s_OptionPrintPage" "wxGenericValidator(& %VARIABLE%)" + "" + "" + "" + "" + "" 0 1 0 @@ -1136,12 +1267,25 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnPrintSetupClick" "ID_PRINT_SETUP" 10001 + "" "wxButton" + "wxButton" + 1 + 0 + "" + "" "" "Print S&etup" 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "797600" "" @@ -1190,12 +1334,25 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnPrintPreviewClick" "ID_PRINT_PREVIEW" 10002 + "" "wxButton" + "wxButton" + 1 + 0 + "" + "" "" "Pre&view" 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "0000C4" "" @@ -1244,12 +1401,25 @@ "wxEVT_COMMAND_BUTTON_CLICKED|OnPrintExecuteClick" "ID_PRINT_EXECUTE" 10003 + "" "wxButton" + "wxButton" + 1 + 0 + "" + "" "" "&Print" 0 "" "" + "" + "" + "" + "" + "" + "" + "" "" "008040" "" @@ -1285,7 +1455,7 @@ "" - "wxButton: wxID_CLOSE" + "wxButton: wxID_CANCEL" "dialog-control-document" "" "dialogcontrol" @@ -1295,15 +1465,28 @@ 0 "28/12/2006" "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnCloseClick" - "wxID_CLOSE" - 5001 + "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick|||WinEDA_PrintFrame" + "wxID_CANCEL" + 5101 + "" "wxButton" - "" + "wxButton" + 1 + 0 + "" + "" + "m_CloseButton" "&Close" - 0 + 1 "" "" + "" + "" + "" + "" + "" + "" + "" "" "" ""