Browse Source

Nullptr safety.

pull/18/head
Jeff Young 5 months ago
parent
commit
1bc60c32f0
  1. 11
      cvpcb/display_footprints_frame.cpp
  2. 2
      eeschema/sim/ngspice.cpp
  3. 31
      pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp
  4. 18
      pcbnew/dialogs/dialog_copper_zones.cpp
  5. 31
      pcbnew/dialogs/dialog_drc.cpp
  6. 36
      pcbnew/dialogs/dialog_export_idf.cpp
  7. 86
      pcbnew/dialogs/dialog_export_step.cpp
  8. 37
      pcbnew/dialogs/dialog_export_vrml.cpp
  9. 15
      pcbnew/dialogs/dialog_footprint_properties.cpp
  10. 58
      pcbnew/dialogs/dialog_gen_footprint_position.cpp
  11. 50
      pcbnew/dialogs/dialog_gendrill.cpp
  12. 28
      pcbnew/dialogs/dialog_import_netlist.cpp
  13. 6
      pcbnew/dialogs/dialog_print_pcbnew.cpp
  14. 29
      pcbnew/dialogs/dialog_update_pcb.cpp
  15. 9
      pcbnew/footprint_viewer_frame.cpp
  16. 49
      pcbnew/import_gfx/dialog_import_graphics.cpp
  17. 7
      pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp
  18. 6
      pcbnew/pcbnew_jobs_handler.cpp
  19. 10
      pcbnew/tools/pcb_selection_tool.cpp
  20. 70
      pcbnew/widgets/appearance_controls.cpp

11
cvpcb/display_footprints_frame.cpp

@ -214,15 +214,14 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
void DISPLAY_FOOTPRINTS_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
// We don't allow people to change this right now, so make sure it's on
GetWindowSettings( cfg )->cursor.always_show_cursor = true;
PCB_BASE_FRAME::LoadSettings( cfg );
GetWindowSettings( aCfg )->cursor.always_show_cursor = true;
if( cfg )
if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
{
PCB_BASE_FRAME::LoadSettings( cfg );
SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions );
}
}

2
eeschema/sim/ngspice.cpp

@ -118,7 +118,7 @@ std::vector<std::string> NGSPICE::AllVectors() const
for( int i = 0; i < noOfVectors; i++, allVectors++ )
{
std::string vec = *allVectors;
retVal.push_back( vec );
retVal.push_back( std::move( vec ) );
}
}

31
pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp

@ -42,16 +42,18 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
m_brd( aParentFrame->GetBoard() ),
m_firstRun( true )
{
PCBNEW_SETTINGS* cfg = m_parentFrame->GetPcbNewSettings();
m_reporter = new WX_TEXT_CTRL_REPORTER( m_tcReport );
m_cbRefillZones->SetValue( cfg->m_Cleanup.cleanup_refill_zones );
m_cleanViasOpt->SetValue( cfg->m_Cleanup.cleanup_vias );
m_mergeSegmOpt->SetValue( cfg->m_Cleanup.merge_segments );
m_deleteUnconnectedOpt->SetValue( cfg->m_Cleanup.cleanup_unconnected );
m_cleanShortCircuitOpt->SetValue( cfg->m_Cleanup.cleanup_short_circuits );
m_deleteTracksInPadsOpt->SetValue( cfg->m_Cleanup.cleanup_tracks_in_pad );
m_deleteDanglingViasOpt->SetValue( cfg->m_Cleanup.delete_dangling_vias );
if( PCBNEW_SETTINGS* cfg = m_parentFrame->GetPcbNewSettings() )
{
m_cbRefillZones->SetValue( cfg->m_Cleanup.cleanup_refill_zones );
m_cleanViasOpt->SetValue( cfg->m_Cleanup.cleanup_vias );
m_mergeSegmOpt->SetValue( cfg->m_Cleanup.merge_segments );
m_deleteUnconnectedOpt->SetValue( cfg->m_Cleanup.cleanup_unconnected );
m_cleanShortCircuitOpt->SetValue( cfg->m_Cleanup.cleanup_short_circuits );
m_deleteTracksInPadsOpt->SetValue( cfg->m_Cleanup.cleanup_tracks_in_pad );
m_deleteDanglingViasOpt->SetValue( cfg->m_Cleanup.delete_dangling_vias );
}
buildFilterLists();
@ -72,18 +74,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
DIALOG_CLEANUP_TRACKS_AND_VIAS::~DIALOG_CLEANUP_TRACKS_AND_VIAS()
{
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_parentFrame->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_parentFrame->GetPcbNewSettings() )
{
cfg->m_Cleanup.cleanup_refill_zones = m_cbRefillZones->GetValue();
cfg->m_Cleanup.cleanup_vias = m_cleanViasOpt->GetValue();

18
pcbnew/dialogs/dialog_copper_zones.cpp

@ -679,21 +679,23 @@ void DIALOG_COPPER_ZONE::storePersistentNetSortConfigurations()
if( m_netSortingByPadCount )
newConfig |= SORT_BY_PAD_COUNT;
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
cfg->m_Zones.net_sort_mode = newConfig;
if( PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings() )
cfg->m_Zones.net_sort_mode = newConfig;
}
void DIALOG_COPPER_ZONE::loadPersistentNetSortConfigurations()
{
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
int sortMode = cfg->m_Zones.net_sort_mode;
if( PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings() )
{
int sortMode = cfg->m_Zones.net_sort_mode;
if( sortMode == DEFAULT_SORT_CONFIG )
sortMode = HIDE_ANONYMOUS_NETS;
if( sortMode == DEFAULT_SORT_CONFIG )
sortMode = HIDE_ANONYMOUS_NETS;
m_hideAutoGeneratedNets = ( sortMode & HIDE_ANONYMOUS_NETS );
m_netSortingByPadCount = ( sortMode & SORT_BY_PAD_COUNT );
m_hideAutoGeneratedNets = ( sortMode & HIDE_ANONYMOUS_NETS );
m_netSortingByPadCount = ( sortMode & SORT_BY_PAD_COUNT );
}
}

31
pcbnew/dialogs/dialog_drc.cpp

@ -89,8 +89,16 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
m_messages->SetImmediateMode();
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
m_severities = cfg->m_DrcDialog.severities;
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
{
m_severities = cfg->m_DrcDialog.severities;
m_cbRefillZones->SetValue( cfg->m_DrcDialog.refill_zones );
m_cbReportAllTrackErrors->SetValue( cfg->m_DrcDialog.test_all_track_errors );
if( !Kiface().IsSingle() )
m_cbTestFootprints->SetValue( cfg->m_DrcDialog.test_footprints );
}
m_markersProvider = std::make_shared<DRC_ITEMS_PROVIDER>( m_currentBoard,
MARKER_BASE::MARKER_DRC,
@ -145,12 +153,6 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
m_footprintsTitleTemplate = m_Notebook->GetPageText( 2 );
m_ignoredTitleTemplate = m_Notebook->GetPageText( 3 );
m_cbRefillZones->SetValue( cfg->m_DrcDialog.refill_zones );
m_cbReportAllTrackErrors->SetValue( cfg->m_DrcDialog.test_all_track_errors );
if( !Kiface().IsSingle() )
m_cbTestFootprints->SetValue( cfg->m_DrcDialog.test_footprints );
Layout(); // adding the units above expanded Clearance text, now resize.
SetFocus();
@ -177,18 +179,7 @@ DIALOG_DRC::~DIALOG_DRC()
m_ignoredList->GetItemData( ii ) } );
}
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_frame->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
{
cfg->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
cfg->m_DrcDialog.test_all_track_errors = m_cbReportAllTrackErrors->GetValue();

36
pcbnew/dialogs/dialog_export_idf.cpp

@ -38,17 +38,18 @@ DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* aEditFrame ) :
{
SetFocus();
auto cfg = m_editFrame->GetPcbNewSettings();
m_idfThouOpt = cfg->m_ExportIdf.units_mils;
m_rbUnitSelection->SetSelection( m_idfThouOpt ? 1 : 0 );
m_AutoAdjust = cfg->m_ExportIdf.auto_adjust;
m_RefUnits = cfg->m_ExportIdf.ref_units;
m_XRef = cfg->m_ExportIdf.ref_x;
m_YRef = cfg->m_ExportIdf.ref_y;
m_cbRemoveUnspecified->SetValue( cfg->m_ExportIdf.no_unspecified );
m_cbRemoveDNP->SetValue( cfg->m_ExportIdf.no_dnp );
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
m_idfThouOpt = cfg->m_ExportIdf.units_mils;
m_rbUnitSelection->SetSelection( m_idfThouOpt ? 1 : 0 );
m_AutoAdjust = cfg->m_ExportIdf.auto_adjust;
m_RefUnits = cfg->m_ExportIdf.ref_units;
m_XRef = cfg->m_ExportIdf.ref_x;
m_YRef = cfg->m_ExportIdf.ref_y;
m_cbRemoveUnspecified->SetValue( cfg->m_ExportIdf.no_unspecified );
m_cbRemoveDNP->SetValue( cfg->m_ExportIdf.no_dnp );
}
m_cbAutoAdjustOffset->SetValue( m_AutoAdjust );
m_cbAutoAdjustOffset->Bind( wxEVT_CHECKBOX, &DIALOG_EXPORT_IDF3::OnAutoAdjustOffset, this );
@ -85,18 +86,7 @@ DIALOG_EXPORT_IDF3::~DIALOG_EXPORT_IDF3()
{
m_idfThouOpt = m_rbUnitSelection->GetSelection() == 1;
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_editFrame->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
cfg->m_ExportIdf.units_mils = m_idfThouOpt;
cfg->m_ExportIdf.auto_adjust = m_AutoAdjust;

86
pcbnew/dialogs/dialog_export_step.cpp

@ -144,50 +144,51 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, wxWindow* aP
if( !m_job )
{
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
m_origin = static_cast<STEP_ORIGIN_OPTION>( cfg->m_ExportStep.origin_mode );
m_origin = static_cast<STEP_ORIGIN_OPTION>( cfg->m_ExportStep.origin_mode );
switch( m_origin )
{
default:
case STEP_ORIGIN_PLOT_AXIS: m_rbDrillAndPlotOrigin->SetValue( true ); break;
case STEP_ORIGIN_GRID_AXIS: m_rbGridOrigin->SetValue( true ); break;
case STEP_ORIGIN_USER: m_rbUserDefinedOrigin->SetValue( true ); break;
case STEP_ORIGIN_BOARD_CENTER: m_rbBoardCenterOrigin->SetValue( true ); break;
}
switch( m_origin )
{
default:
case STEP_ORIGIN_PLOT_AXIS: m_rbDrillAndPlotOrigin->SetValue( true ); break;
case STEP_ORIGIN_GRID_AXIS: m_rbGridOrigin->SetValue( true ); break;
case STEP_ORIGIN_USER: m_rbUserDefinedOrigin->SetValue( true ); break;
case STEP_ORIGIN_BOARD_CENTER: m_rbBoardCenterOrigin->SetValue( true ); break;
m_originUnits = cfg->m_ExportStep.origin_units;
m_userOriginX = cfg->m_ExportStep.origin_x;
m_userOriginY = cfg->m_ExportStep.origin_y;
m_noUnspecified = cfg->m_ExportStep.no_unspecified;
m_noDNP = cfg->m_ExportStep.no_dnp;
m_txtNetFilter->SetValue( m_netFilter );
m_cbOptimizeStep->SetValue( m_optimizeStep );
m_cbExportBody->SetValue( m_exportBoardBody );
m_cbExportComponents->SetValue( m_exportComponents );
m_cbExportTracks->SetValue( m_exportTracks );
m_cbExportPads->SetValue( m_exportPads );
m_cbExportZones->SetValue( m_exportZones );
m_cbExportInnerCopper->SetValue( m_exportInnerCopper );
m_cbExportSilkscreen->SetValue( m_exportSilkscreen );
m_cbExportSoldermask->SetValue( m_exportSoldermask );
m_cbFuseShapes->SetValue( m_fuseShapes );
m_cbCutViasInBody->SetValue( m_cutViasInBody );
m_cbFillAllVias->SetValue( m_fillAllVias );
m_cbRemoveUnspecified->SetValue( m_noUnspecified );
m_cbRemoveDNP->SetValue( m_noDNP );
m_cbSubstModels->SetValue( cfg->m_ExportStep.replace_models );
m_cbOverwriteFile->SetValue( cfg->m_ExportStep.overwrite_file );
}
m_originUnits = cfg->m_ExportStep.origin_units;
m_userOriginX = cfg->m_ExportStep.origin_x;
m_userOriginY = cfg->m_ExportStep.origin_y;
m_noUnspecified = cfg->m_ExportStep.no_unspecified;
m_noDNP = cfg->m_ExportStep.no_dnp;
m_txtNetFilter->SetValue( m_netFilter );
m_cbOptimizeStep->SetValue( m_optimizeStep );
m_cbExportBody->SetValue( m_exportBoardBody );
m_cbExportComponents->SetValue( m_exportComponents );
m_cbExportTracks->SetValue( m_exportTracks );
m_cbExportPads->SetValue( m_exportPads );
m_cbExportZones->SetValue( m_exportZones );
m_cbExportInnerCopper->SetValue( m_exportInnerCopper );
m_cbExportSilkscreen->SetValue( m_exportSilkscreen );
m_cbExportSoldermask->SetValue( m_exportSoldermask );
m_cbFuseShapes->SetValue( m_fuseShapes );
m_cbCutViasInBody->SetValue( m_cutViasInBody );
m_cbFillAllVias->SetValue( m_fillAllVias );
m_cbRemoveUnspecified->SetValue( m_noUnspecified );
m_cbRemoveDNP->SetValue( m_noDNP );
m_cbSubstModels->SetValue( cfg->m_ExportStep.replace_models );
m_cbOverwriteFile->SetValue( cfg->m_ExportStep.overwrite_file );
m_txtComponentFilter->SetValue( m_componentFilter );
switch( m_componentMode )
{
case COMPONENT_MODE::EXPORT_ALL: m_rbAllComponents->SetValue( true ); break;
case COMPONENT_MODE::EXPORT_SELECTED: m_rbOnlySelected->SetValue( true ); break;
case COMPONENT_MODE::CUSTOM_FILTER: m_rbFilteredComponents->SetValue( true ); break;
case COMPONENT_MODE::EXPORT_ALL: m_rbAllComponents->SetValue( true ); break;
case COMPONENT_MODE::EXPORT_SELECTED: m_rbOnlySelected->SetValue( true ); break;
case COMPONENT_MODE::CUSTOM_FILTER: m_rbFilteredComponents->SetValue( true ); break;
}
// Sync the enabled states
@ -317,20 +318,9 @@ DIALOG_EXPORT_STEP::~DIALOG_EXPORT_STEP()
{
GetOriginOption(); // Update m_origin member.
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_editFrame->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( !m_job ) // dont save mru if its a job dialog
{
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
cfg->m_ExportStep.origin_mode = static_cast<int>( m_origin );
cfg->m_ExportStep.origin_units = m_STEP_OrgUnitChoice->GetSelection();

37
pcbnew/dialogs/dialog_export_vrml.cpp

@ -47,18 +47,18 @@ DIALOG_EXPORT_VRML::DIALOG_EXPORT_VRML( PCB_EDIT_FRAME* aEditFrame ) :
{
m_filePicker->SetFocus();
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
m_unitsOpt = cfg->m_ExportVrml.units;
m_noUnspecified = cfg->m_ExportVrml.no_unspecified;
m_noDNP = cfg->m_ExportVrml.no_dnp;
m_copy3DFilesOpt = cfg->m_ExportVrml.copy_3d_models;
m_useRelativePathsOpt = cfg->m_ExportVrml.use_relative_paths;
m_RefUnits = cfg->m_ExportVrml.ref_units;
m_XRef = cfg->m_ExportVrml.ref_x;
m_YRef = cfg->m_ExportVrml.ref_y;
m_originMode = cfg->m_ExportVrml.origin_mode;
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
m_unitsOpt = cfg->m_ExportVrml.units;
m_noUnspecified = cfg->m_ExportVrml.no_unspecified;
m_noDNP = cfg->m_ExportVrml.no_dnp;
m_copy3DFilesOpt = cfg->m_ExportVrml.copy_3d_models;
m_useRelativePathsOpt = cfg->m_ExportVrml.use_relative_paths;
m_RefUnits = cfg->m_ExportVrml.ref_units;
m_XRef = cfg->m_ExportVrml.ref_x;
m_YRef = cfg->m_ExportVrml.ref_y;
m_originMode = cfg->m_ExportVrml.origin_mode;
}
m_rbCoordOrigin->SetSelection( m_originMode );
m_rbSelectUnits->SetSelection( m_unitsOpt );
@ -88,18 +88,7 @@ DIALOG_EXPORT_VRML::~DIALOG_EXPORT_VRML()
m_noDNP = GetNoDNPOption();
m_copy3DFilesOpt = GetCopyFilesOption();
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_editFrame->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
cfg->m_ExportVrml.units = m_unitsOpt;
cfg->m_ExportVrml.no_unspecified = m_noUnspecified;

15
pcbnew/dialogs/dialog_footprint_properties.cpp

@ -190,21 +190,8 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
{
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_frame->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
{
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
cfg->m_FootprintTextShownColumns = m_itemsGrid->GetShownColumnsAsString();
}
// Prevents crash bug in wxGrid's d'tor
m_itemsGrid->DestroyTable( m_fields );

58
pcbnew/dialogs/dialog_gen_footprint_position.cpp

@ -87,23 +87,25 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
{
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
PROJECT_FILE& projectFile = m_editFrame->Prj().GetProjectFile();
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
PROJECT_FILE& projectFile = m_editFrame->Prj().GetProjectFile();
m_units = cfg->m_PlaceFile.units == 0 ? EDA_UNITS::INCH : EDA_UNITS::MM;
// Output directory
m_outputDirectoryName->SetValue( projectFile.m_PcbLastPath[LAST_PATH_POS_FILES] );
// Update Options
m_unitsCtrl->SetSelection( cfg->m_PlaceFile.units );
m_singleFile->SetValue( cfg->m_PlaceFile.file_options == 1 );
m_formatCtrl->SetSelection( cfg->m_PlaceFile.file_format );
m_cbIncludeBoardEdge->SetValue( cfg->m_PlaceFile.include_board_edge );
m_useDrillPlaceOrigin->SetValue( cfg->m_PlaceFile.use_aux_origin );
m_onlySMD->SetValue( cfg->m_PlaceFile.only_SMD );
m_negateXcb->SetValue( cfg->m_PlaceFile.negate_xcoord );
m_excludeTH->SetValue( cfg->m_PlaceFile.exclude_TH );
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
m_units = cfg->m_PlaceFile.units == 0 ? EDA_UNITS::INCH : EDA_UNITS::MM;
// Output directory
m_outputDirectoryName->SetValue( projectFile.m_PcbLastPath[LAST_PATH_POS_FILES] );
// Update Options
m_unitsCtrl->SetSelection( cfg->m_PlaceFile.units );
m_singleFile->SetValue( cfg->m_PlaceFile.file_options == 1 );
m_formatCtrl->SetSelection( cfg->m_PlaceFile.file_format );
m_cbIncludeBoardEdge->SetValue( cfg->m_PlaceFile.include_board_edge );
m_useDrillPlaceOrigin->SetValue( cfg->m_PlaceFile.use_aux_origin );
m_onlySMD->SetValue( cfg->m_PlaceFile.only_SMD );
m_negateXcb->SetValue( cfg->m_PlaceFile.negate_xcoord );
m_excludeTH->SetValue( cfg->m_PlaceFile.exclude_TH );
}
// Update sizes and sizers:
m_messagesPanel->MsgPanelSetMinSize( wxSize( -1, 160 ) );
@ -266,22 +268,24 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
{
m_units = m_unitsCtrl->GetSelection() == 0 ? EDA_UNITS::INCH : EDA_UNITS::MM;
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
wxString dirStr = m_outputDirectoryName->GetValue();
// Keep unix directory format convention in cfg files
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
m_editFrame->Prj().GetProjectFile().m_PcbLastPath[LAST_PATH_POS_FILES] = dirStr;
cfg->m_PlaceFile.output_directory = dirStr;
cfg->m_PlaceFile.units = m_units == EDA_UNITS::INCH ? 0 : 1;
cfg->m_PlaceFile.file_options = m_singleFile->GetValue() ? 1 : 0;
cfg->m_PlaceFile.file_format = m_formatCtrl->GetSelection();
cfg->m_PlaceFile.include_board_edge = m_cbIncludeBoardEdge->GetValue();
cfg->m_PlaceFile.exclude_TH = m_excludeTH->GetValue();
cfg->m_PlaceFile.only_SMD = m_onlySMD->GetValue();
cfg->m_PlaceFile.use_aux_origin = m_useDrillPlaceOrigin->GetValue();
cfg->m_PlaceFile.negate_xcoord = m_negateXcb->GetValue();
if( PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings() )
{
cfg->m_PlaceFile.output_directory = dirStr;
cfg->m_PlaceFile.units = m_units == EDA_UNITS::INCH ? 0 : 1;
cfg->m_PlaceFile.file_options = m_singleFile->GetValue() ? 1 : 0;
cfg->m_PlaceFile.file_format = m_formatCtrl->GetSelection();
cfg->m_PlaceFile.include_board_edge = m_cbIncludeBoardEdge->GetValue();
cfg->m_PlaceFile.exclude_TH = m_excludeTH->GetValue();
cfg->m_PlaceFile.only_SMD = m_onlySMD->GetValue();
cfg->m_PlaceFile.use_aux_origin = m_useDrillPlaceOrigin->GetValue();
cfg->m_PlaceFile.negate_xcoord = m_negateXcb->GetValue();
}
if( m_formatCtrl->GetSelection() == 2 )
CreateGerberFiles();

50
pcbnew/dialogs/dialog_gendrill.cpp

@ -216,18 +216,19 @@ void DIALOG_GENDRILL::initDialog()
}
else
{
auto cfg = m_pcbEditFrame->GetPcbNewSettings();
g_merge_PTH_NPTH = cfg->m_GenDrill.merge_pth_npth;
g_minimalHeader = cfg->m_GenDrill.minimal_header;
g_mirror = cfg->m_GenDrill.mirror;
g_unitDrillIsInch = cfg->m_GenDrill.unit_drill_is_inch;
g_useRouteModeForOvalHoles = cfg->m_GenDrill.use_route_for_oval_holes;
g_drillFileType = cfg->m_GenDrill.drill_file_type;
g_mapFileType = cfg->m_GenDrill.map_file_type;
g_zerosFormat = cfg->m_GenDrill.zeros_format;
g_generateMap = cfg->m_GenDrill.generate_map;
g_generateTenting = cfg->m_GenDrill.generate_tenting;
if( PCBNEW_SETTINGS* cfg = m_pcbEditFrame->GetPcbNewSettings() )
{
g_merge_PTH_NPTH = cfg->m_GenDrill.merge_pth_npth;
g_minimalHeader = cfg->m_GenDrill.minimal_header;
g_mirror = cfg->m_GenDrill.mirror;
g_unitDrillIsInch = cfg->m_GenDrill.unit_drill_is_inch;
g_useRouteModeForOvalHoles = cfg->m_GenDrill.use_route_for_oval_holes;
g_drillFileType = cfg->m_GenDrill.drill_file_type;
g_mapFileType = cfg->m_GenDrill.map_file_type;
g_zerosFormat = cfg->m_GenDrill.zeros_format;
g_generateMap = cfg->m_GenDrill.generate_map;
g_generateTenting = cfg->m_GenDrill.generate_tenting;
}
// Ensure validity of g_mapFileType
if( g_mapFileType < 0 || g_mapFileType >= (int) m_choiceDrillMap->GetCount() )
@ -276,18 +277,19 @@ void DIALOG_GENDRILL::updateConfig()
{
UpdateDrillParams();
PCBNEW_SETTINGS* cfg = m_pcbEditFrame->GetPcbNewSettings();
cfg->m_GenDrill.merge_pth_npth = g_merge_PTH_NPTH;
cfg->m_GenDrill.minimal_header = g_minimalHeader;
cfg->m_GenDrill.mirror = g_mirror;
cfg->m_GenDrill.unit_drill_is_inch = g_unitDrillIsInch;
cfg->m_GenDrill.use_route_for_oval_holes = g_useRouteModeForOvalHoles;
cfg->m_GenDrill.drill_file_type = g_drillFileType;
cfg->m_GenDrill.map_file_type = g_mapFileType;
cfg->m_GenDrill.zeros_format = g_zerosFormat;
cfg->m_GenDrill.generate_map = g_generateMap;
cfg->m_GenDrill.generate_tenting = g_generateTenting;
if( PCBNEW_SETTINGS* cfg = m_pcbEditFrame->GetPcbNewSettings() )
{
cfg->m_GenDrill.merge_pth_npth = g_merge_PTH_NPTH;
cfg->m_GenDrill.minimal_header = g_minimalHeader;
cfg->m_GenDrill.mirror = g_mirror;
cfg->m_GenDrill.unit_drill_is_inch = g_unitDrillIsInch;
cfg->m_GenDrill.use_route_for_oval_holes = g_useRouteModeForOvalHoles;
cfg->m_GenDrill.drill_file_type = g_drillFileType;
cfg->m_GenDrill.map_file_type = g_mapFileType;
cfg->m_GenDrill.zeros_format = g_zerosFormat;
cfg->m_GenDrill.generate_map = g_generateMap;
cfg->m_GenDrill.generate_tenting = g_generateTenting;
}
}

28
pcbnew/dialogs/dialog_import_netlist.cpp

@ -68,17 +68,18 @@ DIALOG_IMPORT_NETLIST::DIALOG_IMPORT_NETLIST( PCB_EDIT_FRAME* aParent,
m_NetlistFilenameCtrl->SetValue( m_netlistPath );
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
auto cfg = m_parent->GetPcbNewSettings();
m_cbUpdateFootprints->SetValue( cfg->m_NetlistDialog.update_footprints );
m_cbTransferGroups->SetValue( cfg->m_NetlistDialog.transfer_groups );
m_cbDeleteShortingTracks->SetValue( cfg->m_NetlistDialog.delete_shorting_tracks );
m_cbDeleteExtraFootprints->SetValue( cfg->m_NetlistDialog.delete_extra_footprints );
if( PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings() )
{
m_cbUpdateFootprints->SetValue( cfg->m_NetlistDialog.update_footprints );
m_cbTransferGroups->SetValue( cfg->m_NetlistDialog.transfer_groups );
m_cbDeleteShortingTracks->SetValue( cfg->m_NetlistDialog.delete_shorting_tracks );
m_cbDeleteExtraFootprints->SetValue( cfg->m_NetlistDialog.delete_extra_footprints );
m_MessageWindow->SetVisibleSeverities( cfg->m_NetlistDialog.report_filter );
}
m_matchByTimestamp->SetSelection( m_matchByUUID ? 0 : 1 );
m_MessageWindow->SetLabel( _("Changes to Be Applied") );
m_MessageWindow->SetVisibleSeverities( cfg->m_NetlistDialog.report_filter );
m_MessageWindow->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
SetupStandardButtons( { { wxID_OK, _( "Load and Test Netlist" ) },
@ -94,18 +95,7 @@ DIALOG_IMPORT_NETLIST::~DIALOG_IMPORT_NETLIST()
{
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_parent->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings() )
{
cfg->m_NetlistDialog.report_filter = m_MessageWindow->GetVisibleSeverities();
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();

6
pcbnew/dialogs/dialog_print_pcbnew.cpp

@ -345,13 +345,13 @@ void DIALOG_PRINT_PCBNEW::onPagePerLayerClicked( wxCommandEvent& event )
void DIALOG_PRINT_PCBNEW::onColorModeClicked( wxCommandEvent& event )
{
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
m_settings->m_blackWhite = m_outputMode->GetSelection();
m_checkBackground->Enable( !m_settings->m_blackWhite );
m_checkUseTheme->Enable( !m_settings->m_blackWhite );
m_colorTheme->Enable( !m_settings->m_blackWhite && cfg->m_Printing.use_theme );
if( PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings() )
m_colorTheme->Enable( !m_settings->m_blackWhite && cfg->m_Printing.use_theme );
}

29
pcbnew/dialogs/dialog_update_pcb.cpp

@ -41,20 +41,20 @@ DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist
m_netlist( aNetlist ),
m_initialized( false )
{
auto cfg = m_frame->GetPcbNewSettings();
m_cbRelinkFootprints->SetValue( cfg->m_NetlistDialog.associate_by_ref_sch );
m_cbUpdateFootprints->SetValue( cfg->m_NetlistDialog.update_footprints );
m_cbTransferGroups->SetValue( cfg->m_NetlistDialog.transfer_groups );
m_cbDeleteExtraFootprints->SetValue( cfg->m_NetlistDialog.delete_extra_footprints );
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
{
m_cbRelinkFootprints->SetValue( cfg->m_NetlistDialog.associate_by_ref_sch );
m_cbUpdateFootprints->SetValue( cfg->m_NetlistDialog.update_footprints );
m_cbTransferGroups->SetValue( cfg->m_NetlistDialog.transfer_groups );
m_cbDeleteExtraFootprints->SetValue( cfg->m_NetlistDialog.delete_extra_footprints );
m_messagePanel->SetVisibleSeverities( cfg->m_NetlistDialog.report_filter );
}
m_messagePanel->SetLabel( _("Changes to Be Applied") );
m_messagePanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
m_messagePanel->SetLazyUpdate( true );
m_netlist->SortByReference();
m_messagePanel->SetVisibleSeverities( cfg->m_NetlistDialog.report_filter );
m_messagePanel->GetSizer()->SetSizeHints( this );
m_messagePanel->Layout();
@ -70,18 +70,7 @@ DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist
DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB()
{
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_frame->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
{
cfg->m_NetlistDialog.associate_by_ref_sch = m_cbRelinkFootprints->GetValue();
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();

9
pcbnew/footprint_viewer_frame.cpp

@ -282,9 +282,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
ActivateGalCanvas();
// Restore last zoom and auto zoom option. (If auto-zooming we'll adjust when we load the footprint.)
PCBNEW_SETTINGS* cfg = GetPcbNewSettings();
wxASSERT( cfg );
GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
if( PCBNEW_SETTINGS* cfg = GetPcbNewSettings() )
GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
updateView();
setupUnits( config() );
@ -732,7 +731,6 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB()
if( GetBoard()->GetFirstFootprint() )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
PCBNEW_SETTINGS* cfg = pcbframe->GetPcbNewSettings();
if( pcbframe == nullptr ) // happens when the board editor is not active (or closed)
{
@ -740,7 +738,8 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB()
return;
}
TOOL_MANAGER* toolMgr = pcbframe->GetToolManager();
PCBNEW_SETTINGS* cfg = pcbframe->GetPcbNewSettings();
TOOL_MANAGER* toolMgr = pcbframe->GetToolManager();
if( toolMgr->GetTool<BOARD_EDITOR_CONTROL>()->PlacingFootprint() )
{

49
pcbnew/import_gfx/dialog_import_graphics.cpp

@ -74,24 +74,25 @@ DIALOG_IMPORT_GRAPHICS::DIALOG_IMPORT_GRAPHICS( PCB_BASE_FRAME* aParent ) :
m_importer = std::make_unique<GRAPHICS_IMPORTER_PCBNEW>( aParent->GetModel() );
m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>();
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
s_shouldGroupItems = cfg->m_ImportGraphics.group_items;
s_fixDiscontinuities = cfg->m_ImportGraphics.fix_discontinuities;
s_toleranceValue = cfg->m_ImportGraphics.tolerance * pcbIUScale.IU_PER_MM;
s_useDlgLayerSelection = cfg->m_ImportGraphics.use_dlg_layer_selection;
if( PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings() )
{
s_shouldGroupItems = cfg->m_ImportGraphics.group_items;
s_fixDiscontinuities = cfg->m_ImportGraphics.fix_discontinuities;
s_toleranceValue = cfg->m_ImportGraphics.tolerance * pcbIUScale.IU_PER_MM;
s_useDlgLayerSelection = cfg->m_ImportGraphics.use_dlg_layer_selection;
s_placementInteractive = cfg->m_ImportGraphics.interactive_placement;
m_xOrigin.SetValue( cfg->m_ImportGraphics.origin_x * pcbIUScale.IU_PER_MM );
m_yOrigin.SetValue( cfg->m_ImportGraphics.origin_y * pcbIUScale.IU_PER_MM );
m_defaultLineWidth.SetValue( cfg->m_ImportGraphics.dxf_line_width * pcbIUScale.IU_PER_MM );
m_textCtrlFileName->SetValue( cfg->m_ImportGraphics.last_file );
}
s_placementInteractive = cfg->m_ImportGraphics.interactive_placement;
m_cbGroupItems->SetValue( s_shouldGroupItems );
m_setLayerCheckbox->SetValue( s_useDlgLayerSelection );
m_xOrigin.SetValue( cfg->m_ImportGraphics.origin_x * pcbIUScale.IU_PER_MM );
m_yOrigin.SetValue( cfg->m_ImportGraphics.origin_y * pcbIUScale.IU_PER_MM );
m_defaultLineWidth.SetValue( cfg->m_ImportGraphics.dxf_line_width * pcbIUScale.IU_PER_MM );
m_importScaleCtrl->SetValue( wxString::Format( wxT( "%f" ), s_importScale ) );
m_textCtrlFileName->SetValue( cfg->m_ImportGraphics.last_file );
m_placeAtCheckbox->SetValue( !s_placementInteractive );
m_tolerance.SetValue( s_toleranceValue );
@ -102,13 +103,16 @@ DIALOG_IMPORT_GRAPHICS::DIALOG_IMPORT_GRAPHICS( PCB_BASE_FRAME* aParent ) :
m_SelLayerBox->SetBoardFrame( m_parent );
m_SelLayerBox->Resync();
if( m_SelLayerBox->SetLayerSelection( cfg->m_ImportGraphics.layer ) < 0 )
m_SelLayerBox->SetLayerSelection( Dwgs_User );
for( const std::pair<const DXF_IMPORT_UNITS, wxString>& unitEntry : dxfUnitsMap )
m_dxfUnitsChoice->Append( unitEntry.second );
m_dxfUnitsChoice->SetSelection( cfg->m_ImportGraphics.dxf_units );
if( PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings() )
{
if( m_SelLayerBox->SetLayerSelection( cfg->m_ImportGraphics.layer ) < 0 )
m_SelLayerBox->SetLayerSelection( Dwgs_User );
m_dxfUnitsChoice->SetSelection( cfg->m_ImportGraphics.dxf_units );
}
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
@ -136,18 +140,7 @@ DIALOG_IMPORT_GRAPHICS::~DIALOG_IMPORT_GRAPHICS()
s_shouldGroupItems = m_cbGroupItems->IsChecked();
s_useDlgLayerSelection = m_setLayerCheckbox->IsChecked();
PCBNEW_SETTINGS* cfg = nullptr;
try
{
cfg = m_parent->GetPcbNewSettings();
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( cfg )
if( PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings() )
{
cfg->m_ImportGraphics.layer = m_SelLayerBox->GetLayerSelection();
cfg->m_ImportGraphics.use_dlg_layer_selection = s_useDlgLayerSelection;

7
pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp

@ -1174,11 +1174,10 @@ void PCB_IO_KICAD_LEGACY::loadSETUP()
* (the first value is not tested, because it is the netclass value)
*/
BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
sort( designSettings.m_ViasDimensionsList.begin() + 1,
designSettings.m_ViasDimensionsList.end() );
sort( designSettings.m_ViasDimensionsList.begin() + 1, designSettings.m_ViasDimensionsList.end() );
sort( designSettings.m_TrackWidthList.begin() + 1, designSettings.m_TrackWidthList.end() );
for( unsigned ii = 1; ii < designSettings.m_ViasDimensionsList.size() - 1; ii++ )
for( int ii = 1; ii < (int) designSettings.m_ViasDimensionsList.size() - 1; ii++ )
{
if( designSettings.m_ViasDimensionsList[ii] == designSettings.m_ViasDimensionsList[ii + 1] )
{
@ -1187,7 +1186,7 @@ void PCB_IO_KICAD_LEGACY::loadSETUP()
}
}
for( unsigned ii = 1; ii < designSettings.m_TrackWidthList.size() - 1; ii++ )
for( int ii = 1; ii < (int) designSettings.m_TrackWidthList.size() - 1; ii++ )
{
if( designSettings.m_TrackWidthList[ii] == designSettings.m_TrackWidthList[ii + 1] )
{

6
pcbnew/pcbnew_jobs_handler.cpp

@ -126,7 +126,11 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER( KIWAY* aKiway ) :
std::bind( &PCBNEW_JOBS_HANDLER::JobExportRender, this, std::placeholders::_1 ),
[]( JOB* job, wxWindow* aParent ) -> bool
{
DIALOG_RENDER_JOB dlg( aParent, dynamic_cast<JOB_PCB_RENDER*>( job ) );
JOB_PCB_RENDER* renderJob = dynamic_cast<JOB_PCB_RENDER*>( job );
wxCHECK( renderJob, false );
DIALOG_RENDER_JOB dlg( aParent, renderJob );
return dlg.ShowModal() == wxID_OK;
} );
Register( "svg", std::bind( &PCBNEW_JOBS_HANDLER::JobExportSvg, this, std::placeholders::_1 ),

10
pcbnew/tools/pcb_selection_tool.cpp

@ -290,14 +290,8 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
MOUSE_DRAG_ACTION dragAction = m_frame->GetDragAction();
TRACK_DRAG_ACTION trackDragAction = TRACK_DRAG_ACTION::MOVE;
try
{
trackDragAction = m_frame->GetPcbNewSettings()->m_TrackDragAction;
}
catch( const std::runtime_error& e )
{
wxFAIL_MSG( e.what() );
}
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
trackDragAction = cfg->m_TrackDragAction;
// on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),

70
pcbnew/widgets/appearance_controls.cpp

@ -576,13 +576,14 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
if( m_isFpEditor )
m_notebook->RemovePage( 2 );
PCBNEW_SETTINGS* settings = m_frame->GetPcbNewSettings();
if( settings->m_AuiPanels.appearance_expand_layer_display )
m_paneLayerDisplayOptions->Expand();
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
{
if( cfg->m_AuiPanels.appearance_expand_layer_display )
m_paneLayerDisplayOptions->Expand();
if( settings->m_AuiPanels.appearance_expand_net_display )
m_paneNetDisplayOptions->Expand();
if( cfg->m_AuiPanels.appearance_expand_net_display )
m_paneNetDisplayOptions->Expand();
}
loadDefaultLayerPresets();
rebuildLayerPresetsWidget();
@ -1411,18 +1412,19 @@ void APPEARANCE_CONTROLS::UpdateDisplayOptions()
if( !m_isFpEditor )
{
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
if( !cfg->m_Display.m_ShowGlobalRatsnest )
m_rbRatsnestNone->SetValue( true );
else if( cfg->m_Display.m_RatsnestMode == RATSNEST_MODE::ALL )
m_rbRatsnestAllLayers->SetValue( true );
else
m_rbRatsnestVisLayers->SetValue( true );
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
{
if( !cfg->m_Display.m_ShowGlobalRatsnest )
m_rbRatsnestNone->SetValue( true );
else if( cfg->m_Display.m_RatsnestMode == RATSNEST_MODE::ALL )
m_rbRatsnestAllLayers->SetValue( true );
else
m_rbRatsnestVisLayers->SetValue( true );
wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) );
APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST );
ratsnest->ctl_visibility->SetValue( cfg->m_Display.m_ShowGlobalRatsnest );
wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) );
APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST );
ratsnest->ctl_visibility->SetValue( cfg->m_Display.m_ShowGlobalRatsnest );
}
}
}
@ -3269,30 +3271,34 @@ void APPEARANCE_CONTROLS::onNetColorMode( wxCommandEvent& aEvent )
void APPEARANCE_CONTROLS::onRatsnestMode( wxCommandEvent& aEvent )
{
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
if( m_rbRatsnestAllLayers->GetValue() )
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
{
cfg->m_Display.m_ShowGlobalRatsnest = true;
cfg->m_Display.m_RatsnestMode = RATSNEST_MODE::ALL;
}
else if( m_rbRatsnestVisLayers->GetValue() )
{
cfg->m_Display.m_ShowGlobalRatsnest = true;
cfg->m_Display.m_RatsnestMode = RATSNEST_MODE::VISIBLE;
}
else
{
cfg->m_Display.m_ShowGlobalRatsnest = false;
if( m_rbRatsnestAllLayers->GetValue() )
{
cfg->m_Display.m_ShowGlobalRatsnest = true;
cfg->m_Display.m_RatsnestMode = RATSNEST_MODE::ALL;
}
else if( m_rbRatsnestVisLayers->GetValue() )
{
cfg->m_Display.m_ShowGlobalRatsnest = true;
cfg->m_Display.m_RatsnestMode = RATSNEST_MODE::VISIBLE;
}
else
{
cfg->m_Display.m_ShowGlobalRatsnest = false;
}
}
if( PCB_EDIT_FRAME* editframe = dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) )
{
editframe->SetElementVisibility( LAYER_RATSNEST, cfg->m_Display.m_ShowGlobalRatsnest );
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
editframe->SetElementVisibility( LAYER_RATSNEST, cfg->m_Display.m_ShowGlobalRatsnest );
editframe->OnDisplayOptionsChanged();
editframe->GetCanvas()->RedrawRatsnest();
editframe->GetCanvas()->Refresh();
}
passOnFocus();
}

Loading…
Cancel
Save