Fix some Coverity issues.
This commit is contained in:
parent
5f7bcb9c34
commit
ba36fc0009
|
@ -51,13 +51,16 @@ EDA_3D_SETTINGS G_null_EDA_3D_SETTINGS;
|
|||
|
||||
|
||||
EDA_3D_SETTINGS::EDA_3D_SETTINGS() :
|
||||
m_board( nullptr ),
|
||||
m_3d_model_manager( nullptr ),
|
||||
m_colors( nullptr ),
|
||||
m_layerZcoordTop(),
|
||||
m_layerZcoordBottom(),
|
||||
m_currentCamera( m_trackBallCamera ),
|
||||
m_trackBallCamera( RANGE_SCALE_3D )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_SETTINGS::EDA_3D_SETTINGS" ) );
|
||||
|
||||
m_board = NULL;
|
||||
m_3d_model_manager = NULL;
|
||||
m_3D_grid_type = GRID3D_TYPE::NONE;
|
||||
m_drawFlags.resize( FL_LAST, false );
|
||||
|
||||
|
@ -92,9 +95,6 @@ EDA_3D_SETTINGS::EDA_3D_SETTINGS() :
|
|||
m_calc_seg_min_factor3DU = 0.0f;
|
||||
m_calc_seg_max_factor3DU = 0.0f;
|
||||
|
||||
memset( m_layerZcoordTop, 0, sizeof( m_layerZcoordTop ) );
|
||||
memset( m_layerZcoordBottom, 0, sizeof( m_layerZcoordBottom ) );
|
||||
|
||||
SetFlag( FL_USE_REALISTIC_MODE, true );
|
||||
SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, true );
|
||||
SetFlag( FL_SHOW_BOARD_BODY, true );
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#ifndef EDA_3D_SETTINGS_H
|
||||
#define EDA_3D_SETTINGS_H
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer2d.h"
|
||||
#include "../3d_rendering/3d_render_raytracing/accelerators/ccontainer.h"
|
||||
|
@ -46,7 +47,6 @@
|
|||
#include <class_module.h>
|
||||
#include <reporter.h>
|
||||
|
||||
|
||||
class COLOR_SETTINGS;
|
||||
|
||||
/// A type that stores a container of 2d objects for each layer id
|
||||
|
@ -621,10 +621,10 @@ private:
|
|||
double m_biuTo3Dunits;
|
||||
|
||||
/// Top (End) Z position of each layer (normalized)
|
||||
float m_layerZcoordTop[PCB_LAYER_ID_COUNT];
|
||||
std::array<float, PCB_LAYER_ID_COUNT> m_layerZcoordTop;
|
||||
|
||||
/// Bottom (Start) Z position of each layer (normalized)
|
||||
float m_layerZcoordBottom[PCB_LAYER_ID_COUNT];
|
||||
std::array<float, PCB_LAYER_ID_COUNT> m_layerZcoordBottom;
|
||||
|
||||
/// Copper thickness (normalized)
|
||||
float m_copperThickness3DU;
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
*/
|
||||
|
||||
#include <3d_enums.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <wx/config.h>
|
||||
|
||||
#include "3d_viewer_settings.h"
|
||||
|
||||
using KIGFX::COLOR4D;
|
||||
|
||||
///! Update the schema version whenever a migration is required
|
||||
const int viewer3dSchemaVersion = 0;
|
||||
|
||||
|
|
|
@ -72,47 +72,4 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
// Individual color param: not necessary once 3D viewer is migrated to color theme system
|
||||
// TODO(JE) remove once irrelevant
|
||||
class PARAM_COLOR : public PARAM_BASE
|
||||
{
|
||||
public:
|
||||
PARAM_COLOR( const std::string& aJsonPath, COLOR4D* aPtr, COLOR4D aDefault,
|
||||
bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault )
|
||||
{}
|
||||
|
||||
void Load( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
COLOR4D val = m_default;
|
||||
|
||||
if( OPT<COLOR4D> optval = aSettings->Get<COLOR4D>( m_path ) )
|
||||
val = *optval;
|
||||
|
||||
*m_ptr = val;
|
||||
}
|
||||
|
||||
void Store( JSON_SETTINGS* aSettings) const override
|
||||
{
|
||||
aSettings->Set<COLOR4D>( m_path, *m_ptr );
|
||||
}
|
||||
|
||||
COLOR4D GetDefault() const
|
||||
{
|
||||
return m_default;
|
||||
}
|
||||
|
||||
virtual void SetDefault() override
|
||||
{
|
||||
*m_ptr = m_default;
|
||||
}
|
||||
|
||||
private:
|
||||
COLOR4D* m_ptr;
|
||||
COLOR4D m_default;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -376,7 +376,7 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
|||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
auto cfg = dynamic_cast<EDA_3D_VIEWER_SETTINGS*>( aCfg );
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = dynamic_cast<EDA_3D_VIEWER_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings" );
|
||||
|
@ -400,55 +400,51 @@ void EDA_3D_VIEWER::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
|||
set_color( colors->GetColor( LAYER_3D_SOLDERMASK ), m_settings.m_SolderMaskColorTop );
|
||||
set_color( colors->GetColor( LAYER_3D_SOLDERPASTE ), m_settings.m_SolderPasteColor );
|
||||
|
||||
m_settings.SetFlag( FL_USE_REALISTIC_MODE, cfg->m_Render.realistic );
|
||||
if( cfg )
|
||||
{
|
||||
#define TRANSER_SETTING( flag, field ) m_settings.SetFlag( flag, cfg->m_Render.field )
|
||||
|
||||
m_settings.SetFlag( FL_SUBTRACT_MASK_FROM_SILK, cfg->m_Render.subtract_mask_from_silk );
|
||||
TRANSER_SETTING( FL_USE_REALISTIC_MODE, realistic );
|
||||
TRANSER_SETTING( FL_SUBTRACT_MASK_FROM_SILK, subtract_mask_from_silk );
|
||||
|
||||
// OpenGL options
|
||||
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, cfg->m_Render.opengl_copper_thickness );
|
||||
|
||||
m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, cfg->m_Render.opengl_show_model_bbox );
|
||||
TRANSER_SETTING( FL_RENDER_OPENGL_COPPER_THICKNESS, opengl_copper_thickness );
|
||||
TRANSER_SETTING( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, opengl_show_model_bbox );
|
||||
|
||||
// Raytracing options
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, cfg->m_Render.raytrace_shadows );
|
||||
TRANSER_SETTING( FL_RENDER_RAYTRACING_SHADOWS, raytrace_shadows );
|
||||
TRANSER_SETTING( FL_RENDER_RAYTRACING_BACKFLOOR, raytrace_backfloor );
|
||||
TRANSER_SETTING( FL_RENDER_RAYTRACING_REFRACTIONS, raytrace_refractions );
|
||||
TRANSER_SETTING( FL_RENDER_RAYTRACING_REFLECTIONS, raytrace_reflections );
|
||||
TRANSER_SETTING( FL_RENDER_RAYTRACING_POST_PROCESSING, raytrace_post_processing );
|
||||
TRANSER_SETTING( FL_RENDER_RAYTRACING_ANTI_ALIASING, raytrace_anti_aliasing );
|
||||
TRANSER_SETTING( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, raytrace_procedural_textures );
|
||||
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, cfg->m_Render.raytrace_backfloor );
|
||||
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFRACTIONS, cfg->m_Render.raytrace_refractions );
|
||||
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFLECTIONS, cfg->m_Render.raytrace_reflections );
|
||||
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING,
|
||||
cfg->m_Render.raytrace_post_processing );
|
||||
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, cfg->m_Render.raytrace_anti_aliasing );
|
||||
|
||||
m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES,
|
||||
cfg->m_Render.raytrace_procedural_textures );
|
||||
|
||||
m_settings.SetFlag( FL_AXIS, cfg->m_Render.show_axis );
|
||||
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, cfg->m_Render.show_footprints_normal );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, cfg->m_Render.show_footprints_insert );
|
||||
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, cfg->m_Render.show_footprints_virtual );
|
||||
|
||||
m_settings.SetFlag( FL_ZONE, cfg->m_Render.show_zones );
|
||||
m_settings.SetFlag( FL_ADHESIVE, cfg->m_Render.show_adhesive );
|
||||
m_settings.SetFlag( FL_SILKSCREEN, cfg->m_Render.show_silkscreen );
|
||||
m_settings.SetFlag( FL_SOLDERMASK, cfg->m_Render.show_soldermask );
|
||||
m_settings.SetFlag( FL_SOLDERPASTE, cfg->m_Render.show_solderpaste );
|
||||
m_settings.SetFlag( FL_COMMENTS, cfg->m_Render.show_comments );
|
||||
m_settings.SetFlag( FL_ECO, cfg->m_Render.show_eco );
|
||||
m_settings.SetFlag( FL_SHOW_BOARD_BODY, cfg->m_Render.show_board_body );
|
||||
TRANSER_SETTING( FL_AXIS, show_axis );
|
||||
TRANSER_SETTING( FL_MODULE_ATTRIBUTES_NORMAL, show_footprints_normal );
|
||||
TRANSER_SETTING( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, show_footprints_insert );
|
||||
TRANSER_SETTING( FL_MODULE_ATTRIBUTES_VIRTUAL, show_footprints_virtual );
|
||||
TRANSER_SETTING( FL_ZONE, show_zones );
|
||||
TRANSER_SETTING( FL_ADHESIVE, show_adhesive );
|
||||
TRANSER_SETTING( FL_SILKSCREEN, show_silkscreen );
|
||||
TRANSER_SETTING( FL_SOLDERMASK, show_soldermask );
|
||||
TRANSER_SETTING( FL_SOLDERPASTE, show_solderpaste );
|
||||
TRANSER_SETTING( FL_COMMENTS, show_comments );
|
||||
TRANSER_SETTING( FL_ECO, show_eco );
|
||||
TRANSER_SETTING( FL_SHOW_BOARD_BODY, show_board_body );
|
||||
|
||||
m_settings.GridSet( static_cast<GRID3D_TYPE>( cfg->m_Render.grid_type ) );
|
||||
|
||||
RENDER_ENGINE engine = static_cast<RENDER_ENGINE>( cfg->m_Render.engine );
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings render setting %s",
|
||||
( engine == RENDER_ENGINE::RAYTRACING ) ? "Ray Trace" : "OpenGL" );
|
||||
wxLogTrace( m_logTrace, engine == RENDER_ENGINE::RAYTRACING ?
|
||||
"EDA_3D_VIEWER::LoadSettings render setting Ray Trace" :
|
||||
"EDA_3D_VIEWER::LoadSettings render setting OpenGL" );
|
||||
m_settings.RenderEngineSet( engine );
|
||||
|
||||
m_settings.MaterialModeSet( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );
|
||||
|
||||
#undef TRANSFER_SETTING
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,43 +472,49 @@ void EDA_3D_VIEWER::SaveSettings( APP_SETTINGS_BASE *aCfg )
|
|||
save_color( m_settings.m_SolderMaskColorTop, LAYER_3D_SOLDERMASK );
|
||||
save_color( m_settings.m_SolderPasteColor, LAYER_3D_SOLDERPASTE );
|
||||
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings render setting %s",
|
||||
( m_settings.RenderEngineGet() == RENDER_ENGINE::RAYTRACING ) ? "Ray Trace" :
|
||||
"OpenGL" );
|
||||
wxLogTrace( m_logTrace, m_settings.RenderEngineGet() == RENDER_ENGINE::RAYTRACING ?
|
||||
"EDA_3D_VIEWER::SaveSettings render setting Ray Trace" :
|
||||
"EDA_3D_VIEWER::SaveSettings render setting OpenGL" );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
#define TRANSFER_SETTING( field, flag ) cfg->m_Render.field = m_settings.GetFlag( flag )
|
||||
|
||||
cfg->m_Render.engine = static_cast<int>( m_settings.RenderEngineGet() );
|
||||
cfg->m_Render.grid_type = static_cast<int>( m_settings.GridGet() );
|
||||
cfg->m_Render.material_mode = static_cast<int>( m_settings.MaterialModeGet() );
|
||||
|
||||
cfg->m_Render.opengl_copper_thickness = m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS );
|
||||
cfg->m_Render.opengl_show_model_bbox = m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX );
|
||||
cfg->m_Render.raytrace_anti_aliasing = m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING );
|
||||
cfg->m_Render.raytrace_backfloor = m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR );
|
||||
cfg->m_Render.raytrace_post_processing =
|
||||
m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING );
|
||||
cfg->m_Render.raytrace_procedural_textures =
|
||||
m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES );
|
||||
cfg->m_Render.raytrace_reflections = m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS );
|
||||
cfg->m_Render.raytrace_refractions = m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS );
|
||||
cfg->m_Render.raytrace_shadows = m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS );
|
||||
cfg->m_Render.realistic = m_settings.GetFlag( FL_USE_REALISTIC_MODE );
|
||||
cfg->m_Render.show_adhesive = m_settings.GetFlag( FL_ADHESIVE );
|
||||
cfg->m_Render.show_axis = m_settings.GetFlag( FL_AXIS );
|
||||
cfg->m_Render.show_board_body = m_settings.GetFlag( FL_SHOW_BOARD_BODY );
|
||||
cfg->m_Render.show_comments = m_settings.GetFlag( FL_COMMENTS );
|
||||
cfg->m_Render.show_eco = m_settings.GetFlag( FL_ECO );
|
||||
cfg->m_Render.show_footprints_insert = m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT );
|
||||
cfg->m_Render.show_footprints_normal = m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL );
|
||||
cfg->m_Render.show_footprints_virtual = m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL );
|
||||
cfg->m_Render.show_silkscreen = m_settings.GetFlag( FL_SILKSCREEN );
|
||||
cfg->m_Render.show_soldermask = m_settings.GetFlag( FL_SOLDERMASK );
|
||||
cfg->m_Render.show_solderpaste = m_settings.GetFlag( FL_SOLDERPASTE );
|
||||
cfg->m_Render.show_zones = m_settings.GetFlag( FL_ZONE );
|
||||
cfg->m_Render.subtract_mask_from_silk = m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK );
|
||||
TRANSFER_SETTING( opengl_copper_thickness, FL_RENDER_OPENGL_COPPER_THICKNESS );
|
||||
TRANSFER_SETTING( opengl_show_model_bbox, FL_RENDER_OPENGL_SHOW_MODEL_BBOX );
|
||||
TRANSFER_SETTING( raytrace_anti_aliasing, FL_RENDER_RAYTRACING_ANTI_ALIASING );
|
||||
TRANSFER_SETTING( raytrace_backfloor, FL_RENDER_RAYTRACING_BACKFLOOR );
|
||||
TRANSFER_SETTING( raytrace_post_processing, FL_RENDER_RAYTRACING_POST_PROCESSING );
|
||||
TRANSFER_SETTING( raytrace_procedural_textures, FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES );
|
||||
TRANSFER_SETTING( raytrace_reflections, FL_RENDER_RAYTRACING_REFLECTIONS );
|
||||
TRANSFER_SETTING( raytrace_refractions, FL_RENDER_RAYTRACING_REFRACTIONS );
|
||||
TRANSFER_SETTING( raytrace_shadows, FL_RENDER_RAYTRACING_SHADOWS );
|
||||
|
||||
TRANSFER_SETTING( realistic, FL_USE_REALISTIC_MODE );
|
||||
TRANSFER_SETTING( show_adhesive, FL_ADHESIVE );
|
||||
TRANSFER_SETTING( show_axis, FL_AXIS );
|
||||
TRANSFER_SETTING( show_board_body, FL_SHOW_BOARD_BODY );
|
||||
TRANSFER_SETTING( show_comments, FL_COMMENTS );
|
||||
TRANSFER_SETTING( show_eco, FL_ECO );
|
||||
TRANSFER_SETTING( show_footprints_insert, FL_MODULE_ATTRIBUTES_NORMAL_INSERT );
|
||||
TRANSFER_SETTING( show_footprints_normal, FL_MODULE_ATTRIBUTES_NORMAL );
|
||||
TRANSFER_SETTING( show_footprints_virtual, FL_MODULE_ATTRIBUTES_VIRTUAL );
|
||||
TRANSFER_SETTING( show_silkscreen, FL_SILKSCREEN );
|
||||
TRANSFER_SETTING( show_soldermask, FL_SOLDERMASK );
|
||||
TRANSFER_SETTING( show_solderpaste, FL_SOLDERPASTE );
|
||||
TRANSFER_SETTING( show_zones, FL_ZONE );
|
||||
TRANSFER_SETTING( subtract_mask_from_silk, FL_SUBTRACT_MASK_FROM_SILK );
|
||||
|
||||
#undef TRANSER_SETTING
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::SynchroniseColoursWithBoard( void )
|
||||
void EDA_3D_VIEWER::SynchroniseColoursWithBoard()
|
||||
{
|
||||
BOARD* brd = GetBoard();
|
||||
const FAB_LAYER_COLOR* stdColors = GetColorStandardList();
|
||||
|
|
|
@ -65,8 +65,16 @@ void EDA_3D_CONTROLLER::Reset( RESET_REASON aReason )
|
|||
{
|
||||
TOOLS_HOLDER* holder = m_toolMgr->GetToolHolder();
|
||||
|
||||
if( holder )
|
||||
{
|
||||
m_canvas = dynamic_cast<EDA_3D_CANVAS*>( holder->GetToolCanvas() );
|
||||
m_settings = dynamic_cast<EDA_3D_SETTINGS_HOLDER*>( holder )->GetSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_canvas = nullptr;
|
||||
m_settings = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -147,22 +147,26 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
|||
|
||||
Layout();
|
||||
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER& panelCfg = cfg->m_SymChooserPanel;
|
||||
|
||||
// We specify the width of the right window (m_symbol_view_panel), because specify
|
||||
// the width of the left window does not work as expected when SetSashGravity() is called
|
||||
m_hsplitter->SetSashPosition( cfg->m_SymChooserPanel.sash_pos_h > 0 ?
|
||||
cfg->m_SymChooserPanel.sash_pos_h : HorizPixelsFromDU( 220 ) );
|
||||
m_hsplitter->SetSashPosition( panelCfg.sash_pos_h > 0 ? panelCfg.sash_pos_h :
|
||||
HorizPixelsFromDU( 220 ) );
|
||||
|
||||
if( m_vsplitter )
|
||||
m_vsplitter->SetSashPosition( cfg->m_SymChooserPanel.sash_pos_v > 0 ?
|
||||
cfg->m_SymChooserPanel.sash_pos_v : VertPixelsFromDU( 230 ) );
|
||||
m_vsplitter->SetSashPosition( panelCfg.sash_pos_v > 0 ? panelCfg.sash_pos_v :
|
||||
VertPixelsFromDU( 230 ) );
|
||||
|
||||
wxSize dlgSize( cfg->m_SymChooserPanel.width > 0 ?
|
||||
cfg->m_SymChooserPanel.width : HorizPixelsFromDU( 390 ),
|
||||
cfg->m_SymChooserPanel.height > 0 ?
|
||||
cfg->m_SymChooserPanel.height : VertPixelsFromDU( 300 ) );
|
||||
wxSize dlgSize( panelCfg.width > 0 ? panelCfg.width : HorizPixelsFromDU( 390 ),
|
||||
panelCfg.height > 0 ? panelCfg.height : VertPixelsFromDU( 300 ) );
|
||||
SetSize( dlgSize );
|
||||
}
|
||||
|
||||
SetInitialFocus( m_tree );
|
||||
okButton->SetDefault();
|
||||
|
|
|
@ -555,8 +555,11 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup()
|
|||
|
||||
NetlistUpdateOpt();
|
||||
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_NetlistPanel.custom_command_titles.clear();
|
||||
cfg->m_NetlistPanel.custom_command_paths.clear();
|
||||
|
||||
|
@ -573,10 +576,11 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup()
|
|||
if( title.IsEmpty() )
|
||||
continue;
|
||||
|
||||
cfg->m_NetlistPanel.custom_command_titles.push_back( title.ToStdString() );
|
||||
cfg->m_NetlistPanel.custom_command_paths.push_back(
|
||||
cfg->m_NetlistPanel.custom_command_titles.emplace_back( title.ToStdString() );
|
||||
cfg->m_NetlistPanel.custom_command_paths.emplace_back(
|
||||
currPage->m_CommandStringCtrl->GetValue().ToStdString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -497,8 +497,11 @@ void SCH_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
{
|
||||
EDA_DRAW_FRAME::LoadSettings( aCfg );
|
||||
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_repeatStep.x = Mils2iu( cfg->m_Drawing.default_repeat_offset_x );
|
||||
m_repeatStep.y = Mils2iu( cfg->m_Drawing.default_repeat_offset_y );
|
||||
|
||||
|
@ -534,6 +537,7 @@ void SCH_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KIGFX::SCH_RENDER_SETTINGS* settings = GetRenderSettings();
|
||||
settings->m_ShowPinsElectricalType = false;
|
||||
|
@ -548,11 +552,13 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
{
|
||||
EDA_DRAW_FRAME::SaveSettings( aCfg );
|
||||
|
||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
// TODO(JE) do most of these need to live as class members here, or can the sites that need
|
||||
// the setting just grab a pointer to the EESCHEMA_SETTINGS and look them up directly?
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_Appearance.footprint_preview = m_footprintPreview;
|
||||
cfg->m_Appearance.navigator_stays_open = m_navigatorStaysOpen;
|
||||
cfg->m_Appearance.print_sheet_reference = m_printSheetReference;
|
||||
|
@ -593,6 +599,7 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
record.Replace( wxT(" "), wxT(" "), true ); // double space to single
|
||||
|
||||
cfg->m_Drawing.field_names = record.ToStdString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,9 +40,10 @@
|
|||
#include <utf8.h>
|
||||
|
||||
|
||||
BACK_ANNOTATE::BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, SETTINGS aSettings )
|
||||
: m_settings( aSettings ),
|
||||
m_frame( aFrame )
|
||||
BACK_ANNOTATE::BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, SETTINGS aSettings ) :
|
||||
m_settings( aSettings ),
|
||||
m_frame( aFrame ),
|
||||
m_changesCount( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -235,8 +236,9 @@ int BACK_ANNOTATE::checkForUnusedSymbols()
|
|||
|
||||
m_refs.SortByTimeStamp();
|
||||
|
||||
std::sort(
|
||||
m_changelist.begin(), m_changelist.end(), []( CHANGELIST_ITEM a, CHANGELIST_ITEM b ) {
|
||||
std::sort( m_changelist.begin(), m_changelist.end(),
|
||||
[]( const CHANGELIST_ITEM& a, const CHANGELIST_ITEM& b )
|
||||
{
|
||||
return SCH_REFERENCE_LIST::sortByTimeStamp( a.first, b.first );
|
||||
} );
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include <widgets/wx_grid.h>
|
||||
|
||||
|
||||
PANEL_PCBNEW_ACTION_PLUGINS::PANEL_PCBNEW_ACTION_PLUGINS( PCB_EDIT_FRAME* aFrame, PAGED_DIALOG* aWindow ) :
|
||||
PANEL_PCBNEW_ACTION_PLUGINS::PANEL_PCBNEW_ACTION_PLUGINS( PCB_EDIT_FRAME* aFrame,
|
||||
PAGED_DIALOG* aWindow ) :
|
||||
PANEL_PCBNEW_ACTION_PLUGINS_BASE( aWindow->GetTreebook() ),
|
||||
m_frame( aFrame )
|
||||
{
|
||||
|
@ -138,15 +139,20 @@ void PANEL_PCBNEW_ACTION_PLUGINS::OnReloadButtonClick( wxCommandEvent& event )
|
|||
|
||||
bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataFromWindow()
|
||||
{
|
||||
auto settings = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxASSERT( settings );
|
||||
|
||||
if( settings )
|
||||
{
|
||||
settings->m_VisibleActionPlugins.clear();
|
||||
|
||||
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
|
||||
{
|
||||
settings->m_VisibleActionPlugins.emplace_back( std::make_pair(
|
||||
m_grid->GetCellValue( ii, COLUMN_PATH ),
|
||||
m_grid->GetCellValue( ii, COLUMN_VISIBLE ) == wxT( "1" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -155,6 +161,7 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataFromWindow()
|
|||
bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow()
|
||||
{
|
||||
m_grid->Freeze();
|
||||
|
||||
if( m_grid->GetNumberRows() != 0 )
|
||||
m_grid->DeleteRows( 0, m_grid->GetNumberRows() );
|
||||
|
||||
|
@ -173,21 +180,14 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataToWindow()
|
|||
m_grid->SetCellRenderer( row, COLUMN_VISIBLE, new wxGridCellBoolRenderer() );
|
||||
m_grid->SetCellAlignment( row, COLUMN_VISIBLE, wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
bool showButton = m_frame->GetActionPluginButtonVisible(
|
||||
ap->GetPluginPath(), ap->GetShowToolbarButton() );
|
||||
bool showButton = m_frame->GetActionPluginButtonVisible( ap->GetPluginPath(),
|
||||
ap->GetShowToolbarButton() );
|
||||
|
||||
m_grid->SetCellValue( row, COLUMN_VISIBLE, showButton ? wxT( "1" ) : wxEmptyString );
|
||||
|
||||
// Name
|
||||
m_grid->SetCellValue( row, COLUMN_NAME, ap->GetName() );
|
||||
|
||||
// Category
|
||||
m_grid->SetCellValue( row, COLUMN_CATEGORY, ap->GetCategoryName() );
|
||||
|
||||
// Description
|
||||
m_grid->SetCellValue( row, COLUMN_DESCRIPTION, ap->GetDescription() );
|
||||
|
||||
// Path
|
||||
m_grid->SetCellValue( row, COLUMN_PATH, ap->GetPluginPath() );
|
||||
}
|
||||
|
||||
|
|
|
@ -512,9 +512,12 @@ void FOOTPRINT_WIZARD_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
EDA_DRAW_FRAME::LoadSettings( cfg );
|
||||
|
||||
m_auiPerspective = cfg->m_FootprintViewer.perspective;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -523,9 +526,12 @@ void FOOTPRINT_WIZARD_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
EDA_DRAW_FRAME::SaveSettings( cfg );
|
||||
|
||||
cfg->m_FootprintViewer.perspective = m_auimgr.SavePerspective().ToStdString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -533,7 +539,8 @@ WINDOW_SETTINGS* FOOTPRINT_WIZARD_FRAME::GetWindowSettings( APP_SETTINGS_BASE* a
|
|||
{
|
||||
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
|
||||
wxASSERT( cfg );
|
||||
return &cfg->m_FootprintWizard;
|
||||
|
||||
return cfg ? &cfg->m_FootprintWizard : nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue