Copper Zone Properties dialog modifications
* Changed the net sorting mechanism make it similar to the 'Net Inspector' window * Replaced the 'Show All Nets' check box with 'Hide auto-generated nets' check box * Replace the warning label with wxInfoBar * Removed unused controls and renamed controls where applicable * Re-arranged the Copper Zone Properties dialog layout to improve user experience * Minor code refactoring of DIALOG_COPPER_ZONE class Fixes https://gitlab.com/kicad/code/kicad/-/issues/8547
This commit is contained in:
parent
4df3ba6a56
commit
8d65663566
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.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
|
||||
|
@ -34,41 +34,55 @@
|
|||
#include <pad.h>
|
||||
#include <board.h>
|
||||
#include <trigo.h>
|
||||
#include <eda_pattern_match.h>
|
||||
|
||||
#include <dialog_copper_zones_base.h>
|
||||
#include <kicad_string.h>
|
||||
|
||||
|
||||
class DIALOG_COPPER_ZONE : public DIALOG_COPPER_ZONE_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings );
|
||||
|
||||
private:
|
||||
using NET_FILTER = std::unique_ptr<EDA_PATTERN_MATCH>;
|
||||
using NET_FILTER_LIST = std::vector<NET_FILTER>;
|
||||
|
||||
static constexpr int INVALID_NET_CODE{ 0 };
|
||||
|
||||
static constexpr int DEFAULT_SORT_CONFIG{ -1 };
|
||||
static constexpr int NO_PERSISTENT_SORT_MODE{ 0 };
|
||||
static constexpr int HIDE_ANONYMOUS_NETS{ 1 << 0 };
|
||||
static constexpr int SORT_BY_PAD_COUNT{ 1 << 1 };
|
||||
|
||||
PCB_BASE_FRAME* m_Parent;
|
||||
|
||||
bool m_settingsExported; // settings will be written to all other zones
|
||||
|
||||
ZONE_SETTINGS m_settings;
|
||||
ZONE_SETTINGS* m_ptr;
|
||||
|
||||
std::map<wxString, int> m_displayNameToNetCodeMap;
|
||||
|
||||
bool m_netSortingByPadCount;
|
||||
bool m_netFiltering;
|
||||
static wxString m_netNameShowFilter; // the filter to show nets (default * "*"). Static
|
||||
// to keep this pattern for an entire Pcbnew session
|
||||
NET_FILTER_LIST m_showNetsFilter;
|
||||
|
||||
int m_cornerSmoothingType;
|
||||
int m_maxNetCode;
|
||||
int m_currentlySelectedNetcode;
|
||||
|
||||
UNIT_BINDER m_cornerRadius;
|
||||
UNIT_BINDER m_clearance;
|
||||
UNIT_BINDER m_minWidth;
|
||||
UNIT_BINDER m_antipadClearance ;
|
||||
UNIT_BINDER m_antipadClearance;
|
||||
UNIT_BINDER m_spokeWidth;
|
||||
|
||||
UNIT_BINDER m_gridStyleRotation;
|
||||
UNIT_BINDER m_gridStyleThickness;
|
||||
UNIT_BINDER m_gridStyleGap;
|
||||
UNIT_BINDER m_islandThreshold;
|
||||
bool m_hideAutoGeneratedNets;
|
||||
|
||||
std::map<wxString, int> m_netNameToNetCode;
|
||||
std::vector<NETINFO_ITEM*> m_netInfoItemList;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
@ -84,19 +98,36 @@ private:
|
|||
void OnLayerSelection( wxDataViewEvent& event ) override;
|
||||
void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
|
||||
void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override;
|
||||
void OnRunFiltersButtonClick( wxCommandEvent& event ) override;
|
||||
void OnShowNetNameFilterChange( wxCommandEvent& event ) override;
|
||||
void OnUpdateUI( wxUpdateUIEvent& ) override;
|
||||
void OnButtonCancelClick( wxCommandEvent& event ) override;
|
||||
void OnClose( wxCloseEvent& event ) override;
|
||||
void OnNetSelectionUpdated( wxCommandEvent& event ) override;
|
||||
void OnRemoveIslandsSelection( wxCommandEvent& event ) override;
|
||||
|
||||
void buildAvailableListOfNets();
|
||||
void readNetInformation();
|
||||
void readFilteringAndSortingCriteria();
|
||||
void buildListOfNets( const NETINFO_LIST& nets );
|
||||
wxArrayString buildListOfNetsToDisplay();
|
||||
void sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets, const int maxNetCode );
|
||||
void updateDisplayedListOfNets();
|
||||
int ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList );
|
||||
void displayNetsList( const wxArrayString& netNamesList, int selectIndex );
|
||||
void updateShowNetsFilter();
|
||||
wxString getUnescapedNetName( const NETINFO_ITEM* net );
|
||||
void sortNetsIfRequired();
|
||||
wxArrayString getSortedNetNamesList();
|
||||
wxArrayString applyShowFilter( const wxArrayString& sortedNetNames );
|
||||
wxArrayString applyHideFilterIfRequired( const wxArrayString& netNames );
|
||||
bool isAutoGenerated( const wxString& netName );
|
||||
void updateCurrentNetSelection();
|
||||
void updateInfoBar();
|
||||
void handleRemoveIslandsSelection();
|
||||
void storePersistentNetSortConfigurations();
|
||||
void loadPersistentNetSortConfigurations();
|
||||
};
|
||||
|
||||
|
||||
// Initialize static member variables
|
||||
wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) );
|
||||
|
||||
|
||||
int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
|
||||
{
|
||||
DIALOG_COPPER_ZONE dlg( aCaller, aSettings );
|
||||
|
@ -105,21 +136,50 @@ int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
|
|||
}
|
||||
|
||||
|
||||
// The pad count for each netcode, stored in a buffer for a fast access.
|
||||
// This is needed by the sort function sortNetsByNodes()
|
||||
static std::vector<int> padCountListByNet;
|
||||
|
||||
|
||||
// Sort nets by decreasing pad count.
|
||||
// For same pad count, sort by alphabetic names
|
||||
static bool sortNetsByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
|
||||
{
|
||||
int countA = padCountListByNet[a->GetNetCode()];
|
||||
int countB = padCountListByNet[b->GetNetCode()];
|
||||
|
||||
if( countA == countB )
|
||||
return a->GetNetname() < b->GetNetname();
|
||||
else
|
||||
return countB < countA;
|
||||
}
|
||||
|
||||
|
||||
// Sort nets by alphabetic names
|
||||
static bool sortNetsByNames( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
|
||||
{
|
||||
return a->GetNetname() < b->GetNetname();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
|
||||
DIALOG_COPPER_ZONE_BASE( aParent ),
|
||||
m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
|
||||
m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
|
||||
m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits ),
|
||||
m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits ),
|
||||
m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits ),
|
||||
m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits ),
|
||||
m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation, m_staticTextRotUnits ),
|
||||
m_gridStyleThickness( aParent, m_staticTextStyleThickness, m_tcGridStyleThickness, m_GridStyleThicknessUnits ),
|
||||
m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits ),
|
||||
m_islandThreshold( aParent, m_islandThresholdLabel, m_tcIslandThreshold, m_islandThresholdUnits )
|
||||
DIALOG_COPPER_ZONE_BASE( aParent ),
|
||||
m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
|
||||
m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
|
||||
m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits ),
|
||||
m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits ),
|
||||
m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits ),
|
||||
m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits ),
|
||||
m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation,
|
||||
m_staticTextRotUnits ),
|
||||
m_gridStyleThickness( aParent, m_staticTextStyleThickness, m_tcGridStyleThickness,
|
||||
m_GridStyleThicknessUnits ),
|
||||
m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits ),
|
||||
m_islandThreshold( aParent, m_islandThresholdLabel, m_tcIslandThreshold,
|
||||
m_islandThresholdUnits ),
|
||||
m_hideAutoGeneratedNets{ false }
|
||||
{
|
||||
m_Parent = aParent;
|
||||
m_bitmapNoNetWarning->SetBitmap( KiBitmap( BITMAPS::dialog_warning ) );
|
||||
|
||||
m_ptr = aSettings;
|
||||
m_settings = *aSettings;
|
||||
|
@ -127,10 +187,10 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
|
|||
|
||||
m_settingsExported = false;
|
||||
|
||||
m_netFiltering = false;
|
||||
m_netSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
|
||||
|
||||
m_sdbSizerOK->SetDefault();
|
||||
m_ShowNetNameFilter->SetHint( _( "Filter" ) );
|
||||
|
||||
m_cbRemoveIslands->Bind( wxEVT_CHOICE,
|
||||
[&]( wxCommandEvent& )
|
||||
|
@ -190,27 +250,15 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
m_islandThresholdLabel->Enable( val );
|
||||
m_islandThresholdUnits->Enable( val );
|
||||
|
||||
wxString netNameDoNotShowFilter = wxT( "Net-*" );
|
||||
m_netFiltering = false;
|
||||
m_netSortingByPadCount = true;
|
||||
loadPersistentNetSortConfigurations();
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
|
||||
|
||||
int opt = cfg->m_Zones.net_sort_mode;
|
||||
m_netFiltering = opt >= 2;
|
||||
m_netSortingByPadCount = opt % 2;
|
||||
|
||||
netNameDoNotShowFilter = cfg->m_Zones.net_filter;
|
||||
|
||||
m_ShowNetNameFilter->ChangeValue( m_netNameShowFilter );
|
||||
m_DoNotShowNetNameFilter->ChangeValue( netNameDoNotShowFilter );
|
||||
m_showAllNetsOpt->SetValue( !m_netFiltering );
|
||||
m_sortByPadsOpt->SetValue( m_netSortingByPadCount );
|
||||
m_hideAutoGenNetNamesOpt->SetValue( m_hideAutoGeneratedNets );
|
||||
|
||||
// Build list of nets:
|
||||
buildAvailableListOfNets();
|
||||
m_currentlySelectedNetcode = m_settings.m_NetcodeSelection;
|
||||
|
||||
SetInitialFocus( m_ListNetNameSelection );
|
||||
// Initialize information required to display nets list
|
||||
readNetInformation();
|
||||
|
||||
switch( m_settings.m_FillMode )
|
||||
{
|
||||
|
@ -246,6 +294,13 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
|
||||
m_tcZoneName->SetValue( m_settings.m_Name );
|
||||
|
||||
updateInfoBar();
|
||||
handleRemoveIslandsSelection();
|
||||
|
||||
updateDisplayedListOfNets();
|
||||
|
||||
SetInitialFocus( m_ShowNetNameFilter );
|
||||
|
||||
// Enable/Disable some widgets
|
||||
wxCommandEvent event;
|
||||
OnStyleSelection( event );
|
||||
|
@ -256,22 +311,45 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::readNetInformation()
|
||||
{
|
||||
NETINFO_LIST& netInfoList = m_Parent->GetBoard()->GetNetInfo();
|
||||
|
||||
if( netInfoList.GetNetCount() > 0 )
|
||||
{
|
||||
buildListOfNets( netInfoList );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::buildListOfNets( const NETINFO_LIST& nets )
|
||||
{
|
||||
m_netInfoItemList.clear();
|
||||
m_netInfoItemList.reserve( nets.GetNetCount() );
|
||||
|
||||
m_netNameToNetCode.clear();
|
||||
m_netNameToNetCode[wxT( "<no net>" )] = INVALID_NET_CODE;
|
||||
|
||||
m_maxNetCode = INVALID_NET_CODE;
|
||||
|
||||
for( NETINFO_ITEM* net : nets )
|
||||
{
|
||||
const int& netCode = net->GetNetCode();
|
||||
const wxString& netName = getUnescapedNetName( net );
|
||||
|
||||
m_netNameToNetCode[netName] = netCode;
|
||||
|
||||
if( netCode > INVALID_NET_CODE && net->IsCurrent() )
|
||||
{
|
||||
m_netInfoItemList.push_back( net );
|
||||
m_maxNetCode = std::max( netCode, m_maxNetCode );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::OnUpdateUI( wxUpdateUIEvent& )
|
||||
{
|
||||
if( m_ListNetNameSelection->GetSelection() < 0 )
|
||||
m_ListNetNameSelection->SetSelection( 0 );
|
||||
|
||||
bool noNetSelected = m_ListNetNameSelection->GetSelection() == 0;
|
||||
bool enableSize = !noNetSelected && ( m_cbRemoveIslands->GetSelection() == 2 );
|
||||
|
||||
m_bNoNetWarning->Show( noNetSelected );
|
||||
|
||||
// Zones with no net never have islands removed
|
||||
m_cbRemoveIslands->Enable( !noNetSelected );
|
||||
m_islandThresholdLabel->Enable( enableSize );
|
||||
m_islandThresholdUnits->Enable( enableSize );
|
||||
m_tcIslandThreshold->Enable( enableSize );
|
||||
|
||||
if( m_cornerSmoothingType != m_cornerSmoothingChoice->GetSelection() )
|
||||
{
|
||||
m_cornerSmoothingType = m_cornerSmoothingChoice->GetSelection();
|
||||
|
@ -294,10 +372,42 @@ void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::OnNetSelectionUpdated( wxCommandEvent& event )
|
||||
{
|
||||
updateCurrentNetSelection();
|
||||
|
||||
updateInfoBar();
|
||||
|
||||
// When info bar is updated, the nets-list shrinks.
|
||||
// Therefore, we need to reestablish the list and maintain the
|
||||
// correct selection
|
||||
updateDisplayedListOfNets();
|
||||
|
||||
handleRemoveIslandsSelection();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::OnRemoveIslandsSelection( wxCommandEvent& event )
|
||||
{
|
||||
handleRemoveIslandsSelection();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::handleRemoveIslandsSelection()
|
||||
{
|
||||
bool noNetSelected = m_currentlySelectedNetcode == INVALID_NET_CODE;
|
||||
bool enableSize = !noNetSelected && ( m_cbRemoveIslands->GetSelection() == 2 );
|
||||
|
||||
// Zones with no net never have islands removed
|
||||
m_cbRemoveIslands->Enable( !noNetSelected );
|
||||
m_islandThresholdLabel->Enable( enableSize );
|
||||
m_islandThresholdUnits->Enable( enableSize );
|
||||
m_tcIslandThreshold->Enable( enableSize );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_COPPER_ZONE::TransferDataFromWindow()
|
||||
{
|
||||
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
||||
|
||||
if( m_GridStyleCtrl->GetSelection() > 0 )
|
||||
m_settings.m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN;
|
||||
else
|
||||
|
@ -369,9 +479,6 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
|||
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
|
||||
|
||||
cfg->m_Zones.hatching_style = static_cast<int>( m_settings.m_ZoneBorderDisplayStyle );
|
||||
cfg->m_Zones.net_filter = m_DoNotShowNetNameFilter->GetValue().ToStdString();
|
||||
|
||||
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
||||
|
||||
m_settings.m_ZoneClearance = m_clearance.GetValue();
|
||||
m_settings.m_ZoneMinThickness = m_minWidth.GetValue();
|
||||
|
@ -395,6 +502,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
|||
return false;
|
||||
}
|
||||
|
||||
storePersistentNetSortConfigurations();
|
||||
cfg->m_Zones.clearance = Iu2Mils( m_settings.m_ZoneClearance );
|
||||
cfg->m_Zones.min_thickness = Iu2Mils( m_settings.m_ZoneMinThickness );
|
||||
cfg->m_Zones.thermal_relief_gap = Iu2Mils( m_settings.m_ThermalReliefGap );
|
||||
|
@ -423,12 +531,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
|||
return false;
|
||||
}
|
||||
|
||||
int netcode = 0;
|
||||
|
||||
if( m_ListNetNameSelection->GetSelection() > 0 )
|
||||
netcode = m_displayNameToNetCodeMap[ m_ListNetNameSelection->GetStringSelection() ];
|
||||
|
||||
m_settings.m_NetcodeSelection = netcode;
|
||||
m_settings.m_NetcodeSelection = m_currentlySelectedNetcode;
|
||||
|
||||
m_settings.m_Name = m_tcZoneName->GetValue();
|
||||
|
||||
|
@ -436,6 +539,22 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::updateCurrentNetSelection()
|
||||
{
|
||||
const int netSelection{ m_ListNetNameSelection->GetSelection() };
|
||||
|
||||
if( netSelection )
|
||||
{
|
||||
const wxString& selectedNetName = m_ListNetNameSelection->GetString( netSelection );
|
||||
m_currentlySelectedNetcode = m_netNameToNetCode[selectedNetName];
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentlySelectedNetcode = INVALID_NET_CODE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::OnStyleSelection( wxCommandEvent& event )
|
||||
{
|
||||
bool enable = m_GridStyleCtrl->GetSelection() >= 1;
|
||||
|
@ -465,21 +584,43 @@ void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event )
|
|||
|
||||
void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )
|
||||
{
|
||||
m_netFiltering = !m_showAllNetsOpt->GetValue();
|
||||
m_netSortingByPadCount = m_sortByPadsOpt->GetValue();
|
||||
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
||||
updateDisplayedListOfNets();
|
||||
}
|
||||
|
||||
buildAvailableListOfNets();
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
|
||||
void DIALOG_COPPER_ZONE::storePersistentNetSortConfigurations()
|
||||
{
|
||||
// These configurations are persistent across multiple invokations of
|
||||
// this dialog
|
||||
int newConfig{ NO_PERSISTENT_SORT_MODE };
|
||||
|
||||
int configValue = m_netFiltering ? 2 : 0;
|
||||
if( m_hideAutoGeneratedNets )
|
||||
{
|
||||
newConfig |= HIDE_ANONYMOUS_NETS;
|
||||
}
|
||||
|
||||
if( m_netSortingByPadCount )
|
||||
configValue += 1;
|
||||
{
|
||||
newConfig |= SORT_BY_PAD_COUNT;
|
||||
}
|
||||
|
||||
cfg->m_Zones.net_sort_mode = configValue;
|
||||
cfg->m_Zones.net_filter = m_DoNotShowNetNameFilter->GetValue().ToStdString();
|
||||
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
|
||||
cfg->m_Zones.net_sort_mode = newConfig;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::loadPersistentNetSortConfigurations()
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg{ m_Parent->GetPcbNewSettings() };
|
||||
int savedConfig{ cfg->m_Zones.net_sort_mode };
|
||||
|
||||
if( savedConfig == DEFAULT_SORT_CONFIG )
|
||||
{
|
||||
savedConfig = HIDE_ANONYMOUS_NETS;
|
||||
}
|
||||
|
||||
m_hideAutoGeneratedNets = ( savedConfig & HIDE_ANONYMOUS_NETS );
|
||||
m_netSortingByPadCount = ( savedConfig & SORT_BY_PAD_COUNT );
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,159 +646,227 @@ void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::OnRunFiltersButtonClick( wxCommandEvent& event )
|
||||
void DIALOG_COPPER_ZONE::OnShowNetNameFilterChange( wxCommandEvent& event )
|
||||
{
|
||||
m_netFiltering = true;
|
||||
m_showAllNetsOpt->SetValue( false );
|
||||
updateDisplayedListOfNets();
|
||||
}
|
||||
|
||||
buildAvailableListOfNets();
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_Parent->GetPcbNewSettings();
|
||||
void DIALOG_COPPER_ZONE::updateDisplayedListOfNets()
|
||||
{
|
||||
readFilteringAndSortingCriteria();
|
||||
|
||||
int configValue = m_netFiltering ? 2 : 0;
|
||||
wxArrayString listOfNets = buildListOfNetsToDisplay();
|
||||
|
||||
const int selectedNet = ensureSelectedNetIsVisible( m_currentlySelectedNetcode, listOfNets );
|
||||
|
||||
displayNetsList( listOfNets, selectedNet );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::readFilteringAndSortingCriteria()
|
||||
{
|
||||
updateShowNetsFilter();
|
||||
|
||||
// Hide nets filter criteria
|
||||
m_hideAutoGeneratedNets = m_hideAutoGenNetNamesOpt->GetValue();
|
||||
|
||||
// Nets sort criteria
|
||||
m_netSortingByPadCount = m_sortByPadsOpt->GetValue();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::updateShowNetsFilter()
|
||||
{
|
||||
wxString netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
||||
|
||||
if( netNameShowFilter.Len() == 0 )
|
||||
{
|
||||
netNameShowFilter = wxT( "*" );
|
||||
}
|
||||
|
||||
wxStringTokenizer showFilters( netNameShowFilter.Lower(), "," );
|
||||
|
||||
m_showNetsFilter.clear();
|
||||
|
||||
while( showFilters.HasMoreTokens() )
|
||||
{
|
||||
wxString filter = showFilters.GetNextToken();
|
||||
filter.Trim( false );
|
||||
filter.Trim( true );
|
||||
|
||||
if( !filter.IsEmpty() )
|
||||
{
|
||||
m_showNetsFilter.emplace_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
|
||||
m_showNetsFilter.back()->SetPattern( filter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxArrayString DIALOG_COPPER_ZONE::buildListOfNetsToDisplay()
|
||||
{
|
||||
sortNetsIfRequired();
|
||||
|
||||
const wxArrayString sortedNetNames = getSortedNetNamesList();
|
||||
|
||||
const wxArrayString netsAfterShowFilter = applyShowFilter( sortedNetNames );
|
||||
|
||||
wxArrayString filteredNetNames = applyHideFilterIfRequired( netsAfterShowFilter );
|
||||
|
||||
return filteredNetNames;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::sortNetsIfRequired()
|
||||
{
|
||||
if( m_netSortingByPadCount )
|
||||
configValue += 1;
|
||||
|
||||
cfg->m_Zones.net_sort_mode = configValue;
|
||||
cfg->m_Zones.net_filter = m_DoNotShowNetNameFilter->GetValue().ToStdString();
|
||||
}
|
||||
|
||||
|
||||
// The pad count for each netcode, stored in a buffer for a fast access.
|
||||
// This is needed by the sort function sortNetsByNodes()
|
||||
static std::vector<int> padCountListByNet;
|
||||
|
||||
|
||||
// Sort nets by decreasing pad count.
|
||||
// For same pad count, sort by alphabetic names
|
||||
static bool sortNetsByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
|
||||
{
|
||||
int countA = padCountListByNet[ a->GetNetCode() ];
|
||||
int countB = padCountListByNet[ b->GetNetCode() ];
|
||||
|
||||
if( countA == countB )
|
||||
return a->GetNetname() < b->GetNetname();
|
||||
{
|
||||
sortNetsByPadCount( m_netInfoItemList, m_maxNetCode );
|
||||
}
|
||||
else
|
||||
return countB < countA;
|
||||
}
|
||||
|
||||
|
||||
// Sort nets by alphabetic names
|
||||
static bool sortNetsByNames( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
|
||||
{
|
||||
return a->GetNetname() < b->GetNetname();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::buildAvailableListOfNets()
|
||||
{
|
||||
NETINFO_LIST& netInfo = m_Parent->GetBoard()->GetNetInfo();
|
||||
wxString displayNetName;
|
||||
wxArrayString displayNetNameList;
|
||||
|
||||
m_displayNameToNetCodeMap.clear();
|
||||
|
||||
if( netInfo.GetNetCount() > 0 )
|
||||
{
|
||||
// Build the list
|
||||
std::vector<NETINFO_ITEM*> netBuffer;
|
||||
sort( m_netInfoItemList.begin(), m_netInfoItemList.end(), sortNetsByNames );
|
||||
}
|
||||
}
|
||||
|
||||
netBuffer.reserve( netInfo.GetNetCount() );
|
||||
int max_netcode = 0;
|
||||
|
||||
for( NETINFO_ITEM* net : netInfo )
|
||||
{
|
||||
int netcode = net->GetNetCode();
|
||||
void DIALOG_COPPER_ZONE::sortNetsByPadCount( std::vector<NETINFO_ITEM*>& nets,
|
||||
const int maxNetCode )
|
||||
{
|
||||
const std::vector<PAD*> pads = m_Parent->GetBoard()->GetPads();
|
||||
|
||||
if( netcode > 0 && net->IsCurrent() )
|
||||
{
|
||||
netBuffer.push_back( net );
|
||||
max_netcode = std::max( netcode, max_netcode);
|
||||
}
|
||||
}
|
||||
padCountListByNet.clear();
|
||||
|
||||
// sort the list
|
||||
if( m_netSortingByPadCount )
|
||||
{
|
||||
// Build the pad count by net:
|
||||
padCountListByNet.clear();
|
||||
std::vector<PAD*> pads = m_Parent->GetBoard()->GetPads();
|
||||
// +1 is required for <no-net> item
|
||||
padCountListByNet.assign( maxNetCode + 1, 0 );
|
||||
|
||||
padCountListByNet.assign( max_netcode + 1, 0 );
|
||||
for( PAD* pad : pads )
|
||||
{
|
||||
const int netCode = pad->GetNetCode();
|
||||
|
||||
for( PAD* pad : pads )
|
||||
{
|
||||
int netCode = pad->GetNetCode();
|
||||
|
||||
if( netCode >= 0 )
|
||||
padCountListByNet[ netCode ]++;
|
||||
}
|
||||
|
||||
sort( netBuffer.begin(), netBuffer.end(), sortNetsByNodes );
|
||||
}
|
||||
else
|
||||
{
|
||||
sort( netBuffer.begin(), netBuffer.end(), sortNetsByNames );
|
||||
}
|
||||
|
||||
for( NETINFO_ITEM* net : netBuffer )
|
||||
{
|
||||
displayNetName = UnescapeString( net->GetNetname() );
|
||||
displayNetNameList.Add( displayNetName );
|
||||
m_displayNameToNetCodeMap[ displayNetName ] = net->GetNetCode();
|
||||
}
|
||||
if( netCode > INVALID_NET_CODE )
|
||||
padCountListByNet[netCode]++;
|
||||
}
|
||||
|
||||
if( m_netFiltering )
|
||||
{
|
||||
wxString doNotShowFilter = m_DoNotShowNetNameFilter->GetValue().Lower();
|
||||
wxString ShowFilter = m_ShowNetNameFilter->GetValue().Lower();
|
||||
sort( nets.begin(), nets.end(), sortNetsByNodes );
|
||||
}
|
||||
|
||||
for( unsigned ii = 0; ii < displayNetNameList.GetCount(); ii++ )
|
||||
|
||||
wxArrayString DIALOG_COPPER_ZONE::getSortedNetNamesList()
|
||||
{
|
||||
wxArrayString sortedNetNames;
|
||||
|
||||
for( NETINFO_ITEM* net : m_netInfoItemList )
|
||||
{
|
||||
const wxString& netName = getUnescapedNetName( net );
|
||||
sortedNetNames.Add( netName );
|
||||
}
|
||||
|
||||
return sortedNetNames;
|
||||
}
|
||||
|
||||
|
||||
wxArrayString DIALOG_COPPER_ZONE::applyShowFilter( const wxArrayString& netNames )
|
||||
{
|
||||
wxArrayString netsAfterShowFilter;
|
||||
|
||||
for( const wxString& netName : netNames )
|
||||
{
|
||||
for( const NET_FILTER& filter : m_showNetsFilter )
|
||||
{
|
||||
if( displayNetNameList[ii].Lower().Matches( doNotShowFilter ) )
|
||||
if( filter->Find( netName.Lower() ) )
|
||||
{
|
||||
displayNetNameList.RemoveAt( ii );
|
||||
ii--;
|
||||
}
|
||||
else if( !displayNetNameList[ii].Lower().Matches( ShowFilter ) )
|
||||
{
|
||||
displayNetNameList.RemoveAt( ii );
|
||||
ii--;
|
||||
netsAfterShowFilter.Add( netName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
displayNetName = _( "<no net>" );
|
||||
displayNetNameList.Insert( displayNetName, 0 );
|
||||
m_displayNameToNetCodeMap[ displayNetName ] = 0;
|
||||
return netsAfterShowFilter;
|
||||
}
|
||||
|
||||
// Ensure currently selected net for the zone is visible, regardless of filters
|
||||
int selectedNetListNdx = 0;
|
||||
int net_select = m_settings.m_NetcodeSelection;
|
||||
|
||||
if( net_select > 0 )
|
||||
wxArrayString DIALOG_COPPER_ZONE::applyHideFilterIfRequired( const wxArrayString& netNames )
|
||||
{
|
||||
wxArrayString filteredNetNames;
|
||||
|
||||
if( m_hideAutoGeneratedNets )
|
||||
{
|
||||
NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( net_select );
|
||||
for( const wxString& netName : netNames )
|
||||
{
|
||||
if( !isAutoGenerated( netName ) )
|
||||
{
|
||||
filteredNetNames.Add( netName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filteredNetNames = netNames;
|
||||
}
|
||||
|
||||
filteredNetNames.Insert( wxT( "<no net>" ), INVALID_NET_CODE );
|
||||
|
||||
return filteredNetNames;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_COPPER_ZONE::isAutoGenerated( const wxString& netName )
|
||||
{
|
||||
return netName.StartsWith( "Net-(" ) || netName.StartsWith( "unconnected-(" );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::displayNetsList( const wxArrayString& netNamesList, int selectIndex )
|
||||
{
|
||||
m_ListNetNameSelection->Clear();
|
||||
m_ListNetNameSelection->InsertItems( netNamesList, 0 );
|
||||
m_ListNetNameSelection->SetSelection( selectIndex );
|
||||
m_ListNetNameSelection->EnsureVisible( selectIndex );
|
||||
}
|
||||
|
||||
|
||||
int DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible( int selectedNetCode, wxArrayString& netsList )
|
||||
{
|
||||
int selectedIndex = 0;
|
||||
if( selectedNetCode > INVALID_NET_CODE )
|
||||
{
|
||||
NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( selectedNetCode );
|
||||
|
||||
if( selectedNet )
|
||||
{
|
||||
selectedNetListNdx = displayNetNameList.Index( selectedNet->GetNetname() );
|
||||
const wxString& netName = getUnescapedNetName( selectedNet );
|
||||
selectedIndex = netsList.Index( netName );
|
||||
|
||||
if( wxNOT_FOUND == selectedNetListNdx )
|
||||
if( wxNOT_FOUND == selectedIndex )
|
||||
{
|
||||
// the currently selected net must *always* be visible.
|
||||
// <no net> is the zero'th index, so pick next lowest
|
||||
displayNetNameList.Insert( selectedNet->GetNetname(), 1 );
|
||||
selectedNetListNdx = 1;
|
||||
netsList.Insert( netName, 1 );
|
||||
selectedIndex = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_ListNetNameSelection->Clear();
|
||||
m_ListNetNameSelection->InsertItems( displayNetNameList, 0 );
|
||||
m_ListNetNameSelection->SetSelection( selectedNetListNdx );
|
||||
m_ListNetNameSelection->EnsureVisible( selectedNetListNdx );
|
||||
return selectedIndex;
|
||||
}
|
||||
|
||||
|
||||
wxString DIALOG_COPPER_ZONE::getUnescapedNetName( const NETINFO_ITEM* net )
|
||||
{
|
||||
return UnescapeString( net->GetNetname() );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_COPPER_ZONE::updateInfoBar()
|
||||
{
|
||||
if( m_currentlySelectedNetcode <= INVALID_NET_CODE && !m_copperZoneInfo->IsShown() )
|
||||
{
|
||||
m_copperZoneInfo->ShowMessage(
|
||||
_( "Selecting <no net> will create an isolated copper island." ), wxICON_WARNING );
|
||||
}
|
||||
else if( m_currentlySelectedNetcode > INVALID_NET_CODE && m_copperZoneInfo->IsShown() )
|
||||
{
|
||||
m_copperZoneInfo->Dismiss();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,11 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
|
|||
|
||||
m_MainBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_copperZoneInfo = new wxInfoBar( this );
|
||||
m_copperZoneInfo->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE );
|
||||
m_copperZoneInfo->SetEffectDuration( 500 );
|
||||
m_MainBoxSizer->Add( m_copperZoneInfo, 0, wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* m_OptionsBoxSizer;
|
||||
m_OptionsBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
@ -30,62 +35,34 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
|
|||
m_OptionsBoxSizer->Add( sbSizer2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizer3;
|
||||
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net") ), wxHORIZONTAL );
|
||||
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net") ), wxVERTICAL );
|
||||
|
||||
m_ListNetNameSelection = new wxListBox( sbSizer3->GetStaticBox(), ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
sbSizer3->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
wxBoxSizer* bSizer8;
|
||||
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bFilteringSizer;
|
||||
bFilteringSizer = new wxBoxSizer( wxVERTICAL );
|
||||
bFilteringSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextDisplay = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Hide nets matching:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDisplay->Wrap( -1 );
|
||||
bFilteringSizer->Add( m_staticTextDisplay, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_DoNotShowNetNameFilter = new wxTextCtrl( sbSizer3->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
|
||||
m_DoNotShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nNet names matching this pattern are not displayed.") );
|
||||
m_DoNotShowNetNameFilter->SetMinSize( wxSize( 180,-1 ) );
|
||||
|
||||
bFilteringSizer->Add( m_DoNotShowNetNameFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextVFilter = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Show nets matching:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextVFilter->Wrap( -1 );
|
||||
bFilteringSizer->Add( m_staticTextVFilter, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_ShowNetNameFilter = new wxTextCtrl( sbSizer3->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, _("*"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
|
||||
m_ShowNetNameFilter = new wxTextCtrl( sbSizer3->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
|
||||
m_ShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nOnly net names matching this pattern are displayed.") );
|
||||
|
||||
bFilteringSizer->Add( m_ShowNetNameFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
bFilteringSizer->Add( m_ShowNetNameFilter, 2, wxALIGN_CENTER|wxBOTTOM, 5 );
|
||||
|
||||
m_buttonRunFilter = new wxButton( sbSizer3->GetStaticBox(), wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bFilteringSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_showAllNetsOpt = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Show all nets"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bFilteringSizer->Add( m_showAllNetsOpt, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 );
|
||||
m_hideAutoGenNetNamesOpt = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Hide auto-generated net names"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_hideAutoGenNetNamesOpt->SetValue(true);
|
||||
bFilteringSizer->Add( m_hideAutoGenNetNamesOpt, 0, wxALIGN_CENTER|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_sortByPadsOpt = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Sort nets by pad count"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bFilteringSizer->Add( m_sortByPadsOpt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_bNoNetWarning = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_bitmapNoNetWarning = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_bNoNetWarning->Add( m_bitmapNoNetWarning, 0, wxTOP|wxBOTTOM|wxLEFT, 8 );
|
||||
|
||||
m_staticText18 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("No net will result\nin an unconnected \ncopper island."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText18->Wrap( -1 );
|
||||
m_bNoNetWarning->Add( m_staticText18, 0, wxALL, 5 );
|
||||
bFilteringSizer->Add( m_sortByPadsOpt, 1, wxALIGN_CENTER|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bFilteringSizer->Add( m_bNoNetWarning, 1, wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN|wxTOP, 20 );
|
||||
bSizer8->Add( bFilteringSizer, 0, wxEXPAND, 20 );
|
||||
|
||||
|
||||
sbSizer3->Add( bFilteringSizer, 0, wxEXPAND, 20 );
|
||||
sbSizer3->Add( bSizer8, 1, wxEXPAND, 5 );
|
||||
|
||||
m_ListNetNameSelection = new wxListBox( sbSizer3->GetStaticBox(), ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
sbSizer3->Add( m_ListNetNameSelection, 8, wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_OptionsBoxSizer->Add( sbSizer3, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
@ -400,7 +377,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
|
|||
m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export Settings to Other Zones"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ExportSetupButton->SetToolTip( _("Export this zone setup (excluding layer and net selection) to all other copper zones.") );
|
||||
|
||||
bSizerbottom->Add( m_ExportSetupButton, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
|
||||
bSizerbottom->Add( m_ExportSetupButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
|
@ -423,14 +400,13 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
|
|||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_COPPER_ZONE_BASE::OnClose ) );
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_COPPER_ZONE_BASE::OnUpdateUI ) );
|
||||
m_layers->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_COPPER_ZONE_BASE::OnLayerSelection ), NULL, this );
|
||||
m_DoNotShowNetNameFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_DoNotShowNetNameFilter->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_ShowNetNameFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_ShowNetNameFilter->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_buttonRunFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_showAllNetsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
|
||||
m_ShowNetNameFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnShowNetNameFilterChange ), NULL, this );
|
||||
m_ShowNetNameFilter->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnShowNetNameFilterChange ), NULL, this );
|
||||
m_hideAutoGenNetNamesOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
|
||||
m_sortByPadsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
|
||||
m_ListNetNameSelection->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSelectionUpdated ), NULL, this );
|
||||
m_GridStyleCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnStyleSelection ), NULL, this );
|
||||
m_cbRemoveIslands->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRemoveIslandsSelection ), NULL, this );
|
||||
m_ExportSetupButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::ExportSetupToOtherCopperZones ), NULL, this );
|
||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnButtonCancelClick ), NULL, this );
|
||||
}
|
||||
|
@ -441,14 +417,13 @@ DIALOG_COPPER_ZONE_BASE::~DIALOG_COPPER_ZONE_BASE()
|
|||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_COPPER_ZONE_BASE::OnClose ) );
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_COPPER_ZONE_BASE::OnUpdateUI ) );
|
||||
m_layers->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_COPPER_ZONE_BASE::OnLayerSelection ), NULL, this );
|
||||
m_DoNotShowNetNameFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_DoNotShowNetNameFilter->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_ShowNetNameFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_ShowNetNameFilter->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_buttonRunFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
|
||||
m_showAllNetsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
|
||||
m_ShowNetNameFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnShowNetNameFilterChange ), NULL, this );
|
||||
m_ShowNetNameFilter->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnShowNetNameFilterChange ), NULL, this );
|
||||
m_hideAutoGenNetNamesOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
|
||||
m_sortByPadsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
|
||||
m_ListNetNameSelection->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSelectionUpdated ), NULL, this );
|
||||
m_GridStyleCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnStyleSelection ), NULL, this );
|
||||
m_cbRemoveIslands->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRemoveIslandsSelection ), NULL, this );
|
||||
m_ExportSetupButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::ExportSetupToOtherCopperZones ), NULL, this );
|
||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnButtonCancelClick ), NULL, this );
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,27 +11,27 @@
|
|||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/infobar.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -47,9 +47,8 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
|
|||
enum
|
||||
{
|
||||
ID_DIALOG_COPPER_ZONE_BASE = 1000,
|
||||
ID_NETNAME_SELECTION,
|
||||
ID_TEXTCTRL_NETNAMES_FILTER,
|
||||
wxID_APPLY_FILTERS,
|
||||
ID_NETNAME_SELECTION,
|
||||
ID_M_PRIORITYLEVELCTRL,
|
||||
ID_M_OUTLINEAPPEARANCECTRL,
|
||||
ID_CORNER_SMOOTHING,
|
||||
|
@ -61,18 +60,12 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
|
|||
};
|
||||
|
||||
wxBoxSizer* m_MainBoxSizer;
|
||||
wxInfoBar* m_copperZoneInfo;
|
||||
wxDataViewListCtrl* m_layers;
|
||||
wxListBox* m_ListNetNameSelection;
|
||||
wxStaticText* m_staticTextDisplay;
|
||||
wxTextCtrl* m_DoNotShowNetNameFilter;
|
||||
wxStaticText* m_staticTextVFilter;
|
||||
wxTextCtrl* m_ShowNetNameFilter;
|
||||
wxButton* m_buttonRunFilter;
|
||||
wxCheckBox* m_showAllNetsOpt;
|
||||
wxCheckBox* m_hideAutoGenNetNamesOpt;
|
||||
wxCheckBox* m_sortByPadsOpt;
|
||||
wxBoxSizer* m_bNoNetWarning;
|
||||
wxStaticBitmap* m_bitmapNoNetWarning;
|
||||
wxStaticText* m_staticText18;
|
||||
wxListBox* m_ListNetNameSelection;
|
||||
wxStaticText* m_zoneNameLabel;
|
||||
wxTextCtrl* m_tcZoneName;
|
||||
wxStaticText* m_staticTextPriorityLevel;
|
||||
|
@ -133,9 +126,11 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
|
|||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); }
|
||||
virtual void OnRunFiltersButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnShowNetNameFilterChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnNetSelectionUpdated( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnStyleSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRemoveIslandsSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
|
|
@ -330,11 +330,8 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
|||
m_params.emplace_back( new PARAM<int>( "zones.hatching_style",
|
||||
&m_Zones.hatching_style, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( "zones.net_filter",
|
||||
&m_Zones.net_filter, "" ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "zones.net_sort_mode",
|
||||
&m_Zones.net_sort_mode, 1 ) );
|
||||
&m_Zones.net_sort_mode, -1 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<double>( "zones.clearance",
|
||||
&m_Zones.clearance, ZONE_CLEARANCE_MIL ) );
|
||||
|
@ -663,7 +660,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
ret &= fromLegacy<int> ( aCfg, "VrmlOriginMode", "export_vrml.origin_mode" );
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "Zone_Ouline_Hatch_Opt", "zones.hatching_style" );
|
||||
ret &= fromLegacyString( aCfg, "Zone_Filter_Opt", "zones.net_filter" );
|
||||
ret &= fromLegacy<int>( aCfg, "Zone_NetSort_Opt", "zones.net_sort_mode" );
|
||||
ret &= fromLegacy<double>( aCfg, "Zone_Clearance", "zones.clearance" );
|
||||
ret &= fromLegacy<double>( aCfg, "Zone_Thickness", "zones.min_thickness" );
|
||||
|
|
|
@ -220,7 +220,6 @@ public:
|
|||
struct ZONES
|
||||
{
|
||||
int hatching_style;
|
||||
wxString net_filter;
|
||||
int net_sort_mode;
|
||||
double clearance;
|
||||
double min_thickness;
|
||||
|
|
Loading…
Reference in New Issue