Improve clarity of default zone settings.

This commit is contained in:
Jeff Young 2024-02-03 12:46:59 +00:00
parent d9737a39bf
commit 0890ac57dd
10 changed files with 8 additions and 57 deletions

View File

@ -182,9 +182,6 @@ public:
*/ */
void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh = true ); void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh = true );
const ZONE_SETTINGS& GetZoneSettings() const;
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
/** /**
* Return the #PCB_PLOT_PARAMS for the BOARD owned by this frame. * Return the #PCB_PLOT_PARAMS for the BOARD owned by this frame.
*/ */

View File

@ -771,17 +771,6 @@ BOARD_DESIGN_SETTINGS& BOARD::GetDesignSettings() const
} }
const ZONE_SETTINGS& BOARD::GetZoneSettings() const
{
return GetDesignSettings().GetDefaultZoneSettings();
}
void BOARD::SetZoneSettings( const ZONE_SETTINGS& aSettings )
{
GetDesignSettings().SetDefaultZoneSettings( aSettings );
}
int BOARD::GetMaxClearanceValue() const int BOARD::GetMaxClearanceValue() const
{ {
int worstClearance = m_designSettings->GetBiggestClearanceValue(); int worstClearance = m_designSettings->GetBiggestClearanceValue();

View File

@ -642,10 +642,6 @@ public:
*/ */
BOARD_DESIGN_SETTINGS& GetDesignSettings() const; BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
const ZONE_SETTINGS& GetZoneSettings() const override;
void SetZoneSettings( const ZONE_SETTINGS& aSettings ) override;
// Tented vias are vias covered by solder mask. So because the solder mask is a negative // Tented vias are vias covered by solder mask. So because the solder mask is a negative
// layer, tented vias are NOT plotted on solder mask layers // layer, tented vias are NOT plotted on solder mask layers
bool GetTentVias() const { return !m_plotOptions.GetPlotViaOnMaskLayer(); } bool GetTentVias() const { return !m_plotOptions.GetPlotViaOnMaskLayer(); }

View File

@ -79,26 +79,6 @@ public:
Remove( aItem ); Remove( aItem );
delete aItem; delete aItem;
} }
/**
* @brief Fetch the zone settings for this container
*/
virtual const ZONE_SETTINGS& GetZoneSettings() const
{
return m_zoneSettings;
}
/**
* @brief Set the zone settings for this container
* @param aSettings new Zone settings for this container
*/
virtual void SetZoneSettings( const ZONE_SETTINGS& aSettings )
{
m_zoneSettings = aSettings;
}
private:
ZONE_SETTINGS m_zoneSettings;
}; };
#endif /* BOARD_ITEM_CONTAINER_H */ #endif /* BOARD_ITEM_CONTAINER_H */

View File

@ -29,6 +29,7 @@
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <board_commit.h> #include <board_commit.h>
#include <board_design_settings.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/actions.h> #include <tool/actions.h>
#include <zone.h> #include <zone.h>
@ -40,7 +41,7 @@
void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone ) void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
{ {
int dialogResult; int dialogResult;
ZONE_SETTINGS zoneInfo = GetZoneSettings(); ZONE_SETTINGS zoneInfo = m_pcb->GetDesignSettings().GetDefaultZoneSettings();
PICKED_ITEMS_LIST pickedList; // zones for undo/redo command PICKED_ITEMS_LIST pickedList; // zones for undo/redo command
PICKED_ITEMS_LIST deletedList; // zones that have been deleted when combined PICKED_ITEMS_LIST deletedList; // zones that have been deleted when combined
BOARD_COMMIT commit( this ); BOARD_COMMIT commit( this );
@ -74,7 +75,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE* aZone )
return; return;
} }
SetZoneSettings( zoneInfo ); m_pcb->GetDesignSettings().SetDefaultZoneSettings( zoneInfo );
OnModify(); OnModify();
if( dialogResult == ZONE_EXPORT_VALUES ) if( dialogResult == ZONE_EXPORT_VALUES )

View File

@ -581,18 +581,6 @@ void PCB_BASE_FRAME::SetDrawBgColor( const COLOR4D& aColor )
} }
const ZONE_SETTINGS& PCB_BASE_FRAME::GetZoneSettings() const
{
return m_pcb->GetDesignSettings().GetDefaultZoneSettings();
}
void PCB_BASE_FRAME::SetZoneSettings( const ZONE_SETTINGS& aSettings )
{
m_pcb->GetDesignSettings().SetDefaultZoneSettings( aSettings );
}
const PCB_PLOT_PARAMS& PCB_BASE_FRAME::GetPlotSettings() const const PCB_PLOT_PARAMS& PCB_BASE_FRAME::GetPlotSettings() const
{ {
return m_pcb->GetPlotOptions(); return m_pcb->GetPlotOptions();

View File

@ -905,7 +905,7 @@ void PCB_IO_KICAD_LEGACY::loadSHEET()
void PCB_IO_KICAD_LEGACY::loadSETUP() void PCB_IO_KICAD_LEGACY::loadSETUP()
{ {
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings(); ZONE_SETTINGS zoneSettings = bds.GetDefaultZoneSettings();
std::shared_ptr<NETCLASS> defaultNetclass = bds.m_NetSettings->m_DefaultNetClass; std::shared_ptr<NETCLASS> defaultNetclass = bds.m_NetSettings->m_DefaultNetClass;
char* line; char* line;
char* saveptr; char* saveptr;
@ -1146,7 +1146,7 @@ void PCB_IO_KICAD_LEGACY::loadSETUP()
} }
else if( TESTLINE( "$EndSETUP" ) ) else if( TESTLINE( "$EndSETUP" ) )
{ {
m_board->SetZoneSettings( zoneSettings ); bds.SetDefaultZoneSettings( zoneSettings );
// Very old *.brd file does not have NETCLASSes // Very old *.brd file does not have NETCLASSes
// "TrackWidth", "ViaSize", "ViaDrill", "ViaMinSize", and "TrackClearence" were // "TrackWidth", "ViaSize", "ViaDrill", "ViaMinSize", and "TrackClearence" were

View File

@ -468,7 +468,7 @@ int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent )
// Creating zone or keepout // Creating zone or keepout
PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>(); PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
BOARD_ITEM_CONTAINER* parent = frame->GetModel(); BOARD_ITEM_CONTAINER* parent = frame->GetModel();
ZONE_SETTINGS zoneInfo = frame->GetZoneSettings(); ZONE_SETTINGS zoneInfo = bds.GetDefaultZoneSettings();
bool nonCopper = IsNonCopperLayer( destLayer ); bool nonCopper = IsNonCopperLayer( destLayer );
zoneInfo.m_Layers.reset().set( destLayer ); zoneInfo.m_Layers.reset().set( destLayer );

View File

@ -92,7 +92,7 @@ std::unique_ptr<ZONE> ZONE_CREATE_HELPER::createNewZone( bool aKeepout )
std::set<int> highlightedNets = board->GetHighLightNetCodes(); std::set<int> highlightedNets = board->GetHighLightNetCodes();
// Get the current default settings for zones // Get the current default settings for zones
ZONE_SETTINGS zoneInfo = frame->GetZoneSettings(); ZONE_SETTINGS zoneInfo = board->GetDesignSettings().GetDefaultZoneSettings();
zoneInfo.m_Layers.reset().set( m_params.m_layer ); // TODO(JE) multilayer defaults? zoneInfo.m_Layers.reset().set( m_params.m_layer ); // TODO(JE) multilayer defaults?
zoneInfo.m_NetcodeSelection = highlightedNets.empty() ? -1 : *highlightedNets.begin(); zoneInfo.m_NetcodeSelection = highlightedNets.empty() ? -1 : *highlightedNets.begin();
zoneInfo.SetIsRuleArea( m_params.m_keepout ); zoneInfo.SetIsRuleArea( m_params.m_keepout );

View File

@ -73,7 +73,7 @@ ZONE::ZONE( BOARD_ITEM_CONTAINER* aParent ) :
m_hatchThickness = m_ZoneMinThickness; m_hatchThickness = m_ZoneMinThickness;
m_hatchGap = m_ZoneMinThickness; m_hatchGap = m_ZoneMinThickness;
aParent->GetZoneSettings().ExportSetting( *this ); aParent->GetBoard()->GetDesignSettings().GetDefaultZoneSettings().ExportSetting( *this );
m_needRefill = false; // True only after edits. m_needRefill = false; // True only after edits.
} }