7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 22:43:44 +00:00

Remove some more duplicated preferences.

Fixes https://gitlab.com/kicad/code/kicad/issues/10112
This commit is contained in:
Jeff Young 2021-12-26 00:36:12 +00:00
parent eac65635be
commit 5e4a704155
46 changed files with 290 additions and 604 deletions

View File

@ -554,7 +554,6 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/plugins/legacy/legacy_plugin.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/netlist_reader.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pad_custom_shape_functions.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_display_options.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_draw_panel_gal.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netlist_reader/pcb_netlist.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_origin_transforms.cpp

View File

@ -34,7 +34,6 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
m_ActiveLayer( UNDEFINED_LAYER ),
m_ContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL ),
m_NetColorMode( NET_COLOR_MODE::RATSNEST ),
m_RatsnestMode( RATSNEST_MODE::ALL ),
m_AutoTrackWidth( true ),
m_ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FILLED ),
m_TrackOpacity( 1.0 ),
@ -165,10 +164,6 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
&m_NetColorMode, NET_COLOR_MODE::RATSNEST, NET_COLOR_MODE::OFF,
NET_COLOR_MODE::ALL ) );
m_params.emplace_back( new PARAM_ENUM<RATSNEST_MODE>( "board.ratsnest_display_mode",
&m_RatsnestMode, RATSNEST_MODE::ALL, RATSNEST_MODE::ALL,
RATSNEST_MODE::VISIBLE ) );
m_params.emplace_back( new PARAM<bool>( "board.auto_track_width",
&m_AutoTrackWidth, true ) );

View File

@ -49,21 +49,7 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() :
addParamsForWindow( &m_FootprintViewer, "footprint_viewer" );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.pad_fill",
&m_FootprintViewerDisplayOptions.m_DisplayPadFill, true ) );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.pad_numbers",
&m_FootprintViewerDisplayOptions.m_DisplayPadNum, true ) );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.footprint_text_fill",
&m_FootprintViewerDisplayOptions.m_DisplayTextFill, true ) );
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.graphic_items_fill",
&m_FootprintViewerDisplayOptions.m_DisplayGraphicsFill, true ) );
m_params.emplace_back( new PARAM<double>( "footprint_viewer.zoom",
&m_FootprintViewerZoom, 1.0 ) );
m_params.emplace_back( new PARAM<double>( "footprint_viewer.zoom", &m_FootprintViewerZoom, 1.0 ) );
}

View File

@ -94,15 +94,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
LoadSettings( config() );
// Initialize some display options
auto displ_opts = GetDisplayOptions();
displ_opts.m_DisplayPadClearance = false; // Pad clearance has no meaning here
displ_opts.m_DisplayPadNoConnects = false; // Nor do connections
// Track and via clearance has no meaning here.
displ_opts.m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
SetDisplayOptions( displ_opts );
// Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),

View File

@ -153,15 +153,11 @@ public:
/**
* Returns the BOARD_DESIGN_SETTINGS for the open project.
*
* Overloaded in FOOTPRINT_EDIT_FRAME.
*/
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
/**
* Helper to retrieve the current color settings.
*
* @return a pointer to the active COLOR_SETTINGS.
*/
virtual COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override
{
@ -170,6 +166,7 @@ public:
}
PCBNEW_SETTINGS& Settings() { return *m_settings; }
const PCBNEW_SETTINGS& Settings() const { return *m_settings; }
void SetDrawBgColor( const COLOR4D& aColor ) override;
@ -191,16 +188,12 @@ public:
/**
* Return the #PCB_PLOT_PARAMS for the BOARD owned by this frame.
*
* Overloaded in FOOTPRINT_EDIT_FRAME.
*/
virtual const PCB_PLOT_PARAMS& GetPlotSettings() const;
virtual void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings );
/**
* Set the #m_Pcb member in such as way as to ensure deleting any previous #BOARD.
*
* @param aBoard is the #BOARD to put into the frame.
*/
virtual void SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -22,99 +22,41 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcb_display_options.h
* @brief Definition of PCB_DISPLAY_OPTIONS class
*/
#ifndef PCB_DISPLAY_OPTIONS_H_
#define PCB_DISPLAY_OPTIONS_H_
#include <project/board_project_settings.h>
enum TRACE_CLEARANCE_DISPLAY_MODE_T
{
DO_NOT_SHOW_CLEARANCE = 0,
SHOW_TRACK_CLEARANCE_WHILE_ROUTING,
SHOW_TRACK_CLEARANCE_WITH_VIA_WHILE_ROUTING,
SHOW_WHILE_ROUTING_OR_DRAGGING,
SHOW_TRACK_CLEARANCE_WITH_VIA_ALWAYS
};
/**
* Container for display options like enable/disable some optional drawings.
*/
class PCB_DISPLAY_OPTIONS
{
public:
PCB_DISPLAY_OPTIONS();
PCB_DISPLAY_OPTIONS()
{
m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
m_NetColorMode = NET_COLOR_MODE::RATSNEST;
/**
* The set of values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option.
*
* This parameter controls how to show tracks and vias clearance area.
*/
bool m_DisplayPadFill;
bool m_DisplayViaFill;
bool m_DisplayPadNum; // show pads numbers
bool m_DisplayPadClearance;
bool m_DisplayPadNoConnects;
bool m_DisplayGraphicsFill; // How to display fp drawings ( sketch/ filled )
bool m_DisplayTextFill; // How to display fp texts ( sketch/ filled )
bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled.
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode;
m_TrackOpacity = 1.0;
m_ViaOpacity = 1.0;
m_PadOpacity = 1.0;
m_ZoneOpacity = 1.0;
}
/// @see ZONE_DISPLAY_MODE - stored in the project
ZONE_DISPLAY_MODE m_ZoneDisplayMode;
int m_DisplayNetNamesMode; /* 0 do not show netnames,
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads
*/
ZONE_DISPLAY_MODE m_ZoneDisplayMode;
/// How inactive layers are displayed. @see HIGH_CONTRAST_MODE - stored in the project
HIGH_CONTRAST_MODE m_ContrastModeDisplay;
/// How to use color overrides on specific nets and netclasses
NET_COLOR_MODE m_NetColorMode;
/// Ratsnest draw mode (all layers vs only visible layers)
RATSNEST_MODE m_RatsnestMode;
int m_MaxLinksShowed; // in track creation: number of airwires shown
bool m_ShowModuleRatsnest; // When moving a footprint: allows displaying a ratsnest
bool m_ShowGlobalRatsnest; // If true, show all
bool m_DisplayRatsnestLinesCurved; // Airwires can be drawn as straight lines (false)
// or curved lines (true)
NET_COLOR_MODE m_NetColorMode;
// These opacity overrides multiply with any opacity in the base layer color
double m_TrackOpacity; ///< Opacity override for all tracks
double m_ViaOpacity; ///< Opacity override for all types of via
double m_PadOpacity; ///< Opacity override for SMD pads and PTHs
double m_ZoneOpacity; ///< Opacity override for filled zone areas
/**
* The set of values for DISPLAY_OPTIONS.DisplayOrigin parameter option.
*
* This parameter controls what is used as the origin point for location values
*/
enum PCB_DISPLAY_ORIGIN_OPTIONS_T {
PCB_ORIGIN_PAGE = 0,
PCB_ORIGIN_AUX,
PCB_ORIGIN_GRID,
};
/// Which origin is used for display transforms
PCB_DISPLAY_ORIGIN_OPTIONS_T m_DisplayOrigin;
bool m_DisplayInvertXAxis; //< true: Invert the X axis for display
bool m_DisplayInvertYAxis; //< true: Invert the Y axis for display
bool m_Live3DRefresh; ///< If true, 3D viewer will redraw on every modification operation
double m_TrackOpacity; ///< Opacity override for all tracks
double m_ViaOpacity; ///< Opacity override for all types of via
double m_PadOpacity; ///< Opacity override for SMD pads and PTHs
double m_ZoneOpacity; ///< Opacity override for filled zone areas
};
#endif // PCBSTRUCT_H_

View File

@ -63,10 +63,7 @@ public:
bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
void SetProject( PROJECT* aProject )
{
m_project = aProject;
}
void SetProject( PROJECT* aProject ) { m_project = aProject; }
void SaveFileState( const wxString& aFileName, const WINDOW_SETTINGS* aWindowCfg, bool aOpen );
@ -116,9 +113,6 @@ public:
/// The current net color mode
NET_COLOR_MODE m_NetColorMode;
/// The current ratsnest draw mode
RATSNEST_MODE m_RatsnestMode;
/// The current setting for whether to automatically adjust track widths to match
bool m_AutoTrackWidth;

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -32,6 +33,7 @@
#include <tools/pcb_tool_base.h>
#include <tools/pcb_actions.h>
#include <connectivity/connectivity_data.h>
#include <pcbnew_settings.h>
#include <functional>
using namespace std::placeholders;
@ -443,7 +445,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( aSetDirtyBit )
frame->OnModify();
else
frame->Update3DView( true, frame->GetDisplayOptions().m_Live3DRefresh );
frame->Update3DView( true, frame->Settings().m_Display.m_Live3DRefresh );
}
clear();

View File

@ -76,7 +76,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
PAD* pad = nullptr;
BOARD* pcb = GetBoard();
CROSS_PROBING_SETTINGS& crossProbingSettings = GetPcbNewSettings()->m_CrossProbing;
CROSS_PROBING_SETTINGS& crossProbingSettings = Settings().m_CrossProbing;
KIGFX::VIEW* view = m_toolManager->GetView();
KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();

View File

@ -156,8 +156,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
{
m_frame->GetPcbNewSettings()->m_FootprintTextShownColumns =
m_itemsGrid->GetShownColumns().ToStdString();
m_frame->Settings().m_FootprintTextShownColumns = m_itemsGrid->GetShownColumns().ToStdString();
// Prevents crash bug in wxGrid's d'tor
m_itemsGrid->DestroyTable( m_texts );

View File

@ -325,14 +325,14 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
// fix the pad render mode (filled/not filled)
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
bool sketchMode = m_cbShowPadOutline->IsChecked();
settings->SetSketchMode( LAYER_PADS_TH, sketchMode );
settings->SetSketchMode( LAYER_PAD_FR, sketchMode );
settings->SetSketchMode( LAYER_PAD_BK, sketchMode );
settings->SetSketchModeGraphicItems( sketchMode );
if( m_cbShowPadOutline->IsChecked() )
settings->m_ForcePadSketchModeOn = true;
else
settings->m_ForcePadSketchModeOff = true;
settings->SetHighContrast( false );
settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL );
settings->m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
// gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
double gridsize = 0.001 * IU_PER_MM;
@ -769,16 +769,15 @@ void DIALOG_PAD_PROPERTIES::onChangePadMode( wxCommandEvent& event )
KIGFX::VIEW* view = m_padPreviewGAL->GetView();
// fix the pad render mode (filled/not filled)
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
settings->SetSketchMode( LAYER_PADS_TH, m_sketchPreview );
settings->SetSketchMode( LAYER_PAD_FR, m_sketchPreview );
settings->SetSketchMode( LAYER_PAD_BK, m_sketchPreview );
settings->SetSketchModeGraphicItems( m_sketchPreview );
if( m_cbShowPadOutline->IsChecked() )
settings->m_ForcePadSketchModeOn = true;
else
settings->m_ForcePadSketchModeOff = true;
settings->SetHighContrast( false );
settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL );
settings->m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
redraw();
}

View File

@ -26,7 +26,7 @@
#include <widgets/gal_options_panel.h>
static const UTIL::CFG_MAP<TRACE_CLEARANCE_DISPLAY_MODE_T> clearanceModeMap =
static const UTIL::CFG_MAP<TRACK_CLEARANCE_MODE> clearanceModeMap =
{
{ SHOW_TRACK_CLEARANCE_WITH_VIA_WHILE_ROUTING, 2 }, // Default
{ DO_NOT_SHOW_CLEARANCE, 0 },

View File

@ -40,9 +40,9 @@ void PANEL_PCBNEW_DISPLAY_ORIGIN::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
switch( aCfg->m_Display.m_DisplayOrigin )
{
case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_PAGE: origin = 0; break;
case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_AUX: origin = 1; break;
case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_GRID: origin = 2; break;
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE: origin = 0; break;
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX: origin = 1; break;
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_GRID: origin = 2; break;
}
m_DisplayOrigin->SetSelection( origin );
@ -67,9 +67,9 @@ bool PANEL_PCBNEW_DISPLAY_ORIGIN::TransferDataFromWindow()
switch( m_DisplayOrigin->GetSelection() )
{
case 0: cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_OPTIONS::PCB_ORIGIN_PAGE; break;
case 1: cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_OPTIONS::PCB_ORIGIN_AUX; break;
case 2: cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_OPTIONS::PCB_ORIGIN_GRID; break;
case 0: cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE; break;
case 1: cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX; break;
case 2: cfg->m_Display.m_DisplayOrigin = PCB_DISPLAY_ORIGIN::PCB_ORIGIN_GRID; break;
}
cfg->m_Display.m_DisplayInvertXAxis = m_XAxisDirection->GetSelection() != 0;

View File

@ -91,15 +91,6 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "editing.fp_use_45_degree_limit",
&m_Use45Limit, false ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.text_fill",
&m_Display.m_DisplayTextFill, true ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.graphic_items_fill",
&m_Display.m_DisplayGraphicsFill, true ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_fill",
&m_Display.m_DisplayPadFill, true ) );
m_params.emplace_back( new PARAM_LAYER_PRESET( "pcb_display.layer_presets", &m_LayerPresets ) );
m_params.emplace_back( new PARAM<wxString>( "pcb_display.active_layer_preset",

View File

@ -109,7 +109,7 @@ void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<FOOTPRINT> aFootp
// Ensure we are not using the high contrast mode to display the selected footprint
KIGFX::PAINTER* painter = GetView()->GetPainter();
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL );
settings->m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
GetView()->Add( m_currentFootprint.get() );
GetView()->SetVisible( m_currentFootprint.get(), true );

View File

@ -737,7 +737,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
for( PAD* pad : newFootprint->Pads() )
{
// Set the pads ratsnest settings to the global settings
pad->SetLocalRatsnestVisible( pcbframe->GetDisplayOptions().m_ShowGlobalRatsnest );
pad->SetLocalRatsnestVisible( pcbframe->Settings().m_Display.m_ShowGlobalRatsnest );
// Pads in the library all have orphaned nets. Replace with Default.
pad->SetNetCode( 0 );
@ -746,8 +746,10 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
// Put it on FRONT layer,
// (Can be stored flipped if the lib is an archive built from a board)
if( newFootprint->IsFlipped() )
{
newFootprint->Flip( newFootprint->GetPosition(),
pcbframe->Settings().m_FlipLeftRight );
}
KIGFX::VIEW_CONTROLS* viewControls = pcbframe->GetCanvas()->GetViewControls();
VECTOR2D cursorPos = viewControls->GetCursorPosition();

View File

@ -132,13 +132,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 );
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
PCB_DISPLAY_OPTIONS disp_opts = GetDisplayOptions();
disp_opts.m_DisplayPadClearance = true;
disp_opts.m_DisplayPadNoConnects = false;
disp_opts.m_DisplayPadNum = true;
SetDisplayOptions( disp_opts );
// Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),

View File

@ -107,15 +107,8 @@ public:
* @return force the text rotation to be always between -90 .. 90 deg. Otherwise the text
* is not easy to read if false, the text rotation is free.
*/
bool IsKeepUpright() const
{
return m_keepUpright;
}
void SetKeepUpright( bool aKeepUpright )
{
m_keepUpright = aKeepUpright;
}
bool IsKeepUpright() const { return m_keepUpright; }
void SetKeepUpright( bool aKeepUpright ) { m_keepUpright = aKeepUpright; }
/// Rotate text, in footprint editor
/// (for instance in footprint rotation transform)
@ -207,7 +200,7 @@ public:
int aError, ERROR_LOC aErrorLoc ) const;
// @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
wxString GetClass() const override
{
@ -233,18 +226,13 @@ public:
#endif
private:
/* Note: orientation in 1/10 deg relative to the footprint
* Physical orient is m_Orient + m_Parent->m_Orient
*/
TEXT_TYPE m_Type; ///< 0=ref, 1=val, etc.
TEXT_TYPE m_Type; ///< 0=ref, 1=val, etc.
wxPoint m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0.
///< text coordinate ref point is the text center
wxPoint m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0.
///< text coordinate ref point is the text center
bool m_keepUpright; ///< if true, keep rotation angle between -90 .. 90 deg.
///< to keep the text more easy to read
};
#endif // FP_TEXT_H

View File

@ -169,7 +169,7 @@ FOOTPRINT* BOARD_NETLIST_UPDATER::addNewFootprint( COMPONENT* aComponent )
for( PAD* pad : footprint->Pads() )
{
// Set the pads ratsnest settings to the global settings
pad->SetLocalRatsnestVisible( m_frame->GetDisplayOptions().m_ShowGlobalRatsnest );
pad->SetLocalRatsnestVisible( m_frame->Settings().m_Display.m_ShowGlobalRatsnest );
// Pads in the library all have orphaned nets. Replace with Default.
pad->SetNetCode( 0 );

View File

@ -38,7 +38,6 @@
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
#include <widgets/appearance_controls.h>
#include <dialogs/dialog_grid_settings.h>
#include <dialogs/eda_view_switcher.h>
#include <wildcards_and_files_ext.h>
#include <collectors.h>
@ -245,7 +244,7 @@ void PCB_BASE_EDIT_FRAME::SetObjectVisible( GAL_LAYER_ID aLayer, bool aVisible )
COLOR_SETTINGS* PCB_BASE_EDIT_FRAME::GetColorSettings( bool aForceRefresh ) const
{
return Pgm().GetSettingsManager().GetColorSettings( GetPcbNewSettings()->m_ColorTheme );
return Pgm().GetSettingsManager().GetColorSettings( Settings().m_ColorTheme );
}

View File

@ -473,15 +473,14 @@ const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
const wxPoint PCB_BASE_FRAME::GetUserOrigin() const
{
auto& displ_opts = GetDisplayOptions();
wxPoint origin( 0, 0 );
switch( displ_opts.m_DisplayOrigin )
switch( Settings().m_Display.m_DisplayOrigin )
{
case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_PAGE: break;
case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_AUX: origin = GetAuxOrigin(); break;
case PCB_DISPLAY_OPTIONS::PCB_ORIGIN_GRID: origin = GetGridOrigin(); break;
default: wxASSERT( false ); break;
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE: break;
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX: origin = GetAuxOrigin(); break;
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_GRID: origin = GetGridOrigin(); break;
default: wxASSERT( false ); break;
}
return origin;
@ -779,10 +778,7 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
if( cfg )
{
m_displayOptions = cfg->m_Display;
m_polarCoords = cfg->m_PolarCoords;
}
wxASSERT( GetCanvas() );
@ -818,10 +814,7 @@ void PCB_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
if( cfg )
{
cfg->m_Display = m_displayOptions;
cfg->m_PolarCoords = m_polarCoords;
}
}

View File

@ -1,65 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcb_display_options.h>
#include <eda_text.h>
PCB_DISPLAY_OPTIONS::PCB_DISPLAY_OPTIONS()
{
m_DisplayPadFill = FILLED;
m_DisplayViaFill = FILLED;
m_DisplayPadNum = true;
m_DisplayPadClearance = true;
m_DisplayPadNoConnects = true;
m_DisplayGraphicsFill = FILLED;
m_DisplayTextFill = FILLED;
m_DisplayPcbTrackFill = FILLED; // false = sketch , true = filled
m_ShowTrackClearanceMode = SHOW_TRACK_CLEARANCE_WITH_VIA_WHILE_ROUTING;
m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
m_DisplayNetNamesMode = 3; /* 0 do not show netnames,
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads */
m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
m_NetColorMode = NET_COLOR_MODE::RATSNEST;
m_RatsnestMode = RATSNEST_MODE::ALL;
m_MaxLinksShowed = 3; // in track creation: number of hairwires shown
m_ShowModuleRatsnest = true; // When moving a footprint: allows displaying a ratsnest
m_DisplayRatsnestLinesCurved = false;
m_ShowGlobalRatsnest = true;
m_TrackOpacity = 1.0;
m_ViaOpacity = 1.0;
m_PadOpacity = 1.0;
m_ZoneOpacity = 1.0;
m_DisplayOrigin = PCB_ORIGIN_PAGE;
m_DisplayInvertXAxis = false;
m_DisplayInvertYAxis = false;
m_Live3DRefresh = false;
}

View File

@ -39,7 +39,6 @@
#include <dialog_footprint_properties.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <dialog_board_setup.h>
#include <convert_to_biu.h>
#include <invoke_pcb_dialog.h>
#include <board.h>
#include <board_design_settings.h>
@ -90,9 +89,7 @@
#include <python/scripting/pcb_scripting_tool.h>
#include <gestfich.h>
#include <executable_names.h>
#include <netlist_reader/board_netlist_updater.h>
#include <netlist_reader/netlist_reader.h>
#include <netlist_reader/pcb_netlist.h>
#include <wx/socket.h>
#include <wx/wupdlock.h>
#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
@ -672,13 +669,13 @@ void PCB_EDIT_FRAME::setupUIConditions()
auto globalRatsnestCond =
[this] (const SELECTION& )
{
return GetDisplayOptions().m_ShowGlobalRatsnest;
return Settings().m_Display.m_ShowGlobalRatsnest;
};
auto curvedRatsnestCond =
[this] (const SELECTION& )
{
return GetDisplayOptions().m_DisplayRatsnestLinesCurved;
return Settings().m_Display.m_DisplayRatsnestLinesCurved;
};
auto netHighlightCond =
@ -1020,25 +1017,6 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
Kiway().CommonSettingsChanged( false, true );
const PCB_DISPLAY_OPTIONS& opts = GetDisplayOptions();
if( opts.m_ShowTrackClearanceMode || opts.m_DisplayPadClearance )
{
// Update clearance outlines
GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
[&]( KIGFX::VIEW_ITEM* aItem ) -> bool
{
PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( aItem );
PAD* pad = dynamic_cast<PAD*>( aItem );
// PCB_TRACK is the base class of PCB_VIA and PCB_ARC so we don't need
// to check them independently
return ( track && opts.m_ShowTrackClearanceMode )
|| ( pad && opts.m_DisplayPadClearance );
} );
}
GetCanvas()->Refresh();
UpdateUserInterface();
@ -1130,7 +1108,7 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
{
// Clearances could be layer-dependent so redraw them when the active layer
// is changed
if( GetDisplayOptions().m_DisplayPadClearance )
if( Settings().m_Display.m_DisplayPadClearance )
{
// Round-corner rects are expensive to draw, but are mostly found on
// SMD pads which only need redrawing on an active-to-not-active
@ -1151,7 +1129,7 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
{
// Clearances could be layer-dependent so redraw them when the active layer
// is changed
if( GetDisplayOptions().m_ShowTrackClearanceMode )
if( Settings().m_Display.m_ShowTrackClearanceMode )
{
// Tracks aren't particularly expensive to draw, but it's an easy check.
return track->IsOnLayer( oldLayer ) || track->IsOnLayer( aLayer );
@ -1211,7 +1189,7 @@ void PCB_EDIT_FRAME::onBoardLoaded()
// Sync layer and item visibility
GetCanvas()->SyncLayersVisibility( m_pcb );
SetElementVisibility( LAYER_RATSNEST, GetDisplayOptions().m_ShowGlobalRatsnest );
SetElementVisibility( LAYER_RATSNEST, Settings().m_Display.m_ShowGlobalRatsnest );
m_appearancePanel->OnBoardChanged();
@ -1314,7 +1292,7 @@ void PCB_EDIT_FRAME::OnModify( )
{
PCB_BASE_FRAME::OnModify();
Update3DView( true, GetDisplayOptions().m_Live3DRefresh );
Update3DView( true, Settings().m_Display.m_Live3DRefresh );
if( !GetTitle().StartsWith( "*" ) )
UpdateTitle();
@ -1761,8 +1739,8 @@ void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
auto* painter = static_cast<KIGFX::PCB_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
auto* renderSettings = painter->GetSettings();
renderSettings->LoadDisplayOptions( GetDisplayOptions() );
SetElementVisibility( LAYER_NO_CONNECTS, GetDisplayOptions().m_DisplayPadNoConnects );
SetElementVisibility( LAYER_RATSNEST, GetDisplayOptions().m_ShowGlobalRatsnest );
SetElementVisibility( LAYER_NO_CONNECTS, Settings().m_Display.m_DisplayPadNoConnects );
SetElementVisibility( LAYER_RATSNEST, Settings().m_Display.m_ShowGlobalRatsnest );
auto cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 Reece R. Pollack <reece@his.com>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,15 +24,13 @@
#include <wx/debug.h> // for wxASSERT
#include <pcb_base_frame.h>
#include <pcb_display_options.h>
#include <pcbnew_settings.h>
#include <pcb_origin_transforms.h>
using COORD_TYPE = ORIGIN_TRANSFORMS::COORD_TYPES_T;
PCB_ORIGIN_TRANSFORMS::PCB_ORIGIN_TRANSFORMS( PCB_BASE_FRAME& aPcbBaseFrame )
: m_pcbBaseFrame( aPcbBaseFrame ),
m_invertXAxis( aPcbBaseFrame.GetDisplayOptions().m_DisplayInvertXAxis ),
m_invertYAxis( aPcbBaseFrame.GetDisplayOptions().m_DisplayInvertYAxis )
PCB_ORIGIN_TRANSFORMS::PCB_ORIGIN_TRANSFORMS( PCB_BASE_FRAME& aPcbBaseFrame ) :
m_pcbBaseFrame( aPcbBaseFrame )
{}
PCB_ORIGIN_TRANSFORMS::~PCB_ORIGIN_TRANSFORMS()
@ -56,8 +54,7 @@ long long int PCB_ORIGIN_TRANSFORMS::ToDisplay( long long int aValue,
return value;
}
double PCB_ORIGIN_TRANSFORMS::ToDisplay( double aValue,
COORD_TYPES_T aCoordType ) const
double PCB_ORIGIN_TRANSFORMS::ToDisplay( double aValue, COORD_TYPES_T aCoordType ) const
{
double value = aValue;
@ -92,8 +89,7 @@ long long int PCB_ORIGIN_TRANSFORMS::FromDisplay( long long int aValue,
return value;
}
double PCB_ORIGIN_TRANSFORMS::FromDisplay( double aValue,
COORD_TYPES_T aCoordType ) const
double PCB_ORIGIN_TRANSFORMS::FromDisplay( double aValue, COORD_TYPES_T aCoordType ) const
{
double value = aValue;
@ -111,13 +107,22 @@ double PCB_ORIGIN_TRANSFORMS::FromDisplay( double aValue,
}
int PCB_ORIGIN_TRANSFORMS::GetUserXOrigin() const
int PCB_ORIGIN_TRANSFORMS::getUserXOrigin() const
{
return m_pcbBaseFrame.GetUserOrigin().x;
}
int PCB_ORIGIN_TRANSFORMS::GetUserYOrigin() const
int PCB_ORIGIN_TRANSFORMS::getUserYOrigin() const
{
return m_pcbBaseFrame.GetUserOrigin().y;
}
bool PCB_ORIGIN_TRANSFORMS::invertXAxis() const
{
return m_pcbBaseFrame.Settings().m_Display.m_DisplayInvertXAxis;
}
bool PCB_ORIGIN_TRANSFORMS::invertYAxis() const
{
return m_pcbBaseFrame.Settings().m_Display.m_DisplayInvertYAxis;
}

View File

@ -94,25 +94,25 @@ public:
template<typename T>
T ToDisplayRelX( T aInternalValue ) const
{
return ORIGIN_TRANSFORMS::ToDisplayRel( aInternalValue, m_invertXAxis );
return ORIGIN_TRANSFORMS::ToDisplayRel( aInternalValue, invertXAxis() );
}
template<typename T>
T ToDisplayRelY( T aInternalValue ) const
{
return ORIGIN_TRANSFORMS::ToDisplayRel( aInternalValue, m_invertYAxis );
return ORIGIN_TRANSFORMS::ToDisplayRel( aInternalValue, invertYAxis() );
}
template<typename T>
T FromDisplayRelX( T aDisplayValue ) const
{
return ORIGIN_TRANSFORMS::FromDisplayRel( aDisplayValue, m_invertXAxis );
return ORIGIN_TRANSFORMS::FromDisplayRel( aDisplayValue, invertXAxis() );
}
template<typename T>
T FromDisplayRelY( T aDisplayValue ) const
{
return ORIGIN_TRANSFORMS::FromDisplayRel( aDisplayValue, m_invertYAxis );
return ORIGIN_TRANSFORMS::FromDisplayRel( aDisplayValue, invertYAxis() );
}
@ -121,25 +121,25 @@ public:
template<typename T>
T ToDisplayAbsX( T aInternalValue ) const
{
return ORIGIN_TRANSFORMS::ToDisplayAbs( aInternalValue, GetUserXOrigin(), m_invertXAxis );
return ORIGIN_TRANSFORMS::ToDisplayAbs( aInternalValue, getUserXOrigin(), invertXAxis() );
}
template<typename T>
T ToDisplayAbsY( T aInternalValue ) const
{
return ORIGIN_TRANSFORMS::ToDisplayAbs( aInternalValue, GetUserYOrigin(), m_invertYAxis );
return ORIGIN_TRANSFORMS::ToDisplayAbs( aInternalValue, getUserYOrigin(), invertYAxis() );
}
template<typename T>
T FromDisplayAbsX( T aDisplayValue ) const
{
return ORIGIN_TRANSFORMS::FromDisplayAbs( aDisplayValue, GetUserXOrigin(), m_invertXAxis );
return ORIGIN_TRANSFORMS::FromDisplayAbs( aDisplayValue, getUserXOrigin(), invertXAxis() );
}
template<typename T>
T FromDisplayAbsY( T aDisplayValue ) const
{
return ORIGIN_TRANSFORMS::FromDisplayAbs( aDisplayValue, GetUserYOrigin(), m_invertYAxis );
return ORIGIN_TRANSFORMS::FromDisplayAbs( aDisplayValue, getUserYOrigin(), invertYAxis() );
}
@ -190,13 +190,14 @@ public:
}
protected:
int GetUserXOrigin() const;
int GetUserYOrigin() const;
int getUserXOrigin() const;
int getUserYOrigin() const;
bool invertXAxis() const;
bool invertYAxis() const;
protected:
const PCB_BASE_FRAME& m_pcbBaseFrame;
const bool& m_invertXAxis;
const bool& m_invertYAxis;
};
#endif // PCB_ORIGIN_TRANSFORMS_H_

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