Coverity warning fixes.
This commit is contained in:
parent
2849388d2e
commit
b5eee9dd7e
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2022 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2015-2023 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
|
@ -223,10 +223,23 @@ BOARD_ADAPTER::~BOARD_ADAPTER()
|
|||
|
||||
void BOARD_ADAPTER::ReloadColorSettings() noexcept
|
||||
{
|
||||
wxASSERT( PgmOrNull() );
|
||||
wxCHECK( PgmOrNull(), /* void */ );
|
||||
|
||||
PCBNEW_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
m_colors = Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_colors = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -934,8 +934,8 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
|
|||
|
||||
m_reporter->Report( _( "Running ERC...\n" ), RPT_SEVERITY_INFO );
|
||||
|
||||
DS_PROXY_VIEW_ITEM* drawingSheet = getDrawingSheetProxyView( sch );
|
||||
ercTester.RunTests( drawingSheet, nullptr, m_progressReporter );
|
||||
std::unique_ptr<DS_PROXY_VIEW_ITEM> drawingSheet( getDrawingSheetProxyView( sch ) );
|
||||
ercTester.RunTests( drawingSheet.get(), nullptr, m_progressReporter );
|
||||
|
||||
markersProvider->SetSeverities( ercJob->m_severity );
|
||||
|
||||
|
|
|
@ -160,11 +160,10 @@ void SCH_VIEW::DisplaySymbol( LIB_SYMBOL* aSymbol )
|
|||
// Draw the parent items if the symbol is inherited from another symbol.
|
||||
if( aSymbol->IsAlias() )
|
||||
{
|
||||
std::shared_ptr< LIB_SYMBOL > parent = aSymbol->GetRootSymbol().lock();
|
||||
|
||||
wxCHECK( parent, /* void */ );
|
||||
|
||||
drawnSymbol = parent.get();
|
||||
if( std::shared_ptr< LIB_SYMBOL > parent = aSymbol->GetRootSymbol().lock() )
|
||||
drawnSymbol = parent.get();
|
||||
else
|
||||
wxCHECK( false, /* void */ );
|
||||
}
|
||||
|
||||
for( LIB_ITEM& item : drawnSymbol->GetDrawItems() )
|
||||
|
|
|
@ -2059,6 +2059,9 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath )
|
|||
m_simulatorFrame->LoadSimulator( simTab->GetSimCommand(), simTab->GetSimOptions() );
|
||||
|
||||
simTab = dynamic_cast<SIM_TAB*>( m_plotNotebook->GetPage( 0 ) );
|
||||
|
||||
wxCHECK( simTab, false );
|
||||
|
||||
simTab->SetLastSchTextSimCommand( js[ "last_sch_text_sim_command" ] );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,8 +277,21 @@ SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME()
|
|||
// current screen is destroyed in EDA_DRAW_FRAME
|
||||
SetScreen( m_dummyScreen );
|
||||
|
||||
auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
|
||||
Pgm().GetSettingsManager().Save( libedit );
|
||||
SYMBOL_EDITOR_SETTINGS* cfg = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
Pgm().GetSettingsManager().Save( cfg );
|
||||
}
|
||||
|
||||
delete m_libMgr;
|
||||
}
|
||||
|
@ -745,6 +758,8 @@ wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
|
|||
|
||||
void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
|
||||
{
|
||||
wxCHECK( m_toolManager, /* void */ );
|
||||
|
||||
m_toolManager->RunAction( EE_ACTIONS::clearSelection );
|
||||
GetCanvas()->GetView()->Clear();
|
||||
delete m_symbol;
|
||||
|
@ -811,12 +826,14 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
|
|||
}
|
||||
else if( IsSymbolAlias() )
|
||||
{
|
||||
std::shared_ptr<LIB_SYMBOL> rootSymbol = m_symbol->GetRootSymbol().lock();
|
||||
wxString rootSymbolName;
|
||||
|
||||
// Don't assume the parent symbol shared pointer is still valid.
|
||||
wxCHECK( rootSymbol, /* void */ );
|
||||
if( std::shared_ptr<LIB_SYMBOL> rootSymbol = m_symbol->GetRootSymbol().lock() )
|
||||
rootSymbolName = rootSymbol->GetName();
|
||||
else
|
||||
wxCHECK( false, /* void */ );
|
||||
|
||||
wxString rootSymbolName = rootSymbol->GetName();
|
||||
int unit = GetUnit();
|
||||
int convert = GetConvert();
|
||||
wxString msg;
|
||||
|
|
|
@ -170,23 +170,37 @@ DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
|
|||
DIALOG_BOARD_REANNOTATE::~DIALOG_BOARD_REANNOTATE()
|
||||
{
|
||||
GetParameters(); // Get the current menu settings
|
||||
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
|
||||
cfg->m_Reannotate.sort_on_fp_location = m_locationChoice->GetSelection() == 0;
|
||||
cfg->m_Reannotate.remove_front_prefix = m_RemoveFrontPrefix->GetValue();
|
||||
cfg->m_Reannotate.remove_back_prefix = m_RemoveBackPrefix->GetValue();
|
||||
cfg->m_Reannotate.exclude_locked = m_ExcludeLocked->GetValue();
|
||||
|
||||
cfg->m_Reannotate.grid_index = m_gridIndex;
|
||||
cfg->m_Reannotate.sort_code = m_sortCode;
|
||||
cfg->m_Reannotate.annotation_choice = m_annotationScope;
|
||||
cfg->m_Reannotate.report_severity = m_severity;
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_Reannotate.front_refdes_start = m_FrontRefDesStart->GetValue();
|
||||
cfg->m_Reannotate.back_refdes_start = m_BackRefDesStart->GetValue();
|
||||
cfg->m_Reannotate.front_prefix = m_FrontPrefix->GetValue();
|
||||
cfg->m_Reannotate.back_prefix = m_BackPrefix->GetValue();
|
||||
cfg->m_Reannotate.exclude_list = m_ExcludeList->GetValue();
|
||||
cfg->m_Reannotate.report_file_name = m_MessageWindow->GetFileName();
|
||||
try
|
||||
{
|
||||
cfg = m_frame->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_Reannotate.sort_on_fp_location = m_locationChoice->GetSelection() == 0;
|
||||
cfg->m_Reannotate.remove_front_prefix = m_RemoveFrontPrefix->GetValue();
|
||||
cfg->m_Reannotate.remove_back_prefix = m_RemoveBackPrefix->GetValue();
|
||||
cfg->m_Reannotate.exclude_locked = m_ExcludeLocked->GetValue();
|
||||
|
||||
cfg->m_Reannotate.grid_index = m_gridIndex;
|
||||
cfg->m_Reannotate.sort_code = m_sortCode;
|
||||
cfg->m_Reannotate.annotation_choice = m_annotationScope;
|
||||
cfg->m_Reannotate.report_severity = m_severity;
|
||||
|
||||
cfg->m_Reannotate.front_refdes_start = m_FrontRefDesStart->GetValue();
|
||||
cfg->m_Reannotate.back_refdes_start = m_BackRefDesStart->GetValue();
|
||||
cfg->m_Reannotate.front_prefix = m_FrontPrefix->GetValue();
|
||||
cfg->m_Reannotate.back_prefix = m_BackPrefix->GetValue();
|
||||
cfg->m_Reannotate.exclude_list = m_ExcludeList->GetValue();
|
||||
cfg->m_Reannotate.report_file_name = m_MessageWindow->GetFileName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
|
@ -59,14 +59,26 @@ 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->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_Cleanup.cleanup_vias = m_cleanViasOpt->GetValue();
|
||||
cfg->m_Cleanup.merge_segments = m_mergeSegmOpt->GetValue();
|
||||
cfg->m_Cleanup.cleanup_unconnected = m_deleteUnconnectedOpt->GetValue();
|
||||
cfg->m_Cleanup.cleanup_short_circuits = m_cleanShortCircuitOpt->GetValue();
|
||||
cfg->m_Cleanup.cleanup_tracks_in_pad = m_deleteTracksInPadsOpt->GetValue();
|
||||
cfg->m_Cleanup.delete_dangling_vias = m_deleteDanglingViasOpt->GetValue();
|
||||
try
|
||||
{
|
||||
cfg = m_parentFrame->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_Cleanup.cleanup_vias = m_cleanViasOpt->GetValue();
|
||||
cfg->m_Cleanup.merge_segments = m_mergeSegmOpt->GetValue();
|
||||
cfg->m_Cleanup.cleanup_unconnected = m_deleteUnconnectedOpt->GetValue();
|
||||
cfg->m_Cleanup.cleanup_short_circuits = m_cleanShortCircuitOpt->GetValue();
|
||||
cfg->m_Cleanup.cleanup_tracks_in_pad = m_deleteTracksInPadsOpt->GetValue();
|
||||
cfg->m_Cleanup.delete_dangling_vias = m_deleteDanglingViasOpt->GetValue();
|
||||
}
|
||||
|
||||
m_changesTreeModel->DecRef();
|
||||
}
|
||||
|
|
|
@ -160,14 +160,27 @@ DIALOG_DRC::~DIALOG_DRC()
|
|||
for( int ii = 0; ii < m_ignoredList->GetItemCount(); ++ii )
|
||||
g_lastIgnored.push_back( m_ignoredList->GetItemText( ii ) );
|
||||
|
||||
PCBNEW_SETTINGS* settings = m_frame->GetPcbNewSettings();
|
||||
settings->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
|
||||
settings->m_DrcDialog.test_all_track_errors = m_cbReportAllTrackErrors->GetValue();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
if( !Kiface().IsSingle() )
|
||||
settings->m_DrcDialog.test_footprints = m_cbTestFootprints->GetValue();
|
||||
try
|
||||
{
|
||||
cfg = m_frame->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
settings->m_DrcDialog.severities = m_severities;
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
|
||||
cfg->m_DrcDialog.test_all_track_errors = m_cbReportAllTrackErrors->GetValue();
|
||||
|
||||
if( !Kiface().IsSingle() )
|
||||
cfg->m_DrcDialog.test_footprints = m_cbTestFootprints->GetValue();
|
||||
|
||||
cfg->m_DrcDialog.severities = m_severities;
|
||||
}
|
||||
|
||||
m_markersTreeModel->DecRef();
|
||||
m_unconnectedTreeModel->DecRef();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2015 Cirilo Bernardo
|
||||
* Copyright (C) 2013-2019 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2013-2023 KiCad Developers, see change_log.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
|
||||
|
@ -91,13 +91,25 @@ public:
|
|||
{
|
||||
m_idfThouOpt = m_rbUnitSelection->GetSelection() == 1;
|
||||
|
||||
auto cfg = m_parent->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_ExportIdf.units_mils = m_idfThouOpt;
|
||||
cfg->m_ExportIdf.auto_adjust = m_AutoAdjust;
|
||||
cfg->m_ExportIdf.ref_units = m_RefUnits;
|
||||
cfg->m_ExportIdf.ref_x = m_XRef;
|
||||
cfg->m_ExportIdf.ref_y = m_YRef;
|
||||
try
|
||||
{
|
||||
cfg = m_parent->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_ExportIdf.units_mils = m_idfThouOpt;
|
||||
cfg->m_ExportIdf.auto_adjust = m_AutoAdjust;
|
||||
cfg->m_ExportIdf.ref_units = m_RefUnits;
|
||||
cfg->m_ExportIdf.ref_x = m_XRef;
|
||||
cfg->m_ExportIdf.ref_y = m_YRef;
|
||||
}
|
||||
}
|
||||
|
||||
bool GetThouOption()
|
||||
|
|
|
@ -255,23 +255,35 @@ DIALOG_EXPORT_STEP::~DIALOG_EXPORT_STEP()
|
|||
{
|
||||
GetOriginOption(); // Update m_origin member.
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_ExportStep.origin_mode = static_cast<int>( m_origin );
|
||||
cfg->m_ExportStep.origin_units = m_STEP_OrgUnitChoice->GetSelection();
|
||||
cfg->m_ExportStep.replace_models = m_cbSubstModels->GetValue();
|
||||
cfg->m_ExportStep.overwrite_file = m_cbOverwriteFile->GetValue();
|
||||
try
|
||||
{
|
||||
cfg = m_parent->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
double val = 0.0;
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_ExportStep.origin_mode = static_cast<int>( m_origin );
|
||||
cfg->m_ExportStep.origin_units = m_STEP_OrgUnitChoice->GetSelection();
|
||||
cfg->m_ExportStep.replace_models = m_cbSubstModels->GetValue();
|
||||
cfg->m_ExportStep.overwrite_file = m_cbOverwriteFile->GetValue();
|
||||
|
||||
m_STEP_Xorg->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportStep.origin_x = val;
|
||||
double val = 0.0;
|
||||
|
||||
m_STEP_Yorg->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportStep.origin_y = val;
|
||||
m_STEP_Xorg->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportStep.origin_x = val;
|
||||
|
||||
cfg->m_ExportStep.no_unspecified = m_cbRemoveUnspecified->GetValue();
|
||||
cfg->m_ExportStep.no_dnp = m_cbRemoveDNP->GetValue();
|
||||
m_STEP_Yorg->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportStep.origin_y = val;
|
||||
|
||||
cfg->m_ExportStep.no_unspecified = m_cbRemoveUnspecified->GetValue();
|
||||
cfg->m_ExportStep.no_dnp = m_cbRemoveDNP->GetValue();
|
||||
}
|
||||
|
||||
m_toleranceLastChoice = m_choiceTolerance->GetSelection();
|
||||
m_exportTracks = m_cbExportTracks->GetValue();
|
||||
|
|
|
@ -71,8 +71,6 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/* DIALOG_EXPORT_SVG functions
|
||||
*/
|
||||
DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG( PCB_EDIT_FRAME* aParent, BOARD* aBoard ) :
|
||||
DIALOG_EXPORT_SVG_BASE( aParent ),
|
||||
m_board( aBoard ),
|
||||
|
@ -117,28 +115,42 @@ DIALOG_EXPORT_SVG::~DIALOG_EXPORT_SVG()
|
|||
|
||||
m_parent->Prj().GetProjectFile().m_PcbLastPath[ LAST_PATH_SVG ] = m_outputDirectory;
|
||||
|
||||
auto cfg = m_parent->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_ExportSvg.black_and_white = m_printBW;
|
||||
cfg->m_ExportSvg.mirror = m_printMirror;
|
||||
cfg->m_ExportSvg.one_file = m_oneFileOnly;
|
||||
cfg->m_ExportSvg.page_size = m_rbSvgPageSizeOpt->GetSelection();
|
||||
cfg->m_ExportSvg.output_dir = m_outputDirectory.ToStdString();
|
||||
try
|
||||
{
|
||||
cfg = m_parent->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
cfg->m_ExportSvg.use_selected_theme = !m_cbUsedBoardTheme->GetValue();
|
||||
cfg->m_ExportSvg.color_theme = m_colorTheme->GetStringSelection();
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_ExportSvg.black_and_white = m_printBW;
|
||||
cfg->m_ExportSvg.mirror = m_printMirror;
|
||||
cfg->m_ExportSvg.one_file = m_oneFileOnly;
|
||||
cfg->m_ExportSvg.page_size = m_rbSvgPageSizeOpt->GetSelection();
|
||||
cfg->m_ExportSvg.output_dir = m_outputDirectory.ToStdString();
|
||||
cfg->m_ExportSvg.use_selected_theme = !m_cbUsedBoardTheme->GetValue();
|
||||
cfg->m_ExportSvg.color_theme = m_colorTheme->GetStringSelection();
|
||||
}
|
||||
|
||||
if( m_checkboxPagePerLayer->GetValue() )
|
||||
{
|
||||
m_oneFileOnly = false;
|
||||
cfg->m_ExportSvg.plot_board_edges = m_checkboxEdgesOnAllPages->GetValue();
|
||||
|
||||
if( cfg )
|
||||
cfg->m_ExportSvg.plot_board_edges = m_checkboxEdgesOnAllPages->GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oneFileOnly = true;
|
||||
}
|
||||
|
||||
cfg->m_ExportSvg.layers.clear();
|
||||
if( cfg )
|
||||
cfg->m_ExportSvg.layers.clear();
|
||||
|
||||
for( unsigned layer = 0; layer < arrayDim( m_boxSelectLayer ); ++layer )
|
||||
{
|
||||
|
@ -146,7 +158,10 @@ DIALOG_EXPORT_SVG::~DIALOG_EXPORT_SVG()
|
|||
continue;
|
||||
|
||||
if( m_boxSelectLayer[layer].first->IsChecked( m_boxSelectLayer[layer].second ) )
|
||||
cfg->m_ExportSvg.layers.push_back( layer );
|
||||
{
|
||||
if( cfg )
|
||||
cfg->m_ExportSvg.layers.push_back( layer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,6 +317,7 @@ void DIALOG_EXPORT_SVG::ExportSVGFile( bool aOnlyOneFile )
|
|||
LSET all_selected = getCheckBoxSelectedLayers();
|
||||
|
||||
PCB_PLOT_SVG_OPTIONS svgPlotOptions;
|
||||
svgPlotOptions.m_negative = false;
|
||||
svgPlotOptions.m_blackAndWhite = m_printBW;
|
||||
svgPlotOptions.m_printMaskLayer = m_printMaskLayer;
|
||||
svgPlotOptions.m_pageSizeMode = m_rbSvgPageSizeOpt->GetSelection();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2009-2013 Lorenzo Mercantonio
|
||||
* Copyright (C) 2013 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2023 KiCad Developers, see change_log.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
|
||||
|
@ -96,20 +96,32 @@ public:
|
|||
m_unitsOpt = GetUnits();
|
||||
m_copy3DFilesOpt = GetCopyFilesOption();
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_ExportVrml.units = m_unitsOpt;
|
||||
cfg->m_ExportVrml.copy_3d_models = m_copy3DFilesOpt;
|
||||
cfg->m_ExportVrml.use_relative_paths = m_useRelativePathsOpt;
|
||||
cfg->m_ExportVrml.ref_units = m_VRML_RefUnitChoice->GetSelection();
|
||||
cfg->m_ExportVrml.origin_mode = m_rbCoordOrigin->GetSelection();
|
||||
try
|
||||
{
|
||||
cfg = m_parent->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
double val = 0.0;
|
||||
m_VRML_Xref->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportVrml.ref_x = val;
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_ExportVrml.units = m_unitsOpt;
|
||||
cfg->m_ExportVrml.copy_3d_models = m_copy3DFilesOpt;
|
||||
cfg->m_ExportVrml.use_relative_paths = m_useRelativePathsOpt;
|
||||
cfg->m_ExportVrml.ref_units = m_VRML_RefUnitChoice->GetSelection();
|
||||
cfg->m_ExportVrml.origin_mode = m_rbCoordOrigin->GetSelection();
|
||||
|
||||
m_VRML_Yref->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportVrml.ref_y = val;
|
||||
double val = 0.0;
|
||||
m_VRML_Xref->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportVrml.ref_x = val;
|
||||
|
||||
m_VRML_Yref->GetValue().ToDouble( &val );
|
||||
cfg->m_ExportVrml.ref_y = val;
|
||||
}
|
||||
};
|
||||
|
||||
void SetSubdir( const wxString & aDir )
|
||||
|
|
|
@ -176,8 +176,21 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
|
|||
|
||||
DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
|
||||
{
|
||||
if( PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings() )
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cfg = m_frame->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_FootprintTextShownColumns = m_itemsGrid->GetShownColumnsAsString();
|
||||
}
|
||||
|
||||
// Prevents crash bug in wxGrid's d'tor
|
||||
m_itemsGrid->DestroyTable( m_fields );
|
||||
|
|
|
@ -228,8 +228,21 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
|
|||
|
||||
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR()
|
||||
{
|
||||
if( FOOTPRINT_EDITOR_SETTINGS* cfg = m_frame->GetSettings() )
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cfg = m_frame->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_FootprintTextShownColumns = m_itemsGrid->GetShownColumnsAsString();
|
||||
}
|
||||
|
||||
// Prevents crash bug in wxGrid's d'tor
|
||||
m_itemsGrid->DestroyTable( m_fields );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012-2014 Miguel Angel Ajo <miguelangel@nbee.es>
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
|
@ -68,9 +68,19 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
|||
|
||||
DIALOG_FOOTPRINT_WIZARD_LIST::~DIALOG_FOOTPRINT_WIZARD_LIST()
|
||||
{
|
||||
if( !IsIconized() )
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg && !IsIconized() )
|
||||
{
|
||||
auto cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
|
||||
cfg->m_FootprintWizardList.width = GetSize().x;
|
||||
cfg->m_FootprintWizardList.height = GetSize().y;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
|
@ -91,12 +91,24 @@ DIALOG_IMPORT_NETLIST::~DIALOG_IMPORT_NETLIST()
|
|||
{
|
||||
m_matchByUUID = m_matchByTimestamp->GetSelection() == 0;
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_NetlistDialog.report_filter = m_MessageWindow->GetVisibleSeverities();
|
||||
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.delete_shorting_tracks = m_cbDeleteShortingTracks->GetValue();
|
||||
cfg->m_NetlistDialog.delete_extra_footprints = m_cbDeleteExtraFootprints->GetValue();
|
||||
try
|
||||
{
|
||||
cfg = m_parent->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_NetlistDialog.report_filter = m_MessageWindow->GetVisibleSeverities();
|
||||
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.delete_shorting_tracks = m_cbDeleteShortingTracks->GetValue();
|
||||
cfg->m_NetlistDialog.delete_extra_footprints = m_cbDeleteExtraFootprints->GetValue();
|
||||
}
|
||||
|
||||
if( m_runDragCommand )
|
||||
{
|
||||
|
|
|
@ -68,12 +68,24 @@ DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB( PCB_EDIT_FRAME* aParent, NETLIST* aNetlist
|
|||
|
||||
DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB()
|
||||
{
|
||||
auto cfg = m_frame->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_NetlistDialog.associate_by_ref_sch = m_cbRelinkFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.delete_extra_footprints = m_cbDeleteExtraFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.report_filter = m_messagePanel->GetVisibleSeverities();
|
||||
try
|
||||
{
|
||||
cfg = m_frame->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_NetlistDialog.associate_by_ref_sch = m_cbRelinkFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.update_footprints = m_cbUpdateFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.delete_extra_footprints = m_cbDeleteExtraFootprints->GetValue();
|
||||
cfg->m_NetlistDialog.report_filter = m_messagePanel->GetVisibleSeverities();
|
||||
}
|
||||
|
||||
if( m_runDragCommand )
|
||||
{
|
||||
|
|
|
@ -130,15 +130,28 @@ DIALOG_IMPORT_GFX_PCB::DIALOG_IMPORT_GFX_PCB( PCB_BASE_FRAME* aParent, bool aImp
|
|||
|
||||
DIALOG_IMPORT_GFX_PCB::~DIALOG_IMPORT_GFX_PCB()
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
cfg->m_ImportGraphics.layer = m_SelLayerBox->GetLayerSelection();
|
||||
cfg->m_ImportGraphics.interactive_placement = m_placementInteractive;
|
||||
cfg->m_ImportGraphics.last_file = m_textCtrlFileName->GetValue();
|
||||
cfg->m_ImportGraphics.dxf_line_width = pcbIUScale.IUTomm( m_defaultLineWidth.GetValue() );
|
||||
cfg->m_ImportGraphics.origin_x = pcbIUScale.IUTomm( m_xOrigin.GetValue() );
|
||||
cfg->m_ImportGraphics.origin_y = pcbIUScale.IUTomm( m_yOrigin.GetValue() );
|
||||
cfg->m_ImportGraphics.dxf_units = m_choiceDxfUnits->GetSelection();
|
||||
try
|
||||
{
|
||||
cfg = m_parent->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_ImportGraphics.layer = m_SelLayerBox->GetLayerSelection();
|
||||
cfg->m_ImportGraphics.interactive_placement = m_placementInteractive;
|
||||
cfg->m_ImportGraphics.last_file = m_textCtrlFileName->GetValue();
|
||||
cfg->m_ImportGraphics.dxf_line_width =
|
||||
pcbIUScale.IUTomm( m_defaultLineWidth.GetValue() );
|
||||
cfg->m_ImportGraphics.origin_x = pcbIUScale.IUTomm( m_xOrigin.GetValue() );
|
||||
cfg->m_ImportGraphics.origin_y = pcbIUScale.IUTomm( m_yOrigin.GetValue() );
|
||||
cfg->m_ImportGraphics.dxf_units = m_choiceDxfUnits->GetSelection();
|
||||
}
|
||||
|
||||
m_importScale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_importScaleCtrl->GetValue() );
|
||||
|
||||
|
|
|
@ -240,6 +240,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
|
|||
obs.m_item = const_cast<ITEM*>( this );
|
||||
obs.m_clearance = clearance;
|
||||
obs.m_distFirst = 0;
|
||||
obs.m_maxFanoutWidth = 0;
|
||||
aCtx->obstacles.insert( obs );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -144,9 +144,11 @@ public:
|
|||
if( !via || hasNonVirtualVia )
|
||||
return false;
|
||||
|
||||
assert ( seg1 && seg2 );
|
||||
// This compiles away in release builds so we still need to check it below
|
||||
// to prevent segfaults in release builds.
|
||||
assert( seg1 && seg2 );
|
||||
|
||||
return seg1->Width() == seg2->Width();
|
||||
return ( seg1 && seg2 ) ? seg1->Width() == seg2->Width() : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,10 @@ const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance )
|
|||
clearance = m_sizes.Clearance() + m_sizes.DiffPairWidth() / 2;
|
||||
}
|
||||
|
||||
PNS::ITEM_SET ret;
|
||||
|
||||
wxCHECK( node, ret );
|
||||
|
||||
if( aUseClearance )
|
||||
{
|
||||
NODE::OBSTACLES obs;
|
||||
|
@ -155,10 +159,6 @@ const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance )
|
|||
opts.m_differentNetsOnly = false;
|
||||
opts.m_overrideClearance = clearance;
|
||||
|
||||
PNS::ITEM_SET ret;
|
||||
|
||||
wxCHECK( node, ret );
|
||||
|
||||
node->QueryColliding( &test, obs, opts );
|
||||
|
||||
for( const OBSTACLE& obstacle : obs )
|
||||
|
|
|
@ -188,8 +188,13 @@ const WALKAROUND::RESULT WALKAROUND::Route( const LINE& aInitialPath )
|
|||
if( s_cw != IN_PROGRESS && s_ccw != IN_PROGRESS )
|
||||
break;
|
||||
|
||||
double lcw = path_cw.Line().Length() / (double)aInitialPath.CLine().Length();
|
||||
double lccw = path_ccw.Line().Length() / (double)aInitialPath.CLine().Length();
|
||||
double length = (double)aInitialPath.CLine().Length();
|
||||
wxCHECK2( length != 0, length = 1.0 );
|
||||
double lcw = path_cw.Line().Length() / length;
|
||||
|
||||
length = (double)aInitialPath.CLine().Length();
|
||||
wxCHECK2( length != 0, length = 1.0 );
|
||||
double lccw = path_ccw.Line().Length() / length;
|
||||
|
||||
PNS_DBG( Dbg(), Message, wxString::Format( wxT( "lcw %.1f lccw %.1f" ), lcw, lccw ) );
|
||||
|
||||
|
|
|
@ -2749,11 +2749,13 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
ROUTER_TOOL* router = m_frame->GetToolManager()->GetTool<ROUTER_TOOL>();
|
||||
|
||||
m_allowDRCViolations = router->Router()->Settings().AllowDRCViolations();
|
||||
if( router )
|
||||
m_allowDRCViolations = router->Router()->Settings().AllowDRCViolations();
|
||||
|
||||
try
|
||||
{
|
||||
m_drcEngine->InitEngine( aFrame->GetDesignRulesPath() );
|
||||
if( aFrame )
|
||||
m_drcEngine->InitEngine( aFrame->GetDesignRulesPath() );
|
||||
|
||||
DRC_CONSTRAINT constraint;
|
||||
|
||||
|
@ -2788,6 +2790,8 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
|||
KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView();
|
||||
std::vector<PCB_TRACK*> possible_tracks;
|
||||
|
||||
wxCHECK( view, nullptr );
|
||||
|
||||
view->Query( bbox, items );
|
||||
|
||||
for( const KIGFX::VIEW::LAYER_ITEM_PAIR& it : items )
|
||||
|
|
|
@ -263,7 +263,16 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
MOUSE_DRAG_ACTION dragAction = m_frame->GetDragAction();
|
||||
TRACK_DRAG_ACTION trackDragAction = m_frame->GetPcbNewSettings()->m_TrackDragAction;
|
||||
TRACK_DRAG_ACTION trackDragAction = TRACK_DRAG_ACTION::MOVE;
|
||||
|
||||
try
|
||||
{
|
||||
m_frame->GetPcbNewSettings()->m_TrackDragAction;
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
// on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
|
||||
setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
|
||||
|
|
|
@ -167,7 +167,17 @@ PANEL_FOOTPRINT_CHOOSER::~PANEL_FOOTPRINT_CHOOSER()
|
|||
m_dbl_click_timer->Stop();
|
||||
delete m_dbl_click_timer;
|
||||
|
||||
if( PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>() )
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
try
|
||||
{
|
||||
cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
// Save any changes to column widths, etc.
|
||||
m_adapter->SaveSettings();
|
||||
|
|
Loading…
Reference in New Issue