Remove bad static_cast.
(m_settings isn't a PCBNEW_SETTINGS in non-PCB_EDIT_FRAMEs)
This commit is contained in:
parent
713c0197d9
commit
1bad72f14f
|
@ -59,6 +59,7 @@ class BOARD_DESIGN_SETTINGS;
|
|||
class ZONE_SETTINGS;
|
||||
class PCB_PLOT_PARAMS;
|
||||
class FP_LIB_TABLE;
|
||||
class PCB_VIEWERS_SETTINGS_BASE;
|
||||
class PCBNEW_SETTINGS;
|
||||
class FOOTPRINT_EDITOR_SETTINGS;
|
||||
struct MAGNETIC_SETTINGS;
|
||||
|
@ -165,9 +166,6 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
PCBNEW_SETTINGS& Settings() { return *m_settings; }
|
||||
const PCBNEW_SETTINGS& Settings() const { return *m_settings; }
|
||||
|
||||
void SetDrawBgColor( const COLOR4D& aColor ) override;
|
||||
|
||||
/**
|
||||
|
@ -375,6 +373,8 @@ public:
|
|||
|
||||
FOOTPRINT_EDITOR_SETTINGS* GetFootprintEditorSettings() const;
|
||||
|
||||
virtual PCB_VIEWERS_SETTINGS_BASE* GetViewerSettingsBase() const;
|
||||
|
||||
virtual MAGNETIC_SETTINGS* GetMagneticItemsSettings();
|
||||
|
||||
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
|
||||
|
@ -412,7 +412,6 @@ protected:
|
|||
BOARD* m_pcb;
|
||||
PCB_DISPLAY_OPTIONS m_displayOptions;
|
||||
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
||||
PCBNEW_SETTINGS* m_settings; // No ownership, just a shortcut
|
||||
|
||||
private:
|
||||
NL_PCBNEW_PLUGIN* m_spaceMouse;
|
||||
|
|
|
@ -547,7 +547,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
if( !( aCommitFlags & SKIP_SET_DIRTY ) )
|
||||
frame->OnModify();
|
||||
else
|
||||
frame->Update3DView( true, frame->Settings().m_Display.m_Live3DRefresh );
|
||||
frame->Update3DView( true, frame->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
|
||||
}
|
||||
|
||||
clear();
|
||||
|
|
|
@ -76,7 +76,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
|||
PAD* pad = nullptr;
|
||||
BOARD* pcb = GetBoard();
|
||||
|
||||
CROSS_PROBING_SETTINGS& crossProbingSettings = Settings().m_CrossProbing;
|
||||
CROSS_PROBING_SETTINGS& crossProbingSettings = GetPcbNewSettings()->m_CrossProbing;
|
||||
|
||||
KIGFX::VIEW* view = m_toolManager->GetView();
|
||||
KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
|
||||
|
@ -473,7 +473,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
|||
|
||||
|
||||
case MAIL_SELECTION:
|
||||
if( !Settings().m_CrossProbing.on_selection )
|
||||
if( !GetPcbNewSettings()->m_CrossProbing.on_selection )
|
||||
break;
|
||||
|
||||
KI_FALLTHROUGH;
|
||||
|
|
|
@ -448,7 +448,7 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
|
|||
|
||||
if( rc_item->GetErrorCode() == DRCE_UNCONNECTED_ITEMS )
|
||||
{
|
||||
if( !m_frame->Settings().m_Display.m_ShowGlobalRatsnest )
|
||||
if( !m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest )
|
||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::showRatsnest, true );
|
||||
|
||||
std::vector<CN_EDGE> edges;
|
||||
|
|
|
@ -522,7 +522,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
|
|||
aNew->SetPosition( aExisting->GetPosition() );
|
||||
|
||||
if( aNew->GetLayer() != aExisting->GetLayer() )
|
||||
aNew->Flip( aNew->GetPosition(), m_settings->m_FlipLeftRight );
|
||||
aNew->Flip( aNew->GetPosition(), GetPcbNewSettings()->m_FlipLeftRight );
|
||||
|
||||
if( aNew->GetOrientation() != aExisting->GetOrientation() )
|
||||
aNew->SetOrientation( aExisting->GetOrientation() );
|
||||
|
|
|
@ -175,7 +175,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
|
|||
|
||||
DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
|
||||
{
|
||||
m_frame->Settings().m_FootprintTextShownColumns = m_itemsGrid->GetShownColumns().ToStdString();
|
||||
m_frame->GetPcbNewSettings()->m_FootprintTextShownColumns = m_itemsGrid->GetShownColumns().ToStdString();
|
||||
|
||||
// Prevents crash bug in wxGrid's d'tor
|
||||
m_itemsGrid->DestroyTable( m_texts );
|
||||
|
@ -480,7 +480,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
|
|||
change_layer = true;
|
||||
|
||||
if( change_layer )
|
||||
m_footprint->Flip( m_footprint->GetPosition(), m_frame->Settings().m_FlipLeftRight );
|
||||
m_footprint->Flip( m_footprint->GetPosition(), m_frame->GetPcbNewSettings()->m_FlipLeftRight );
|
||||
|
||||
// Copy the models from the panel to the footprint
|
||||
std::vector<FP_3DMODEL>& panelList = m_3dPanel->GetModelList();
|
||||
|
|
|
@ -89,8 +89,7 @@ bool PANEL_DISPLAY_OPTIONS::TransferDataFromWindow()
|
|||
|
||||
if( m_isPCBEdit )
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
||||
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
|
||||
int i = m_OptDisplayTracksClearance->GetSelection();
|
||||
cfg->m_Display.m_TrackClearance = UTIL::GetValFromConfig( clearanceModeMap, i );
|
||||
|
|
|
@ -749,10 +749,11 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& aEvent )
|
|||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxString msg =
|
||||
wxString::Format( _( "Could not load footprint '%s' from library '%s'."
|
||||
"\n\n%s" ),
|
||||
getCurFootprintName(), getCurNickname(), ioe.Problem() );
|
||||
wxString msg = wxString::Format( _( "Could not load footprint '%s' from library '%s'."
|
||||
"\n\n%s" ),
|
||||
getCurFootprintName(),
|
||||
getCurNickname(),
|
||||
ioe.Problem() );
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
|
||||
|
@ -789,7 +790,8 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
|
|||
}
|
||||
else if( GetBoard()->GetFirstFootprint() )
|
||||
{
|
||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
PCBNEW_SETTINGS* cfg = pcbframe->GetPcbNewSettings();
|
||||
|
||||
if( pcbframe == nullptr ) // happens when the board editor is not active (or closed)
|
||||
{
|
||||
|
@ -822,7 +824,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->Settings().m_Display.m_ShowGlobalRatsnest );
|
||||
pad->SetLocalRatsnestVisible( cfg->m_Display.m_ShowGlobalRatsnest );
|
||||
|
||||
// Pads in the library all have orphaned nets. Replace with Default.
|
||||
pad->SetNetCode( 0 );
|
||||
|
@ -831,10 +833,7 @@ 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 );
|
||||
}
|
||||
newFootprint->Flip( newFootprint->GetPosition(), cfg->m_FlipLeftRight );
|
||||
|
||||
KIGFX::VIEW_CONTROLS* viewControls = pcbframe->GetCanvas()->GetViewControls();
|
||||
VECTOR2D cursorPos = viewControls->GetCursorPosition();
|
||||
|
|
|
@ -147,7 +147,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint )
|
|||
// Put it on FRONT layer,
|
||||
// because this is the default in Footprint Editor, and in libs
|
||||
if( newFootprint->GetLayer() != F_Cu )
|
||||
newFootprint->Flip( newFootprint->GetPosition(), frame->Settings().m_FlipLeftRight );
|
||||
newFootprint->Flip( newFootprint->GetPosition(), frame->GetPcbNewSettings()->m_FlipLeftRight );
|
||||
|
||||
// Put it in orientation 0,
|
||||
// because this is the default orientation in Footprint Editor, and in libs
|
||||
|
|
|
@ -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->Settings().m_Display.m_ShowGlobalRatsnest );
|
||||
pad->SetLocalRatsnestVisible( m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
|
||||
|
||||
// Pads in the library all have orphaned nets. Replace with Default.
|
||||
pad->SetNetCode( 0 );
|
||||
|
|
|
@ -269,7 +269,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( Settings().m_ColorTheme );
|
||||
return Pgm().GetSettingsManager().GetColorSettings( GetPcbNewSettings()->m_ColorTheme );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <3d_viewer/eda_3d_viewer_frame.h> // To include VIEWER3D_FRAMENAME
|
||||
#include <footprint_editor_settings.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <board.h>
|
||||
|
@ -73,9 +74,10 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName ) :
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||
m_pcb( nullptr ), m_originTransforms( *this ), m_spaceMouse( nullptr )
|
||||
m_pcb( nullptr ),
|
||||
m_originTransforms( *this ),
|
||||
m_spaceMouse( nullptr )
|
||||
{
|
||||
m_settings = static_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -233,7 +235,7 @@ void PCB_BASE_FRAME::AddFootprintToBoard( FOOTPRINT* aFootprint )
|
|||
// Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
|
||||
// built from a board)
|
||||
if( aFootprint->IsFlipped() )
|
||||
aFootprint->Flip( aFootprint->GetPosition(), m_settings->m_FlipLeftRight );
|
||||
aFootprint->Flip( aFootprint->GetPosition(), GetPcbNewSettings()->m_FlipLeftRight );
|
||||
|
||||
// Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
|
||||
// it might be stored in another orientation if the lib is an archive built from a board)
|
||||
|
@ -567,7 +569,7 @@ const VECTOR2I PCB_BASE_FRAME::GetUserOrigin() const
|
|||
{
|
||||
VECTOR2I origin( 0, 0 );
|
||||
|
||||
switch( Settings().m_Display.m_DisplayOrigin )
|
||||
switch( GetPcbNewSettings()->m_Display.m_DisplayOrigin )
|
||||
{
|
||||
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE: break;
|
||||
case PCB_DISPLAY_ORIGIN::PCB_ORIGIN_AUX: origin = GetAuxOrigin(); break;
|
||||
|
@ -922,10 +924,15 @@ FOOTPRINT_EDITOR_SETTINGS* PCB_BASE_FRAME::GetFootprintEditorSettings() const
|
|||
}
|
||||
|
||||
|
||||
PCB_VIEWERS_SETTINGS_BASE* PCB_BASE_FRAME::GetViewerSettingsBase() const
|
||||
{
|
||||
return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
}
|
||||
|
||||
|
||||
MAGNETIC_SETTINGS* PCB_BASE_FRAME::GetMagneticItemsSettings()
|
||||
{
|
||||
wxCHECK( m_settings, nullptr );
|
||||
return &m_settings->m_MagneticItems;
|
||||
return &GetPcbNewSettings()->m_MagneticItems;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -694,13 +694,13 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
|||
auto globalRatsnestCond =
|
||||
[this] (const SELECTION& )
|
||||
{
|
||||
return Settings().m_Display.m_ShowGlobalRatsnest;
|
||||
return GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest;
|
||||
};
|
||||
|
||||
auto curvedRatsnestCond =
|
||||
[this] (const SELECTION& )
|
||||
{
|
||||
return Settings().m_Display.m_DisplayRatsnestLinesCurved;
|
||||
return GetPcbNewSettings()->m_Display.m_DisplayRatsnestLinesCurved;
|
||||
};
|
||||
|
||||
auto netHighlightCond =
|
||||
|
@ -1166,7 +1166,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( Settings().m_Display.m_PadClearance )
|
||||
if( GetPcbNewSettings()->m_Display.m_PadClearance )
|
||||
{
|
||||
// Round-corner rects are expensive to draw, but are mostly found on
|
||||
// SMD pads which only need redrawing on an active-to-not-active
|
||||
|
@ -1187,7 +1187,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( Settings().m_Display.m_TrackClearance )
|
||||
if( GetPcbNewSettings()->m_Display.m_TrackClearance )
|
||||
{
|
||||
// Tracks aren't particularly expensive to draw, but it's an easy check.
|
||||
return track->IsOnLayer( oldLayer ) || track->IsOnLayer( aLayer );
|
||||
|
@ -1247,7 +1247,7 @@ void PCB_EDIT_FRAME::onBoardLoaded()
|
|||
// Sync layer and item visibility
|
||||
GetCanvas()->SyncLayersVisibility( m_pcb );
|
||||
|
||||
SetElementVisibility( LAYER_RATSNEST, Settings().m_Display.m_ShowGlobalRatsnest );
|
||||
SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
|
||||
|
||||
m_appearancePanel->OnBoardChanged();
|
||||
|
||||
|
@ -1355,7 +1355,7 @@ void PCB_EDIT_FRAME::OnModify()
|
|||
{
|
||||
PCB_BASE_FRAME::OnModify();
|
||||
|
||||
Update3DView( true, Settings().m_Display.m_Live3DRefresh );
|
||||
Update3DView( true, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
|
||||
|
||||
if( !GetTitle().StartsWith( wxT( "*" ) ) )
|
||||
UpdateTitle();
|
||||
|
@ -1842,10 +1842,10 @@ void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
|
|||
|
||||
renderSettings->LoadDisplayOptions( GetDisplayOptions() );
|
||||
|
||||
SetElementVisibility( LAYER_NO_CONNECTS, Settings().m_Display.m_PadNoConnects );
|
||||
SetElementVisibility( LAYER_RATSNEST, Settings().m_Display.m_ShowGlobalRatsnest );
|
||||
SetElementVisibility( LAYER_NO_CONNECTS, GetPcbNewSettings()->m_Display.m_PadNoConnects );
|
||||
SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
|
||||
|
||||
GetGalDisplayOptions().ReadWindowSettings( Settings().m_Window );
|
||||
GetGalDisplayOptions().ReadWindowSettings( GetPcbNewSettings()->m_Window );
|
||||
|
||||
// Netclass definitions could have changed, either by us or by Eeschema, so we need to
|
||||
// recompile the implicit rules
|
||||
|
|
|
@ -119,10 +119,10 @@ int PCB_ORIGIN_TRANSFORMS::getUserYOrigin() const
|
|||
|
||||
bool PCB_ORIGIN_TRANSFORMS::invertXAxis() const
|
||||
{
|
||||
return m_pcbBaseFrame.Settings().m_Display.m_DisplayInvertXAxis;
|
||||
return m_pcbBaseFrame.GetPcbNewSettings()->m_Display.m_DisplayInvertXAxis;
|
||||
}
|
||||
|
||||
bool PCB_ORIGIN_TRANSFORMS::invertYAxis() const
|
||||
{
|
||||
return m_pcbBaseFrame.Settings().m_Display.m_DisplayInvertYAxis;
|
||||
return m_pcbBaseFrame.GetPcbNewSettings()->m_Display.m_DisplayInvertYAxis;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include <project/net_settings.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <pcbnew_settings.h>
|
||||
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
|
@ -77,7 +78,10 @@ PCBNEW_SETTINGS* pcbconfig()
|
|||
// returns the viewer options existing to Cvpcb and Pcbnew
|
||||
static PCB_VIEWERS_SETTINGS_BASE* viewer_settings()
|
||||
{
|
||||
return static_cast<PCB_VIEWERS_SETTINGS_BASE*>( Kiface().KifaceSettings() );
|
||||
if( pcbconfig() )
|
||||
return Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
else
|
||||
return dynamic_cast<PCB_VIEWERS_SETTINGS_BASE*>( Kiface().KifaceSettings() );
|
||||
}
|
||||
|
||||
static bool displayPadFill()
|
||||
|
@ -993,8 +997,13 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
|||
wxString padNumber;
|
||||
|
||||
if( displayPadNumbers() )
|
||||
{
|
||||
padNumber = UnescapeString( aPad->GetNumber() );
|
||||
|
||||
if( !displayOpts )
|
||||
netname = UnescapeString( aPad->GetShortNetname() );
|
||||
}
|
||||
|
||||
if( displayOpts )
|
||||
{
|
||||
if( displayOpts->m_NetNames == 1 || displayOpts->m_NetNames == 3 )
|
||||
|
|
|
@ -1092,7 +1092,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
|||
|
||||
for( PAD* pad : fp->Pads() )
|
||||
{
|
||||
pad->SetLocalRatsnestVisible( m_frame->Settings().m_Display.m_ShowGlobalRatsnest );
|
||||
pad->SetLocalRatsnestVisible( m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
|
||||
|
||||
// Pads in the library all have orphaned nets. Replace with Default.
|
||||
pad->SetNetCode( 0 );
|
||||
|
@ -1101,7 +1101,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
|||
// Put it on FRONT layer,
|
||||
// (Can be stored flipped if the lib is an archive built from a board)
|
||||
if( fp->IsFlipped() )
|
||||
fp->Flip( fp->GetPosition(), m_frame->Settings().m_FlipLeftRight );
|
||||
fp->Flip( fp->GetPosition(), m_frame->GetPcbNewSettings()->m_FlipLeftRight );
|
||||
|
||||
fp->SetOrientation( ANGLE_0 );
|
||||
fp->SetPosition( cursorPos );
|
||||
|
|
|
@ -1243,7 +1243,7 @@ int BOARD_INSPECTION_TOOL::CrossProbePcbToSch( const TOOL_EVENT& aEvent )
|
|||
m_frame->SendMessageToEESCHEMA( nullptr );
|
||||
|
||||
// Update 3D viewer highlighting
|
||||
m_frame->Update3DView( false, frame()->Settings().m_Display.m_Live3DRefresh );
|
||||
m_frame->Update3DView( false, frame()->GetPcbNewSettings()->m_Display.m_Live3DRefresh );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1262,7 +1262,7 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
m_probingSchToPcb = false;
|
||||
|
||||
bool request3DviewRedraw = frame()->Settings().m_Display.m_Live3DRefresh;
|
||||
bool request3DviewRedraw = frame()->GetPcbNewSettings()->m_Display.m_Live3DRefresh;
|
||||
|
||||
if( item && item->Type() != PCB_FOOTPRINT_T )
|
||||
request3DviewRedraw = false;
|
||||
|
|
|
@ -1027,7 +1027,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
},
|
||||
// Prompt user regarding locked items if in board editor and in free-pad-mode (if
|
||||
// we're not in free-pad mode we delay this until the second RequestSelection()).
|
||||
frame()->Settings().m_AllowFreePads && !m_isFootprintEditor );
|
||||
frame()->GetPcbNewSettings()->m_AllowFreePads && !m_isFootprintEditor );
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
@ -1041,7 +1041,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Now filter out pads if not in free pads mode. We cannot do this in the first
|
||||
// RequestSelection() as we need the reference point when a pad is the selection front.
|
||||
if( !m_isFootprintEditor && !frame()->Settings().m_AllowFreePads )
|
||||
if( !m_isFootprintEditor && !frame()->GetPcbNewSettings()->m_AllowFreePads )
|
||||
{
|
||||
selection = m_selectionTool->RequestSelection(
|
||||
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
|
||||
|
@ -1301,7 +1301,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
|||
refPt = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) )->GetPosition();
|
||||
}
|
||||
|
||||
bool leftRight = frame()->Settings().m_FlipLeftRight;
|
||||
bool leftRight = frame()->GetPcbNewSettings()->m_FlipLeftRight;
|
||||
|
||||
// When editing footprints, all items have the same parent
|
||||
if( IsFootprintEditor() )
|
||||
|
@ -1464,7 +1464,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
case PCB_PAD_T:
|
||||
if( IsFootprintEditor() || frame()->Settings().m_AllowFreePads )
|
||||
if( IsFootprintEditor() || frame()->GetPcbNewSettings()->m_AllowFreePads )
|
||||
{
|
||||
PAD* pad = static_cast<PAD*>( item );
|
||||
FOOTPRINT* parent = static_cast<FOOTPRINT*>( item->GetParent() );
|
||||
|
@ -1544,8 +1544,11 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( bItem->Type() == PCB_PAD_T )
|
||||
{
|
||||
if( !IsFootprintEditor() && !frame()->Settings().m_AllowFreePads )
|
||||
if( !IsFootprintEditor()
|
||||
&& !frame()->GetPcbNewSettings()->m_AllowFreePads )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_commit->Modify( bItem->GetParent() );
|
||||
|
@ -1627,7 +1630,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
|
|||
// Make sure the rotation is from the right reference point
|
||||
selCenter += translation;
|
||||
|
||||
if( !frame()->Settings().m_Display.m_DisplayInvertYAxis )
|
||||
if( !frame()->GetPcbNewSettings()->m_Display.m_DisplayInvertYAxis )
|
||||
rotation = -rotation;
|
||||
|
||||
// When editing footprints, all items have the same parent
|
||||
|
|
|
@ -312,7 +312,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
},
|
||||
// Prompt user regarding locked items if in board editor and in free-pad-mode (if
|
||||
// we're not in free-pad mode we delay this until the second RequestSelection()).
|
||||
editFrame->Settings().m_AllowFreePads && !m_isFootprintEditor );
|
||||
editFrame->GetPcbNewSettings()->m_AllowFreePads && !m_isFootprintEditor );
|
||||
|
||||
if( m_dragging || selection.Empty() )
|
||||
return 0;
|
||||
|
@ -324,7 +324,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
|
||||
// Now filter out pads if not in free pads mode. We cannot do this in the first
|
||||
// RequestSelection() as we need the item_layers when a pad is the selection front.
|
||||
if( !m_isFootprintEditor && !editFrame->Settings().m_AllowFreePads )
|
||||
if( !m_isFootprintEditor && !editFrame->GetPcbNewSettings()->m_AllowFreePads )
|
||||
{
|
||||
selection = m_selectionTool->RequestSelection(
|
||||
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
|
||||
|
@ -396,7 +396,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
bool hv45Mode = false;
|
||||
bool eatFirstMouseUp = true;
|
||||
bool hasRedrawn3D = false;
|
||||
bool allowRedraw3D = editFrame->Settings().m_Display.m_Live3DRefresh;
|
||||
bool allowRedraw3D = editFrame->GetPcbNewSettings()->m_Display.m_Live3DRefresh;
|
||||
// Courtyard conflicts will be tested only if the LAYER_CONFLICTS_SHADOW gal layer is visible
|
||||
bool showCourtyardConflicts = !m_isFootprintEditor
|
||||
&& board->IsElementVisible( LAYER_CONFLICTS_SHADOW );
|
||||
|
@ -524,7 +524,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
// Prepare to start dragging
|
||||
if( !( evt->IsAction( &PCB_ACTIONS::move )
|
||||
|| evt->IsAction( &PCB_ACTIONS::moveWithReference ) )
|
||||
&& ( editFrame->Settings().m_TrackDragAction != TRACK_DRAG_ACTION::MOVE ) )
|
||||
&& ( editFrame->GetPcbNewSettings()->m_TrackDragAction != TRACK_DRAG_ACTION::MOVE ) )
|
||||
{
|
||||
if( invokeInlineRouter( PNS::DM_ANY ) )
|
||||
break;
|
||||
|
|
|
@ -146,37 +146,37 @@ bool PCB_EDITOR_CONDITIONS::hasItemsFunc( const SELECTION& aSelection, PCB_BASE_
|
|||
|
||||
bool PCB_EDITOR_CONDITIONS::padNumberDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
{
|
||||
return aFrame->Settings().m_ViewersDisplay.m_DisplayPadNumbers;
|
||||
return aFrame->GetViewerSettingsBase()->m_ViewersDisplay.m_DisplayPadNumbers;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDITOR_CONDITIONS::padFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
{
|
||||
return aFrame->Settings().m_ViewersDisplay.m_DisplayPadFill;
|
||||
return aFrame->GetViewerSettingsBase()->m_ViewersDisplay.m_DisplayPadFill;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDITOR_CONDITIONS::textFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
{
|
||||
return aFrame->Settings().m_ViewersDisplay.m_DisplayTextFill;
|
||||
return aFrame->GetViewerSettingsBase()->m_ViewersDisplay.m_DisplayTextFill;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDITOR_CONDITIONS::graphicsFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
{
|
||||
return aFrame->Settings().m_ViewersDisplay.m_DisplayGraphicsFill;
|
||||
return aFrame->GetViewerSettingsBase()->m_ViewersDisplay.m_DisplayGraphicsFill;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDITOR_CONDITIONS::viaFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
{
|
||||
return aFrame->Settings().m_Display.m_DisplayViaFill;
|
||||
return aFrame->GetPcbNewSettings()->m_Display.m_DisplayViaFill;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDITOR_CONDITIONS::trackFillDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
{
|
||||
return aFrame->Settings().m_Display.m_DisplayPcbTrackFill;
|
||||
return aFrame->GetPcbNewSettings()->m_Display.m_DisplayPcbTrackFill;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
MOUSE_DRAG_ACTION dragAction = m_frame->GetDragAction();
|
||||
TRACK_DRAG_ACTION trackDragAction = m_frame->Settings().m_TrackDragAction;
|
||||
TRACK_DRAG_ACTION trackDragAction = m_frame->GetPcbNewSettings()->m_TrackDragAction;
|
||||
|
||||
// on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
|
||||
setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
|
||||
|
@ -668,8 +668,7 @@ const GENERAL_COLLECTORS_GUIDE PCB_SELECTION_TOOL::getCollectorsGuide() const
|
|||
|
||||
bool PCB_SELECTION_TOOL::ctrlClickHighlights()
|
||||
{
|
||||
return m_frame && m_frame->Settings().m_CtrlClickHighlight
|
||||
&& !m_frame->IsType( FRAME_FOOTPRINT_EDITOR );
|
||||
return m_frame && m_frame->GetPcbNewSettings()->m_CtrlClickHighlight && !m_isFootprintEditor;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1537,9 +1536,9 @@ void PCB_SELECTION_TOOL::doSyncSelection( const std::vector<BOARD_ITEM*>& aItems
|
|||
|
||||
if( bbox.GetWidth() > 0 && bbox.GetHeight() > 0 )
|
||||
{
|
||||
if( m_frame->Settings().m_CrossProbing.center_on_items )
|
||||
if( m_frame->GetPcbNewSettings()->m_CrossProbing.center_on_items )
|
||||
{
|
||||
if( m_frame->Settings().m_CrossProbing.zoom_to_fit )
|
||||
if( m_frame->GetPcbNewSettings()->m_CrossProbing.zoom_to_fit )
|
||||
zoomFitCrossProbeBBox( bbox );
|
||||
|
||||
m_frame->FocusOnLocation( bbox.Centre() );
|
||||
|
@ -2884,7 +2883,7 @@ void PCB_SELECTION_TOOL::FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollect
|
|||
BOARD_ITEM* item = aCollector[i];
|
||||
|
||||
if( !m_isFootprintEditor && item->Type() == PCB_PAD_T
|
||||
&& !frame()->Settings().m_AllowFreePads )
|
||||
&& !frame()->GetPcbNewSettings()->m_AllowFreePads )
|
||||
{
|
||||
if( !aCollector.HasItem( item->GetParent() ) )
|
||||
to_add.insert( item->GetParent() );
|
||||
|
|
|
@ -225,7 +225,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
|
|||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
|
||||
{
|
||||
newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
|
||||
newItem->Flip( newItem->GetPosition(), frame()->GetPcbNewSettings()->m_FlipLeftRight );
|
||||
view()->Update( &preview );
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||
|
|
|
@ -90,8 +90,8 @@ template<class T> void Flip( T& aValue )
|
|||
|
||||
int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_VIEWERS_SETTINGS_BASE& cfg = frame()->Settings();
|
||||
Flip( cfg.m_ViewersDisplay.m_DisplayPadNumbers );
|
||||
PCB_VIEWERS_SETTINGS_BASE* cfg = frame()->GetViewerSettingsBase();
|
||||
Flip( cfg->m_ViewersDisplay.m_DisplayPadNumbers );
|
||||
|
||||
for( FOOTPRINT* fp : board()->Footprints() )
|
||||
{
|
||||
|
@ -107,8 +107,8 @@ int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
|
|||
|
||||
int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_VIEWERS_SETTINGS_BASE& cfg = frame()->Settings();
|
||||
Flip( cfg.m_ViewersDisplay.m_DisplayPadFill );
|
||||
PCB_VIEWERS_SETTINGS_BASE* cfg = frame()->GetViewerSettingsBase();
|
||||
Flip( cfg->m_ViewersDisplay.m_DisplayPadFill );
|
||||
|
||||
for( FOOTPRINT* fp : board()->Footprints() )
|
||||
{
|
||||
|
@ -124,8 +124,8 @@ int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent )
|
|||
|
||||
int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_VIEWERS_SETTINGS_BASE& cfg = frame()->Settings();
|
||||
Flip( cfg.m_ViewersDisplay.m_DisplayGraphicsFill );
|
||||
PCB_VIEWERS_SETTINGS_BASE* cfg = frame()->GetViewerSettingsBase();
|
||||
Flip( cfg->m_ViewersDisplay.m_DisplayGraphicsFill );
|
||||
|
||||
for( FOOTPRINT* fp : board()->Footprints() )
|
||||
{
|
||||
|
@ -154,8 +154,8 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent )
|
|||
|
||||
int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_VIEWERS_SETTINGS_BASE& cfg = frame()->Settings();
|
||||
Flip( cfg.m_ViewersDisplay.m_DisplayTextFill );
|
||||
PCB_VIEWERS_SETTINGS_BASE* cfg = frame()->GetViewerSettingsBase();
|
||||
Flip( cfg->m_ViewersDisplay.m_DisplayTextFill );
|
||||
|
||||
for( FOOTPRINT* fp : board()->Footprints() )
|
||||
{
|
||||
|
|
|
@ -1226,7 +1226,7 @@ void APPEARANCE_CONTROLS::setVisibleObjects( GAL_SET aLayers )
|
|||
{
|
||||
// Ratsnest visibility is controlled by the ratsnest option, and not by the preset
|
||||
if( m_frame->IsType( FRAME_PCB_EDITOR ) )
|
||||
aLayers.set( LAYER_RATSNEST, m_frame->Settings().m_Display.m_ShowGlobalRatsnest );
|
||||
aLayers.set( LAYER_RATSNEST, m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest );
|
||||
|
||||
m_frame->GetBoard()->SetVisibleElements( aLayers );
|
||||
}
|
||||
|
@ -1294,16 +1294,18 @@ void APPEARANCE_CONTROLS::UpdateDisplayOptions()
|
|||
|
||||
if( !m_isFpEditor )
|
||||
{
|
||||
if( !m_frame->Settings().m_Display.m_ShowGlobalRatsnest )
|
||||
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
|
||||
|
||||
if( !cfg->m_Display.m_ShowGlobalRatsnest )
|
||||
m_rbRatsnestNone->SetValue( true );
|
||||
else if( m_frame->Settings().m_Display.m_RatsnestMode == RATSNEST_MODE::ALL )
|
||||
else if( cfg->m_Display.m_RatsnestMode == RATSNEST_MODE::ALL )
|
||||
m_rbRatsnestAllLayers->SetValue( true );
|
||||
else
|
||||
m_rbRatsnestVisLayers->SetValue( true );
|
||||
|
||||
wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) );
|
||||
APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST );
|
||||
ratsnest->ctl_visibility->SetValue( m_frame->Settings().m_Display.m_ShowGlobalRatsnest );
|
||||
ratsnest->ctl_visibility->SetValue( cfg->m_Display.m_ShowGlobalRatsnest );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1959,7 +1961,7 @@ void APPEARANCE_CONTROLS::onObjectVisibilityChanged( GAL_LAYER_ID aLayer, bool i
|
|||
|
||||
if( m_frame->IsType( FRAME_PCB_EDITOR ) )
|
||||
{
|
||||
m_frame->Settings().m_Display.m_ShowGlobalRatsnest = isVisible;
|
||||
m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest = isVisible;
|
||||
m_frame->GetBoard()->SetElementVisibility( aLayer, isVisible );
|
||||
m_frame->GetCanvas()->RedrawRatsnest();
|
||||
}
|
||||
|
@ -3022,19 +3024,21 @@ void APPEARANCE_CONTROLS::onNetColorMode( wxCommandEvent& aEvent )
|
|||
|
||||
void APPEARANCE_CONTROLS::onRatsnestMode( wxCommandEvent& aEvent )
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
|
||||
|
||||
if( m_rbRatsnestAllLayers->GetValue() )
|
||||
{
|
||||
m_frame->Settings().m_Display.m_ShowGlobalRatsnest = true;
|
||||
m_frame->Settings().m_Display.m_RatsnestMode = RATSNEST_MODE::ALL;
|
||||
cfg->m_Display.m_ShowGlobalRatsnest = true;
|
||||
cfg->m_Display.m_RatsnestMode = RATSNEST_MODE::ALL;
|
||||
}
|
||||
else if( m_rbRatsnestVisLayers->GetValue() )
|
||||
{
|
||||
m_frame->Settings().m_Display.m_ShowGlobalRatsnest = true;
|
||||
m_frame->Settings().m_Display.m_RatsnestMode = RATSNEST_MODE::VISIBLE;
|
||||
cfg->m_Display.m_ShowGlobalRatsnest = true;
|
||||
cfg->m_Display.m_RatsnestMode = RATSNEST_MODE::VISIBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->Settings().m_Display.m_ShowGlobalRatsnest = false;
|
||||
cfg->m_Display.m_ShowGlobalRatsnest = false;
|
||||
}
|
||||
|
||||
m_frame->GetCanvas()->RedrawRatsnest();
|
||||
|
|
Loading…
Reference in New Issue