Split pcbnew and footprint editor settings getters for clarity

This commit is contained in:
Jon Evans 2020-05-05 21:43:37 -04:00
parent d00df0169f
commit 51eac3e3e6
19 changed files with 45 additions and 36 deletions

View File

@ -60,6 +60,7 @@ class ZONE_SETTINGS;
class PCB_PLOT_PARAMS;
class FP_LIB_TABLE;
class PCBNEW_SETTINGS;
class FOOTPRINT_EDITOR_SETTINGS;
wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent );
@ -405,7 +406,9 @@ public:
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
PCBNEW_SETTINGS* GetSettings();
PCBNEW_SETTINGS* GetPcbNewSettings();
FOOTPRINT_EDITOR_SETTINGS* GetFootprintEditorSettings();
void CommonSettingsChanged( bool aEnvVarsChanged ) override;

View File

@ -38,7 +38,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( aParentFrame ),
m_parentFrame( aParentFrame )
{
auto cfg = m_parentFrame->GetSettings();
auto cfg = m_parentFrame->GetPcbNewSettings();
m_cleanViasOpt->SetValue( cfg->m_Cleanup.cleanup_vias );
m_mergeSegmOpt->SetValue( cfg->m_Cleanup.merge_segments );
@ -63,7 +63,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
DIALOG_CLEANUP_TRACKS_AND_VIAS::~DIALOG_CLEANUP_TRACKS_AND_VIAS()
{
auto cfg = m_parentFrame->GetSettings();
auto cfg = m_parentFrame->GetPcbNewSettings();
cfg->m_Cleanup.cleanup_vias = m_cleanViasOpt->GetValue();
cfg->m_Cleanup.merge_segments = m_mergeSegmOpt->GetValue();

View File

@ -183,7 +183,7 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
m_NetFiltering = false;
m_NetSortingByPadCount = true;
auto cfg = m_Parent->GetSettings();
auto cfg = m_Parent->GetPcbNewSettings();
int opt = cfg->m_Zones.net_sort_mode;
m_NetFiltering = opt >= 2;
@ -357,7 +357,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
break;
}
auto cfg = m_Parent->GetSettings();
auto cfg = m_Parent->GetPcbNewSettings();
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_Zone_HatchingStyle );
cfg->m_Zones.net_filter = m_DoNotShowNetNameFilter->GetValue().ToStdString();
@ -468,7 +468,7 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )
buildAvailableListOfNets();
auto cfg = m_Parent->GetSettings();
auto cfg = m_Parent->GetPcbNewSettings();
int configValue = m_NetFiltering ? 2 : 0;

View File

@ -91,7 +91,7 @@ DIALOG_DRC::~DIALOG_DRC()
{
m_brdEditor->FocusOnItem( nullptr );
PCBNEW_SETTINGS* settings = m_brdEditor->GetSettings();
PCBNEW_SETTINGS* settings = m_brdEditor->GetPcbNewSettings();
settings->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
settings->m_DrcDialog.test_track_to_zone = m_cbReportAllTrackErrors->GetValue();
settings->m_DrcDialog.test_footprints = m_cbTestFootprints->GetValue();
@ -143,7 +143,7 @@ void DIALOG_DRC::initValues()
displayDRCValues();
auto cfg = m_brdEditor->GetSettings();
auto cfg = m_brdEditor->GetPcbNewSettings();
m_cbRefillZones->SetValue( cfg->m_DrcDialog.refill_zones );
m_cbReportAllTrackErrors->SetValue( cfg->m_DrcDialog.test_track_to_zone );

View File

@ -92,7 +92,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
m_modelsGrid->PushEventHandler( new GRID_TRICKS( m_modelsGrid ) );
// Show/hide text item columns according to the user's preference
m_itemsGrid->ShowHideColumns( m_frame->GetSettings()->m_FootprintTextShownColumns );
m_itemsGrid->ShowHideColumns( m_frame->GetPcbNewSettings()->m_FootprintTextShownColumns );
// Set up the 3D models grid
wxGridCellAttr* attr = new wxGridCellAttr;
@ -159,7 +159,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR()
{
m_frame->GetSettings()->m_FootprintTextShownColumns =
m_frame->GetPcbNewSettings()->m_FootprintTextShownColumns =
m_itemsGrid->GetShownColumns().ToStdString();
// Prevents crash bug in wxGrid's d'tor

View File

@ -50,7 +50,7 @@ public:
{
SetFocus();
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_idfThouOpt = cfg->m_ExportIdf.units_mils;
m_rbUnitSelection->SetSelection( m_idfThouOpt ? 1 : 0 );
@ -93,7 +93,7 @@ public:
{
m_idfThouOpt = m_rbUnitSelection->GetSelection() == 1;
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_ExportIdf.units_mils = m_idfThouOpt;
cfg->m_ExportIdf.auto_adjust = m_AutoAdjust;

View File

@ -100,7 +100,7 @@ public:
{
GetOriginOption(); // Update m_STEP_org_opt member.
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_ExportStep.origin_mode = static_cast<int>( m_STEP_org_opt );
cfg->m_ExportStep.origin_units = m_STEP_OrgUnitChoice->GetSelection();
@ -143,7 +143,7 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
SetFocus();
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_STEP_org_opt = static_cast<STEP_ORG_OPT>( cfg->m_ExportStep.origin_mode );

View File

@ -108,7 +108,7 @@ DIALOG_EXPORT_SVG::~DIALOG_EXPORT_SVG()
m_outputDirectory = m_outputDirectoryName->GetValue();
m_outputDirectory.Replace( wxT( "\\" ), wxT( "/" ) );
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_ExportSvg.black_and_white = m_printBW;
cfg->m_ExportSvg.mirror = m_printMirror;
@ -132,7 +132,7 @@ DIALOG_EXPORT_SVG::~DIALOG_EXPORT_SVG()
void DIALOG_EXPORT_SVG::initDialog()
{
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_printBW = cfg->m_ExportSvg.black_and_white;
m_printMirror = cfg->m_ExportSvg.mirror;

View File

@ -61,7 +61,7 @@ public:
{
m_filePicker->SetFocus();
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_unitsOpt = cfg->m_ExportVrml.units;
m_copy3DFilesOpt = cfg->m_ExportVrml.copy_3d_models;
@ -96,7 +96,7 @@ public:
m_unitsOpt = GetUnits();
m_copy3DFilesOpt = GetCopyFilesOption();
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_ExportVrml.units = m_unitsOpt;
cfg->m_ExportVrml.copy_3d_models = m_copy3DFilesOpt;

View File

@ -100,7 +100,7 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL()
void DIALOG_GENDRILL::initDialog()
{
auto cfg = m_pcbEditFrame->GetSettings();
auto cfg = m_pcbEditFrame->GetPcbNewSettings();
m_Merge_PTH_NPTH = cfg->m_GenDrill.merge_pth_npth;
m_MinimalHeader = cfg->m_GenDrill.minimal_header;
@ -236,7 +236,7 @@ void DIALOG_GENDRILL::UpdateConfig()
{
UpdateDrillParams();
auto cfg = m_pcbEditFrame->GetSettings();
auto cfg = m_pcbEditFrame->GetPcbNewSettings();
cfg->m_GenDrill.merge_pth_npth = m_Merge_PTH_NPTH;
cfg->m_GenDrill.minimal_header = m_MinimalHeader;
@ -257,13 +257,13 @@ void DIALOG_GENDRILL::OnSelDrillUnitsSelected( wxCommandEvent& event )
void DIALOG_GENDRILL::OnGenMapFile( wxCommandEvent& event )
{
GenDrillAndMapFiles( false, true);
GenDrillAndMapFiles( false, true );
}
void DIALOG_GENDRILL::OnGenDrillFile( wxCommandEvent& event )
{
GenDrillAndMapFiles(true, false);
GenDrillAndMapFiles( true, false );
}

View File

@ -175,7 +175,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataFromWindow()
break;
}
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_Zones.hatching_style = static_cast<int>( m_zonesettings.m_Zone_HatchingStyle );
m_zonesettings.m_Zone_45_Only = m_cbConstrainCtrl->GetValue();

View File

@ -71,7 +71,7 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxString& aNetlistFullF
m_NetlistFilenameCtrl->SetValue( m_netlistPath );
m_browseButton->SetBitmap( KiBitmap( folder_xpm ) );
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_cbUpdateFootprints->SetValue( cfg->m_NetlistDialog.update_footprints );
m_cbDeleteShortingTracks->SetValue( cfg->m_NetlistDialog.delete_shorting_tracks );
@ -103,7 +103,7 @@ DIALOG_NETLIST::~DIALOG_NETLIST()
m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue();
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_NetlistDialog.report_filter = m_MessageWindow->GetVisibleSeverities();
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();

View File

@ -260,7 +260,7 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
m_settings.m_HatchFillTypeSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
m_settings.m_HatchFillTypeSmoothingValue = m_spinCtrlSmoothValue->GetValue();
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_Zone_HatchingStyle );
m_settings.m_Zone_45_Only = m_ConstrainOpt->GetValue();

View File

@ -74,7 +74,7 @@ void DIALOG_PLOT::init_Dialog()
BOARD* board = m_parent->GetBoard();
wxFileName fileName;
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_XScaleAdjust = cfg->m_Plot.fine_scale_x;
m_YScaleAdjust = cfg->m_Plot.fine_scale_y;
@ -657,7 +657,7 @@ void DIALOG_PLOT::applyPlotSettings()
reporter.Report( msg, RPT_SEVERITY_INFO );
}
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_Plot.fine_scale_x = m_XScaleAdjust;
cfg->m_Plot.fine_scale_y = m_YScaleAdjust;

View File

@ -50,7 +50,7 @@ DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist
m_netlist( aNetlist ),
m_initialized( false )
{
auto cfg = m_frame->GetSettings();
auto cfg = m_frame->GetPcbNewSettings();
m_cbRelinkFootprints->SetValue( cfg->m_NetlistDialog.associate_by_ref_sch );
m_cbUpdateFootprints->SetValue( cfg->m_NetlistDialog.update_footprints );
@ -85,7 +85,7 @@ DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB()
{
m_warnForNoNetPads = m_cbWarnNoNetPad->GetValue();
auto cfg = m_frame->GetSettings();
auto cfg = m_frame->GetPcbNewSettings();
cfg->m_NetlistDialog.associate_by_ref_sch = m_cbRelinkFootprints->GetValue();
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();

View File

@ -146,7 +146,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
{
m_browseButton->SetBitmap( KiBitmap( folder_xpm ) );
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_units = static_cast<EDA_UNITS>( cfg->m_PlaceFile.units );
m_fileOpt = cfg->m_PlaceFile.file_options;
@ -204,7 +204,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnGenerate( wxCommandEvent& event )
m_fileFormat = m_rbFormat->GetSelection();
m_includeBoardEdge = m_cbIncludeBoardEdge->GetValue();
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_PlaceFile.units = static_cast<int>( m_units );
cfg->m_PlaceFile.file_options = m_fileOpt;

View File

@ -75,7 +75,7 @@ DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFoo
m_lineWidth = 0.2; // always in mm
m_lineWidthUnits = 0;
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
m_layer = cfg->m_ImportGraphics.layer;
m_placementInteractive = cfg->m_ImportGraphics.interactive_placement;
@ -120,7 +120,7 @@ DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFoo
DIALOG_IMPORT_GFX::~DIALOG_IMPORT_GFX()
{
auto cfg = m_parent->GetSettings();
auto cfg = m_parent->GetPcbNewSettings();
cfg->m_ImportGraphics.layer = m_layer;
cfg->m_ImportGraphics.interactive_placement = m_placementInteractive;

View File

@ -769,12 +769,18 @@ void PCB_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
}
PCBNEW_SETTINGS* PCB_BASE_FRAME::GetSettings()
PCBNEW_SETTINGS* PCB_BASE_FRAME::GetPcbNewSettings()
{
return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
}
FOOTPRINT_EDITOR_SETTINGS* PCB_BASE_FRAME::GetFootprintEditorSettings()
{
return Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
}
void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );

View File

@ -108,7 +108,7 @@ void TOOL_BASE::Reset( RESET_REASON aReason )
m_router->UpdateSizes( m_savedSizes );
PCBNEW_SETTINGS* settings = frame()->GetSettings();
PCBNEW_SETTINGS* settings = frame()->GetPcbNewSettings();
if( !settings->m_PnsSettings )
settings->m_PnsSettings = std::make_unique<ROUTING_SETTINGS>( settings, "tools.pns" );