Merge branch kicad:master into master

This commit is contained in:
Alihossein Sepahvand 2025-06-17 07:58:38 -06:00
commit 42431925cb
226 changed files with 21520 additions and 7008 deletions

View File

@ -37,6 +37,8 @@ win64_build:
../../
- cmake --build . 2>&1 | tee compilation_log.txt
- cd ../../
after_script:
- Get-Content -Path C:\builder\vcpkg\buildtrees\wxpython-33\python3-tool-post-install-err.log
artifacts:
# Only save the artifacts that are needed for running the tests in the next stage
# and the compilation log. The entire build directory is too large to save as an

View File

@ -227,17 +227,11 @@ BOARD_ADAPTER::~BOARD_ADAPTER()
void BOARD_ADAPTER::ReloadColorSettings() noexcept
{
wxCHECK( PgmOrNull(), /* void */ );
PCBNEW_SETTINGS* cfg = GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
COLOR_SETTINGS* cs = ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
COLOR_SETTINGS* colors = mgr.GetColorSettings( cfg ? cfg->m_ColorTheme : wxString( "" ) );
if( colors )
{
for( int layer = F_Cu; layer < PCB_LAYER_ID_COUNT; ++layer )
m_BoardEditorColors[ layer ] = colors->GetColor( layer );
}
for( int layer = F_Cu; layer < PCB_LAYER_ID_COUNT; ++layer )
m_BoardEditorColors[ layer ] = cs->GetColor( layer );
}
@ -617,7 +611,7 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetDefaultColors() const
colors[ LAYER_3D_USER_ECO1 ] = BOARD_ADAPTER::g_DefaultECOs;
colors[ LAYER_3D_USER_ECO2 ] = BOARD_ADAPTER::g_DefaultECOs;
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings( wxEmptyString );
COLOR_SETTINGS* settings = ::GetColorSettings( DEFAULT_THEME );
for( int layer = LAYER_3D_USER_1; layer <= LAYER_3D_USER_45; ++layer )
colors[ layer ] = settings->GetColor( layer );
@ -636,7 +630,7 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
}
else
{
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
COLOR_SETTINGS* settings = ::GetColorSettings( DEFAULT_THEME );
for( const auto& [ layer, defaultColor /* unused */ ] : GetDefaultColors() )
colors[ layer ] = settings->GetColor( layer );
@ -746,7 +740,7 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
void BOARD_ADAPTER::SetLayerColors( const std::map<int, COLOR4D>& aColors )
{
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
COLOR_SETTINGS* settings = ::GetColorSettings( DEFAULT_THEME );
for( const auto& [ layer, color ] : aColors )
{

View File

@ -680,6 +680,31 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
break;
case SHAPE_T::BEZIER:
{
SHAPE_POLY_SET polyList;
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, ERROR_INSIDE );
// Some polygons can be a bit complex (especially when coming from a
// picture of a text converted to a polygon
// So call Simplify before calling ConvertPolygonToTriangles, just in case.
polyList.Simplify();
if( polyList.IsEmpty() ) // Just for caution
break;
if( margin != 0 )
{
CORNER_STRATEGY cornerStr = margin >= 0 ? CORNER_STRATEGY::ROUND_ALL_CORNERS
: CORNER_STRATEGY::ALLOW_ACUTE_CORNERS;
polyList.Inflate( margin, cornerStr, GetBoard()->GetDesignSettings().m_MaxError );
}
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
break;
}
case SHAPE_T::POLY:
{
if( isSolidFill )

View File

@ -1124,14 +1124,14 @@ bool EDA_3D_CANVAS::SetView3D( VIEW3D_TYPE aRequestedView )
void EDA_3D_CANVAS::RenderEngineChanged()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
switch( cfg->m_Render.engine )
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
{
case RENDER_ENGINE::OPENGL: m_3d_render = m_3d_render_opengl; break;
case RENDER_ENGINE::RAYTRACING: m_3d_render = m_3d_render_raytracing; break;
default: m_3d_render = nullptr; break;
switch( cfg->m_Render.engine )
{
case RENDER_ENGINE::OPENGL: m_3d_render = m_3d_render_opengl; break;
case RENDER_ENGINE::RAYTRACING: m_3d_render = m_3d_render_raytracing; break;
default: m_3d_render = nullptr; break;
}
}
if( m_3d_render )

View File

@ -111,24 +111,26 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
SetStatusWidths( arrayDim( status_dims ), status_dims );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
ANTIALIASING_MODE aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode );
ANTIALIASING_MODE aaMode = ANTIALIASING_MODE::AA_NONE;
EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode, true ),
m_boardAdapter, m_currentCamera,
PROJECT_PCB::Get3DCacheManager( &Prj() ) );
if( cfg )
aaMode = static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode );
m_canvas = new EDA_3D_CANVAS( this, OGL_ATT_LIST::GetAttributesList( aaMode, true ), m_boardAdapter,
m_currentCamera, PROJECT_PCB::Get3DCacheManager( &Prj() ) );
m_appearancePanel = new APPEARANCE_CONTROLS_3D( this, GetCanvas() );
LoadSettings( cfg );
LoadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
loadCommonSettings();
m_appearancePanel->SetUserViewports( Prj().GetProjectFile().m_Viewports3D );
// Create the manager
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), nullptr, nullptr, cfg, this );
m_toolManager->SetEnvironment( GetBoard(), nullptr, nullptr,
GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ), this );
m_actions = new EDA_3D_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
@ -142,7 +144,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
setupUIConditions();
if( EDA_3D_CONTROLLER* ctrlTool = GetToolManager()->GetTool<EDA_3D_CONTROLLER>() )
ctrlTool->SetRotationIncrement( cfg->m_Camera.rotation_increment );
ctrlTool->SetRotationIncrement( cfg ? cfg->m_Camera.rotation_increment : 10.0 );
// Run the viewer control tool, it is supposed to be always active
m_toolManager->InvokeTool( "3DViewer.Control" );
@ -170,10 +172,11 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
if( cfg->m_AuiPanels.right_panel_width > 0 )
if( cfg && cfg->m_AuiPanels.right_panel_width > 0 )
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
if( cfg )
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hiding it.
@ -455,35 +458,25 @@ void EDA_3D_VIEWER_FRAME::OnCloseWindow( wxCloseEvent &event )
void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
{
int id = event.GetId();
bool isChecked = event.IsChecked();
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::Process_Special_Functions id %d "
"isChecked %d" ),
id,
isChecked );
if( m_canvas == nullptr )
return;
switch( id )
switch( event.GetId() )
{
case ID_MENU3D_RESET_DEFAULTS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
m_boardAdapter.SetLayerColors( m_boardAdapter.GetDefaultColors() );
cfg->ResetToDefaults();
LoadSettings( cfg );
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
cfg->ResetToDefaults();
LoadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
// Tell canvas that we (may have) changed the render engine
RenderEngineChanged();
NewDisplay( true );
}
return;
}
default:
wxFAIL_MSG( wxT( "Invalid event in EDA_3D_VIEWER_FRAME::Process_Special_Functions()" ) );
@ -494,8 +487,7 @@ void EDA_3D_VIEWER_FRAME::Process_Special_Functions( wxCommandEvent &event )
void EDA_3D_VIEWER_FRAME::onDisableRayTracing( wxCommandEvent& aEvent )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::%s disabling ray tracing." ),
__WXFUNCTION__ );
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::%s disabling ray tracing." ), __WXFUNCTION__ );
m_disable_ray_tracing = true;
m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL;
@ -580,19 +572,9 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
void EDA_3D_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE *aCfg )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
EDA_BASE_FRAME::SaveSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
EDA_BASE_FRAME::SaveSettings( cfg );
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::SaveSettings" ) );
wxLogTrace( m_logTrace, m_boardAdapter.m_Cfg->m_Render.engine == RENDER_ENGINE::RAYTRACING ?
wxT( "EDA_3D_VIEWER_FRAME::SaveSettings render setting Ray Trace" )
:
wxT( "EDA_3D_VIEWER_FRAME::SaveSettings render setting OpenGL" ) );
if( cfg )
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
{
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
@ -614,8 +596,7 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( int aFlags )
EDA_BASE_FRAME::CommonSettingsChanged( aFlags );
loadCommonSettings();
applySettings(
Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
applySettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
m_appearancePanel->CommonSettingsChanged();
@ -643,23 +624,24 @@ void EDA_3D_VIEWER_FRAME::ShowChangedLanguage()
void EDA_3D_VIEWER_FRAME::ToggleAppearanceManager()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
// show auxiliary Vertical layers and visibility manager toolbar
cfg->m_AuiPanels.show_layer_manager = !cfg->m_AuiPanels.show_layer_manager;
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
if( cfg->m_AuiPanels.show_layer_manager )
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
{
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
}
else
{
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
m_auimgr.Update();
// show auxiliary Vertical layers and visibility manager toolbar
cfg->m_AuiPanels.show_layer_manager = !cfg->m_AuiPanels.show_layer_manager;
layersManager.Show( cfg->m_AuiPanels.show_layer_manager );
if( cfg->m_AuiPanels.show_layer_manager )
{
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
}
else
{
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
m_auimgr.Update();
}
}
}

View File

@ -64,32 +64,28 @@ void PANEL_3D_DISPLAY_OPTIONS::loadViewSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
loadViewSettings( cfg );
loadViewSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
return true;
}
bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
{
// Set visibility of items
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
cfg->m_Render.clip_silk_on_via_annuli = m_checkBoxClipSilkOnViaAnnulus->GetValue();
cfg->m_Render.differentiate_plated_copper = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
// Set visibility of items
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
cfg->m_Render.clip_silk_on_via_annuli = m_checkBoxClipSilkOnViaAnnulus->GetValue();
cfg->m_Render.differentiate_plated_copper = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
cfg->m_Render.material_mode = static_cast<MATERIAL_MODE>( m_materialProperties->GetSelection() );
cfg->m_Render.material_mode = static_cast<MATERIAL_MODE>( m_materialProperties->GetSelection() );
// Camera Options
cfg->m_Camera.animation_enabled = m_checkBoxEnableAnimation->GetValue();
cfg->m_Camera.moving_speed_multiplier = m_sliderAnimationSpeed->GetValue();
cfg->m_Camera.rotation_increment = m_spinCtrlRotationAngle->GetValue();
// Camera Options
cfg->m_Camera.animation_enabled = m_checkBoxEnableAnimation->GetValue();
cfg->m_Camera.moving_speed_multiplier = m_sliderAnimationSpeed->GetValue();
cfg->m_Camera.rotation_increment = m_spinCtrlRotationAngle->GetValue();
}
return true;
}

View File

@ -56,32 +56,27 @@ void PANEL_3D_OPENGL_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
bool PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
loadSettings( cfg );
loadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
return true;
}
bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
{
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
cfg->m_Render.highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
cfg->m_Render.opengl_copper_thickness = m_checkBoxCuThickness->GetValue();
cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue();
cfg->m_Render.highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue();
cfg->m_Render.opengl_AA_mode = static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() );
cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor();
cfg->m_Render.opengl_AA_mode =
static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() );
cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor();
cfg->m_Render.opengl_AA_disableOnMove = m_checkBoxDisableAAMove->GetValue();
cfg->m_Render.opengl_thickness_disableOnMove = m_checkBoxDisableMoveThickness->GetValue();
cfg->m_Render.opengl_microvias_disableOnMove = m_checkBoxDisableMoveVias->GetValue();
cfg->m_Render.opengl_holes_disableOnMove = m_checkBoxDisableMoveHoles->GetValue();
cfg->m_Render.opengl_AA_disableOnMove = m_checkBoxDisableAAMove->GetValue();
cfg->m_Render.opengl_thickness_disableOnMove = m_checkBoxDisableMoveThickness->GetValue();
cfg->m_Render.opengl_microvias_disableOnMove = m_checkBoxDisableMoveVias->GetValue();
cfg->m_Render.opengl_holes_disableOnMove = m_checkBoxDisableMoveHoles->GetValue();
}
return true;
}

View File

@ -110,85 +110,78 @@ void PANEL_3D_RAYTRACING_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
loadSettings( cfg );
loadSettings( GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) );
return true;
}
bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
{
cfg->m_Render.raytrace_shadows = m_cbRaytracing_renderShadows->GetValue();
cfg->m_Render.raytrace_backfloor = m_cbRaytracing_addFloor->GetValue();
cfg->m_Render.raytrace_refractions = m_cbRaytracing_showRefractions->GetValue();
cfg->m_Render.raytrace_reflections = m_cbRaytracing_showReflections->GetValue();
cfg->m_Render.raytrace_post_processing = m_cbRaytracing_postProcessing->GetValue();
cfg->m_Render.raytrace_anti_aliasing = m_cbRaytracing_antiAliasing->GetValue();
cfg->m_Render.raytrace_procedural_textures = m_cbRaytracing_proceduralTextures->GetValue();
cfg->m_Render.raytrace_shadows = m_cbRaytracing_renderShadows->GetValue();
cfg->m_Render.raytrace_backfloor = m_cbRaytracing_addFloor->GetValue();
cfg->m_Render.raytrace_refractions = m_cbRaytracing_showRefractions->GetValue();
cfg->m_Render.raytrace_reflections = m_cbRaytracing_showReflections->GetValue();
cfg->m_Render.raytrace_post_processing = m_cbRaytracing_postProcessing->GetValue();
cfg->m_Render.raytrace_anti_aliasing = m_cbRaytracing_antiAliasing->GetValue();
cfg->m_Render.raytrace_procedural_textures = m_cbRaytracing_proceduralTextures->GetValue();
cfg->m_Render.raytrace_nrsamples_shadows = m_numSamples_Shadows->GetValue();
cfg->m_Render.raytrace_nrsamples_reflections = m_numSamples_Reflections->GetValue();
cfg->m_Render.raytrace_nrsamples_refractions = m_numSamples_Refractions->GetValue();
cfg->m_Render.raytrace_nrsamples_shadows = m_numSamples_Shadows->GetValue();
cfg->m_Render.raytrace_nrsamples_reflections = m_numSamples_Reflections->GetValue();
cfg->m_Render.raytrace_nrsamples_refractions = m_numSamples_Refractions->GetValue();
cfg->m_Render.raytrace_spread_shadows =
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
m_spreadFactor_Shadows->GetValue() ) / 100.0f;
cfg->m_Render.raytrace_spread_reflections =
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
m_spreadFactor_Reflections->GetValue() ) / 100.0f;
cfg->m_Render.raytrace_spread_refractions =
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
m_spreadFactor_Refractions->GetValue() ) / 100.0f;
cfg->m_Render.raytrace_spread_shadows =
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
m_spreadFactor_Shadows->GetValue() )
/ 100.0f;
cfg->m_Render.raytrace_spread_reflections =
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
m_spreadFactor_Reflections->GetValue() )
/ 100.0f;
cfg->m_Render.raytrace_spread_refractions =
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
m_spreadFactor_Refractions->GetValue() )
/ 100.0f;
cfg->m_Render.raytrace_recursivelevel_reflections = m_recursiveLevel_Reflections->GetValue();
cfg->m_Render.raytrace_recursivelevel_refractions = m_recursiveLevel_Refractions->GetValue();
cfg->m_Render.raytrace_recursivelevel_reflections = m_recursiveLevel_Reflections->GetValue();
cfg->m_Render.raytrace_recursivelevel_refractions = m_recursiveLevel_Refractions->GetValue();
cfg->m_Render.raytrace_lightColorCamera = m_colourPickerCameraLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColorTop = m_colourPickerTopLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColorBottom = m_colourPickerBottomLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColorCamera = m_colourPickerCameraLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColorTop = m_colourPickerTopLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColorBottom = m_colourPickerBottomLight->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[0] = m_colourPickerLight1->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[1] = m_colourPickerLight2->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[2] = m_colourPickerLight3->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[3] = m_colourPickerLight4->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[4] = m_colourPickerLight5->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[5] = m_colourPickerLight6->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[6] = m_colourPickerLight7->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[7] = m_colourPickerLight8->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[0] = m_colourPickerLight1->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[1] = m_colourPickerLight2->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[2] = m_colourPickerLight3->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[3] = m_colourPickerLight4->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[4] = m_colourPickerLight5->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[5] = m_colourPickerLight6->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[6] = m_colourPickerLight7->GetSwatchColor();
cfg->m_Render.raytrace_lightColor[7] = m_colourPickerLight8->GetSwatchColor();
auto get_value =
[]( wxTextCtrl* aCtrl )
{
return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
aCtrl->GetValue() );
};
auto get_value =
[]( wxTextCtrl* aCtrl )
{
return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
aCtrl->GetValue() );
};
cfg->m_Render.raytrace_lightElevation[0] = get_value( m_lightElevation1 );
cfg->m_Render.raytrace_lightElevation[1] = get_value( m_lightElevation2 );
cfg->m_Render.raytrace_lightElevation[2] = get_value( m_lightElevation3 );
cfg->m_Render.raytrace_lightElevation[3] = get_value( m_lightElevation4 );
cfg->m_Render.raytrace_lightElevation[4] = get_value( m_lightElevation5 );
cfg->m_Render.raytrace_lightElevation[5] = get_value( m_lightElevation6 );
cfg->m_Render.raytrace_lightElevation[6] = get_value( m_lightElevation7 );
cfg->m_Render.raytrace_lightElevation[7] = get_value( m_lightElevation8 );
cfg->m_Render.raytrace_lightElevation[0] = get_value( m_lightElevation1 );
cfg->m_Render.raytrace_lightElevation[1] = get_value( m_lightElevation2 );
cfg->m_Render.raytrace_lightElevation[2] = get_value( m_lightElevation3 );
cfg->m_Render.raytrace_lightElevation[3] = get_value( m_lightElevation4 );
cfg->m_Render.raytrace_lightElevation[4] = get_value( m_lightElevation5 );
cfg->m_Render.raytrace_lightElevation[5] = get_value( m_lightElevation6 );
cfg->m_Render.raytrace_lightElevation[6] = get_value( m_lightElevation7 );
cfg->m_Render.raytrace_lightElevation[7] = get_value( m_lightElevation8 );
cfg->m_Render.raytrace_lightAzimuth[0] = get_value( m_lightAzimuth1 );
cfg->m_Render.raytrace_lightAzimuth[1] = get_value( m_lightAzimuth2 );
cfg->m_Render.raytrace_lightAzimuth[2] = get_value( m_lightAzimuth3 );
cfg->m_Render.raytrace_lightAzimuth[3] = get_value( m_lightAzimuth4 );
cfg->m_Render.raytrace_lightAzimuth[4] = get_value( m_lightAzimuth5 );
cfg->m_Render.raytrace_lightAzimuth[5] = get_value( m_lightAzimuth6 );
cfg->m_Render.raytrace_lightAzimuth[6] = get_value( m_lightAzimuth7 );
cfg->m_Render.raytrace_lightAzimuth[7] = get_value( m_lightAzimuth8 );
cfg->m_Render.raytrace_lightAzimuth[0] = get_value( m_lightAzimuth1 );
cfg->m_Render.raytrace_lightAzimuth[1] = get_value( m_lightAzimuth2 );
cfg->m_Render.raytrace_lightAzimuth[2] = get_value( m_lightAzimuth3 );
cfg->m_Render.raytrace_lightAzimuth[3] = get_value( m_lightAzimuth4 );
cfg->m_Render.raytrace_lightAzimuth[4] = get_value( m_lightAzimuth5 );
cfg->m_Render.raytrace_lightAzimuth[5] = get_value( m_lightAzimuth6 );
cfg->m_Render.raytrace_lightAzimuth[6] = get_value( m_lightAzimuth7 );
cfg->m_Render.raytrace_lightAzimuth[7] = get_value( m_lightAzimuth8 );
}
return true;
}

View File

@ -212,10 +212,7 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
// TODO(JE) use all control options
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EDA_3D_VIEWER_SETTINGS* cfg = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
if( cfg )
if( EDA_3D_VIEWER_SETTINGS* cfg = GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) )
{
// Save the 3D viewer render settings, to restore it after closing the preview
m_initialRender = cfg->m_Render;

View File

@ -520,6 +520,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
set(WX_LIB_DIR_PREFIX vc)
endif()
set( EXTRA_LIB_PATH "" )
if(VCPKG_TOOLCHAIN)
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set( EXTRA_LIB_PATH "${WX_ROOT_DIR}/debug/lib" )
else()
set( EXTRA_LIB_PATH "${WX_ROOT_DIR}/lib" )
endif()
endif()
if(BUILD_SHARED_LIBS)
find_path(wxWidgets_LIB_DIR
NAMES
@ -536,6 +545,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
PATHS
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll # prefer shared
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib
${EXTRA_LIB_PATH}
DOC "Path to wxWidgets libraries"
NO_DEFAULT_PATH
)
@ -555,6 +565,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
PATHS
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_lib # prefer static
${WX_ROOT_DIR}/lib/${WX_LIB_DIR_PREFIX}_dll
${EXTRA_LIB_PATH}
DOC "Path to wxWidgets libraries"
NO_DEFAULT_PATH
)
@ -614,6 +625,10 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
set(WX_USE_REL_AND_DBG FALSE)
endif()
if( VCPKG_TOOLCHAIN )
set(WX_USE_REL_AND_DBG FALSE)
endif()
# Get configuration parameters from the name.
WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} PF UNV UCD DBG)

View File

@ -259,6 +259,8 @@ if( MSVC )
string( APPEND WARN_FLAGS_CXX " /wd5204 /wd4265" )
# disable "layout of class may have changed from a previous version of the compiler"
string( APPEND WARN_FLAGS_CXX " /wd4371" )
# disable "'this': used in base member initializer list"
string( APPEND WARN_FLAGS_CXX " /wd4355" )
# disable "relative include path contains '..'"
string( APPEND WARN_FLAGS_CXX " /wd4464" )
# disable "'const' variable is not used"

View File

@ -312,6 +312,8 @@ ADVANCED_CFG::ADVANCED_CFG()
m_MaxPastedTextLength = 100;
m_hopOverArcRadius = 2.5;
loadFromConfigFile();
}

View File

@ -645,16 +645,14 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
aTable.clear();
aTable.Load( fn.GetFullPath() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" );
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
wxString packagesPath;
if( std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( env, wxT( "3RD_PARTY" ) ) )
packagesPath = *v;
if( settings->m_PcmLibAutoAdd )
if( cfg && cfg->m_PcmLibAutoAdd )
{
// Scan for libraries in PCM packages directory
@ -663,14 +661,14 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
if( d.DirExists() )
{
PCM_DESIGN_BLOCK_LIB_TRAVERSER traverser( packagesPath, aTable, settings->m_PcmLibPrefix );
PCM_DESIGN_BLOCK_LIB_TRAVERSER traverser( packagesPath, aTable, cfg->m_PcmLibPrefix );
wxDir dir( d.GetPath() );
dir.Traverse( traverser );
}
}
if( settings->m_PcmLibAutoRemove )
if( cfg && cfg->m_PcmLibAutoRemove )
{
// Remove PCM libraries that no longer exist
std::vector<wxString> to_remove;

View File

@ -369,15 +369,14 @@ bool PANEL_COLOR_SETTINGS::saveCurrentTheme( bool aValidate )
if( aValidate && !validateSave() )
return false;
SETTINGS_MANAGER& settingsMgr = Pgm().GetSettingsManager();
COLOR_SETTINGS* selected = settingsMgr.GetColorSettings( m_currentSettings->GetFilename() );
COLOR_SETTINGS* selected = ::GetColorSettings( m_currentSettings->GetFilename() );
selected->SetOverrideSchItemColors( m_optOverrideColors->GetValue() );
for( int layer : m_validLayers )
selected->SetColor( layer, m_currentSettings->GetColor( layer ) );
settingsMgr.SaveColorSettings( selected, m_colorNamespace );
Pgm().GetSettingsManager().SaveColorSettings( selected, m_colorNamespace );
return true;
}

View File

@ -317,79 +317,80 @@ PANEL_DESIGN_BLOCK_LIB_TABLE::PANEL_DESIGN_BLOCK_LIB_TABLE( DIALOG_EDIT_LIBRARY_
for( auto& [fileType, desc] : m_supportedDesignBlockFiles )
choices.Add( DESIGN_BLOCK_IO_MGR::ShowType( fileType ) );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" );
if( cfg->m_lastDesignBlockLibDir.IsEmpty() )
cfg->m_lastDesignBlockLibDir = PATHS::GetDefaultUserDesignBlocksPath();
m_lastProjectLibDir = m_projectBasePath;
auto autoSizeCol = [&]( WX_GRID* aGrid, int aCol )
{
int prevWidth = aGrid->GetColSize( aCol );
auto autoSizeCol =
[&]( WX_GRID* aGrid, int aCol )
{
int prevWidth = aGrid->GetColSize( aCol );
aGrid->AutoSizeColumn( aCol, false );
aGrid->SetColSize( aCol, std::max( prevWidth, aGrid->GetColSize( aCol ) ) );
};
aGrid->AutoSizeColumn( aCol, false );
aGrid->SetColSize( aCol, std::max( prevWidth, aGrid->GetColSize( aCol ) ) );
};
auto setupGrid = [&]( WX_GRID* aGrid )
{
// Give a bit more room for wxChoice editors
aGrid->SetDefaultRowSize( aGrid->GetDefaultRowSize() + 4 );
auto setupGrid =
[&]( WX_GRID* aGrid )
{
// Give a bit more room for wxChoice editors
aGrid->SetDefaultRowSize( aGrid->GetDefaultRowSize() + 4 );
// add Cut, Copy, and Paste to wxGrids
aGrid->PushEventHandler( new DESIGN_BLOCK_GRID_TRICKS( m_parent, aGrid ) );
// add Cut, Copy, and Paste to wxGrids
aGrid->PushEventHandler( new DESIGN_BLOCK_GRID_TRICKS( m_parent, aGrid ) );
aGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
aGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
wxGridCellAttr* attr;
wxGridCellAttr* attr = new wxGridCellAttr;
attr = new wxGridCellAttr;
attr->SetEditor( new GRID_CELL_PATH_EDITOR(
m_parent, aGrid, &cfg->m_lastDesignBlockLibDir, true, m_projectBasePath,
[this]( WX_GRID* grid, int row ) -> wxString
if( cfg )
{
auto* libTable = static_cast<DESIGN_BLOCK_LIB_TABLE_GRID*>( grid->GetTable() );
auto* tableRow =
static_cast<DESIGN_BLOCK_LIB_TABLE_ROW*>( libTable->at( row ) );
DESIGN_BLOCK_IO_MGR::DESIGN_BLOCK_FILE_T fileType = tableRow->GetFileType();
const IO_BASE::IO_FILE_DESC& pluginDesc =
m_supportedDesignBlockFiles.at( fileType );
attr->SetEditor( new GRID_CELL_PATH_EDITOR(
m_parent, aGrid, &cfg->m_lastDesignBlockLibDir, true, m_projectBasePath,
[this]( WX_GRID* grid, int row ) -> wxString
{
auto* libTable = static_cast<DESIGN_BLOCK_LIB_TABLE_GRID*>( grid->GetTable() );
auto* tableRow = static_cast<DESIGN_BLOCK_LIB_TABLE_ROW*>( libTable->at( row ) );
DESIGN_BLOCK_IO_MGR::DESIGN_BLOCK_FILE_T fileType = tableRow->GetFileType();
const IO_BASE::IO_FILE_DESC& pluginDesc = m_supportedDesignBlockFiles.at( fileType );
if( pluginDesc.m_IsFile )
return pluginDesc.FileFilter();
else
return wxEmptyString;
} ) );
aGrid->SetColAttr( COL_URI, attr );
if( pluginDesc.m_IsFile )
return pluginDesc.FileFilter();
else
return wxEmptyString;
} ) );
}
attr = new wxGridCellAttr;
attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
aGrid->SetColAttr( COL_TYPE, attr );
aGrid->SetColAttr( COL_URI, attr );
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
aGrid->SetColAttr( COL_ENABLED, attr );
attr = new wxGridCellAttr;
attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
aGrid->SetColAttr( COL_TYPE, attr );
// No visibility control for design block libraries yet; this feature is primarily
// useful for database libraries and it's only implemented for schematic symbols
// at the moment.
aGrid->HideCol( COL_VISIBLE );
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
aGrid->SetColAttr( COL_ENABLED, attr );
// all but COL_OPTIONS, which is edited with Option Editor anyways.
autoSizeCol( aGrid, COL_NICKNAME );
autoSizeCol( aGrid, COL_TYPE );
autoSizeCol( aGrid, COL_URI );
autoSizeCol( aGrid, COL_DESCR );
// No visibility control for design block libraries yet; this feature is primarily
// useful for database libraries and it's only implemented for schematic symbols
// at the moment.
aGrid->HideCol( COL_VISIBLE );
// Gives a selection to each grid, mainly for delete button. wxGrid's wake up with
// a currentCell which is sometimes not highlighted.
if( aGrid->GetNumberRows() > 0 )
aGrid->SelectRow( 0 );
};
// all but COL_OPTIONS, which is edited with Option Editor anyways.
autoSizeCol( aGrid, COL_NICKNAME );
autoSizeCol( aGrid, COL_TYPE );
autoSizeCol( aGrid, COL_URI );
autoSizeCol( aGrid, COL_DESCR );
// Gives a selection to each grid, mainly for delete button. wxGrid's wake up with
// a currentCell which is sometimes not highlighted.
if( aGrid->GetNumberRows() > 0 )
aGrid->SelectRow( 0 );
};
setupGrid( m_global_grid );
@ -857,14 +858,12 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::onMigrateLibraries( wxCommandEvent& event )
{
if( rowsToMigrate.size() == 1 )
{
msg.Printf( _( "Save '%s' as current KiCad format "
"and replace entry in table?" ),
msg.Printf( _( "Save '%s' as current KiCad format and replace entry in table?" ),
m_cur_grid->GetCellValue( rowsToMigrate[0], COL_NICKNAME ) );
}
else
{
msg.Printf( _( "Save %d libraries as current KiCad format "
"and replace entries in table?" ),
msg.Printf( _( "Save %d libraries as current KiCad format and replace entries in table?" ),
(int) rowsToMigrate.size() );
}
@ -897,18 +896,16 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::onMigrateLibraries( wxCommandEvent& event )
"blocks?" ),
newLib.GetFullPath() );
switch( wxMessageBox( msg, _( "Migrate Library" ),
wxYES_NO | wxCANCEL | wxICON_QUESTION, m_parent ) )
switch( wxMessageBox( msg, _( "Migrate Library" ), wxYES_NO | wxCANCEL | wxICON_QUESTION, m_parent ) )
{
case wxYES: break;
case wxNO: continue;
case wxYES: break;
case wxNO: continue;
case wxCANCEL: return;
}
}
wxString options = m_cur_grid->GetCellValue( row, COL_OPTIONS );
std::unique_ptr<std::map<std::string, UTF8>> props(
LIB_TABLE::ParseOptions( options.ToStdString() ) );
wxString options = m_cur_grid->GetCellValue( row, COL_OPTIONS );
std::unique_ptr<std::map<std::string, UTF8>> props( LIB_TABLE::ParseOptions( options.ToStdString() ) );
if( DESIGN_BLOCK_IO_MGR::ConvertLibrary( props.get(), legacyLib.GetFullPath(),
newLib.GetFullPath() ) )
@ -926,8 +923,7 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::onMigrateLibraries( wxCommandEvent& event )
}
else
{
msg.Printf( _( "Failed to save design block library file '%s'." ),
newLib.GetFullPath() );
msg.Printf( _( "Failed to save design block library file '%s'." ), newLib.GetFullPath() );
DisplayErrorMessage( wxGetTopLevelParent( this ), msg );
}
}
@ -955,51 +951,42 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event
if( fileType == DESIGN_BLOCK_IO_MGR::FILE_TYPE_NONE )
{
wxLogWarning( wxT( "File type selection event received but could not find the file type "
"in the table" ) );
wxLogWarning( wxT( "File type selection event received but could not find the file type in the table" ) );
return;
}
const IO_BASE::IO_FILE_DESC& fileDesc = m_supportedDesignBlockFiles.at( fileType );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" );
wxString title =
wxString::Format( _( "Select %s Library" ), DESIGN_BLOCK_IO_MGR::ShowType( fileType ) );
wxString openDir = cfg->m_lastDesignBlockLibDir;
wxString title = wxString::Format( _( "Select %s Library" ), DESIGN_BLOCK_IO_MGR::ShowType( fileType ) );
wxString dummy;
wxString* lastDir;
if( m_cur_grid == m_project_grid )
openDir = m_lastProjectLibDir;
lastDir = &m_lastProjectLibDir;
else
lastDir = cfg ? &cfg->m_lastDesignBlockLibDir : &dummy;
wxArrayString files;
wxWindow* topLevelParent = wxGetTopLevelParent( this );
wxWindow* topLevelParent = wxGetTopLevelParent( this );
if( fileDesc.m_IsFile )
{
wxFileDialog dlg( topLevelParent, title, openDir, wxEmptyString, fileDesc.FileFilter(),
wxFileDialog dlg( topLevelParent, title, *lastDir, wxEmptyString, fileDesc.FileFilter(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
int result = dlg.ShowModal();
if( result == wxID_CANCEL )
if( dlg.ShowModal() == wxID_CANCEL )
return;
dlg.GetPaths( files );
if( m_cur_grid == m_global_grid )
cfg->m_lastDesignBlockLibDir = dlg.GetDirectory();
else
m_lastProjectLibDir = dlg.GetDirectory();
*lastDir = dlg.GetDirectory();
}
else
{
wxDirDialog dlg( topLevelParent, title, openDir,
wxDirDialog dlg( topLevelParent, title, *lastDir,
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST | wxDD_MULTIPLE );
int result = dlg.ShowModal();
if( result == wxID_CANCEL )
if( dlg.ShowModal() == wxID_CANCEL )
return;
dlg.GetPaths( files );
@ -1007,18 +994,13 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event
if( !files.IsEmpty() )
{
wxFileName first( files.front() );
if( m_cur_grid == m_global_grid )
cfg->m_lastDesignBlockLibDir = first.GetPath();
else
m_lastProjectLibDir = first.GetPath();
*lastDir = first.GetPath();
}
}
// Drop the last directory if the path is a .pretty folder
if( cfg->m_lastDesignBlockLibDir.EndsWith( FILEEXT::KiCadDesignBlockLibPathExtension ) )
cfg->m_lastDesignBlockLibDir =
cfg->m_lastDesignBlockLibDir.BeforeLast( wxFileName::GetPathSeparator() );
if( cfg && cfg->m_lastDesignBlockLibDir.EndsWith( FILEEXT::KiCadDesignBlockLibPathExtension ) )
cfg->m_lastDesignBlockLibDir = cfg->m_lastDesignBlockLibDir.BeforeLast( wxFileName::GetPathSeparator() );
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
bool addDuplicates = false;
@ -1034,8 +1016,7 @@ void PANEL_DESIGN_BLOCK_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event
wxString nickname = LIB_ID::FixIllegalChars( fn.GetName(), true );
bool doAdd = true;
if( fileType == DESIGN_BLOCK_IO_MGR::KICAD_SEXP
&& fn.GetExt() != FILEEXT::KiCadDesignBlockLibPathExtension )
if( fileType == DESIGN_BLOCK_IO_MGR::KICAD_SEXP && fn.GetExt() != FILEEXT::KiCadDesignBlockLibPathExtension )
nickname = LIB_ID::FixIllegalChars( fn.GetFullName(), true ).wx_str();
if( cur_model()->ContainsNickname( nickname ) )

View File

@ -47,16 +47,14 @@ PANEL_PACKAGES_AND_UPDATES::PANEL_PACKAGES_AND_UPDATES( wxWindow* parent ) :
bool PANEL_PACKAGES_AND_UPDATES::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
wxCHECK( cfg, false );
m_cbKicadUpdate->SetValue( cfg->m_KiCadUpdateCheck );
m_cbPcmUpdate->SetValue( cfg->m_PcmUpdateCheck );
m_libAutoAdd->SetValue( cfg->m_PcmLibAutoAdd );
m_libAutoRemove->SetValue( cfg->m_PcmLibAutoRemove );
m_libPrefix->SetValue( cfg->m_PcmLibPrefix );
if( KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" ) )
{
m_cbKicadUpdate->SetValue( cfg->m_KiCadUpdateCheck );
m_cbPcmUpdate->SetValue( cfg->m_PcmUpdateCheck );
m_libAutoAdd->SetValue( cfg->m_PcmLibAutoAdd );
m_libAutoRemove->SetValue( cfg->m_PcmLibAutoRemove );
m_libPrefix->SetValue( cfg->m_PcmLibPrefix );
}
return true;
}
@ -64,16 +62,14 @@ bool PANEL_PACKAGES_AND_UPDATES::TransferDataToWindow()
bool PANEL_PACKAGES_AND_UPDATES::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* cfg = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
wxCHECK( cfg, false );
cfg->m_KiCadUpdateCheck = m_cbKicadUpdate->GetValue();
cfg->m_PcmUpdateCheck = m_cbPcmUpdate->GetValue();
cfg->m_PcmLibAutoAdd = m_libAutoAdd->GetValue();
cfg->m_PcmLibAutoRemove = m_libAutoRemove->GetValue();
cfg->m_PcmLibPrefix = m_libPrefix->GetValue();
if( KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" ) )
{
cfg->m_KiCadUpdateCheck = m_cbKicadUpdate->GetValue();
cfg->m_PcmUpdateCheck = m_cbPcmUpdate->GetValue();
cfg->m_PcmLibAutoAdd = m_libAutoAdd->GetValue();
cfg->m_PcmLibAutoRemove = m_libAutoRemove->GetValue();
cfg->m_PcmLibPrefix = m_libPrefix->GetValue();
}
return true;
}

View File

@ -1245,8 +1245,7 @@ COLOR_SETTINGS* EDA_DRAW_FRAME::GetColorSettings( bool aForceRefresh ) const
{
if( !m_colorSettings || aForceRefresh )
{
COLOR_SETTINGS* colorSettings = Pgm().GetSettingsManager().GetColorSettings();
COLOR_SETTINGS* colorSettings = ::GetColorSettings( DEFAULT_THEME );
const_cast<EDA_DRAW_FRAME*>( this )->m_colorSettings = colorSettings;
}

View File

@ -48,7 +48,7 @@ void OUTLINE_DECOMPOSER::newContour()
{
CONTOUR contour;
contour.m_Orientation = FT_Outline_Get_Orientation( &m_outline );
m_contours->push_back( contour );
m_contours->push_back( std::move( contour ) );
}

View File

@ -601,8 +601,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
SystemDirsAppend( &ss );
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( envVars,
wxT( "TEMPLATE_DIR" ) );
std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( envVars, wxT( "TEMPLATE_DIR" ) );
if( v && !v->IsEmpty() )
ss.AddPaths( *v, 0 );
@ -612,7 +611,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
// The fallback is to create an empty global footprint table for the user to populate.
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
{
FP_LIB_TABLE emptyTable;
FP_LIB_TABLE emptyTable;
emptyTable.Save( fn.GetFullPath() );
}
@ -620,16 +619,14 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
aTable.Load( fn.GetFullPath() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" );
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
wxString packagesPath;
wxString packagesPath;
if( std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( env, wxT( "3RD_PARTY" ) ) )
packagesPath = *v;
if( settings->m_PcmLibAutoAdd )
if( cfg && cfg->m_PcmLibAutoAdd )
{
// Scan for libraries in PCM packages directory
@ -638,14 +635,14 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
if( d.DirExists() )
{
PCM_FP_LIB_TRAVERSER traverser( packagesPath, aTable, settings->m_PcmLibPrefix );
PCM_FP_LIB_TRAVERSER traverser( packagesPath, aTable, cfg->m_PcmLibPrefix );
wxDir dir( d.GetPath() );
dir.Traverse( traverser );
}
}
if( settings->m_PcmLibAutoRemove )
if( cfg && cfg->m_PcmLibAutoRemove )
{
// Remove PCM libraries that no longer exist
std::vector<wxString> to_remove;

View File

@ -1686,17 +1686,17 @@ bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
bool CAIRO_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
{
// Store the current cursor type and get the wxCursor for it
// Store the current cursor type and get the wx cursor for it
if( !GAL::SetNativeCursorStyle( aCursor, aHiDPI ) )
return false;
if( aHiDPI )
m_currentwxCursor = CURSOR_STORE::GetHiDPICursor( m_currentNativeCursor );
else
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor, aHiDPI );
// Update the cursor in the wx control
#if wxCHECK_VERSION( 3, 3, 0 )
wxWindow::SetCursorBundle( m_currentwxCursor );
#else
wxWindow::SetCursor( m_currentwxCursor );
#endif
return true;
}
@ -1704,7 +1704,11 @@ bool CAIRO_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
void CAIRO_GAL::onSetNativeCursor( wxSetCursorEvent& aEvent )
{
#if wxCHECK_VERSION( 3, 3, 0 )
aEvent.SetCursor( m_currentwxCursor.GetCursorFor( this ) );
#else
aEvent.SetCursor( m_currentwxCursor );
#endif
}

View File

@ -22,6 +22,7 @@
*/
#include <vector>
#include <map>
#include <gal/cursors.h>
#include <kiplatform/ui.h>
@ -88,513 +89,294 @@
#include <wx/bitmap.h>
#include <wx/debug.h>
#include <wx/bmpbndl.h>
static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
static const std::map<KICURSOR, std::vector<CURSOR_STORE::CURSOR_DEF>> cursors_defs = {
{
KICURSOR::VOLTAGE_PROBE,
nullptr,
nullptr,
voltage_probe_xpm,
{ 32, 32 },
{ 1, 31 },
{
{ voltage_probe_xpm, { 1, 31 } },
{ voltage_probe64_xpm, { 1, 62 } }
}
},
{
KICURSOR::CURRENT_PROBE,
nullptr,
nullptr,
current_probe_xpm,
{ 32, 32 },
{ 4, 27 },
{
{ current_probe_xpm, { 4, 27 } },
{ current_probe64_xpm, { 8, 54 } }
}
},
{
KICURSOR::TUNE,
nullptr,
nullptr,
cursor_tune_xpm,
{ 32, 32 },
{ 1, 30 },
{
{ cursor_tune_xpm, { 1, 30 } },
{ cursor_tune64_xpm, { 2, 60 } }
}
},
{
KICURSOR::PENCIL,
nullptr,
nullptr,
cursor_pencil_xpm,
{ 32, 32 },
{ 4, 27 },
{
{ cursor_pencil_xpm, { 4, 27 } },
{ cursor_pencil64_xpm, { 8, 54 } }
}
},
{
KICURSOR::MOVING,
nullptr,
nullptr,
{
{
#ifdef __WINDOWS__
cursor_select_m_xpm,
cursor_select_m_xpm,
#else
cursor_select_m_black_xpm,
cursor_select_m_black_xpm,
#endif
{ 32, 32 },
{ 1, 1 },
{ 1, 1 }
},
{
#ifdef __WINDOWS__
cursor_select_m64_xpm,
#else
cursor_select_m_black64_xpm,
#endif
{ 2, 2 }
}
}
},
{
KICURSOR::REMOVE,
nullptr,
nullptr,
cursor_eraser_xpm,
{ 32, 32 },
{ 4, 4 },
{
{ cursor_eraser_xpm, { 4, 4 } },
{ cursor_eraser64_xpm, { 8, 8 } }
}
},
{
KICURSOR::TEXT,
nullptr,
nullptr,
cursor_text_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_text_xpm, { 7, 7 } },
{ cursor_text64_xpm, { 14, 14 } }
}
},
{
KICURSOR::MEASURE,
nullptr,
nullptr,
cursor_measure_xpm,
{ 32, 32 },
{ 4, 4 },
{
{ cursor_measure_xpm, { 4, 4 } },
{ cursor_measure64_xpm, { 8, 8 } }
}
},
{
KICURSOR::ADD,
nullptr,
nullptr,
cursor_add_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_add_xpm, { 7, 7 } },
{ cursor_add64_xpm, { 14, 14 } }
}
},
{
KICURSOR::SUBTRACT,
nullptr,
nullptr,
cursor_subtract_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_subtract_xpm, { 7, 7 } },
{ cursor_subtract64_xpm, { 14, 14 } }
}
},
{
KICURSOR::XOR,
nullptr,
nullptr,
cursor_xor_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_xor_xpm, { 7, 7 } },
{ cursor_xor64_xpm, { 14, 14 } }
}
},
{
KICURSOR::ZOOM_IN,
nullptr,
nullptr,
cursor_zoom_in_xpm,
{ 32, 32 },
{ 6, 6 },
{
{ cursor_zoom_in_xpm, { 6, 6 } },
{ cursor_zoom_in64_xpm, { 12, 12 } }
}
},
{
KICURSOR::ZOOM_OUT,
nullptr,
nullptr,
cursor_zoom_out_xpm,
{ 32, 32 },
{ 6, 6 },
{
{ cursor_zoom_out_xpm, { 6, 6 } },
{ cursor_zoom_out64_xpm, { 12, 12 } }
}
},
{
KICURSOR::LABEL_NET,
nullptr,
nullptr,
cursor_label_net_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_label_net_xpm, { 7, 7 } },
{ cursor_label_net64_xpm, { 14, 14 } }
}
},
{
KICURSOR::LABEL_GLOBAL,
nullptr,
nullptr,
cursor_label_global_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_label_global_xpm, { 7, 7 } },
{ cursor_label_global64_xpm, { 14, 14 } }
}
},
{
KICURSOR::COMPONENT,
nullptr,
nullptr,
cursor_component_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_component_xpm, { 7, 7 } },
{ cursor_component64_xpm, { 14, 14 } }
}
},
{
KICURSOR::SELECT_LASSO,
nullptr,
nullptr,
cursor_select_lasso_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_select_lasso_xpm, { 7, 7 } },
{ cursor_select_lasso64_xpm, { 14, 14 } }
}
},
{
KICURSOR::SELECT_WINDOW,
nullptr,
nullptr,
cursor_select_window_xpm,
{ 32, 32 },
{ 7, 10 },
{
{ cursor_select_window_xpm, { 7, 10 } },
{ cursor_select_window64_xpm, { 14, 20 } }
}
},
{
KICURSOR::LINE_BUS,
nullptr,
nullptr,
cursor_line_bus_xpm,
{ 32, 32 },
{ 5, 26 },
{
{ cursor_line_bus_xpm, { 5, 26 } },
{ cursor_line_bus64_xpm, { 10, 52 } }
}
},
{
KICURSOR::LINE_WIRE,
nullptr,
nullptr,
cursor_line_wire_xpm,
{ 32, 32 },
{ 5, 26 },
{
{ cursor_line_wire_xpm, { 5, 26 } },
{ cursor_line_wire64_xpm, { 10, 52 } }
}
},
{
KICURSOR::LINE_GRAPHIC,
nullptr,
nullptr,
cursor_line_graphic_xpm,
{ 32, 32 },
{ 5, 26 },
{
{ cursor_line_graphic_xpm, { 5, 26 } },
{ cursor_line_graphic64_xpm, { 10, 52 } }
}
},
{
KICURSOR::LABEL_HIER,
nullptr,
nullptr,
cursor_label_hier_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_label_hier_xpm, { 7, 7 } },
{ cursor_label_hier64_xpm, { 14, 14 } }
}
},
{
KICURSOR::PLACE,
nullptr,
nullptr,
{
{
#ifdef __WINDOWS__
cursor_place_xpm,
cursor_place_xpm,
#else
cursor_place_black_xpm,
cursor_place_black_xpm,
#endif
{ 32, 32 },
{ 1, 1 },
},
};
static const std::vector<CURSOR_STORE::CURSOR_DEF> hidpi_cursors = {
{
KICURSOR::VOLTAGE_PROBE,
nullptr,
nullptr,
voltage_probe64_xpm,
{ 64, 64 },
{ 1, 62 },
},
{
KICURSOR::CURRENT_PROBE,
nullptr,
nullptr,
current_probe64_xpm,
{ 64, 64 },
{ 8, 54 },
},
{
KICURSOR::TUNE,
nullptr,
nullptr,
cursor_tune64_xpm,
{ 64, 64 },
{ 2, 60 },
},
{
KICURSOR::PENCIL,
nullptr,
nullptr,
cursor_pencil64_xpm,
{ 64, 64 },
{ 8, 54 },
},
{
KICURSOR::MOVING,
nullptr,
nullptr,
{ 1, 1 }
},
{
#ifdef __WINDOWS__
cursor_select_m64_xpm,
cursor_place64_xpm,
#else
cursor_select_m_black64_xpm,
cursor_place_black64_xpm,
#endif
{ 64, 64 },
{ 2, 2 },
},
{
KICURSOR::REMOVE,
nullptr,
nullptr,
cursor_eraser64_xpm,
{ 64, 64 },
{ 8, 8 },
},
{
KICURSOR::TEXT,
nullptr,
nullptr,
cursor_text64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::MEASURE,
nullptr,
nullptr,
cursor_measure64_xpm,
{ 64, 64 },
{ 8, 8 },
},
{
KICURSOR::ADD,
nullptr,
nullptr,
cursor_add64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::SUBTRACT,
nullptr,
nullptr,
cursor_subtract64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::XOR,
nullptr,
nullptr,
cursor_xor64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::ZOOM_IN,
nullptr,
nullptr,
cursor_zoom_in64_xpm,
{ 64, 64 },
{ 12, 12 },
},
{
KICURSOR::ZOOM_OUT,
nullptr,
nullptr,
cursor_zoom_out64_xpm,
{ 64, 64 },
{ 12, 12 },
},
{
KICURSOR::LABEL_NET,
nullptr,
nullptr,
cursor_label_net64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::LABEL_GLOBAL,
nullptr,
nullptr,
cursor_label_global64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::COMPONENT,
nullptr,
nullptr,
cursor_component64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::SELECT_LASSO,
nullptr,
nullptr,
cursor_select_lasso64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::SELECT_WINDOW,
nullptr,
nullptr,
cursor_select_window64_xpm,
{ 64, 64 },
{ 14, 20 },
},
{
KICURSOR::LINE_BUS,
nullptr,
nullptr,
cursor_line_bus64_xpm,
{ 64, 64 },
{ 10, 52 },
},
{
KICURSOR::LINE_WIRE,
nullptr,
nullptr,
cursor_line_wire64_xpm,
{ 64, 64 },
{ 10, 52 },
},
{
KICURSOR::LINE_GRAPHIC,
nullptr,
nullptr,
cursor_line_graphic64_xpm,
{ 64, 64 },
{ 10, 52 },
},
{
KICURSOR::LABEL_HIER,
nullptr,
nullptr,
cursor_label_hier64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::PLACE,
nullptr,
nullptr,
#ifdef __WINDOWS__
cursor_place64_xpm,
#else
cursor_place_black64_xpm,
#endif
{ 64, 64 },
{ 2, 2 },
},
};
/**
* Construct a cursor for the given definition.
*
* How to do this depends on the platform, see
* http://docs.wxwidgets.org/trunk/classwx_cursor.html
*
* @param aDef the cursor definition
* @return a newly constructed cursor if the platform is supported,
* else wxNullCursor
*/
wxCursor constructCursor( const CURSOR_STORE::CURSOR_DEF& aDef )
{
if( aDef.m_xpm != nullptr )
{
wxImage xpmImage = wxImage( aDef.m_xpm );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
return wxCursor( xpmImage );
{ 2, 2 }
}
}
}
else if( aDef.m_image_data != nullptr && aDef.m_mask_data != nullptr )
};
CURSOR_STORE::CURSOR_STORE()
{
for( const auto& [cursorId, defs] : cursors_defs )
{
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
wxCHECK2( !defs.empty(), continue );
wxBitmap img_bitmap(
reinterpret_cast<const char*>( aDef.m_image_data ), aDef.m_size.x, aDef.m_size.y );
wxBitmap msk_bitmap(
reinterpret_cast<const char*>( aDef.m_mask_data ), aDef.m_size.x, aDef.m_size.y );
img_bitmap.SetMask( new wxMask( msk_bitmap ) );
#if wxCHECK_VERSION( 3, 3, 0 )
// For wx 3.3+, create cursor bundles from the cursor definitions
std::vector<wxBitmap> bitmaps;
for( const auto& [xpm, hotspot_def] : defs )
{
wxCHECK2( xpm, continue );
bitmaps.push_back( wxBitmap( xpm ) );
}
wxImage image( img_bitmap.ConvertToImage() );
wxBitmapBundle bitmapBundle = wxBitmapBundle::FromBitmaps( bitmaps );
#if defined( __WXMSW__ )
image.SetMaskColour( 255, 255, 255 );
#endif
wxPoint hotspot = defs[0].m_hotspot; // Use hotspot from standard cursor
m_bundleMap[cursorId] = wxCursorBundle( bitmapBundle, hotspot );
#else
auto constructCursor = []( const CURSOR_STORE::CURSOR_DEF& aDef ) -> wxCursor
{
wxCHECK( aDef.m_xpm, wxNullCursor );
wxImage xpmImage = wxImage( aDef.m_xpm );
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
return wxCursor{ image };
#elif defined( __WXGTK__ ) || defined( __WXMOTIF__ )
return wxCursor{
reinterpret_cast<const char*>( aDef.m_image_data ),
aDef.m_size.x,
aDef.m_size.y,
aDef.m_hotspot.x,
aDef.m_hotspot.y,
reinterpret_cast<const char*>( aDef.m_mask_data ),
return wxCursor( xpmImage );
};
#else
wxASSERT_MSG( false, wxS( "Unknown platform for cursor construction." ) );
return wxNullCursor;
// Add standard cursor (first definition)
m_standardCursorMap[cursorId] = constructCursor( defs[0] );
// Add HiDPI cursor (second definition if available, otherwise fallback to standard)
if( defs.size() > 1 )
m_hidpiCursorMap[cursorId] = constructCursor( defs[1] );
else
m_hidpiCursorMap[cursorId] = m_standardCursorMap[cursorId];
#endif
}
wxASSERT_MSG( false, wxS( "Unknown to find cursor" ) );
return wxNullCursor;
}
CURSOR_STORE::CURSOR_STORE( const std::vector<CURSOR_DEF>& aDefs )
#if wxCHECK_VERSION( 3, 3, 0 )
const wxCursorBundle& CURSOR_STORE::storeGetBundle( KICURSOR aIdKey ) const
{
for( const auto& def : aDefs )
{
m_store[def.m_id_key] = constructCursor( def );
}
}
const auto find_iter = m_bundleMap.find( aIdKey );
const wxCursor& CURSOR_STORE::Get( KICURSOR aIdKey ) const
{
const auto find_iter = m_store.find( aIdKey );
if( find_iter != m_store.end() )
if( find_iter != m_bundleMap.end() )
return find_iter->second;
wxASSERT_MSG( false, wxString::Format( "Could not find cursor with ID %d",
wxASSERT_MSG( false, wxString::Format( "Could not find cursor bundle with ID %d",
static_cast<int>( aIdKey ) ) );
return wxCursorBundle();
}
#else
const wxCursor& CURSOR_STORE::storeGetCursor( KICURSOR aIdKey, bool aHiDPI ) const
{
const auto& store = aHiDPI ? m_hidpiCursorMap : m_standardCursorMap;
const auto find_iter = store.find( aIdKey );
if( find_iter != store.end() )
return find_iter->second;
wxASSERT_MSG( false, wxString::Format( "Could not find cursor with ID %d", static_cast<int>( aIdKey ) ) );
return wxNullCursor;
}
#endif
const wxCursor CURSOR_STORE::GetCursor( KICURSOR aCursorType )
/* static */
const WX_CURSOR_TYPE CURSOR_STORE::GetCursor( KICURSOR aCursorType, bool aHiDPI )
{
// Use a single cursor store instance
static CURSOR_STORE store;
wxStockCursor stock = GetStockCursor( aCursorType );
if( stock != wxCURSOR_MAX )
{
return wxCursor( stock );
}
return WX_CURSOR_TYPE( stock );
static CURSOR_STORE store( standard_cursors );
return store.Get( aCursorType );
#if wxCHECK_VERSION( 3, 3, 0 )
// For wx 3.3+, return the pre-built cursor bundle (aHiDPI is ignored as bundles contain both)
return store.storeGetBundle( aCursorType );
#else
return store.storeGetCursor( aCursorType, aHiDPI );
#endif
}
const wxCursor CURSOR_STORE::GetHiDPICursor( KICURSOR aCursorType )
{
wxStockCursor stock = GetStockCursor( aCursorType );
if( stock != wxCURSOR_MAX )
{
return wxCursor( stock );
}
static CURSOR_STORE store( hidpi_cursors );
return store.Get( aCursorType );
}
/* static */
wxStockCursor CURSOR_STORE::GetStockCursor( KICURSOR aCursorType )
{
wxStockCursor stockCursor;
@ -618,9 +400,7 @@ wxStockCursor CURSOR_STORE::GetStockCursor( KICURSOR aCursorType )
}
if( !KIPLATFORM::UI::IsStockCursorOk( stockCursor ) )
{
stockCursor = wxCURSOR_MAX;
}
return stockCursor;
}

View File

@ -171,17 +171,15 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2I aDimensions )
if( (int) usedBuffers() >= maxBuffers )
{
throw std::runtime_error( "Cannot create more framebuffers. OpenGL rendering backend "
"requires at least 3 framebuffers. You may try to update/change "
"your graphic drivers." );
throw std::runtime_error( "Cannot create more framebuffers. OpenGL rendering backend requires at "
"least 3 framebuffers. You may try to update/change your graphic drivers." );
}
glGetIntegerv( GL_MAX_TEXTURE_SIZE, (GLint*) &maxTextureSize );
if( maxTextureSize < (int) aDimensions.x || maxTextureSize < (int) aDimensions.y )
{
throw std::runtime_error( "Requested texture size is not supported. "
"Could not create a buffer." );
throw std::runtime_error( "Requested texture size is not supported. Could not create a buffer." );
}
// GL_COLOR_ATTACHMENTn are consecutive integers
@ -197,16 +195,14 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2I aDimensions )
// Set texture parameters
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, aDimensions.x, aDimensions.y, 0, GL_RGBA,
GL_UNSIGNED_BYTE, nullptr );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, aDimensions.x, aDimensions.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr );
checkGlError( "creating framebuffer texture", __FILE__, __LINE__ );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
// Bind the texture to the specific attachment point, clear and rebind the screen
bindFb( m_mainFbo );
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachmentPoint, GL_TEXTURE_2D, textureTarget,
0 );
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachmentPoint, GL_TEXTURE_2D, textureTarget, 0 );
// Check the status, exit if the framebuffer can't be created
GLenum status = glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT );
@ -222,20 +218,17 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2I aDimensions )
throw std::runtime_error( "No images attached to the framebuffer." );
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
throw std::runtime_error( "The framebuffer does not have at least one "
"image attached to it." );
throw std::runtime_error( "The framebuffer does not have at least one image attached to it." );
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
throw std::runtime_error( "The framebuffer read buffer is incomplete." );
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
throw std::runtime_error( "The combination of internal formats of the attached "
"images violates an implementation-dependent set of "
"restrictions." );
throw std::runtime_error( "The combination of internal formats of the attached images violates "
"an implementation-dependent set of restrictions." );
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
throw std::runtime_error( "GL_RENDERBUFFER_SAMPLES is not the same for "
"all attached renderbuffers" );
throw std::runtime_error( "GL_RENDERBUFFER_SAMPLES is not the same for all attached renderbuffers" );
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
throw std::runtime_error( "Framebuffer incomplete layer targets errors." );
@ -263,15 +256,14 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2I aDimensions )
GLenum OPENGL_COMPOSITOR::GetBufferTexture( unsigned int aBufferHandle )
{
wxASSERT( aBufferHandle > 0 && aBufferHandle <= usedBuffers() );
wxCHECK( aBufferHandle > 0 && aBufferHandle <= usedBuffers(), 0 );
return m_buffers[aBufferHandle - 1].textureTarget;
}
void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
{
wxASSERT( m_initialized );
wxASSERT( aBufferHandle <= usedBuffers() );
wxCHECK( m_initialized && aBufferHandle <= usedBuffers(), /* void */ );
// Either unbind the FBO for direct rendering, or bind the one with target textures
bindFb( aBufferHandle == DIRECT_RENDERING ? DIRECT_RENDERING : m_mainFbo );
@ -283,8 +275,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
glDrawBuffer( m_buffers[m_curBuffer].attachmentPoint );
checkGlError( "setting draw buffer", __FILE__, __LINE__ );
glViewport( 0, 0, m_buffers[m_curBuffer].dimensions.x,
m_buffers[m_curBuffer].dimensions.y );
glViewport( 0, 0, m_buffers[m_curBuffer].dimensions.x, m_buffers[m_curBuffer].dimensions.y );
}
else
{
@ -295,7 +286,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
void OPENGL_COMPOSITOR::ClearBuffer( const COLOR4D& aColor )
{
wxASSERT( m_initialized );
wxCHECK( m_initialized, /* void */ );
glClearColor( aColor.r, aColor.g, aColor.b, m_curFbo == DIRECT_RENDERING ? 1.0f : 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
@ -326,9 +317,8 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aSourceHandle, unsigned int aDestHandle )
{
wxASSERT( m_initialized );
wxASSERT( aSourceHandle != 0 && aSourceHandle <= usedBuffers() );
wxASSERT( aDestHandle <= usedBuffers() );
wxCHECK( m_initialized && aSourceHandle != 0 && aSourceHandle <= usedBuffers(), /* void */ );
wxCHECK( aDestHandle <= usedBuffers(), /* void */ );
// Switch to the destination buffer and blit the scene
SetBuffer( aDestHandle );
@ -393,7 +383,7 @@ void OPENGL_COMPOSITOR::bindFb( unsigned int aFb )
void OPENGL_COMPOSITOR::clean()
{
wxASSERT( m_initialized );
wxCHECK( m_initialized, /* void */ );
bindFb( DIRECT_RENDERING );

View File

@ -2150,17 +2150,17 @@ void OPENGL_GAL::EndDiffLayer()
bool OPENGL_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
{
// Store the current cursor type and get the wxCursor for it
// Store the current cursor type and get the wx cursor for it
if( !GAL::SetNativeCursorStyle( aCursor, aHiDPI ) )
return false;
if( aHiDPI )
m_currentwxCursor = CURSOR_STORE::GetHiDPICursor( m_currentNativeCursor );
else
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor, aHiDPI );
// Update the cursor in the wx control
HIDPI_GL_CANVAS::SetCursor( m_currentwxCursor );
#if wxCHECK_VERSION( 3, 3, 0 )
wxWindow::SetCursorBundle( m_currentwxCursor );
#else
wxWindow::SetCursor( m_currentwxCursor );
#endif
return true;
}
@ -2168,7 +2168,11 @@ bool OPENGL_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
void OPENGL_GAL::onSetNativeCursor( wxSetCursorEvent& aEvent )
{
#if wxCHECK_VERSION( 3, 3, 0 )
aEvent.SetCursor( m_currentwxCursor.GetCursorFor( this ) );
#else
aEvent.SetCursor( m_currentwxCursor );
#endif
}

View File

@ -45,6 +45,7 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
m_drawingSheet(),
m_plotAll( true ),
m_plotDrawingSheet( true ),
m_show_hop_over( false ),
m_blackAndWhite( false ),
m_pageSizeSelect( JOB_PAGE_SIZE::PAGE_SIZE_AUTO ),
m_useBackgroundColor( true ),
@ -69,6 +70,9 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
m_params.emplace_back( new JOB_PARAM<bool>( "black_and_white",
&m_blackAndWhite, m_blackAndWhite ) );
m_params.emplace_back( new JOB_PARAM<bool>( "show_hop_over",
&m_blackAndWhite, m_show_hop_over ) );
m_params.emplace_back( new JOB_PARAM<JOB_PAGE_SIZE>( "page_size",
&m_pageSizeSelect, m_pageSizeSelect ) );

View File

@ -58,6 +58,7 @@ public:
bool m_plotDrawingSheet;
std::vector<wxString> m_plotPages;
bool m_show_hop_over;
bool m_blackAndWhite;
JOB_PAGE_SIZE m_pageSizeSelect;
bool m_useBackgroundColor;

View File

@ -23,7 +23,7 @@
#include <kicommon.h>
#include <jobs/job.h>
#define OUTPUT_TMP_PATH_VAR_NAME wxT( "JOBSET_OUTPUT_TMP_PATH" )
#define OUTPUT_TMP_PATH_VAR_NAME wxT( "JOBSET_OUTPUT_WORK_PATH" )
class KICOMMON_API JOB_SPECIAL_EXECUTE : public JOB
{

View File

@ -1262,6 +1262,7 @@ void UOP::Exec( CONTEXT* ctx )
LIBEVAL::VALUE* arg1 = ctx->Pop();
double ARG1VALUE = arg1 ? arg1->AsDouble() : 0.0;
double result;
EDA_UNITS resultUnits = arg1 ? arg1->GetUnits() : EDA_UNITS::UNSCALED;
switch( m_op )
{
@ -1275,7 +1276,7 @@ void UOP::Exec( CONTEXT* ctx )
auto rp = ctx->AllocValue();
rp->Set( result );
rp->SetUnits( arg1->GetUnits() );
rp->SetUnits( resultUnits );
ctx->Push( rp );
return;
}

View File

@ -237,7 +237,7 @@ COLOR_SETTINGS* SETTINGS_MANAGER::GetColorSettings( const wxString& aName )
{
ret = registerColorSettings( aName );
*ret = *m_color_settings.at( COLOR_SETTINGS::COLOR_BUILTIN_DEFAULT );
ret->SetFilename( wxT( "user" ) );
ret->SetFilename( DEFAULT_THEME );
ret->SetReadOnly( false );
}

View File

@ -799,9 +799,7 @@ void ACTION_TOOLBAR::popupPalette( wxAuiToolBarItem* aItem )
wxWindow* toolParent = dynamic_cast<wxWindow*>( m_toolManager->GetToolHolder() );
wxASSERT( GetParent() );
wxASSERT( m_auiManager );
wxASSERT( toolParent );
wxCHECK( GetParent() && m_auiManager && toolParent, /* void */ );
// Ensure the item we are using for the palette has a group associated with it.
const auto it = m_actionGroups.find( aItem->GetId() );

View File

@ -1011,6 +1011,16 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
}
void TOOL_MANAGER::WarpAfterContextMenu()
{
if( m_viewControls && m_warpMouseAfterContextMenu )
m_viewControls->WarpMouseCursor( m_menuCursor, true, false );
// Don't warp again when the menu is closed
m_warpMouseAfterContextMenu = false;
}
TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState )
{
auto it = std::find( m_activeTools.begin(), m_activeTools.end(), aState->theTool->GetId() );

View File

@ -37,7 +37,8 @@ public:
TRANSLINE_CALCULATION_BASE( { TCP::SKIN_DEPTH, TCP::EPSILON_EFF, TCP::EPSILONR, TCP::T, TCP::STRIPLINE_A,
TCP::H, TCP::Z0, TCP::LOSS_CONDUCTOR, TCP::PHYS_LEN, TCP::LOSS_DIELECTRIC,
TCP::FREQUENCY, TCP::TAND, TCP::PHYS_WIDTH, TCP::UNIT_PROP_DELAY, TCP::ANG_L,
TCP::SIGMA, TCP::MURC } )
TCP::SIGMA, TCP::MURC } ),
unit_prop_delay( 0.0 )
{
}

View File

@ -28,7 +28,7 @@
APP_PROGRESS_DIALOG::APP_PROGRESS_DIALOG( const wxString& aTitle, const wxString& aMessage,
int aMaximum, wxWindow* aParent,
bool aIndeterminateTaskBarStatus, int aStyle )
: wxProgressDialog( aTitle,
: APP_PROGRESS_DIALOG_BASE( aTitle,
aMessage == wxEmptyString ? wxString( wxT( " " ) ) : aMessage,
aMaximum, aParent, aStyle ),
m_appProgressIndicator( aParent, aMaximum ),
@ -49,5 +49,5 @@ bool APP_PROGRESS_DIALOG::Update( int aValue, const wxString& aNewMsg, bool* aSk
m_appProgressIndicator.SetValue( aValue );
}
return wxProgressDialog::Update( aValue, aNewMsg, aSkip );
return APP_PROGRESS_DIALOG_BASE::Update( aValue, aNewMsg, aSkip );
}

View File

@ -126,8 +126,13 @@ void GRID_CELL_STC_EDITOR::SetSize( const wxRect& aRect )
WX_GRID::CellEditorTransformSizeRect( rect );
#if defined( __WXMSW__ )
#if !wxCHECK_VERSION( 3, 3, 0 )
rect.Offset( -1, 0 );
// hack no longer needed with wx 3.3
rect.SetHeight( rect.GetHeight() + 6 );
#else
rect.Offset( 0, 1 );
#endif
#elif defined( __WXGTK__ )
rect.Offset( -1, 3 );
#else

View File

@ -195,7 +195,7 @@ WX_AUI_DOCK_ART::WX_AUI_DOCK_ART() : wxAuiDefaultDockArt()
m_captionFont = *wxNORMAL_FONT;
// Increase the box the caption rests in size a bit
m_captionSize = ( wxNORMAL_FONT->GetPixelSize().y * 7 ) / 4;
m_captionSize = ( wxNORMAL_FONT->GetPointSize() * 7 ) / 4 + 6;
#endif
SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,

View File

@ -234,7 +234,23 @@ void WX_INFOBAR::onSize( wxSizeEvent& aEvent )
if( !sizer )
return;
// wx3.3 moved the sizer we previously wanted deeper into sizers...
// do we actually still need this for wx3.3?
#if wxCHECK_VERSION( 3, 3, 0 )
wxSizerItem* outerSizer = sizer->GetItem( (size_t) 0 );
wxSizerItem* text = nullptr;
if (outerSizer->IsSizer())
{
wxBoxSizer* innerSizer1 = dynamic_cast<wxBoxSizer*>( outerSizer->GetSizer() );
wxBoxSizer* innerSizer2 =
dynamic_cast<wxBoxSizer*>( innerSizer1->GetItem((size_t)0)->GetSizer() );
if( innerSizer2 )
text = innerSizer2->GetItem( 1 );
}
#else
wxSizerItem* text = sizer->GetItem( 1 );
#endif
if( text )
{

View File

@ -33,7 +33,7 @@ WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& a
int aNumPhases, int aCanAbort,
bool aReserveSpaceForMessage ) :
PROGRESS_REPORTER_BASE( aNumPhases ),
wxProgressDialog( aTitle,
WX_PROGRESS_REPORTER_BASE( aTitle,
( aReserveSpaceForMessage ? wxT( " " ) : wxT( "" ) ),
1, aParent,
// wxPD_APP_MODAL | // Don't use; messes up OSX when called from
@ -93,7 +93,7 @@ bool WX_PROGRESS_REPORTER::updateUI()
}
// Returns false when cancelled (if it's a cancellable dialog)
bool diag = wxProgressDialog::Update( cur, message );
bool diag = WX_PROGRESS_REPORTER_BASE::Update( cur, message );
return diag;
}

View File

@ -192,7 +192,8 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
error_msg.Empty();
bool firstAssoc = true;
for( unsigned kk = 0; kk < m_netlist.GetCount(); kk++ )
for( int kk = 0; kk < (int) m_netlist.GetCount(); kk++ )
{
COMPONENT* component = m_netlist.GetComponent( kk );
@ -207,37 +208,29 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
// for example)
wxString fpid_candidate;
for( unsigned idx = 0; idx < equivList.size(); idx++ )
for( int idx = 0; idx < (int) equivList.size(); idx++ )
{
FOOTPRINT_EQUIVALENCE& equivItem = equivList[idx];
if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
continue;
const FOOTPRINT_INFO* fp =
m_FootprintsList->GetFootprintInfo( equivItem.m_FootprintFPID );
const FOOTPRINT_INFO* fp = m_FootprintsList->GetFootprintInfo( equivItem.m_FootprintFPID );
bool equ_is_unique = true;
unsigned next = idx+1;
int next = idx+1;
int previous = idx-1;
if( next < equivList.size()
&& equivItem.m_ComponentValue == equivList[next].m_ComponentValue )
{
if( next < (int) equivList.size() && equivItem.m_ComponentValue == equivList[next].m_ComponentValue )
equ_is_unique = false;
}
if( previous >= 0
&& equivItem.m_ComponentValue == equivList[previous].m_ComponentValue )
{
if( previous >= 0 && equivItem.m_ComponentValue == equivList[previous].m_ComponentValue )
equ_is_unique = false;
}
// If the equivalence is unique, no ambiguity: use the association
if( fp && equ_is_unique )
{
AssociateFootprint( CVPCB_ASSOCIATION( kk, equivItem.m_FootprintFPID ),
firstAssoc );
AssociateFootprint( CVPCB_ASSOCIATION( kk, equivItem.m_FootprintFPID ), firstAssoc );
firstAssoc = false;
found = true;
break;
@ -254,18 +247,18 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
if( fp )
{
size_t filtercount = component->GetFootprintFilters().GetCount();
found = ( 0 == filtercount ); // if no entries, do not filter
found = ( filtercount == 0 ); // if no entries, do not filter
for( size_t jj = 0; jj < filtercount && !found; jj++ )
found = fp->GetFootprintName().Matches( component->GetFootprintFilters()[jj] );
}
else
{
msg.Printf( _( "Component %s: footprint %s not found in any of the project "
"footprint libraries." ),
component->GetReference(), equivItem.m_FootprintFPID );
msg.Printf( _( "Component %s: footprint %s not found in any of the project footprint libraries." ),
component->GetReference(),
equivItem.m_FootprintFPID );
if( ! error_msg.IsEmpty() )
if( !error_msg.IsEmpty() )
error_msg << wxT("\n\n");
error_msg += msg;
@ -273,8 +266,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
if( found )
{
AssociateFootprint( CVPCB_ASSOCIATION( kk, equivItem.m_FootprintFPID ),
firstAssoc );
AssociateFootprint( CVPCB_ASSOCIATION( kk, equivItem.m_FootprintFPID ), firstAssoc );
firstAssoc = false;
break;
}
@ -292,14 +284,13 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
}
// obviously the last chance: there's only one filter matching one footprint
if( 1 == component->GetFootprintFilters().GetCount() )
if( component->GetFootprintFilters().GetCount() == 1 )
{
// we do not need to analyze wildcards: single footprint do not
// contain them and if there are wildcards it just will not match any
if( m_FootprintsList->GetFootprintInfo( component->GetFootprintFilters()[0] ) )
{
AssociateFootprint( CVPCB_ASSOCIATION( kk, component->GetFootprintFilters()[0] ),
firstAssoc );
AssociateFootprint( CVPCB_ASSOCIATION( kk, component->GetFootprintFilters()[0] ), firstAssoc );
firstAssoc = false;
}
}

View File

@ -116,7 +116,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
setupUIConditions();
m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings<DISPLAY_FOOTPRINTS_TOOLBAR_SETTINGS>( "display_footprints-toolbars" );
m_toolbarSettings = GetToolbarSettings<DISPLAY_FOOTPRINTS_TOOLBAR_SETTINGS>( "display_footprints-toolbars" );
configureToolbars();
RecreateToolbars();
@ -192,13 +192,9 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
wxASSERT( mgr );
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
mgr->SetConditions( ACTIONS::zoomTool,
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool,
CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
mgr->SetConditions( ACTIONS::measureTool,
CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
mgr->SetConditions( ACTIONS::measureTool, CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
@ -218,47 +214,50 @@ void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
void DISPLAY_FOOTPRINTS_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
wxCHECK( cfg, /* void */ );
// We don't allow people to change this right now, so make sure it's on
GetWindowSettings( cfg )->cursor.always_show_cursor = true;
GetWindowSettings( aCfg )->cursor.always_show_cursor = true;
PCB_BASE_FRAME::LoadSettings( cfg );
SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions );
if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
{
PCB_BASE_FRAME::LoadSettings( cfg );
SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions );
}
}
void DISPLAY_FOOTPRINTS_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
wxCHECK( cfg, /* void */ );
PCB_BASE_FRAME::SaveSettings( aCfg );
PCB_BASE_FRAME::SaveSettings( cfg );
cfg->m_FootprintViewerDisplayOptions = GetDisplayOptions();
cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale();
if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
{
cfg->m_FootprintViewerDisplayOptions = GetDisplayOptions();
cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale();
}
}
WINDOW_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
{
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
return &cfg->m_FootprintViewer;
static WINDOW_SETTINGS defaultCfg;
CVPCB_SETTINGS* cfg = GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
return cfg ? &cfg->m_FootprintViewer : &defaultCfg;
}
PCB_VIEWERS_SETTINGS_BASE* DISPLAY_FOOTPRINTS_FRAME::GetViewerSettingsBase() const
{
return Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
return GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
}
MAGNETIC_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetMagneticItemsSettings()
{
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
return &cfg->m_FootprintViewerMagneticSettings;
static MAGNETIC_SETTINGS defaultCfg;
CVPCB_SETTINGS* cfg = GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
return cfg ? &cfg->m_FootprintViewerMagneticSettings : &defaultCfg;
}
@ -268,16 +267,14 @@ COLOR4D DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
}
FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
REPORTER& aReporter )
FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName, REPORTER& aReporter )
{
FOOTPRINT* footprint = nullptr;
LIB_ID fpid;
if( fpid.Parse( aFootprintName ) >= 0 )
{
aReporter.Report( wxString::Format( _( "Footprint ID '%s' is not valid." ),
aFootprintName ),
aReporter.Report( wxString::Format( _( "Footprint ID '%s' is not valid." ), aFootprintName ),
RPT_SEVERITY_ERROR );
return nullptr;
}
@ -291,8 +288,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
// See if the library requested is in the library table
if( !fpTable->HasLibrary( libNickname ) )
{
aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library "
"table." ),
aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library table." ),
libNickname ),
RPT_SEVERITY_ERROR );
return nullptr;
@ -455,12 +451,8 @@ void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetColorSettings( bool aForceRefresh ) const
{
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
if( cfg )
return Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
else
return Pgm().GetSettingsManager().GetColorSettings();
FOOTPRINT_EDITOR_SETTINGS* cfg = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
}

View File

@ -198,4 +198,25 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_COMMIT* aCommit, SCH_SCREEN* aScr
return junction;
}
void SCH_EDIT_FRAME::UpdateHopOveredWires( SCH_ITEM* aItem )
{
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
GetCanvas()->GetView()->Query( aItem->GetBoundingBox(), items );
for( const auto& it : items )
{
if( !it.first->IsSCH_ITEM() )
continue;
SCH_ITEM* item = static_cast<SCH_ITEM*>( it.first );
if( item == aItem )
continue;
if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T } ) )
{
GetCanvas()->GetView()->Update( item );
}
}
}

View File

@ -48,6 +48,7 @@ bool g_resetFieldVisibilities[2] = { true, false };
bool g_resetFieldEffects[2] = { true, false };
bool g_resetFieldPositions[2] = { true, false };
bool g_resetAttributes[2] = { true, false };
bool g_resetPinVisibilities[2] = { true, false };
bool g_resetCustomPower[2] = { false, false };
bool g_resetAlternatePins[2] = { true, false };
@ -144,6 +145,9 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
m_resetFieldEffects->SetLabel( _( "Update field sizes and styles" ) );
m_resetFieldPositions->SetLabel( _( "Update field positions" ) );
m_resetAttributes->SetLabel( _( "Update symbol attributes" ) );
m_resetPinTextVisibility->SetLabel( _( "Update pin name/number visibilities" ) );
m_resetAlternatePin->SetLabel( _( "Reset alternate pin functions" ) );
m_resetCustomPower->SetLabel( _( "Reset custom power symbols" ) );
}
m_removeExtraBox->SetValue( g_removeExtraFields[ (int) m_mode ] );
@ -153,6 +157,7 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
m_resetFieldEffects->SetValue( g_resetFieldEffects[ (int) m_mode ] );
m_resetFieldPositions->SetValue( g_resetFieldPositions[ (int) m_mode ] );
m_resetAttributes->SetValue( g_resetAttributes[ (int) m_mode ] );
m_resetPinTextVisibility->SetValue( g_resetPinVisibilities[ (int) m_mode ] );
m_resetCustomPower->SetValue( g_resetCustomPower[ (int) m_mode ] );
m_resetAlternatePin->SetValue( g_resetAlternatePins[ (int) m_mode ] );
@ -236,6 +241,7 @@ DIALOG_CHANGE_SYMBOLS::~DIALOG_CHANGE_SYMBOLS()
g_resetFieldEffects[ (int) m_mode ] = m_resetFieldEffects->GetValue();
g_resetFieldPositions[ (int) m_mode ] = m_resetFieldPositions->GetValue();
g_resetAttributes[ (int) m_mode ] = m_resetAttributes->GetValue();
g_resetPinVisibilities[ (int) m_mode ] = m_resetPinTextVisibility->GetValue();
g_resetCustomPower[ (int) m_mode ] = m_resetCustomPower->GetValue();
g_resetAlternatePins[ (int) m_mode ] = m_resetAlternatePin->GetValue();
}
@ -414,10 +420,25 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
}
void DIALOG_CHANGE_SYMBOLS::checkAll( bool aCheck )
void DIALOG_CHANGE_SYMBOLS::selectAll( bool aSelect )
{
for( unsigned i = 0; i < m_fieldsBox->GetCount(); ++i )
m_fieldsBox->Check( i, aCheck );
m_fieldsBox->Check( i, aSelect );
}
void DIALOG_CHANGE_SYMBOLS::checkAll( bool aCheck )
{
m_removeExtraBox->SetValue( aCheck );
m_resetEmptyFields->SetValue( aCheck );
m_resetFieldText->SetValue( aCheck );
m_resetFieldVisibilities->SetValue( aCheck );
m_resetFieldEffects->SetValue( aCheck );
m_resetFieldPositions->SetValue( aCheck );
m_resetPinTextVisibility->SetValue( aCheck );
m_resetAlternatePin->SetValue( aCheck );
m_resetAttributes->SetValue( aCheck );
m_resetCustomPower->SetValue( aCheck );
}

View File

@ -70,15 +70,26 @@ protected:
void onSelectAll( wxCommandEvent& event ) override
{
checkAll( true );
selectAll( true );
}
void onSelectNone( wxCommandEvent& event ) override
{
selectAll( false );
}
void onCheckAll( wxCommandEvent& aEvent ) override
{
checkAll( true );
}
void onUncheckAll( wxCommandEvent& aEvent ) override
{
checkAll( false );
}
/// Select or deselect all fields in the listbox widget.
void selectAll( bool aSelect );
void checkAll( bool aCheck );
private:

View File

@ -32,25 +32,31 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
m_matchSizer->Add( m_matchBySelection, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
m_matchByReference = new wxRadioButton( this, wxID_ANY, _("Update symbols matching reference designator:"), wxDefaultPosition, wxDefaultSize, 0 );
m_matchSizer->Add( m_matchByReference, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM, 2 );
m_matchSizer->Add( m_matchByReference, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 2 );
m_specifiedReference = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), wxTE_PROCESS_ENTER );
m_matchSizer->Add( m_specifiedReference, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM, 2 );
m_matchSizer->Add( m_specifiedReference, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, 5 );
m_matchByValue = new wxRadioButton( this, wxID_ANY, _("Update symbols matching value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_matchSizer->Add( m_matchByValue, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_specifiedValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_matchSizer->Add( m_specifiedValue, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_matchSizer->Add( m_specifiedValue, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 );
m_matchById = new wxRadioButton( this, wxID_ANY, _("Update symbols matching library identifier:"), wxDefaultPosition, wxDefaultSize, 0 );
m_matchSizer->Add( m_matchById, wxGBPosition( 4, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 6 );
m_matchSizer->Add( m_matchById, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 6 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
m_specifiedId = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_matchSizer->Add( m_specifiedId, wxGBPosition( 5, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
bSizer10->Add( m_specifiedId, 1, wxALIGN_CENTER_VERTICAL, 5 );
m_matchIdBrowserButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_matchSizer->Add( m_matchIdBrowserButton, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
bSizer10->Add( m_matchIdBrowserButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_matchSizer->Add( bSizer10, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxRIGHT, 5 );
m_matchSizer->AddGrowableCol( 1 );
@ -67,24 +73,18 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_mainSizer->Add( m_staticline1, 0, wxEXPAND|wxALL, 4 );
m_newIdSizer = new wxBoxSizer( wxVERTICAL );
m_newIdSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* m_newIdLabel;
m_newIdLabel = new wxStaticText( this, wxID_ANY, _("New library identifier:"), wxDefaultPosition, wxDefaultSize, 0 );
m_newIdLabel->Wrap( -1 );
m_newIdSizer->Add( m_newIdLabel, 0, wxLEFT, 5 );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxHORIZONTAL );
m_newIdSizer->Add( m_newIdLabel, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_newId = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
bSizer1->Add( m_newId, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
m_newIdSizer->Add( m_newId, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_newIdBrowserButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizer1->Add( m_newIdBrowserButton, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_newIdSizer->Add( bSizer1, 0, wxEXPAND|wxTOP, 2 );
m_newIdSizer->Add( m_newIdBrowserButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_mainSizer->Add( m_newIdSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
@ -115,6 +115,9 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
bSizerUpdate->Add( m_updateFieldsSizer, 2, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
bSizerUpdate->Add( 5, 0, 0, wxEXPAND, 5 );
m_updateOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Update Options") ), wxHORIZONTAL );
wxBoxSizer* bSizer8;
@ -123,28 +126,31 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
m_removeExtraBox = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Remove fields if not in library symbol"), wxDefaultPosition, wxDefaultSize, 0 );
m_removeExtraBox->SetToolTip( _("Removes fields that do not occur in the original library symbols") );
bSizer8->Add( m_removeExtraBox, 0, wxBOTTOM|wxRIGHT, 4 );
bSizer8->Add( m_removeExtraBox, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetEmptyFields = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset fields if empty in library symbol"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_resetEmptyFields, 0, wxBOTTOM|wxRIGHT, 4 );
bSizer8->Add( m_resetEmptyFields, 0, wxBOTTOM|wxRIGHT, 5 );
bSizer8->Add( 0, 10, 1, wxEXPAND, 5 );
m_resetFieldText = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field text"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_resetFieldText, 0, wxBOTTOM|wxRIGHT, 4 );
bSizer8->Add( m_resetFieldText, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetFieldVisibilities = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field visibilities"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_resetFieldVisibilities, 0, wxBOTTOM|wxRIGHT, 4 );
bSizer8->Add( m_resetFieldVisibilities, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetFieldEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field text sizes and styles"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_resetFieldEffects, 0, wxBOTTOM|wxRIGHT, 4 );
bSizer8->Add( m_resetFieldEffects, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetFieldPositions = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field positions"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_resetFieldPositions, 0, wxBOTTOM|wxRIGHT, 4 );
bSizer8->Add( m_resetFieldPositions, 0, wxBOTTOM|wxRIGHT, 10 );
m_checkAll = new wxButton( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Check All Update Options"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_checkAll, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_updateOptionsSizer->Add( bSizer8, 0, wxEXPAND, 5 );
m_updateOptionsSizer->Add( bSizer8, 0, wxEXPAND|wxRIGHT, 10 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
@ -166,7 +172,7 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
bSizer9->Add( 0, 10, 1, wxEXPAND, 5 );
m_resetPinTextVisibility = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset visibility of pin names/numbers"), wxDefaultPosition, wxDefaultSize, 0 );
m_resetPinTextVisibility = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset pin name/number visibilities"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_resetPinTextVisibility, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetAlternatePin = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset alternate pin functions"), wxDefaultPosition, wxDefaultSize, 0 );
@ -179,13 +185,16 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
bSizer9->Add( m_resetAttributes, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetCustomPower = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset custom power symbols"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_resetCustomPower, 0, wxBOTTOM|wxRIGHT, 5 );
bSizer9->Add( m_resetCustomPower, 0, wxBOTTOM|wxRIGHT, 10 );
m_uncheckAll = new wxButton( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Uncheck All Update Options"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_uncheckAll, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_updateOptionsSizer->Add( bSizer9, 0, wxEXPAND, 5 );
m_updateOptionsSizer->Add( bSizer9, 0, wxEXPAND|wxLEFT, 5 );
bSizerUpdate->Add( m_updateOptionsSizer, 3, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
bSizerUpdate->Add( m_updateOptionsSizer, 4, wxEXPAND|wxTOP|wxRIGHT, 10 );
m_mainSizer->Add( bSizerUpdate, 0, wxEXPAND, 5 );
@ -232,6 +241,8 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
m_newIdBrowserButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::launchNewIdSymbolBrowser ), NULL, this );
m_selAllBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onSelectAll ), NULL, this );
m_selNoneBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onSelectNone ), NULL, this );
m_checkAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onCheckAll ), NULL, this );
m_uncheckAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onUncheckAll ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onOkButtonClicked ), NULL, this );
}
@ -252,6 +263,8 @@ DIALOG_CHANGE_SYMBOLS_BASE::~DIALOG_CHANGE_SYMBOLS_BASE()
m_newIdBrowserButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::launchNewIdSymbolBrowser ), NULL, this );
m_selAllBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onSelectAll ), NULL, this );
m_selNoneBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onSelectNone ), NULL, this );
m_checkAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onCheckAll ), NULL, this );
m_uncheckAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onUncheckAll ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CHANGE_SYMBOLS_BASE::onOkButtonClicked ), NULL, this );
}

View File

@ -230,7 +230,7 @@
<property name="border">2</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="true">
@ -296,10 +296,10 @@
</object>
</object>
<object class="gbsizeritem" expanded="true">
<property name="border">2</property>
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="true">
@ -437,7 +437,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="true">
@ -505,9 +505,9 @@
</object>
<object class="gbsizeritem" expanded="true">
<property name="border">6</property>
<property name="colspan">2</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="true">
@ -574,149 +574,157 @@
</object>
<object class="gbsizeritem" expanded="true">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="row">5</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_specifiedId</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnKillFocus">onMatchIDKillFocus</event>
</object>
</object>
<object class="gbsizeritem" expanded="true">
<property name="border">3</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="row">5</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MyButton</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_matchIdBrowserButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">launchMatchIdSymbolBrowser</event>
<property name="name">bSizer10</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_specifiedId</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnKillFocus">onMatchIDKillFocus</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MyButton</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_matchIdBrowserButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">launchMatchIdSymbolBrowser</event>
</object>
</object>
</object>
</object>
</object>
@ -799,11 +807,11 @@
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">m_newIdSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxLEFT</property>
<property name="flag">wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="true">
<property name="BottomDockable">1</property>
@ -864,155 +872,144 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">2</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="name">bSizer1</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_newId</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnKillFocus">onNewLibIDKillFocus</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MyButton</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_newIdBrowserButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">launchNewIdSymbolBrowser</event>
</object>
</object>
<property name="moveable">1</property>
<property name="name">m_newId</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnKillFocus">onNewLibIDKillFocus</event>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MyButton</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_newIdBrowserButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">launchNewIdSymbolBrowser</event>
</object>
</object>
</object>
@ -1265,10 +1262,20 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">5</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">3</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT</property>
<property name="proportion">4</property>
<object class="wxStaticBoxSizer" expanded="true">
<property name="id">wxID_ANY</property>
<property name="label">Update Options</property>
@ -1278,8 +1285,8 @@
<property name="parent">1</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="border">10</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
@ -1287,7 +1294,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">4</property>
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
@ -1352,7 +1359,7 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">4</property>
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
@ -1427,7 +1434,7 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">4</property>
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
@ -1492,7 +1499,7 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">4</property>
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
@ -1557,7 +1564,7 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">4</property>
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
@ -1622,7 +1629,7 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">4</property>
<property name="border">10</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
@ -1686,11 +1693,86 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Check All Update Options</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkAll</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onCheckAll</event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
@ -1871,7 +1953,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Update/reset visibility of pin names/numbers</property>
<property name="label">Update/reset pin name/number visibilities</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -2043,7 +2125,7 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="border">10</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
@ -2107,6 +2189,81 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Uncheck All Update Options</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_uncheckAll</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">onUncheckAll</event>
</object>
</object>
</object>
</object>
</object>

View File

@ -26,8 +26,8 @@ class WX_HTML_REPORT_PANEL;
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/gbsizer.h>
#include <wx/sizer.h>
#include <wx/gbsizer.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/checklst.h>
@ -72,10 +72,12 @@ class DIALOG_CHANGE_SYMBOLS_BASE : public DIALOG_SHIM
wxCheckBox* m_resetFieldVisibilities;
wxCheckBox* m_resetFieldEffects;
wxCheckBox* m_resetFieldPositions;
wxButton* m_checkAll;
wxCheckBox* m_resetPinTextVisibility;
wxCheckBox* m_resetAlternatePin;
wxCheckBox* m_resetAttributes;
wxCheckBox* m_resetCustomPower;
wxButton* m_uncheckAll;
WX_HTML_REPORT_PANEL* m_messagePanel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
@ -95,6 +97,8 @@ class DIALOG_CHANGE_SYMBOLS_BASE : public DIALOG_SHIM
virtual void launchNewIdSymbolBrowser( wxCommandEvent& event ) { event.Skip(); }
virtual void onSelectAll( wxCommandEvent& event ) { event.Skip(); }
virtual void onSelectNone( wxCommandEvent& event ) { event.Skip(); }
virtual void onCheckAll( wxCommandEvent& event ) { event.Skip(); }
virtual void onUncheckAll( wxCommandEvent& event ) { event.Skip(); }
virtual void onOkButtonClicked( wxCommandEvent& event ) { event.Skip(); }

View File

@ -544,18 +544,17 @@ public:
VECTOR2I pos = last->GetPosition();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg =
mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( last->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
|| last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
pos.y -= schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
}
else
{
pos.x += schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
if( last->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
|| last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
{
pos.y -= schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
}
else
{
pos.x += schIUScale.MilsToIU( cfg->m_Repeat.pin_step );
}
}
newPin->SetPosition( pos );

View File

@ -187,10 +187,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
// Add in any template fieldnames not yet defined:
// Read global fieldname templates
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg )
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
TEMPLATES templateMgr;

View File

@ -365,10 +365,7 @@ COLOR_SETTINGS* DIALOG_PLOT_SCHEMATIC::getColorSettings()
int selection = m_colorTheme->GetSelection();
if( selection < 0 )
{
return m_editFrame->GetSettingsManager()->GetColorSettings(
COLOR_SETTINGS::COLOR_BUILTIN_DEFAULT );
}
return ::GetColorSettings( COLOR_SETTINGS::COLOR_BUILTIN_DEFAULT );
return static_cast<COLOR_SETTINGS*>( m_colorTheme->GetClientData( selection ) );
}
@ -416,6 +413,8 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
renderSettings.m_ShowHiddenPins = false;
renderSettings.m_ShowHiddenFields = false;
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
getPlotOptions( &renderSettings );
std::unique_ptr<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( m_editFrame );
@ -433,6 +432,7 @@ void DIALOG_PLOT_SCHEMATIC::plotSchematic( bool aPlotAll )
plotOpts.m_PDFMetadata = m_plotPDFMetadata->GetValue();
plotOpts.m_outputDirectory = getOutputPath();
plotOpts.m_pageSizeSelect = m_pageSizeSelect;
plotOpts.m_plotHopOver = cfg ? cfg->m_Appearance.show_hop_over : false;
schPlotter->Plot( GetPlotFileFormat(), plotOpts, &renderSettings, &m_MessagesBox->Reporter() );

View File

@ -61,7 +61,6 @@ void PANEL_EESCHEMA_ANNOTATION_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS*
case 2: m_rbSheetX1000->SetValue( true ); break;
}
int annotateStartNum = 0; // Default "start after" value for annotation
// See if we can get a "start after" value from the project settings
@ -79,41 +78,32 @@ void PANEL_EESCHEMA_ANNOTATION_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS*
bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
loadEEschemaSettings( cfg );
loadEEschemaSettings( GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) );
return true;
}
bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
cfg->m_AnnotatePanel.automatic = m_checkAutoAnnotate->GetValue();
cfg->m_AnnotatePanel.automatic = m_checkAutoAnnotate->GetValue();
cfg->m_AnnotatePanel.sort_order = m_rbSortBy_Y_Position->GetValue() ? ANNOTATE_ORDER_T::SORT_BY_Y_POSITION
: ANNOTATE_ORDER_T::SORT_BY_X_POSITION;
cfg->m_AnnotatePanel.sort_order = m_rbSortBy_Y_Position->GetValue()
? ANNOTATE_ORDER_T::SORT_BY_Y_POSITION
: ANNOTATE_ORDER_T::SORT_BY_X_POSITION;
if( m_rbSheetX100->GetValue() )
cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_100;
else if( m_rbSheetX1000->GetValue() )
cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_1000;
else
cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::INCREMENTAL_BY_REF;
}
if( m_rbSheetX100->GetValue() )
cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_100;
else if( m_rbSheetX1000->GetValue() )
cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_1000;
else
cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::INCREMENTAL_BY_REF;
SCH_EDIT_FRAME* schFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_schSettingsProvider );
if( schFrame )
if( SCH_EDIT_FRAME* schFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_schSettingsProvider ) )
{
SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings();
projSettings.m_AnnotateStartNum =
EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() );
projSettings.m_AnnotateStartNum = EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() );
}
return true;

View File

@ -67,10 +67,9 @@ PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( wxWindow* aParent
{
m_colorNamespace = "schematic";
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
EESCHEMA_SETTINGS* app_settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
EESCHEMA_SETTINGS* app_settings = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
COLOR_SETTINGS* current = ::GetColorSettings( app_settings ? app_settings->m_ColorTheme : DEFAULT_THEME );
// Saved theme doesn't exist? Reset to default
if( current->GetFilename() != app_settings->m_ColorTheme )
@ -122,10 +121,8 @@ bool PANEL_EESCHEMA_COLOR_SETTINGS::TransferDataFromWindow()
if( !saveCurrentTheme( true ) )
return false;
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
cfg->m_ColorTheme = m_currentSettings->GetFilename();
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
cfg->m_ColorTheme = m_currentSettings->GetFilename();
return true;
}

View File

@ -62,6 +62,7 @@ void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cf
m_checkShowOPVoltages->SetValue( cfg->m_Appearance.show_op_voltages );
m_checkShowPinAltModeIcons->SetValue( cfg->m_Appearance.show_op_currents );
m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits );
m_cbHopOver->SetValue( cfg->m_Appearance.show_hop_over );
m_checkSelDrawChildItems->SetValue( cfg->m_Selection.draw_selected_children );
m_checkSelFillShapes->SetValue( cfg->m_Selection.fill_shapes );
@ -80,22 +81,16 @@ void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cf
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
loadEEschemaSettings( cfg );
loadEEschemaSettings( GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) );
m_galOptsPanel->TransferDataToWindow();
return true;
}
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
cfg->m_Appearance.default_font = m_defaultFontCtrl->GetSelection() <= 0
// This is a keyword. Do not translate.
? wxString( KICAD_FONT_NAME )
@ -110,6 +105,7 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
cfg->m_Appearance.show_op_currents = m_checkShowOPCurrents->GetValue();
cfg->m_Appearance.show_pin_alt_icons = m_checkShowPinAltModeIcons->GetValue();
cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue();
cfg->m_Appearance.show_hop_over = m_cbHopOver->GetValue();
cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue();
cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue();
@ -117,13 +113,13 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
cfg->m_Selection.highlight_thickness = KiROUND( m_highlightWidthCtrl->GetValue() );
cfg->m_Selection.highlight_netclass_colors = m_highlightNetclassColors->GetValue();
cfg->m_Selection.highlight_netclass_colors_thickness = m_colHighlightThickness->GetValue();
cfg->m_Selection.highlight_netclass_colors_alpha =
m_colHighlightTransparency->GetValue() / 100.0;
cfg->m_Selection.highlight_netclass_colors_alpha = m_colHighlightTransparency->GetValue() / 100.0;
cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
}
m_galOptsPanel->TransferDataFromWindow();

View File

@ -135,6 +135,11 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_checkPageLimits->SetValue(true);
bAppearanceSizer->Add( m_checkPageLimits, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbHopOver = new wxCheckBox( this, wxID_ANY, _("Hop hover on wire crossing"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbHopOver->SetToolTip( _("Show a hop hover when two wires are crossing") );
bAppearanceSizer->Add( m_cbHopOver, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bRightColumn->Add( bAppearanceSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );

View File

@ -1432,6 +1432,71 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Hop hover on wire crossing</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbHopOver</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Show a hop hover when two wires are crossing</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="false">

View File

@ -58,6 +58,7 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL
wxCheckBox* m_checkShowOPCurrents;
wxCheckBox* m_checkShowPinAltModeIcons;
wxCheckBox* m_checkPageLimits;
wxCheckBox* m_cbHopOver;
wxStaticText* m_selectionLabel;
wxStaticLine* m_staticline2;
wxCheckBox* m_checkSelDrawChildItems;

View File

@ -99,9 +99,8 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
m_vPitch.SetValue( schIUScale.MilsToIU( aCfg->m_Drawing.default_repeat_offset_y ) );
m_spinLabelRepeatStep->SetValue( aCfg->m_Drawing.repeat_label_increment );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
COLOR_SETTINGS* settings = mgr.GetColorSettings();
COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
COLOR_SETTINGS* settings = ::GetColorSettings( DEFAULT_THEME );
COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
m_borderColorSwatch->SetDefaultColor( settings->GetDefaultColor( LAYER_SHEET ) );
@ -109,8 +108,7 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
m_backgroundColorSwatch->SetDefaultColor( settings->GetDefaultColor( LAYER_SHEET_BACKGROUND ) );
m_backgroundColorSwatch->SetSwatchColor( aCfg->m_Drawing.default_sheet_background_color,
false );
m_backgroundColorSwatch->SetSwatchColor( aCfg->m_Drawing.default_sheet_background_color, false );
m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
m_choiceArcMode->SetSelection( arcEditModeToComboIndex( aCfg->m_Drawing.arc_edit_mode ) );
@ -132,42 +130,38 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
loadEEschemaSettings( cfg );
loadEEschemaSettings( GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) );
return true;
}
bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
cfg->m_Drawing.new_power_symbols = static_cast<POWER_SYMBOLS>( m_choicePower->GetSelection() );
cfg->m_Drawing.new_power_symbols = static_cast<POWER_SYMBOLS>( m_choicePower->GetSelection() );
cfg->m_Drawing.default_sheet_border_color = m_borderColorSwatch->GetSwatchColor();
cfg->m_Drawing.default_sheet_background_color = m_backgroundColorSwatch->GetSwatchColor();
cfg->m_Drawing.default_sheet_border_color = m_borderColorSwatch->GetSwatchColor();
cfg->m_Drawing.default_sheet_background_color = m_backgroundColorSwatch->GetSwatchColor();
cfg->m_Drawing.default_repeat_offset_x = schIUScale.IUToMils( m_hPitch.GetIntValue() );
cfg->m_Drawing.default_repeat_offset_y = schIUScale.IUToMils( m_vPitch.GetIntValue() );
cfg->m_Drawing.repeat_label_increment = m_spinLabelRepeatStep->GetValue();
cfg->m_Drawing.default_repeat_offset_x = schIUScale.IUToMils( m_hPitch.GetIntValue() );
cfg->m_Drawing.default_repeat_offset_y = schIUScale.IUToMils( m_vPitch.GetIntValue() );
cfg->m_Drawing.repeat_label_increment = m_spinLabelRepeatStep->GetValue();
cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection();
cfg->m_Drawing.arc_edit_mode = arcEditModeToEnum( m_choiceArcMode->GetSelection() );
cfg->m_Appearance.footprint_preview = m_footprintPreview->GetValue();
cfg->m_RescueNeverShow = m_neverShowRescue->GetValue();
cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection();
cfg->m_Drawing.arc_edit_mode = arcEditModeToEnum( m_choiceArcMode->GetSelection() );
cfg->m_Appearance.footprint_preview = m_footprintPreview->GetValue();
cfg->m_RescueNeverShow = m_neverShowRescue->GetValue();
cfg->m_AutoplaceFields.enable = m_checkAutoplaceFields->GetValue();
cfg->m_AutoplaceFields.allow_rejustify = m_checkAutoplaceJustify->GetValue();
cfg->m_AutoplaceFields.align_to_grid = m_checkAutoplaceAlign->GetValue();
cfg->m_AutoplaceFields.enable = m_checkAutoplaceFields->GetValue();
cfg->m_AutoplaceFields.allow_rejustify = m_checkAutoplaceJustify->GetValue();
cfg->m_AutoplaceFields.align_to_grid = m_checkAutoplaceAlign->GetValue();
cfg->m_Input.drag_is_move = !m_mouseDragIsDrag->GetValue();
cfg->m_Input.drag_is_move = !m_mouseDragIsDrag->GetValue();
cfg->m_Drawing.auto_start_wires = m_cbAutoStartWires->GetValue();
cfg->m_Input.esc_clears_net_highlight = m_escClearsNetHighlight->GetValue();
cfg->m_Drawing.auto_start_wires = m_cbAutoStartWires->GetValue();
cfg->m_Input.esc_clears_net_highlight = m_escClearsNetHighlight->GetValue();
}
return true;
}

View File

@ -86,16 +86,17 @@ bool PANEL_SIMULATOR_PREFERENCES::TransferDataFromWindow()
return static_cast<SIM_MOUSE_WHEEL_ACTION>( aChoice->GetSelection() );
};
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
SIM_MOUSE_WHEEL_ACTION_SET& actions = cfg->m_Simulator.preferences.mouse_wheel_actions;
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
SIM_MOUSE_WHEEL_ACTION_SET& actions = cfg->m_Simulator.preferences.mouse_wheel_actions;
actions.vertical_unmodified = toAction( m_choiceVScrollUnmodified );
actions.vertical_with_ctrl = toAction( m_choiceVScrollCtrl );
actions.vertical_with_shift = toAction( m_choiceVScrollShift );
actions.vertical_with_alt = toAction( m_choiceVScrollAlt );
actions.vertical_unmodified = toAction( m_choiceVScrollUnmodified );
actions.vertical_with_ctrl = toAction( m_choiceVScrollCtrl );
actions.vertical_with_shift = toAction( m_choiceVScrollShift );
actions.vertical_with_alt = toAction( m_choiceVScrollAlt );
actions.horizontal = horizontalScrollSelectionToAction( m_choiceHScroll->GetSelection() );
actions.horizontal = horizontalScrollSelectionToAction( m_choiceHScroll->GetSelection() );
}
return true;
}
@ -103,10 +104,9 @@ bool PANEL_SIMULATOR_PREFERENCES::TransferDataFromWindow()
bool PANEL_SIMULATOR_PREFERENCES::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
applyMouseScrollActionsToPanel( cfg->m_Simulator.preferences.mouse_wheel_actions );
applyMouseScrollActionsToPanel( cfg->m_Simulator.preferences.mouse_wheel_actions );
return true;
}

View File

@ -35,15 +35,14 @@ PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( wxWindow* aWindow ) :
bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( cfg->m_UseEeschemaColorSettings )
if( cfg && cfg->m_UseEeschemaColorSettings )
m_eeschemaRB->SetValue( true );
else
m_themeRB->SetValue( true );
COLOR_SETTINGS* current = mgr.GetColorSettings( cfg->m_ColorTheme );
COLOR_SETTINGS* current = ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
int width = 0;
int height = 0;
@ -51,7 +50,7 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
m_themes->Clear();
for( COLOR_SETTINGS* settings : mgr.GetColorSettingsList() )
for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
{
int pos = m_themes->Append( settings->GetName(), static_cast<void*>( settings ) );
@ -72,17 +71,17 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow()
bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();
if( !cfg->m_UseEeschemaColorSettings )
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
int sel = m_themes->GetSelection();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
cfg->m_UseEeschemaColorSettings = m_eeschemaRB->GetValue();
cfg->m_ColorTheme = colors->GetFilename();
if( !cfg->m_UseEeschemaColorSettings )
{
int sel = m_themes->GetSelection();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
cfg->m_ColorTheme = colors->GetFilename();
}
}
return true;

View File

@ -50,10 +50,7 @@ void PANEL_SYM_DISPLAY_OPTIONS::loadSymEditorSettings( SYMBOL_EDITOR_SETTINGS* c
bool PANEL_SYM_DISPLAY_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
loadSymEditorSettings( cfg );
loadSymEditorSettings( GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) );
m_galOptsPanel->TransferDataToWindow();
@ -63,14 +60,14 @@ bool PANEL_SYM_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_SYM_DISPLAY_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
cfg->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
cfg->m_ShowHiddenFields = m_checkShowHiddenFields->GetValue();
cfg->m_ShowPinElectricalType = m_showPinElectricalTypes->GetValue();
cfg->m_ShowPinAltIcons = m_checkShowPinAltModeIcons->GetValue();
m_galOptsPanel->TransferDataFromWindow();
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
cfg->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
cfg->m_ShowHiddenFields = m_checkShowHiddenFields->GetValue();
cfg->m_ShowPinElectricalType = m_showPinElectricalTypes->GetValue();
cfg->m_ShowPinAltIcons = m_checkShowPinAltModeIcons->GetValue();
m_galOptsPanel->TransferDataFromWindow();
}
return true;
}

View File

@ -66,31 +66,27 @@ void PANEL_SYM_EDITING_OPTIONS::loadSymEditorSettings( SYMBOL_EDITOR_SETTINGS* a
bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
loadSymEditorSettings( cfg );
loadSymEditorSettings( GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) );
return true;
}
bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
cfg->m_Defaults.line_width = schIUScale.IUToMils( m_lineWidth.GetIntValue() );
cfg->m_Defaults.text_size = schIUScale.IUToMils( m_textSize.GetIntValue() );
cfg->m_Defaults.pin_length = schIUScale.IUToMils( m_pinLength.GetIntValue() );
cfg->m_Defaults.pin_num_size = schIUScale.IUToMils( m_pinNumberSize.GetIntValue() );
cfg->m_Defaults.pin_name_size = schIUScale.IUToMils( m_pinNameSize.GetIntValue() );
cfg->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
cfg->m_Repeat.pin_step = schIUScale.IUToMils( m_pinPitch.GetIntValue() );
cfg->m_dragPinsAlongWithEdges = m_dragPinsWithEdges->GetValue();
cfg->m_Defaults.line_width = schIUScale.IUToMils( m_lineWidth.GetIntValue() );
cfg->m_Defaults.text_size = schIUScale.IUToMils( m_textSize.GetIntValue() );
cfg->m_Defaults.pin_length = schIUScale.IUToMils( m_pinLength.GetIntValue() );
cfg->m_Defaults.pin_num_size = schIUScale.IUToMils( m_pinNumberSize.GetIntValue() );
cfg->m_Defaults.pin_name_size = schIUScale.IUToMils( m_pinNameSize.GetIntValue() );
cfg->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
cfg->m_Repeat.pin_step = schIUScale.IUToMils( m_pinPitch.GetIntValue() );
cfg->m_dragPinsAlongWithEdges = m_dragPinsWithEdges->GetValue();
// Force pin_step to a grid multiple
cfg->m_Repeat.pin_step = KiROUND( double( cfg->m_Repeat.pin_step ) / MIN_GRID ) * MIN_GRID;
// Force pin_step to a grid multiple
cfg->m_Repeat.pin_step = KiROUND( double( cfg->m_Repeat.pin_step ) / MIN_GRID ) * MIN_GRID;
}
return true;
}

View File

@ -241,16 +241,13 @@ protected:
void PANEL_SYM_LIB_TABLE::setupGrid( WX_GRID* aGrid )
{
auto autoSizeCol =
[&]( WX_GRID* aCurrGrid, int aCol )
{
int prevWidth = aCurrGrid->GetColSize( aCol );
[&]( WX_GRID* aCurrGrid, int aCol )
{
int prevWidth = aCurrGrid->GetColSize( aCol );
aCurrGrid->AutoSizeColumn( aCol, false );
aCurrGrid->SetColSize( aCol, std::max( prevWidth, aCurrGrid->GetColSize( aCol ) ) );
};
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
aCurrGrid->AutoSizeColumn( aCol, false );
aCurrGrid->SetColSize( aCol, std::max( prevWidth, aCurrGrid->GetColSize( aCol ) ) );
};
// Give a bit more room for combobox editors
for( int ii = 0; ii < aGrid->GetNumberRows(); ++ii )
@ -262,33 +259,34 @@ void PANEL_SYM_LIB_TABLE::setupGrid( WX_GRID* aGrid )
aGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
// Set special attributes
wxGridCellAttr* attr;
attr = new wxGridCellAttr;
wxGridCellAttr* attr = new wxGridCellAttr;
wxString fileFiltersStr;
wxString allWildcardsStr;
attr->SetEditor( new GRID_CELL_PATH_EDITOR( m_parent, aGrid,
&cfg->m_lastSymbolLibDir,
true, m_project->GetProjectPath(),
[]( WX_GRID* grid, int row ) -> wxString
{
auto* libTable = static_cast<SYMBOL_LIB_TABLE_GRID*>( grid->GetTable() );
auto* tableRow = static_cast<SYMBOL_LIB_TABLE_ROW*>( libTable->at( row ) );
IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( tableRow->GetFileType() ) );
if( pi )
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
attr->SetEditor( new GRID_CELL_PATH_EDITOR(
m_parent, aGrid, &cfg->m_lastSymbolLibDir, true, m_project->GetProjectPath(),
[]( WX_GRID* grid, int row ) -> wxString
{
const IO_BASE::IO_FILE_DESC& desc = pi->GetLibraryDesc();
auto* libTable = static_cast<SYMBOL_LIB_TABLE_GRID*>( grid->GetTable() );
auto* tableRow = static_cast<SYMBOL_LIB_TABLE_ROW*>( libTable->at( row ) );
if( desc.m_IsFile )
return desc.FileFilter();
}
IO_RELEASER<SCH_IO> pi( SCH_IO_MGR::FindPlugin( tableRow->GetFileType() ) );
if( pi )
{
const IO_BASE::IO_FILE_DESC& desc = pi->GetLibraryDesc();
if( desc.m_IsFile )
return desc.FileFilter();
}
return wxEmptyString;
} ) );
}
return wxEmptyString;
} ) );
aGrid->SetColAttr( COL_URI, attr );
attr = new wxGridCellAttr;
@ -345,15 +343,14 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
m_pluginChoices.Add( SCH_IO_MGR::ShowType( type ) );
}
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg->m_lastSymbolLibDir.IsEmpty() )
cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
if( cfg->m_lastSymbolLibDir.IsEmpty() )
cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
}
m_lastProjectLibDir = m_project->GetProjectPath();
setupGrid( m_global_grid );
if( m_projectTable )
@ -630,34 +627,28 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
fileFiltersStr = _( "All supported formats" ) + wxT( "|" ) + allWildcardsStr + wxT( "|" )
+ fileFiltersStr;
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
wxString openDir = cfg->m_lastSymbolLibDir;
EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
wxString dummy;
wxString* lastDir;
if( m_cur_grid == m_project_grid )
openDir = m_lastProjectLibDir;
lastDir = &m_lastProjectLibDir;
else
lastDir = cfg ? &cfg->m_lastSymbolLibDir : &dummy;
wxWindow* topLevelParent = wxGetTopLevelParent( this );
wxFileDialog dlg( topLevelParent, _( "Add Library" ), openDir, wxEmptyString, fileFiltersStr,
wxFileDialog dlg( topLevelParent, _( "Add Library" ), *lastDir, wxEmptyString, fileFiltersStr,
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( m_cur_grid == m_global_grid )
cfg->m_lastSymbolLibDir = dlg.GetDirectory();
else
m_lastProjectLibDir = dlg.GetDirectory();
*lastDir = dlg.GetDirectory();
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
bool addDuplicates = false;
bool applyToAll = false;
wxString warning = _( "Warning: Duplicate Nickname" );
wxString msg = _( "A library nicknamed '%s' already exists." );
wxString detailedMsg = _( "One of the nicknames will need to be changed after "
"adding this library." );
wxArrayString filePathsList;
dlg.GetPaths( filePathsList );
@ -673,9 +664,12 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
if( !applyToAll )
{
// The cancel button adds the library to the table anyway
addDuplicates = OKOrCancelDialog( wxGetTopLevelParent( this ), warning,
wxString::Format( msg, nickname ),
detailedMsg, _( "Skip" ), _( "Add Anyway" ),
addDuplicates = OKOrCancelDialog( wxGetTopLevelParent( this ), _( "Warning: Duplicate Nickname" ),
wxString::Format( _( "A library nicknamed '%s' already exists." ),
nickname ),
_( "One of the nicknames will need to be changed after adding "
"this library." ),
_( "Skip" ), _( "Add Anyway" ),
&applyToAll ) == wxID_CANCEL;
}

View File

@ -52,11 +52,11 @@ PANEL_TEMPLATE_FIELDNAMES::PANEL_TEMPLATE_FIELDNAMES( wxWindow* aWindow,
m_global = true;
m_templateMgr = &m_templateMgrInstance;
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg && !cfg->m_Drawing.field_names.IsEmpty() )
m_templateMgr->AddTemplateFieldNames( cfg->m_Drawing.field_names );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
if( !cfg->m_Drawing.field_names.IsEmpty() )
m_templateMgr->AddTemplateFieldNames( cfg->m_Drawing.field_names );
}
}
m_addFieldButton->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
@ -292,10 +292,7 @@ bool PANEL_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
if( m_global )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( cfg )
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
// Save global fieldname templates
STRING_FORMATTER sf;

View File

@ -163,8 +163,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
void OnKifaceEnd() override;
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
int aCtlBits = 0 ) override
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
{
switch( aClassId )
{
@ -184,10 +183,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
}
case FRAME_SCH_SYMBOL_EDITOR:
{
SYMBOL_EDIT_FRAME* frame = new SYMBOL_EDIT_FRAME( aKiway, aParent );
return frame;
}
return new SYMBOL_EDIT_FRAME( aKiway, aParent );
case FRAME_SIMULATOR:
{
@ -205,16 +201,10 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
}
case FRAME_SCH_VIEWER:
{
SYMBOL_VIEWER_FRAME* frame = new SYMBOL_VIEWER_FRAME( aKiway, aParent );
return frame;
}
return new SYMBOL_VIEWER_FRAME( aKiway, aParent );
case FRAME_SYMBOL_CHOOSER:
{
SYMBOL_CHOOSER_FRAME* frame = new SYMBOL_CHOOSER_FRAME( aKiway, aParent );
return frame;
}
return new SYMBOL_CHOOSER_FRAME( aKiway, aParent );
case DIALOG_SCH_LIBRARY_TABLE:
InvokeSchEditSymbolLibTable( aKiway, aParent );
@ -227,17 +217,11 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
return nullptr;
case PANEL_SYM_DISP_OPTIONS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
return new PANEL_SYM_DISPLAY_OPTIONS( aParent, cfg );
}
return new PANEL_SYM_DISPLAY_OPTIONS( aParent, GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) );
case PANEL_SYM_EDIT_GRIDS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
APP_SETTINGS_BASE* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
if( !frame )
@ -270,9 +254,8 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
case PANEL_SYM_TOOLBARS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
TOOLBAR_SETTINGS* tb = mgr.GetToolbarSettings<SYMBOL_EDIT_TOOLBAR_SETTINGS>( "symbol_editor-toolbars" );
APP_SETTINGS_BASE* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
TOOLBAR_SETTINGS* tb = GetToolbarSettings<SYMBOL_EDIT_TOOLBAR_SETTINGS>( "symbol_editor-toolbars" );
std::vector<TOOL_ACTION*> actions;
std::vector<ACTION_TOOLBAR_CONTROL*> controls;
@ -290,17 +273,11 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
return new PANEL_SYM_COLOR_SETTINGS( aParent );
case PANEL_SCH_DISP_OPTIONS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, cfg );
}
return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) );
case PANEL_SCH_GRIDS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false );
if( !frame )
@ -332,17 +309,12 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
}
case PANEL_SCH_ANNO_OPTIONS:
{
EDA_BASE_FRAME* schSettingsProvider = aKiway->Player( FRAME_SCH, false );
return new PANEL_EESCHEMA_ANNOTATION_OPTIONS( aParent, schSettingsProvider );
}
return new PANEL_EESCHEMA_ANNOTATION_OPTIONS( aParent, aKiway->Player( FRAME_SCH, false ) );
case PANEL_SCH_TOOLBARS:
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
TOOLBAR_SETTINGS* tb = mgr.GetToolbarSettings<SCH_EDIT_TOOLBAR_SETTINGS>( "eeschema-toolbars" );
APP_SETTINGS_BASE* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
TOOLBAR_SETTINGS* tb = GetToolbarSettings<SCH_EDIT_TOOLBAR_SETTINGS>( "eeschema-toolbars" );
std::vector<TOOL_ACTION*> actions;
std::vector<ACTION_TOOLBAR_CONTROL*> controls;

View File

@ -52,7 +52,7 @@
/// Helper for all the old plotting/printing code while it still exists
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
{
return Pgm().GetSettingsManager().GetColorSettings()->GetColor( aLayer );
return ::GetColorSettings( DEFAULT_THEME )->GetColor( aLayer );
}

View File

@ -205,7 +205,7 @@ void EESCHEMA_JOBS_HANDLER::InitRenderSettings( SCH_RENDER_SETTINGS* aRenderSett
const wxString& aTheme, SCHEMATIC* aSch,
const wxString& aDrawingSheetOverride )
{
COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings( aTheme );
COLOR_SETTINGS* cs = ::GetColorSettings( aTheme );
aRenderSettings->LoadColors( cs );
aRenderSettings->m_ShowHiddenPins = false;
aRenderSettings->m_ShowHiddenFields = false;
@ -282,14 +282,8 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
if( font.IsEmpty() )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg =
dynamic_cast<EESCHEMA_SETTINGS*>( mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) );
if( cfg )
font = cfg->m_Appearance.default_font;
else
font = KICAD_FONT_NAME;
EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
font = cfg ? cfg->m_Appearance.default_font : wxString( KICAD_FONT_NAME );
}
renderSettings->SetDefaultFont( font );
@ -348,6 +342,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
plotOpts.m_plotPages = aPlotJob->m_plotPages;
plotOpts.m_theme = aPlotJob->m_theme;
plotOpts.m_useBackgroundColor = aPlotJob->m_useBackgroundColor;
plotOpts.m_plotHopOver = aPlotJob->m_show_hop_over;
schPlotter->Plot( format, plotOpts, renderSettings.get(), m_reporter );
@ -983,7 +978,7 @@ int EESCHEMA_JOBS_HANDLER::JobSymExportSvg( JOB* aJob )
}
SCH_RENDER_SETTINGS renderSettings;
COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings( svgJob->m_colorTheme );
COLOR_SETTINGS* cs = ::GetColorSettings( svgJob->m_colorTheme );
renderSettings.LoadColors( cs );
renderSettings.SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS );
renderSettings.m_ShowHiddenPins = svgJob->m_includeHiddenPins;

View File

@ -244,6 +244,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
&m_Appearance.show_page_limits, true ) );
m_params.emplace_back( new PARAM<bool>( "appearance.show_hop_over",
&m_Appearance.show_hop_over, false ) );
m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
&m_Appearance.show_sexpr_file_convert_warning, true ) );
@ -544,7 +547,7 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
&m_PlotPanel.color, true ) );
m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
&m_PlotPanel.color_theme, wxT( "user" ) ) );
&m_PlotPanel.color_theme, DEFAULT_THEME ) );
m_params.emplace_back( new PARAM<int>( "plot.format",
&m_PlotPanel.format, 0 ) );
@ -951,12 +954,14 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
COLOR_SETTINGS* cs = mgr.GetMigratedColorSettings();
auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
wxString str;
auto migrateLegacyColor =
[&] ( const std::string& aKey, int aLayerId )
{
wxString str;
if( aCfg->Read( aKey, &str ) )
cs->SetColor( aLayerId, COLOR4D( str ) );
};
if( aCfg->Read( aKey, &str ) )
cs->SetColor( aLayerId, COLOR4D( str ) );
};
migrateLegacyColor( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND );
migrateLegacyColor( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND );
@ -995,9 +1000,11 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
// LibEdit settings were stored with eeschema. If eeschema is the first app to run,
// we need to migrate the LibEdit settings here
SYMBOL_EDITOR_SETTINGS* libedit = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
libedit->MigrateFromLegacy( aCfg );
libedit->Load();
if( SYMBOL_EDITOR_SETTINGS* sym_edit_cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
sym_edit_cfg->MigrateFromLegacy( aCfg );
sym_edit_cfg->Load();
}
return ret;
}

View File

@ -87,6 +87,7 @@ public:
bool show_pin_alt_icons;
bool show_illegal_symbol_lib_dialog;
bool show_page_limits;
bool show_hop_over;
bool show_sexpr_file_convert_warning;
bool show_sheet_filename_case_sensitivity_dialog;
};

View File

@ -138,7 +138,8 @@ static void add_category( const std::string& aCategoryPath, CATEGORY_STORE& aCat
aCategoryStore.insert( aCategoryStore.end(), { aCategoryPath, categoryNode.get() } );
parent_iter->second->push_back( std::move( categoryNode ) );
if( parent_iter != aCategoryStore.end() )
parent_iter->second->push_back( std::move( categoryNode ) );
}
@ -219,11 +220,13 @@ void NL_SCHEMATIC_PLUGIN_IMPL::exportCommandsAndImages()
}
}
wxLogTrace( m_logTrace, wxT( "Inserting command: %s, description: %s, in category: %s" ),
name, description, iter->first );
if( iter != categoryStore.end() )
{
wxLogTrace( m_logTrace, wxT( "Inserting command: %s, description: %s, in category: %s" ),
name, description, iter->first );
iter->second->push_back(
CCommand( std::move( name ), std::move( label ), std::move( description ) ) );
iter->second->push_back( CCommand( name, label, description ) );
}
}
NAV_3D::AddCommandSet( commandSet );
@ -233,7 +236,7 @@ void NL_SCHEMATIC_PLUGIN_IMPL::exportCommandsAndImages()
long NL_SCHEMATIC_PLUGIN_IMPL::GetCameraMatrix( navlib::matrix_t& matrix ) const
{
if( m_view == nullptr )
if( !m_view )
return navlib::make_result_code( navlib::navlib_errc::no_data_available );
m_viewPosition = m_view->GetCenter();
@ -253,7 +256,7 @@ long NL_SCHEMATIC_PLUGIN_IMPL::GetCameraMatrix( navlib::matrix_t& matrix ) const
long NL_SCHEMATIC_PLUGIN_IMPL::GetPointerPosition( navlib::point_t& position ) const
{
if( m_view == nullptr )
if( !m_view )
return navlib::make_result_code( navlib::navlib_errc::no_data_available );
VECTOR2D mouse_pointer = m_viewport2D->GetViewControls()->GetMousePosition();
@ -268,7 +271,7 @@ long NL_SCHEMATIC_PLUGIN_IMPL::GetPointerPosition( navlib::point_t& position ) c
long NL_SCHEMATIC_PLUGIN_IMPL::GetViewExtents( navlib::box_t& extents ) const
{
if( m_view == nullptr )
if( !m_view )
return navlib::make_result_code( navlib::navlib_errc::no_data_available );
double scale = m_viewport2D->GetGAL()->GetWorldScale();
@ -296,14 +299,13 @@ long NL_SCHEMATIC_PLUGIN_IMPL::GetIsViewPerspective( navlib::bool_t& perspective
long NL_SCHEMATIC_PLUGIN_IMPL::SetCameraMatrix( const navlib::matrix_t& matrix )
{
if( m_view == nullptr )
if( !m_view )
return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
long result = 0;
VECTOR2D viewPos( matrix.m4x4[3][0], matrix.m4x4[3][1] );
if( !equals( m_view->GetCenter(), m_viewPosition,
static_cast<VECTOR2D::coord_type>( FLT_EPSILON ) ) )
if( !equals( m_view->GetCenter(), m_viewPosition, static_cast<VECTOR2D::coord_type>( FLT_EPSILON ) ) )
{
m_view->SetCenter( viewPos + m_view->GetCenter() - m_viewPosition );
result = navlib::make_result_code( navlib::navlib_errc::error );
@ -321,7 +323,7 @@ long NL_SCHEMATIC_PLUGIN_IMPL::SetCameraMatrix( const navlib::matrix_t& matrix )
long NL_SCHEMATIC_PLUGIN_IMPL::SetViewExtents( const navlib::box_t& extents )
{
if( m_view == nullptr )
if( !m_view )
return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
long result = 0;
@ -356,7 +358,7 @@ long NL_SCHEMATIC_PLUGIN_IMPL::SetViewFrustum( const navlib::frustum_t& frustum
long NL_SCHEMATIC_PLUGIN_IMPL::GetModelExtents( navlib::box_t& extents ) const
{
if( m_view == nullptr )
if( !m_view )
return navlib::make_result_code( navlib::navlib_errc::no_data_available );
BOX2I box = static_cast<SCH_BASE_FRAME*>( m_viewport2D->GetParent() )->GetDocumentExtents();
@ -424,7 +426,7 @@ long NL_SCHEMATIC_PLUGIN_IMPL::SetActiveCommand( std::string commandId )
context = action;
}
if( context != nullptr )
if( context )
{
wxWindow* parent = m_viewport2D->GetParent();

View File

@ -131,16 +131,14 @@ void PIN_LAYOUT_CACHE::recomputeExtentsCache( bool aDefinitelyDirty, KIFONT::FON
VECTOR2D fontSize( aSize, aSize );
int penWidth = GetPenSizeForNormal( aSize );
aCache.m_Extents =
aFont->StringBoundaryLimits( aText, fontSize, penWidth, false, false, aFontMetrics );
aCache.m_Extents = aFont->StringBoundaryLimits( aText, fontSize, penWidth, false, false, aFontMetrics );
}
void PIN_LAYOUT_CACHE::recomputeCaches()
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
KIFONT::FONT* font = KIFONT::FONT::GetFont( cfg->m_Appearance.default_font );
EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
KIFONT::FONT* font = KIFONT::FONT::GetFont( cfg ? cfg->m_Appearance.default_font : wxString( "" ) );
const KIFONT::METRICS& metrics = m_pin.GetFontMetrics();
// Due to the fact a shadow text in position INSIDE or OUTSIDE is drawn left or right aligned,
@ -156,15 +154,13 @@ void PIN_LAYOUT_CACHE::recomputeCaches()
{
const bool dirty = isDirty( DIRTY_FLAGS::NUMBER );
const wxString number = m_pin.GetShownNumber();
recomputeExtentsCache( dirty, font, m_pin.GetNumberTextSize(), number, metrics,
m_numExtentsCache );
recomputeExtentsCache( dirty, font, m_pin.GetNumberTextSize(), number, metrics, m_numExtentsCache );
}
{
const bool dirty = isDirty( DIRTY_FLAGS::NAME );
const wxString name = m_pin.GetShownName();
recomputeExtentsCache( dirty, font, m_pin.GetNameTextSize(), name, metrics,
m_nameExtentsCache );
recomputeExtentsCache( dirty, font, m_pin.GetNameTextSize(), name, metrics, m_nameExtentsCache );
}
{

View File

@ -139,17 +139,18 @@ bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting
painter->SetSchematic( &m_parent->Schematic() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
SCH_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
COLOR_SETTINGS* cs = ::GetColorSettings( cfg ? cfg->m_Printing.color_theme : DEFAULT_THEME );
SCH_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
// Target paper size
wxRect pageSizePix;
wxSize dcPPI = dc->GetPPI();
if( aForPrinting )
{
pageSizePix = GetLogicalPageRect();
}
else
{
dc->SetUserScale( 1, 1 );
@ -188,17 +189,17 @@ bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting
// Set the color scheme
dstSettings->LoadColors( m_parent->GetColorSettings( false ) );
if( cfg->m_Printing.use_theme && theme )
dstSettings->LoadColors( theme );
if( cfg && cfg->m_Printing.use_theme )
dstSettings->LoadColors( cs );
bool printDrawingSheet = cfg->m_Printing.title_block;
bool printDrawingSheet = cfg ? cfg->m_Printing.title_block : true;
COLOR4D bgColor = m_parent->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
if( cfg->m_Printing.background )
if( cfg && cfg->m_Printing.background )
{
if( cfg->m_Printing.use_theme && theme )
bgColor = theme->GetColor( LAYER_SCHEMATIC_BACKGROUND );
if( cfg->m_Printing.use_theme )
bgColor = cs->GetColor( LAYER_SCHEMATIC_BACKGROUND );
}
else
{
@ -212,9 +213,9 @@ bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting
dstSettings->SetLayerColor( LAYER_DRAWINGSHEET,
dstSettings->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );
dstSettings->SetDefaultFont( cfg->m_Appearance.default_font );
dstSettings->SetDefaultFont( cfg ? cfg->m_Appearance.default_font : wxString( "" ) );
if( cfg->m_Printing.monochrome )
if( cfg && cfg->m_Printing.monochrome )
{
for( int i = 0; i < LAYER_ID_COUNT; ++i )
dstSettings->SetLayerColor( i, COLOR4D::BLACK );

View File

@ -152,12 +152,12 @@ APP_SETTINGS_BASE* SCH_BASE_FRAME::GetViewerSettingsBase() const
{
case FRAME_SCH:
default:
return Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
return GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
case FRAME_SCH_SYMBOL_EDITOR:
case FRAME_SCH_VIEWER:
case FRAME_SYMBOL_CHOOSER:
return Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
return GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
}
}
@ -561,22 +561,19 @@ COLOR_SETTINGS* SCH_BASE_FRAME::GetColorSettings( bool aForceRefresh ) const
{
if( !m_colorSettings || aForceRefresh )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
wxString colorTheme = cfg->m_ColorTheme;
EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
wxString colorTheme = cfg ? cfg->m_ColorTheme : wxString( "" );
if( IsType( FRAME_SCH_SYMBOL_EDITOR ) )
{
SYMBOL_EDITOR_SETTINGS* symCfg =
mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( !symCfg->m_UseEeschemaColorSettings )
colorTheme = symCfg->m_ColorTheme;
if( SYMBOL_EDITOR_SETTINGS* sym_edit_cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
if( !sym_edit_cfg->m_UseEeschemaColorSettings )
colorTheme = sym_edit_cfg->m_ColorTheme;
}
}
COLOR_SETTINGS* colorSettings = mgr.GetColorSettings( colorTheme );
const_cast<SCH_BASE_FRAME*>( this )->m_colorSettings = colorSettings;
const_cast<SCH_BASE_FRAME*>( this )->m_colorSettings = ::GetColorSettings( colorTheme );
}
return m_colorSettings;

View File

@ -232,6 +232,20 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
if( enteredGroup )
Modify( enteredGroup );
// Handle wires with Hop Over shapes:
for( COMMIT_LINE& ent : m_changes )
{
SCH_ITEM* schCopyItem = dynamic_cast<SCH_ITEM*>( ent.m_copy );
SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( ent.m_item );
if( schCopyItem && schCopyItem->Type() == SCH_LINE_T )
frame->UpdateHopOveredWires( schCopyItem );
if( schItem && schItem->Type() == SCH_LINE_T )
frame->UpdateHopOveredWires( schItem );
}
for( COMMIT_LINE& ent : m_changes )
{
SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( ent.m_item );

View File

@ -63,12 +63,10 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
m_painter.reset( new KIGFX::SCH_PAINTER( m_gal ) );
COLOR_SETTINGS* cs = nullptr;
COLOR_SETTINGS* cs = ::GetColorSettings( DEFAULT_THEME );
if( auto frame = dynamic_cast<SCH_BASE_FRAME*>( GetParentEDAFrame() ) )
if( SCH_BASE_FRAME* frame = dynamic_cast<SCH_BASE_FRAME*>( GetParentEDAFrame() ) )
cs = frame->GetColorSettings();
else
cs = Pgm().GetSettingsManager().GetColorSettings();
wxASSERT( cs );
m_painter->GetSettings()->LoadColors( cs );

View File

@ -193,7 +193,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
setupUIConditions();
ReCreateMenuBar();
m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings<SCH_EDIT_TOOLBAR_SETTINGS>( "eeschema-toolbars" );
m_toolbarSettings = GetToolbarSettings<SCH_EDIT_TOOLBAR_SETTINGS>( "eeschema-toolbars" );
configureToolbars();
RecreateToolbars();
@ -1906,24 +1906,25 @@ void SCH_EDIT_FRAME::CommonSettingsChanged( int aFlags )
ShowAllIntersheetRefs( settings.m_IntersheetRefsShow );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
GetRenderSettings()->SetDefaultFont( cfg->m_Appearance.default_font );
KIGFX::VIEW* view = GetCanvas()->GetView();
view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
KIGFX::VIEW* view = GetCanvas()->GetView();
view->SetLayerVisible( LAYER_ERC_ERR, cfg->m_Appearance.show_erc_errors );
view->SetLayerVisible( LAYER_ERC_WARN, cfg->m_Appearance.show_erc_warnings );
view->SetLayerVisible( LAYER_ERC_EXCLUSION, cfg->m_Appearance.show_erc_exclusions );
view->SetLayerVisible( LAYER_OP_VOLTAGES, cfg->m_Appearance.show_op_voltages );
view->SetLayerVisible( LAYER_OP_CURRENTS, cfg->m_Appearance.show_op_currents );
RefreshOperatingPointDisplay();
RefreshOperatingPointDisplay();
settings.m_TemplateFieldNames.DeleteAllFieldNameTemplates( true /* global */ );
settings.m_TemplateFieldNames.DeleteAllFieldNameTemplates( true /* global */ );
if( !cfg->m_Drawing.field_names.IsEmpty() )
settings.m_TemplateFieldNames.AddTemplateFieldNames( cfg->m_Drawing.field_names );
if( !cfg->m_Drawing.field_names.IsEmpty() )
settings.m_TemplateFieldNames.AddTemplateFieldNames( cfg->m_Drawing.field_names );
}
SCH_SCREEN* screen = GetCurrentSheet().LastScreen();

View File

@ -609,6 +609,8 @@ public:
* @param aItem The junction to delete
*/
void DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aItem );
void UpdateHopOveredWires( SCH_ITEM* aItem );
void FlipBodyStyle( SCH_SYMBOL* aSymbol );

View File

@ -304,9 +304,12 @@ void SCH_EASYEDAPRO_PARSER::ApplyAttrToField( const std::map<wxString, nlohmann:
EDA_TEXT* text = static_cast<EDA_TEXT*>( field );
text->SetText( ResolveFieldVariables( aAttr.value, aDeviceAttributes ) );
text->SetVisible( aAttr.keyVisible || aAttr.valVisible );
field->SetNameShown( aAttr.keyVisible );
if( aIsSym )
{
text->SetVisible( aAttr.keyVisible || aAttr.valVisible );
field->SetNameShown( aAttr.keyVisible );
}
if( aAttr.position )
{
@ -314,7 +317,8 @@ void SCH_EASYEDAPRO_PARSER::ApplyAttrToField( const std::map<wxString, nlohmann:
: ScalePosSym( *aAttr.position ) );
}
ApplyFontStyle( fontStyles, text, aAttr.fontStyle );
if( aIsSym )
ApplyFontStyle( fontStyles, text, aAttr.fontStyle );
auto parent = aParent;
if( parent && parent->Type() == SCH_SYMBOL_T )
@ -1202,6 +1206,14 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
for( SCH_PIN* pin : schSym->GetAllLibPins() )
pin->SetName( globalNetAttr->value );
}
else if( auto nameAttr = get_opt( attributes, "Name" ) )
{
ApplyAttrToField( fontStyles, schSym->GetField( FIELD_T::VALUE ),
*nameAttr, false, true, compAttrs, schSym.get() );
for( SCH_PIN* pin : schSym->GetAllLibPins() )
pin->SetName( nameAttr->value );
}
else
{
SCH_FIELD* valueField = schSym->GetField( FIELD_T::VALUE );

View File

@ -29,19 +29,13 @@
#include <sch_connection.h>
#include <sch_group.h>
#include <sch_rule_area.h>
#include <sch_item.h>
#include <sch_screen.h>
#include <sch_sheet_path.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <schematic.h>
#include <symbol.h>
#include <connection_graph.h>
#include <trace_helpers.h>
#include <general.h>
#include <netclass.h>
#include <project/project_file.h>
#include <project/net_settings.h>
#include <font/kicad_font_name.h>
// Rendering fonts is expensive (particularly when using outline fonts). At small effective
@ -576,10 +570,11 @@ int SCH_ITEM::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
const wxString& SCH_ITEM::GetDefaultFont() const
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
static wxString defaultName = KICAD_FONT_NAME;
return cfg->m_Appearance.default_font;
EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
return cfg ? cfg->m_Appearance.default_font : defaultName;
}

View File

@ -1009,6 +1009,165 @@ double SCH_LINE::Similarity( const SCH_ITEM& aOther ) const
}
bool SCH_LINE::ShouldHopOver( const SCH_LINE* aLine ) const
{
// try to find if this should hop over aLine. Horizontal wires have preference for hop.
bool isMeVertical = ( m_end.x == m_start.x );
bool isCandidateVertical = ( aLine->GetEndPoint().x == aLine->GetStartPoint().x );
// Vertical vs. Horizontal: Horizontal should hop
if( isMeVertical && !isCandidateVertical )
return false;
if( isCandidateVertical && !isMeVertical )
return true;
// Both this and aLine have a slope. Try to find the best candidate
double slopeMe = ( m_end.y - m_start.y ) / (double) ( m_end.x - m_start.x );
double slopeCandidate = ( aLine->GetEndPoint().y - aLine->GetStartPoint().y )
/ (double) ( aLine->GetEndPoint().x - aLine->GetStartPoint().x );
if( fabs( slopeMe ) == fabs( slopeCandidate ) ) // Can easily happen with 45 deg wires
return slopeMe < slopeCandidate; // signs are certainly different
return fabs( slopeMe ) < fabs( slopeCandidate ); // The shallower line should hop
}
std::vector<VECTOR3I> SCH_LINE::BuildWireWithHopShape( const SCH_SCREEN* aScreen,
double aArcRadius ) const
{
// Note: Points are VECTOR3D, with Z coord used as flag
// for segments: start point and end point have the Z coord = 0
// for arcs: start point middle point and end point have the Z coord = 1
std::vector<VECTOR3I> wire_shape; // List of coordinates:
// 2 points for a segment, 3 points for an arc
if( !IsWire() )
{
wire_shape.emplace_back( GetStartPoint().x,GetStartPoint().y, 0 );
wire_shape.emplace_back( GetEndPoint().x, GetEndPoint().y, 0 );
return wire_shape;
}
std::vector<SCH_LINE*> existingWires; // wires to test (candidates)
std::vector<VECTOR2I> intersections;
for( SCH_ITEM* item : aScreen->Items().Overlapping( SCH_LINE_T, GetBoundingBox() ) )
{
SCH_LINE* line = static_cast<SCH_LINE*>( item );
if( line->IsWire() )
existingWires.push_back( line );
}
VECTOR2I currentLineStartPoint = GetStartPoint();
VECTOR2I currentLineEndPoint = GetEndPoint();
for( SCH_LINE* existingLine : existingWires )
{
VECTOR2I extLineStartPoint = existingLine->GetStartPoint();
VECTOR2I extLineEndPoint = existingLine->GetEndPoint();
if( extLineStartPoint == currentLineStartPoint && extLineEndPoint == currentLineEndPoint )
continue;
if( !ShouldHopOver( existingLine ) )
continue;
SEG currentSegment = SEG( currentLineStartPoint, currentLineEndPoint );
SEG existingSegment = SEG( extLineStartPoint, extLineEndPoint );
if( OPT_VECTOR2I intersect = currentSegment.Intersect( existingSegment, true, false ) )
{
if( IsEndPoint( *intersect ) || existingLine->IsEndPoint( *intersect ) )
continue;
intersections.push_back( *intersect );
}
}
if( intersections.empty() )
{
wire_shape.emplace_back( currentLineStartPoint.x, currentLineStartPoint.y, 0 );
wire_shape.emplace_back( currentLineEndPoint.x, currentLineEndPoint.y, 0 );
}
else
{
auto getDistance = []( const VECTOR2I& a, const VECTOR2I& b ) -> double
{
return std::sqrt( std::pow( a.x - b.x, 2 ) + std::pow( a.y - b.y, 2 ) );
};
std::sort( intersections.begin(), intersections.end(),
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
return getDistance( GetStartPoint(), a ) < getDistance( GetStartPoint(), b );
} );
VECTOR2I currentStart = GetStartPoint();
double arcRadius = aArcRadius;
for( const VECTOR2I& hopMid : intersections )
{
// Calculate the angle of the line from start point to end point in radians
double lineAngle = std::atan2( GetEndPoint().y - GetStartPoint().y,
GetEndPoint().x - GetStartPoint().x );
// Convert the angle from radians to degrees
double lineAngleDeg = lineAngle * ( 180.0f / M_PI );
// Normalize the angle to be between 0 and 360 degrees
if( lineAngleDeg < 0 )
lineAngleDeg += 360;
double startAngle = lineAngleDeg;
double endAngle = startAngle + 180.0f;
// Adjust the end angle if it exceeds 360 degrees
if( endAngle >= 360.0 )
endAngle -= 360.0;
// Convert start and end angles from degrees to radians
double startAngleRad = startAngle * ( M_PI / 180.0f );
double endAngleRad = endAngle * ( M_PI / 180.0f );
VECTOR2I arcMidPoint = {
hopMid.x + static_cast<int>( arcRadius
* cos( ( startAngleRad + endAngleRad ) / 2.0f ) ),
hopMid.y + static_cast<int>( arcRadius
* sin( ( startAngleRad + endAngleRad ) / 2.0f ) )
};
VECTOR2I beforeHop = hopMid - VECTOR2I( arcRadius * std::cos( lineAngle ),
arcRadius * std::sin( lineAngle ) );
VECTOR2I afterHop = hopMid + VECTOR2I( arcRadius * std::cos( lineAngle ),
arcRadius * std::sin( lineAngle ) );
// Draw the line from the current start point to the before-hop point
wire_shape.emplace_back( currentStart.x, currentStart.y, 0 );
wire_shape.emplace_back( beforeHop.x, beforeHop.y, 0 );
// Create an arc object
SHAPE_ARC arc( beforeHop, arcMidPoint, afterHop, 0 );
wire_shape.emplace_back( beforeHop.x, beforeHop.y, 1 );
wire_shape.emplace_back( arcMidPoint.x, arcMidPoint.y, 1 );
wire_shape.emplace_back( afterHop.x, afterHop.y, 1 );
currentStart = afterHop;
}
// Draw the final line from the current start point to the end point of the original line
wire_shape.emplace_back( currentStart. x,currentStart.y, 0 );
wire_shape.emplace_back( GetEndPoint().x, GetEndPoint().y, 0 );
}
return wire_shape;
}
static struct SCH_LINE_DESC
{
SCH_LINE_DESC()

View File

@ -29,6 +29,7 @@
#include <wx/pen.h> // for wxPenStyle
#include <list> // for std::list
#include <geometry/seg.h>
#include <math/vector3.h>
class NETLIST_OBJECT_LIST;
@ -260,6 +261,24 @@ public:
bool IsParallel( const SCH_LINE* aLine ) const;
/**
* For wires only:
* @return true if a wire can accept a hop over arc shape
* (when 2 wires are crossing, only one must accept the hop over arc)
*/
bool ShouldHopOver( const SCH_LINE* aLine ) const;
/**
* For wires only: build the list of points to draw the shape using segments and 180 deg arcs
* Points are VECTOR3D, with Z coord used as flag:
* for segments: start point and end point have the Z coord = 0
* for arcs (hop over): start point middle point and end point have the Z coord = 1
* @return the list of points
* @param aScreen is the current screen to draw/plot
* @param aArcRadius is the radius of the hop over arc
*/
std::vector<VECTOR3I> BuildWireWithHopShape( const SCH_SCREEN* aScreen, double aArcRadius ) const;
void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,

View File

@ -328,8 +328,7 @@ SCH_LAYER_ID SCH_MARKER::GetColorLayer() const
KIGFX::COLOR4D SCH_MARKER::getColor() const
{
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
return colors->GetColor( GetColorLayer() );
return ::GetColorSettings( DEFAULT_THEME )->GetColor( GetColorLayer() );
}

View File

@ -1364,9 +1364,11 @@ void SCH_PAINTER::draw( const SCH_LINE* aLine, int aLayer )
bool highlightNetclassColors = false;
double highlightAlpha = 0.6;
EESCHEMA_SETTINGS* eeschemaCfg = eeconfig();
bool showHopOver = false;
if( eeschemaCfg )
{
showHopOver = eeschemaCfg->m_Appearance.show_hop_over;
highlightNetclassColors = eeschemaCfg->m_Selection.highlight_netclass_colors;
highlightAlpha = eeschemaCfg->m_Selection.highlight_netclass_colors_alpha;
}
@ -1477,26 +1479,57 @@ void SCH_PAINTER::draw( const SCH_LINE* aLine, int aLayer )
return;
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
m_gal->SetStrokeColor( color );
m_gal->SetLineWidth( width );
if( lineStyle <= LINE_STYLE::FIRST_TYPE || drawingShadows )
{
m_gal->DrawLine( aLine->GetStartPoint(), aLine->GetEndPoint() );
}
double lineWidth = getLineWidth( aLine, drawingShadows, drawingNetColorHighlights );
double arcRadius = lineWidth * ADVANCED_CFG::GetCfg().m_hopOverArcRadius;
std::vector<VECTOR3I> curr_wire_shape;
if( aLine->IsWire() && showHopOver )
curr_wire_shape = aLine->BuildWireWithHopShape( m_schematic->GetCurrentScreen(), arcRadius );
else
{
SHAPE_SEGMENT line( aLine->GetStartPoint(), aLine->GetEndPoint() );
curr_wire_shape.emplace_back( aLine->GetStartPoint().x, aLine->GetStartPoint().y, 0 );
curr_wire_shape.emplace_back( aLine->GetEndPoint().x, aLine->GetEndPoint().y, 0 );
}
STROKE_PARAMS::Stroke( &line, lineStyle, KiROUND( width ), &m_schSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
// DrawLine has problem with 0 length lines so enforce minimum
if( a == b )
m_gal->DrawLine( a+1, b );
else
m_gal->DrawLine( a, b );
} );
for( size_t ii = 1; ii < curr_wire_shape.size(); ii++ )
{
VECTOR2I start( curr_wire_shape[ii-1].x, curr_wire_shape[ii-1].y );
if( curr_wire_shape[ii-1].z == 0 ) // This is the start point of a segment
// there are always 2 points in list for a segment
{
VECTOR2I end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
drawLine( start, end, lineStyle,
( lineStyle <= LINE_STYLE::FIRST_TYPE || drawingShadows ), width );
}
else // This is the start point of a arc. there are always 3 points in list for an arc
{
// Hop are a small arc, so use a solid line style gives best results
VECTOR2I arc_middle( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
ii++;
VECTOR2I arc_end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
ii++;
VECTOR2D dstart = start;
VECTOR2D dmid = arc_middle;
VECTOR2D dend = arc_end;
VECTOR2D center = CalcArcCenter( dstart, dmid, dend );
EDA_ANGLE startAngle( dstart - center );
EDA_ANGLE midAngle( dmid - center );
EDA_ANGLE endAngle( dend - center );
EDA_ANGLE angle1 = midAngle - startAngle;
EDA_ANGLE angle2 = endAngle - midAngle;
EDA_ANGLE angle = angle1.Normalize180() + angle2.Normalize180();
m_gal->DrawArc( center, ( dstart - center ).EuclideanNorm(), startAngle, angle );
}
}
}
@ -3112,4 +3145,26 @@ void SCH_PAINTER::draw( const SCH_GROUP* aGroup, int aLayer )
}
}
void SCH_PAINTER::drawLine( const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint,
LINE_STYLE aLineStyle, bool aDrawDirectLine, int aWidth )
{
if( aDrawDirectLine )
{
m_gal->DrawLine( aStartPoint, aEndPoint );
}
else
{
SHAPE_SEGMENT segment( aStartPoint, aEndPoint );
STROKE_PARAMS::Stroke( &segment, aLineStyle, KiROUND( aWidth ), &m_schSettings,
[&]( const VECTOR2I& start, const VECTOR2I& end )
{
if( start == end )
m_gal->DrawLine( start + 1, end );
else
m_gal->DrawLine( start, end );
} );
}
}
}; // namespace KIGFX

View File

@ -140,6 +140,9 @@ private:
wxString expandLibItemTextVars( const wxString& aSourceText, const SCH_SYMBOL* aSymbolContext );
void drawLine( const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint, LINE_STYLE aLineStyle,
bool aDrawDirectLine = false, int aWidth = 0 );
public:
static std::vector<KICAD_T> g_ScaledSelectionTypes;

View File

@ -101,32 +101,22 @@ SCH_PIN::SCH_PIN( LIB_SYMBOL* aParentSymbol ) :
SCH_ITEM( aParentSymbol, SCH_PIN_T, 0, 0 ),
m_libPin( nullptr ),
m_position( { 0, 0 } ),
m_length( schIUScale.MilsToIU( DEFAULT_PIN_LENGTH ) ),
m_orientation( PIN_ORIENTATION::PIN_RIGHT ),
m_shape( GRAPHIC_PINSHAPE::LINE ),
m_type( ELECTRICAL_PINTYPE::PT_UNSPECIFIED ),
m_hidden( false ),
m_numTextSize( schIUScale.MilsToIU( DEFAULT_PINNUM_SIZE ) ),
m_nameTextSize( schIUScale.MilsToIU( DEFAULT_PINNAME_SIZE ) ),
m_isDangling( true ),
m_layoutCache( std::make_unique<PIN_LAYOUT_CACHE>( *this ) )
{
// Use the application settings for pin sizes if exists.
// pgm can be nullptr when running a shared lib from a script, not from a kicad appl
PGM_BASE* pgm = PgmOrNull();
if( pgm )
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
SETTINGS_MANAGER& mgr = pgm->GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
m_length = schIUScale.MilsToIU( cfg->m_Defaults.pin_length );
m_numTextSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_num_size );
m_nameTextSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_name_size );
}
else // Use hardcoded eeschema defaults: symbol_editor settings are not existing.
{
m_length = schIUScale.MilsToIU( DEFAULT_PIN_LENGTH );
m_numTextSize = schIUScale.MilsToIU( DEFAULT_PINNUM_SIZE );
m_nameTextSize = schIUScale.MilsToIU( DEFAULT_PINNAME_SIZE );
}
m_layer = LAYER_DEVICE;
}

View File

@ -881,9 +881,7 @@ wxFileName SCH_PLOTTER::createPlotFileName( const SCH_PLOT_OPTS& aPlotOpts,
void SCH_PLOTTER::Plot( PLOT_FORMAT aPlotFormat, const SCH_PLOT_OPTS& aPlotOpts,
SCH_RENDER_SETTINGS* aRenderSettings, REPORTER* aReporter )
{
SETTINGS_MANAGER& settingsMgr = Pgm().GetSettingsManager();
m_colorSettings = settingsMgr.GetColorSettings( aPlotOpts.m_theme );
m_colorSettings = ::GetColorSettings( aPlotOpts.m_theme );
switch( aPlotFormat )
{

View File

@ -57,6 +57,7 @@ struct SCH_PLOT_OPTS
bool m_plotDrawingSheet;
std::vector<wxString> m_plotPages;
bool m_plotHopOver;
bool m_blackAndWhite;
int m_pageSizeSelect;
bool m_useBackgroundColor;
@ -71,6 +72,7 @@ struct SCH_PLOT_OPTS
SCH_PLOT_OPTS() :
m_plotAll( true ),
m_plotDrawingSheet( true ),
m_plotHopOver( false ),
m_blackAndWhite( false ),
m_pageSizeSelect( 0 ),
m_useBackgroundColor( true ),

View File

@ -55,7 +55,7 @@ SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL( wxWindow* aParentWindow, wxWindowID aWindo
m_painter.reset( new KIGFX::SCH_PAINTER( m_gal ) );
SCH_RENDER_SETTINGS* renderSettings = GetRenderSettings();
renderSettings->LoadColors( Pgm().GetSettingsManager().GetColorSettings() );
renderSettings->LoadColors( ::GetColorSettings( DEFAULT_THEME ) );
renderSettings->m_ShowPinsElectricalType = false;
renderSettings->m_ShowPinNumbers = false;
renderSettings->m_TextOffsetRatio = 0.35;

View File

@ -198,21 +198,22 @@ wxString SCH_RULE_AREA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool
}
void SCH_RULE_AREA::ResetCaches( KIGFX::SCH_VIEW* view )
void SCH_RULE_AREA::resetCaches()
{
// Save the current state
m_prev_items = m_items;
m_prev_directives = m_directives;
m_prev_items = m_itemIDs;
m_prev_directives = m_directiveIDs;
// Reset the rule area
clearContainedItems();
clearDirectives( view );
// Do NOT assume these pointers are valid.
m_items.clear();
m_itemIDs.clear();
m_directives.clear();
m_directiveIDs.clear();
}
void SCH_RULE_AREA::RefreshContainedItemsAndDirectives(
SCH_SCREEN* screen, KIGFX::SCH_VIEW* view,
std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>& forceUpdateRuleAreas )
void SCH_RULE_AREA::RefreshContainedItemsAndDirectives( SCH_SCREEN* screen )
{
EE_RTREE& items = screen->Items();
const BOX2I boundingBox = GetBoundingBox();
@ -228,13 +229,9 @@ void SCH_RULE_AREA::RefreshContainedItemsAndDirectives(
assert( labelConnectionPoints.size() == 1 );
if( GetPolyShape().CollideEdge( labelConnectionPoints[0], nullptr, 5 ) )
addDirective( label, view );
addDirective( label );
}
// If directives have changed, we need to force an update of the contained items connectivity
if( m_directives != m_prev_directives )
forceUpdateRuleAreas.push_back( { this, screen } );
// Next find any connectable items which lie within the rule area
EE_RTREE::EE_TYPE ruleAreaItems = items.Overlapping( boundingBox );
@ -280,17 +277,6 @@ void SCH_RULE_AREA::RefreshContainedItemsAndDirectives(
}
std::unordered_set<SCH_ITEM*> SCH_RULE_AREA::GetPastAndPresentContainedItems() const
{
std::unordered_set<SCH_ITEM*> items = m_items;
for( SCH_ITEM* item : m_prev_items )
items.insert( item );
return items;
}
std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>
SCH_RULE_AREA::UpdateRuleAreasInScreens( std::unordered_set<SCH_SCREEN*>& screens,
KIGFX::SCH_VIEW* view )
@ -301,17 +287,26 @@ SCH_RULE_AREA::UpdateRuleAreasInScreens( std::unordered_set<SCH_SCREEN*>& screen
{
// First reset all item caches - must be done first to ensure two rule areas
// on the same item don't overwrite each other's caches
for( SCH_ITEM* ruleAreaAsItem : screen->Items().OfType( SCH_RULE_AREA_T ) )
for( SCH_ITEM* item : screen->Items() )
{
SCH_RULE_AREA* ruleArea = static_cast<SCH_RULE_AREA*>( ruleAreaAsItem );
ruleArea->ResetCaches( view );
if( item->Type() == SCH_RULE_AREA_T )
static_cast<SCH_RULE_AREA*>( item )->resetCaches();
if( item->Type() == SCH_DIRECTIVE_LABEL_T && view )
view->Update( item, KIGFX::REPAINT );
item->ClearRuleAreasCache();
}
// Secondly refresh the contained items
for( SCH_ITEM* ruleAreaAsItem : screen->Items().OfType( SCH_RULE_AREA_T ) )
{
SCH_RULE_AREA* ruleArea = static_cast<SCH_RULE_AREA*>( ruleAreaAsItem );
ruleArea->RefreshContainedItemsAndDirectives( screen, view, forceUpdateRuleAreas );
ruleArea->RefreshContainedItemsAndDirectives( screen );
if( ruleArea->m_directiveIDs != ruleArea->m_prev_directives )
forceUpdateRuleAreas.push_back( { ruleArea, screen } );
}
}
@ -331,6 +326,12 @@ const std::unordered_set<SCH_DIRECTIVE_LABEL*>& SCH_RULE_AREA::GetDirectives() c
}
const std::unordered_set<KIID>& SCH_RULE_AREA::GetPastContainedItems() const
{
return m_prev_items;
}
const std::vector<std::pair<wxString, SCH_ITEM*>> SCH_RULE_AREA::GetResolvedNetclasses() const
{
std::vector<std::pair<wxString, SCH_ITEM*>> resolvedNetclasses;
@ -362,19 +363,6 @@ const std::vector<std::pair<wxString, SCH_ITEM*>> SCH_RULE_AREA::GetResolvedNetc
}
void SCH_RULE_AREA::ResetDirectivesAndItems( KIGFX::SCH_VIEW* view )
{
for( SCH_DIRECTIVE_LABEL* label : m_directives )
{
label->ClearConnectedRuleAreas();
view->Update( label, KIGFX::REPAINT );
}
for( SCH_ITEM* item : m_items )
item->ClearRuleAreasCache();
}
void SCH_RULE_AREA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
aList.emplace_back( _( "Rule Area" ), wxEmptyString );
@ -396,27 +384,11 @@ void SCH_RULE_AREA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PAN
}
void SCH_RULE_AREA::addDirective( SCH_DIRECTIVE_LABEL* label, KIGFX::SCH_VIEW* view )
void SCH_RULE_AREA::addDirective( SCH_DIRECTIVE_LABEL* label )
{
label->AddConnectedRuleArea( this );
m_directives.insert( label );
if( view )
view->Update( label, KIGFX::REPAINT );
}
void SCH_RULE_AREA::clearDirectives( KIGFX::SCH_VIEW* view )
{
for( SCH_DIRECTIVE_LABEL* label : m_directives )
{
label->ClearConnectedRuleAreas();
if( view )
view->Update( label, KIGFX::REPAINT );
}
m_directives.clear();
m_directiveIDs.insert( label->m_Uuid );
}
@ -424,15 +396,7 @@ void SCH_RULE_AREA::addContainedItem( SCH_ITEM* item )
{
item->AddRuleAreaToCache( this );
m_items.insert( item );
}
void SCH_RULE_AREA::clearContainedItems()
{
for( SCH_ITEM* item : m_items )
item->ClearRuleAreasCache();
m_items.clear();
m_itemIDs.insert( item->m_Uuid );
}

View File

@ -41,8 +41,11 @@ class SCH_RULE_AREA : public SCH_SHAPE
{
public:
SCH_RULE_AREA() :
SCH_SHAPE( SHAPE_T::POLY, LAYER_RULE_AREAS, 0 /* line width */, FILL_T::NO_FILL,
SCH_RULE_AREA_T )
SCH_SHAPE( SHAPE_T::POLY, LAYER_RULE_AREAS, 0 /* line width */, FILL_T::NO_FILL, SCH_RULE_AREA_T ),
m_excludedFromSim( false ),
m_excludedFromBOM( false ),
m_excludedFromBoard( false ),
m_DNP( false )
{
SetLayer( LAYER_RULE_AREAS );
}
@ -93,16 +96,8 @@ public:
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
/// Reset all item and directive caches, saving the current state first.
void ResetCaches( KIGFX::SCH_VIEW* view );
/// Refresh the list of items which this rule area affects.
void RefreshContainedItemsAndDirectives(
SCH_SCREEN* screen, KIGFX::SCH_VIEW* view,
std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>& forceUpdateRuleAreas );
/// Fetch all items which were, or are, within the rule area.
std::unordered_set<SCH_ITEM*> GetPastAndPresentContainedItems() const;
void RefreshContainedItemsAndDirectives( SCH_SCREEN* screen );
/// Update all rule area connectvity / caches in the given sheet paths.
///
@ -113,6 +108,8 @@ public:
/// Return a set of all items contained within the rule area.
const std::unordered_set<SCH_ITEM*>& GetContainedItems() const;
const std::unordered_set<KIID>& GetPastContainedItems() const;
/// Return the set of all directive labels attached to the rule area border.
const std::unordered_set<SCH_DIRECTIVE_LABEL*>& GetDirectives() const;
@ -121,24 +118,18 @@ public:
/// @return The resolved netclass (if any), and the SCH_ITEM providing the declaration.
const std::vector<std::pair<wxString, SCH_ITEM*>> GetResolvedNetclasses() const;
/// Clear and resets items and directives attached to this rule area.
void ResetDirectivesAndItems( KIGFX::SCH_VIEW* view );
/// Get the message panel info for the rule area.
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
protected:
/// Add a directive label which applies to items within ths rule area.
void addDirective( SCH_DIRECTIVE_LABEL* label, KIGFX::SCH_VIEW* view );
/// Clear the list of directives.
void clearDirectives( KIGFX::SCH_VIEW* view );
void addDirective( SCH_DIRECTIVE_LABEL* label );
/// Add an item to the list of items which this rule area affects.
void addContainedItem( SCH_ITEM* item );
/// Clear the list of items which this rule area affects.
void clearContainedItems();
/// Reset all item and directive caches, saving the current state first.
void resetCaches();
protected:
bool m_excludedFromSim;
@ -148,15 +139,17 @@ protected:
/// All #SCH_ITEM objects currently contained or intersecting the rule area.
std::unordered_set<SCH_ITEM*> m_items;
std::unordered_set<KIID> m_itemIDs;
/// All #SCH_DIRECTIVE_LABEL objectss attached to the rule area border.
std::unordered_set<SCH_DIRECTIVE_LABEL*> m_directives;
std::unordered_set<KIID> m_directiveIDs;
/// All #SCH_ITEM objectss contained or intersecting the rule area in the previous update.
std::unordered_set<SCH_ITEM*> m_prev_items;
std::unordered_set<KIID> m_prev_items;
/// All SCH_DIRECTIVE_LABEL objects attached to the rule area border in the previous update.
std::unordered_set<SCH_DIRECTIVE_LABEL*> m_prev_directives;
std::unordered_set<KIID> m_prev_directives;
};
#endif

View File

@ -61,10 +61,12 @@
#include <locale_io.h>
#include <algorithm>
#include <math/vector3.h>
// TODO(JE) Debugging only
#include <core/profile.h>
#include "sch_bus_entry.h"
#include "sch_shape.h"
/**
* Flag to enable profiling of the TestDanglingEnds() function.
@ -913,8 +915,53 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter, const SCH_PLOT_OPTS& aPlotOpts ) const
// Plot the foreground items
for( SCH_ITEM* item : other )
{
aPlotter->SetCurrentLineWidth( item->GetEffectivePenWidth( renderSettings ) );
item->Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
double lineWidth = item->GetEffectivePenWidth( renderSettings );
aPlotter->SetCurrentLineWidth( lineWidth );
if( item->Type() != SCH_LINE_T )
item->Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
else
{
SCH_LINE* aLine = static_cast<SCH_LINE*>( item );
if( !aLine->IsWire() || !aPlotOpts.m_plotHopOver )
item->Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
else
{
double arcRadius = lineWidth * ADVANCED_CFG::GetCfg().m_hopOverArcRadius;
std::vector<VECTOR3I> curr_wire_shape = aLine->BuildWireWithHopShape( this, arcRadius );
for( size_t ii = 1; ii < curr_wire_shape.size(); ii++ )
{
VECTOR2I start( curr_wire_shape[ii-1].x, curr_wire_shape[ii-1].y );
if( curr_wire_shape[ii-1].z == 0 ) // This is the start point of a segment
// there are always 2 points in list for a segment
{
VECTOR2I end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
SCH_LINE curr_line( *aLine );
curr_line.SetStartPoint( start );
curr_line.SetEndPoint( end );
curr_line.Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
}
else // This is the start point of a arc. there are always 3 points in list for an arc
{
VECTOR2I arc_middle( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
ii++;
VECTOR2I arc_end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
ii++;
SCH_SHAPE arc( SHAPE_T::ARC, aLine->GetLayer(), lineWidth );
arc.SetArcGeometry( start, arc_middle, arc_end );
// Hop are a small arc, so use a solid line style gives best results
arc.SetLineStyle( LINE_STYLE::SOLID );
arc.Plot( aPlotter, !background, aPlotOpts, 0, 0, { 0, 0 }, false );
}
}
}
}
}
// After plotting the symbols as a group above (in `other`), we need to overplot the pins

View File

@ -1263,7 +1263,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
if( GetDNP() )
{
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
COLOR_SETTINGS* colors = ::GetColorSettings( DEFAULT_THEME );
BOX2I bbox = GetBodyBoundingBox();
BOX2I pins = GetBoundingBox();
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(),

View File

@ -1382,10 +1382,6 @@ void SCHEMATIC::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS a
if( item->Type() == SCH_RULE_AREA_T )
{
SCH_RULE_AREA* ruleArea = static_cast<SCH_RULE_AREA*>( item );
// Clear item and directive associations for this rule area
ruleArea->ResetDirectivesAndItems( aSchView );
changed_rule_areas.insert( { ruleArea, screen } );
}
else if( item->IsConnectable() )
@ -1408,11 +1404,24 @@ void SCHEMATIC::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS a
// If a SCH_RULE_AREA was changed, we need to add all past and present contained items to
// update their connectivity
for( const std::pair<SCH_RULE_AREA*, SCH_SCREEN*>& changedRuleArea : changed_rule_areas )
{
for( SCH_ITEM* containedItem : changedRuleArea.first->GetPastAndPresentContainedItems() )
addItemToChangeSet( { containedItem, nullptr, changedRuleArea.second } );
}
std::map<KIID, EDA_ITEM*> itemMap;
list.FillItemMap( itemMap );
auto addPastAndPresentContainedItems =
[&]( SCH_RULE_AREA* changedRuleArea, SCH_SCREEN* screen )
{
for( const KIID& pastItem : changedRuleArea->GetPastContainedItems() )
{
if( itemMap.contains( pastItem ) )
addItemToChangeSet( { static_cast<SCH_ITEM*>( itemMap[pastItem] ), nullptr, screen } );
}
for( SCH_ITEM* containedItem : changedRuleArea->GetContainedItems() )
addItemToChangeSet( { containedItem, nullptr, screen } );
};
for( const auto& [changedRuleArea, screen] : changed_rule_areas )
addPastAndPresentContainedItems( changedRuleArea, screen );
// Add all changed items, and associated items, to the change set
for( CHANGED_ITEM& changed_item_data : changed_connectable_items )
@ -1436,10 +1445,7 @@ void SCHEMATIC::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS a
std::vector<SHAPE*> borderShapes = ruleArea->MakeEffectiveShapes( true );
if( ruleArea->GetPolyShape().CollideEdge( labelConnectionPoints[0], nullptr, 5 ) )
{
for( SCH_ITEM* containedItem : ruleArea->GetPastAndPresentContainedItems() )
addItemToChangeSet( { containedItem, nullptr, changed_item_data.screen } );
}
addPastAndPresentContainedItems( ruleArea, changed_item_data.screen );
}
}
}

View File

@ -67,8 +67,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
m_MaxError( ARC_LOW_DEF_MM * schIUScale.IU_PER_MM ),
m_NgspiceSettings( nullptr )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
int defaultLineThickness = cfg ? cfg->m_Drawing.default_line_thickness : DEFAULT_LINE_WIDTH_MILS;
int defaultTextSize = cfg ? cfg->m_Drawing.default_text_size : DEFAULT_TEXT_SIZE;
@ -186,12 +185,11 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
}
// Read global fieldname templates
SETTINGS_MANAGER& curr_mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* curr_cfg =
curr_mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
if( curr_cfg && !curr_cfg->m_Drawing.field_names.IsEmpty() )
m_TemplateFieldNames.AddTemplateFieldNames( curr_cfg->m_Drawing.field_names );
if( EESCHEMA_SETTINGS* curr_cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
if( !curr_cfg->m_Drawing.field_names.IsEmpty() )
m_TemplateFieldNames.AddTemplateFieldNames( curr_cfg->m_Drawing.field_names );
}
}, {} ) );
m_params.emplace_back( new PARAM<wxString>( "bom_export_filename",

View File

@ -557,6 +557,21 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
if( connectivityCleanUp == GLOBAL_CLEANUP )
SetSheetNumberAndCount();
// Restore hop over shapes of wires, if any
if( eeconfig()->m_Appearance.show_hop_over )
{
for( SCH_ITEM* item : GetScreen()->Items() )
{
if( item->Type() != SCH_LINE_T )
continue;
SCH_LINE* line = static_cast<SCH_LINE*>( item );
if( line->IsWire() )
UpdateHopOveredWires( line );
}
}
}
// Update the hierarchy navigator when there are sheet changes.

View File

@ -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 ) );
}
}

View File

@ -172,7 +172,7 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// was created.
m_tbTopMain->SetToolManager( m_toolManager );
m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings<SIMULATOR_TOOLBAR_SETTINGS>( "sim-toolbars" );
m_toolbarSettings = GetToolbarSettings<SIMULATOR_TOOLBAR_SETTINGS>( "sim-toolbars" );
configureToolbars();
RecreateToolbars();
ReCreateMenuBar();
@ -290,18 +290,17 @@ void SIMULATOR_FRAME::CommonSettingsChanged( int aFlags )
{
KIWAY_PLAYER::CommonSettingsChanged( aFlags );
auto* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( m_toolManager->GetSettings() );
wxASSERT( cfg != nullptr );
m_ui->ApplyPreferences( cfg->m_Simulator.preferences );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
m_ui->ApplyPreferences( cfg->m_Simulator.preferences );
}
WINDOW_SETTINGS* SIMULATOR_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
{
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
wxASSERT( cfg );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
return &cfg->m_Simulator.window;
return cfg ? &cfg->m_Simulator.window : nullptr;
return nullptr;
}

View File

@ -138,7 +138,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetIcons( icon_bundle );
m_settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
m_settings = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
LoadSettings( m_settings );
m_libMgr = new LIB_SYMBOL_LIBRARY_MANAGER( *this );
@ -181,7 +181,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateMenuBar();
m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings<SYMBOL_EDIT_TOOLBAR_SETTINGS>( "symbol_editor-toolbars" );
m_toolbarSettings = GetToolbarSettings<SYMBOL_EDIT_TOOLBAR_SETTINGS>( "symbol_editor-toolbars" );
configureToolbars();
RecreateToolbars();
@ -304,11 +304,8 @@ SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME()
// current screen is destroyed in EDA_DRAW_FRAME
SetScreen( m_dummyScreen );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( cfg )
mgr.Save( cfg );
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
Pgm().GetSettingsManager().Save( cfg );
delete m_libMgr;
}
@ -362,12 +359,12 @@ APP_SETTINGS_BASE* SYMBOL_EDIT_FRAME::config() const
COLOR_SETTINGS* SYMBOL_EDIT_FRAME::GetColorSettings( bool aForceRefresh ) const
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = GetSettings();
if( GetSettings()->m_UseEeschemaColorSettings )
return mgr.GetColorSettings( mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" )->m_ColorTheme );
else
return mgr.GetColorSettings( GetSettings()->m_ColorTheme );
if( cfg && static_cast<SYMBOL_EDITOR_SETTINGS*>( cfg )->m_UseEeschemaColorSettings )
cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
}
@ -1367,15 +1364,15 @@ void SYMBOL_EDIT_FRAME::CommonSettingsChanged( int aFlags )
{
SCH_BASE_FRAME::CommonSettingsChanged( aFlags );
SETTINGS_MANAGER* mgr = GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr->GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_ShowPinElectricalType;
GetRenderSettings()->m_ShowHiddenPins = cfg->m_ShowHiddenPins;
GetRenderSettings()->m_ShowHiddenFields = cfg->m_ShowHiddenFields;
GetRenderSettings()->m_ShowPinAltIcons = cfg->m_ShowPinAltIcons;
GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_ShowPinElectricalType;
GetRenderSettings()->m_ShowHiddenPins = cfg->m_ShowHiddenPins;
GetRenderSettings()->m_ShowHiddenFields = cfg->m_ShowHiddenFields;
GetRenderSettings()->m_ShowPinAltIcons = cfg->m_ShowPinAltIcons;
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
}
if( m_symbol )
m_symbol->ClearCaches();

View File

@ -661,18 +661,14 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
aTable.Load( fn.GetFullPath() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>( "kicad" );
wxCHECK( settings, false );
wxString packagesPath;
KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" );
wxString packagesPath;
const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
if( std::optional<wxString> v = ENV_VAR::GetVersionedEnvVarValue( vars, wxT( "3RD_PARTY" ) ) )
packagesPath = *v;
if( settings->m_PcmLibAutoAdd )
if( cfg && cfg->m_PcmLibAutoAdd )
{
// Scan for libraries in PCM packages directory
wxFileName d( packagesPath, "" );
@ -680,14 +676,14 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
if( d.DirExists() )
{
PCM_SYM_LIB_TRAVERSER traverser( packagesPath, aTable, settings->m_PcmLibPrefix );
PCM_SYM_LIB_TRAVERSER traverser( packagesPath, aTable, cfg->m_PcmLibPrefix );
wxDir dir( d.GetPath() );
dir.Traverse( traverser );
}
}
if( settings->m_PcmLibAutoRemove )
if( cfg && cfg->m_PcmLibAutoRemove )
{
// Remove PCM libraries that no longer exist
std::vector<wxString> to_remove;

View File

@ -143,7 +143,7 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
setupTools();
setupUIConditions();
m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings<SYMBOL_VIEWER_TOOLBAR_SETTINGS>( "symbol_viewer-toolbars" );
m_toolbarSettings = GetToolbarSettings<SYMBOL_VIEWER_TOOLBAR_SETTINGS>( "symbol_viewer-toolbars" );
configureToolbars();
RecreateToolbars();
@ -850,50 +850,50 @@ void SYMBOL_VIEWER_FRAME::DClickOnSymbolList( wxCommandEvent& event )
void SYMBOL_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
SCH_BASE_FRAME::LoadSettings( GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) );
SCH_BASE_FRAME::LoadSettings( cfg );
// Grid shape, etc.
GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
m_libListWidth = cfg->m_LibViewPanel.lib_list_width;
m_symbolListWidth = cfg->m_LibViewPanel.cmp_list_width;
GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_LibViewPanel.show_pin_electrical_type;
GetRenderSettings()->m_ShowPinNumbers = cfg->m_LibViewPanel.show_pin_numbers;
// Set parameters to a reasonable value.
int maxWidth = cfg->m_LibViewPanel.window.state.size_x - 80;
if( m_libListWidth + m_symbolListWidth > maxWidth )
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
m_libListWidth = maxWidth * ( m_libListWidth / ( m_libListWidth + m_symbolListWidth ) );
m_symbolListWidth = maxWidth - m_libListWidth;
// Grid shape, etc.
GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
m_libListWidth = cfg->m_LibViewPanel.lib_list_width;
m_symbolListWidth = cfg->m_LibViewPanel.cmp_list_width;
GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_LibViewPanel.show_pin_electrical_type;
GetRenderSettings()->m_ShowPinNumbers = cfg->m_LibViewPanel.show_pin_numbers;
// Set parameters to a reasonable value.
int maxWidth = cfg->m_LibViewPanel.window.state.size_x - 80;
if( m_libListWidth + m_symbolListWidth > maxWidth )
{
m_libListWidth = maxWidth * ( m_libListWidth / ( m_libListWidth + m_symbolListWidth ) );
m_symbolListWidth = maxWidth - m_libListWidth;
}
}
}
void SYMBOL_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
SCH_BASE_FRAME::SaveSettings( cfg );
SCH_BASE_FRAME::SaveSettings( GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) );
if( m_libListWidth && m_libList )
m_libListWidth = m_libList->GetSize().x;
m_symbolListWidth = m_symbolList->GetSize().x;
cfg->m_LibViewPanel.lib_list_width = m_libListWidth;
cfg->m_LibViewPanel.cmp_list_width = m_symbolListWidth;
if( SCH_RENDER_SETTINGS* renderSettings = GetRenderSettings() )
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
cfg->m_LibViewPanel.show_pin_electrical_type = renderSettings->m_ShowPinsElectricalType;
cfg->m_LibViewPanel.show_pin_numbers = renderSettings->m_ShowPinNumbers;
cfg->m_LibViewPanel.lib_list_width = m_libListWidth;
cfg->m_LibViewPanel.cmp_list_width = m_symbolListWidth;
if( SCH_RENDER_SETTINGS* renderSettings = GetRenderSettings() )
{
cfg->m_LibViewPanel.show_pin_electrical_type = renderSettings->m_ShowPinsElectricalType;
cfg->m_LibViewPanel.show_pin_numbers = renderSettings->m_ShowPinNumbers;
}
}
}
@ -910,9 +910,8 @@ void SYMBOL_VIEWER_FRAME::CommonSettingsChanged( int aFlags )
{
SCH_BASE_FRAME::CommonSettingsChanged( aFlags );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
GetGalDisplayOptions().ReadWindowSettings( cfg->m_LibViewPanel.window );
GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
GetCanvas()->GetGAL()->DrawGrid();

View File

@ -813,7 +813,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( head && head->IsMoving() )
moving = true;
if( principalItemCount == 1 )
{
if( moving && selection.HasReferencePoint() )
@ -993,7 +993,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( item->Type() == SCH_LINE_T )
{
SCH_LINE* line = (SCH_LINE*) item;
SCH_LINE* line = (SCH_LINE*) item;
line->Rotate( rotPoint, !clockwise );
}
@ -1517,10 +1517,8 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
for( const std::unique_ptr<SCH_ITEM>& item : sourceItems )
{
SCH_ITEM* newItem = item->Duplicate( IGNORE_PARENT_GROUP );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
bool restore_state = false;
SCH_ITEM* newItem = item->Duplicate( IGNORE_PARENT_GROUP );
bool restore_state = false;
// Ensure newItem has a suitable parent: the current screen, because an item from
// a list of items to repeat must be attached to this current screen
@ -1538,9 +1536,11 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
if( SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( newItem ) )
{
// If incrementing tries to go below zero, tell user why the value is repeated
if( !label->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
if( !label->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
}
}
// If cloning a symbol then put into 'move' mode.
@ -1549,7 +1549,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( true );
newItem->Move( cursorPos - newItem->GetPosition() );
}
else
else if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
newItem->Move( VECTOR2I( schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_x ),
schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) );
@ -1621,7 +1621,6 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
m_frame->Schematic().CleanUp( &commit );
commit.Push( _( "Repeat Item" ) );
}
}
if( !newItems.Empty() )
@ -2945,8 +2944,6 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
std::vector<SCH_LINE*> lines;
// Save the current orthogonal mode so we can restore it later
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
static enum LINE_MODE lineMode = LINE_MODE::LINE_MODE_90;
static bool lineModeChanged = false;
@ -2964,7 +2961,6 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
}
};
for( EDA_ITEM* item : selection )
{
if( item->Type() == SCH_LINE_T )
@ -3001,11 +2997,14 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
if( !lines.empty() )
{
if( cfg->m_Drawing.line_mode != LINE_MODE::LINE_MODE_FREE )
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
{
lineMode = (enum LINE_MODE) cfg->m_Drawing.line_mode;
lineModeChanged = true;
m_toolMgr->RunAction( SCH_ACTIONS::lineModeFree );
if( cfg->m_Drawing.line_mode != LINE_MODE::LINE_MODE_FREE )
{
lineMode = (enum LINE_MODE) cfg->m_Drawing.line_mode;
lineModeChanged = true;
m_toolMgr->RunAction( SCH_ACTIONS::lineModeFree );
}
}
m_frame->TestDanglingEnds();

View File

@ -405,11 +405,13 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aCommit, bool aIsSlice )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
KIGFX::VIEW_CONTROLS* controls = getViewControls();
EE_GRID_HELPER grid( m_toolMgr );
bool wasDragging = m_moveInProgress && m_isDrag;
bool isLineModeConstrained = false;
if( EESCHEMA_SETTINGS* cfg = GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" ) )
isLineModeConstrained = cfg->m_Drawing.line_mode != LINE_MODE::LINE_MODE_FREE;
m_anchorPos.reset();
@ -800,10 +802,8 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
// Only partially selected drag lines in orthogonal line mode need special
// handling
if( m_isDrag
&& cfg->m_Drawing.line_mode != LINE_MODE::LINE_MODE_FREE
&& line
&& line->HasFlag( STARTPOINT ) != line->HasFlag( ENDPOINT ) )
if( m_isDrag && isLineModeConstrained
&& line && line->HasFlag( STARTPOINT ) != line->HasFlag( ENDPOINT ) )
{
orthoLineDrag( aCommit, line, splitDelta, xBendCount, yBendCount, grid );
}
@ -835,7 +835,9 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
//------------------------------------------------------------------------
// Handle cancel
//
else if( evt->IsCancelInteractive() || evt->IsActivate() )
else if( evt->IsCancelInteractive()
|| evt->IsActivate()
|| evt->IsAction( &ACTIONS::undo ) )
{
if( evt->IsCancelInteractive() )
m_frame->GetInfoBar()->Dismiss();
@ -867,18 +869,15 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
//------------------------------------------------------------------------
// Handle TOOL_ACTION special cases
//
else if( evt->Action() == TA_UNDO_REDO_PRE )
{
unselect = true;
break;
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
{
evt->SetPassEvent();
// Exit on a delete; there will no longer be anything to drag.
break;
}
else if( evt->IsAction( &ACTIONS::duplicate ) )
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem )
|| evt->IsAction( &ACTIONS::redo ) )
{
wxBell();
}

View File

@ -82,11 +82,9 @@ bool SYMBOL_EDITOR_DRAWING_TOOLS::Init()
int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
KICAD_T type = aEvent.Parameter<KICAD_T>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
SYMBOL_EDITOR_PIN_TOOL* pinTool = type == SCH_PIN_T
? m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>()
: nullptr;
SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
SYMBOL_EDITOR_PIN_TOOL* pinTool = type == SCH_PIN_T ? m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>()
: nullptr;
if( m_inTwoClickPlace )
return 0;
@ -236,8 +234,12 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( m_drawSpecificBodyStyle )
text->SetBodyStyle( m_frame->GetBodyStyle() );
text->SetTextSize( VECTOR2I( schIUScale.MilsToIU( cfg->m_Defaults.text_size ),
schIUScale.MilsToIU( cfg->m_Defaults.text_size ) ) );
if( cfg )
{
text->SetTextSize( VECTOR2I( schIUScale.MilsToIU( cfg->m_Defaults.text_size ),
schIUScale.MilsToIU( cfg->m_Defaults.text_size ) ) );
}
text->SetTextAngle( m_lastTextAngle );
DIALOG_TEXT_PROPERTIES dlg( m_frame, text );
@ -367,8 +369,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
SHAPE_T toolType = aDrawingShape.value_or( SHAPE_T::SEGMENT );
KIGFX::VIEW_CONTROLS* controls = getViewControls();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
EE_GRID_HELPER grid( m_toolMgr );
VECTOR2I cursorPos;
SHAPE_T shapeType = toolType == SHAPE_T::SEGMENT ? SHAPE_T::POLY : toolType;
@ -469,15 +470,19 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
m_toolMgr->RunAction( ACTIONS::selectionClear );
int lineWidth = schIUScale.MilsToIU( cfg->m_Defaults.line_width );
int lineWidth = schIUScale.MilsToIU( cfg ? cfg->m_Defaults.line_width : DEFAULT_LINE_WIDTH_MILS );
if( isTextBox )
{
SCH_TEXTBOX* textbox = new SCH_TEXTBOX( LAYER_DEVICE, lineWidth, m_lastFillStyle );
textbox->SetParent( symbol );
textbox->SetTextSize( VECTOR2I( schIUScale.MilsToIU( cfg->m_Defaults.text_size ),
schIUScale.MilsToIU( cfg->m_Defaults.text_size ) ) );
if( cfg )
{
textbox->SetTextSize( VECTOR2I( schIUScale.MilsToIU( cfg->m_Defaults.text_size ),
schIUScale.MilsToIU( cfg->m_Defaults.text_size ) ) );
}
// Must be after SetTextSize()
textbox->SetBold( m_lastTextBold );

View File

@ -51,10 +51,8 @@ static int GetLastPinLength()
{
if( g_LastPinLength == -1 )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
g_LastPinLength = schIUScale.MilsToIU( cfg->m_Defaults.pin_length );
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
g_LastPinLength = schIUScale.MilsToIU( cfg->m_Defaults.pin_length );
}
return g_LastPinLength;
@ -64,10 +62,8 @@ static int GetLastPinNameSize()
{
if( g_LastPinNameSize == -1 )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
g_LastPinNameSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_name_size );
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
g_LastPinNameSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_name_size );
}
return g_LastPinNameSize;
@ -77,10 +73,8 @@ static int GetLastPinNumSize()
{
if( g_LastPinNumSize == -1 )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
g_LastPinNumSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_num_size );
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
g_LastPinNumSize = schIUScale.MilsToIU( cfg->m_Defaults.pin_num_size );
}
return g_LastPinNumSize;
@ -423,33 +417,34 @@ SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const SCH_PIN* aSourcePin )
commit.Modify( symbol );
SCH_PIN* pin = static_cast<SCH_PIN*>( aSourcePin->Duplicate( true, &commit ) );
VECTOR2I step;
pin->ClearFlags();
pin->SetFlags( IS_NEW );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
switch( pin->GetOrientation() )
if( SYMBOL_EDITOR_SETTINGS* cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
{
default:
case PIN_ORIENTATION::PIN_RIGHT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_UP: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_DOWN: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step) ; break;
case PIN_ORIENTATION::PIN_LEFT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
VECTOR2I step;
switch( pin->GetOrientation() )
{
default:
case PIN_ORIENTATION::PIN_RIGHT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_UP: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_DOWN: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step) ; break;
case PIN_ORIENTATION::PIN_LEFT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
}
pin->Move( step );
wxString nextName = pin->GetName();
IncrementString( nextName, cfg->m_Repeat.label_delta );
pin->SetName( nextName );
wxString nextNumber = pin->GetNumber();
IncrementString( nextNumber, cfg->m_Repeat.label_delta );
pin->SetNumber( nextNumber );
}
pin->Move( step );
wxString nextName = pin->GetName();
IncrementString( nextName, cfg->m_Repeat.label_delta );
pin->SetName( nextName );
wxString nextNumber = pin->GetNumber();
IncrementString( nextNumber, cfg->m_Repeat.label_delta );
pin->SetNumber( nextNumber );
if( m_frame->SynchronizePins() )
pin->SetFlags( IS_LINKED );

Some files were not shown because too many files have changed in this diff Show More