39#include <wx/statbox.h>
40#include <wx/statline.h>
41#include <wx/radiobut.h>
43#define LAYER_LIST_COLUMN_CHECK 0
44#define LAYER_LIST_COLUMN_ICON 1
45#define LAYER_LIST_COLUMN_NAME 2
46#define LAYER_LIST_ROW_ALL_INNER_LAYERS 1
109 m_outlineHatchPitch( aParent, m_stBorderHatchPitchText, m_outlineHatchPitchCtrl, m_outlineHatchUnits ),
110 m_convertSettings( aConvertSettings ),
111 m_rbCenterline( nullptr ),
112 m_rbBoundingHull( nullptr ),
113 m_gapLabel( nullptr ),
114 m_gapCtrl( nullptr ),
115 m_gapUnits( nullptr ),
117 m_cbDeleteOriginals( nullptr ),
118 m_notFoundPlacementSource( false ),
146 if( aConvertSettings )
148 wxStaticBox* bConvertBox =
new wxStaticBox(
this, wxID_ANY,
149 _(
"Conversion Settings" ) );
150 wxStaticBoxSizer* bConvertSizer =
new wxStaticBoxSizer( bConvertBox, wxVERTICAL );
152 m_rbCenterline =
new wxRadioButton(
this, wxID_ANY,
_(
"Use centerlines" ) );
155 bConvertSizer->AddSpacer( 2 );
156 m_rbBoundingHull =
new wxRadioButton(
this, wxID_ANY,
_(
"Create bounding hull" ) );
159 m_gapLabel =
new wxStaticText(
this, wxID_ANY,
_(
"Gap:" ) );
160 m_gapCtrl =
new wxTextCtrl(
this, wxID_ANY );
161 m_gapUnits =
new wxStaticText(
this, wxID_ANY,
_(
"mm" ) );
164 wxBoxSizer* hullParamsSizer =
new wxBoxSizer( wxHORIZONTAL );
165 hullParamsSizer->Add(
m_gapLabel, 0, wxALIGN_CENTRE_VERTICAL, 5 );
166 hullParamsSizer->Add(
m_gapCtrl, 1, wxALIGN_CENTRE_VERTICAL|wxLEFT|wxRIGHT, 3 );
167 hullParamsSizer->Add(
m_gapUnits, 0, wxALIGN_CENTRE_VERTICAL, 5 );
169 bConvertSizer->AddSpacer( 2 );
170 bConvertSizer->Add( hullParamsSizer, 0, wxLEFT, 26 );
172 bConvertSizer->AddSpacer( 6 );
174 _(
"Delete source objects after conversion" ) );
177 GetSizer()->Insert( 0, bConvertSizer, 0, wxALL|wxEXPAND, 10 );
179 wxStaticLine* line =
new wxStaticLine(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
181 GetSizer()->Insert( 1, line, 0, wxLEFT|wxRIGHT|wxEXPAND, 10 );
183 SetTitle(
_(
"Convert to Rule Area" ) );
270 std::set<wxString> classNames;
273 classNames.insert( className );
275 for(
const wxString& sourceName : classNames )
278 if( !classNames.empty() )
282 std::set<wxString> sheetNames;
283 std::set<wxString> groupNames;
287 sheetNames.insert( fp->GetSheetname() );
289 if( fp->GetParentGroup() && !fp->GetParentGroup()->GetName().IsEmpty() )
290 groupNames.insert( fp->GetParentGroup()->GetName() );
293 for(
const wxString& sourceName : sheetNames )
296 for(
const wxString& groupName : groupNames )
299 if( !sheetNames.empty() )
302 if( !groupNames.empty() )
306 auto setupCurrentSourceSelection = [&]( wxComboBox* cb )
308 if( curSourceName == wxEmptyString )
311 if( !cb->SetStringSelection( curSourceName ) )
315 wxString notFoundDisplayName =
_(
"Not found on board: " ) + curSourceName;
316 cb->Insert( notFoundDisplayName, 0 );
361 case ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER:
378 if( event.GetColumn() != 0 )
381 int row =
m_layers->ItemToRow( event.GetItem() );
432 auto setPlacementSource =
439 if( sourceType == PLACEMENT_SOURCE_T::SHEETNAME )
441 else if( sourceType == PLACEMENT_SOURCE_T::COMPONENT_CLASS )
446 int selectedSourceIdx = cb->GetSelection();
448 if( selectedSourceIdx != wxNOT_FOUND )
465 setPlacementSource( PLACEMENT_SOURCE_T::SHEETNAME );
470 setPlacementSource( PLACEMENT_SOURCE_T::COMPONENT_CLASS );
475 setPlacementSource( PLACEMENT_SOURCE_T::GROUP_PLACEMENT );
constexpr EDA_IU_SCALE pcbIUScale
BASE_SET & set(size_t pos)
Information pertinent to a Pcbnew printed circuit board.
int GetCopperLayerCount() const
const FOOTPRINTS & Footprints() const
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
std::unordered_set< wxString > GetClassNames() const
Fetches a read-only map of the fundamental component classes.
Class DIALOG_RULE_AREA_PROPERTIES_BASE.
wxNotebook * m_areaPropertiesNb
wxChoice * m_OutlineDisplayCtrl
wxDataViewListCtrl * m_layers
void OnLayerSelection(wxDataViewEvent &event) override
wxString m_notFoundPlacementSourceName
PCB_BASE_FRAME * m_parent
wxStaticText * m_gapUnits
ZONE_SETTINGS m_zonesettings
the working copy of zone settings
bool m_notFoundPlacementSource
UNIT_BINDER m_outlineHatchPitch
bool TransferDataFromWindow() override
void OnSheetNameClicked(wxCommandEvent &event)
PANEL_RULE_AREA_PROPERTIES_KEEPOUT_BASE * m_keepoutProperties
ZONE_SETTINGS * m_ptr
the pointer to the zone settings of the zone to edit
~DIALOG_RULE_AREA_PROPERTIES()
wxRadioButton * m_rbCenterline
wxStaticText * m_gapLabel
PLACEMENT_SOURCE_T m_originalPlacementSourceType
PANEL_RULE_AREA_PROPERTIES_PLACEMENT_BASE * m_placementProperties
wxCheckBox * m_cbDeleteOriginals
void OnGroupClicked(wxCommandEvent &event)
bool TransferDataToWindow() override
DIALOG_RULE_AREA_PROPERTIES(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings, CONVERT_SETTINGS *aConvertSettings, BOARD *aBoard)
void OnComponentClassClicked(wxCommandEvent &event)
PLACEMENT_SOURCE_T m_lastPlacementSourceType
wxRadioButton * m_rbBoundingHull
CONVERT_SETTINGS * m_convertSettings
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
bool IsType(FRAME_T aType) const
LSET is a set of PCB_LAYER_IDs.
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Class PANEL_RULE_AREA_PROPERTIES_KEEPOUT_BASE.
wxCheckBox * m_cbTracksCtrl
wxCheckBox * m_cbFootprintsCtrl
wxCheckBox * m_cbViasCtrl
wxCheckBox * m_cbCopperPourCtrl
wxCheckBox * m_cbPadsCtrl
Class PANEL_RULE_AREA_PROPERTIES_PLACEMENT_BASE.
wxComboBox * m_componentClassCombo
wxRadioButton * m_SheetRb
wxRadioButton * m_GroupRb
wxRadioButton * m_DisabledRb
wxRadioButton * m_ComponentsRb
wxComboBox * m_sheetCombo
wxComboBox * m_groupCombo
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
ZONE_SETTINGS handles zones parameters.
void SetIsRuleArea(bool aEnable)
bool GetDoNotAllowTracks() const
wxString GetPlacementAreaSource() const
void SetDoNotAllowVias(bool aEnable)
bool GetDoNotAllowFootprints() const
bool GetDoNotAllowPads() const
PLACEMENT_SOURCE_T GetPlacementAreaSourceType() const
bool GetDoNotAllowZoneFills() const
void SetDoNotAllowTracks(bool aEnable)
bool GetDoNotAllowVias() const
void SetPlacementAreaSource(const wxString &aSource)
void SetPlacementAreaEnabled(bool aEnabled)
void SetupLayersList(wxDataViewListCtrl *aList, PCB_BASE_FRAME *aFrame, LSET aLayers, bool aFpEditorMode)
A helper routine for the various zone dialogs (copper, non-copper, keepout).
bool GetPlacementAreaEnabled() const
Accessors to parameters used in Rule Area zones:
bool HasKeepoutParametersSet() const
Accessor to determine if any keepout parameters are set.
void SetDoNotAllowFootprints(bool aEnable)
void SetDoNotAllowPads(bool aEnable)
void SetDoNotAllowZoneFills(bool aEnable)
ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle
Option to show the zone area (outlines only, short hatches or full hatches.
void SetPlacementAreaSourceType(PLACEMENT_SOURCE_T aType)
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
#define LAYER_LIST_ROW_ALL_INNER_LAYERS
#define LAYER_LIST_COLUMN_NAME
#define LAYER_LIST_COLUMN_CHECK
int InvokeRuleAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aZoneSettings, BOARD *aBoard, CONVERT_SETTINGS *aConvertSettings)
Function InvokeRuleAreaEditor invokes up a modal dialog window for copper zone editing.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
CONVERT_STRATEGY m_Strategy
constexpr int mmToIU(double mm) const
Class ZONE_SETTINGS used to handle zones parameters in dialogs.
#define ZONE_BORDER_HATCH_MINDIST_MM
#define ZONE_BORDER_HATCH_MAXDIST_MM