Push a few missed project settings out of the frame

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4823
This commit is contained in:
Jon Evans 2020-07-06 17:21:42 -04:00
parent 3939b31027
commit 0410fdd9fb
4 changed files with 28 additions and 33 deletions

View File

@ -260,7 +260,9 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
{ {
m_Parent = parent; m_Parent = parent;
m_DefaultNetFmtName = m_Parent->GetNetListFormatName(); SCHEMATIC_SETTINGS& settings = m_Parent->Schematic().Settings();
m_DefaultNetFmtName = settings.m_NetFormatName;
for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType) for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType)
page = NULL; page = NULL;
@ -309,10 +311,12 @@ void NETLIST_DIALOG::InstallPageSpice()
NETLIST_PAGE_DIALOG* page = m_PanelNetType[PANELSPICE] = NETLIST_PAGE_DIALOG* page = m_PanelNetType[PANELSPICE] =
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE ); new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE );
SCHEMATIC_SETTINGS& settings = m_Parent->Schematic().Settings();
page->m_AdjustPassiveValues = new wxCheckBox( page, ID_USE_NETCODE_AS_NETNAME, page->m_AdjustPassiveValues = new wxCheckBox( page, ID_USE_NETCODE_AS_NETNAME,
_( "Reformat passive symbol values" ) ); _( "Reformat passive symbol values" ) );
page->m_AdjustPassiveValues->SetToolTip( _( "Reformat passive symbol values e.g. 1M -> 1Meg" ) ); page->m_AdjustPassiveValues->SetToolTip( _( "Reformat passive symbol values e.g. 1M -> 1Meg" ) );
page->m_AdjustPassiveValues->SetValue( m_Parent->GetSpiceAjustPassiveValues() ); page->m_AdjustPassiveValues->SetValue( settings.m_SpiceAdjustPassiveValues );
page->m_LeftBoxSizer->Add( page->m_AdjustPassiveValues, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 ); page->m_LeftBoxSizer->Add( page->m_AdjustPassiveValues, 0, wxGROW | wxBOTTOM | wxRIGHT, 5 );
} }
@ -390,8 +394,10 @@ void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
if( currPage == NULL ) if( currPage == NULL )
return; return;
SCHEMATIC_SETTINGS& settings = m_Parent->Schematic().Settings();
m_DefaultNetFmtName = currPage->GetPageNetFmtName(); m_DefaultNetFmtName = currPage->GetPageNetFmtName();
m_Parent->SetNetListFormatName( m_DefaultNetFmtName ); settings.m_NetFormatName = m_DefaultNetFmtName;
currPage->m_IsCurrentFormat->SetValue( true ); currPage->m_IsCurrentFormat->SetValue( true );
} }
@ -411,16 +417,18 @@ void NETLIST_DIALOG::NetlistUpdateOpt()
{ {
bool adjust = m_PanelNetType[ PANELSPICE ]->m_AdjustPassiveValues->IsChecked(); bool adjust = m_PanelNetType[ PANELSPICE ]->m_AdjustPassiveValues->IsChecked();
m_Parent->SetSpiceAdjustPassiveValues( adjust ); SCHEMATIC_SETTINGS& settings = m_Parent->Schematic().Settings();
m_Parent->SetNetListFormatName( wxEmptyString );
settings.m_SpiceAdjustPassiveValues = adjust;
settings.m_NetFormatName = wxEmptyString;
for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType ) for( NETLIST_PAGE_DIALOG*& page : m_PanelNetType )
{ {
if( page == NULL ) if( page == nullptr )
break; break;
if( page->m_IsCurrentFormat->GetValue() == true ) if( page->m_IsCurrentFormat->GetValue() )
m_Parent->SetNetListFormatName( page->GetPageNetFmtName() ); settings.m_NetFormatName = page->GetPageNetFmtName();
} }
} }
@ -711,12 +719,14 @@ int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
{ {
NETLIST_DIALOG dlg( aCaller ); NETLIST_DIALOG dlg( aCaller );
wxString curr_default_netformat = aCaller->GetNetListFormatName(); SCHEMATIC_SETTINGS& settings = aCaller->Schematic().Settings();
wxString curr_default_netformat = settings.m_NetFormatName;
int ret = dlg.ShowModal(); int ret = dlg.ShowModal();
// Update the default netlist and store it in prj config if it was explicitely changed. // Update the default netlist and store it in prj config if it was explicitely changed.
aCaller->SetNetListFormatName( dlg.m_DefaultNetFmtName ); // can have temporary changed settings.m_NetFormatName = dlg.m_DefaultNetFmtName; // can have temporary changed
if( curr_default_netformat != dlg.m_DefaultNetFmtName ) if( curr_default_netformat != dlg.m_DefaultNetFmtName )
aCaller->SaveProjectSettings(); aCaller->SaveProjectSettings();

View File

@ -127,7 +127,8 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
m_penWidth.SetValue( m_HPGLPenSize ); m_penWidth.SetValue( m_HPGLPenSize );
// Plot directory // Plot directory
wxString path = m_parent->GetPlotDirectoryName(); SCHEMATIC_SETTINGS& settings = m_parent->Schematic().Settings();
wxString path = settings.m_PlotDirectoryName;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
path.Replace( '/', '\\' ); path.Replace( '/', '\\' );
#endif #endif
@ -290,10 +291,12 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
wxString path = m_outputDirectoryName->GetValue(); wxString path = m_outputDirectoryName->GetValue();
path.Replace( '\\', '/' ); path.Replace( '\\', '/' );
if( m_parent->GetPlotDirectoryName() != path ) SCHEMATIC_SETTINGS& settings = m_parent->Schematic().Settings();
if( settings.m_PlotDirectoryName != path )
m_configChanged = true; m_configChanged = true;
m_parent->SetPlotDirectoryName( path ); settings.m_PlotDirectoryName = path;
} }

View File

@ -219,8 +219,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_findReplaceDialog = nullptr; m_findReplaceDialog = nullptr;
SetSpiceAdjustPassiveValues( false );
// Give an icon // Give an icon
wxIcon icon; wxIcon icon;
icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) ); icon.CopyFromBitmap( KiBitmap( icon_eeschema_xpm ) );

View File

@ -134,12 +134,6 @@ private:
DIALOG_SCH_FIND* m_findReplaceDialog; DIALOG_SCH_FIND* m_findReplaceDialog;
wxString m_plotDirectoryName;
wxString m_netListFormat;
/// Use netcodes (net number) as net names when generating spice net lists.
bool m_spiceAjustPassiveValues;
static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type. static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type.
protected: protected:
@ -175,16 +169,6 @@ public:
*/ */
bool GetShowAllPins() const override; bool GetShowAllPins() const override;
const wxString& GetNetListFormatName() const { return m_netListFormat; }
void SetNetListFormatName( const wxString& aFormat ) { m_netListFormat = aFormat; }
bool GetSpiceAjustPassiveValues() const { return m_spiceAjustPassiveValues; }
void SetSpiceAdjustPassiveValues( bool aEnable ) { m_spiceAjustPassiveValues = aEnable; }
/// accessor to the destination directory to use when generating plot files.
const wxString& GetPlotDirectoryName() const { return m_plotDirectoryName; }
void SetPlotDirectoryName( const wxString& aDirName ) { m_plotDirectoryName = aDirName; }
/** /**
* Save changes to the project settings to the project (.pro) file. * Save changes to the project settings to the project (.pro) file.
*/ */