2012-06-25 20:59:19 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-02-18 09:09:13 +00:00
|
|
|
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-25 20:59:19 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2019-03-04 16:34:04 +00:00
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-06-25 20:59:19 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <zones.h>
|
2018-02-20 14:58:01 +00:00
|
|
|
#include <bitmaps.h>
|
2018-05-25 14:56:04 +00:00
|
|
|
#include <widgets/unit_binder.h>
|
2012-11-23 09:10:37 +00:00
|
|
|
#include <class_zone.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
2018-05-25 14:56:04 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
#include <dialog_copper_zones_base.h>
|
2012-06-26 20:18:01 +00:00
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
class DIALOG_COPPER_ZONE : public DIALOG_COPPER_ZONE_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings );
|
|
|
|
|
|
|
|
private:
|
|
|
|
PCB_BASE_FRAME* m_Parent;
|
2018-05-25 14:56:04 +00:00
|
|
|
wxConfigBase* m_Config; // Current config
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2019-06-02 09:50:46 +00:00
|
|
|
bool m_settingsExported; // settings will be written to all other zones
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
ZONE_SETTINGS m_settings;
|
|
|
|
ZONE_SETTINGS* m_ptr;
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
bool m_NetSortingByPadCount;
|
2012-02-06 05:44:19 +00:00
|
|
|
long m_NetFiltering;
|
2019-03-04 16:34:04 +00:00
|
|
|
static wxString m_netNameShowFilter; // the filter to show nets (default * "*"). Static
|
|
|
|
// to keep this pattern for an entire Pcbnew session
|
2018-07-19 20:08:31 +00:00
|
|
|
int m_cornerSmoothingType;
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
UNIT_BINDER m_cornerRadius;
|
|
|
|
UNIT_BINDER m_clearance;
|
|
|
|
UNIT_BINDER m_minWidth;
|
|
|
|
UNIT_BINDER m_antipadClearance ;
|
|
|
|
UNIT_BINDER m_spokeWidth;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
UNIT_BINDER m_gridStyleRotation;
|
|
|
|
UNIT_BINDER m_gridStyleThickness;
|
|
|
|
UNIT_BINDER m_gridStyleGap;
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
/**
|
2019-03-04 16:34:04 +00:00
|
|
|
* @param aUseExportableSetupOnly is true to use exportable parameters only (used to
|
|
|
|
* export this setup to other zones).
|
2012-02-06 05:44:19 +00:00
|
|
|
* @return bool - false if incorrect options, true if ok.
|
|
|
|
*/
|
2018-05-25 14:56:04 +00:00
|
|
|
bool AcceptOptions( bool aUseExportableSetupOnly = false );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
void OnStyleSelection( wxCommandEvent& event ) override;
|
2018-05-25 14:56:04 +00:00
|
|
|
void OnLayerSelection( wxDataViewEvent& event ) override;
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
|
|
|
|
void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override;
|
|
|
|
void OnRunFiltersButtonClick( wxCommandEvent& event ) override;
|
2018-05-25 14:56:04 +00:00
|
|
|
void OnUpdateUI( wxUpdateUIEvent& ) override;
|
|
|
|
void OnButtonCancelClick( wxCommandEvent& event ) override;
|
|
|
|
void OnClose( wxCloseEvent& event ) override;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
void buildAvailableListOfNets();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
// Initialize static member variables
|
|
|
|
wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2011-02-23 22:38:01 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
|
2012-02-06 05:44:19 +00:00
|
|
|
{
|
|
|
|
DIALOG_COPPER_ZONE dlg( aCaller, aSettings );
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
return dlg.ShowModal();
|
2012-02-06 05:44:19 +00:00
|
|
|
}
|
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
#define MIN_THICKNESS ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
|
2018-05-25 14:56:04 +00:00
|
|
|
DIALOG_COPPER_ZONE_BASE( aParent ),
|
2018-07-19 20:08:31 +00:00
|
|
|
m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
|
2018-11-29 18:59:38 +00:00
|
|
|
m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits, true ),
|
|
|
|
m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits, true ),
|
|
|
|
m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits, true ),
|
|
|
|
m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits, true ),
|
2018-02-18 09:09:13 +00:00
|
|
|
m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits, true ),
|
|
|
|
m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation, m_staticTextRotUnits,
|
|
|
|
false ),
|
|
|
|
m_gridStyleThickness( aParent, m_staticTextStyleThickness,
|
|
|
|
m_tcGridStyleThickness, m_GridStyleThicknessUnits, false ),
|
|
|
|
m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits, false )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2012-02-06 05:44:19 +00:00
|
|
|
m_Parent = aParent;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
m_Config = Kiface().KifaceSettings();
|
2018-05-25 14:56:04 +00:00
|
|
|
m_bitmapNoNetWarning->SetBitmap( KiBitmap( dialog_warning_xpm ) );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
m_ptr = aSettings;
|
|
|
|
m_settings = *aSettings;
|
2018-05-25 14:56:04 +00:00
|
|
|
m_settings.SetupLayersList( m_layers, m_Parent, true );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_settingsExported = false;
|
2009-08-23 15:22:44 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_NetFiltering = false;
|
|
|
|
m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
|
2010-01-20 12:43:05 +00:00
|
|
|
|
2015-09-17 20:43:14 +00:00
|
|
|
m_sdbSizerOK->SetDefault();
|
2016-07-02 09:35:52 +00:00
|
|
|
|
2018-07-21 22:17:46 +00:00
|
|
|
FinishDialogSettings();
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
m_constrainOutline->SetValue( m_settings.m_Zone_45_Only );
|
2012-02-06 05:44:19 +00:00
|
|
|
m_cornerSmoothingChoice->SetSelection( m_settings.GetCornerSmoothingType() );
|
2018-05-25 14:56:04 +00:00
|
|
|
m_cornerRadius.SetValue( m_settings.GetCornerRadius() );
|
|
|
|
m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority );
|
2011-02-21 19:43:59 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
switch( m_settings.m_Zone_HatchingStyle )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
case ZONE_HATCH_STYLE::NO_HATCH:
|
|
|
|
m_OutlineAppearanceCtrl->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
case ZONE_HATCH_STYLE::DIAGONAL_EDGE:
|
|
|
|
m_OutlineAppearanceCtrl->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
case ZONE_HATCH_STYLE::DIAGONAL_FULL:
|
|
|
|
m_OutlineAppearanceCtrl->SetSelection( 2 );
|
|
|
|
break;
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_clearance.SetValue( m_settings.m_ZoneClearance );
|
|
|
|
m_minWidth.SetValue( m_settings.m_ZoneMinThickness );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
switch( m_settings.GetPadConnection() )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
default:
|
2019-12-28 00:55:11 +00:00
|
|
|
case ZONE_CONNECTION::THERMAL:
|
|
|
|
m_PadInZoneOpt->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
case ZONE_CONNECTION::THT_THERMAL:
|
|
|
|
m_PadInZoneOpt->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
case ZONE_CONNECTION::NONE:
|
|
|
|
m_PadInZoneOpt->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
case ZONE_CONNECTION::FULL:
|
|
|
|
m_PadInZoneOpt->SetSelection( 0 );
|
|
|
|
break;
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
// Do not enable/disable antipad clearance and spoke width. They might be needed if
|
|
|
|
// a module or pad overrides the zone to specify a thermal connection.
|
|
|
|
m_antipadClearance.SetValue( m_settings.m_ThermalReliefGap );
|
|
|
|
m_spokeWidth.SetValue( m_settings.m_ThermalReliefCopperBridge );
|
2013-03-25 17:02:29 +00:00
|
|
|
|
2013-09-25 19:09:57 +00:00
|
|
|
wxString netNameDoNotShowFilter = wxT( "Net-*" );
|
2018-05-25 14:56:04 +00:00
|
|
|
m_NetFiltering = false;
|
|
|
|
m_NetSortingByPadCount = true;
|
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_Config )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2010-08-23 12:13:48 +00:00
|
|
|
int opt = m_Config->Read( ZONE_NET_SORT_OPTION_KEY, 1l );
|
2018-05-25 14:56:04 +00:00
|
|
|
m_NetFiltering = opt >= 2;
|
|
|
|
m_NetSortingByPadCount = opt % 2;
|
2010-08-23 12:13:48 +00:00
|
|
|
m_Config->Read( ZONE_NET_FILTER_STRING_KEY, netNameDoNotShowFilter );
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
2010-11-13 19:21:16 +00:00
|
|
|
m_ShowNetNameFilter->SetValue( m_netNameShowFilter );
|
2018-05-25 14:56:04 +00:00
|
|
|
m_DoNotShowNetNameFilter->SetValue( netNameDoNotShowFilter );
|
|
|
|
m_showAllNetsOpt->SetValue( !m_NetFiltering );
|
|
|
|
m_sortByPadsOpt->SetValue( m_NetSortingByPadCount );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
// Build list of nets:
|
|
|
|
buildAvailableListOfNets();
|
2011-02-21 19:43:59 +00:00
|
|
|
|
2019-03-04 20:30:32 +00:00
|
|
|
SetInitialFocus( m_ListNetNameSelection );
|
2019-03-04 16:34:04 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
switch( m_settings.m_FillMode )
|
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
case ZONE_FILL_MODE::HATCH_PATTERN:
|
2018-02-18 09:09:13 +00:00
|
|
|
m_GridStyleCtrl->SetSelection( 1 ); break;
|
|
|
|
default:
|
|
|
|
m_GridStyleCtrl->SetSelection( 0 ); break;
|
|
|
|
}
|
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES );
|
2018-02-18 09:09:13 +00:00
|
|
|
m_gridStyleRotation.SetValue( m_settings.m_HatchFillTypeOrientation*10 ); // IU is decidegree
|
|
|
|
|
|
|
|
// Gives a reasonable value to grid style parameters, if currently there are no defined
|
|
|
|
// parameters for grid pattern thickness and gap (if the value is 0)
|
|
|
|
// the grid pattern thickness default value is (arbitrary) m_ZoneMinThickness * 4
|
|
|
|
// or 1mm
|
|
|
|
// the grid pattern gap default value is (arbitrary) m_ZoneMinThickness * 6
|
|
|
|
// or 1.5 mm
|
|
|
|
int bestvalue = m_settings.m_HatchFillTypeThickness;
|
|
|
|
|
|
|
|
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeThickness
|
|
|
|
bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, Millimeter2iu( 1.0 ) );
|
|
|
|
|
|
|
|
m_gridStyleThickness.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
|
|
|
|
|
|
|
|
bestvalue = m_settings.m_HatchFillTypeGap;
|
|
|
|
|
|
|
|
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeGap
|
|
|
|
bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, Millimeter2iu( 1.5 ) );
|
|
|
|
|
|
|
|
m_gridStyleGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
|
|
|
|
|
|
|
|
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchFillTypeSmoothingLevel );
|
|
|
|
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchFillTypeSmoothingValue );
|
|
|
|
|
|
|
|
// Enable/Disable some widgets
|
|
|
|
wxCommandEvent event;
|
|
|
|
OnStyleSelection( event );
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
return true;
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-20 14:58:01 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnUpdateUI( wxUpdateUIEvent& )
|
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
if( m_ListNetNameSelection->GetSelection() < 0 )
|
|
|
|
m_ListNetNameSelection->SetSelection( 0 );
|
|
|
|
|
2018-02-20 14:58:01 +00:00
|
|
|
m_bNoNetWarning->Show( m_ListNetNameSelection->GetSelection() == 0 );
|
2018-05-25 14:56:04 +00:00
|
|
|
|
2018-07-19 20:08:31 +00:00
|
|
|
if( m_cornerSmoothingType != m_cornerSmoothingChoice->GetSelection() )
|
|
|
|
{
|
|
|
|
m_cornerSmoothingType = m_cornerSmoothingChoice->GetSelection();
|
|
|
|
|
|
|
|
if( m_cornerSmoothingChoice->GetSelection() == ZONE_SETTINGS::SMOOTHING_CHAMFER )
|
|
|
|
m_cornerRadiusLabel->SetLabel( _( "Chamfer distance:" ) );
|
|
|
|
else
|
|
|
|
m_cornerRadiusLabel->SetLabel( _( "Fillet radius:" ) );
|
|
|
|
}
|
2019-04-30 11:16:29 +00:00
|
|
|
|
|
|
|
m_cornerRadiusCtrl->Enable(m_cornerSmoothingType > ZONE_SETTINGS::SMOOTHING_NONE );
|
2018-02-20 14:58:01 +00:00
|
|
|
}
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
|
2011-02-19 10:13:09 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
// After an "Export Settings to Other Zones" cancel and close must return
|
|
|
|
// ZONE_EXPORT_VALUES instead of wxID_CANCEL.
|
2011-02-19 10:13:09 +00:00
|
|
|
Close( true );
|
|
|
|
}
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
|
|
|
|
bool DIALOG_COPPER_ZONE::TransferDataFromWindow()
|
2012-02-06 05:44:19 +00:00
|
|
|
{
|
|
|
|
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
if( m_GridStyleCtrl->GetSelection() > 0 )
|
2019-12-20 14:11:39 +00:00
|
|
|
m_settings.m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN;
|
2018-02-18 09:09:13 +00:00
|
|
|
else
|
2019-12-20 14:11:39 +00:00
|
|
|
m_settings.m_FillMode = ZONE_FILL_MODE::POLYGONS;
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
if( !AcceptOptions() )
|
|
|
|
return false;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
m_settings.m_HatchFillTypeOrientation = m_gridStyleRotation.GetValue()/10.0; // value is returned in deci-degree
|
|
|
|
m_settings.m_HatchFillTypeThickness = m_gridStyleThickness.GetValue();
|
|
|
|
m_settings.m_HatchFillTypeGap = m_gridStyleGap.GetValue();
|
|
|
|
m_settings.m_HatchFillTypeSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
|
|
|
|
m_settings.m_HatchFillTypeSmoothingValue = m_spinCtrlSmoothValue->GetValue();
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
*m_ptr = m_settings;
|
|
|
|
return true;
|
|
|
|
}
|
2011-02-19 10:13:09 +00:00
|
|
|
|
2019-03-04 16:34:04 +00:00
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
EndModal( m_settingsExported ? ZONE_EXPORT_VALUES : wxID_CANCEL );
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-11-29 18:59:38 +00:00
|
|
|
if( !m_clearance.Validate( 0, Mils2iu( ZONE_CLEARANCE_MAX_VALUE_MIL ) ) )
|
|
|
|
return false;
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2018-11-29 18:59:38 +00:00
|
|
|
if( !m_minWidth.Validate( Mils2iu( ZONE_THICKNESS_MIN_VALUE_MIL ), INT_MAX ) )
|
|
|
|
return false;
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2018-11-29 18:59:38 +00:00
|
|
|
if( !m_cornerRadius.Validate( 0, INT_MAX ) )
|
|
|
|
return false;
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2018-11-29 18:59:38 +00:00
|
|
|
if( !m_spokeWidth.Validate( 0, INT_MAX ) )
|
|
|
|
return false;
|
|
|
|
|
2019-09-05 14:36:23 +00:00
|
|
|
m_gridStyleRotation.SetValue( NormalizeAngle180( m_gridStyleRotation.GetValue() ) );
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
if( m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN )
|
2018-05-25 14:56:04 +00:00
|
|
|
{
|
2018-02-18 09:09:13 +00:00
|
|
|
int minThickness = m_minWidth.GetValue();
|
2018-05-25 14:56:04 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if( !m_gridStyleGap.Validate( minThickness, INT_MAX ) )
|
|
|
|
return false;
|
2018-05-25 14:56:04 +00:00
|
|
|
}
|
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
switch( m_PadInZoneOpt->GetSelection() )
|
|
|
|
{
|
2019-12-28 00:55:11 +00:00
|
|
|
case 3:
|
|
|
|
m_settings.SetPadConnection( ZONE_CONNECTION::NONE );
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_settings.SetPadConnection( ZONE_CONNECTION::THT_THERMAL );
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_settings.SetPadConnection( ZONE_CONNECTION::THERMAL );
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
m_settings.SetPadConnection( ZONE_CONNECTION::FULL );
|
|
|
|
break;
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( m_OutlineAppearanceCtrl->GetSelection() )
|
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
case 0:
|
|
|
|
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::NO_HATCH;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL;
|
|
|
|
break;
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_Config )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
m_Config->Write( ZONE_NET_OUTLINES_STYLE_KEY, (long) m_settings.m_Zone_HatchingStyle );
|
2012-02-06 05:44:19 +00:00
|
|
|
wxString filter = m_DoNotShowNetNameFilter->GetValue();
|
|
|
|
m_Config->Write( ZONE_NET_FILTER_STRING_KEY, filter );
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_settings.m_ZoneClearance = m_clearance.GetValue();
|
|
|
|
m_settings.m_ZoneMinThickness = m_minWidth.GetValue();
|
2008-11-22 20:50:30 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
|
2019-04-30 11:16:29 +00:00
|
|
|
|
|
|
|
m_settings.SetCornerRadius( m_settings.GetCornerSmoothingType() == ZONE_SETTINGS::SMOOTHING_NONE
|
|
|
|
? 0 : m_cornerRadius.GetValue() );
|
2011-02-21 19:43:59 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_ZonePriority = m_PriorityLevelCtrl->GetValue();
|
2012-01-29 19:29:19 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_settings.m_Zone_45_Only = m_constrainOutline->GetValue();
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_settings.m_ThermalReliefGap = m_antipadClearance.GetValue();
|
|
|
|
m_settings.m_ThermalReliefCopperBridge = m_spokeWidth.GetValue();
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2019-07-12 12:56:02 +00:00
|
|
|
if( m_settings.m_ThermalReliefCopperBridge < m_settings.m_ZoneMinThickness )
|
2018-09-03 11:57:11 +00:00
|
|
|
{
|
2019-07-12 12:56:02 +00:00
|
|
|
DisplayError( this, _( "Thermal spoke width cannot be smaller than the minimum width." ) );
|
2018-09-03 11:57:11 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-06-25 20:59:19 +00:00
|
|
|
if( m_Config )
|
|
|
|
{
|
2013-03-29 10:14:32 +00:00
|
|
|
ConfigBaseWriteDouble( m_Config, ZONE_CLEARANCE_WIDTH_STRING_KEY,
|
|
|
|
(double) m_settings.m_ZoneClearance / IU_PER_MILS );
|
|
|
|
ConfigBaseWriteDouble( m_Config, ZONE_MIN_THICKNESS_WIDTH_STRING_KEY,
|
2018-05-25 14:56:04 +00:00
|
|
|
(double) m_settings.m_ZoneMinThickness / IU_PER_MILS );
|
2013-03-29 10:14:32 +00:00
|
|
|
ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
|
2018-05-25 14:56:04 +00:00
|
|
|
(double) m_settings.m_ThermalReliefGap / IU_PER_MILS );
|
2013-03-29 10:14:32 +00:00
|
|
|
ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
|
2018-05-25 14:56:04 +00:00
|
|
|
(double) m_settings.m_ThermalReliefCopperBridge / IU_PER_MILS );
|
2008-11-24 20:46:41 +00:00
|
|
|
}
|
2008-11-14 22:40:31 +00:00
|
|
|
|
|
|
|
// If we use only exportable to others zones parameters, exit here:
|
|
|
|
if( aUseExportableSetupOnly )
|
|
|
|
return true;
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
// Get the layer selection for this zone
|
2018-05-25 14:56:04 +00:00
|
|
|
int layer = -1;
|
|
|
|
for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
if( m_layers->GetToggleValue( (unsigned) ii, 0 ) )
|
|
|
|
{
|
|
|
|
layer = ii;
|
|
|
|
break;
|
|
|
|
}
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
if( layer < 0 )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
DisplayError( this, _( "No layer selected." ) );
|
2008-11-14 22:40:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
NETINFO_ITEM* net = nullptr;
|
2009-01-24 19:30:39 +00:00
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
// Search net_code for this net, if a net was selected
|
2009-01-24 19:30:39 +00:00
|
|
|
if( m_ListNetNameSelection->GetSelection() > 0 )
|
2018-10-19 11:28:34 +00:00
|
|
|
{
|
2019-04-11 23:26:49 +00:00
|
|
|
wxString netname = m_ListNetNameSelection->GetStringSelection();
|
2018-10-19 11:28:34 +00:00
|
|
|
net = m_Parent->GetBoard()->FindNet( netname );
|
|
|
|
}
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_settings.m_NetcodeSelection = net ? net->GetNet() : 0;
|
2008-11-14 22:40:31 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnStyleSelection( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
bool enable = m_GridStyleCtrl->GetSelection() >= 1;
|
|
|
|
m_tcGridStyleThickness->Enable( enable );
|
|
|
|
m_tcGridStyleGap->Enable( enable );
|
|
|
|
m_tcGridStyleOrientation->Enable( enable );
|
|
|
|
m_spinCtrlSmoothLevel->Enable( enable );
|
|
|
|
m_spinCtrlSmoothValue->Enable( enable );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event )
|
2012-02-06 05:44:19 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
if( event.GetColumn() != 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
int row = m_layers->ItemToRow( event.GetItem() );
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
if( m_layers->GetToggleValue( row, 0 ) )
|
2012-02-06 05:44:19 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
wxVariant layerID;
|
|
|
|
m_layers->GetValue( layerID, row, 2 );
|
|
|
|
m_settings.m_CurrentZone_Layer = ToLAYER_ID( layerID.GetInteger() );
|
|
|
|
|
|
|
|
// Turn all other checkboxes off.
|
|
|
|
for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
|
|
|
|
{
|
|
|
|
if( ii != row )
|
|
|
|
m_layers->SetToggleValue( false, ii, 0 );
|
|
|
|
}
|
2012-02-06 05:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
m_NetFiltering = !m_showAllNetsOpt->GetValue();
|
|
|
|
m_NetSortingByPadCount = m_sortByPadsOpt->GetValue();
|
2010-08-23 12:13:48 +00:00
|
|
|
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
buildAvailableListOfNets();
|
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_Config )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
long configValue = m_NetFiltering ? 2 : 0;
|
|
|
|
|
|
|
|
if( m_NetSortingByPadCount )
|
|
|
|
configValue += 1;
|
|
|
|
|
|
|
|
m_Config->Write( ZONE_NET_SORT_OPTION_KEY, configValue );
|
2010-08-23 12:13:48 +00:00
|
|
|
wxString Filter = m_DoNotShowNetNameFilter->GetValue();
|
2008-11-22 11:10:40 +00:00
|
|
|
m_Config->Write( ZONE_NET_FILTER_STRING_KEY, Filter );
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
if( !AcceptOptions( true ) )
|
2008-11-14 22:40:31 +00:00
|
|
|
return;
|
|
|
|
|
2012-11-23 09:10:37 +00:00
|
|
|
// Export settings ( but layer and netcode ) to others copper zones
|
2009-01-05 05:21:35 +00:00
|
|
|
BOARD* pcb = m_Parent->GetBoard();
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
|
|
|
|
{
|
|
|
|
ZONE_CONTAINER* zone = pcb->GetArea( ii );
|
2012-11-23 09:10:37 +00:00
|
|
|
|
|
|
|
// Cannot export settings from a copper zone
|
|
|
|
// to a zone keepout:
|
|
|
|
if( zone->GetIsKeepout() )
|
|
|
|
continue;
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.ExportSetting( *zone, false ); // false = partial export
|
2018-05-25 14:56:04 +00:00
|
|
|
m_settingsExported = true;
|
2010-02-19 13:23:58 +00:00
|
|
|
m_Parent->OnModify();
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
2010-08-23 12:13:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnRunFiltersButtonClick( wxCommandEvent& event )
|
2010-08-23 12:13:48 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
m_NetFiltering = true;
|
|
|
|
m_showAllNetsOpt->SetValue( false );
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
buildAvailableListOfNets();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::buildAvailableListOfNets()
|
2010-08-23 12:13:48 +00:00
|
|
|
{
|
2011-08-27 23:31:56 +00:00
|
|
|
wxArrayString listNetName;
|
2010-08-23 12:13:48 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
m_Parent->GetBoard()->SortedNetnamesList( listNetName, m_NetSortingByPadCount );
|
2010-08-23 12:13:48 +00:00
|
|
|
|
|
|
|
if( m_NetFiltering )
|
|
|
|
{
|
|
|
|
wxString doNotShowFilter = m_DoNotShowNetNameFilter->GetValue();
|
|
|
|
wxString ShowFilter = m_ShowNetNameFilter->GetValue();
|
2011-08-27 23:31:56 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
for( unsigned ii = 0; ii < listNetName.GetCount(); ii++ )
|
|
|
|
{
|
|
|
|
if( listNetName[ii].Matches( doNotShowFilter ) )
|
|
|
|
{
|
|
|
|
listNetName.RemoveAt( ii );
|
|
|
|
ii--;
|
|
|
|
}
|
|
|
|
else if( !listNetName[ii].Matches( ShowFilter ) )
|
|
|
|
{
|
|
|
|
listNetName.RemoveAt( ii );
|
|
|
|
ii--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-08-27 23:31:56 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
listNetName.Insert( wxT( "<no net>" ), 0 );
|
|
|
|
|
2011-08-27 23:31:56 +00:00
|
|
|
// Ensure currently selected net for the zone is visible, regardless of filters
|
2018-05-25 14:56:04 +00:00
|
|
|
int selectedNetListNdx = 0;
|
2012-02-06 05:44:19 +00:00
|
|
|
int net_select = m_settings.m_NetcodeSelection;
|
2011-08-27 23:31:56 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
if( net_select > 0 )
|
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( net_select );
|
|
|
|
if( selectedNet )
|
2010-08-23 12:13:48 +00:00
|
|
|
{
|
2018-05-25 14:56:04 +00:00
|
|
|
selectedNetListNdx = listNetName.Index( selectedNet->GetNetname() );
|
2011-08-27 23:31:56 +00:00
|
|
|
|
|
|
|
if( wxNOT_FOUND == selectedNetListNdx )
|
2010-08-23 12:13:48 +00:00
|
|
|
{
|
2011-08-27 23:31:56 +00:00
|
|
|
// the currently selected net must *always* be visible.
|
2018-05-25 14:56:04 +00:00
|
|
|
// <no net> is the zero'th index, so pick next lowest
|
|
|
|
listNetName.Insert( selectedNet->GetNetname(), 1 );
|
2018-03-24 03:37:32 +00:00
|
|
|
selectedNetListNdx = 1;
|
2010-08-23 12:13:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-08-27 23:31:56 +00:00
|
|
|
|
|
|
|
m_ListNetNameSelection->Clear();
|
|
|
|
m_ListNetNameSelection->InsertItems( listNetName, 0 );
|
2018-05-25 14:56:04 +00:00
|
|
|
m_ListNetNameSelection->SetSelection( selectedNetListNdx );
|
|
|
|
m_ListNetNameSelection->EnsureVisible( selectedNetListNdx );
|
2010-08-23 12:13:48 +00:00
|
|
|
}
|
2011-02-19 10:13:09 +00:00
|
|
|
|