From 31ab4e6c9a70080cada46b2c1b8822dce4336b53 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 8 Jan 2019 04:26:36 -0800 Subject: [PATCH] eeschema: Simplify netlist dialog The default filename textbox confusingly could not be edited and the checkbox for "Use default filename" would also use a default location. As the netlist export is no longer required in the workflow, we can simplify the layout to always show the user the file save dialog allowing them to choose the location and name of the exported netlist file. --- eeschema/dialogs/dialog_netlist.cpp | 38 +- eeschema/dialogs/dialog_netlist_base.cpp | 99 ++- eeschema/dialogs/dialog_netlist_base.fbp | 769 ++--------------------- eeschema/dialogs/dialog_netlist_base.h | 57 +- 4 files changed, 147 insertions(+), 816 deletions(-) diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp index 4287e0d0d3..ac60b8bdea 100644 --- a/eeschema/dialogs/dialog_netlist.cpp +++ b/eeschema/dialogs/dialog_netlist.cpp @@ -172,11 +172,6 @@ private: */ void WriteCurrentNetlistSetup(); - bool GetUseDefaultNetlistName() - { - return m_cbUseDefaultNetlistName->IsChecked(); - } - /** * Function UserNetlistTypeName * to retrieve user netlist type names @@ -314,7 +309,6 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) : long tmp; m_config->Read( NETLIST_USE_DEFAULT_NETNAME, &tmp, 0l ); - m_cbUseDefaultNetlistName->SetValue( tmp ); m_NetFmtName = m_Parent->GetNetListFormatName(); for( int ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ ) @@ -508,18 +502,6 @@ void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event ) return; m_buttonDelPlugin->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 ); - m_cbUseDefaultNetlistName->Enable( currPage->m_IdNetType < NET_TYPE_CUSTOM1 ); - - wxString fileExt; - - if( FilenamePrms( currPage->m_IdNetType, &fileExt, NULL ) ) - { - wxFileName fn = g_RootSheet->GetScreen()->GetFileName(); - fn.SetExt( fileExt ); - m_textCtrlDefaultFileName->SetValue( fn.GetFullName() ); - } - else - m_textCtrlDefaultFileName->Clear(); } @@ -597,20 +579,16 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) ); wxString fullpath = fn.GetFullPath(); + wxString fullname = fn.GetFullName(); + wxString path = fn.GetPath(); - if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 ) - { - wxString fullname = fn.GetFullName(); - wxString path = fn.GetPath(); + // fullname does not and should not include the path, per wx docs. + wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE ); - // fullname does not and should not include the path, per wx docs. - wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE ); + if( dlg.ShowModal() == wxID_CANCEL ) + return; - if( dlg.ShowModal() == wxID_CANCEL ) - return; - - fullpath = dlg.GetPath(); // directory + filename - } + fullpath = dlg.GetPath(); // directory + filename m_Parent->ClearMsgPanel(); @@ -710,8 +688,6 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup() NetlistUpdateOpt(); - m_config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() ); - // Update existing custom pages int jj = 0; for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ ) diff --git a/eeschema/dialogs/dialog_netlist_base.cpp b/eeschema/dialogs/dialog_netlist_base.cpp index d682bf8907..d1f451f936 100644 --- a/eeschema/dialogs/dialog_netlist_base.cpp +++ b/eeschema/dialogs/dialog_netlist_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Nov 23 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -20,65 +20,55 @@ END_EVENT_TABLE() NETLIST_DIALOG_BASE::NETLIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - + wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); - + m_NoteBook = new wxNotebook( this, ID_CHANGE_NOTEBOOK_PAGE, wxDefaultPosition, wxDefaultSize, 0 ); - + bRightSizer->Add( m_NoteBook, 1, wxEXPAND | wxALL, 5 ); - - + + bUpperSizer->Add( bRightSizer, 5, wxEXPAND, 5 ); - + wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); - - + + bLeftSizer->Add( 0, 0, 0, wxTOP, 15 ); - + m_buttonNetlist = new wxButton( this, ID_CREATE_NETLIST, _("Generate Netlist"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftSizer->Add( m_buttonNetlist, 0, wxALL|wxEXPAND, 5 ); - + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 ); - + m_buttonAddPlugin = new wxButton( this, ID_ADD_PLUGIN, _("Add Plugin..."), wxDefaultPosition, wxDefaultSize, 0 ); bLeftSizer->Add( m_buttonAddPlugin, 0, wxALL|wxEXPAND, 5 ); - + m_buttonDelPlugin = new wxButton( this, ID_DEL_PLUGIN, _("Remove Plugin..."), wxDefaultPosition, wxDefaultSize, 0 ); bLeftSizer->Add( m_buttonDelPlugin, 0, wxALL|wxEXPAND, 5 ); - - m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bLeftSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - - m_cbUseDefaultNetlistName = new wxCheckBox( this, wxID_ANY, _("Use default netname"), wxDefaultPosition, wxDefaultSize, 0 ); - bLeftSizer->Add( m_cbUseDefaultNetlistName, 0, wxALL, 5 ); - - + + + bLeftSizer->Add( 0, 0, 1, wxBOTTOM, 10 ); + + bUpperSizer->Add( bLeftSizer, 2, wxEXPAND, 5 ); - - + + bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 ); - - m_staticTextDefaultFN = new wxStaticText( this, wxID_ANY, _("Default Netlist Filename:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDefaultFN->Wrap( -1 ); - bMainSizer->Add( m_staticTextDefaultFN, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_textCtrlDefaultFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - bMainSizer->Add( m_textCtrlDefaultFileName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - + + this->SetSizer( bMainSizer ); this->Layout(); bMainSizer->Fit( this ); - + this->Centre( wxBOTH ); } @@ -95,53 +85,54 @@ END_EVENT_TABLE() NETLIST_DIALOG_ADD_PLUGIN_BASE::NETLIST_DIALOG_ADD_PLUGIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxHORIZONTAL ); - + wxBoxSizer* bSizerLeft; bSizerLeft = new wxBoxSizer( wxVERTICAL ); - + m_staticTextCmd = new wxStaticText( this, wxID_ANY, _("Netlist command:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCmd->Wrap( -1 ); bSizerLeft->Add( m_staticTextCmd, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - + m_textCtrlCommand = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlCommand->SetMinSize( wxSize( 300,-1 ) ); - + bSizerLeft->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - + m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextName->Wrap( -1 ); bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - + m_textCtrlName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bSizerLeft->Add( m_textCtrlName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - + + bSizerMain->Add( bSizerLeft, 1, wxEXPAND, 5 ); - + wxBoxSizer* bSizerRight; bSizerRight = new wxBoxSizer( wxVERTICAL ); - + m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonOK->SetDefault(); + + m_buttonOK->SetDefault(); bSizerRight->Add( m_buttonOK, 0, wxALL|wxEXPAND, 5 ); - + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 ); - + m_buttonPlugin = new wxButton( this, wxID_BROWSE_PLUGINS, _("Browse Plugins"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_buttonPlugin, 0, wxALL|wxEXPAND, 5 ); - - + + bSizerMain->Add( bSizerRight, 0, wxEXPAND, 5 ); - - + + this->SetSizer( bSizerMain ); this->Layout(); bSizerMain->Fit( this ); - + this->Centre( wxBOTH ); } diff --git a/eeschema/dialogs/dialog_netlist_base.fbp b/eeschema/dialogs/dialog_netlist_base.fbp index 6c99127307..7cde7159be 100644 --- a/eeschema/dialogs/dialog_netlist_base.fbp +++ b/eeschema/dialogs/dialog_netlist_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ dialog_netlist_base 1000 none + 1 dialog_netlist_base @@ -52,42 +53,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bMainSizer @@ -168,31 +133,7 @@ - - - - - - - - - - - - - - - - OnNetlistTypeSelection - - - - - - - - @@ -231,25 +172,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 ID_CREATE_NETLIST Generate Netlist + + 0 0 @@ -264,6 +211,8 @@ protected 1 + + Resizable 1 @@ -279,29 +228,6 @@ GenNetlist - - - - - - - - - - - - - - - - - - - - - - - @@ -319,25 +245,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_CANCEL Close + + 0 0 @@ -352,6 +284,8 @@ protected 1 + + Resizable 1 @@ -367,29 +301,6 @@ OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - @@ -407,25 +318,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 ID_ADD_PLUGIN Add Plugin... + + 0 0 @@ -440,6 +357,8 @@ protected 1 + + Resizable 1 @@ -455,29 +374,6 @@ OnAddPlugin - - - - - - - - - - - - - - - - - - - - - - - @@ -495,25 +391,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 ID_DEL_PLUGIN Remove Plugin... + + 0 0 @@ -528,6 +430,8 @@ protected 1 + + Resizable 1 @@ -543,378 +447,22 @@ OnDelPlugin - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - + + 10 + wxBOTTOM + 1 + + 0 protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Use default netname - - 0 - - - 0 - - 1 - m_cbUseDefaultNetlistName - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 0 - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Default Netlist Filename: - - 0 - - - 0 - - 1 - m_staticTextDefaultFN - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_textCtrlDefaultFileName - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -943,52 +491,16 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain wxHORIZONTAL none - + 5 wxEXPAND 1 - + bSizerLeft wxVERTICAL @@ -1026,6 +538,7 @@ 0 wxID_ANY Netlist command: + 0 0 @@ -1051,29 +564,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1138,33 +628,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1200,6 +663,7 @@ 0 wxID_ANY Name: + 0 0 @@ -1225,29 +689,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1312,33 +753,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1367,25 +781,31 @@ + 1 0 1 1 + 1 0 + Dock 0 Left 1 1 + 0 0 wxID_OK OK + + 0 0 @@ -1400,6 +820,8 @@ protected 1 + + Resizable 1 @@ -1415,29 +837,6 @@ OnOKClick - - - - - - - - - - - - - - - - - - - - - - - @@ -1455,25 +854,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_CANCEL Cancel + + 0 0 @@ -1488,6 +893,8 @@ protected 1 + + Resizable 1 @@ -1503,29 +910,6 @@ OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - @@ -1543,25 +927,31 @@ + 1 0 1 1 + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_BROWSE_PLUGINS Browse Plugins + + 0 0 @@ -1576,6 +966,8 @@ protected 1 + + Resizable 1 @@ -1591,29 +983,6 @@ OnBrowsePlugins - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_netlist_base.h b/eeschema/dialogs/dialog_netlist_base.h index a79b6ea6dd..8b5c034c13 100644 --- a/eeschema/dialogs/dialog_netlist_base.h +++ b/eeschema/dialogs/dialog_netlist_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Nov 23 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_NETLIST_BASE_H__ -#define __DIALOG_NETLIST_BASE_H__ +#pragma once #include #include @@ -19,12 +18,13 @@ #include #include #include +#include +#include +#include #include -#include -#include +#include #include #include -#include /////////////////////////////////////////////////////////////////////////// @@ -35,15 +35,15 @@ class NETLIST_DIALOG_BASE : public DIALOG_SHIM { DECLARE_EVENT_TABLE() private: - + // Private event handlers void _wxFB_OnNetlistTypeSelection( wxNotebookEvent& event ){ OnNetlistTypeSelection( event ); } void _wxFB_GenNetlist( wxCommandEvent& event ){ GenNetlist( event ); } void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } void _wxFB_OnAddPlugin( wxCommandEvent& event ){ OnAddPlugin( event ); } void _wxFB_OnDelPlugin( wxCommandEvent& event ){ OnDelPlugin( event ); } - - + + protected: enum { @@ -52,30 +52,26 @@ class NETLIST_DIALOG_BASE : public DIALOG_SHIM ID_ADD_PLUGIN, ID_DEL_PLUGIN }; - + wxNotebook* m_NoteBook; wxButton* m_buttonNetlist; wxButton* m_buttonCancel; wxButton* m_buttonAddPlugin; wxButton* m_buttonDelPlugin; - wxStaticLine* m_staticline1; - wxCheckBox* m_cbUseDefaultNetlistName; - wxStaticText* m_staticTextDefaultFN; - wxTextCtrl* m_textCtrlDefaultFileName; - + // Virtual event handlers, overide them in your derived class virtual void OnNetlistTypeSelection( wxNotebookEvent& event ) { event.Skip(); } virtual void GenNetlist( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddPlugin( wxCommandEvent& event ) { event.Skip(); } virtual void OnDelPlugin( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - NETLIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Netlist"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + + NETLIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Netlist"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~NETLIST_DIALOG_BASE(); - + }; /////////////////////////////////////////////////////////////////////////////// @@ -85,19 +81,19 @@ class NETLIST_DIALOG_ADD_PLUGIN_BASE : public DIALOG_SHIM { DECLARE_EVENT_TABLE() private: - + // Private event handlers void _wxFB_OnOKClick( wxCommandEvent& event ){ OnOKClick( event ); } void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } void _wxFB_OnBrowsePlugins( wxCommandEvent& event ){ OnBrowsePlugins( event ); } - - + + protected: enum { wxID_BROWSE_PLUGINS = 1000 }; - + wxStaticText* m_staticTextCmd; wxTextCtrl* m_textCtrlCommand; wxStaticText* m_staticTextName; @@ -105,18 +101,17 @@ class NETLIST_DIALOG_ADD_PLUGIN_BASE : public DIALOG_SHIM wxButton* m_buttonOK; wxButton* m_buttonCancel; wxButton* m_buttonPlugin; - + // Virtual event handlers, overide them in your derived class virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnBrowsePlugins( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - NETLIST_DIALOG_ADD_PLUGIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plugin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + + NETLIST_DIALOG_ADD_PLUGIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plugin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~NETLIST_DIALOG_ADD_PLUGIN_BASE(); - + }; -#endif //__DIALOG_NETLIST_BASE_H__