Unroll a level of prefs for fieldname templates.
It was playing havoc with the saving of project and global templates without one overwriting the other. Fixes https://gitlab.com/kicad/code/kicad/issues/5415
This commit is contained in:
parent
7652637553
commit
20211eed49
|
@ -41,7 +41,6 @@ PROJECT_FILE::PROJECT_FILE( const wxString& aFullPath ) :
|
|||
m_project( nullptr ),
|
||||
m_ErcSettings( nullptr ),
|
||||
m_SchematicSettings( nullptr ),
|
||||
m_TemplateFieldNames( nullptr ),
|
||||
m_BoardSettings()
|
||||
{
|
||||
// Keep old files around
|
||||
|
|
|
@ -798,7 +798,7 @@ bool SETTINGS_MANAGER::SaveProject( const wxString& aFullPath )
|
|||
return false;
|
||||
|
||||
PROJECT_FILE* project = m_project_files.at( path );
|
||||
wxString projectPath = GetPathForSettingsFile( project );
|
||||
wxString projectPath = GetPathForSettingsFile( project );
|
||||
|
||||
project->SaveToFile( projectPath );
|
||||
Prj().GetLocalSettings().SaveToFile( projectPath );
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
|
||||
#include <template_fieldnames.h>
|
||||
#include <dsnlexer.h>
|
||||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
#include <pgm_base.h>
|
||||
|
|
|
@ -64,13 +64,13 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aUse
|
|||
if( aUseReset )
|
||||
{
|
||||
m_resetButton = new wxButton( this, wxID_ANY, _( "Reset to Defaults" ) );
|
||||
buttonsSizer->Add( m_resetButton, 0, wxRIGHT | wxLEFT, 5 );
|
||||
buttonsSizer->Add( m_resetButton, 0, wxALL, 5 );
|
||||
}
|
||||
|
||||
if( !aAuxiliaryAction.IsEmpty() )
|
||||
{
|
||||
m_auxiliaryButton = new wxButton( this, wxID_ANY, aAuxiliaryAction );
|
||||
buttonsSizer->Add( m_auxiliaryButton, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
buttonsSizer->Add( m_auxiliaryButton, 0, wxALL, 5 );
|
||||
}
|
||||
|
||||
buttonsSizer->AddStretchSpacer();
|
||||
|
|
|
@ -149,7 +149,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
|
|||
}
|
||||
|
||||
// Add in any template fieldnames not yet defined:
|
||||
for( const TEMPLATE_FIELDNAME& templateFieldname : GetParent()->GetTemplateFieldNames() )
|
||||
for( const TEMPLATE_FIELDNAME& templateFieldname :
|
||||
GetParent()->Schematic().Settings().m_TemplateFieldNames.GetTemplateFieldNames() )
|
||||
{
|
||||
if( defined.count( templateFieldname.m_Name ) <= 0 )
|
||||
{
|
||||
|
@ -400,6 +401,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
|||
return false;
|
||||
|
||||
SCH_SCREEN* currentScreen = GetParent()->GetScreen();
|
||||
SCHEMATIC& schematic = GetParent()->Schematic();
|
||||
|
||||
wxCHECK( currentScreen, false );
|
||||
|
||||
|
@ -483,8 +485,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
|||
|
||||
// Push all fields to the component -except- for those which are TEMPLATE_FIELDNAMES
|
||||
// with empty values.
|
||||
TEMPLATE_FIELDNAMES templateFieldnames = GetParent()->GetTemplateFieldNames();
|
||||
SCH_FIELDS& fields = m_cmp->GetFields();
|
||||
SCH_FIELDS& fields = m_cmp->GetFields();
|
||||
|
||||
fields.clear();
|
||||
|
||||
|
@ -495,7 +496,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
|||
|
||||
if( i >= MANDATORY_FIELDS )
|
||||
{
|
||||
for( const auto& fieldname : templateFieldnames )
|
||||
for( const TEMPLATE_FIELDNAME& fieldname :
|
||||
schematic.Settings().m_TemplateFieldNames.GetTemplateFieldNames() )
|
||||
{
|
||||
if( field.GetName() == fieldname.m_Name && field.GetText().IsEmpty() )
|
||||
{
|
||||
|
@ -746,7 +748,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary( wxCommandEvent
|
|||
}
|
||||
|
||||
// Add in any template fieldnames not yet defined:
|
||||
for( const TEMPLATE_FIELDNAME& templateFieldname : GetParent()->GetTemplateFieldNames() )
|
||||
for( const TEMPLATE_FIELDNAME& templateFieldname :
|
||||
GetParent()->Schematic().Settings().m_TemplateFieldNames.GetTemplateFieldNames() )
|
||||
{
|
||||
if( defined.count( templateFieldname.m_Name ) <= 0 )
|
||||
{
|
||||
|
|
|
@ -957,10 +957,11 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames()
|
|||
AddField( fieldName, true, false );
|
||||
|
||||
// Add any templateFieldNames which aren't already present in the userFieldNames
|
||||
for( const TEMPLATE_FIELDNAME& templateFieldName : m_parent->GetTemplateFieldNames() )
|
||||
for( const TEMPLATE_FIELDNAME& templateFieldname :
|
||||
m_parent->Schematic().Settings().m_TemplateFieldNames.GetTemplateFieldNames() )
|
||||
{
|
||||
if( userFieldNames.count( templateFieldName.m_Name ) == 0 )
|
||||
AddField( templateFieldName.m_Name, false, false );
|
||||
if( userFieldNames.count( templateFieldname.m_Name ) == 0 )
|
||||
AddField( templateFieldname.m_Name, false, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,23 +153,20 @@ void DIALOG_SCHEMATIC_SETUP::OnAuxiliaryAction( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
PROJECT* otherPrj = m_frame->GetSettingsManager()->GetProject( projectFn.GetFullPath() );
|
||||
|
||||
SCHEMATIC otherSch( otherPrj );
|
||||
|
||||
TEMPLATES templateMgr;
|
||||
PROJECT* otherPrj = m_frame->GetSettingsManager()->GetProject( projectFn.GetFullPath() );
|
||||
SCHEMATIC otherSch( otherPrj );
|
||||
TEMPLATES templateMgr;
|
||||
PROJECT_FILE& file = otherPrj->GetProjectFile();
|
||||
|
||||
wxASSERT( file.m_SchematicSettings );
|
||||
|
||||
file.m_SchematicSettings->m_TemplateFieldNames = &templateMgr;
|
||||
file.m_SchematicSettings->LoadFromFile();
|
||||
|
||||
if( importDlg.m_FormattingOpt->GetValue() )
|
||||
m_formatting->ImportSettingsFrom( *file.m_SchematicSettings );
|
||||
|
||||
if( importDlg.m_FieldNameTemplatesOpt->GetValue() )
|
||||
m_fieldNameTemplates->ImportSettingsFrom( file.m_SchematicSettings->m_TemplateFieldNames );
|
||||
m_fieldNameTemplates->ImportSettingsFrom( &otherSch.Settings().m_TemplateFieldNames );
|
||||
|
||||
if( importDlg.m_PinMapOpt->GetValue() )
|
||||
m_pinMap->ImportSettingsFrom( file.m_ErcSettings->m_PinMap );
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <grid_tricks.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <schematic.h>
|
||||
#include <panel_eeschema_template_fieldnames.h>
|
||||
|
||||
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT_FRAME* aFrame,
|
||||
|
@ -67,7 +67,9 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::~PANEL_EESCHEMA_TEMPLATE_FIELDNAMES()
|
|||
|
||||
bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataToWindow()
|
||||
{
|
||||
m_fields = m_frame->GetTemplateFieldNames( m_global );
|
||||
SCHEMATIC& schematic = m_frame->Schematic();
|
||||
|
||||
m_fields = schematic.Settings().m_TemplateFieldNames.GetTemplateFieldNames( m_global );
|
||||
return TransferDataToGrid();
|
||||
}
|
||||
|
||||
|
@ -164,10 +166,12 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
|
|||
if( !TransferDataFromGrid() )
|
||||
return false;
|
||||
|
||||
m_frame->DeleteAllTemplateFieldNames( m_global );
|
||||
SCHEMATIC& schematic = m_frame->Schematic();
|
||||
|
||||
schematic.Settings().m_TemplateFieldNames.DeleteAllFieldNameTemplates( m_global );
|
||||
|
||||
for( const TEMPLATE_FIELDNAME& field : m_fields )
|
||||
m_frame->AddTemplateFieldName( field, m_global );
|
||||
schematic.Settings().m_TemplateFieldNames.AddTemplateFieldName( field, m_global );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -375,26 +375,6 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
for( double& factor : aCfg->m_Window.zoom_factors )
|
||||
factor = std::min( factor, MAX_ZOOM_FACTOR );
|
||||
|
||||
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
wxString templateFieldNames = cfg->m_Drawing.field_names;
|
||||
|
||||
if( !templateFieldNames.IsEmpty() )
|
||||
{
|
||||
TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
|
||||
|
||||
try
|
||||
{
|
||||
m_templateFieldNames.Parse( &lexer, true );
|
||||
}
|
||||
catch( const IO_ERROR& )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -403,19 +383,6 @@ void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
wxCHECK_RET( aCfg, "Call to SCH_BASE_FRAME::SaveSettings with null settings" );
|
||||
|
||||
EDA_DRAW_FRAME::SaveSettings( aCfg );
|
||||
|
||||
if( eeconfig() )
|
||||
{
|
||||
// Save template fieldnames
|
||||
STRING_FORMATTER sf;
|
||||
m_templateFieldNames.Format( &sf, 0, true );
|
||||
|
||||
wxString record = FROM_UTF8( sf.GetString().c_str() );
|
||||
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
|
||||
record.Replace( wxT(" "), wxT(" "), true ); // double space to single
|
||||
|
||||
eeconfig()->m_Drawing.field_names = record.ToStdString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <widgets/grid_icon_text_helpers.h>
|
||||
#include <widgets/grid_text_button_helpers.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <project/project_file.h>
|
||||
#include "eda_doc.h"
|
||||
|
||||
|
||||
|
@ -307,8 +307,10 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
|
|||
}
|
||||
else
|
||||
{
|
||||
wxString fieldname = GetValue( aRow, FDC_NAME );
|
||||
const TEMPLATE_FIELDNAME* templateFn = m_frame->GetTemplateFieldName( fieldname );
|
||||
wxString fn = GetValue( aRow, FDC_NAME );
|
||||
|
||||
SCHEMATIC_SETTINGS* settings = m_frame->Prj().GetProjectFile().m_SchematicSettings;
|
||||
const TEMPLATE_FIELDNAME* templateFn = settings->m_TemplateFieldNames.GetFieldName( fn );
|
||||
|
||||
if( templateFn && templateFn->m_URL )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2015-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2020 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
|
||||
|
@ -90,10 +90,8 @@ LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
|
|||
class SCH_BASE_FRAME : public EDA_DRAW_FRAME
|
||||
{
|
||||
protected:
|
||||
TEMPLATES m_templateFieldNames;
|
||||
|
||||
/// These are only used by libedit. Eeschema should be using the one inside the SCHEMATIC.
|
||||
SCHEMATIC_SETTINGS m_base_frame_defaults;
|
||||
SCHEMATIC_SETTINGS m_base_frame_defaults;
|
||||
|
||||
SCHEMATIC_SETTINGS* m_defaults;
|
||||
|
||||
|
@ -180,33 +178,6 @@ public:
|
|||
const LIB_ID* aHighlight = nullptr,
|
||||
bool aAllowFields = true );
|
||||
|
||||
/**
|
||||
* Return a template field names list for read only access.
|
||||
*/
|
||||
const TEMPLATE_FIELDNAMES& GetTemplateFieldNames()
|
||||
{
|
||||
return m_templateFieldNames.GetTemplateFieldNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a specific template field names list (global or project) for read only access.
|
||||
*/
|
||||
const TEMPLATE_FIELDNAMES& GetTemplateFieldNames( bool aGlobal )
|
||||
{
|
||||
return m_templateFieldNames.GetTemplateFieldNames( aGlobal );
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for \a aName in the the template field name list.
|
||||
*
|
||||
* @param aName A wxString object containing the field name to search for.
|
||||
* @return the template fieldname if found; NULL otherwise.
|
||||
*/
|
||||
const TEMPLATE_FIELDNAME* GetTemplateFieldName( const wxString& aName )
|
||||
{
|
||||
return m_templateFieldNames.GetFieldName( aName );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load symbol from symbol library table.
|
||||
*
|
||||
|
|
|
@ -26,12 +26,9 @@
|
|||
#include <class_library.h>
|
||||
#include <confirm.h>
|
||||
#include <connection_graph.h>
|
||||
#include <dialog_symbol_remap.h>
|
||||
#include <dialogs/dialog_schematic_find.h>
|
||||
#include <eeschema_config.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <executable_names.h>
|
||||
#include <fctsys.h>
|
||||
#include <general.h>
|
||||
#include <gestfich.h>
|
||||
#include <gr_basic.h>
|
||||
|
@ -54,7 +51,6 @@
|
|||
#include <settings/settings_manager.h>
|
||||
#include <advanced_config.h>
|
||||
#include <sim/sim_plot_frame.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <tool/action_manager.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tool/common_control.h>
|
||||
|
@ -526,7 +522,6 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
{
|
||||
m_schematic->Reset();
|
||||
m_schematic->SetProject( &Prj() );
|
||||
m_schematic->SetTemplateFieldNames( &m_templateFieldNames );
|
||||
|
||||
m_schematic->SetRoot( new SCH_SHEET( m_schematic ) );
|
||||
|
||||
|
@ -678,7 +673,6 @@ void SCH_EDIT_FRAME::doCloseWindow()
|
|||
SetScreen( nullptr );
|
||||
|
||||
GetSettingsManager()->SaveProject();
|
||||
Schematic().SetTemplateFieldNames( nullptr );
|
||||
Schematic().Reset();
|
||||
|
||||
Destroy();
|
||||
|
|
|
@ -185,29 +185,6 @@ public:
|
|||
|
||||
void ShowSchematicSetupDialog( const wxString& aInitialPage = wxEmptyString );
|
||||
|
||||
/**
|
||||
* Insert or append a wanted symbol field name into the field names template.
|
||||
*
|
||||
* Should be used for any symbol property editor. If the name already exists, it
|
||||
* overwrites the same name.
|
||||
*
|
||||
* @param aFieldName is a full description of the wanted field, and it must not match
|
||||
* any of the default field names.
|
||||
* @param aGlobal indicates whether to add to the global or project table
|
||||
*/
|
||||
void AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName, bool aGlobal )
|
||||
{
|
||||
m_templateFieldNames.AddTemplateFieldName( aFieldName, aGlobal );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all global or project fieldname templates.
|
||||
*/
|
||||
void DeleteAllTemplateFieldNames( bool aGlobal )
|
||||
{
|
||||
m_templateFieldNames.DeleteAllFieldNameTemplates( aGlobal );
|
||||
}
|
||||
|
||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
|
|
|
@ -90,26 +90,12 @@ void SCHEMATIC::SetProject( PROJECT* aPrj )
|
|||
project.m_ErcSettings = new ERC_SETTINGS( &project, "erc" );
|
||||
project.m_SchematicSettings = new SCHEMATIC_SETTINGS( &project, "schematic" );
|
||||
|
||||
project.m_SchematicSettings->m_TemplateFieldNames = project.m_TemplateFieldNames;
|
||||
project.m_SchematicSettings->LoadFromFile();
|
||||
|
||||
project.m_ErcSettings->LoadFromFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCHEMATIC::SetTemplateFieldNames( TEMPLATES* aTemplates )
|
||||
{
|
||||
wxASSERT( m_project );
|
||||
PROJECT_FILE& project = m_project->GetProjectFile();
|
||||
|
||||
project.m_TemplateFieldNames = aTemplates;
|
||||
|
||||
if( project.m_SchematicSettings )
|
||||
project.m_SchematicSettings->m_TemplateFieldNames = aTemplates;
|
||||
}
|
||||
|
||||
|
||||
void SCHEMATIC::SetRoot( SCH_SHEET* aRootSheet )
|
||||
{
|
||||
wxCHECK_RET( aRootSheet, "Call to SetRoot with null SCH_SHEET!" );
|
||||
|
|
|
@ -81,9 +81,6 @@ public:
|
|||
|
||||
void SetProject( PROJECT* aPrj );
|
||||
|
||||
/// Sets up the template fieldnames link if this project is opened in eeschema
|
||||
void SetTemplateFieldNames( TEMPLATES* aTemplates );
|
||||
|
||||
/**
|
||||
* Builds and returns an updated schematic hierarchy
|
||||
* TODO: can this be cached?
|
||||
|
|
|
@ -41,8 +41,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
m_TextOffsetRatio( 0.08 ),
|
||||
m_PinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 ),
|
||||
m_JunctionSize( DEFAULT_JUNCTION_DIAM * IU_PER_MILS ),
|
||||
m_SpiceAdjustPassiveValues( false ),
|
||||
m_TemplateFieldNames( nullptr )
|
||||
m_SpiceAdjustPassiveValues( false )
|
||||
{
|
||||
EESCHEMA_SETTINGS* appSettings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
||||
|
@ -94,11 +93,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
{
|
||||
nlohmann::json ret = nlohmann::json::array();
|
||||
|
||||
if( !m_TemplateFieldNames )
|
||||
return ret;
|
||||
|
||||
for( const TEMPLATE_FIELDNAME& field :
|
||||
m_TemplateFieldNames->GetTemplateFieldNames( false ) )
|
||||
m_TemplateFieldNames.GetTemplateFieldNames( false ) )
|
||||
{
|
||||
ret.push_back( nlohmann::json( {
|
||||
{ "name", field.m_Name },
|
||||
|
@ -107,14 +103,29 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
} ) );
|
||||
}
|
||||
|
||||
auto* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
// Save global fieldname templates
|
||||
STRING_FORMATTER sf;
|
||||
m_TemplateFieldNames.Format( &sf, 0, true );
|
||||
|
||||
wxString record = FROM_UTF8( sf.GetString().c_str() );
|
||||
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
|
||||
record.Replace( wxT(" "), wxT(" "), true ); // double space to single
|
||||
|
||||
cfg->m_Drawing.field_names = record.ToStdString();
|
||||
}
|
||||
|
||||
return ret;
|
||||
},
|
||||
[&]( const nlohmann::json& aJson )
|
||||
{
|
||||
if( !m_TemplateFieldNames || aJson.empty() || !aJson.is_array() )
|
||||
if( aJson.empty() || !aJson.is_array() )
|
||||
return;
|
||||
|
||||
m_TemplateFieldNames->DeleteAllFieldNameTemplates( false );
|
||||
m_TemplateFieldNames.DeleteAllFieldNameTemplates( false );
|
||||
|
||||
for( const nlohmann::json& entry : aJson )
|
||||
{
|
||||
|
@ -125,7 +136,28 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
TEMPLATE_FIELDNAME field( entry["name"].get<wxString>() );
|
||||
field.m_URL = entry["url"].get<bool>();
|
||||
field.m_Visible = entry["visible"].get<bool>();
|
||||
m_TemplateFieldNames->AddTemplateFieldName( field, false );
|
||||
m_TemplateFieldNames.AddTemplateFieldName( field, false );
|
||||
}
|
||||
|
||||
auto* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
// Read global fieldname templates
|
||||
wxString templateFieldNames = cfg->m_Drawing.field_names;
|
||||
|
||||
if( !templateFieldNames.IsEmpty() )
|
||||
{
|
||||
TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
|
||||
|
||||
try
|
||||
{
|
||||
m_TemplateFieldNames.Parse( &lexer, true );
|
||||
}
|
||||
catch( const IO_ERROR& )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {} ) );
|
||||
|
||||
|
|
|
@ -42,25 +42,24 @@ public:
|
|||
|
||||
// Default sizes are all stored in IU here, and im mils in the JSON file
|
||||
|
||||
int m_DefaultLineWidth;
|
||||
int m_DefaultWireThickness;
|
||||
int m_DefaultBusThickness;
|
||||
int m_DefaultTextSize;
|
||||
double m_TextOffsetRatio;
|
||||
int m_PinSymbolSize;
|
||||
int m_JunctionSize;
|
||||
int m_DefaultLineWidth;
|
||||
int m_DefaultWireThickness;
|
||||
int m_DefaultBusThickness;
|
||||
int m_DefaultTextSize;
|
||||
double m_TextOffsetRatio;
|
||||
int m_PinSymbolSize;
|
||||
int m_JunctionSize;
|
||||
|
||||
wxString m_PageLayoutDescrFile;
|
||||
wxString m_PageLayoutDescrFile;
|
||||
|
||||
wxString m_PlotDirectoryName;
|
||||
wxString m_PlotDirectoryName;
|
||||
|
||||
wxString m_NetFormatName;
|
||||
wxString m_NetFormatName;
|
||||
|
||||
bool m_SpiceAdjustPassiveValues;
|
||||
wxString m_SpiceCommandString; // A command string to run external spice
|
||||
bool m_SpiceAdjustPassiveValues;
|
||||
wxString m_SpiceCommandString; // A command string to run external spice
|
||||
|
||||
/// @see PROJECT_FILE::m_TemplateFieldNames
|
||||
TEMPLATES* m_TemplateFieldNames;
|
||||
TEMPLATES m_TemplateFieldNames;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -137,17 +137,6 @@ public:
|
|||
// Schematic editing and misc settings: lifecycle managed by SCHEMATIC
|
||||
SCHEMATIC_SETTINGS* m_SchematicSettings;
|
||||
|
||||
/**
|
||||
* A pointer to the template fieldnames object owned by the parent SCH_BASE_FRAME.
|
||||
* Note that this coupling is unfortunate; but the TEMPLATES object has to outlive any
|
||||
* SCHEMATIC_SETTINGS object because it holds both global and project field names.
|
||||
* This will be null if the project is opened outside a SCH_BASE_FRAME. It is placed here
|
||||
* instead of in SCHEMATIC_SETTINGS because SCHEMATIC_SETTINGS objects are created and destroyed
|
||||
* when schematics are loaded, and it's inconvenient to make sure this pointer is set early so
|
||||
* that load of the SCHEMATIC_SETTINGS works.
|
||||
*/
|
||||
TEMPLATES* m_TemplateFieldNames;
|
||||
|
||||
// Legacy parameters LibDir and LibName, for importing old projects
|
||||
wxString m_LegacyLibDir;
|
||||
|
||||
|
|
Loading…
Reference in New Issue