2012-06-25 20:59:19 +00:00
|
|
|
/**
|
|
|
|
* @file dialog_copper_zones.cpp
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-04-08 06:21:35 +00:00
|
|
|
* Copyright (C) 2017 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
2012-06-25 20:59:19 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2017-04-08 06:21:35 +00:00
|
|
|
* Copyright (C) 1992-2017 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
|
|
|
|
2011-02-19 10:13:09 +00:00
|
|
|
#include <wx/wx.h>
|
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>
|
|
|
|
#include <PolyLine.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <zones.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2012-11-23 09:10:37 +00:00
|
|
|
#include <class_zone.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
2012-02-06 05:44:19 +00:00
|
|
|
#include <dialog_copper_zones_base.h>
|
2012-06-26 20:18:01 +00:00
|
|
|
|
|
|
|
#include <wx/imaglist.h> // needed for wx/listctrl.h, in wxGTK 2.8.12
|
2012-02-06 09:10:32 +00:00
|
|
|
#include <wx/listctrl.h>
|
2013-03-31 13:27:46 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class DIALOG_COPPER_ZONE
|
|
|
|
* is the derived class from dialog_copper_zone_frame created by wxFormBuilder
|
|
|
|
*/
|
|
|
|
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;
|
2015-09-17 20:43:14 +00:00
|
|
|
wxConfigBase* m_Config; ///< Current config
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
ZONE_EDIT_T m_OnExitCode; ///< exit code: ZONE_ABORT if no change,
|
|
|
|
///< ZONE_OK if new values accepted
|
|
|
|
///< ZONE_EXPORT_VALUES if values are exported to others zones
|
|
|
|
|
|
|
|
ZONE_SETTINGS m_settings;
|
|
|
|
ZONE_SETTINGS* m_ptr;
|
|
|
|
|
|
|
|
bool m_NetSortingByPadCount; ///< false = alphabetic sort.
|
|
|
|
///< true = pad count sort.
|
|
|
|
|
|
|
|
long m_NetFiltering;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
std::vector<PCB_LAYER_ID> m_LayerId; ///< Handle the real layer number from layer
|
2012-02-06 05:44:19 +00:00
|
|
|
///< name position in m_LayerSelectionCtrl
|
|
|
|
|
|
|
|
static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*").
|
2015-09-17 20:43:14 +00:00
|
|
|
///< static to keep this pattern for an entire Pcbnew session
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function initDialog
|
|
|
|
* fills in the dialog controls using the current settings.
|
|
|
|
*/
|
|
|
|
void initDialog();
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnButtonOkClick( wxCommandEvent& event ) override;
|
|
|
|
void OnButtonCancelClick( wxCommandEvent& event ) override;
|
|
|
|
void OnClose( wxCloseEvent& event ) override;
|
|
|
|
void OnCornerSmoothingModeChoice( wxCommandEvent& event ) override;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AcceptOptions
|
|
|
|
* @param aPromptForErrors is true to prompt user on incorrect params.
|
2015-09-17 20:43:14 +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.
|
|
|
|
*/
|
|
|
|
bool AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly = false );
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
|
|
|
|
void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override;
|
|
|
|
void OnPadsInZoneClick( wxCommandEvent& event ) override;
|
|
|
|
void OnRunFiltersButtonClick( wxCommandEvent& event ) override;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
void buildAvailableListOfNets();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function initListNetsParams
|
|
|
|
* initializes m_NetSortingByPadCount and m_NetFiltering values
|
|
|
|
* according to m_NetDisplayOption selection.
|
|
|
|
*/
|
|
|
|
void initListNetsParams();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function makeLayerBitmap
|
|
|
|
* creates the colored rectangle bitmaps used in the layer selection widget.
|
|
|
|
* @param aColor is the color to fill the rectangle with.
|
|
|
|
*/
|
2017-02-20 16:57:41 +00:00
|
|
|
wxBitmap makeLayerBitmap( COLOR4D aColor );
|
2012-02-06 05:44:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define LAYER_BITMAP_SIZE_X 20
|
|
|
|
#define LAYER_BITMAP_SIZE_Y 10
|
2011-02-19 10:13:09 +00:00
|
|
|
|
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
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
|
|
|
|
{
|
|
|
|
DIALOG_COPPER_ZONE dlg( aCaller, aSettings );
|
|
|
|
|
|
|
|
ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
|
|
|
|
DIALOG_COPPER_ZONE_BASE( aParent )
|
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();
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
m_ptr = aSettings;
|
|
|
|
m_settings = *aSettings;
|
|
|
|
|
|
|
|
m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
|
2010-11-13 19:21:16 +00:00
|
|
|
m_OnExitCode = ZONE_ABORT;
|
2009-08-23 15:22:44 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
|
2010-02-19 13:23:58 +00:00
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
// Fix static text widget minimum width to a suitable value so that
|
|
|
|
// resizing the dialog is not necessary when changing the corner smoothing type.
|
|
|
|
// Depends on the default text in the widget.
|
2017-04-08 06:21:35 +00:00
|
|
|
m_cornerSmoothingValue->SetMinSize( m_cornerSmoothingValue->GetSize() );
|
2011-03-01 22:36:38 +00:00
|
|
|
|
2010-02-03 17:38:32 +00:00
|
|
|
initDialog();
|
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
|
|
|
|
|
|
|
FinishDialogSettings();
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::initDialog()
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
BOARD* board = m_Parent->GetBoard();
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2008-11-22 20:50:30 +00:00
|
|
|
wxString msg;
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
if( m_settings.m_Zone_45_Only )
|
2008-11-14 22:40:31 +00:00
|
|
|
m_OrientEdgesOpt->SetSelection( 1 );
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit );
|
* 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
|
|
|
msg = StringFromValue( g_UserUnit, m_settings.m_ZoneClearance );
|
2008-11-14 22:40:31 +00:00
|
|
|
m_ZoneClearanceCtrl->SetValue( msg );
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
|
* 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
|
|
|
msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
|
2008-11-22 20:50:30 +00:00
|
|
|
m_ZoneMinThicknessCtrl->SetValue( msg );
|
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
switch( m_settings.GetPadConnection() )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_THT_THERMAL: // Thermals only for THT pads
|
2008-11-14 22:40:31 +00:00
|
|
|
m_PadInZoneOpt->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_NONE: // Pads are not covered
|
2012-07-09 07:10:07 +00:00
|
|
|
m_PadInZoneOpt->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
default:
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_THERMAL: // Use thermal relief for pads
|
2008-11-14 22:40:31 +00:00
|
|
|
m_PadInZoneOpt->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_FULL: // pads are covered by copper
|
2008-11-14 22:40:31 +00:00
|
|
|
m_PadInZoneOpt->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority );
|
2012-01-29 19:29:19 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
AddUnitSymbol( *m_AntipadSizeText, g_UserUnit );
|
|
|
|
AddUnitSymbol( *m_CopperBridgeWidthText, g_UserUnit );
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_AntipadSizeValue, m_settings.m_ThermalReliefGap );
|
|
|
|
PutValueInLocalUnits( *m_CopperWidthValue, m_settings.m_ThermalReliefCopperBridge );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_cornerSmoothingChoice->SetSelection( m_settings.GetCornerSmoothingType() );
|
2011-02-21 19:43:59 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_cornerSmoothingCtrl, m_settings.GetCornerRadius() );
|
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
|
|
|
{
|
2017-03-07 12:06:00 +00:00
|
|
|
case ZONE_CONTAINER::NO_HATCH:
|
2008-11-14 22:40:31 +00:00
|
|
|
m_OutlineAppearanceCtrl->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
case ZONE_CONTAINER::DIAGONAL_EDGE:
|
2008-11-14 22:40:31 +00:00
|
|
|
m_OutlineAppearanceCtrl->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
2017-03-07 12:06:00 +00:00
|
|
|
case ZONE_CONTAINER::DIAGONAL_FULL:
|
2008-11-14 22:40:31 +00:00
|
|
|
m_OutlineAppearanceCtrl->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-01-12 13:15:13 +00:00
|
|
|
m_ArcApproximationOpt->SetSelection(
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2012-07-13 18:55:29 +00:00
|
|
|
// Create one column in m_LayerSelectionCtrl
|
2013-03-25 17:02:29 +00:00
|
|
|
wxListItem column0;
|
|
|
|
column0.SetId( 0 );
|
|
|
|
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2011-02-19 10:13:09 +00:00
|
|
|
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
|
|
|
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2013-08-13 17:51:22 +00:00
|
|
|
int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names
|
2014-07-15 16:53:13 +00:00
|
|
|
int imgIdx = 0;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
|
|
|
LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() );
|
|
|
|
|
2014-07-15 16:53:13 +00:00
|
|
|
for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack, imgIdx++ )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID layer = *cu_stack;
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
m_LayerId.push_back( layer );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2014-06-30 15:03:20 +00:00
|
|
|
msg = board->GetLayerName( layer );
|
|
|
|
|
|
|
|
msg.Trim();
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2017-02-20 16:57:41 +00:00
|
|
|
COLOR4D layerColor = board->GetLayerColor( layer );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2011-02-19 10:13:09 +00:00
|
|
|
imageList->Add( makeLayerBitmap( layerColor ) );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2014-06-29 18:09:32 +00:00
|
|
|
int itemIndex = m_LayerSelectionCtrl->InsertItem(
|
2014-07-15 16:53:13 +00:00
|
|
|
m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
|
|
|
if( m_settings.m_CurrentZone_Layer == layer )
|
2011-02-19 10:13:09 +00:00
|
|
|
m_LayerSelectionCtrl->Select( itemIndex );
|
2013-08-13 17:51:22 +00:00
|
|
|
|
|
|
|
wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) );
|
|
|
|
ctrlWidth = std::max( ctrlWidth, tsize.x );
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
2013-08-13 17:51:22 +00:00
|
|
|
// The most easy way to ensure the right size is to use wxLIST_AUTOSIZE
|
|
|
|
// unfortunately this option does not work well both on
|
2015-09-17 20:43:14 +00:00
|
|
|
// wxWidgets 2.8 ( column width too small), and
|
|
|
|
// wxWidgets 2.9 ( column width too large)
|
2014-09-25 07:07:17 +00:00
|
|
|
ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text
|
2013-08-13 17:51:22 +00:00
|
|
|
m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2014-09-25 07:07:17 +00:00
|
|
|
ctrlWidth += 25; // add small margin between text and window borders
|
|
|
|
// and room for vertical scroll bar
|
2014-06-24 16:17:18 +00:00
|
|
|
m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) );
|
2013-03-25 17:02:29 +00:00
|
|
|
|
2013-09-25 19:09:57 +00:00
|
|
|
wxString netNameDoNotShowFilter = wxT( "Net-*" );
|
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 );
|
|
|
|
m_NetDisplayOption->SetSelection( opt );
|
|
|
|
m_Config->Read( ZONE_NET_FILTER_STRING_KEY, netNameDoNotShowFilter );
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
2010-08-23 12:13:48 +00:00
|
|
|
else
|
|
|
|
m_NetDisplayOption->SetSelection( 1 );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2010-11-13 19:21:16 +00:00
|
|
|
m_ShowNetNameFilter->SetValue( m_netNameShowFilter );
|
2010-08-23 12:13:48 +00:00
|
|
|
initListNetsParams();
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
// Build list of nets:
|
|
|
|
m_DoNotShowNetNameFilter->SetValue( netNameDoNotShowFilter );
|
|
|
|
buildAvailableListOfNets();
|
2011-02-21 19:43:59 +00:00
|
|
|
|
|
|
|
wxCommandEvent event;
|
|
|
|
OnCornerSmoothingModeChoice( event );
|
2008-11-14 22:40:31 +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
|
|
|
{
|
|
|
|
Close( true );
|
|
|
|
}
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
|
|
|
|
|
|
|
if( AcceptOptions( true ) )
|
|
|
|
{
|
2012-02-06 07:14:51 +00:00
|
|
|
*m_ptr = m_settings;
|
2012-02-06 05:44:19 +00:00
|
|
|
EndModal( ZONE_OK );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-19 10:13:09 +00:00
|
|
|
|
2012-02-06 07:14:51 +00:00
|
|
|
// called on system close button
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2012-02-06 05:44:19 +00:00
|
|
|
if( m_OnExitCode != ZONE_ABORT )
|
|
|
|
*m_ptr = m_settings;
|
|
|
|
|
2009-08-23 15:22:44 +00:00
|
|
|
EndModal( m_OnExitCode );
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
|
|
|
switch( m_PadInZoneOpt->GetSelection() )
|
|
|
|
{
|
2012-07-09 07:10:07 +00:00
|
|
|
case 3:
|
2012-02-06 05:44:19 +00:00
|
|
|
// Pads are not covered
|
2015-08-18 14:19:17 +00:00
|
|
|
m_settings.SetPadConnection( PAD_ZONE_CONN_NONE );
|
2008-11-14 22:40:31 +00:00
|
|
|
break;
|
|
|
|
|
2012-07-09 07:10:07 +00:00
|
|
|
case 2:
|
|
|
|
// Use thermal relief for THT pads
|
2015-08-18 14:19:17 +00:00
|
|
|
m_settings.SetPadConnection( PAD_ZONE_CONN_THT_THERMAL );
|
2012-07-09 07:10:07 +00:00
|
|
|
break;
|
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
case 1:
|
2012-02-06 05:44:19 +00:00
|
|
|
// Use thermal relief for pads
|
2015-08-18 14:19:17 +00:00
|
|
|
m_settings.SetPadConnection( PAD_ZONE_CONN_THERMAL );
|
2008-11-14 22:40:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
2012-02-06 05:44:19 +00:00
|
|
|
// pads are covered by copper
|
2015-08-18 14:19:17 +00:00
|
|
|
m_settings.SetPadConnection( PAD_ZONE_CONN_FULL );
|
2008-11-14 22:40:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( m_OutlineAppearanceCtrl->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0:
|
2017-03-07 12:06:00 +00:00
|
|
|
m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH;
|
2008-11-14 22:40:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2017-03-07 12:06:00 +00:00
|
|
|
m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE;
|
2008-11-14 22:40:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2017-03-07 12:06:00 +00:00
|
|
|
m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL;
|
2008-11-14 22:40:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_ArcToSegmentsCount = m_ArcApproximationOpt->GetSelection() == 1 ?
|
2010-01-12 13:15:13 +00:00
|
|
|
ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF :
|
|
|
|
ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
|
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
|
|
|
{
|
2008-11-22 11:10:40 +00:00
|
|
|
m_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
|
2012-02-06 05:44:19 +00:00
|
|
|
(long) m_settings.m_Zone_HatchingStyle );
|
|
|
|
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();
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
|
2008-11-14 22:40:31 +00:00
|
|
|
|
|
|
|
wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
|
* 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_settings.m_ZoneClearance = ValueFromString( g_UserUnit, txtvalue );
|
2008-11-22 20:50:30 +00:00
|
|
|
|
2012-05-29 18:10:56 +00:00
|
|
|
// Test if this is a reasonable value for this parameter
|
2011-09-30 18:15:37 +00:00
|
|
|
// A too large value can hang Pcbnew
|
2012-06-25 20:59:19 +00:00
|
|
|
#define CLEARANCE_MAX_VALUE ZONE_CLEARANCE_MAX_VALUE_MIL*IU_PER_MILS
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE )
|
2009-03-03 19:42:49 +00:00
|
|
|
{
|
2012-06-25 20:59:19 +00:00
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Clearance must be smaller than %f\" / %f mm." ),
|
|
|
|
ZONE_CLEARANCE_MAX_VALUE_MIL / 1000.0, ZONE_CLEARANCE_MAX_VALUE_MIL * 0.0254 );
|
|
|
|
DisplayError( this, msg );
|
2009-03-03 19:42:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-11-22 20:50:30 +00:00
|
|
|
txtvalue = m_ZoneMinThicknessCtrl->GetValue();
|
* 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_settings.m_ZoneMinThickness = ValueFromString( g_UserUnit, txtvalue );
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2012-06-25 20:59:19 +00:00
|
|
|
if( m_settings.m_ZoneMinThickness < (ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS) )
|
2008-12-03 10:32:53 +00:00
|
|
|
{
|
2012-06-25 20:59:19 +00:00
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Minimum width must be larger than %f\" / %f mm." ),
|
|
|
|
ZONE_THICKNESS_MIN_VALUE_MIL / 1000.0, ZONE_THICKNESS_MIN_VALUE_MIL * 0.0254 );
|
|
|
|
DisplayError( this, msg );
|
2008-12-03 10:32:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2008-11-22 20:50:30 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
|
2011-02-21 19:43:59 +00:00
|
|
|
txtvalue = m_cornerSmoothingCtrl->GetValue();
|
* 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_settings.SetCornerRadius( ValueFromString( g_UserUnit, txtvalue ) );
|
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
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
if( m_OrientEdgesOpt->GetSelection() == 0 )
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_Zone_45_Only = false;
|
2008-11-14 22:40:31 +00:00
|
|
|
else
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_Zone_45_Only = true;
|
|
|
|
|
* 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_settings.m_ThermalReliefGap = ValueFromTextCtrl( *m_AntipadSizeValue );
|
|
|
|
m_settings.m_ThermalReliefCopperBridge = ValueFromTextCtrl( *m_CopperWidthValue );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
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 );
|
2012-06-25 20:59:19 +00:00
|
|
|
|
2013-03-29 10:14:32 +00:00
|
|
|
ConfigBaseWriteDouble( m_Config, ZONE_MIN_THICKNESS_WIDTH_STRING_KEY,
|
2012-06-25 20:59:19 +00:00
|
|
|
(double) m_settings.m_ZoneMinThickness / IU_PER_MILS );
|
2008-11-24 20:46:41 +00:00
|
|
|
|
2013-03-29 10:14:32 +00:00
|
|
|
ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
|
2012-06-25 20:59:19 +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,
|
2012-06-25 20:59:19 +00:00
|
|
|
(double) m_settings.m_ThermalReliefCopperBridge / IU_PER_MILS );
|
|
|
|
}
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2015-12-21 18:42:16 +00:00
|
|
|
if( ( m_settings.GetPadConnection() == PAD_ZONE_CONN_THT_THERMAL
|
|
|
|
|| m_settings.GetPadConnection() == PAD_ZONE_CONN_THERMAL )
|
|
|
|
&& m_settings.m_ThermalReliefCopperBridge <= m_settings.m_ZoneMinThickness )
|
2008-11-24 20:46:41 +00:00
|
|
|
{
|
2009-01-24 19:30:39 +00:00
|
|
|
DisplayError( this,
|
2015-09-17 20:43:14 +00:00
|
|
|
_( "Thermal relief spoke must be greater than the minimum width." ) );
|
2008-11-24 20:46:41 +00:00
|
|
|
return false;
|
|
|
|
}
|
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
|
2011-02-19 10:13:09 +00:00
|
|
|
int ii = m_LayerSelectionCtrl->GetFirstSelected();
|
2011-03-01 22:36:38 +00:00
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
if( ii < 0 && aPromptForErrors )
|
|
|
|
{
|
2011-02-19 10:13:09 +00:00
|
|
|
DisplayError( this, _( "No layer selected." ) );
|
2008-11-14 22:40:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-06-29 13:05:51 +00:00
|
|
|
m_settings.m_CurrentZone_Layer = ToLAYER_ID( m_LayerId[ii] );
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
// Get the net name selection for this zone
|
2008-11-14 22:40:31 +00:00
|
|
|
ii = m_ListNetNameSelection->GetSelection();
|
2011-03-01 22:36:38 +00:00
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
if( ii < 0 && aPromptForErrors )
|
|
|
|
{
|
2011-02-19 10:13:09 +00:00
|
|
|
DisplayError( this, _( "No net selected." ) );
|
2008-11-14 22:40:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-08-23 15:22:44 +00:00
|
|
|
if( ii == 0 ) // the not connected option was selected: this is not a good practice: warn:
|
2009-01-24 19:30:39 +00:00
|
|
|
{
|
2015-09-17 20:43:14 +00:00
|
|
|
if( !IsOK( this, _( "You have chosen the \"not connected\" option. This will create "
|
|
|
|
"insulated copper islands. Are you sure ?" ) ) )
|
2009-08-23 15:22:44 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-01-24 19:30:39 +00:00
|
|
|
|
2008-11-14 22:40:31 +00:00
|
|
|
wxString net_name = m_ListNetNameSelection->GetString( ii );
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_NetcodeSelection = 0;
|
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 )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2009-08-23 15:22:44 +00:00
|
|
|
NETINFO_ITEM* net = m_Parent->GetBoard()->FindNet( net_name );
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2009-05-24 18:28:36 +00:00
|
|
|
if( net )
|
2012-02-06 05:44:19 +00:00
|
|
|
m_settings.m_NetcodeSelection = net->GetNet();
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnCornerSmoothingModeChoice( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int selection = m_cornerSmoothingChoice->GetSelection();
|
|
|
|
|
|
|
|
switch( selection )
|
|
|
|
{
|
|
|
|
case ZONE_SETTINGS::SMOOTHING_NONE:
|
2017-04-08 06:21:35 +00:00
|
|
|
m_cornerSmoothingValue->Enable( false );
|
2012-02-06 05:44:19 +00:00
|
|
|
m_cornerSmoothingCtrl->Enable( false );
|
|
|
|
break;
|
|
|
|
case ZONE_SETTINGS::SMOOTHING_CHAMFER:
|
2017-04-08 06:21:35 +00:00
|
|
|
m_cornerSmoothingValue->Enable( true );
|
2012-02-06 05:44:19 +00:00
|
|
|
m_cornerSmoothingCtrl->Enable( true );
|
2017-04-08 06:21:35 +00:00
|
|
|
m_cornerSmoothingValue->SetLabel( _( "Chamfer distance" ) );
|
|
|
|
AddUnitSymbol( *m_cornerSmoothingValue, g_UserUnit );
|
2012-02-06 05:44:19 +00:00
|
|
|
break;
|
|
|
|
case ZONE_SETTINGS::SMOOTHING_FILLET:
|
2017-04-08 06:21:35 +00:00
|
|
|
m_cornerSmoothingValue->Enable( true );
|
2012-02-06 05:44:19 +00:00
|
|
|
m_cornerSmoothingCtrl->Enable( true );
|
2017-04-08 06:21:35 +00:00
|
|
|
m_cornerSmoothingValue->SetLabel( _( "Fillet radius" ) );
|
|
|
|
AddUnitSymbol( *m_cornerSmoothingValue, g_UserUnit );
|
2012-02-06 05:44:19 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2010-08-23 12:13:48 +00:00
|
|
|
initListNetsParams();
|
|
|
|
buildAvailableListOfNets();
|
2008-11-14 22:40:31 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
2015-09-17 20:43:14 +00:00
|
|
|
|
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
|
|
|
m_Config->Write( ZONE_NET_SORT_OPTION_KEY, (long) m_NetDisplayOption->GetSelection() );
|
|
|
|
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
|
|
|
{
|
|
|
|
if( !AcceptOptions( true, true ) )
|
|
|
|
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
|
2010-02-19 13:23:58 +00:00
|
|
|
m_Parent->OnModify();
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
2010-01-12 13:15:13 +00:00
|
|
|
|
2009-08-23 15:22:44 +00:00
|
|
|
m_OnExitCode = ZONE_EXPORT_VALUES; // values are exported to others zones
|
2008-11-14 22:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnPadsInZoneClick( wxCommandEvent& event )
|
2008-11-14 22:40:31 +00:00
|
|
|
{
|
2016-02-09 08:23:24 +00:00
|
|
|
// Antipad and spokes are significant only for thermals
|
|
|
|
// However, even if thermals are disabled, these parameters must be set
|
|
|
|
// for pads which have local settings with thermal enabled
|
|
|
|
// Previously, wxTextCtrl widgets related to thermal settings were disabled,
|
|
|
|
// but this is not a good idea. We leave them always enabled.
|
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::initListNetsParams()
|
2010-08-23 12:13:48 +00:00
|
|
|
{
|
|
|
|
switch( m_NetDisplayOption->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0:
|
2010-11-13 19:21:16 +00:00
|
|
|
m_NetSortingByPadCount = false;
|
2010-08-23 12:13:48 +00:00
|
|
|
m_NetFiltering = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2010-11-13 19:21:16 +00:00
|
|
|
m_NetSortingByPadCount = true;
|
2010-08-23 12:13:48 +00:00
|
|
|
m_NetFiltering = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2010-11-13 19:21:16 +00:00
|
|
|
m_NetSortingByPadCount = false;
|
2010-08-23 12:13:48 +00:00
|
|
|
m_NetFiltering = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2010-11-13 19:21:16 +00:00
|
|
|
m_NetSortingByPadCount = true;
|
2010-08-23 12:13:48 +00:00
|
|
|
m_NetFiltering = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
void DIALOG_COPPER_ZONE::OnRunFiltersButtonClick( wxCommandEvent& event )
|
2010-08-23 12:13:48 +00:00
|
|
|
{
|
|
|
|
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
|
2010-11-13 19:21:16 +00:00
|
|
|
|
2011-03-01 22:36:38 +00:00
|
|
|
// Ensure filtered option for nets
|
2010-08-23 12:13:48 +00:00
|
|
|
if( m_NetDisplayOption->GetSelection() == 0 )
|
|
|
|
m_NetDisplayOption->SetSelection( 2 );
|
|
|
|
else if( m_NetDisplayOption->GetSelection() == 1 )
|
|
|
|
m_NetDisplayOption->SetSelection( 3 );
|
2015-09-17 20:43:14 +00:00
|
|
|
|
2010-08-23 12:13:48 +00:00
|
|
|
initListNetsParams();
|
|
|
|
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
|
|
|
|
int selectedNetListNdx = -1;
|
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 )
|
|
|
|
{
|
|
|
|
NETINFO_ITEM* equipot = m_Parent->GetBoard()->FindNet( net_select );
|
2011-08-27 23:31:56 +00:00
|
|
|
if( equipot )
|
2010-08-23 12:13:48 +00:00
|
|
|
{
|
2011-08-27 23:31:56 +00:00
|
|
|
selectedNetListNdx = listNetName.Index( equipot->GetNetname() );
|
|
|
|
|
|
|
|
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.
|
|
|
|
listNetName.Insert( equipot->GetNetname(), 0 );
|
|
|
|
selectedNetListNdx = 0;
|
2010-08-23 12:13:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-08-27 23:31:56 +00:00
|
|
|
else if( net_select == 0 )
|
|
|
|
selectedNetListNdx = 0; // SetSelection() on "<no net>"
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// selectedNetListNdx remains -1, no net selected.
|
|
|
|
}
|
|
|
|
|
|
|
|
m_ListNetNameSelection->Clear();
|
|
|
|
m_ListNetNameSelection->InsertItems( listNetName, 0 );
|
|
|
|
m_ListNetNameSelection->SetSelection( 0 );
|
|
|
|
|
|
|
|
if( selectedNetListNdx >= 0 )
|
|
|
|
{
|
|
|
|
m_ListNetNameSelection->SetSelection( selectedNetListNdx );
|
|
|
|
m_ListNetNameSelection->EnsureVisible( selectedNetListNdx );
|
|
|
|
}
|
2010-08-23 12:13:48 +00:00
|
|
|
}
|
2011-02-19 10:13:09 +00:00
|
|
|
|
|
|
|
|
2017-02-20 16:57:41 +00:00
|
|
|
wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( COLOR4D aColor )
|
2011-02-19 10:13:09 +00:00
|
|
|
{
|
|
|
|
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
|
|
|
wxBrush brush;
|
|
|
|
wxMemoryDC iconDC;
|
|
|
|
|
|
|
|
iconDC.SelectObject( bitmap );
|
2017-02-20 16:57:41 +00:00
|
|
|
brush.SetColour( aColor.ToColour() );
|
2014-01-08 01:34:04 +00:00
|
|
|
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
2011-02-19 10:13:09 +00:00
|
|
|
iconDC.SetBrush( brush );
|
|
|
|
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
|
|
|
|
|
|
|
|
return bitmap;
|
|
|
|
}
|