Fixup some Coverity issues.
This commit is contained in:
parent
e0e4ea6223
commit
93b7eacfb2
|
@ -123,14 +123,19 @@ public:
|
|||
};
|
||||
|
||||
|
||||
AUTOPLACER( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen )
|
||||
:m_screen( aScreen ), m_component( aComponent )
|
||||
AUTOPLACER( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen ) :
|
||||
m_screen( aScreen ), m_component( aComponent )
|
||||
{
|
||||
m_component->GetFields( m_fields, /* aVisibleOnly */ true );
|
||||
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
m_allow_rejustify = cfg->m_AutoplaceFields.allow_rejustify;
|
||||
m_align_to_grid = cfg->m_AutoplaceFields.align_to_grid;
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_allow_rejustify = cfg->m_AutoplaceFields.allow_rejustify;
|
||||
m_align_to_grid = cfg->m_AutoplaceFields.align_to_grid;
|
||||
}
|
||||
|
||||
m_comp_bbox = m_component->GetBodyBoundingBox();
|
||||
m_fbox_size = ComputeFBoxSize( /* aDynamic */ true );
|
||||
|
|
|
@ -87,7 +87,10 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
|||
DIALOG_ERC::~DIALOG_ERC()
|
||||
{
|
||||
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
settings->m_Appearance.erc_severities = m_severities;
|
||||
wxASSERT( settings );
|
||||
|
||||
if( settings )
|
||||
settings->m_Appearance.erc_severities = m_severities;
|
||||
|
||||
m_markerTreeModel->DecRef();
|
||||
}
|
||||
|
|
|
@ -321,22 +321,27 @@ void NETLIST_DIALOG::InstallCustomPages()
|
|||
NETLIST_PAGE_DIALOG* currPage;
|
||||
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxASSERT( cfg );
|
||||
|
||||
for( size_t i = 0;
|
||||
i < CUSTOMPANEL_COUNTMAX && i < cfg->m_NetlistPanel.custom_command_titles.size(); i++ )
|
||||
if( cfg )
|
||||
{
|
||||
// pairs of (title, command) are stored
|
||||
wxString title = cfg->m_NetlistPanel.custom_command_titles[i];
|
||||
for( size_t i = 0;
|
||||
i < CUSTOMPANEL_COUNTMAX && i < cfg->m_NetlistPanel.custom_command_titles.size();
|
||||
i++ )
|
||||
{
|
||||
// pairs of (title, command) are stored
|
||||
wxString title = cfg->m_NetlistPanel.custom_command_titles[i];
|
||||
|
||||
if( i >= cfg->m_NetlistPanel.custom_command_paths.size() )
|
||||
break; // No more panel to install
|
||||
if( i >= cfg->m_NetlistPanel.custom_command_paths.size() )
|
||||
break; // No more panel to install
|
||||
|
||||
wxString command = cfg->m_NetlistPanel.custom_command_paths[i];
|
||||
wxString command = cfg->m_NetlistPanel.custom_command_paths[i];
|
||||
|
||||
currPage = AddOneCustomPage( title, command,
|
||||
static_cast<NETLIST_TYPE_ID>( NET_TYPE_CUSTOM1 + i ) );
|
||||
currPage = AddOneCustomPage( title, command,
|
||||
static_cast<NETLIST_TYPE_ID>( NET_TYPE_CUSTOM1 + i ) );
|
||||
|
||||
m_PanelNetType[PANELCUSTOMBASE + i] = currPage;
|
||||
m_PanelNetType[PANELCUSTOMBASE + i] = currPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,55 +85,52 @@ DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent )
|
|||
void DIALOG_PLOT_SCHEMATIC::initDlg()
|
||||
{
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxASSERT( cfg );
|
||||
|
||||
for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
|
||||
if( cfg )
|
||||
{
|
||||
int idx = m_colorTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||
for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
|
||||
{
|
||||
int idx = m_colorTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||
|
||||
if( settings->GetFilename() == cfg->m_PlotPanel.color_theme )
|
||||
m_colorTheme->SetSelection( idx );
|
||||
}
|
||||
if( settings->GetFilename() == cfg->m_PlotPanel.color_theme )
|
||||
m_colorTheme->SetSelection( idx );
|
||||
}
|
||||
|
||||
m_colorTheme->Enable( cfg->m_PlotPanel.color );
|
||||
m_colorTheme->Enable( cfg->m_PlotPanel.color );
|
||||
|
||||
m_plotBackgroundColor->Enable( cfg->m_PlotPanel.color );
|
||||
m_plotBackgroundColor->SetValue( cfg->m_PlotPanel.background_color );
|
||||
m_plotBackgroundColor->Enable( cfg->m_PlotPanel.color );
|
||||
m_plotBackgroundColor->SetValue( cfg->m_PlotPanel.background_color );
|
||||
|
||||
// Set color or B&W plot option
|
||||
setModeColor( cfg->m_PlotPanel.color );
|
||||
// Set color or B&W plot option
|
||||
setModeColor( cfg->m_PlotPanel.color );
|
||||
|
||||
// Set plot or not frame reference option
|
||||
setPlotFrameRef( cfg->m_PlotPanel.frame_reference );
|
||||
// Set plot or not frame reference option
|
||||
setPlotFrameRef( cfg->m_PlotPanel.frame_reference );
|
||||
|
||||
// Set HPGL plot origin to center of paper of left bottom corner
|
||||
SetPlotOriginCenter( cfg->m_PlotPanel.hpgl_origin );
|
||||
// Set HPGL plot origin to center of paper of left bottom corner
|
||||
SetPlotOriginCenter( cfg->m_PlotPanel.hpgl_origin );
|
||||
|
||||
m_HPGLPaperSizeSelect = cfg->m_PlotPanel.hpgl_paper_size;
|
||||
m_HPGLPaperSizeSelect = cfg->m_PlotPanel.hpgl_paper_size;
|
||||
|
||||
// HPGL Pen Size is stored in mm in config
|
||||
m_HPGLPenSize = cfg->m_PlotPanel.hpgl_pen_size * IU_PER_MM;
|
||||
// HPGL Pen Size is stored in mm in config
|
||||
m_HPGLPenSize = cfg->m_PlotPanel.hpgl_pen_size * IU_PER_MM;
|
||||
|
||||
// Switch to the last save plot format
|
||||
switch( static_cast<PLOT_FORMAT>( cfg->m_PlotPanel.format ) )
|
||||
{
|
||||
default:
|
||||
case PLOT_FORMAT::POST:
|
||||
m_plotFormatOpt->SetSelection( 0 );
|
||||
break;
|
||||
case PLOT_FORMAT::PDF:
|
||||
m_plotFormatOpt->SetSelection( 1 );
|
||||
break;
|
||||
case PLOT_FORMAT::SVG:
|
||||
m_plotFormatOpt->SetSelection( 2 );
|
||||
break;
|
||||
case PLOT_FORMAT::DXF:
|
||||
m_plotFormatOpt->SetSelection( 3 );
|
||||
m_plotBackgroundColor->Disable();
|
||||
break;
|
||||
case PLOT_FORMAT::HPGL:
|
||||
m_plotFormatOpt->SetSelection( 4 );
|
||||
m_plotBackgroundColor->Disable();
|
||||
break;
|
||||
// Switch to the last save plot format
|
||||
PLOT_FORMAT fmt = static_cast<PLOT_FORMAT>( cfg->m_PlotPanel.format );
|
||||
|
||||
switch( fmt )
|
||||
{
|
||||
default:
|
||||
case PLOT_FORMAT::POST: m_plotFormatOpt->SetSelection( 0 ); break;
|
||||
case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 1 ); break;
|
||||
case PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break;
|
||||
case PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break;
|
||||
case PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
|
||||
}
|
||||
|
||||
if( fmt == PLOT_FORMAT::DXF || fmt == PLOT_FORMAT::HPGL )
|
||||
m_plotBackgroundColor->Disable();
|
||||
}
|
||||
|
||||
// Set the default line width (pen width which should be used for
|
||||
|
@ -278,18 +275,22 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
|
|||
m_HPGLPenSize = m_penWidth.GetValue();
|
||||
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxASSERT( cfg );
|
||||
|
||||
cfg->m_PlotPanel.background_color = m_plotBackgroundColor->GetValue();
|
||||
cfg->m_PlotPanel.color = getModeColor();
|
||||
cfg->m_PlotPanel.color_theme = static_cast<COLOR_SETTINGS*>(
|
||||
m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) )->GetFilename();
|
||||
cfg->m_PlotPanel.frame_reference = getPlotFrameRef();
|
||||
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
|
||||
cfg->m_PlotPanel.hpgl_origin = GetPlotOriginCenter();
|
||||
cfg->m_PlotPanel.hpgl_paper_size = m_HPGLPaperSizeSelect;
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_PlotPanel.background_color = m_plotBackgroundColor->GetValue();
|
||||
cfg->m_PlotPanel.color = getModeColor();
|
||||
cfg->m_PlotPanel.color_theme = static_cast<COLOR_SETTINGS*>(
|
||||
m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) )->GetFilename();
|
||||
cfg->m_PlotPanel.frame_reference = getPlotFrameRef();
|
||||
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
|
||||
cfg->m_PlotPanel.hpgl_origin = GetPlotOriginCenter();
|
||||
cfg->m_PlotPanel.hpgl_paper_size = m_HPGLPaperSizeSelect;
|
||||
|
||||
// HPGL Pen Size is stored in mm in config
|
||||
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
|
||||
// HPGL Pen Size is stored in mm in config
|
||||
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
|
||||
}
|
||||
|
||||
SetDefaultLineThickness( m_defaultLineWidth.GetValue() );
|
||||
|
||||
|
|
|
@ -59,8 +59,13 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* aParent, SCH_SHE
|
|||
|
||||
// Show/hide columns according to user's preference
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
m_shownColumns = cfg->m_Appearance.edit_sheet_visible_columns;
|
||||
m_grid->ShowHideColumns( m_shownColumns );
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_shownColumns = cfg->m_Appearance.edit_sheet_visible_columns;
|
||||
m_grid->ShowHideColumns( m_shownColumns );
|
||||
}
|
||||
|
||||
wxToolTip::Enable( true );
|
||||
m_stdDialogButtonSizerOK->SetDefault();
|
||||
|
@ -93,7 +98,10 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* aParent, SCH_SHE
|
|||
DIALOG_SCH_SHEET_PROPS::~DIALOG_SCH_SHEET_PROPS()
|
||||
{
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
cfg->m_Appearance.edit_sheet_visible_columns = m_grid->GetShownColumns();
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
cfg->m_Appearance.edit_sheet_visible_columns = m_grid->GetShownColumns();
|
||||
|
||||
// Prevents crash bug in wxGrid's d'tor
|
||||
m_grid->DestroyTable( m_fields );
|
||||
|
|
|
@ -117,7 +117,6 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
|||
SCH_ITEM( aParent, SCH_COMPONENT_T )
|
||||
{
|
||||
Init( aPos );
|
||||
m_fieldsAutoplaced = FIELDS_AUTOPLACED_NO;
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +135,6 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, LIB_ID aLibId, SCH_SHEET_PATH* sh
|
|||
part = aPart.Flatten();
|
||||
part->SetParent();
|
||||
m_part.reset( part.release() );
|
||||
m_fieldsAutoplaced = FIELDS_AUTOPLACED_NO;
|
||||
|
||||
// Copy fields from the library component
|
||||
UpdateFields( true, true );
|
||||
|
|
|
@ -47,6 +47,8 @@ SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) :
|
|||
EDA_ITEM( aParent, aType )
|
||||
{
|
||||
m_Layer = LAYER_WIRE; // It's only a default, in fact
|
||||
m_fieldsAutoplaced = FIELDS_AUTOPLACED_NO;
|
||||
|
||||
m_connectivity_dirty = true;
|
||||
}
|
||||
|
||||
|
@ -55,6 +57,8 @@ SCH_ITEM::SCH_ITEM( const SCH_ITEM& aItem ) :
|
|||
EDA_ITEM( aItem )
|
||||
{
|
||||
m_Layer = aItem.m_Layer;
|
||||
m_fieldsAutoplaced = aItem.m_fieldsAutoplaced;
|
||||
|
||||
m_connectivity_dirty = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,13 +238,16 @@ void SIM_PLOT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
EDA_BASE_FRAME::SaveSettings( cfg );
|
||||
if( cfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( cfg );
|
||||
|
||||
cfg->m_Simulator.plot_panel_width = m_splitterLeftRight->GetSashPosition();
|
||||
cfg->m_Simulator.plot_panel_height = m_splitterPlotAndConsole->GetSashPosition();
|
||||
cfg->m_Simulator.signal_panel_height = m_splitterSignals->GetSashPosition();
|
||||
cfg->m_Simulator.cursors_panel_height = m_splitterTuneValues->GetSashPosition();
|
||||
cfg->m_Simulator.white_background = m_plotUseWhiteBg;
|
||||
cfg->m_Simulator.plot_panel_width = m_splitterLeftRight->GetSashPosition();
|
||||
cfg->m_Simulator.plot_panel_height = m_splitterPlotAndConsole->GetSashPosition();
|
||||
cfg->m_Simulator.signal_panel_height = m_splitterSignals->GetSashPosition();
|
||||
cfg->m_Simulator.cursors_panel_height = m_splitterTuneValues->GetSashPosition();
|
||||
cfg->m_Simulator.white_background = m_plotUseWhiteBg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -253,16 +256,19 @@ void SIM_PLOT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
EDA_BASE_FRAME::LoadSettings( cfg );
|
||||
if( cfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( cfg );
|
||||
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
// Read subwindows sizes (should be > 0 )
|
||||
m_splitterLeftRightSashPosition = cfg->m_Simulator.plot_panel_width;
|
||||
m_splitterPlotAndConsoleSashPosition = cfg->m_Simulator.plot_panel_height;
|
||||
m_splitterSignalsSashPosition = cfg->m_Simulator.signal_panel_height;
|
||||
m_splitterTuneValuesSashPosition = cfg->m_Simulator.cursors_panel_height;
|
||||
m_plotUseWhiteBg = cfg->m_Simulator.white_background;
|
||||
// Read subwindows sizes (should be > 0 )
|
||||
m_splitterLeftRightSashPosition = cfg->m_Simulator.plot_panel_width;
|
||||
m_splitterPlotAndConsoleSashPosition = cfg->m_Simulator.plot_panel_height;
|
||||
m_splitterSignalsSashPosition = cfg->m_Simulator.signal_panel_height;
|
||||
m_splitterTuneValuesSashPosition = cfg->m_Simulator.cursors_panel_height;
|
||||
m_plotUseWhiteBg = cfg->m_Simulator.white_background;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,7 +276,8 @@ WINDOW_SETTINGS* SIM_PLOT_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
|
|||
{
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
return &cfg->m_Simulator.window;
|
||||
|
||||
return cfg ? &cfg->m_Simulator.window : nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -644,14 +644,17 @@ void PCB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
cs->SetColorContext( COLOR_CONTEXT::PCB );
|
||||
cs->Load();
|
||||
|
||||
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
m_rotationAngle = cfg->m_RotationAngle;
|
||||
g_DrawDefaultLineThickness = Millimeter2iu( cfg->m_PlotLineWidth );
|
||||
m_show_microwave_tools = cfg->m_AuiPanels.show_microwave_tools;
|
||||
m_show_layer_manager_tools = cfg->m_AuiPanels.show_layer_manager;
|
||||
m_showPageLimits = cfg->m_ShowPageLimits;
|
||||
if( cfg )
|
||||
{
|
||||
m_rotationAngle = cfg->m_RotationAngle;
|
||||
g_DrawDefaultLineThickness = Millimeter2iu( cfg->m_PlotLineWidth );
|
||||
m_show_microwave_tools = cfg->m_AuiPanels.show_microwave_tools;
|
||||
m_show_layer_manager_tools = cfg->m_AuiPanels.show_layer_manager;
|
||||
m_showPageLimits = cfg->m_ShowPageLimits;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -670,11 +673,14 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
cfg->m_RotationAngle = m_rotationAngle;
|
||||
cfg->m_PlotLineWidth = Iu2Millimeter( g_DrawDefaultLineThickness );
|
||||
cfg->m_AuiPanels.show_microwave_tools = m_show_microwave_tools;
|
||||
cfg->m_AuiPanels.show_layer_manager = m_show_layer_manager_tools;
|
||||
cfg->m_ShowPageLimits = m_showPageLimits;
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_RotationAngle = m_rotationAngle;
|
||||
cfg->m_PlotLineWidth = Iu2Millimeter( g_DrawDefaultLineThickness );
|
||||
cfg->m_AuiPanels.show_microwave_tools = m_show_microwave_tools;
|
||||
cfg->m_AuiPanels.show_layer_manager = m_show_layer_manager_tools;
|
||||
cfg->m_ShowPageLimits = m_showPageLimits;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue