From 6bdc9cd25ec38db9948c93f74730d9a9212f6387 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 11 Aug 2017 09:44:06 +0200 Subject: [PATCH] fix a minor issue in dialog netlist, and add comments in code. --- eeschema/dialogs/dialog_netlist.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp index 76b3518d46..2b84556fe8 100644 --- a/eeschema/dialogs/dialog_netlist.cpp +++ b/eeschema/dialogs/dialog_netlist.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras@wanadoo.fr + * Copyright (C) 2013-2017 Jean-Pierre Charras, jp.charras@wanadoo.fr * Copyright (C) 2013-2015 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -145,7 +145,13 @@ private: void GenNetlist( wxCommandEvent& event ) override; void RunSimulator( wxCommandEvent& event ); void NetlistUpdateOpt(); + + // Called when changing the notebook page, therefore the current + // netlist format void OnNetlistTypeSelection( wxNotebookEvent& event ) override; + + // called when checking the "Default format" wxCheckBox + // in the current page of the notbook void SelectDefaultNetlistType( wxCommandEvent& event ); /** @@ -238,7 +244,7 @@ enum id_netlist { }; -// ID for configuration: +// keywords for configuration: #define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" ) #define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" ) #define NETLIST_USE_DEFAULT_NETNAME wxT( "NetlistUseDefaultNetname" ) @@ -342,8 +348,16 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) : // Add custom panels: InstallCustomPages(); + // Ensure a netlist format is selected: if( !m_asFormatSelected ) + { m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true ); + m_NoteBook->SetSelection( PANELPCBNEW ); + // call OnNetlistTypeSelection to update some widgets. + // SetSelection() do nothing if the current page is already PANELPCBNEW + wxNotebookEvent event; + OnNetlistTypeSelection( event ); + } SetDefaultItem( m_buttonNetlist ); @@ -490,6 +504,7 @@ void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event ) void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event ) { NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); + if( currPage == NULL ) return; @@ -497,6 +512,7 @@ void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event ) m_cbUseDefaultNetlistName->Enable( currPage->m_IdNetType < NET_TYPE_CUSTOM1 ); wxString fileExt; + if( FilenamePrms( currPage->m_IdNetType, &fileExt, NULL ) ) { wxFileName fn = g_RootSheet->GetScreen()->GetFileName();