KiCad PCB EDA Suite
DIALOG_PAD_PROPERTIES Class Reference

#include <dialog_pad_properties.h>

Inheritance diagram for DIALOG_PAD_PROPERTIES:
DIALOG_PAD_PROPERTIES_BASE DIALOG_SHIM KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

 DIALOG_PAD_PROPERTIES (PCB_BASE_FRAME *aParent, PAD *aPad)
 
 ~DIALOG_PAD_PROPERTIES ()
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal () const
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
void OnModify ()
 
void SetPosition (const wxPoint &aNewPosition)
 Force the position of the dialog to a new position. More...
 
EDA_UNITS GetUserUnits () const
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 

Static Public Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 

Protected Types

enum  { wxID_DIALOG_EDIT_PAD = 1000, wxID_PADNUMCTRL }
 

Protected Member Functions

void finishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void setSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int horizPixelsFromDU (int x) const
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int vertPixelsFromDU (int y) const
 Convert an integer number of dialog units to pixels, vertically. More...
 
void resetSize ()
 Clear the existing dialog size and position. More...
 
virtual void OnCharHook (wxKeyEvent &aEvt)
 

Protected Attributes

wxBoxSizer * m_MainSizer
 
wxNotebook * m_notebook
 
wxPanel * m_panelGeneral
 
wxBoxSizer * m_LeftBoxSizer
 
wxStaticText * m_padTypeLabel
 
wxChoice * m_padType
 
wxStaticText * m_padNumLabel
 
wxTextCtrl * m_padNumCtrl
 
wxStaticText * m_padNetLabel
 
NET_SELECTORm_padNetSelector
 
wxStaticText * m_posXLabel
 
wxTextCtrl * m_posXCtrl
 
wxStaticText * m_posXUnits
 
wxStaticText * m_posYLabel
 
wxTextCtrl * m_posYCtrl
 
wxStaticText * m_posYUnits
 
wxCheckBox * m_locked
 
wxStaticLine * m_staticline5
 
wxStaticText * m_shapeLabel
 
wxChoice * m_PadShapeSelector
 
wxSimplebook * m_shapePropsBook
 
wxPanel * m_emptyProps
 
wxPanel * m_trapProps
 
wxFlexGridSizer * fgSizerTrapProps
 
wxStaticText * m_trapDeltaLabel
 
wxTextCtrl * m_trapDeltaCtrl
 
wxStaticText * m_trapDeltaUnits
 
wxStaticText * m_trapAxisLabel
 
wxChoice * m_trapAxisCtrl
 
wxPanel * m_roudingProps
 
wxFlexGridSizer * fgSizerRoundingProps
 
wxStaticText * m_cornerRatioLabel
 
TEXT_CTRL_EVALm_cornerRatioCtrl
 
wxStaticText * m_cornerRatioUnits
 
wxStaticText * m_cornerRadiusLabel
 
wxTextCtrl * m_cornerRadiusCtrl
 
wxStaticText * m_cornerRadiusUnits
 
wxPanel * m_chamferProps
 
wxStaticText * m_chamferRatioLabel
 
TEXT_CTRL_EVALm_chamferRatioCtrl
 
wxStaticText * m_chamferRatioUnits
 
wxStaticText * m_staticTextChamferCorner
 
wxCheckBox * m_cbTopLeft
 
wxCheckBox * m_cbTopRight
 
wxCheckBox * m_cbBottomLeft
 
wxCheckBox * m_cbBottomRight
 
wxPanel * m_mixedProps
 
wxStaticText * m_mixedChamferRatioLabel
 
TEXT_CTRL_EVALm_mixedChamferRatioCtrl
 
wxStaticText * m_mixedChamferRatioUnits
 
wxStaticText * m_staticTextChamferCorner1
 
wxCheckBox * m_cbTopLeft1
 
wxCheckBox * m_cbTopRight1
 
wxCheckBox * m_cbBottomLeft1
 
wxCheckBox * m_cbBottomRight1
 
wxStaticText * m_mixedCornerRatioLabel
 
TEXT_CTRL_EVALm_mixedCornerRatioCtrl
 
wxStaticText * m_mixedCornerRatioUnits
 
wxStaticText * m_sizeXLabel
 
wxTextCtrl * m_sizeXCtrl
 
wxStaticText * m_sizeXUnits
 
wxStaticText * m_sizeYLabel
 
wxTextCtrl * m_sizeYCtrl
 
wxStaticText * m_sizeYUnits
 
wxStaticText * m_PadOrientText
 
wxComboBox * m_cb_padrotation
 
wxStaticText * m_orientationUnits
 
wxStaticLine * m_staticline6
 
wxStaticText * m_holeShapeLabel
 
wxChoice * m_holeShapeCtrl
 
wxStaticText * m_holeXLabel
 
wxTextCtrl * m_holeXCtrl
 
wxStaticText * m_holeXUnits
 
wxStaticText * m_holeYLabel
 
wxTextCtrl * m_holeYCtrl
 
wxStaticText * m_holeYUnits
 
wxStaticLine * m_staticline7
 
wxCheckBox * m_offsetShapeOpt
 
wxStaticText * m_offsetShapeOptLabel
 
wxFlexGridSizer * m_offsetCtrls
 
wxStaticText * m_offsetXLabel
 
wxTextCtrl * m_offsetXCtrl
 
wxStaticText * m_offsetXUnits
 
wxStaticText * m_offsetYLabel
 
wxTextCtrl * m_offsetYCtrl
 
wxStaticText * m_offsetYUnits
 
wxCheckBox * m_padToDieOpt
 
wxStaticText * m_padToDieLabel
 
wxTextCtrl * m_padToDieCtrl
 
wxStaticText * m_padToDieUnits
 
wxBoxSizer * m_middleBoxSizer
 
wxBoxSizer * m_FlippedWarningSizer
 
wxStaticBitmap * m_FlippedWarningIcon
 
wxStaticText * m_staticText86
 
wxStaticText * m_copperLayersLabel
 
wxChoice * m_rbCopperLayersSel
 
wxStaticText * m_techLayersLabel
 
wxCheckBox * m_PadLayerAdhCmp
 
wxCheckBox * m_PadLayerAdhCu
 
wxCheckBox * m_PadLayerPateCmp
 
wxCheckBox * m_PadLayerPateCu
 
wxCheckBox * m_PadLayerSilkCmp
 
wxCheckBox * m_PadLayerSilkCu
 
wxCheckBox * m_PadLayerMaskCmp
 
wxCheckBox * m_PadLayerMaskCu
 
wxCheckBox * m_PadLayerDraft
 
wxCheckBox * m_PadLayerECO1
 
wxCheckBox * m_PadLayerECO2
 
wxStaticText * m_staticTextFabProperty
 
wxChoice * m_choiceFabProperty
 
wxPanel * m_localSettingsPanel
 
wxStaticText * m_staticTextInfoPosValue
 
wxStaticText * m_staticTextInfoNegVal
 
wxStaticText * m_clearanceLabel
 
wxTextCtrl * m_clearanceCtrl
 
wxStaticText * m_clearanceUnits
 
wxStaticText * m_maskMarginLabel
 
wxTextCtrl * m_maskMarginCtrl
 
wxStaticText * m_maskMarginUnits
 
wxStaticText * m_pasteMarginLabel
 
wxTextCtrl * m_pasteMarginCtrl
 
wxStaticText * m_pasteMarginUnits
 
wxStaticText * m_pasteMarginRatioLabel
 
TEXT_CTRL_EVALm_pasteMarginRatioCtrl
 
wxStaticText * m_pasteMarginRatioUnits
 
wxSimplebook * m_nonCopperWarningBook
 
wxStaticText * m_nonCopperNote
 
wxStaticText * m_staticTextInfoPaste
 
wxStaticBitmap * m_nonCopperWarningIcon
 
wxStaticText * m_nonCopperWarningText
 
wxStaticBoxSizer * m_sbSizerZonesSettings
 
wxStaticText * m_staticText40
 
wxChoice * m_ZoneConnectionChoice
 
wxStaticText * m_spokeWidthLabel
 
wxTextCtrl * m_spokeWidthCtrl
 
wxStaticText * m_spokeWidthUnits
 
wxStaticText * m_thermalGapLabel
 
wxTextCtrl * m_thermalGapCtrl
 
wxStaticText * m_thermalGapUnits
 
wxStaticText * m_staticTextcps
 
wxChoice * m_ZoneCustomPadShape
 
wxPanel * m_panelCustomShapePrimitives
 
wxBoxSizer * m_bSizerPanelPrimitives
 
wxStaticText * m_staticTextPrimitivesList
 
wxStaticText * m_staticTextPrimitiveListWarning
 
wxListView * m_listCtrlPrimitives
 
wxButton * m_buttonAddShape
 
wxButton * m_buttonEditShape
 
wxButton * m_buttonDup
 
wxButton * m_buttonGeometry
 
wxButton * m_buttonDel
 
wxSimplebook * m_stackupImagesBook
 
wxPanel * page0
 
wxStaticBitmap * m_stackupImage0
 
wxPanel * page1
 
wxStaticBitmap * m_stackupImage1
 
wxPanel * page2
 
wxStaticBitmap * m_stackupImage2
 
wxPanel * page3
 
wxPanel * page4
 
wxStaticBitmap * m_stackupImage4
 
wxPanel * page5
 
wxStaticBitmap * m_stackupImage5
 
wxPanel * page6
 
wxStaticBitmap * m_stackupImage6
 
wxPanel * page7
 
wxStaticBitmap * m_stackupImage7
 
wxPanel * m_boardViewPanel
 
wxBoxSizer * m_padPreviewSizer
 
wxStaticText * m_parentInfo
 
wxCheckBox * m_cbShowPadOutline
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
EDA_UNITS m_units
 
std::string m_hash_key
 
bool m_useCalculatedSize
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 
EDA_BASE_FRAMEm_parentFrame
 
std::vector< wxWindow * > m_tabOrder
 
wxSize m_initialSize
 

Private Member Functions

void prepareCanvas ()
 
void initValues ()
 
void displayPrimitivesList ()
 
bool padValuesOK ()
 test if all values are acceptable for the pad More...
 
void redraw ()
 
void editPrimitive ()
 
void updateRoundRectCornerValues ()
 
void enablePrimitivePage (bool aEnable)
 enable (or disable) the primitive page editor More...
 
void updatePadLayersList (LSET layer_mask, bool remove_unconnected, bool keep_top_bottom)
 Updates the CheckBox states in pad layers list, based on the layer_mask (if non-empty) or the default layers for the current pad type. More...
 
bool transferDataToPad (PAD *aPad)
 Copy values from dialog field to aPad's members. More...
 
bool Show (bool aShow) override
 
void OnInitDialog (wxInitDialogEvent &event) override
 
void OnResize (wxSizeEvent &event)
 
void OnCancel (wxCommandEvent &event) override
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
void OnUpdateUINonCopperWarning (wxUpdateUIEvent &event) override
 
void OnPadShapeSelection (wxCommandEvent &event) override
 
void OnDrillShapeSelected (wxCommandEvent &event) override
 
void onChangePadMode (wxCommandEvent &event) override
 
void OnOffsetCheckbox (wxCommandEvent &event) override
 
void OnPadToDieCheckbox (wxCommandEvent &event) override
 
void PadOrientEvent (wxCommandEvent &event) override
 
void PadTypeSelected (wxCommandEvent &event) override
 
void UpdateLayersDropdown ()
 
void OnSetCopperLayers (wxCommandEvent &event) override
 
void OnSetLayers (wxCommandEvent &event) override
 
void onCornerSizePercentChange (wxCommandEvent &event) override
 
void onCornerRadiusChange (wxCommandEvent &event) override
 
void OnValuesChanged (wxCommandEvent &event) override
 Called when a dimension has changed. More...
 
bool TransferDataFromWindow () override
 Updates the different parameters for the component being edited. More...
 
bool TransferDataToWindow () override
 
void onDeletePrimitive (wxCommandEvent &event) override
 Event handlers of basic shapes list panel. More...
 
void onEditPrimitive (wxCommandEvent &event) override
 
void onAddPrimitive (wxCommandEvent &event) override
 
void onGeometryTransform (wxCommandEvent &event) override
 
void onDuplicatePrimitive (wxCommandEvent &event) override
 
void onPrimitiveDClick (wxMouseEvent &event) override
 Called on a double click on the basic shapes list. More...
 
void OnPrimitiveSelection (wxListEvent &event) override
 Called on selection/deselection of a basic shape. More...
 
PAD_PROP getSelectedProperty ()
 Return the pad property currently selected. More...
 

Private Attributes

PCB_BASE_FRAMEm_parent
 
PADm_currentPad
 
PADm_dummyPad
 
PADm_padMaster
 
BOARDm_board
 
bool m_isFlipped
 
bool m_canUpdate
 
bool m_canEditNetName
 
bool m_isFpEditor
 
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
 
COLOR4D m_selectedColor
 
std::vector< PCB_SHAPE * > m_highlight
 
PCB_DRAW_PANEL_GALm_padPreviewGAL
 
KIGFX::ORIGIN_VIEWITEMm_axisOrigin
 
UNIT_BINDER m_posX
 
UNIT_BINDER m_posY
 
UNIT_BINDER m_sizeX
 
UNIT_BINDER m_sizeY
 
UNIT_BINDER m_offsetX
 
UNIT_BINDER m_offsetY
 
UNIT_BINDER m_padToDie
 
UNIT_BINDER m_trapDelta
 
UNIT_BINDER m_cornerRadius
 
UNIT_BINDER m_cornerRatio
 
UNIT_BINDER m_chamferRatio
 
UNIT_BINDER m_mixedCornerRatio
 
UNIT_BINDER m_mixedChamferRatio
 
UNIT_BINDER m_holeX
 
UNIT_BINDER m_holeY
 
UNIT_BINDER m_clearance
 
UNIT_BINDER m_maskMargin
 
UNIT_BINDER m_pasteMargin
 
UNIT_BINDER m_pasteMarginRatio
 
UNIT_BINDER m_spokeWidth
 
UNIT_BINDER m_thermalGap
 
UNIT_BINDER m_pad_orientation
 

Static Private Attributes

static bool m_sketchPreview = false
 

Detailed Description

Definition at line 50 of file dialog_pad_properties.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 39 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_PAD_PROPERTIES()

DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES ( PCB_BASE_FRAME aParent,
PAD aPad 
)

Definition at line 113 of file dialog_pad_properties.cpp.

113  :
114  DIALOG_PAD_PROPERTIES_BASE( aParent ),
115  m_parent( aParent ),
116  m_canUpdate( false ),
142 {
143  SetName( PAD_PROPERTIES_DLG_NAME );
144  m_isFpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( aParent ) != nullptr;
145 
146  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
147  // from the footprint editor to set default pad setup
148 
150 
151  // Configure display origin transforms
154 
157 
158  m_cbShowPadOutline->SetValue( m_sketchPreview );
159 
162 
164  m_dummyPad = new PAD( (FOOTPRINT*) nullptr );
165 
166  if( aPad )
167  {
168  SetTitle( _( "Pad Properties" ) );
169 
170  *m_dummyPad = *aPad;
172  }
173  else
174  {
175  SetTitle( _( "Default Pad Properties for Add Pad Tool" ) );
176 
178  }
179 
180  if( m_isFpEditor )
181  {
182  m_padNetLabel->Show( false );
183  m_padNetSelector->Show( false );
184  }
185 
186  // Pad needs to have a parent for painting; use the parent board for its design settings
187  if( !m_dummyPad->GetParent() )
189 
196 
198 
201 
202  initValues();
203 
204  wxFont infoFont = KIUI::GetInfoFont( this );
205  m_copperLayersLabel->SetFont( infoFont );
206  m_techLayersLabel->SetFont( infoFont );
207  m_parentInfo->SetFont( infoFont );
208 
209  infoFont.SetStyle( wxFONTSTYLE_ITALIC );
210  m_nonCopperNote->SetFont( infoFont );
211  m_staticTextInfoPaste->SetFont( infoFont );
212  m_staticTextInfoNegVal->SetFont( infoFont );
213  m_staticTextInfoPosValue->SetFont( infoFont );
214  m_staticTextPrimitiveListWarning->SetFont( infoFont );
215 
216  // Do not allow locking items in the footprint editor
217  m_locked->Show( !m_isFpEditor );
218 
219  // Usually, TransferDataToWindow is called by OnInitDialog
220  // calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
222 
223  // Initialize canvas to be able to display the dummy pad:
224  prepareCanvas();
225 
227  m_sdbSizerOK->SetDefault();
228  m_canUpdate = true;
229 
230  m_padNetSelector->Connect( NET_SELECTED,
231  wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ),
232  nullptr, this );
233 
234  // Now all widgets have the size fixed, call FinishDialogSettings
236 
237  // Update widgets
238  wxUpdateUIEvent dummyUI;
239  OnUpdateUI( dummyUI );
240 
241  // Post a dummy size event to force the pad preview panel to update the
242  // view: actual size, best zoom ... after the frame is shown
243  PostSizeEvent();
244 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual void SetNegativeZero()
Definition: unit_binder.h:67
void SetBoard(BOARD *aBoard)
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:680
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:97
std::unique_ptr< PAD > m_Pad_Master
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
#define PAD_PROPERTIES_DLG_NAME
DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder.
#define _(s)
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
#define SELECTED
void SetNetInfo(NETINFO_LIST *aNetInfoList)
DIALOG_PAD_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_DIALOG_EDIT_PAD, const wxString &title=_("Pad Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
FOOTPRINT * GetParent() const
Definition: pad.cpp:1415
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
Definition: unit_binder.cpp:92
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:177
BOARD * GetBoard() const
void OnUpdateUI(wxUpdateUIEvent &event) override
#define BRIGHTENED
item is drawn with a bright contour

References _, ORIGIN_TRANSFORMS::ABS_X_COORD, ORIGIN_TRANSFORMS::ABS_Y_COORD, BRIGHTENED, EDA_ITEM::ClearFlags(), DEGREES, dialog_warning, DIALOG_SHIM::finishDialogSettings(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), KIUI::GetInfoFont(), BOARD::GetNetInfo(), PAD::GetParent(), initValues(), KiBitmap(), m_board, m_canUpdate, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_chamferRatio, DIALOG_PAD_PROPERTIES_BASE::m_copperLayersLabel, m_cornerRatio, m_currentPad, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningIcon, m_isFpEditor, DIALOG_PAD_PROPERTIES_BASE::m_locked, m_mixedChamferRatio, m_mixedCornerRatio, DIALOG_PAD_PROPERTIES_BASE::m_nonCopperNote, DIALOG_PAD_PROPERTIES_BASE::m_nonCopperWarningIcon, BOARD_DESIGN_SETTINGS::m_Pad_Master, m_pad_orientation, m_padMaster, DIALOG_PAD_PROPERTIES_BASE::m_padNetLabel, DIALOG_PAD_PROPERTIES_BASE::m_padNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_padNumCtrl, m_parent, DIALOG_PAD_PROPERTIES_BASE::m_parentInfo, m_pasteMargin, m_pasteMarginRatio, m_posX, m_posY, DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerOK, m_sketchPreview, DIALOG_PAD_PROPERTIES_BASE::m_staticTextInfoNegVal, DIALOG_PAD_PROPERTIES_BASE::m_staticTextInfoPaste, DIALOG_PAD_PROPERTIES_BASE::m_staticTextInfoPosValue, DIALOG_PAD_PROPERTIES_BASE::m_staticTextPrimitiveListWarning, DIALOG_PAD_PROPERTIES_BASE::m_techLayersLabel, OnUpdateUI(), OnValuesChanged(), PAD, PAD_PROPERTIES_DLG_NAME, PERCENT, prepareCanvas(), SELECTED, NET_SELECTOR::SetBoard(), UNIT_BINDER::SetCoordType(), DIALOG_SHIM::SetInitialFocus(), UNIT_BINDER::SetNegativeZero(), NET_SELECTOR::SetNetInfo(), EDA_ITEM::SetParent(), UNIT_BINDER::SetPrecision(), UNIT_BINDER::SetUnits(), and TransferDataToWindow().

◆ ~DIALOG_PAD_PROPERTIES()

DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES ( )

Definition at line 247 of file dialog_pad_properties.cpp.

248 {
249  m_padNetSelector->Disconnect( NET_SELECTED,
250  wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ),
251  nullptr, this );
252 
253  delete m_dummyPad;
254  delete m_axisOrigin;
255 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin

References m_axisOrigin, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_padNetSelector, and OnValuesChanged().

Member Function Documentation

◆ displayPrimitivesList()

void DIALOG_PAD_PROPERTIES::displayPrimitivesList ( )
private

Definition at line 678 of file dialog_pad_properties.cpp.

679 {
680  m_listCtrlPrimitives->ClearAll();
681 
682  wxListItem itemCol;
683  itemCol.SetImage(-1);
684 
685  for( int ii = 0; ii < 5; ++ii )
686  m_listCtrlPrimitives->InsertColumn(ii, itemCol);
687 
688  wxString bs_info[5];
689 
690  for( unsigned ii = 0; ii < m_primitives.size(); ++ii )
691  {
692  const std::shared_ptr<PCB_SHAPE>& primitive = m_primitives[ii];
693 
694  for( wxString& s : bs_info )
695  s.Empty();
696 
697  bs_info[4] = _( "width" ) + wxS( " " )+ MessageTextFromValue( m_units,
698  primitive->GetWidth() );
699 
700  switch( primitive->GetShape() )
701  {
702  case SHAPE_T::SEGMENT:
703  bs_info[0] = _( "Segment" );
704  bs_info[1] = _( "from" ) + wxS( " " )+ formatCoord( m_units, primitive->GetStart() );
705  bs_info[2] = _( "to" ) + wxS( " " )+ formatCoord( m_units, primitive->GetEnd() );
706  break;
707 
708  case SHAPE_T::BEZIER:
709  bs_info[0] = _( "Bezier" );
710  bs_info[1] = _( "from" ) + wxS( " " )+ formatCoord( m_units, primitive->GetStart() );
711  bs_info[2] = _( "to" ) + wxS( " " )+ formatCoord( m_units, primitive->GetEnd() );
712  break;
713 
714  case SHAPE_T::ARC:
715  bs_info[0] = _( "Arc" );
716  bs_info[1] = _( "center" ) + wxS( " " )+ formatCoord( m_units, primitive->GetCenter() );
717  bs_info[2] = _( "start" ) + wxS( " " )+ formatCoord( m_units, primitive->GetStart() );
718  bs_info[3] = _( "angle" ) + wxS( " " )+ FormatAngle( primitive->GetArcAngle() );
719  break;
720 
721  case SHAPE_T::CIRCLE:
722  if( primitive->GetWidth() )
723  bs_info[0] = _( "ring" );
724  else
725  bs_info[0] = _( "circle" );
726 
727  bs_info[1] = formatCoord( m_units, primitive->GetStart() );
728  bs_info[2] = _( "radius" ) + wxS( " " )+ MessageTextFromValue( m_units,
729  primitive->GetRadius() );
730  break;
731 
732  case SHAPE_T::POLY:
733  bs_info[0] = "Polygon";
734  bs_info[1] = wxString::Format( _( "corners count %d" ),
735  (int) primitive->GetPolyShape().Outline( 0 ).PointCount() );
736  break;
737 
738  default:
739  bs_info[0] = "Unknown primitive";
740  break;
741  }
742 
743  long tmp = m_listCtrlPrimitives->InsertItem( ii, bs_info[0] );
744  m_listCtrlPrimitives->SetItemData( tmp, ii );
745 
746  for( int jj = 0, col = 0; jj < 5; ++jj )
747  m_listCtrlPrimitives->SetItem( tmp, col++, bs_info[jj] );
748  }
749 
750  // Now columns are filled, ensure correct width of columns
751  for( unsigned ii = 0; ii < 5; ++ii )
752  m_listCtrlPrimitives->SetColumnWidth( ii, wxLIST_AUTOSIZE );
753 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
static wxString formatCoord(EDA_UNITS aUnits, wxPoint aCoord)
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
std::string FormatAngle(double aAngle)
Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.
Definition: base_units.cpp:520
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
EDA_UNITS m_units
Definition: dialog_shim.h:200

References _, ARC, BEZIER, CIRCLE, Format(), FormatAngle(), formatCoord(), DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_primitives, DIALOG_SHIM::m_units, MessageTextFromValue(), POLY, and SEGMENT.

Referenced by editPrimitive(), initValues(), onAddPrimitive(), onDeletePrimitive(), onDuplicatePrimitive(), and onGeometryTransform().

◆ editPrimitive()

void DIALOG_PAD_PROPERTIES::editPrimitive ( )
private

Definition at line 2032 of file dialog_pad_properties.cpp.

2033 {
2034  long select = m_listCtrlPrimitives->GetFirstSelected();
2035 
2036  if( select < 0 )
2037  {
2038  wxMessageBox( _( "No shape selected" ) );
2039  return;
2040  }
2041 
2042  std::shared_ptr<PCB_SHAPE>& shape = m_primitives[select];
2043 
2044  if( shape->GetShape() == SHAPE_T::POLY )
2045  {
2046  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, shape.get() );
2047 
2048  if( dlg.ShowModal() != wxID_OK )
2049  return;
2050 
2051  dlg.TransferDataFromWindow();
2052  }
2053 
2054  else
2055  {
2056  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, shape.get() );
2057 
2058  if( dlg.ShowModal() != wxID_OK )
2059  return;
2060 
2061  dlg.TransferDataFromWindow();
2062  }
2063 
2065 
2066  if( m_canUpdate )
2067  {
2069  redraw();
2070  }
2071 }
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
bool TransferDataFromWindow() override
Transfer data out of the GUI.
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
#define _(s)
A dialog to edit basic polygonal shape parameters.
A dialog to edit basic shape parameters.
bool TransferDataFromWindow() override
Transfer data out of the GUI.

References _, displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_parent, m_primitives, POLY, redraw(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow(), and transferDataToPad().

Referenced by onEditPrimitive(), and onPrimitiveDClick().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 312 of file dialog_shim.cpp.

313 {
314  // so we can do logging of this state change:
315  return wxDialog::Enable( enable );
316 }

◆ enablePrimitivePage()

void DIALOG_PAD_PROPERTIES::enablePrimitivePage ( bool  aEnable)
private

enable (or disable) the primitive page editor

Definition at line 283 of file dialog_pad_properties.cpp.

284 {
285  // Enable or disable the widgets in page managing custom shape primitives
286  m_listCtrlPrimitives->Enable( aEnable );
287  m_buttonDel->Enable( aEnable );
288  m_buttonEditShape->Enable( aEnable );
289  m_buttonAddShape->Enable( aEnable );
290  m_buttonDup->Enable( aEnable );
291  m_buttonGeometry->Enable( aEnable );
292 }

References DIALOG_PAD_PROPERTIES_BASE::m_buttonAddShape, DIALOG_PAD_PROPERTIES_BASE::m_buttonDel, DIALOG_PAD_PROPERTIES_BASE::m_buttonDup, DIALOG_PAD_PROPERTIES_BASE::m_buttonEditShape, DIALOG_PAD_PROPERTIES_BASE::m_buttonGeometry, and DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives.

Referenced by initValues(), and OnPadShapeSelection().

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 480 of file dialog_shim.cpp.

481 {
482  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
483  // handle validation in the same way as other dialogs.
484  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
485  return;
486 
487  SetReturnCode( retCode );
488 
489  if( !IsQuasiModal() )
490  {
491  wxFAIL_MSG( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal"
492  "wasn't called" );
493  return;
494  }
495 
496  if( m_qmodal_loop )
497  {
498  if( m_qmodal_loop->IsRunning() )
499  m_qmodal_loop->Exit( 0 );
500  else
501  m_qmodal_loop->ScheduleExit( 0 );
502 
503  m_qmodal_loop = nullptr;
504  }
505 
507  m_qmodal_parent_disabler = nullptr;
508 
509  Show( false );
510 }
bool IsQuasiModal() const
Definition: dialog_shim.h:106
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:213
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:216

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, and DIALOG_SHIM::Show().

Referenced by NETLIST_DIALOG::OnAddGenerator(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_SYMBOLS_LIBID::onCancel(), DIALOG_LIB_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), NETLIST_DIALOG::OnDelGenerator(), DIALOG_SYMBOL_PROPERTIES::OnEditLibrarySymbol(), DIALOG_SYMBOL_PROPERTIES::OnEditSymbol(), DIALOG_SYMBOL_PROPERTIES::OnExchangeSymbol(), PCB_ONE_LAYER_SELECTOR::OnLeftGridCellClick(), PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick(), DIALOG_SYMBOL_PROPERTIES::OnUpdateSymbol(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_PUSH_PAD_PROPERTIES::PadPropertiesAccept(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ finishDialogSettings()

void DIALOG_SHIM::finishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

finishDialogSettings must be called from derived classes after all widgets have been initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at the end of TransferDataToWindow, or better yet, at end of a wxInitDialogEvent handler.

Definition at line 151 of file dialog_shim.cpp.

152 {
153  // must be called from the constructor of derived classes,
154  // when all widgets are initialized, and therefore their size fixed
155 
156  // SetSizeHints fixes the minimal size of sizers in the dialog
157  // (SetSizeHints calls Fit(), so no need to call it)
158  GetSizer()->SetSizeHints( this );
159 }

Referenced by DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_BUS_MANAGER::DIALOG_BUS_MANAGER(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EDIT_SYMBOLS_LIBID::DIALOG_EDIT_SYMBOLS_LIBID(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC::DIALOG_ERC(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_MANAGE_REPOSITORIES::DIALOG_MANAGE_REPOSITORIES(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), DIALOG_PCM::DIALOG_PCM(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_REGULATOR_FORM::DIALOG_REGULATOR_FORM(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SELECT_3DMODEL::DIALOG_SELECT_3DMODEL(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_AND_LABEL_PROPERTIES::DIALOG_TEXT_AND_LABEL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), PAGED_DIALOG::finishInitialization(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SHEET_PROPERTIES::OnInitDlg(), DIALOG_SYMBOL_PROPERTIES::OnInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_BOARD_STATISTICS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

◆ getSelectedProperty()

PAD_PROP DIALOG_PAD_PROPERTIES::getSelectedProperty ( )
private

Return the pad property currently selected.

Definition at line 1660 of file dialog_pad_properties.cpp.

1661 {
1662  PAD_PROP prop = PAD_PROP::NONE;
1663 
1664  switch( m_choiceFabProperty->GetSelection() )
1665  {
1666  case 0: prop = PAD_PROP::NONE; break;
1667  case 1: prop = PAD_PROP::BGA; break;
1668  case 2: prop = PAD_PROP::FIDUCIAL_LOCAL; break;
1669  case 3: prop = PAD_PROP::FIDUCIAL_GLBL; break;
1670  case 4: prop = PAD_PROP::TESTPOINT; break;
1671  case 5: prop = PAD_PROP::HEATSINK; break;
1672  case 6: prop = PAD_PROP::CASTELLATED; break;
1673  }
1674 
1675  return prop;
1676 }
a test point pad
a pad used as heat sink, usually in SMD footprints
Smd pad, used in BGA footprints.
a fiducial (usually a smd) local to the parent footprint
a fiducial (usually a smd) for the full board
PAD_PROP
Ghe set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition: pad_shapes.h:95
no special fabrication property
a pad with a castellated through hole

References BGA, CASTELLATED, FIDUCIAL_GLBL, FIDUCIAL_LOCAL, HEATSINK, DIALOG_PAD_PROPERTIES_BASE::m_choiceFabProperty, NONE, and TESTPOINT.

Referenced by TransferDataFromWindow(), and transferDataToPad().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( ) const
inlineinherited

Definition at line 46 of file kiway_holder.h.

46 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:76

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ horizPixelsFromDU()

int DIALOG_SHIM::horizPixelsFromDU ( int  x) const
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 169 of file dialog_shim.cpp.

170 {
171  wxSize sz( x, 0 );
172  return ConvertDialogToPixels( sz ).x;
173 }

Referenced by DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

◆ initValues()

void DIALOG_PAD_PROPERTIES::initValues ( )
private

Definition at line 459 of file dialog_pad_properties.cpp.

460 {
461  wxString msg;
462 
463  // Disable pad net name wxTextCtrl if the caller is the footprint editor
464  // because nets are living only in the board managed by the board editor
466 
467  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
468  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
470  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
472  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
473  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
474  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
475  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
476  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
478 
479  if( m_currentPad )
480  {
481  m_locked->SetValue( m_currentPad->IsLocked() );
483 
484  FOOTPRINT* footprint = m_currentPad->GetParent();
485 
486  if( footprint )
487  {
488  double angle = m_dummyPad->GetOrientation();
489  angle -= footprint->GetOrientation();
491 
492  // Display parent footprint info
493  msg.Printf( _("Footprint %s (%s), %s, rotated %g deg"),
494  footprint->Reference().GetShownText(),
495  footprint->Value().GetShownText(),
496  footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
497  footprint->GetOrientationDegrees() );
498  }
499 
500  m_parentInfo->SetLabel( msg );
501  }
502  else
503  {
504  m_locked->Hide();
505  m_isFlipped = false;
506  }
507 
508  if( m_isFlipped )
509  {
510  // flip pad (up/down) around its position
511  m_dummyPad->Flip( m_dummyPad->GetPosition(), false );
512  }
513 
515 
517 
518  if( m_currentPad )
519  {
520  m_padNumCtrl->SetValue( m_dummyPad->GetNumber() );
521  }
522  else
523  {
524  PAD_TOOL* padTool = m_parent->GetToolManager()->GetTool<PAD_TOOL>();
525  m_padNumCtrl->SetValue( padTool->GetLastPadNumber() );
526  }
527 
529 
530  // Display current pad parameters units:
533 
536 
539 
540  m_offsetShapeOpt->SetValue( m_dummyPad->GetOffset() != wxPoint() );
543 
544  if( m_dummyPad->GetDelta().x )
545  {
547  m_trapAxisCtrl->SetSelection( 0 );
548  }
549  else
550  {
552  m_trapAxisCtrl->SetSelection( 1 );
553  }
554 
555  m_padToDieOpt->SetValue( m_dummyPad->GetPadToDieLength() != 0 );
557 
565 
566  switch( m_dummyPad->GetZoneConnection() )
567  {
568  default:
569  case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
570  case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
571  case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
572  case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
573  }
574 
576  m_ZoneCustomPadShape->SetSelection( 1 );
577  else
578  m_ZoneCustomPadShape->SetSelection( 0 );
579 
580  switch( m_dummyPad->GetShape() )
581  {
582  default:
583  case PAD_SHAPE::CIRCLE: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
584  case PAD_SHAPE::OVAL: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_OVAL ); break;
585  case PAD_SHAPE::RECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_RECT ); break;
586  case PAD_SHAPE::TRAPEZOID: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_TRAPEZOID ); break;
587  case PAD_SHAPE::ROUNDRECT: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_ROUNDRECT ); break;
588 
590  if( m_dummyPad->GetRoundRectRadiusRatio() > 0.0 )
592  else
594  break;
595 
596  case PAD_SHAPE::CUSTOM:
599  else
601  break;
602  }
603 
612 
614 
616 
617  // Type of pad selection
618  bool aperture = m_dummyPad->GetAttribute() == PAD_ATTRIB::SMD && m_dummyPad->IsAperturePad();
619 
620  if( aperture )
621  {
622  m_padType->SetSelection( APERTURE_DLG_TYPE );
623  }
624  else
625  {
626  switch( m_dummyPad->GetAttribute() )
627  {
628  case PAD_ATTRIB::PTH: m_padType->SetSelection( PTH_DLG_TYPE ); break;
629  case PAD_ATTRIB::SMD: m_padType->SetSelection( SMD_DLG_TYPE ); break;
630  case PAD_ATTRIB::CONN: m_padType->SetSelection( CONN_DLG_TYPE ); break;
631  case PAD_ATTRIB::NPTH: m_padType->SetSelection( NPTH_DLG_TYPE ); break;
632  }
633  }
634 
635  switch( m_dummyPad->GetProperty() )
636  {
637  case PAD_PROP::NONE: m_choiceFabProperty->SetSelection( 0 ); break;
638  case PAD_PROP::BGA: m_choiceFabProperty->SetSelection( 1 ); break;
639  case PAD_PROP::FIDUCIAL_LOCAL: m_choiceFabProperty->SetSelection( 2 ); break;
640  case PAD_PROP::FIDUCIAL_GLBL: m_choiceFabProperty->SetSelection( 3 ); break;
641  case PAD_PROP::TESTPOINT: m_choiceFabProperty->SetSelection( 4 ); break;
642  case PAD_PROP::HEATSINK: m_choiceFabProperty->SetSelection( 5 ); break;
643  case PAD_PROP::CASTELLATED: m_choiceFabProperty->SetSelection( 6 ); break;
644  }
645 
646  // Ensure the pad property is compatible with the pad type
648  {
649  m_choiceFabProperty->SetSelection( 0 );
650  m_choiceFabProperty->Enable( false );
651  }
652 
654  m_holeShapeCtrl->SetSelection( 0 );
655  else
656  m_holeShapeCtrl->SetSelection( 1 );
657 
660 
661  // Update some dialog widgets state (Enable/disable options):
662  wxCommandEvent cmd_event;
663  OnPadShapeSelection( cmd_event );
664  OnOffsetCheckbox( cmd_event );
665 
666  // Update basic shapes list
668 }
int GetLocalSolderMaskMargin() const
Definition: pad.h:386
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
int GetLocalSolderPasteMargin() const
Definition: pad.h:393
double GetRoundRectRadiusRatio() const
Definition: pad.h:523
PAD_PROP GetProperty() const
Definition: pad.h:374
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
#define NPTH_DLG_TYPE
Like smd, does not appear on the solder paste layer (default)
Smd pad, appears on the solder paste layer (default)
virtual void ChangeDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
Tool relating to pads and pad settings.
Definition: pad_tool.h:35
bool IsLocked() const override
Definition: pad.cpp:149
double GetOrientation() const
Definition: footprint.h:191
bool IsAperturePad() const
Definition: pad.h:378
a test point pad
int GetThermalGap() const
Definition: pad.h:499
bool GetKeepTopBottom() const
Definition: pad.h:563
bool IsFlipped() const
Definition: pad.cpp:193
Plated through hole pad.
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:500
FP_TEXT & Reference()
Definition: footprint.h:501
a pad used as heat sink, usually in SMD footprints
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:476
const wxPoint & GetOffset() const
Definition: pad.h:250
#define CONN_DLG_TYPE
const wxSize & GetDrillSize() const
Definition: pad.h:243
like PAD_PTH, but not plated
pads are covered by copper
int GetThermalSpokeWidth() const
Definition: pad.h:491
void updatePadLayersList(LSET layer_mask, bool remove_unconnected, bool keep_top_bottom)
Updates the CheckBox states in pad layers list, based on the layer_mask (if non-empty) or the default...
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
Definition: pad.h:349
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pad.cpp:622
const wxSize & GetSize() const
Definition: pad.h:233
void SetSelectedNetcode(int aNetcode)
Smd pad, used in BGA footprints.
void OnPadShapeSelection(wxCommandEvent &event) override
wxString GetLastPadNumber() const
Definition: pad_tool.h:62
const wxString & GetNumber() const
Definition: pad.h:129
PAD_SHAPE GetShape() const
Definition: pad.h:170
a fiducial (usually a smd) local to the parent footprint
#define _(s)
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:368
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:718
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:396
const wxSize & GetDelta() const
Definition: pad.h:240
FOOTPRINT * GetParent() const
Definition: pad.cpp:1415
bool IsFlipped() const
Definition: footprint.h:278
Use thermal relief for pads.
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:188
bool IsType(FRAME_T aType) const
a fiducial (usually a smd) for the full board
wxPoint GetPosition() const override
Definition: pad.h:178
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354
no special fabrication property
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
#define APERTURE_DLG_TYPE
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
#define PTH_DLG_TYPE
void OnOffsetCheckbox(wxCommandEvent &event) override
Pads are not covered.
int GetChamferPositions() const
Definition: pad.h:542
a pad with a castellated through hole
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:416
int GetPadToDieLength() const
Definition: pad.h:384
bool GetRemoveUnconnected() const
Definition: pad.h:557
#define SMD_DLG_TYPE
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:301
PAD_SHAPE GetAnchorPadShape() const
Definition: pad.h:183
void SetOrientation(double aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:613
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...

References _, PNS::angle(), APERTURE_DLG_TYPE, B_Adhes, B_Mask, B_Paste, B_SilkS, BGA, CASTELLATED, CHAMFERED_RECT, UNIT_BINDER::ChangeDoubleValue(), UNIT_BINDER::ChangeValue(), CHOICE_SHAPE_CHAMFERED_RECT, CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT, CHOICE_SHAPE_CIRCLE, CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR, CHOICE_SHAPE_CUSTOM_RECT_ANCHOR, CHOICE_SHAPE_OVAL, CHOICE_SHAPE_RECT, CHOICE_SHAPE_ROUNDRECT, CHOICE_SHAPE_TRAPEZOID, CIRCLE, CONN, CONN_DLG_TYPE, CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL, CUSTOM, displayPrimitivesList(), Dwgs_User, Eco1_User, Eco2_User, enablePrimitivePage(), F_Adhes, F_Mask, F_Paste, F_SilkS, FIDUCIAL_GLBL, FIDUCIAL_LOCAL, PAD::Flip(), FRAME_PCB_EDITOR, FULL, PAD::GetAnchorPadShape(), PAD::GetAttribute(), PAD::GetChamferPositions(), PAD::GetCustomShapeInZoneOpt(), PAD::GetDelta(), PAD::GetDrillShape(), PAD::GetDrillSize(), PAD::GetKeepTopBottom(), PAD_TOOL::GetLastPadNumber(), BOARD::GetLayerName(), PAD::GetLayerSet(), PAD::GetLocalClearance(), PAD::GetLocalSolderMaskMargin(), PAD::GetLocalSolderPasteMargin(), PAD::GetLocalSolderPasteMarginRatio(), BOARD_CONNECTED_ITEM::GetNetCode(), PAD::GetNumber(), PAD::GetOffset(), FOOTPRINT::GetOrientation(), PAD::GetOrientation(), FOOTPRINT::GetOrientationDegrees(), PAD::GetPadToDieLength(), PAD::GetParent(), PAD::GetPosition(), PAD::GetPrimitives(), PAD::GetProperty(), PAD::GetRemoveUnconnected(), PAD::GetRoundRectRadiusRatio(), PAD::GetShape(), FP_TEXT::GetShownText(), PAD::GetSize(), PAD::GetThermalGap(), PAD::GetThermalSpokeWidth(), TOOL_MANAGER::GetTool(), TOOLS_HOLDER::GetToolManager(), PAD::GetZoneConnection(), HEATSINK, INHERITED, PAD::IsAperturePad(), PAD::IsFlipped(), FOOTPRINT::IsFlipped(), PAD::IsLocked(), EDA_BASE_FRAME::IsType(), m_board, m_canEditNetName, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomLeft1, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomRight, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomRight1, DIALOG_PAD_PROPERTIES_BASE::m_cbTopLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbTopLeft1, DIALOG_PAD_PROPERTIES_BASE::m_cbTopRight, DIALOG_PAD_PROPERTIES_BASE::m_cbTopRight1, DIALOG_PAD_PROPERTIES_BASE::m_choiceFabProperty, m_clearance, m_currentPad, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningSizer, DIALOG_PAD_PROPERTIES_BASE::m_holeShapeCtrl, m_holeX, m_holeY, m_isFlipped, DIALOG_PAD_PROPERTIES_BASE::m_locked, m_maskMargin, DIALOG_PAD_PROPERTIES_BASE::m_offsetShapeOpt, m_offsetX, m_offsetY, m_pad_orientation, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerDraft, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO1, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO2, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCu, DIALOG_PAD_PROPERTIES_BASE::m_padNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_padNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSelector, m_padToDie, DIALOG_PAD_PROPERTIES_BASE::m_padToDieOpt, DIALOG_PAD_PROPERTIES_BASE::m_padType, m_parent, DIALOG_PAD_PROPERTIES_BASE::m_parentInfo, m_pasteMargin, m_pasteMarginRatio, m_posX, m_posY, m_primitives, m_sizeX, m_sizeY, m_spokeWidth, m_thermalGap, DIALOG_PAD_PROPERTIES_BASE::m_trapAxisCtrl, m_trapDelta, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, NONE, NPTH, NPTH_DLG_TYPE, OnOffsetCheckbox(), OnPadShapeSelection(), OVAL, PAD_DRILL_SHAPE_OBLONG, PTH, PTH_DLG_TYPE, RECT, RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT, RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, FOOTPRINT::Reference(), ROUNDRECT, PAD::SetOrientation(), NET_SELECTOR::SetSelectedNetcode(), SMD, SMD_DLG_TYPE, TESTPOINT, THERMAL, TRAPEZOID, updatePadLayersList(), updateRoundRectCornerValues(), and FOOTPRINT::Value().

Referenced by DIALOG_PAD_PROPERTIES().

◆ IsCtrl()

static bool DIALOG_SHIM::IsCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 126 of file dialog_shim.h.

127  {
128  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
129  !e.ShiftDown() && !e.MetaDown();
130  }

◆ IsQuasiModal()

◆ IsShiftCtrl()

static bool DIALOG_SHIM::IsShiftCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 132 of file dialog_shim.h.

133  {
134  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
135  e.ShiftDown() && !e.MetaDown();
136  }

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Return a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 53 of file kiway_holder.h.

54  {
55  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
56  return *m_kiway;
57  }
KIWAY * m_kiway
Definition: kiway_holder.h:75

References KIWAY_HOLDER::m_kiway.

Referenced by PROJECT_TREE_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::AddLibraryFile(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AskToSaveChanges(), SYMBOL_EDIT_FRAME::CanCloseSymbolFromSchematic(), SCH_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_SYMBOL::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), BACK_ANNOTATE::FetchNetlistFromPCB(), KICAD_MANAGER_FRAME::ImportNonKiCadProject(), SCRIPTING_TOOL::Init(), EDA_DRAW_FRAME::IsScriptingConsoleVisible(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), SYMBOL_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_FIELD_PROPERTIES::OnTextValueSelectButtonClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), SCH_BASE_FRAME::PickSymbolFromLibBrowser(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), FOOTPRINT_WIZARD_FRAME::PythonPluginsReload(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SCH_EDITOR_CONTROL::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SYMBOL_EDIT_FRAME::Save(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), EDA_DRAW_FRAME::ScriptingConsoleEnableDisable(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SYMBOL_EDIT_FRAME::SetCurSymbol(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ onAddPrimitive()

void DIALOG_PAD_PROPERTIES::onAddPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2122 of file dialog_pad_properties.cpp.

2123 {
2124  // Ask user for shape type
2125  wxString shapelist[] = {
2126  _( "Segment" ),
2127  _( "Arc" ),
2128  _( "Bezier" ),
2129  _( "Ring/Circle" ),
2130  _( "Polygon" )
2131  };
2132 
2133  int type = wxGetSingleChoiceIndex( _( "Shape type:" ), _( "Add Primitive" ),
2134  arrayDim( shapelist ), shapelist, 0, this );
2135 
2136  // User pressed cancel
2137  if( type == -1 )
2138  return;
2139 
2141  SHAPE_T::POLY };
2142 
2143  PCB_SHAPE* primitive = new PCB_SHAPE();
2144  primitive->SetShape( listtype[type] );
2146  primitive->SetFilled( true );
2147 
2148  if( listtype[type] == SHAPE_T::POLY )
2149  {
2150  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, primitive );
2151 
2152  if( dlg.ShowModal() != wxID_OK )
2153  return;
2154  }
2155  else
2156  {
2157  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, primitive );
2158 
2159  if( dlg.ShowModal() != wxID_OK )
2160  return;
2161  }
2162 
2163  m_primitives.emplace_back( primitive );
2164 
2166 
2167  if( m_canUpdate )
2168  {
2170  redraw();
2171  }
2172 }
void SetFilled(bool aFlag)
Definition: eda_shape.h:83
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
SHAPE_T
Definition: eda_shape.h:40
#define _(s)
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
void SetWidth(int aWidth)
Definition: eda_shape.h:88
A dialog to edit basic polygonal shape parameters.
Definition: layer_ids.h:71
void SetShape(SHAPE_T aShape)
Definition: eda_shape.h:91
A dialog to edit basic shape parameters.

References _, ARC, arrayDim(), BEZIER, CIRCLE, displayPrimitivesList(), F_Cu, BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetLineThickness(), m_board, m_canUpdate, m_dummyPad, m_parent, m_primitives, POLY, redraw(), SEGMENT, EDA_SHAPE::SetFilled(), EDA_SHAPE::SetShape(), EDA_SHAPE::SetWidth(), and transferDataToPad().

◆ OnCancel()

void DIALOG_PAD_PROPERTIES::OnCancel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 272 of file dialog_pad_properties.cpp.

273 {
274  // Mandatory to avoid m_panelShowPadGal trying to draw something
275  // in a non valid context during closing process:
277 
278  // Now call default handler for wxID_CANCEL command event
279  event.Skip();
280 }
PCB_DRAW_PANEL_GAL * m_padPreviewGAL
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.

References m_padPreviewGAL, and EDA_DRAW_PANEL_GAL::StopDrawing().

◆ onChangePadMode()

void DIALOG_PAD_PROPERTIES::onChangePadMode ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 763 of file dialog_pad_properties.cpp.

764 {
765  m_sketchPreview = m_cbShowPadOutline->GetValue();
766 
768 
769  // fix the pad render mode (filled/not filled)
770  KIGFX::PCB_RENDER_SETTINGS* settings =
771  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
772 
777 
778  settings->SetHighContrast( false );
780 
781  redraw();
782 }
smd pads, front layer
Definition: layer_ids.h:198
void SetContrastModeDisplay(HIGH_CONTRAST_MODE aMode)
Switch the contrast mode setting (HIGH_CONTRAST_MODE:NORMAL, DIMMED or HIDDEN ) to control how the no...
Definition: pcb_painter.h:163
smd pads, back layer
Definition: layer_ids.h:199
void SetSketchModeGraphicItems(bool aEnabled)
Turn on/off sketch mode for graphic items (DRAWSEGMENTs, texts).
Definition: pcb_painter.h:128
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
PCB specific render settings.
Definition: pcb_painter.h:64
Inactive layers are shown normally (no high-contrast mode)
void SetHighContrast(bool aEnabled)
Turns on/off high contrast display mode.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
multilayer pads, usually with holes
Definition: layer_ids.h:209
void SetSketchMode(int aItemLayer, bool aEnabled)
Turn on/off sketch mode for given item layer.
Definition: pcb_painter.h:107
PCB_DRAW_PANEL_GAL * m_padPreviewGAL
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68

References KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_padPreviewGAL, m_sketchPreview, NORMAL, redraw(), KIGFX::PCB_RENDER_SETTINGS::SetContrastModeDisplay(), KIGFX::RENDER_SETTINGS::SetHighContrast(), KIGFX::PCB_RENDER_SETTINGS::SetSketchMode(), and KIGFX::PCB_RENDER_SETTINGS::SetSketchModeGraphicItems().

◆ OnCharHook()

void DIALOG_SHIM::OnCharHook ( wxKeyEvent &  aEvt)
protectedvirtualinherited

Reimplemented in DIALOG_CHOOSE_SYMBOL, HK_PROMPT_DIALOG, and HTML_MESSAGE_BOX.

Definition at line 570 of file dialog_shim.cpp.

571 {
572  if( aEvt.GetKeyCode() == 'U' && aEvt.GetModifiers() == wxMOD_CONTROL )
573  {
574  if( m_parentFrame )
575  {
577  return;
578  }
579  }
580  // shift-return (Mac default) or Ctrl-Return (GTK) for OK
581  else if( aEvt.GetKeyCode() == WXK_RETURN && ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
582  {
583  wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
584  return;
585  }
586  else if( aEvt.GetKeyCode() == WXK_TAB && !aEvt.ControlDown() )
587  {
588  wxWindow* currentWindow = wxWindow::FindFocus();
589  int currentIdx = -1;
590  int delta = aEvt.ShiftDown() ? -1 : 1;
591 
592  auto advance = [&]( int& idx )
593  {
594  // Wrap-around modulus
595  int size = m_tabOrder.size();
596  idx = ( ( idx + delta ) % size + size ) % size;
597  };
598 
599  for( size_t i = 0; i < m_tabOrder.size(); ++i )
600  {
601  if( m_tabOrder[i] == currentWindow )
602  {
603  currentIdx = (int) i;
604  break;
605  }
606  }
607 
608  if( currentIdx >= 0 )
609  {
610  advance( currentIdx );
611 
612  //todo: We don't currently have non-textentry dialog boxes but this will break if
613  // we add them.
614 #ifdef __APPLE__
615  while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr )
616  advance( currentIdx );
617 #endif
618 
619  m_tabOrder[ currentIdx ]->SetFocus();
620  return;
621  }
622  }
623 
624  aEvt.Skip();
625 }
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:220
EDA_BASE_FRAME * m_parentFrame
Definition: dialog_shim.h:218
virtual void ToggleUserUnits()
constexpr int delta

References delta, DIALOG_SHIM::m_parentFrame, DIALOG_SHIM::m_tabOrder, and EDA_BASE_FRAME::ToggleUserUnits().

Referenced by DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), and DIALOG_TEXT_PROPERTIES::~DIALOG_TEXT_PROPERTIES().

◆ onCornerRadiusChange()

void DIALOG_PAD_PROPERTIES::onCornerRadiusChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 363 of file dialog_pad_properties.cpp.

364 {
367  {
368  return;
369  }
370 
371  if( m_cornerRadius.GetValue() < 0 )
372  m_cornerRadiusCtrl->ChangeValue( "0" );
373 
376 
379 
380  redraw();
381 }
double GetRoundRectRadiusRatio() const
Definition: pad.h:523
virtual void ChangeDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
PAD_SHAPE GetShape() const
Definition: pad.h:170
void SetRoundRectCornerRadius(double aRadius)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:276
virtual long long int GetValue()
Return the current value in Internal Units.

References CHAMFERED_RECT, UNIT_BINDER::ChangeDoubleValue(), PAD::GetRoundRectRadiusRatio(), PAD::GetShape(), UNIT_BINDER::GetValue(), m_cornerRadius, DIALOG_PAD_PROPERTIES_BASE::m_cornerRadiusCtrl, m_cornerRatio, m_dummyPad, m_mixedCornerRatio, redraw(), ROUNDRECT, PAD::SetRoundRectCornerRadius(), and transferDataToPad().

◆ onCornerSizePercentChange()

void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 384 of file dialog_pad_properties.cpp.

385 {
388  {
389  return;
390  }
391 
392  wxObject* ctrl = event.GetEventObject();
393  wxString value = event.GetString();
394  bool changed = false;
395 
396  if( ctrl == m_cornerRatioCtrl || ctrl == m_mixedCornerRatioCtrl )
397  {
398  double ratioPercent;
399 
400  if( value.ToDouble( &ratioPercent ) )
401  {
402  // Clamp ratioPercent to acceptable value (0.0 to 50.0)
403  if( ratioPercent < 0.0 )
404  {
407  }
408  else if( ratioPercent > 50.0 )
409  {
412  }
413 
414  if( ctrl == m_cornerRatioCtrl )
415  m_mixedCornerRatioCtrl->ChangeValue( value );
416  else
417  m_cornerRatioCtrl->ChangeValue( value );
418 
419  changed = true;
420  }
421  }
422  else if( ctrl == m_chamferRatioCtrl || ctrl == m_mixedChamferRatioCtrl )
423  {
424  double ratioPercent;
425 
426  if( value.ToDouble( &ratioPercent ) )
427  {
428  // Clamp ratioPercent to acceptable value (0.0 to 50.0)
429  if( ratioPercent < 0.0 )
430  {
433  }
434  else if( ratioPercent > 50.0 )
435  {
438  }
439 
440  if( ctrl == m_chamferRatioCtrl )
441  m_mixedChamferRatioCtrl->ChangeValue( value );
442  else
443  m_chamferRatioCtrl->ChangeValue( value );
444 
445  changed = true;
446  }
447  }
448 
449  if( changed )
450  {
453  }
454 
455  redraw();
456 }
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
PAD_SHAPE GetShape() const
Definition: pad.h:170
int GetRoundRectCornerRadius() const
Definition: pad.cpp:270
virtual void SetDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...

References CHAMFERED_RECT, UNIT_BINDER::ChangeValue(), PAD::GetRoundRectCornerRadius(), PAD::GetShape(), m_chamferRatio, DIALOG_PAD_PROPERTIES_BASE::m_chamferRatioCtrl, m_cornerRadius, m_cornerRatio, DIALOG_PAD_PROPERTIES_BASE::m_cornerRatioCtrl, m_dummyPad, m_mixedChamferRatio, DIALOG_PAD_PROPERTIES_BASE::m_mixedChamferRatioCtrl, m_mixedCornerRatio, DIALOG_PAD_PROPERTIES_BASE::m_mixedCornerRatioCtrl, redraw(), ROUNDRECT, UNIT_BINDER::SetDoubleValue(), and transferDataToPad().

◆ onDeletePrimitive()

void DIALOG_PAD_PROPERTIES::onDeletePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Event handlers of basic shapes list panel.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2094 of file dialog_pad_properties.cpp.

2095 {
2096  long select = m_listCtrlPrimitives->GetFirstSelected();
2097 
2098  if( select < 0 )
2099  return;
2100 
2101  // Multiple selections are allowed. get them and remove corresponding shapes
2102  std::vector<long> indexes;
2103  indexes.push_back( select );
2104 
2105  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2106  indexes.push_back( select );
2107 
2108  // Erase all select shapes
2109  for( unsigned ii = indexes.size(); ii > 0; --ii )
2110  m_primitives.erase( m_primitives.begin() + indexes[ii-1] );
2111 
2113 
2114  if( m_canUpdate )
2115  {
2117  redraw();
2118  }
2119 }
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.

References displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_primitives, redraw(), and transferDataToPad().

◆ OnDrillShapeSelected()

void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 898 of file dialog_pad_properties.cpp.

899 {
901  redraw();
902 }
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.

References m_dummyPad, redraw(), and transferDataToPad().

◆ onDuplicatePrimitive()

void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2209 of file dialog_pad_properties.cpp.

2210 {
2211  long select = m_listCtrlPrimitives->GetFirstSelected();
2212 
2213  if( select < 0 )
2214  {
2215  wxMessageBox( _( "No shape selected" ) );
2216  return;
2217  }
2218 
2219  // Multiple selections are allowed. Build selected shapes list
2220  std::vector<std::shared_ptr<PCB_SHAPE>> shapeList;
2221  shapeList.emplace_back( m_primitives[select] );
2222 
2223  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2224  shapeList.emplace_back( m_primitives[select] );
2225 
2226  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, true );
2227 
2228  if( dlg.ShowModal() != wxID_OK )
2229  return;
2230 
2231  // Transfer new settings
2232  // save duplicates to a separate vector to avoid m_primitives reallocation,
2233  // as shapeList contains pointers to its elements
2234  std::vector<std::shared_ptr<PCB_SHAPE>> duplicates;
2235  dlg.Transform( &duplicates, dlg.GetDuplicateCount() );
2236  std::move( duplicates.begin(), duplicates.end(), std::back_inserter( m_primitives ) );
2237 
2239 
2240  if( m_canUpdate )
2241  {
2243  redraw();
2244  }
2245 }
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
#define _(s)
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin,...

References _, displayPrimitivesList(), DIALOG_PAD_PRIMITIVES_TRANSFORM::GetDuplicateCount(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_parent, m_primitives, redraw(), transferDataToPad(), and DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform().

◆ onEditPrimitive()

void DIALOG_PAD_PROPERTIES::onEditPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2088 of file dialog_pad_properties.cpp.

2089 {
2090  editPrimitive();
2091 }

References editPrimitive().

◆ onGeometryTransform()

void DIALOG_PAD_PROPERTIES::onGeometryTransform ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2175 of file dialog_pad_properties.cpp.

2176 {
2177  long select = m_listCtrlPrimitives->GetFirstSelected();
2178 
2179  if( select < 0 )
2180  {
2181  wxMessageBox( _( "No shape selected" ) );
2182  return;
2183  }
2184 
2185  // Multiple selections are allowed. Build selected shapes list
2186  std::vector<std::shared_ptr<PCB_SHAPE>> shapeList;
2187  shapeList.emplace_back( m_primitives[select] );
2188 
2189  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2190  shapeList.emplace_back( m_primitives[select] );
2191 
2192  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, false );
2193 
2194  if( dlg.ShowModal() != wxID_OK )
2195  return;
2196 
2197  dlg.Transform();
2198 
2200 
2201  if( m_canUpdate )
2202  {
2204  redraw();
2205  }
2206 }
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
#define _(s)
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin,...

References _, displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_parent, m_primitives, redraw(), transferDataToPad(), and DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform().

◆ OnInitDialog()

void DIALOG_PAD_PROPERTIES::OnInitDialog ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 262 of file dialog_pad_properties.cpp.

263 {
264  m_selectedColor = COLOR4D( 1.0, 1.0, 1.0, 0.7 );
265 
266  // Needed on some WM to be sure the pad is redrawn according to the final size
267  // of the canvas, with the right zoom factor
268  redraw();
269 }
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References m_selectedColor, and redraw().

◆ OnModify()

◆ OnOffsetCheckbox()

void DIALOG_PAD_PROPERTIES::OnOffsetCheckbox ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1991 of file dialog_pad_properties.cpp.

1992 {
1993  if( m_offsetShapeOpt->GetValue() )
1994  {
1997  }
1998 
1999  // Show/hide controls depending on m_offsetShapeOpt being enabled
2000  m_offsetCtrls->Show( m_offsetShapeOpt->GetValue() );
2001  m_offsetShapeOptLabel->Show( m_offsetShapeOpt->GetValue() );
2002 
2003  for( size_t i = 0; i < m_notebook->GetPageCount(); ++i )
2004  m_notebook->GetPage( i )->Layout();
2005 
2006  OnValuesChanged( event );
2007 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
const wxPoint & GetOffset() const
Definition: pad.h:250
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.

References PAD::GetOffset(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_notebook, DIALOG_PAD_PROPERTIES_BASE::m_offsetCtrls, DIALOG_PAD_PROPERTIES_BASE::m_offsetShapeOpt, DIALOG_PAD_PROPERTIES_BASE::m_offsetShapeOptLabel, m_offsetX, m_offsetY, OnValuesChanged(), and UNIT_BINDER::SetValue().

Referenced by initValues().

◆ OnPadShapeSelection()

void DIALOG_PAD_PROPERTIES::OnPadShapeSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 785 of file dialog_pad_properties.cpp.

786 {
787  switch( m_PadShapeSelector->GetSelection() )
788  {
789  case CHOICE_SHAPE_CIRCLE:
790  case CHOICE_SHAPE_OVAL:
791  case CHOICE_SHAPE_RECT:
792  m_shapePropsBook->SetSelection( 0 );
793  break;
794 
796  m_shapePropsBook->SetSelection( 1 );
797  break;
798 
800  {
801  m_shapePropsBook->SetSelection( 2 );
802 
803  // A reasonable default (from IPC-7351C)
804  if( m_dummyPad->GetRoundRectRadiusRatio() == 0.0 )
806 
807  break;
808  }
809 
811  m_shapePropsBook->SetSelection( 3 );
812 
813  // Reasonable default
814  if( m_dummyPad->GetChamferRectRatio() == 0.0 )
816 
817  // Ensure the displayed value is up to date:
819 
820  // A reasonable default is one corner chamfered (usual for some SMD pads).
821  if( !m_cbTopLeft->GetValue() && !m_cbTopRight->GetValue()
822  && !m_cbBottomLeft->GetValue() && !m_cbBottomRight->GetValue() )
823  {
824  m_cbTopLeft->SetValue( true );
825  m_cbTopRight->SetValue( false );
826  m_cbBottomLeft->SetValue( false );
827  m_cbBottomRight->SetValue( false );
828  }
829 
830  break;
831 
833  m_shapePropsBook->SetSelection( 4 );
834 
835  // Reasonable defaults (corner radius from IPC-7351C)
836  if( m_dummyPad->GetRoundRectRadiusRatio() == 0.0
837  && m_dummyPad->GetChamferRectRatio() == 0.0 )
838  {
839  if( m_dummyPad->GetRoundRectRadiusRatio() == 0.0 )
841 
842  if( m_dummyPad->GetChamferRectRatio() == 0.0 )
844  }
845 
846  // Ensure the displayed values are up to date:
849  break;
850 
851  case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE::CUSTOM, circular anchor
852  case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE::CUSTOM, rect anchor
853  m_shapePropsBook->SetSelection( 0 );
854  break;
855  }
856 
857  // Readjust props book size
858  wxSize size = m_shapePropsBook->GetSize();
859  size.y = m_shapePropsBook->GetPage( m_shapePropsBook->GetSelection() )->GetBestSize().y;
860  m_shapePropsBook->SetMaxSize( size );
861 
863  && m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR );
864 
865  m_offsetShapeOpt->Enable( m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CIRCLE
867  && m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CUSTOM_RECT_ANCHOR );
868 
869  if( !m_offsetShapeOpt->IsEnabled() )
870  m_offsetShapeOpt->SetValue( false );
871 
872  // Show/hide controls depending on m_offsetShapeOpt being enabled
873  m_offsetCtrls->Show( m_offsetShapeOpt->GetValue() );
874  m_offsetShapeOptLabel->Show( m_offsetShapeOpt->GetValue() );
875 
876  bool is_custom = m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
878 
879  enablePrimitivePage( is_custom );
880  m_staticTextcps->Enable( is_custom );
881  m_ZoneCustomPadShape->Enable( is_custom );
882 
884 
886 
887  for( size_t i = 0; i < m_notebook->GetPageCount(); ++i )
888  m_notebook->GetPage( i )->Layout();
889 
890  // Resize the dialog if its height is too small to show all widgets:
891  if( m_MainSizer->GetSize().y < m_MainSizer->GetMinSize().y )
892  m_MainSizer->SetSizeHints( this );
893 
894  redraw();
895 }
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
double GetRoundRectRadiusRatio() const
Definition: pad.h:523
virtual void ChangeDoubleValue(double aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
void SetRoundRectRadiusRatio(double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition: pad.cpp:285
double GetChamferRectRatio() const
Definition: pad.h:532
void SetChamferRectRatio(double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition: pad.cpp:293
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...

References UNIT_BINDER::ChangeDoubleValue(), UNIT_BINDER::ChangeValue(), CHOICE_SHAPE_CHAMFERED_RECT, CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT, CHOICE_SHAPE_CIRCLE, CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR, CHOICE_SHAPE_CUSTOM_RECT_ANCHOR, CHOICE_SHAPE_OVAL, CHOICE_SHAPE_RECT, CHOICE_SHAPE_ROUNDRECT, CHOICE_SHAPE_TRAPEZOID, UNIT_BINDER::Enable(), enablePrimitivePage(), PAD::GetChamferRectRatio(), PAD::GetRoundRectRadiusRatio(), DIALOG_PAD_PROPERTIES_BASE::m_cbBottomLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomRight, DIALOG_PAD_PROPERTIES_BASE::m_cbTopLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbTopRight, m_chamferRatio, m_cornerRatio, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_MainSizer, m_mixedChamferRatio, m_mixedCornerRatio, DIALOG_PAD_PROPERTIES_BASE::m_notebook, DIALOG_PAD_PROPERTIES_BASE::m_offsetCtrls, DIALOG_PAD_PROPERTIES_BASE::m_offsetShapeOpt, DIALOG_PAD_PROPERTIES_BASE::m_offsetShapeOptLabel, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSelector, DIALOG_PAD_PROPERTIES_BASE::m_shapePropsBook, m_sizeY, DIALOG_PAD_PROPERTIES_BASE::m_staticTextcps, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, redraw(), PAD::SetChamferRectRatio(), PAD::SetRoundRectRadiusRatio(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by initValues().

◆ OnPadToDieCheckbox()

void DIALOG_PAD_PROPERTIES::OnPadToDieCheckbox ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2010 of file dialog_pad_properties.cpp.

2011 {
2012  if( m_padToDieOpt->GetValue() && m_currentPad )
2014 
2015  OnValuesChanged( event );
2016 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
int GetPadToDieLength() const
Definition: pad.h:384

References PAD::GetPadToDieLength(), m_currentPad, m_padToDie, DIALOG_PAD_PROPERTIES_BASE::m_padToDieOpt, OnValuesChanged(), and UNIT_BINDER::SetValue().

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 380 of file dialog_shim.cpp.

381 {
382  if( m_firstPaintEvent )
383  {
385 
386  selectAllInTextCtrls( GetChildren() );
387 
390  else
391  KIPLATFORM::UI::ForceFocus( this ); // Focus the dialog itself
392 
393  m_firstPaintEvent = false;
394  }
395 
396  event.Skip();
397 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:211
bool m_firstPaintEvent
Definition: dialog_shim.h:210
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: gtk/ui.cpp:44
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:71
static void selectAllInTextCtrls(wxWindowList &children)

References KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision(), KIPLATFORM::UI::ForceFocus(), DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ onPrimitiveDClick()

void DIALOG_PAD_PROPERTIES::onPrimitiveDClick ( wxMouseEvent &  event)
overrideprivatevirtual

Called on a double click on the basic shapes list.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2082 of file dialog_pad_properties.cpp.

2083 {
2084  editPrimitive();
2085 }

References editPrimitive().

◆ OnPrimitiveSelection()

void DIALOG_PAD_PROPERTIES::OnPrimitiveSelection ( wxListEvent &  event)
overrideprivatevirtual

Called on selection/deselection of a basic shape.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2074 of file dialog_pad_properties.cpp.

2075 {
2076  // Called on a double click on the basic shapes list
2077  // To Do: highligth the primitive(s) currently selected.
2078  redraw();
2079 }

References redraw().

◆ OnResize()

void DIALOG_PAD_PROPERTIES::OnResize ( wxSizeEvent &  event)
private

Definition at line 756 of file dialog_pad_properties.cpp.

757 {
758  redraw();
759  event.Skip();
760 }

References redraw().

Referenced by prepareCanvas().

◆ OnSetCopperLayers()

void DIALOG_PAD_PROPERTIES::OnSetCopperLayers ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1203 of file dialog_pad_properties.cpp.

1204 {
1206  redraw();
1207 }
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.

References m_dummyPad, redraw(), and transferDataToPad().

◆ OnSetLayers()

void DIALOG_PAD_PROPERTIES::OnSetLayers ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1210 of file dialog_pad_properties.cpp.

1211 {
1213  redraw();
1214 }
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.

References m_dummyPad, redraw(), and transferDataToPad().

◆ OnUpdateUI()

void DIALOG_PAD_PROPERTIES::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1001 of file dialog_pad_properties.cpp.

1002 {
1003  // Enable/disable position
1004  m_posX.Enable( !m_locked->GetValue() || m_isFpEditor );
1005  m_posY.Enable( !m_locked->GetValue() || m_isFpEditor );
1006 
1007  bool hasHole = true;
1008  bool hasConnection = true;
1009 
1010  switch( m_padType->GetSelection() )
1011  {
1012  case PTH_DLG_TYPE: /* PTH */ hasHole = true; hasConnection = true; break;
1013  case SMD_DLG_TYPE: /* SMD */ hasHole = false; hasConnection = true; break;
1014  case CONN_DLG_TYPE: /* CONN */ hasHole = false; hasConnection = true; break;
1015  case NPTH_DLG_TYPE: /* NPTH */ hasHole = true; hasConnection = false; break;
1016  case APERTURE_DLG_TYPE: /* Aperture */ hasHole = false; hasConnection = false; break;
1017  }
1018 
1019  // Enable/disable hole controls
1020  m_holeShapeLabel->Enable( hasHole );
1021  m_holeShapeCtrl->Enable( hasHole );
1022  m_holeX.Enable( hasHole );
1023  m_holeY.Enable( hasHole && m_holeShapeCtrl->GetSelection() == 1 );
1024 
1025  // Enable/disable number and net
1026  m_padNumLabel->Enable( hasConnection );
1027  m_padNumCtrl->Enable( hasConnection );
1028 
1029  if( m_padNetLabel->IsShown() )
1030  {
1031  m_padNetLabel->Enable( hasConnection && m_canEditNetName && m_currentPad );
1032  m_padNetSelector->Enable( hasConnection && m_canEditNetName && m_currentPad );
1033  }
1034 
1035  // Enable/disable pad length-to-die
1036  m_padToDieOpt->Enable( hasConnection );
1037 
1038  if( !m_padToDieOpt->IsEnabled() )
1039  m_padToDieOpt->SetValue( false );
1040 
1041  // We can show/hide this here because it doesn't require the layout to be refreshed.
1042  // All the others have to be done in their event handlers because doing a layout here
1043  // causes infinite looping on MSW.
1044  m_padToDie.Show( m_padToDieOpt->GetValue() );
1045 
1046  // Enable/disable Copper Layers control
1047  m_rbCopperLayersSel->Enable( m_padType->GetSelection() != APERTURE_DLG_TYPE );
1048 
1049  LSET cu_set = m_dummyPad->GetLayerSet() & LSET::AllCuMask();
1050 
1051  switch( m_padType->GetSelection() )
1052  {
1053  case PTH_DLG_TYPE:
1054  if( !cu_set.any() )
1055  m_stackupImagesBook->SetSelection( 3 );
1056  else if( !m_dummyPad->GetRemoveUnconnected() )
1057  m_stackupImagesBook->SetSelection( 0 );
1058  else if( m_dummyPad->GetKeepTopBottom() )
1059  m_stackupImagesBook->SetSelection( 1 );
1060  else
1061  m_stackupImagesBook->SetSelection( 2 );
1062 
1063  break;
1064 
1065  case NPTH_DLG_TYPE:
1066  if( cu_set.test( F_Cu ) && cu_set.test( B_Cu ) )
1067  m_stackupImagesBook->SetSelection( 4 );
1068  else if( cu_set.test( F_Cu ) )
1069  m_stackupImagesBook->SetSelection( 5 );
1070  else if( cu_set.test( B_Cu ) )
1071  m_stackupImagesBook->SetSelection( 6 );
1072  else
1073  m_stackupImagesBook->SetSelection( 7 );
1074 
1075  break;
1076 
1077  case SMD_DLG_TYPE:
1078  case CONN_DLG_TYPE:
1079  case APERTURE_DLG_TYPE:
1080  m_stackupImagesBook->ChangeSelection( 3 );
1081  break;
1082  }
1083 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
#define NPTH_DLG_TYPE
bool GetKeepTopBottom() const
Definition: pad.h:563
#define CONN_DLG_TYPE
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:505
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:368
#define APERTURE_DLG_TYPE
Definition: layer_ids.h:71
#define PTH_DLG_TYPE
bool GetRemoveUnconnected() const
Definition: pad.h:557
#define SMD_DLG_TYPE
void Enable(bool aEnable)
Enable/disable the label, widget and units label.

References LSET::AllCuMask(), APERTURE_DLG_TYPE, B_Cu, CONN_DLG_TYPE, UNIT_BINDER::Enable(), F_Cu, PAD::GetKeepTopBottom(), PAD::GetLayerSet(), PAD::GetRemoveUnconnected(), m_canEditNetName, m_currentPad, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_holeShapeCtrl, DIALOG_PAD_PROPERTIES_BASE::m_holeShapeLabel, m_holeX, m_holeY, m_isFpEditor, DIALOG_PAD_PROPERTIES_BASE::m_locked, DIALOG_PAD_PROPERTIES_BASE::m_padNetLabel, DIALOG_PAD_PROPERTIES_BASE::m_padNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_padNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_padNumLabel, m_padToDie, DIALOG_PAD_PROPERTIES_BASE::m_padToDieOpt, DIALOG_PAD_PROPERTIES_BASE::m_padType, m_posX, m_posY, DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel, DIALOG_PAD_PROPERTIES_BASE::m_stackupImagesBook, NPTH_DLG_TYPE, PTH_DLG_TYPE, UNIT_BINDER::Show(), and SMD_DLG_TYPE.

Referenced by DIALOG_PAD_PROPERTIES().

◆ OnUpdateUINonCopperWarning()

void DIALOG_PAD_PROPERTIES::OnUpdateUINonCopperWarning ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1086 of file dialog_pad_properties.cpp.

1087 {
1088  bool isOnCopperLayer = ( m_dummyPad->GetLayerSet() & LSET::AllCuMask() ).any();
1089  m_nonCopperWarningBook->ChangeSelection( isOnCopperLayer ? 0 : 1 );
1090 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:368

References LSET::AllCuMask(), PAD::GetLayerSet(), m_dummyPad, and DIALOG_PAD_PROPERTIES_BASE::m_nonCopperWarningBook.

◆ OnValuesChanged()

void DIALOG_PAD_PROPERTIES::OnValuesChanged ( wxCommandEvent &  event)
overrideprivatevirtual

Called when a dimension has changed.

Update the graphical pad shown in the panel.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2019 of file dialog_pad_properties.cpp.

2020 {
2021  if( m_canUpdate )
2022  {
2024 
2025  // If the pad size has changed, update the displayed values for rounded rect pads.
2027 
2028  redraw();
2029  }
2030 }
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.

References m_canUpdate, m_dummyPad, redraw(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by DIALOG_PAD_PROPERTIES(), OnOffsetCheckbox(), OnPadToDieCheckbox(), and ~DIALOG_PAD_PROPERTIES().

◆ PadOrientEvent()

void DIALOG_PAD_PROPERTIES::PadOrientEvent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 905 of file dialog_pad_properties.cpp.

906 {
908  redraw();
909 }
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.

References m_dummyPad, redraw(), and transferDataToPad().

◆ PadTypeSelected()

void DIALOG_PAD_PROPERTIES::PadTypeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 949 of file dialog_pad_properties.cpp.

950 {
951  bool hasHole = true;
952  bool hasConnection = true;
953  bool hasProperty = true;
954 
955  switch( m_padType->GetSelection() )
956  {
957  case PTH_DLG_TYPE: hasHole = true; hasConnection = true; hasProperty = true; break;
958  case SMD_DLG_TYPE: hasHole = false; hasConnection = true; hasProperty = true; break;
959  case CONN_DLG_TYPE: hasHole = false; hasConnection = true; hasProperty = true; break;
960  case NPTH_DLG_TYPE: hasHole = true; hasConnection = false; hasProperty = false; break;
961  case APERTURE_DLG_TYPE: hasHole = false; hasConnection = false; hasProperty = true; break;
962  }
963 
964  // Update Layers dropdown list and selects the "best" layer set for the new pad type:
966 
967  if( !hasHole )
968  {
969  m_holeX.ChangeValue( 0 );
970  m_holeY.ChangeValue( 0 );
971  }
972  else if ( m_holeX.GetValue() == 0 && m_currentPad )
973  {
976  }
977 
978  if( !hasConnection )
979  {
980  m_padNumCtrl->ChangeValue( wxEmptyString );
982  m_padToDieOpt->SetValue( false );
983  }
984  else if( m_padNumCtrl->GetValue().IsEmpty() && m_currentPad )
985  {
986  m_padNumCtrl->ChangeValue( m_currentPad->GetNumber() );
988  }
989 
990  if( !hasProperty )
991  m_choiceFabProperty->SetSelection( 0 );
992 
993  m_choiceFabProperty->Enable( hasProperty );
994 
996 
997  redraw();
998 }
#define NPTH_DLG_TYPE
bool GetKeepTopBottom() const
Definition: pad.h:563
#define CONN_DLG_TYPE
const wxSize & GetDrillSize() const
Definition: pad.h:243
void updatePadLayersList(LSET layer_mask, bool remove_unconnected, bool keep_top_bottom)
Updates the CheckBox states in pad layers list, based on the layer_mask (if non-empty) or the default...
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
void SetSelectedNetcode(int aNetcode)
const wxString & GetNumber() const
Definition: pad.h:129
#define APERTURE_DLG_TYPE
#define PTH_DLG_TYPE
virtual long long int GetValue()
Return the current value in Internal Units.
bool GetRemoveUnconnected() const
Definition: pad.h:557
#define SMD_DLG_TYPE
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...

References APERTURE_DLG_TYPE, UNIT_BINDER::ChangeValue(), CONN_DLG_TYPE, PAD::GetDrillSize(), PAD::GetKeepTopBottom(), BOARD_CONNECTED_ITEM::GetNetCode(), PAD::GetNumber(), PAD::GetRemoveUnconnected(), UNIT_BINDER::GetValue(), DIALOG_PAD_PROPERTIES_BASE::m_choiceFabProperty, m_currentPad, m_dummyPad, m_holeX, m_holeY, DIALOG_PAD_PROPERTIES_BASE::m_padNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_padNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_padToDieOpt, DIALOG_PAD_PROPERTIES_BASE::m_padType, NPTH_DLG_TYPE, PTH_DLG_TYPE, redraw(), NET_SELECTOR::SetSelectedNetcode(), SMD_DLG_TYPE, transferDataToPad(), and updatePadLayersList().

◆ padValuesOK()

bool DIALOG_PAD_PROPERTIES::padValuesOK ( )
private

test if all values are acceptable for the pad

Definition at line 1217 of file dialog_pad_properties.cpp.

1218 {
1219  bool error = transferDataToPad( m_dummyPad );
1220 
1221  wxArrayString error_msgs;
1222  wxArrayString warning_msgs;
1223  wxString msg;
1224  wxSize pad_size = m_dummyPad->GetSize();
1225  wxSize drill_size = m_dummyPad->GetDrillSize();
1226 
1228  {
1229  // allow 0-sized anchor pads
1230  }
1231  else if( m_dummyPad->GetShape() == PAD_SHAPE::CIRCLE )
1232  {
1233  if( pad_size.x <= 0 )
1234  warning_msgs.Add( _( "Warning: Pad size is less than zero." ) );
1235  }
1236  else
1237  {
1238  if( pad_size.x <= 0 || pad_size.y <= 0 )
1239  warning_msgs.Add( _( "Warning: Pad size is less than zero." ) );
1240  }
1241 
1242  // Test hole size against pad size
1243  if( m_dummyPad->IsOnCopperLayer() )
1244  {
1246  PCB_LAYER_ID layer = lset.Seq().at( 0 );
1247  int maxError = m_board->GetDesignSettings().m_MaxError;
1248  SHAPE_POLY_SET padOutline;
1249 
1250  m_dummyPad->TransformShapeWithClearanceToPolygon( padOutline, layer, 0, maxError,
1252 
1253  const SHAPE_SEGMENT* drillShape = m_dummyPad->GetEffectiveHoleShape();
1254  const SEG drillSeg = drillShape->GetSeg();
1255  SHAPE_POLY_SET drillOutline;
1256 
1257  TransformOvalToPolygon( drillOutline, (wxPoint) drillSeg.A, (wxPoint) drillSeg.B,
1258  drillShape->GetWidth(), maxError, ERROR_LOC::ERROR_INSIDE );
1259 
1260  drillOutline.BooleanSubtract( padOutline, SHAPE_POLY_SET::POLYGON_MODE::PM_FAST );
1261 
1262  if( drillOutline.BBox().GetWidth() > 0 || drillOutline.BBox().GetHeight() > 0 )
1263  {
1264  warning_msgs.Add( _( "Warning: Pad drill will leave no copper or drill shape and "
1265  "pad shape do not overlap." ) );
1266  }
1267  }
1268 
1269  if( m_dummyPad->GetLocalClearance() < 0 )
1270  warning_msgs.Add( _( "Warning: Negative local clearance values will have no effect." ) );
1271 
1272  // Some pads need a negative solder mask clearance (mainly for BGA with small pads)
1273  // However the negative solder mask clearance must not create negative mask size
1274  // Therefore test for minimal acceptable negative value
1276  {
1277  int absMargin = abs( m_dummyPad->GetLocalSolderMaskMargin() );
1278 
1280  {
1281  for( const std::shared_ptr<PCB_SHAPE>& shape : m_dummyPad->GetPrimitives() )
1282  {
1283  EDA_RECT shapeBBox = shape->GetBoundingBox();
1284 
1285  if( absMargin > shapeBBox.GetWidth() || absMargin > shapeBBox.GetHeight() )
1286  {
1287  warning_msgs.Add( _( "Warning: Negative solder mask clearances larger than "
1288  "some shape primitives. Results may be surprising." ) );
1289 
1290  break;
1291  }
1292  }
1293  }
1294  else if( absMargin > pad_size.x || absMargin > pad_size.y )
1295  {
1296  warning_msgs.Add( _( "Warning: Negative solder mask clearance larger than pad. No "
1297  "solder mask will be generated." ) );
1298  }
1299  }
1300 
1301  // Some pads need a positive solder paste clearance (mainly for BGA with small pads)
1302  // However, a positive value can create issues if the resulting shape is too big.
1303  // (like a solder paste creating a solder paste area on a neighbor pad or on the solder mask)
1304  // So we could ask for user to confirm the choice
1305  // For now we just check for disappearing paste
1306  wxSize paste_size;
1307  int paste_margin = m_dummyPad->GetLocalSolderPasteMargin();
1308  double paste_ratio = m_dummyPad->GetLocalSolderPasteMarginRatio();
1309 
1310  paste_size.x = pad_size.x + paste_margin + KiROUND( pad_size.x * paste_ratio );
1311  paste_size.y = pad_size.y + paste_margin + KiROUND( pad_size.y * paste_ratio );
1312 
1313  if( paste_size.x <= 0 || paste_size.y <= 0 )
1314  {
1315  warning_msgs.Add( _( "Warning: Negative solder paste margins larger than pad. No solder "
1316  "paste mask will be generated." ) );
1317  }
1318 
1319  LSET padlayers_mask = m_dummyPad->GetLayerSet();
1320 
1321  if( padlayers_mask == 0 )
1322  error_msgs.Add( _( "Error: pad has no layer." ) );
1323 
1324  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
1325  {
1326  if( ( drill_size.x || drill_size.y ) && m_dummyPad->GetAttribute() != PAD_ATTRIB::NPTH )
1327  {
1328  warning_msgs.Add( _( "Warning: Plated through holes should normally have a copper pad "
1329  "on at least one layer." ) );
1330  }
1331  }
1332 
1333  if( error )
1334  error_msgs.Add( _( "Too large value for pad delta size." ) );
1335 
1336  switch( m_dummyPad->GetAttribute() )
1337  {
1338  case PAD_ATTRIB::NPTH: // Not plated, but through hole, a hole is expected
1339  case PAD_ATTRIB::PTH: // Pad through hole, a hole is also expected
1340  if( drill_size.x <= 0
1341  || ( drill_size.y <= 0 && m_dummyPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) )
1342  {
1343  warning_msgs.Add( _( "Warning: Through hole pad has no hole." ) );
1344  }
1345  break;
1346 
1347  case PAD_ATTRIB::CONN: // Connector pads are smd pads, just they do not have solder paste.
1348  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
1349  {
1350  warning_msgs.Add( _( "Warning: Connector pads normally have no solder paste. Use an "
1351  "SMD pad instead." ) );
1352  }
1354 
1355  case PAD_ATTRIB::SMD: // SMD and Connector pads (One external copper layer only)
1356  {
1357  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
1358 
1359  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) || innerlayers_mask.count() != 0 )
1360  warning_msgs.Add( _( "Warning: SMD pad has no outer layers." ) );
1361  }
1362  break;
1363  }
1364 
1368  {
1369  warning_msgs.Add( _( "Warning: Fiducial property makes no sense on NPTH pads." ) );
1370  }
1371 
1374  {
1375  warning_msgs.Add( _( "Warning: Testpoint property makes no sense on NPTH pads." ) );
1376  }
1377 
1380  {
1381  warning_msgs.Add( _( "Warning: Heatsink property makes no sense of NPTH pads." ) );
1382  }
1383 
1386  {
1387  warning_msgs.Add( _( "Warning: Castellated property is for PTH pads." ) );
1388  }
1389 
1390  if( m_dummyPad->GetProperty() == PAD_PROP::BGA &&
1392  {
1393  warning_msgs.Add( _( "Warning: BGA property is for SMD pads." ) );
1394  }
1395 
1398  {
1400 
1401  if( m_cornerRatio.GetDoubleValue() < 0.0 )
1402  error_msgs.Add( _( "Error: Negative corner size." ) );
1403  else if( m_cornerRatio.GetDoubleValue() > 50.0 )
1404  warning_msgs.Add( _( "Warning: Corner size will make pad circular." ) );
1405  }
1406 
1407  // PADSTACKS TODO: this will need to check each layer in the pad...
1409  {
1410  SHAPE_POLY_SET mergedPolygon;
1411  m_dummyPad->MergePrimitivesAsPolygon( &mergedPolygon );
1412 
1413  if( mergedPolygon.OutlineCount() > 1 )
1414  error_msgs.Add( _( "Error: Custom pad shape must resolve to a single polygon." ) );
1415  }
1416 
1417 
1418  if( error_msgs.GetCount() || warning_msgs.GetCount() )
1419  {
1420  wxString title = error_msgs.GetCount() ? _( "Pad Properties Errors" )
1421  : _( "Pad Properties Warnings" );
1422  HTML_MESSAGE_BOX dlg( this, title );
1423 
1424  dlg.ListSet( error_msgs );
1425 
1426  if( warning_msgs.GetCount() )
1427  dlg.ListSet( warning_msgs );
1428 
1429  dlg.ShowModal();
1430  }
1431 
1432  return error_msgs.GetCount() == 0;
1433 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
int GetLocalSolderMaskMargin() const
Definition: pad.h:386
int OutlineCount() const
Return the number of vertices in a given outline/hole.
int GetLocalSolderPasteMargin() const
Definition: pad.h:393
PAD_PROP GetProperty() const
Definition: pad.h:374
Like smd, does not appear on the solder paste layer (default)
Smd pad, appears on the solder paste layer (default)
int GetWidth() const
Definition: eda_rect.h:109
const SHAPE_SEGMENT * GetEffectiveHoleShape() const
Return a SHAPE object representing the pad's hole.
Definition: pad.cpp:319
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
a test point pad
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
const SEG & GetSeg() const
Plated through hole pad.
a pad used as heat sink, usually in SMD footprints
const wxSize & GetDrillSize() const
Definition: pad.h:243
like PAD_PTH, but not plated
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:505
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
Represent a set of closed polygons.
coord_type GetWidth() const
Definition: box2.h:180
const wxSize & GetSize() const
Definition: pad.h:233
Smd pad, used in BGA footprints.
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:719
PAD_SHAPE GetShape() const
Definition: pad.h:170
a fiducial (usually a smd) local to the parent footprint
#define _(s)
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:368
bool IsOnCopperLayer() const override
Definition: pad.h:218
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:718
int GetHeight() const
Definition: eda_rect.h:110
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:396
Definition: seg.h:40
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
Definition: pad.cpp:1530
a fiducial (usually a smd) for the full board
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
Definition: layer_ids.h:71
VECTOR2I A
Definition: seg.h:48
Handle the component boundary box.
Definition: eda_rect.h:42
void TransformOvalToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aStart, const wxPoint &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a oblong shape to a polygon, using multiple segments.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
coord_type GetHeight() const
Definition: box2.h:181
void MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
virtual long long int GetValue()
Return the current value in Internal Units.
a pad with a castellated through hole
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
virtual double GetDoubleValue()
Return the current value in Internal Units.
int GetWidth() const
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:301
VECTOR2I B
Definition: seg.h:49

References _, SEG::A, LSET::AllCuMask(), SEG::B, B_Cu, B_Paste, SHAPE_POLY_SET::BBox(), BGA, SHAPE_POLY_SET::BooleanSubtract(), CASTELLATED, CHAMFERED_RECT, CIRCLE, CONN, CUSTOM, ERROR_INSIDE, F_Cu, F_Paste, FIDUCIAL_GLBL, FIDUCIAL_LOCAL, PAD::GetAttribute(), BOARD::GetDesignSettings(), UNIT_BINDER::GetDoubleValue(), PAD::GetDrillShape(), PAD::GetDrillSize(), PAD::GetEffectiveHoleShape(), EDA_RECT::GetHeight(), BOX2< Vec >::GetHeight(), PAD::GetLayerSet(), PAD::GetLocalClearance(), PAD::GetLocalSolderMaskMargin(), PAD::GetLocalSolderPasteMargin(), PAD::GetLocalSolderPasteMarginRatio(), PAD::GetPrimitives(), PAD::GetProperty(), SHAPE_SEGMENT::GetSeg(), PAD::GetShape(), PAD::GetSize(), UNIT_BINDER::GetValue(), EDA_RECT::GetWidth(), SHAPE_SEGMENT::GetWidth(), BOX2< Vec >::GetWidth(), HEATSINK, LSET::InternalCuMask(), PAD::IsOnCopperLayer(), KI_FALLTHROUGH, KiROUND(), HTML_MESSAGE_BOX::ListSet(), m_board, m_cornerRatio, m_dummyPad, BOARD_DESIGN_SETTINGS::m_MaxError, m_mixedCornerRatio, PAD::MergePrimitivesAsPolygon(), NPTH, SHAPE_POLY_SET::OutlineCount(), PAD_DRILL_SHAPE_OBLONG, PTH, ROUNDRECT, LSET::Seq(), SMD, TESTPOINT, transferDataToPad(), TransformOvalToPolygon(), and PAD::TransformShapeWithClearanceToPolygon().

Referenced by TransferDataFromWindow().

◆ prepareCanvas()

void DIALOG_PAD_PROPERTIES::prepareCanvas ( )
private

Definition at line 295 of file dialog_pad_properties.cpp.

296 {
297  // Initialize the canvas to display the pad
298  m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( m_boardViewPanel, -1, wxDefaultPosition,
299  wxDefaultSize,
301  m_parent->GetCanvas()->GetBackend() );
302 
303  m_padPreviewSizer->Add( m_padPreviewGAL, 12, wxEXPAND | wxALL, 5 );
304 
305  // Show the X and Y axis. It is useful because pad shape can have an offset
306  // or be a complex shape.
307  KIGFX::COLOR4D axis_color = LIGHTBLUE;
308 
310  Millimeter2iu( 0.2 ),
312  m_axisOrigin->SetDrawAtZero( true );
313 
316  m_padPreviewGAL->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
317 
318  KIGFX::VIEW_CONTROLS* parentViewControls = m_parent->GetCanvas()->GetViewControls();
319  m_padPreviewGAL->GetViewControls()->ApplySettings( parentViewControls->GetSettings() );
320 
321  m_padPreviewGAL->Show();
322 
324 
325  // fix the pad render mode (filled/not filled)
326  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
327  bool sketchMode = m_cbShowPadOutline->IsChecked();
328  settings->SetSketchMode( LAYER_PADS_TH, sketchMode );
329  settings->SetSketchMode( LAYER_PAD_FR, sketchMode );
330  settings->SetSketchMode( LAYER_PAD_BK, sketchMode );
331  settings->SetSketchModeGraphicItems( sketchMode );
332 
333  settings->SetHighContrast( false );
334  settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL );
335 
336  // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
337  double gridsize = 0.001 * IU_PER_MM;
338  view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
339 
340  // And do not show the grid:
341  view->GetGAL()->SetGridVisibility( false );
342  view->Add( m_dummyPad );
343  view->Add( m_axisOrigin );
344 
346  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
347 }
smd pads, front layer
Definition: layer_ids.h:198
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
static constexpr double IU_PER_MM
Mock up a conversion function.
void ApplySettings(const VC_SETTINGS &aSettings)
Load new settings from program common settings.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
smd pads, back layer
Definition: layer_ids.h:199
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:190
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
const VC_SETTINGS & GetSettings() const
Apply VIEW_CONTROLS settings from an object.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
Inactive layers are shown normally (no high-contrast mode)
void SetDrawAtZero(bool aDrawFlag)
Set the draw at zero flag.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
void OnResize(wxSizeEvent &event)
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void StartDrawing()
Begin drawing if it was stopped previously.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
multilayer pads, usually with holes
Definition: layer_ids.h:209
wxPoint GetPosition() const override
Definition: pad.h:178
PCB_DRAW_PANEL_GAL * m_padPreviewGAL
void SetGridVisibility(bool aVisibility)
Set the visibility setting of the grid.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
static constexpr int Millimeter2iu(double mm)
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::VIEW::Add(), KIGFX::VIEW_CONTROLS::ApplySettings(), KIGFX::ORIGIN_VIEWITEM::CROSS, EDA_DRAW_PANEL_GAL::GetBackend(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW::GetGAL(), EDA_DRAW_FRAME::GetGalDisplayOptions(), KIGFX::VIEW::GetPainter(), PAD::GetPosition(), KIGFX::PAINTER::GetSettings(), KIGFX::VIEW_CONTROLS::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), IU_PER_MM, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, LIGHTBLUE, m_axisOrigin, DIALOG_PAD_PROPERTIES_BASE::m_boardViewPanel, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_dummyPad, m_padPreviewGAL, DIALOG_PAD_PROPERTIES_BASE::m_padPreviewSizer, m_parent, Millimeter2iu(), NORMAL, OnResize(), KIGFX::ORIGIN_VIEWITEM::SetDrawAtZero(), KIGFX::GAL::SetGridSize(), KIGFX::GAL::SetGridVisibility(), EDA_DRAW_PANEL_GAL::SetStealsFocus(), EDA_DRAW_PANEL_GAL::StartDrawing(), and PCB_DRAW_PANEL_GAL::UpdateColors().

Referenced by DIALOG_PAD_PROPERTIES().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Return a reference to the PROJECT associated with this KIWAY.

Definition at line 36 of file kiway_holder.cpp.

37 {
38  return Kiway().Prj();
39 }
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:190

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_LIBRARY_MANAGER::addLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), SCH_EDIT_FRAME::AppendSchematic(), AskSaveBoardFileName(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLibrariesListBox(), SIM_PLOT_FRAME::canCloseWindow(), PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), PCB_BASE_EDIT_FRAME::createNewLibrary(), PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doAutoSave(), PCB_BASE_EDIT_FRAME::doCloseWindow(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), BOARD_EDITOR_CONTROL::ExportNetlist(), DIALOG_EXPORT_SVG::ExportSVGFile(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), SYMBOL_EDITOR_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), SYMBOL_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SIM_PLOT_FRAME::getDefaultFilename(), SIM_PLOT_FRAME::getDefaultPath(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), SCH_BASE_FRAME::GetLibSymbol(), DIALOG_PLOT_SCHEMATIC::getOutputPath(), KICAD_MANAGER_FRAME::GetProjectFileName(), SCH_EDIT_FRAME::GetSchematicJunctionSize(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SIM_PLOT_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), EDA_BASE_FRAME::LoadWindowState(), SIM_PLOT_FRAME::loadWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbookAs(), PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), DIALOG_EXPORT_STEP::onExportButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_SCHEMATIC_SETUP::OnPageChange(), DIALOG_BOARD_SETUP::OnPageChange(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_TEXT_AND_LABEL_PROPERTIES::onScintillaCharAdded(), PROPERTIES_FRAME::onScintillaCharAdded(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_SPICE_MODEL::onSelectLibrary(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_CONTROL::PasteFootprint(), SCH_BASE_FRAME::PickSymbolFromLibTree(), DIALOG_PLOT::Plot(), DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), EDA_DRAW_FRAME::PrintDrawingSheet(), SCH_EDIT_FRAME::PrintPage(), KICAD_MANAGER_FRAME::PrintPrjInfo(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint(), EDA_3D_VIEWER_FRAME::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), SYMBOL_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_EDIT_FRAME::saveSchematicFile(), SIM_PLOT_FRAME::SaveSettings(), EDA_BASE_FRAME::SaveSettings(), SYMBOL_EDIT_FRAME::saveSymbolAs(), SCH_BASE_FRAME::saveSymbolLibTables(), SIM_PLOT_FRAME::saveWorkbook(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectLibrary(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), PCB_BASE_EDIT_FRAME::selectLibTable(), SYMBOL_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), SYMBOL_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), SYMBOL_EDIT_FRAME::SetCurSymbol(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_SYMBOL::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), SYMBOL_VIEWER_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SYMBOL_LIBRARY_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER_FRAME::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), SCH_EDIT_FRAME::updateAutoSaveFile(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), SIM_PLOT_FRAME::updateTitle(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::UpdateTitle(), PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), PANEL_FP_PROPERTIES_3D_MODEL::~PANEL_FP_PROPERTIES_3D_MODEL(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ redraw()

void DIALOG_PAD_PROPERTIES::redraw ( )
private

Definition at line 1436 of file dialog_pad_properties.cpp.

1437 {
1438  if( !m_canUpdate )
1439  return;
1440 
1441  KIGFX::VIEW* view = m_padPreviewGAL->GetView();
1443 
1444  // The layer used to place primitive items selected when editing custom pad shapes
1445  // we use here a layer never used in a pad:
1446  #define SELECTED_ITEMS_LAYER Dwgs_User
1447 
1449  KIGFX::PCB_RENDER_SETTINGS* settings =
1450  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
1452 
1453  view->Update( m_dummyPad );
1454 
1455  // delete previous items if highlight list
1456  while( m_highlight.size() )
1457  {
1458  delete m_highlight.back(); // the dtor also removes item from view
1459  m_highlight.pop_back();
1460  }
1461 
1462  // highlight selected primitives:
1463  long select = m_listCtrlPrimitives->GetFirstSelected();
1464 
1465  while( select >= 0 )
1466  {
1467  PCB_SHAPE* dummyShape = (PCB_SHAPE*) m_primitives[select]->Clone();
1468  dummyShape->SetLayer( SELECTED_ITEMS_LAYER );
1469  dummyShape->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
1470  dummyShape->Move( m_dummyPad->GetPosition() );
1471 
1472  view->Add( dummyShape );
1473  m_highlight.push_back( dummyShape );
1474 
1475  select = m_listCtrlPrimitives->GetNextSelected( select );
1476  }
1477 
1478  BOX2I bbox = m_dummyPad->ViewBBox();
1479 
1480  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
1481  {
1482  // The origin always goes in the middle of the canvas; we want offsetting the pad
1483  // shape to move the pad, not the hole
1484  bbox.Move( -m_dummyPad->GetPosition() );
1485  int maxXExtent = std::max( abs( bbox.GetLeft() ), abs( bbox.GetRight() ) );
1486  int maxYExtent = std::max( abs( bbox.GetTop() ), abs( bbox.GetBottom() ) );
1487 
1488  // Don't blow up the GAL on too-large numbers
1489  if( maxXExtent > INT_MAX / 4 )
1490  maxXExtent = INT_MAX / 4;
1491 
1492  if( maxYExtent > INT_MAX / 4 )
1493  maxYExtent = INT_MAX / 4;
1494 
1495  BOX2D viewBox( m_dummyPad->GetPosition(), {0, 0} );
1496  BOX2D canvasBox( m_dummyPad->GetPosition(), {0, 0} );
1497  viewBox.Inflate( maxXExtent * 1.4, maxYExtent * 1.4 ); // add a margin
1498  canvasBox.Inflate( maxXExtent * 2.0, maxYExtent * 2.0 );
1499 
1500  view->SetBoundary( canvasBox );
1501 
1502  // Autozoom
1503  view->SetViewport( viewBox );
1504 
1507  }
1508 }
void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
Definition: box2.h:104
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition: view.cpp:524
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Set given layer to be displayed on the top or sets back the default order of layers.
Definition: view.cpp:826
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:163
coord_type GetTop() const
Definition: box2.h:187
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
coord_type GetRight() const
Definition: box2.h:182
coord_type GetBottom() const
Definition: box2.h:183
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: pcb_shape.cpp:109
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
PCB specific render settings.
Definition: pcb_painter.h:64
virtual void Move(const wxPoint &aMoveVector) override
Move this object.
Definition: pcb_shape.cpp:97
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
Definition: pad.h:349
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pad.cpp:1392
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void StartDrawing()
Begin drawing if it was stopped previously.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281
wxPoint GetPosition() const override
Definition: pad.h:178
std::unique_ptr< typename std::remove_const< T >::type > Clone(const T &aItem)
Definition: pns_item.h:271
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
PCB_DRAW_PANEL_GAL * m_padPreviewGAL
#define SELECTED_ITEMS_LAYER
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
const Vec & GetSize() const
Definition: box2.h:172
coord_type GetLeft() const
Definition: box2.h:186
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
void SetBoundary(const BOX2D &aBoundary)
Set limits for view area.
Definition: view.h:274
std::vector< PCB_SHAPE * > m_highlight
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570

References KIGFX::VIEW::Add(), PNS::Clone(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), PAD::GetOrientation(), KIGFX::VIEW::GetPainter(), PAD::GetPosition(), BOX2< Vec >::GetRight(), KIGFX::PAINTER::GetSettings(), BOX2< Vec >::GetSize(), BOX2< Vec >::GetTop(), PCB_DRAW_PANEL_GAL::GetView(), BOX2< Vec >::Inflate(), m_canUpdate, m_dummyPad, m_highlight, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_padPreviewGAL, m_primitives, m_selectedColor, BOX2< Vec >::Move(), PCB_SHAPE::Move(), EDA_DRAW_PANEL_GAL::Refresh(), PCB_SHAPE::Rotate(), SELECTED_ITEMS_LAYER, KIGFX::VIEW::SetBoundary(), BOARD_ITEM::SetLayer(), KIGFX::RENDER_SETTINGS::SetLayerColor(), KIGFX::VIEW::SetTopLayer(), KIGFX::VIEW::SetViewport(), EDA_DRAW_PANEL_GAL::StartDrawing(), EDA_DRAW_PANEL_GAL::StopDrawing(), KIGFX::VIEW::Update(), PAD::ViewBBox(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by editPrimitive(), onAddPrimitive(), onChangePadMode(), onCornerRadiusChange(), onCornerSizePercentChange(), onDeletePrimitive(), OnDrillShapeSelected(), onDuplicatePrimitive(), onGeometryTransform(), OnInitDialog(), OnPadShapeSelection(), OnPrimitiveSelection(), OnResize(), OnSetCopperLayers(), OnSetLayers(), OnValuesChanged(), PadOrientEvent(), and PadTypeSelected().

◆ resetSize()

void DIALOG_SHIM::resetSize ( )
protectedinherited

Clear the existing dialog size and position.

This will cause the dialog size to be clear so the next time the dialog is shown the sizers will layout the dialog accordingly. This useful when there are dialog windows that size changes due to layout dependency hidden controls.

Definition at line 287 of file dialog_shim.cpp.

288 {
289  const char* hash_key;
290 
291  if( m_hash_key.size() )
292  {
293  // a special case like EDA_LIST_DIALOG, which has multiple uses.
294  hash_key = m_hash_key.c_str();
295  }
296  else
297  {
298  hash_key = typeid(*this).name();
299  }
300 
301  std::unordered_map<std::string, wxRect>::iterator it = class_map.find( hash_key );
302 
303  if( it == class_map.end() )
304  return;
305 
306  wxRect rect = it->second;
307  rect.SetSize( wxSize( 0, 0 ) );
308  class_map[ hash_key ] = rect;
309 }
std::string m_hash_key
Definition: dialog_shim.h:201
static std::unordered_map< std::string, wxRect > class_map

References class_map, and DIALOG_SHIM::m_hash_key.

Referenced by DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES().

◆ SetInitialFocus()

void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 97 of file dialog_shim.h.

98  {
99  m_initialFocusTarget = aWindow;
100  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:211

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_FIND::DIALOG_FIND(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES(), DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES(), DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_AND_LABEL_PROPERTIES::DIALOG_TEXT_AND_LABEL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER(), HK_PROMPT_DIALOG::HK_PROMPT_DIALOG(), DIALOG_FIELD_PROPERTIES::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), SYMBOL_EDIT_FRAME::saveSymbolAs(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow(), DIALOG_COPPER_ZONE::TransferDataToWindow(), and WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG().

◆ SetKiway()

void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

It is only used for debugging, since "this" is not a wxWindow*.

"this" is a KIWAY_HOLDER mix-in.

Parameters
aDestis the recipient of aKiway pointer.
aKiwayis often from a parent window or from KIFACE::CreateWindow().

Definition at line 43 of file kiway_holder.cpp.

44 {
45 #if defined(DEBUG)
46  // offer a trap point for debugging most any window
47  wxASSERT( aDest );
48  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
49  {
50  int breakhere=1;
51  ignore_unused( breakhere );
52  }
53 #endif
54 
55  ignore_unused( aDest );
56 
57  m_kiway = aKiway;
58 }
KIWAY * m_kiway
Definition: kiway_holder.h:75
const char * name
Definition: DXF_plotter.cpp:56
void ignore_unused(const T &)
Definition: ignore.h:24

References ignore_unused(), KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), PCB::IFACE::CreateWindow(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ SetPosition()

void DIALOG_SHIM::SetPosition ( const wxPoint &  aNewPosition)
inherited

Force the position of the dialog to a new position.

Parameters
aNewPositionis the new forced position

Definition at line 190 of file dialog_shim.cpp.

191 {
192  wxDialog::SetPosition( aNewPosition );
193 
194  // Now update the stored position:
195  const char* hash_key;
196 
197  if( m_hash_key.size() )
198  {
199  // a special case like EDA_LIST_DIALOG, which has multiple uses.
200  hash_key = m_hash_key.c_str();
201  }
202  else
203  {
204  hash_key = typeid(*this).name();
205  }
206 
207  std::unordered_map<std::string, wxRect>::iterator it = class_map.find( hash_key );
208 
209  if( it == class_map.end() )
210  return;
211 
212  wxRect rect = it->second;
213  rect.SetPosition( aNewPosition );
214 
215  class_map[ hash_key ] = rect;
216 }
std::string m_hash_key
Definition: dialog_shim.h:201
static std::unordered_map< std::string, wxRect > class_map
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

References class_map, DIALOG_SHIM::m_hash_key, and PCAD2KICAD::SetPosition().

Referenced by PCB_BASE_FRAME::SelectOneLayer().

◆ setSizeInDU()

void DIALOG_SHIM::setSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 162 of file dialog_shim.cpp.

163 {
164  wxSize sz( x, y );
165  SetSize( ConvertDialogToPixels( sz ) );
166 }

Referenced by DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

◆ Show()

bool DIALOG_PAD_PROPERTIES::Show ( bool  aShow)
overrideprivate

Definition at line 1179 of file dialog_pad_properties.cpp.

1180 {
1181  bool retVal = DIALOG_SHIM::Show( aShow );
1182 
1183  if( aShow )
1184  {
1185  // It *should* work to set the stackup bitmap in the constructor, but it doesn't.
1186  // wxWidgets needs to have these set when the panel is visible for some reason.
1187  // https://gitlab.com/kicad/code/kicad/-/issues/5534
1194  m_stackupImage7->SetBitmap( KiBitmap( BITMAPS::pads_npth ) );
1195 
1196  Layout();
1197  }
1198 
1199  return retVal;
1200 }
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
bool Show(bool show) override

References KiBitmap(), DIALOG_PAD_PROPERTIES_BASE::m_stackupImage0, DIALOG_PAD_PROPERTIES_BASE::m_stackupImage1, DIALOG_PAD_PROPERTIES_BASE::m_stackupImage2, DIALOG_PAD_PROPERTIES_BASE::m_stackupImage4, DIALOG_PAD_PROPERTIES_BASE::m_stackupImage5, DIALOG_PAD_PROPERTIES_BASE::m_stackupImage6, DIALOG_PAD_PROPERTIES_BASE::m_stackupImage7, pads_npth, pads_npth_bottom, pads_npth_top, pads_npth_top_bottom, pads_remove_unused, pads_remove_unused_keep_bottom, pads_reset_unused, and DIALOG_SHIM::Show().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 430 of file dialog_shim.cpp.

431 {
432  // This is an exception safe way to zero a pointer before returning.
433  // Yes, even though DismissModal() clears this first normally, this is
434  // here in case there's an exception before the dialog is dismissed.
435  struct NULLER
436  {
437  void*& m_what;
438  NULLER( void*& aPtr ) : m_what( aPtr ) {}
439  ~NULLER() { m_what = nullptr; } // indeed, set it to NULL on destruction
440  } clear_this( (void*&) m_qmodal_loop );
441 
442  // release the mouse if it's currently captured as the window having it
443  // will be disabled when this dialog is shown -- but will still keep the
444  // capture making it impossible to do anything in the modal dialog itself
445  wxWindow* win = wxWindow::GetCapture();
446  if( win )
447  win->ReleaseMouse();
448 
449  // Get the optimal parent
450  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
451 
452  wxASSERT_MSG( !m_qmodal_parent_disabler,
453  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
454 
455  // quasi-modal: disable only my "optimal" parent
457 
458  // Apple in its infinite wisdom will raise a disabled window before even passing
459  // us the event, so we have no way to stop it. Instead, we must set an order on
460  // the windows so that the quasi-modal will be pushed in front of the disabled
461  // window when it is raised.
463 
464  Show( true );
465 
466  m_qmodal_showing = true;
467 
468  WX_EVENT_LOOP event_loop;
469 
470  m_qmodal_loop = &event_loop;
471 
472  event_loop.Run();
473 
474  m_qmodal_showing = false;
475 
476  return GetReturnCode();
477 }
bool m_qmodal_showing
Definition: dialog_shim.h:215
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:213
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:216
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:44
void ReparentQuasiModal(wxNonOwnedWindow *aWindow)
Move a window's parent to be the top-level window and force the window to be on top.
Definition: gtk/ui.cpp:65

References DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, KIPLATFORM::UI::ReparentQuasiModal(), DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by SCH_EDIT_TOOL::ChangeSymbols(), S3D::Configure3DPaths(), COMMON_CONTROL::ConfigurePaths(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_DRAWING_TOOLS::createNewText(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditSymbolFields(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), InvokeCopperZonesEditor(), InvokeDialogCreateBOM(), InvokeDialogEditSymbolsLibId(), InvokeDialogRescueEach(), InvokeNonCopperZonesEditor(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDITOR_CONTROL::RemapSymbols(), S3D::Select3DModel(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowDimensionPropertiesDialog(), PCB_EDIT_FRAME::ShowExchangeFootprintsDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), PCB_BASE_FRAME::ShowPadPropertiesDialog(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), and PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog().

◆ TransferDataFromWindow()

bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow ( )
overrideprivate

Updates the different parameters for the component being edited.

Automatically fired from the OK button click.

Definition at line 1526 of file dialog_pad_properties.cpp.

1527 {
1528  BOARD_COMMIT commit( m_parent );
1529 
1530  if( !wxDialog::TransferDataFromWindow() )
1531  return false;
1532 
1533  if( !m_panelGeneral->TransferDataFromWindow() )
1534  return false;
1535 
1536  if( !m_localSettingsPanel->TransferDataFromWindow() )
1537  return false;
1538 
1539  if( !padValuesOK() )
1540  return false;
1541 
1543 
1544  PAD_TOOL* padTool = m_parent->GetToolManager()->GetTool<PAD_TOOL>();
1545  padTool->SetLastPadNumber( m_padMaster->GetNumber() );
1546 
1547  // m_padMaster is a pattern: ensure there is no net for this pad:
1549 
1550  if( !m_currentPad ) // Set current Pad parameters
1551  return true;
1552 
1553  commit.Modify( m_currentPad );
1554 
1555  // redraw the area where the pad was, without pad (delete pad on screen)
1557  m_parent->GetCanvas()->Refresh();
1559 
1560  // Update values
1564 
1565  m_currentPad->SetLocked( m_locked->GetValue() );
1566 
1567  if( !m_locked->GetValue() || m_isFpEditor )
1569 
1570  wxSize size;
1571  FOOTPRINT* footprint = m_currentPad->GetParent();
1572 
1574 
1575  size = m_padMaster->GetDelta();
1576  m_currentPad->SetDelta( size );
1577 
1580 
1581  wxPoint offset = m_padMaster->GetOffset();
1582  m_currentPad->SetOffset( offset );
1583 
1585 
1588 
1591 
1595 
1597 
1598  int padNetcode = NETINFO_LIST::UNCONNECTED;
1599 
1600  // For PAD_ATTRIB::NPTH, ensure there is no net name selected
1602  padNetcode = m_padNetSelector->GetSelectedNetcode();
1603 
1604  m_currentPad->SetNetCode( padNetcode );
1615 
1616  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1617  // So set the right shape (and perhaps issues with a radius = 0)
1620  {
1622  }
1623 
1624  // Set the fabrication property:
1626 
1627  // define the way the clearance area is defined in zones
1629 
1630  if( m_isFlipped )
1631  {
1632  // flip pad (up/down) around its position
1633  m_currentPad->Flip( m_currentPad->GetPosition(), false );
1634  }
1635 
1636  if( footprint )
1637  {
1638  footprint->SetLastEditTime();
1639 
1640  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
1641  // i.e. relative to footprint origin (footprint position)
1642  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
1643  RotatePoint( &pt, -footprint->GetOrientation() );
1644  m_currentPad->SetPos0( pt );
1646  footprint->GetOrientation() );
1647  }
1648 
1650 
1651  // redraw the area where the pad was
1652  m_parent->GetCanvas()->Refresh();
1653 
1654  commit.Push( _( "Modify pad" ) );
1655 
1656  return true;
1657 }
int GetLocalSolderMaskMargin() const
Definition: pad.h:386
void SetOffset(const wxPoint &aOffset)
Definition: pad.h:249
void SetLastPadNumber(const wxString &aPadNumber)
Definition: pad_tool.h:63
#define DO_NOT_DRAW
Used to disable draw function.
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: pad.h:397
void SetKeepTopBottom(bool aSet)
Set whether we keep the top and bottom connections even if they are not connected.
Definition: pad.h:562
void SetAttribute(PAD_ATTRIB aAttribute)
Definition: pad.cpp:594
int GetLocalSolderPasteMargin() const
Definition: pad.h:393
double GetRoundRectRadiusRatio() const
Definition: pad.h:523
void DeletePrimitivesList()
Clear the basic shapes list.
void SetLocalClearance(int aClearance)
Definition: pad.h:391
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition: pad.h:490
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Tool relating to pads and pad settings.
Definition: pad_tool.h:35
double GetOrientation() const
Definition: footprint.h:191
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.