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.
This commit is contained in:
Seth Hillbrand 2019-01-08 04:26:36 -08:00
parent 419718b596
commit 31ab4e6c9a
4 changed files with 147 additions and 816 deletions

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -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 <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -19,12 +18,13 @@
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -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__