7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-04 23:55:30 +00:00

Reduce dependency on dynamic_cast.

Also switches to checking __clang__ instead of __WXMAC__.
This commit is contained in:
Jeff Young 2024-12-08 21:46:47 +00:00
parent 04b5ccbdb2
commit 753d385473
85 changed files with 394 additions and 371 deletions
3d-viewer
common
eeschema
gerbview
include/settings
kicad
pagelayout_editor
pcbnew
qa/qa_utils

View File

@ -227,16 +227,8 @@ void BOARD_ADAPTER::ReloadColorSettings() noexcept
{
wxCHECK( PgmOrNull(), /* void */ );
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
if( cfg )
{

View File

@ -1093,7 +1093,7 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
void EDA_3D_CANVAS::RenderEngineChanged()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
switch( cfg->m_Render.engine )
{

View File

@ -480,7 +480,9 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
case ID_MENU3D_RESET_DEFAULTS:
{
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
cfg->ResetToDefaults();
LoadSettings( cfg );
@ -607,7 +609,8 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
{
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
EDA_BASE_FRAME::SaveSettings( cfg );

View File

@ -64,7 +64,8 @@ void PANEL_3D_DISPLAY_OPTIONS::loadViewSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataToWindow()
{
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
loadViewSettings( cfg );
@ -74,7 +75,8 @@ bool PANEL_3D_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
{
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
// Set visibility of items
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();

View File

@ -56,7 +56,8 @@ void PANEL_3D_OPENGL_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
bool PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow()
{
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
loadSettings( cfg );
@ -66,7 +67,8 @@ bool PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow()
bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow()
{
EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue();

View File

@ -110,8 +110,8 @@ void PANEL_3D_RAYTRACING_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
loadSettings( cfg );
@ -121,8 +121,8 @@ bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataToWindow()
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
cfg->m_Render.raytrace_shadows = m_cbRaytracing_renderShadows->GetValue();
cfg->m_Render.raytrace_backfloor = m_cbRaytracing_addFloor->GetValue();

View File

@ -204,7 +204,8 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
// TODO(JE) use all control options
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
if( cfg )
{

View File

@ -627,7 +627,7 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
aTable.Load( fn.GetFullPath() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
wxString packagesPath;

View File

@ -314,7 +314,8 @@ PANEL_DESIGN_BLOCK_LIB_TABLE::PANEL_DESIGN_BLOCK_LIB_TABLE( DIALOG_EDIT_LIBRARY_
choices.Add( DESIGN_BLOCK_IO_MGR::ShowType( fileType ) );
KICAD_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<KICAD_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
if( cfg->m_lastDesignBlockLibDir.IsEmpty() )
cfg->m_lastDesignBlockLibDir = PATHS::GetDefaultUserDesignBlocksPath();
@ -916,7 +917,8 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event
}
const IO_BASE::IO_FILE_DESC& fileDesc = m_supportedDesignBlockFiles.at( fileType );
KICAD_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<KICAD_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
wxString title =
wxString::Format( _( "Select %s Library" ), DESIGN_BLOCK_IO_MGR::ShowType( fileType ) );

View File

@ -48,13 +48,13 @@ PANEL_PACKAGES_AND_UPDATES::PANEL_PACKAGES_AND_UPDATES( wxWindow* parent ) :
bool PANEL_PACKAGES_AND_UPDATES::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
m_cbKicadUpdate->SetValue( settings->m_KiCadUpdateCheck );
m_cbPcmUpdate->SetValue( settings->m_PcmUpdateCheck );
m_libAutoAdd->SetValue( settings->m_PcmLibAutoAdd );
m_libAutoRemove->SetValue( settings->m_PcmLibAutoRemove );
m_libPrefix->SetValue( settings->m_PcmLibPrefix );
m_cbKicadUpdate->SetValue( cfg->m_KiCadUpdateCheck );
m_cbPcmUpdate->SetValue( cfg->m_PcmUpdateCheck );
m_libAutoAdd->SetValue( cfg->m_PcmLibAutoAdd );
m_libAutoRemove->SetValue( cfg->m_PcmLibAutoRemove );
m_libPrefix->SetValue( cfg->m_PcmLibPrefix );
return true;
}
@ -63,13 +63,13 @@ bool PANEL_PACKAGES_AND_UPDATES::TransferDataToWindow()
bool PANEL_PACKAGES_AND_UPDATES::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
settings->m_KiCadUpdateCheck = m_cbKicadUpdate->GetValue();
settings->m_PcmUpdateCheck = m_cbPcmUpdate->GetValue();
settings->m_PcmLibAutoAdd = m_libAutoAdd->GetValue();
settings->m_PcmLibAutoRemove = m_libAutoRemove->GetValue();
settings->m_PcmLibPrefix = m_libPrefix->GetValue();
cfg->m_KiCadUpdateCheck = m_cbKicadUpdate->GetValue();
cfg->m_PcmUpdateCheck = m_cbPcmUpdate->GetValue();
cfg->m_PcmLibAutoAdd = m_libAutoAdd->GetValue();
cfg->m_PcmLibAutoRemove = m_libAutoRemove->GetValue();
cfg->m_PcmLibPrefix = m_libPrefix->GetValue();
return true;
}

View File

@ -622,7 +622,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
aTable.Load( fn.GetFullPath() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
wxString packagesPath;

View File

@ -328,7 +328,8 @@ public:
VECTOR2I pos = last->GetPosition();
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( last->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
|| last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )

View File

@ -187,7 +187,10 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
// Add in any template fieldnames not yet defined:
// Read global fieldname templates
if( EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>() )
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg )
{
TEMPLATES templateMgr;

View File

@ -80,7 +80,7 @@ void PANEL_EESCHEMA_ANNOTATION_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS*
bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
loadEEschemaSettings( cfg );
@ -91,7 +91,7 @@ bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataToWindow()
bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
cfg->m_AnnotatePanel.automatic = m_checkAutoAnnotate->GetValue();

View File

@ -69,7 +69,7 @@ PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( wxWindow* aParent
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
EESCHEMA_SETTINGS* app_settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* app_settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
// Saved theme doesn't exist? Reset to default
@ -122,9 +122,10 @@ bool PANEL_EESCHEMA_COLOR_SETTINGS::TransferDataFromWindow()
if( !saveCurrentTheme( true ) )
return false;
SETTINGS_MANAGER& settingsMgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* app_settings = settingsMgr.GetAppSettings<EESCHEMA_SETTINGS>();
app_settings->m_ColorTheme = m_currentSettings->GetFilename();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
cfg->m_ColorTheme = m_currentSettings->GetFilename();
return true;
}

View File

@ -81,7 +81,7 @@ void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cf
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
loadEEschemaSettings( cfg );
@ -94,7 +94,7 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
cfg->m_Appearance.default_font = m_defaultFontCtrl->GetSelection() <= 0
? wxString( KICAD_FONT_NAME ) // This is a keyword. Do not translate

View File

@ -93,7 +93,7 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
loadEEschemaSettings( cfg );
@ -104,7 +104,7 @@ bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow()
bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
cfg->m_Drawing.default_sheet_border_color = m_borderColorSwatch->GetSwatchColor();
cfg->m_Drawing.default_sheet_background_color = m_backgroundColorSwatch->GetSwatchColor();

View File

@ -86,9 +86,9 @@ bool PANEL_SIMULATOR_PREFERENCES::TransferDataFromWindow()
return static_cast<SIM_MOUSE_WHEEL_ACTION>( aChoice->GetSelection() );
};
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
SIM_MOUSE_WHEEL_ACTION_SET& actions = settings->m_Simulator.preferences.mouse_wheel_actions;
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
SIM_MOUSE_WHEEL_ACTION_SET& actions = cfg->m_Simulator.preferences.mouse_wheel_actions;
actions.vertical_unmodified = toAction( m_choiceVScrollUnmodified );
actions.vertical_with_ctrl = toAction( m_choiceVScrollCtrl );
@ -103,9 +103,10 @@ bool PANEL_SIMULATOR_PREFERENCES::TransferDataFromWindow()
bool PANEL_SIMULATOR_PREFERENCES::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
const EESCHEMA_SETTINGS* settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
applyMouseScrollActionsToPanel( settings->m_Simulator.preferences.mouse_wheel_actions );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
applyMouseScrollActionsToPanel( cfg->m_Simulator.preferences.mouse_wheel_actions );
return true;
}

View File

@ -36,7 +36,7 @@ PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( wxWindow* aWindow ) :
bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( cfg->m_UseEeschemaColorSettings )
m_eeschemaRB->SetValue( true );
@ -73,7 +73,7 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();

View File

@ -51,7 +51,7 @@ void PANEL_SYM_DISPLAY_OPTIONS::loadSymEditorSettings( SYMBOL_EDITOR_SETTINGS* c
bool PANEL_SYM_DISPLAY_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
loadSymEditorSettings( cfg );
@ -64,7 +64,7 @@ bool PANEL_SYM_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_SYM_DISPLAY_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
cfg->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
cfg->m_ShowHiddenFields = m_checkShowHiddenFields->GetValue();

View File

@ -62,9 +62,9 @@ void PANEL_SYM_EDITING_OPTIONS::loadSymEditorSettings( SYMBOL_EDITOR_SETTINGS* a
bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* settings = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
loadSymEditorSettings( settings );
loadSymEditorSettings( cfg );
return true;
}
@ -73,19 +73,19 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow()
bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* settings = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
settings->m_Defaults.line_width = schIUScale.IUToMils( m_lineWidth.GetIntValue() );
settings->m_Defaults.text_size = schIUScale.IUToMils( m_textSize.GetIntValue() );
settings->m_Defaults.pin_length = schIUScale.IUToMils( m_pinLength.GetIntValue() );
settings->m_Defaults.pin_num_size = schIUScale.IUToMils( m_pinNumberSize.GetIntValue() );
settings->m_Defaults.pin_name_size = schIUScale.IUToMils( m_pinNameSize.GetIntValue() );
settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
settings->m_Repeat.pin_step = schIUScale.IUToMils( m_pinPitch.GetIntValue() );
settings->m_dragPinsAlongWithEdges = m_dragPinsWithEdges->GetValue();
cfg->m_Defaults.line_width = schIUScale.IUToMils( m_lineWidth.GetIntValue() );
cfg->m_Defaults.text_size = schIUScale.IUToMils( m_textSize.GetIntValue() );
cfg->m_Defaults.pin_length = schIUScale.IUToMils( m_pinLength.GetIntValue() );
cfg->m_Defaults.pin_num_size = schIUScale.IUToMils( m_pinNumberSize.GetIntValue() );
cfg->m_Defaults.pin_name_size = schIUScale.IUToMils( m_pinNameSize.GetIntValue() );
cfg->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
cfg->m_Repeat.pin_step = schIUScale.IUToMils( m_pinPitch.GetIntValue() );
cfg->m_dragPinsAlongWithEdges = m_dragPinsWithEdges->GetValue();
// Force pin_step to a grid multiple
settings->m_Repeat.pin_step = KiROUND( double( settings->m_Repeat.pin_step ) / MIN_GRID ) * MIN_GRID;
cfg->m_Repeat.pin_step = KiROUND( double( cfg->m_Repeat.pin_step ) / MIN_GRID ) * MIN_GRID;
return true;
}

View File

@ -247,7 +247,8 @@ void PANEL_SYM_LIB_TABLE::setupGrid( WX_GRID* aGrid )
aCurrGrid->SetColSize( aCol, std::max( prevWidth, aCurrGrid->GetColSize( aCol ) ) );
};
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
// Give a bit more room for combobox editors
for( int ii = 0; ii < aGrid->GetNumberRows(); ++ii )
@ -342,7 +343,8 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
m_pluginChoices.Add( SCH_IO_MGR::ShowType( type ) );
}
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg->m_lastSymbolLibDir.IsEmpty() )
cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
@ -628,7 +630,8 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
fileFiltersStr = _( "All supported formats" ) + wxT( "|" ) + allWildcardsStr + wxT( "|" )
+ fileFiltersStr;
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
wxString openDir = cfg->m_lastSymbolLibDir;

View File

@ -52,7 +52,8 @@ PANEL_TEMPLATE_FIELDNAMES::PANEL_TEMPLATE_FIELDNAMES( wxWindow* aWindow,
m_global = true;
m_templateMgr = &m_templateMgrInstance;
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg && !cfg->m_Drawing.field_names.IsEmpty() )
m_templateMgr->AddTemplateFieldNames( cfg->m_Drawing.field_names );
@ -229,7 +230,8 @@ bool PANEL_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
if( m_global )
{
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg )
{

View File

@ -208,7 +208,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
case PANEL_SYM_DISP_OPTIONS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
return new PANEL_SYM_DISPLAY_OPTIONS( aParent, cfg );
}
@ -216,7 +216,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
case PANEL_SYM_EDIT_GRIDS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
if( !frame )
@ -253,7 +253,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
case PANEL_SCH_DISP_OPTIONS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, cfg );
}
@ -261,7 +261,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
case PANEL_SCH_GRIDS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false );
if( !frame )

View File

@ -977,7 +977,8 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
if( aCfg->Read( "MoveWarpsCursor", &tmp ) )
Pgm().GetCommonSettings()->m_Input.warp_mouse_on_move = tmp;
COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetMigratedColorSettings();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
COLOR_SETTINGS* cs = mgr.GetMigratedColorSettings();
auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
wxString str;
@ -1016,14 +1017,14 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_DRAWINGSHEET );
Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" );
mgr.SaveColorSettings( cs, "schematic" );
Set( "appearance.color_theme", cs->GetFilename() );
// LibEdit settings were stored with eeschema. If eeschema is the first app to run,
// we need to migrate the LibEdit settings here
auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* libedit = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
libedit->MigrateFromLegacy( aCfg );
libedit->Load();

Some files were not shown because too many files have changed in this diff Show More