KiCad PCB EDA Suite
DIALOG_PAD_PROPERTIES Class Reference

class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder More...

#include <dialog_pad_properties.h>

Inheritance diagram for DIALOG_PAD_PROPERTIES:
DIALOG_PAD_PROPERTIES_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_PAD_PROPERTIES (PCB_BASE_FRAME *aParent, D_PAD *aPad)
 
 ~DIALOG_PAD_PROPERTIES ()
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Types

enum  { wxID_DIALOG_EDIT_PAD = 1000, wxID_PADNUMCTRL, wxID_PADNETNAMECTRL }
 

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)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

wxNotebook * m_notebook
 
wxPanel * m_panelGeneral
 
wxStaticText * m_PadNumText
 
wxTextCtrl * m_PadNumCtrl
 
wxStaticText * m_PadNameText
 
wxTextCtrl * m_PadNetNameCtrl
 
wxStaticText * m_staticText44
 
wxChoice * m_PadType
 
wxStaticText * m_staticText45
 
wxChoice * m_PadShape
 
wxStaticText * m_staticText4
 
TEXT_CTRL_EVALm_PadPosition_X_Ctrl
 
wxStaticText * m_PadPosX_Unit
 
wxStaticText * m_staticText41
 
TEXT_CTRL_EVALm_PadPosition_Y_Ctrl
 
wxStaticText * m_PadPosY_Unit
 
wxStaticText * m_staticText12
 
TEXT_CTRL_EVALm_ShapeSize_X_Ctrl
 
wxStaticText * m_PadShapeSizeX_Unit
 
wxStaticText * m_staticText15
 
TEXT_CTRL_EVALm_ShapeSize_Y_Ctrl
 
wxStaticText * m_PadShapeSizeY_Unit
 
wxStaticText * m_PadOrientText
 
wxChoice * m_PadOrient
 
wxStaticText * m_staticText491
 
TEXT_CTRL_EVALm_PadOrientCtrl
 
wxStaticText * m_customOrientUnits
 
wxStaticText * m_staticText17
 
TEXT_CTRL_EVALm_ShapeOffset_X_Ctrl
 
wxStaticText * m_PadShapeOffsetX_Unit
 
wxStaticText * m_staticText19
 
TEXT_CTRL_EVALm_ShapeOffset_Y_Ctrl
 
wxStaticText * m_PadShapeOffsetY_Unit
 
wxStaticText * m_staticText38
 
TEXT_CTRL_EVALm_LengthPadToDieCtrl
 
wxStaticText * m_PadLengthDie_Unit
 
wxStaticLine * m_staticline4
 
wxStaticLine * m_staticline5
 
wxStaticLine * m_staticline6
 
wxStaticText * m_staticText21
 
TEXT_CTRL_EVALm_ShapeDelta_Ctrl
 
wxStaticText * m_PadShapeDelta_Unit
 
wxStaticText * m_staticText23
 
wxChoice * m_trapDeltaDirChoice
 
wxStaticLine * m_staticline7
 
wxStaticLine * m_staticline8
 
wxStaticLine * m_staticline9
 
wxStaticText * m_staticTextCornerSizeRatio
 
TEXT_CTRL_EVALm_tcCornerSizeRatio
 
wxStaticText * m_staticTextCornerSizeRatioUnit
 
wxStaticText * m_staticTextCornerRadius
 
wxStaticText * m_staticTextCornerRadiusValue
 
wxStaticText * m_staticTextCornerSizeUnit
 
wxStaticText * m_staticText47
 
wxChoice * m_DrillShapeCtrl
 
wxStaticText * m_staticText51
 
wxStaticText * m_textPadDrillX
 
TEXT_CTRL_EVALm_PadDrill_X_Ctrl
 
wxStaticText * m_PadDrill_X_Unit
 
wxStaticText * m_textPadDrillY
 
TEXT_CTRL_EVALm_PadDrill_Y_Ctrl
 
wxStaticText * m_PadDrill_Y_Unit
 
wxBoxSizer * m_FlippedWarningSizer
 
wxStaticBitmap * m_FlippedWarningIcon
 
wxStaticText * m_staticText86
 
wxStaticText * m_staticText511
 
wxChoice * m_rbCopperLayersSel
 
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
 
wxPanel * m_localSettingsPanel
 
wxStaticText * m_staticTextWarning
 
wxStaticText * m_staticTextInfoPosValue
 
wxStaticText * m_staticTextInfoNegVal
 
wxStaticText * m_staticTextNetClearance
 
TEXT_CTRL_EVALm_NetClearanceValueCtrl
 
wxStaticText * m_NetClearanceUnits
 
wxStaticText * m_MaskClearanceTitle
 
TEXT_CTRL_EVALm_SolderMaskMarginCtrl
 
wxStaticText * m_SolderMaskMarginUnits
 
wxStaticText * m_staticTextSolderPaste
 
TEXT_CTRL_EVALm_SolderPasteMarginCtrl
 
wxStaticText * m_SolderPasteMarginUnits
 
wxStaticText * m_staticTextRatio
 
TEXT_CTRL_EVALm_SolderPasteMarginRatioCtrl
 
wxStaticText * m_SolderPasteRatioMarginUnits
 
wxStaticBoxSizer * m_sbSizerZonesSettings
 
wxStaticText * m_staticText40
 
wxChoice * m_ZoneConnectionChoice
 
wxStaticText * m_staticText49
 
TEXT_CTRL_EVALm_ThermalWidthCtrl
 
wxStaticText * m_ThermalWidthUnits
 
wxStaticText * m_staticText52
 
TEXT_CTRL_EVALm_ThermalGapCtrl
 
wxStaticText * m_ThermalGapUnits
 
wxStaticBoxSizer * m_sbSizerCustomShapedZonesSettings
 
wxStaticText * m_staticTextCsZconnTitle
 
wxTextCtrl * m_textCtrlNone
 
wxStaticText * m_staticTextcps
 
wxChoice * m_ZoneCustomPadShape
 
wxPanel * m_panelCustomShapePrimitives
 
wxBoxSizer * m_bSizerPanelPrimitives
 
wxStaticText * m_staticTextPrimitivesList
 
wxStaticText * m_staticTextPrimitiveListWarning
 
wxListView * m_listCtrlPrimitives
 
wxButton * m_buttonDel
 
wxButton * m_buttonEditShape
 
wxButton * m_buttonAddShape
 
wxButton * m_buttonDup
 
wxButton * m_buttonGeometry
 
wxButton * m_buttonImport
 
wxStaticText * m_staticModuleSideValue
 
wxStaticText * m_staticTitleModuleRot
 
wxStaticText * m_staticModuleRotValue
 
wxPanel * m_panelShowPad
 
PCB_DRAW_PANEL_GALm_panelShowPadGal
 
KIGFX::GAL_DISPLAY_OPTIONS m_galOptions
 
wxCheckBox * m_cbShowPadOutline
 
wxStaticLine * m_staticline13
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
bool m_fixupsRun
 
std::string m_hash_key
 
EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

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 setPadLayersList (LSET layer_mask)
 Function setPadLayersList updates the CheckBox states in pad layers list,. More...
 
bool transferDataToPad (D_PAD *aPad)
 Copy values from dialog field to aPad's members. More...
 
void OnInitDialog (wxInitDialogEvent &event) override
 
void OnResize (wxSizeEvent &event)
 
void OnCancel (wxCommandEvent &event) override
 
void OnPadShapeSelection (wxCommandEvent &event) override
 
void OnDrillShapeSelected (wxCommandEvent &event) override
 
void onChangePadMode (wxCommandEvent &event) override
 
void PadOrientEvent (wxCommandEvent &event) override
 
void PadTypeSelected (wxCommandEvent &event) override
 
void OnSetLayers (wxCommandEvent &event) override
 
void OnPaintShowPanel (wxPaintEvent &event) override
 
void onCornerSizePercentChange (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 onImportPrimitives (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...
 

Private Attributes

PCB_BASE_FRAMEm_parent
 
KIGFX::ORIGIN_VIEWITEMm_axisOrigin
 
D_PADm_currentPad
 
D_PADm_dummyPad
 
D_PADm_padMaster
 
BOARDm_board
 
bool m_isFlipped
 
bool m_canUpdate
 
bool m_canEditNetName
 
std::vector< PAD_CS_PRIMITIVEm_primitives
 
std::vector< DRAWSEGMENT * > m_highligth
 
wxFloatingPointValidator< double > m_OrientValidator
 
double m_OrientValue
 
COLOR4D m_selectedColor
 

Static Private Attributes

static bool m_drawPadOutlineMode = false
 

Detailed Description

class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder

Definition at line 57 of file dialog_pad_properties.h.

Member Enumeration Documentation

anonymous enum
protectedinherited

Constructor & Destructor Documentation

DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES ( PCB_BASE_FRAME aParent,
D_PAD aPad 
)

Definition at line 111 of file dialog_pad_properties.cpp.

References DIALOG_SHIM::FinishDialogSettings(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), initValues(), m_board, m_canUpdate, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_currentPad, m_drawPadOutlineMode, m_dummyPad, m_OrientValidator, BOARD_DESIGN_SETTINGS::m_Pad_Master, m_padMaster, DIALOG_PAD_PROPERTIES_BASE::m_PadOrientCtrl, m_parent, DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerOK, prepareCanvas(), and TransferDataToWindow().

111  :
112  DIALOG_PAD_PROPERTIES_BASE( aParent ),
114 {
115  m_canUpdate = false;
116  m_parent = aParent;
117  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
118  // from the footprint editor to set default pad setup
119 
121 
122  m_OrientValidator.SetRange( -360.0, 360.0 );
123  m_PadOrientCtrl->SetValidator( m_OrientValidator );
124  m_OrientValidator.SetWindow( m_PadOrientCtrl );
125 
127 
129  m_dummyPad = new D_PAD( (MODULE*) NULL );
130 
131  if( aPad )
132  *m_dummyPad = *aPad;
133  else // We are editing a "master" pad, i.e. a template to create new pads
135 
136  initValues();
137 
138  // Usually, TransferDataToWindow is called by OnInitDialog
139  // calling it here fixes all widgets sizes, and FinishDialogSettings can
140  // safely fix minsizes
142 
143  // Initialize canvas to be able to display the dummy pad:
144  prepareCanvas();
145 
146  m_sdbSizerOK->SetDefault();
147  m_canUpdate = true;
148 
149  // Now all widgets have the size fixed, call FinishDialogSettings
151 }
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxFloatingPointValidator< double > m_OrientValidator
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
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)
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES ( )
inline

Definition at line 61 of file dialog_pad_properties.h.

References m_axisOrigin, and m_dummyPad.

62  {
63  delete m_dummyPad;
64  delete m_axisOrigin;
65  }
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin

Member Function Documentation

void DIALOG_PAD_PROPERTIES::displayPrimitivesList ( )
private

Definition at line 768 of file dialog_pad_properties.cpp.

References CoordinateToString(), FMT_ANGLE, Format(), formatCoord(), PAD_CS_PRIMITIVE::m_ArcAngle, PAD_CS_PRIMITIVE::m_End, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, PAD_CS_PRIMITIVE::m_Poly, m_primitives, PAD_CS_PRIMITIVE::m_Radius, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, S_ARC, S_CIRCLE, S_POLYGON, and S_SEGMENT.

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

769 {
770  m_listCtrlPrimitives->ClearAll();
771 
772  wxListItem itemCol;
773  itemCol.SetImage(-1);
774 
775  for( int ii = 0; ii < 5; ++ii )
776  m_listCtrlPrimitives->InsertColumn(ii, itemCol);
777 
778  wxString bs_info[5];
779 
780  for( unsigned ii = 0; ii < m_primitives.size(); ++ii )
781  {
782  const PAD_CS_PRIMITIVE& primitive = m_primitives[ii];
783 
784  for( unsigned jj = 0; jj < 5; ++jj )
785  bs_info[jj].Empty();
786 
787  bs_info[4] = wxString::Format( _( "width %s" ),
788  CoordinateToString( primitive.m_Thickness, true ) );
789 
790  switch( primitive.m_Shape )
791  {
792  case S_SEGMENT: // usual segment : line with rounded ends
793  bs_info[0] = _( "Segment" );
794  bs_info[1] = _( "from " ) + formatCoord( primitive.m_Start );
795  bs_info[2] = _( "to " ) + formatCoord( primitive.m_End );
796  break;
797 
798  case S_ARC: // Arc with rounded ends
799  bs_info[0] = _( "Arc" );
800  bs_info[1] = _( "center " ) + formatCoord( primitive.m_Start ); // Center
801  bs_info[2] = _( "start " ) + formatCoord( primitive.m_End ); // Start point
802  bs_info[3] = wxString::Format( _( "angle %s" ), FMT_ANGLE( primitive.m_ArcAngle ) );
803  break;
804 
805  case S_CIRCLE: // ring or circle
806  if( primitive.m_Thickness )
807  bs_info[0] = _( "ring" );
808  else
809  bs_info[0] = _( "circle" );
810 
811  bs_info[1] = formatCoord( primitive.m_Start );
812  bs_info[2] = wxString::Format( _( "radius %s" ),
813  CoordinateToString( primitive.m_Radius, true ) );
814  break;
815 
816  case S_POLYGON: // polygon
817  bs_info[0] = "Polygon";
818  bs_info[1] = wxString::Format( _( "corners count %d" ), primitive.m_Poly.size() );
819  break;
820 
821  default:
822  bs_info[0] = "Unknown primitive";
823  break;
824  }
825 
826  long tmp = m_listCtrlPrimitives->InsertItem(ii, bs_info[0]);
827  m_listCtrlPrimitives->SetItemData(tmp, ii);
828 
829  for( int jj = 0, col = 0; jj < 5; ++jj )
830  {
831  m_listCtrlPrimitives->SetItem(tmp, col++, bs_info[jj]);
832  }
833  }
834 
835  // Now columns are filled, ensure correct width of columns
836  for( unsigned ii = 0; ii < 5; ++ii )
837  m_listCtrlPrimitives->SetColumnWidth( ii, wxLIST_AUTOSIZE );
838 }
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:118
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:100
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
std::vector< wxPoint > m_Poly
is also the start point of the arc
Definition: class_pad.h:102
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:101
STROKE_T m_Shape
Definition: class_pad.h:94
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
std::vector< PAD_CS_PRIMITIVE > m_primitives
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static wxString formatCoord(wxPoint aCoord)
#define FMT_ANGLE
double m_ArcAngle
radius of a circle
Definition: class_pad.h:99
void DIALOG_PAD_PROPERTIES::editPrimitive ( )
private

Definition at line 1839 of file dialog_pad_properties.cpp.

References displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_primitives, PAD_CS_PRIMITIVE::m_Shape, redraw(), S_POLYGON, DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow(), and transferDataToPad().

Referenced by onEditPrimitive(), and onPrimitiveDClick().

1840 {
1841  long select = m_listCtrlPrimitives->GetFirstSelected();
1842 
1843  if( select < 0 )
1844  {
1845  wxMessageBox( _( "No shape selected" ) );
1846  return;
1847  }
1848 
1849  PAD_CS_PRIMITIVE& shape = m_primitives[select];
1850 
1851  if( shape.m_Shape == S_POLYGON )
1852  {
1853  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, &shape );
1854 
1855  if( dlg.ShowModal() != wxID_OK )
1856  return;
1857 
1858  dlg.TransferDataFromWindow();
1859  }
1860 
1861  else
1862  {
1863  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, &shape );
1864 
1865  if( dlg.ShowModal() != wxID_OK )
1866  return;
1867 
1868  dlg.TransferDataFromWindow();
1869  }
1870 
1872 
1873  if( m_canUpdate )
1874  {
1876  redraw();
1877  }
1878 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
polygon (not yet used for tracks, but could be in microwave apps)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
STROKE_T m_Shape
Definition: class_pad.h:94
a dialog to edit basic polygonal shape parameters
std::vector< PAD_CS_PRIMITIVE > m_primitives
a dialog to edit basics shapes parameters.
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 199 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues(), and DIALOG_SHIM::IsQuasiModal().

200 {
201  // so we can do logging of this state change:
202 
203 #if defined(DEBUG)
204  const char* type_id = typeid( *this ).name();
205  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
206 #endif
207 
208  return wxDialog::Enable( enable );
209 }
void DIALOG_PAD_PROPERTIES::enablePrimitivePage ( bool  aEnable)
private

enable (or disable) the primitive page editor

Definition at line 180 of file dialog_pad_properties.cpp.

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, DIALOG_PAD_PROPERTIES_BASE::m_buttonImport, and DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives.

Referenced by initValues(), and OnPadShapeSelection().

181 {
182  // Enable or disable the widgets in page managing custom shape primitives
183  m_listCtrlPrimitives->Enable( aEnable );
184  m_buttonDel->Enable( aEnable );
185  m_buttonEditShape->Enable( aEnable );
186  m_buttonAddShape->Enable( aEnable );
187  m_buttonDup->Enable( aEnable );
188  m_buttonGeometry->Enable( aEnable );
189  m_buttonImport->Enable( aEnable );
190 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 604 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::OnButton(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_ONE_FIELD::OnCancelClick(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog(), DIALOG_EDIT_ONE_FIELD::OnCloseDialog(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_EDIT_ONE_FIELD::OnOkClick(), DIALOG_EXCHANGE_FOOTPRINTS::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

605 {
606  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
607  // handle validation in the same way as other dialogs.
608  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
609  return;
610 
611  SetReturnCode( retCode );
612 
613  if( !IsQuasiModal() )
614  {
615  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
616  return;
617  }
618 
619  m_qmodal_showing = false;
620 
621  if( m_qmodal_loop )
622  {
623  if( m_qmodal_loop->IsRunning() )
624  m_qmodal_loop->Exit( 0 );
625  else
626  m_qmodal_loop->ScheduleExit( 0 );
627 
628  m_qmodal_loop = NULL;
629  }
630 
633 
634  Show( false );
635 }
bool m_qmodal_showing
Definition: dialog_shim.h:155
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:154
bool IsQuasiModal()
Definition: dialog_shim.h:103
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:156
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, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 104 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by COLOR4D_PICKER_DLG::COLOR4D_PICKER_DLG(), DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), 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_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS(), DIALOG_PAD_PROPERTIES(), DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_SHIM::IsQuasiModal(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_LIB_EDIT_PIN::OnInitDialog(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), DIALOG_TRACK_VIA_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEMS_OPTIONS::OnInitDlg(), DIALOG_EDIT_FPTEXT::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_FOOTPRINT_FP_EDITOR::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), and DIALOG_UPDATE_FIELDS::TransferDataToWindow().

105 {
106  // must be called from the constructor of derived classes,
107  // when all widgets are initialized, and therefore their size fixed
108 
109  // SetSizeHints fixes the minimal size of sizers in the dialog
110  // (SetSizeHints calls Fit(), so no need to call it)
111  GetSizer()->SetSizeHints( this );
112 
113  // the default position, when calling the first time the dlg
114  Center();
115 }
int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 125 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), and DIALOG_SHIM::IsQuasiModal().

126 {
127  wxSize sz( x, 0 );
128  return ConvertDialogToPixels( sz ).x;
129 }
void DIALOG_PAD_PROPERTIES::initValues ( )
private

Definition at line 484 of file dialog_pad_properties.cpp.

References PNS::angle(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, 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, code_type, CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL, DIM, displayPrimitivesList(), Dwgs_User, Eco1_User, Eco2_User, enablePrimitivePage(), F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, FlipLayerMask(), D_PAD::FlipPrimitives(), FRAME_PCB, g_UserUnit, GetAbbreviatedUnitsLabel(), D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), D_PAD::GetCustomShapeInZoneOpt(), D_PAD::GetDelta(), D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), BOARD::GetLayerName(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetLocalSolderPasteMargin(), D_PAD::GetLocalSolderPasteMarginRatio(), D_PAD::GetName(), BOARD_CONNECTED_ITEM::GetNetname(), D_PAD::GetOffset(), MODULE::GetOrientation(), D_PAD::GetOrientation(), MODULE::GetOrientationDegrees(), D_PAD::GetPadToDieLength(), D_PAD::GetParent(), D_PAD::GetPosition(), D_PAD::GetPrimitives(), D_PAD::GetShape(), D_PAD::GetSize(), D_PAD::GetThermalGap(), D_PAD::GetThermalWidth(), D_PAD::GetZoneConnection(), D_PAD::IsFlipped(), EDA_BASE_FRAME::IsType(), KiBitmap(), m_board, m_canEditNetName, m_currentPad, DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningIcon, DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningSizer, m_isFlipped, DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl, DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceUnits, DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceValueCtrl, m_OrientValue, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Unit, 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_PadLengthDie_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadNetNameCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadOrient, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosX_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadPosY_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeDelta_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetX_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetY_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeX_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeY_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadType, m_parent, m_primitives, DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel, DIALOG_PAD_PROPERTIES_BASE::m_ShapeDelta_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginUnits, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginUnits, DIALOG_PAD_PROPERTIES_BASE::m_staticModuleRotValue, DIALOG_PAD_PROPERTIES_BASE::m_staticModuleSideValue, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeUnit, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapUnits, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthUnits, DIALOG_PAD_PROPERTIES_BASE::m_trapDeltaDirChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, NORMALIZE_ANGLE_180(), OnDrillShapeSelected(), OnPadShapeSelection(), PAD_ATTRIB_HOLE_NOT_PLATED, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, PutValueInLocalUnits(), D_PAD::SetDelta(), D_PAD::SetLayerSet(), D_PAD::SetOffset(), D_PAD::SetOrientation(), setPadLayersList(), updateRoundRectCornerValues(), wxPoint::x, and wxPoint::y.

Referenced by DIALOG_PAD_PROPERTIES().

485 {
486  wxString msg;
487  double angle;
488 
489  // Disable pad net name wxTextCtrl if the caller is the footprint editor
490  // because nets are living only in the board managed by the board editor
492 
493 
494  // Setup layers names from board
495  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
496  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
497  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
498 
499  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
500  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
502  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
504  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
505  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
506  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
507  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
508  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
510 
511  m_isFlipped = false;
512 
513  if( m_currentPad )
514  {
516 
517  if( m_isFlipped )
518  m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
519  else
520  m_staticModuleSideValue->SetLabel( _( "Front side" ) );
521 
522  // Diplay footprint rotation ( angles are in 0.1 degree )
523  MODULE* footprint = m_currentPad->GetParent();
524 
525  if( footprint )
526  msg.Printf( "%.1f", footprint->GetOrientationDegrees() );
527  else
528  msg = _("No footprint" );
529 
530  m_staticModuleRotValue->SetLabel( msg );
531  }
532 
533  if( m_isFlipped )
534  {
535  wxPoint pt = m_dummyPad->GetOffset();
536  pt.y = -pt.y;
537  m_dummyPad->SetOffset( pt );
538 
539  wxSize sz = m_dummyPad->GetDelta();
540  sz.y = -sz.y;
541  m_dummyPad->SetDelta( sz );
542 
543  // flip pad's layers
545 
546  // flip custom pad shapes
548  }
549 
551 
552  m_FlippedWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) );
554 
555  m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
556  m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
557 
558  // Set the unit name in dialog:
559  wxStaticText* unitTexts[] =
560  {
568  };
569 
570  for( unsigned ii = 0; ii < DIM( unitTexts ); ++ii )
571  unitTexts[ii]->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
572 
573  // Display current pad parameters units:
576 
579 
582 
585 
586  if( m_dummyPad->GetDelta().x )
587  {
589  m_trapDeltaDirChoice->SetSelection( 0 );
590  }
591  else
592  {
594  m_trapDeltaDirChoice->SetSelection( 1 );
595  }
596 
598 
603 
604  // These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
606 
608  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
609 
610  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
611 
612  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
613  // Sometimes Printf adds a sign if the value is small
614  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
615  else
616  m_SolderPasteMarginRatioCtrl->SetValue( msg );
617 
618  switch( m_dummyPad->GetZoneConnection() )
619  {
620  default:
622  m_ZoneConnectionChoice->SetSelection( 0 );
623  break;
624 
625  case PAD_ZONE_CONN_FULL:
626  m_ZoneConnectionChoice->SetSelection( 1 );
627  break;
628 
630  m_ZoneConnectionChoice->SetSelection( 2 );
631  break;
632 
633  case PAD_ZONE_CONN_NONE:
634  m_ZoneConnectionChoice->SetSelection( 3 );
635  break;
636  }
637 
639  m_ZoneCustomPadShape->SetSelection( 1 );
640  else
641  m_ZoneCustomPadShape->SetSelection( 0 );
642 
643  if( m_currentPad )
644  {
645  angle = m_currentPad->GetOrientation();
646  MODULE* footprint = m_currentPad->GetParent();
647 
648  if( footprint )
649  angle -= footprint->GetOrientation();
650 
651  if( m_isFlipped )
652  angle = -angle;
653 
654  m_dummyPad->SetOrientation( angle );
655  }
656 
657  angle = m_dummyPad->GetOrientation();
658 
659  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
660 
661  // Set layers used by this pad: :
663 
664  // Pad Orient
665  switch( int( angle ) )
666  {
667  case 0:
668  m_PadOrient->SetSelection( 0 );
669  break;
670 
671  case 900:
672  m_PadOrient->SetSelection( 1 );
673  break;
674 
675  case -900:
676  m_PadOrient->SetSelection( 2 );
677  break;
678 
679  case 1800:
680  case -1800:
681  m_PadOrient->SetSelection( 3 );
682  break;
683 
684  default:
685  m_PadOrient->SetSelection( 4 );
686  break;
687  }
688 
689  switch( m_dummyPad->GetShape() )
690  {
691  default:
692  case PAD_SHAPE_CIRCLE:
693  m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE );
694  break;
695 
696  case PAD_SHAPE_OVAL:
697  m_PadShape->SetSelection( CHOICE_SHAPE_OVAL );
698  break;
699 
700  case PAD_SHAPE_RECT:
701  m_PadShape->SetSelection( CHOICE_SHAPE_RECT );
702  break;
703 
704  case PAD_SHAPE_TRAPEZOID:
705  m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID );
706  break;
707 
708  case PAD_SHAPE_ROUNDRECT:
709  m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT );
710  break;
711 
712  case PAD_SHAPE_CUSTOM:
715  else
717  break;
718  }
719 
721 
722  m_OrientValue = angle / 10.0;
723 
724  // Type of pad selection
725  m_PadType->SetSelection( 0 );
726 
727  for( unsigned ii = 0; ii < DIM( code_type ); ii++ )
728  {
729  if( code_type[ii] == m_dummyPad->GetAttribute() )
730  {
731  m_PadType->SetSelection( ii );
732  break;
733  }
734  }
735 
736  // Enable/disable Pad name,and pad length die
737  // (disable for NPTH pads (mechanical pads)
739 
740  m_PadNumCtrl->Enable( enable );
741  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
742  m_LengthPadToDieCtrl->Enable( enable );
743 
745  m_DrillShapeCtrl->SetSelection( 0 );
746  else
747  m_DrillShapeCtrl->SetSelection( 1 );
748 
749  // Update some dialog widgets state (Enable/disable options):
750  wxCommandEvent cmd_event;
752  OnDrillShapeSelected( cmd_event );
753  OnPadShapeSelection( cmd_event );
755 
756  // Update basic shapes list
758 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:226
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known.
Definition: lset.cpp:518
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:336
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:433
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
int GetPadToDieLength() const
Definition: class_pad.h:401
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:403
MODULE * GetParent() const
Definition: class_pad.h:162
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:381
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:314
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
Pads are not covered.
Definition: zones.h:57
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
static PAD_ATTR_T code_type[]
double GetOrientationDegrees() const
Definition: class_module.h:181
double GetOrientation() const
Definition: class_module.h:180
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:484
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:649
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:395
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
int GetThermalWidth() const
Definition: class_pad.cpp:660
void OnPadShapeSelection(wxCommandEvent &event) override
int GetThermalGap() const
Definition: class_pad.cpp:671
const wxSize & GetSize() const
Definition: class_pad.h:269
const wxString & GetName() const
Definition: class_pad.h:190
void OnDrillShapeSelected(wxCommandEvent &event) override
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:409
bool IsFlipped() const
Definition: class_pad.cpp:125
int GetLocalClearance() const
Definition: class_pad.h:406
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:412
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:266
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:394
std::vector< PAD_CS_PRIMITIVE > m_primitives
const wxString & GetNetname() const
Function GetNetname.
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:232
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:375
const wxSize & GetDelta() const
Definition: class_pad.h:272
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:400
bool IsType(FRAME_T aType) const
const wxPoint GetPosition() const override
Definition: class_pad.h:220
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
Use thermal relief for pads.
Definition: zones.h:58
const wxPoint & GetOffset() const
Definition: class_pad.h:278
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
pads are covered by copper
Definition: zones.h:59
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns 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 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), and KIWAY_HOLDER::SetKiway().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void DIALOG_PAD_PROPERTIES::onAddPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1931 of file dialog_pad_properties.cpp.

References DIM, displayPrimitivesList(), m_canUpdate, m_dummyPad, m_primitives, redraw(), S_ARC, S_CIRCLE, S_POLYGON, S_SEGMENT, and transferDataToPad().

1932 {
1933  // Ask user for shape type
1934  wxString shapelist[] =
1935  {
1936  _( "Segment" ), _( "Arc" ), _( "ring/circle" ), _( "polygon" )
1937  };
1938 
1939  int type = wxGetSingleChoiceIndex( wxEmptyString, _( "Select shape type:" ),
1940  DIM( shapelist ), shapelist, 0 );
1941 
1942  STROKE_T listtype[] =
1943  {
1945  };
1946 
1947  PAD_CS_PRIMITIVE primitive( listtype[type] );
1948 
1949  if( listtype[type] == S_POLYGON )
1950  {
1951  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, &primitive );
1952 
1953  if( dlg.ShowModal() != wxID_OK )
1954  return;
1955  }
1956  else
1957  {
1958  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, &primitive );
1959 
1960  if( dlg.ShowModal() != wxID_OK )
1961  return;
1962  }
1963 
1964  m_primitives.push_back( primitive );
1965 
1967 
1968  if( m_canUpdate )
1969  {
1971  redraw();
1972  }
1973 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
STROKE_T
Enum STROKE_T is the set of shapes for segments (graphic segments and tracks) which are often in the ...
a dialog to edit basic polygonal shape parameters
std::vector< PAD_CS_PRIMITIVE > m_primitives
a dialog to edit basics shapes parameters.
void DIALOG_PAD_PROPERTIES::OnCancel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 168 of file dialog_pad_properties.cpp.

References EDA_DRAW_FRAME::IsGalCanvasActive(), DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, and EDA_DRAW_PANEL_GAL::StopDrawing().

169 {
170  // Mandatory to avoid m_panelShowPadGal trying to draw something
171  // in a non valid context during closing process:
172  if( m_parent->IsGalCanvasActive() )
174 
175  // Now call default handler for wxID_CANCEL command event
176  event.Skip();
177 }
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
void DIALOG_PAD_PROPERTIES::onChangePadMode ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 847 of file dialog_pad_properties.cpp.

References KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_FRAME::IsGalCanvasActive(), LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_drawPadOutlineMode, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, redraw(), KIGFX::PCB_RENDER_SETTINGS::SetSketchMode(), and KIGFX::PCB_RENDER_SETTINGS::SetSketchModeGraphicItems().

848 {
850 
851  if( m_parent->IsGalCanvasActive() )
852  {
854 
855  // fix the pad render mode (filled/not filled)
856  KIGFX::PCB_RENDER_SETTINGS* settings =
857  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
858 
863  }
864 
865  redraw();
866 }
multilayer pads, usually with holes
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
smd pads, back layer
void SetSketchModeGraphicItems(bool aEnabled)
Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts).
Definition: pcb_painter.h:134
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
smd pads, front layer
void SetSketchMode(int aItemLayer, bool aEnabled)
Function SetSketchMode Turns on/off sketch mode for given item layer.
Definition: pcb_painter.h:114
Class VIEW.
Definition: view.h:58
void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 453 of file dialog_pad_properties.cpp.

References g_UserUnit, D_PAD::GetRoundRectCornerRadius(), D_PAD::GetShape(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerRadiusValue, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, PAD_SHAPE_ROUNDRECT, redraw(), StringFromValue(), and transferDataToPad().

454 {
456  return;
457 
458  wxString value = m_tcCornerSizeRatio->GetValue();
459  double rrRadiusRatioPercent;
460 
461  if( value.ToDouble( &rrRadiusRatioPercent ) )
462  {
463  // Clamp rrRadiusRatioPercent to acceptable value (0.0 to 50.0)
464  if( rrRadiusRatioPercent < 0.0 )
465  {
466  rrRadiusRatioPercent = 0.0;
467  m_tcCornerSizeRatio->ChangeValue( "0.0" );
468  }
469 
470  if( rrRadiusRatioPercent > 50.0 )
471  {
472  rrRadiusRatioPercent = 0.5;
473  m_tcCornerSizeRatio->ChangeValue( "50.0" );
474  }
475 
479  redraw();
480  }
481 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:204
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:511
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void DIALOG_PAD_PROPERTIES::onDeletePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Event handlers of basic shapes list panel.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1903 of file dialog_pad_properties.cpp.

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

1904 {
1905  long select = m_listCtrlPrimitives->GetFirstSelected();
1906 
1907  if( select < 0 )
1908  return;
1909 
1910  // Multiple selections are allowed. get them and remove corresponding shapes
1911  std::vector<long> indexes;
1912  indexes.push_back( select );
1913 
1914  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1915  indexes.push_back( select );
1916 
1917  // Erase all select shapes
1918  for( unsigned ii = indexes.size(); ii > 0; --ii )
1919  m_primitives.erase( m_primitives.begin() + indexes[ii-1] );
1920 
1922 
1923  if( m_canUpdate )
1924  {
1926  redraw();
1927  }
1928 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
std::vector< PAD_CS_PRIMITIVE > m_primitives
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 952 of file dialog_pad_properties.cpp.

References DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadType, redraw(), and transferDataToPad().

Referenced by initValues(), and PadTypeSelected().

953 {
954  if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
955  {
956  // pad type = SMD or CONN: no hole allowed
957  m_PadDrill_X_Ctrl->Enable( false );
958  m_PadDrill_Y_Ctrl->Enable( false );
959  }
960  else
961  {
962  switch( m_DrillShapeCtrl->GetSelection() )
963  {
964  case 0: //CIRCLE:
965  m_PadDrill_X_Ctrl->Enable( true );
966  m_PadDrill_Y_Ctrl->Enable( false );
967  break;
968 
969  case 1: //OVALE:
970  m_PadDrill_X_Ctrl->Enable( true );
971  m_PadDrill_Y_Ctrl->Enable( true );
972  break;
973  }
974  }
975 
977  redraw();
978 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 2023 of file dialog_pad_properties.cpp.

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

2024 {
2025  long select = m_listCtrlPrimitives->GetFirstSelected();
2026 
2027  if( select < 0 )
2028  {
2029  wxMessageBox( _( "No shape selected" ) );
2030  return;
2031  }
2032 
2033  // Multiple selections are allowed. Build selected shapes list
2034  std::vector<long> indexes;
2035  indexes.push_back( select );
2036 
2037  std::vector<PAD_CS_PRIMITIVE*> shapeList;
2038  shapeList.push_back( &m_primitives[select] );
2039 
2040  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2041  {
2042  indexes.push_back( select );
2043  shapeList.push_back( &m_primitives[select] );
2044  }
2045 
2046  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, shapeList, true );
2047 
2048  if( dlg.ShowModal() != wxID_OK )
2049  return;
2050 
2051  // Transfert new settings:
2052  dlg.Transform( &m_primitives, dlg.GetDuplicateCount() );
2053 
2055 
2056  if( m_canUpdate )
2057  {
2059  redraw();
2060  }
2061 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
std::vector< PAD_CS_PRIMITIVE > m_primitives
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin...
void DIALOG_PAD_PROPERTIES::onEditPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1897 of file dialog_pad_properties.cpp.

References editPrimitive().

1898 {
1899  editPrimitive();
1900 }
void DIALOG_PAD_PROPERTIES::onGeometryTransform ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1982 of file dialog_pad_properties.cpp.

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

1983 {
1984  long select = m_listCtrlPrimitives->GetFirstSelected();
1985 
1986  if( select < 0 )
1987  {
1988  wxMessageBox( _( "No shape selected" ) );
1989  return;
1990  }
1991 
1992  // Multiple selections are allowed. Build selected shapes list
1993  std::vector<long> indexes;
1994  indexes.push_back( select );
1995 
1996  std::vector<PAD_CS_PRIMITIVE*> shapeList;
1997  shapeList.push_back( &m_primitives[select] );
1998 
1999  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2000  {
2001  indexes.push_back( select );
2002  shapeList.push_back( &m_primitives[select] );
2003  }
2004 
2005  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, shapeList, false );
2006 
2007  if( dlg.ShowModal() != wxID_OK )
2008  return;
2009 
2010  // Transfert new settings:
2011  dlg.Transform();
2012 
2014 
2015  if( m_canUpdate )
2016  {
2018  redraw();
2019  }
2020 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
std::vector< PAD_CS_PRIMITIVE > m_primitives
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin...
void DIALOG_PAD_PROPERTIES::onImportPrimitives ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1976 of file dialog_pad_properties.cpp.

1977 {
1978  wxMessageBox( "Not yet available" );
1979 }
void DIALOG_PAD_PROPERTIES::OnInitDialog ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 156 of file dialog_pad_properties.cpp.

References DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, m_selectedColor, and redraw().

157 {
158  m_PadNumCtrl->SetFocus();
159  m_PadNumCtrl->SetSelection( -1, -1 );
160  m_selectedColor = COLOR4D( 1.0, 1.0, 1.0, 0.7 );
161 
162  // Needed on some WM to be sure the pad is redrawn according to the final size
163  // of the canvas, with the right zoom factor
164  redraw();
165 }
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void DIALOG_PAD_PROPERTIES::OnPadShapeSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 869 of file dialog_pad_properties.cpp.

References 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, enablePrimitivePage(), Format(), D_PAD::GetRoundRectRadiusRatio(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, DIALOG_PAD_PROPERTIES_BASE::m_sbSizerCustomShapedZonesSettings, DIALOG_PAD_PROPERTIES_BASE::m_sbSizerZonesSettings, DIALOG_PAD_PROPERTIES_BASE::m_ShapeDelta_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthCtrl, DIALOG_PAD_PROPERTIES_BASE::m_trapDeltaDirChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, redraw(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by initValues().

870 {
871  bool is_custom = false;
872 
873  switch( m_PadShape->GetSelection() )
874  {
875  case CHOICE_SHAPE_CIRCLE:
876  m_ShapeDelta_Ctrl->Enable( false );
877  m_trapDeltaDirChoice->Enable( false );
878  m_ShapeSize_Y_Ctrl->Enable( false );
879  m_ShapeOffset_X_Ctrl->Enable( false );
880  m_ShapeOffset_Y_Ctrl->Enable( false );
881  break;
882 
883  case CHOICE_SHAPE_OVAL:
884  m_ShapeDelta_Ctrl->Enable( false );
885  m_trapDeltaDirChoice->Enable( false );
886  m_ShapeSize_Y_Ctrl->Enable( true );
887  m_ShapeOffset_X_Ctrl->Enable( true );
888  m_ShapeOffset_Y_Ctrl->Enable( true );
889  break;
890 
891  case CHOICE_SHAPE_RECT:
892  m_ShapeDelta_Ctrl->Enable( false );
893  m_trapDeltaDirChoice->Enable( false );
894  m_ShapeSize_Y_Ctrl->Enable( true );
895  m_ShapeOffset_X_Ctrl->Enable( true );
896  m_ShapeOffset_Y_Ctrl->Enable( true );
897  break;
898 
900  m_ShapeDelta_Ctrl->Enable( true );
901  m_trapDeltaDirChoice->Enable( true );
902  m_ShapeSize_Y_Ctrl->Enable( true );
903  m_ShapeOffset_X_Ctrl->Enable( true );
904  m_ShapeOffset_Y_Ctrl->Enable( true );
905  break;
906 
908  m_ShapeDelta_Ctrl->Enable( false );
909  m_trapDeltaDirChoice->Enable( false );
910  m_ShapeSize_Y_Ctrl->Enable( true );
911  m_ShapeOffset_X_Ctrl->Enable( true );
912  m_ShapeOffset_Y_Ctrl->Enable( true );
913  // Ensure m_tcCornerSizeRatio contains the right value:
914  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
916  break;
917 
918  case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE_CUSTOM, circular anchor
919  case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE_CUSTOM, rect anchor
920  is_custom = true;
921  m_ShapeDelta_Ctrl->Enable( false );
922  m_trapDeltaDirChoice->Enable( false );
923  m_ShapeSize_Y_Ctrl->Enable(
924  m_PadShape->GetSelection() == CHOICE_SHAPE_CUSTOM_RECT_ANCHOR );
925  m_ShapeOffset_X_Ctrl->Enable( false );
926  m_ShapeOffset_Y_Ctrl->Enable( false );
927  break;
928  }
929 
930  enablePrimitivePage( is_custom );
931 
932  // A few widgets are enabled only for rounded rect pads:
933  m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT );
934 
935  // PAD_SHAPE_CUSTOM type has constraints for zone connection and thermal shape:
936  // only not connected is allowed to avoid destroying the shape.
937  // Enable/disable options only available for custom shaped pads
938  m_ZoneConnectionChoice->Enable( !is_custom );
939  m_ThermalWidthCtrl->Enable( !is_custom );
940  m_ThermalGapCtrl->Enable( !is_custom );
941 
942  m_sbSizerZonesSettings->Show( !is_custom );
943  m_sbSizerCustomShapedZonesSettings->Show( is_custom );
944 
946 
948  redraw();
949 }
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
wxStaticBoxSizer * m_sbSizerCustomShapedZonesSettings
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:608
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 265 of file dialog_shim.cpp.

References DIALOG_SHIM::m_fixupsRun, and recursiveDescent().

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and DIALOG_SHIM::IsQuasiModal().

266 {
267  if( !m_fixupsRun )
268  {
269 #if DLGSHIM_SELECT_ALL_IN_TEXT_CONTROLS
270  const bool selectAllInTextCtrls = true;
271 #else
272  const bool selectAllInTextCtrls = false;
273 #endif
274  wxWindow* firstTextCtrl = NULL;
275  wxWindow* windowWithFocus = NULL;
276 
277  recursiveDescent( GetChildren(), selectAllInTextCtrls, firstTextCtrl,
278  windowWithFocus );
279 
280 #if DLGSHIM_USE_SETFOCUS
281  // While it would be nice to honour any focus already set (which was
282  // recorded in windowWithFocus), the reality is that it's currently wrong
283  // far more often than it's right.
284  // So just focus on the first text control if we have one; otherwise the
285  // focus on the dialog itself, which will at least allow esc, return, etc.
286  // to function.
287  if( firstTextCtrl )
288  firstTextCtrl->SetFocus();
289  else
290  SetFocus();
291 #endif
292 
293 #ifdef __WXMAC__
294  fixOSXCancelButtonIssue( this );
295 #endif
296 
297  m_fixupsRun = true;
298  }
299 
300  event.Skip();
301 }
static void recursiveDescent(wxWindowList &children, const bool selectTextInTextCtrls, wxWindow *&firstTextCtrl, wxWindow *&windowWithFocus)
bool m_fixupsRun
Definition: dialog_shim.h:149
void DIALOG_PAD_PROPERTIES::OnPaintShowPanel ( wxPaintEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 246 of file dialog_pad_properties.cpp.

References abs, B_Cu, BLACK, DRAWSEGMENT::BuildPolyPointsList(), color, PCB_GENERAL_SETTINGS::Colors(), DARKGRAY, D_PAD::DrawShape(), PAD_CS_PRIMITIVE::ExportTo(), F_Cu, DRAWSEGMENT::GetArcEnd(), DRAWSEGMENT::GetArcStart(), D_PAD::GetAttribute(), D_PAD::GetBoundingRadius(), DRAWSEGMENT::GetCenter(), D_PAD::GetDelta(), D_PAD::GetDrillSize(), DRAWSEGMENT::GetEnd(), COLORS_DESIGN_SETTINGS::GetItemColor(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetOrientation(), D_PAD::GetPosition(), D_PAD::GetShape(), D_PAD::GetSize(), DRAWSEGMENT::GetStart(), GRArc1(), GRCircle(), GRClosedPoly(), GRCSegm(), GRFilledCircle(), GRFilledSegment(), GRLine(), GRResetPenAndBrush(), LAYER_PAD_BK, LAYER_PAD_FR, LIGHTBLUE, LIGHTGRAY, PAD_DRAWINFO::m_Color, PAD_DRAWINFO::m_Display_netname, PAD_DRAWINFO::m_Display_padnum, m_drawPadOutlineMode, m_dummyPad, PAD_DRAWINFO::m_HoleColor, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, PAD_DRAWINFO::m_Offset, PAD_DRAWINFO::m_PadClearance, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, m_parent, m_primitives, PAD_CS_PRIMITIVE::m_Radius, m_selectedColor, PAD_CS_PRIMITIVE::m_Shape, PAD_DRAWINFO::m_ShowNotPlatedHole, PAD_DRAWINFO::m_ShowPadFilled, PAD_CS_PRIMITIVE::m_Thickness, min, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_SHAPE_CIRCLE, DRAWSEGMENT::Rotate(), S_ARC, S_CIRCLE, S_POLYGON, S_SEGMENT, scale, and PCB_BASE_FRAME::Settings().

247 {
248  wxPaintDC dc( m_panelShowPad );
249  PAD_DRAWINFO drawInfo;
250 
252 
253  if( m_dummyPad->GetLayerSet()[F_Cu] )
254  {
256  }
257 
258  if( m_dummyPad->GetLayerSet()[B_Cu] )
259  {
260  color = color.LegacyMix( m_parent->Settings().Colors().GetItemColor( LAYER_PAD_BK ) );
261  }
262 
263  // What could happen: the pad color is *actually* black, or no
264  // copper was selected
265  if( color == BLACK )
266  color = LIGHTGRAY;
267 
268  drawInfo.m_Color = color;
269  drawInfo.m_HoleColor = DARKGRAY;
270  drawInfo.m_Offset = m_dummyPad->GetPosition();
271  drawInfo.m_Display_padnum = true;
272  drawInfo.m_Display_netname = true;
274 
276  drawInfo.m_ShowNotPlatedHole = true;
277 
278  // Shows the local pad clearance
280 
281  wxSize dc_size = dc.GetSize();
282  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
283 
284  // Calculate a suitable scale to fit the available draw area
285  int dim = m_dummyPad->GetBoundingRadius() *2;
286 
287  // Invalid x size. User could enter zero, or have deleted all text prior to
288  // entering a new value; this is also treated as zero. If dim is left at
289  // zero, the drawing scale is zero and we get a crash.
290  if( dim == 0 )
291  {
292  // If drill size has been set, use that. Otherwise default to 1mm.
293  dim = m_dummyPad->GetDrillSize().x;
294  if( dim == 0 )
295  dim = Millimeter2iu( 1.0 );
296  }
297 
298  if( m_dummyPad->GetLocalClearance() > 0 )
299  dim += m_dummyPad->GetLocalClearance() * 2;
300 
301  double scale = (double) dc_size.x / dim;
302 
303  // If the pad is a circle, use the x size here instead.
304  int ysize;
305 
307  ysize = m_dummyPad->GetSize().x;
308  else
309  ysize = m_dummyPad->GetSize().y;
310 
311  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
312 
313  // Invalid y size. See note about x size above.
314  if( dim == 0 )
315  {
316  dim = m_dummyPad->GetDrillSize().y;
317  if( dim == 0 )
318  dim = Millimeter2iu( 0.1 );
319  }
320 
321  if( m_dummyPad->GetLocalClearance() > 0 )
322  dim += m_dummyPad->GetLocalClearance() * 2;
323 
324  double altscale = (double) dc_size.y / dim;
325  scale = std::min( scale, altscale );
326 
327  // Give a margin
328  scale *= 0.7;
329  dc.SetUserScale( scale, scale );
330 
331  GRResetPenAndBrush( &dc );
332  m_dummyPad->DrawShape( NULL, &dc, drawInfo );
333 
334  // draw selected primitives:
335  long select = m_listCtrlPrimitives->GetFirstSelected();
336  wxPoint start, end, center;
337 
338  while( select >= 0 )
339  {
340  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
341 
342  // The best way to calculate parameters to draw a primitive is to
343  // use a dummy DRAWSEGMENT and use its methods
344  // Note: in legacy canvas, the pad has the 0,0 position
345  DRAWSEGMENT dummySegment;
346  primitive.ExportTo( &dummySegment );
347  dummySegment.Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
348 
349  switch( primitive.m_Shape )
350  {
351  case S_SEGMENT: // usual segment : line with rounded ends
352  if( !m_drawPadOutlineMode )
353  GRFilledSegment( NULL, &dc, dummySegment.GetStart(), dummySegment.GetEnd(),
354  primitive.m_Thickness, m_selectedColor );
355  else
356  GRCSegm( NULL, &dc, dummySegment.GetStart(), dummySegment.GetEnd(),
357  primitive.m_Thickness, m_selectedColor );
358  break;
359 
360  case S_ARC: // Arc with rounded ends
361  if( !m_drawPadOutlineMode )
362  GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
363  dummySegment.GetCenter(), primitive.m_Thickness, m_selectedColor );
364  else
365  {
366  GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
367  dummySegment.GetCenter(), 0, m_selectedColor );
368 /* GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
369  dummySegment.GetCenter() - primitive.m_Thickness, 0, m_selectedColor );*/
370  }
371  break;
372 
373  case S_CIRCLE: // ring or circle
374  if( primitive.m_Thickness )
375  {
376  if( !m_drawPadOutlineMode )
377  GRCircle( NULL, &dc, dummySegment.GetCenter(), primitive.m_Radius,
378  primitive.m_Thickness, m_selectedColor );
379  else
380  {
381  GRCircle( NULL, &dc, dummySegment.GetCenter(),
382  primitive.m_Radius + primitive.m_Thickness/2, 0,
383  m_selectedColor );
384  GRCircle( NULL, &dc, dummySegment.GetCenter(),
385  primitive.m_Radius - primitive.m_Thickness/2, 0,
386  m_selectedColor );
387  }
388  }
389  else
390  {
391  if( !m_drawPadOutlineMode )
392  GRFilledCircle( NULL, &dc, dummySegment.GetCenter(),
393  primitive.m_Radius, m_selectedColor );
394  else
395  GRCircle( NULL, &dc, dummySegment.GetCenter(),
396  primitive.m_Radius, 0, m_selectedColor );
397  }
398  break;
399 
400  case S_POLYGON: // polygon
401  {
402  std::vector<wxPoint> poly = dummySegment.BuildPolyPointsList();
403  GRClosedPoly( NULL, &dc, poly.size(), &poly[0],
404  m_drawPadOutlineMode ? false : true,
406  }
407  break;
408 
409  default:
410  break;
411  }
412 
413  select = m_listCtrlPrimitives->GetNextSelected( select );
414  }
415 
416  // Draw X and Y axis. This is particularly useful to show the
417  // reference position of pads with offset and no hole, or custom pad shapes
418  const int linethickness = 0;
419  GRLine( NULL, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0,
420  linethickness, LIGHTBLUE ); // X axis
421  GRLine( NULL, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ),
422  linethickness, LIGHTBLUE ); // Y axis
423 
424  event.Skip();
425 }
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:218
bool m_Display_padnum
Definition: class_pad.h:75
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
const wxPoint GetCenter() const override
Function GetCenter()
void ExportTo(DRAWSEGMENT *aTarget)
Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT useful to draw a primitive shape...
int color
Definition: DXF_plotter.cpp:62
polygon (not yet used for tracks, but could be in microwave apps)
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:510
usual segment : line with rounded ends
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:873
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
#define abs(a)
Definition: auxiliary.h:84
smd pads, back layer
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:806
const wxPoint & GetArcStart() const
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:586
PCB_GENERAL_SETTINGS & Settings()
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:395
COLOR4D m_HoleColor
Definition: class_pad.h:70
const wxSize & GetSize() const
Definition: class_pad.h:269
bool m_ShowNotPlatedHole
Definition: class_pad.h:80
void DrawShape(EDA_RECT *aClipBox, wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
Function DrawShape basic function to draw a pad.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:380
STROKE_T m_Shape
Definition: class_pad.h:94
int m_PadClearance
Definition: class_pad.h:73
int GetLocalClearance() const
Definition: class_pad.h:406
COLORS_DESIGN_SETTINGS & Colors()
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
wxPoint m_Offset
Definition: class_pad.h:83
const int scale
smd pads, front layer
std::vector< PAD_CS_PRIMITIVE > m_primitives
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:621
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:850
const wxPoint GetArcEnd() const
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:375
const wxSize & GetDelta() const
Definition: class_pad.h:272
bool m_ShowPadFilled
Definition: class_pad.h:77
COLOR4D m_Color
Definition: class_pad.h:68
Definition: colors.h:45
bool m_Display_netname
Definition: class_pad.h:76
const wxPoint GetPosition() const override
Definition: class_pad.h:220
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
#define min(a, b)
Definition: auxiliary.h:85
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
Definition: gr_basic.cpp:894
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
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 1890 of file dialog_pad_properties.cpp.

References editPrimitive().

1891 {
1892  editPrimitive();
1893 }
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 1881 of file dialog_pad_properties.cpp.

References redraw().

1882 {
1883  // Called on a double click on the basic shapes list
1884  // To Do: highligth the primitive(s) currently selected.
1885  redraw();
1886 }
void DIALOG_PAD_PROPERTIES::OnResize ( wxSizeEvent &  event)
private

Definition at line 840 of file dialog_pad_properties.cpp.

References redraw().

Referenced by prepareCanvas().

841 {
842  redraw();
843  event.Skip();
844 }
void DIALOG_PAD_PROPERTIES::OnSetLayers ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1074 of file dialog_pad_properties.cpp.

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

1075 {
1077  redraw();
1078 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
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 1826 of file dialog_pad_properties.cpp.

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

1827 {
1828  if( m_canUpdate )
1829  {
1831  // If the pad size has changed, update the displayed values
1832  // for rounded rect pads
1834 
1835  redraw();
1836  }
1837 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
void DIALOG_PAD_PROPERTIES::PadOrientEvent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 981 of file dialog_pad_properties.cpp.

References D_PAD::GetOrientation(), m_dummyPad, m_OrientValidator, m_OrientValue, DIALOG_PAD_PROPERTIES_BASE::m_PadOrient, redraw(), D_PAD::SetOrientation(), and transferDataToPad().

982 {
983  switch( m_PadOrient->GetSelection() )
984  {
985  case 0:
987  break;
988 
989  case 1:
990  m_dummyPad->SetOrientation( 900 );
991  break;
992 
993  case 2:
994  m_dummyPad->SetOrientation( -900 );
995  break;
996 
997  case 3:
998  m_dummyPad->SetOrientation( 1800 );
999  break;
1000 
1001  default:
1002  break;
1003  }
1004 
1006  m_OrientValidator.TransferToWindow();
1007 
1009  redraw();
1010 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
wxFloatingPointValidator< double > m_OrientValidator
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:375
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:400
void DIALOG_PAD_PROPERTIES::PadTypeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1013 of file dialog_pad_properties.cpp.

References code_type, DIM, m_canEditNetName, m_currentPad, DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNetNameCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadType, OnDrillShapeSelected(), and setPadLayersList().

1014 {
1015  unsigned ii = m_PadType->GetSelection();
1016 
1017  if( ii >= DIM( code_type ) ) // catches < 0 also
1018  ii = 0;
1019 
1020  LSET layer_mask = std_pad_layers[ii];
1021  setPadLayersList( layer_mask );
1022 
1023  // Enable/disable drill dialog items:
1024  event.SetId( m_DrillShapeCtrl->GetSelection() );
1025  OnDrillShapeSelected( event );
1026 
1027  if( ii == 0 || ii == DIM( code_type )-1 )
1028  m_DrillShapeCtrl->Enable( true );
1029  else
1030  m_DrillShapeCtrl->Enable( false );
1031 
1032  // Enable/disable Pad name,and pad length die
1033  // (disable for NPTH pads (mechanical pads)
1034  bool enable = ii != 3;
1035  m_PadNumCtrl->Enable( enable );
1036  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
1037  m_LengthPadToDieCtrl->Enable( enable );
1038 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
static PAD_ATTR_T code_type[]
Class LSET is a set of PCB_LAYER_IDs.
void OnDrillShapeSelected(wxCommandEvent &event) override
static const LSET std_pad_layers[]
bool DIALOG_PAD_PROPERTIES::padValuesOK ( )
private

test if all values are acceptable for the pad

Definition at line 1082 of file dialog_pad_properties.cpp.

References abs, B_Cu, B_Paste, F_Cu, F_Paste, Format(), g_UserUnit, D_PAD::GetAttribute(), D_PAD::GetDrillSize(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetOffset(), D_PAD::GetShape(), D_PAD::GetSize(), LSET::InternalCuMask(), HTML_MESSAGE_BOX::ListSet(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, D_PAD::MergePrimitivesAsPolygon(), min, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_ATTRIB_SMD, PAD_ATTRIB_STANDARD, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_ROUNDRECT, StringFromValue(), transferDataToPad(), wxPoint::x, and wxPoint::y.

Referenced by TransferDataFromWindow().

1083 {
1084  bool error = transferDataToPad( m_dummyPad );
1085  bool skip_tstoffset = false; // the offset prm is not always tested
1086 
1087  wxArrayString error_msgs;
1088  wxString msg;
1089 
1090  // Test for incorrect values
1091  if( (m_dummyPad->GetSize().x <= 0) ||
1092  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
1093  {
1094  error_msgs.Add( _( "Pad size must be greater than zero" ) );
1095  }
1096 
1097  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
1098  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
1099  {
1100  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
1101  skip_tstoffset = true; // offset prm will be not tested because if the drill value
1102  // is incorrect the offset prm is always seen as incorrect, even if it is 0
1103  }
1104 
1105  if( m_dummyPad->GetLocalClearance() < 0 )
1106  {
1107  error_msgs.Add( _( "Pad local clearance must be zero or greater than zero" ) );
1108  }
1109 
1110  // Some pads need a negative solder mask clearance (mainly for BGA with small pads)
1111  // However the negative solder mask clearance must not create negative mask size
1112  // Therefore test for minimal acceptable negative value
1113  // Hovewer, a negative value can give strange result with custom shapes, so it is not
1114  // allowed for custom pad shape
1116  {
1118  error_msgs.Add( _( "Pad local solder mask clearance must be zero or greater than zero" ) );
1119  else
1120  {
1121  int min_smClearance = -std::min( m_dummyPad->GetSize().x, m_dummyPad->GetSize().y )/2;
1122 
1123  if( m_dummyPad->GetLocalSolderMaskMargin() <= min_smClearance )
1124  {
1125  error_msgs.Add( wxString::Format(
1126  _( "Pad local solder mask clearance must be greater than %s" ),
1127  StringFromValue( g_UserUnit, min_smClearance, true ) ) );
1128  }
1129  }
1130  }
1131 
1132  // Some pads need a positive solder paste clearance (mainly for BGA with small pads)
1133  // Hovewer, a positive value can create issues if the resulting shape is too big.
1134  // (like a solder paste creating a solder paste area on a neighbour pad or on the solder mask)
1135  // So we could ask for user to confirm the choice
1136  // Currently there are no test
1137 
1138  LSET padlayers_mask = m_dummyPad->GetLayerSet();
1139 
1140  if( padlayers_mask == 0 )
1141  error_msgs.Add( _( "Error: pad has no layer" ) );
1142 
1143  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
1144  {
1145  if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
1146  {
1147  // Note: he message is shown in an HTML window
1148  msg = _( "Error: the pad is not on a copper layer and has a hole" );
1149 
1151  {
1152  msg += wxT( "<br><br><i>" );
1153  msg += _( "For NPTH pad, set pad size value to pad drill value,"
1154  " if you do not want this pad plotted in gerber files"
1155  );
1156  }
1157 
1158  error_msgs.Add( msg );
1159  }
1160  }
1161 
1162  if( !skip_tstoffset )
1163  {
1164  wxPoint max_size;
1165  max_size.x = std::abs( m_dummyPad->GetOffset().x );
1166  max_size.y = std::abs( m_dummyPad->GetOffset().y );
1167  max_size.x += m_dummyPad->GetDrillSize().x / 2;
1168  max_size.y += m_dummyPad->GetDrillSize().y / 2;
1169 
1170  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
1171  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
1172  {
1173  error_msgs.Add( _( "Incorrect value for pad offset" ) );
1174  }
1175  }
1176 
1177  if( error )
1178  {
1179  error_msgs.Add( _( "Too large value for pad delta size" ) );
1180  }
1181 
1182  switch( m_dummyPad->GetAttribute() )
1183  {
1184  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
1185  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
1186  if( m_dummyPad->GetDrillSize().x <= 0 )
1187  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
1188  break;
1189 
1190  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
1191  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
1192  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
1193  "Use SMD pads instead" ) );
1194  // Fall trough
1195  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
1196  {
1197  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
1198 
1199  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
1200  innerlayers_mask.count() != 0 )
1201  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
1202  }
1203  break;
1204  }
1205 
1206 
1208  {
1209  wxString value = m_tcCornerSizeRatio->GetValue();
1210  double rrRadiusRatioPercent;
1211 
1212  if( !value.ToDouble( &rrRadiusRatioPercent ) )
1213  error_msgs.Add( _( "Incorrect corner size value" ) );
1214  else
1215  {
1216  if( rrRadiusRatioPercent < 0.0 )
1217  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
1218  else if( rrRadiusRatioPercent > 50.0 )
1219  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
1220  }
1221  }
1222 
1224  {
1226  error_msgs.Add(
1227  _( "Incorrect pad shape: the shape must be equivalent to only one polygon" ) );
1228  }
1229 
1230 
1231  if( error_msgs.GetCount() )
1232  {
1233  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
1234  dlg.ListSet( error_msgs );
1235  dlg.ShowModal();
1236  }
1237 
1238  return error_msgs.GetCount() == 0;
1239 }
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=32)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:204
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:403
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:61
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
#define abs(a)
Definition: auxiliary.h:84
Class LSET is a set of PCB_LAYER_IDs.
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:395
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:633
const wxSize & GetSize() const
Definition: class_pad.h:269
Class HTML_MESSAGE_BOX.
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:62
int GetLocalClearance() const
Definition: class_pad.h:406
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
Usual pad.
Definition: pad_shapes.h:60
const wxPoint & GetOffset() const
Definition: class_pad.h:278
#define min(a, b)
Definition: auxiliary.h:85
void DIALOG_PAD_PROPERTIES::prepareCanvas ( )
private

Definition at line 193 of file dialog_pad_properties.cpp.

References KIGFX::VIEW::Add(), PCB_GENERAL_SETTINGS::Colors(), KIGFX::ORIGIN_VIEWITEM::CROSS, EDA_DRAW_PANEL_GAL::GetBackend(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL::GetEnableMousewheelPan(), KIGFX::VIEW::GetGAL(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), D_PAD::GetPosition(), KIGFX::PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), EDA_DRAW_FRAME::IsGalCanvasActive(), LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, LIGHTBLUE, m_axisOrigin, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, OnResize(), KIGFX::ORIGIN_VIEWITEM::SetDrawAtZero(), KIGFX::GAL::SetGridSize(), KIGFX::PCB_RENDER_SETTINGS::SetSketchMode(), KIGFX::PCB_RENDER_SETTINGS::SetSketchModeGraphicItems(), PCB_BASE_FRAME::Settings(), EDA_DRAW_PANEL_GAL::StartDrawing(), PCB_DRAW_PANEL_GAL::SwitchBackend(), and PCB_DRAW_PANEL_GAL::UseColorScheme().

Referenced by DIALOG_PAD_PROPERTIES().

194 {
195  // Initialize the canvases (legacy or gal) to display the pad
196  // Enable the suitable canvas and make some inits
197 
198  // Show the X and Y axis. It is usefull because pad shape can have an offset
199  // or be a complex shape.
200  KIGFX::COLOR4D axis_color = LIGHTBLUE;
201 
202  m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( axis_color,
204  Millimeter2iu( 0.2 ),
206  m_axisOrigin->SetDrawAtZero( true );
207 
208  if( m_parent->IsGalCanvasActive() )
209  {
213  EnableMousewheelPan( m_parent->GetCanvas()->GetEnableMousewheelPan() );
214 
215  m_panelShowPadGal->Show();
216  m_panelShowPad->Hide();
217 
219 
220  // fix the pad render mode (filled/not filled)
221  KIGFX::PCB_RENDER_SETTINGS* settings =
222  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
223  bool filled = !m_cbShowPadOutline->IsChecked();
224  settings->SetSketchMode( LAYER_PADS_TH, !filled );
225  settings->SetSketchMode( LAYER_PAD_FR, !filled );
226  settings->SetSketchMode( LAYER_PAD_BK, !filled );
227  settings->SetSketchModeGraphicItems( !filled );
228 
229  // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
230  double gridsize = 0.001 * IU_PER_MM;
231  view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
232  view->Add( m_dummyPad );
233  view->Add( m_axisOrigin );
234 
236  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
237  }
238  else
239  {
240  m_panelShowPad->Show();
241  m_panelShowPadGal->Hide();
242  }
243 }
multilayer pads, usually with holes
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
smd pads, back layer
void SetSketchModeGraphicItems(bool aEnabled)
Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts).
Definition: pcb_painter.h:134
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:177
PCB_GENERAL_SETTINGS & Settings()
void SetDrawAtZero(bool aDrawFlag)
Function SetDrawAtZero() Set the draw at zero flag.
void OnResize(wxSizeEvent &event)
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
void UseColorScheme(const COLORS_DESIGN_SETTINGS *aSettings)
Function UseColorScheme Applies layer color settings.
COLORS_DESIGN_SETTINGS & Colors()
bool SwitchBackend(GAL_TYPE aGalType) override
Function SwitchBackend Switches method of rendering graphics.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
smd pads, front layer
bool GetEnableMousewheelPan() const
void SetSketchMode(int aItemLayer, bool aEnabled)
Function SetSketchMode Turns on/off sketch mode for given item layer.
Definition: pcb_painter.h:114
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:882
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:309
Class VIEW.
Definition: view.h:58
const wxPoint GetPosition() const override
Definition: class_pad.h:220
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

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

Referenced by SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), DIALOG_FOOTPRINT_FP_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), LIB_EDIT_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_FOOTPRINT_FP_EDITOR::Edit3DShapeFileName(), DIALOG_FOOTPRINT_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), FOOTPRINT_EDIT_FRAME::getLibPath(), LIB_EDIT_FRAME::getLibraryFileName(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_EDITOR_CONTROL::PlaceModule(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), EDA_3D_VIEWER::takeScreenshot(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), and DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void DIALOG_PAD_PROPERTIES::redraw ( )
private

Definition at line 1242 of file dialog_pad_properties.cpp.

References KIGFX::VIEW::Add(), PAD_CS_PRIMITIVE::ExportTo(), DRAWSEGMENT::GetCenter(), D_PAD::GetOrientation(), BOX2< Vec >::GetOrigin(), KIGFX::VIEW::GetPainter(), D_PAD::GetPosition(), KIGFX::VIEW::GetScale(), KIGFX::PAINTER::GetSettings(), BOX2< Vec >::GetSize(), EDA_DRAW_PANEL_GAL::GetView(), BOX2< Vec >::Inflate(), EDA_DRAW_FRAME::IsGalCanvasActive(), m_dummyPad, m_highligth, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, m_primitives, PAD_CS_PRIMITIVE::m_Radius, m_selectedColor, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Thickness, BOX2< Vec >::Move(), DRAWSEGMENT::Move(), EDA_DRAW_PANEL_GAL::Refresh(), DRAWSEGMENT::Rotate(), S_ARC, S_CIRCLE, S_POLYGON, S_SEGMENT, SELECTED_ITEMS_LAYER, KIGFX::VIEW::SetBoundary(), DRAWSEGMENT::SetEnd(), BOARD_ITEM::SetLayer(), KIGFX::RENDER_SETTINGS::SetLayerColor(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::SetTopLayer(), KIGFX::VIEW::SetViewport(), DRAWSEGMENT::SetWidth(), EDA_DRAW_PANEL_GAL::StartDrawing(), EDA_DRAW_PANEL_GAL::StopDrawing(), KIGFX::VIEW::Update(), D_PAD::ViewBBox(), wxPoint::x, VECTOR2< T >::x, and VECTOR2< T >::y.

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

1243 {
1244  if( m_parent->IsGalCanvasActive() )
1245  {
1248 
1249  // The layer used to place primitive items selected when editing custom pad shapes
1250  // we use here a layer never used in a pad:
1251  #define SELECTED_ITEMS_LAYER Dwgs_User
1252 
1254  KIGFX::PCB_RENDER_SETTINGS* settings =
1255  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
1257 
1258  view->Update( m_dummyPad );
1259 
1260  // delete previous items if highlight list
1261  while( m_highligth.size() )
1262  {
1263  delete m_highligth.back(); // the dtor also removes item from view
1264  m_highligth.pop_back();
1265  }
1266 
1267  // highlight selected primitives:
1268  long select = m_listCtrlPrimitives->GetFirstSelected();
1269 
1270  while( select >= 0 )
1271  {
1272  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
1273 
1274  DRAWSEGMENT* dummySegment = new DRAWSEGMENT;
1275  dummySegment->SetLayer( SELECTED_ITEMS_LAYER );
1276  primitive.ExportTo( dummySegment );
1277  dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
1278  dummySegment->Move( m_dummyPad->GetPosition() );
1279 
1280  // Update selected primitive (highligth selected)
1281  switch( primitive.m_Shape )
1282  {
1283  case S_SEGMENT:
1284  case S_ARC:
1285  break;
1286 
1287  case S_CIRCLE: // ring or circle
1288  if( primitive.m_Thickness == 0 ) // filled circle
1289  { // the filled circle option does not exist in a DRAWSEGMENT
1290  // but it is easy to create it with a circle having the
1291  // right radius and outline width
1292  wxPoint end = dummySegment->GetCenter();
1293  end.x += primitive.m_Radius/2;
1294  dummySegment->SetEnd( end );
1295  dummySegment->SetWidth( primitive.m_Radius );
1296  }
1297  break;
1298 
1299  case S_POLYGON:
1300  break;
1301 
1302  default:
1303  delete dummySegment;
1304  dummySegment = nullptr;
1305  break;
1306  }
1307 
1308  if( dummySegment )
1309  {
1310  view->Add( dummySegment );
1311  m_highligth.push_back( dummySegment );
1312  }
1313 
1314  select = m_listCtrlPrimitives->GetNextSelected( select );
1315  }
1316 
1317  BOX2I bbox = m_dummyPad->ViewBBox();
1318 
1319  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
1320  {
1321  // gives a size to the full drawable area
1322  BOX2I drawbox;
1323  drawbox.Move( m_dummyPad->GetPosition() );
1324  drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
1325  view->SetBoundary( drawbox );
1326 
1327  // Autozoom
1328  view->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
1329 
1330  // Add a margin
1331  view->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
1332 
1335  }
1336  }
1337  else
1338  {
1339  m_panelShowPad->Refresh();
1340  }
1341 }
const Vec & GetOrigin() const
Definition: box2.h:181
void Move(const Vec &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
Definition: box2.h:108
void SetViewport(const BOX2D &aViewport)
Function SetViewport() Sets the visible area of the VIEW.
Definition: view.cpp:511
virtual void Move(const wxPoint &aMoveVector) override
Function Move move this object.
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Function SetTopLayer() Sets given layer to be displayed on the top or sets back the default order of ...
Definition: view.cpp:727
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
const wxPoint GetCenter() const override
Function GetCenter()
void ExportTo(DRAWSEGMENT *aTarget)
Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT useful to draw a primitive shape...
polygon (not yet used for tracks, but could be in microwave apps)
BOX2< VECTOR2D > BOX2D
Definition: box2.h:469
usual segment : line with rounded ends
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
const Vec & GetSize() const
Definition: box2.h:177
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:247
void SetBoundary(const BOX2I &aBoundary)
Function SetBoundary() Sets limits for view area.
Definition: view.h:275
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
Definition: class_pad.cpp:1295
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Function SetLayerColor Changes the color used to draw a layer.
Definition: painter.h:217
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1382
STROKE_T m_Shape
Definition: class_pad.h:94
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:266
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
std::vector< PAD_CS_PRIMITIVE > m_primitives
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:375
std::vector< DRAWSEGMENT * > m_highligth
#define SELECTED_ITEMS_LAYER
void SetEnd(const wxPoint &aEnd)
double GetScale() const
Function GetScale()
Definition: view.h:265
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:309
Class VIEW.
Definition: view.h:58
const wxPoint GetPosition() const override
Definition: class_pad.h:220
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
void SetWidth(int aWidth)
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
Definition: DXF_plotter.cpp:61
void DIALOG_PAD_PROPERTIES::setPadLayersList ( LSET  layer_mask)
private

Function setPadLayersList updates the CheckBox states in pad layers list,.

Parameters
layer_mask= pad layer mask (ORed layers bit mask)

Definition at line 1041 of file dialog_pad_properties.cpp.

References LSET::AllCuMask(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, Dwgs_User, Eco1_User, Eco2_User, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, 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, and DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel.

Referenced by initValues(), and PadTypeSelected().

1042 {
1043  LSET cu_set = layer_mask & LSET::AllCuMask();
1044 
1045  if( cu_set == LSET( F_Cu ) )
1046  m_rbCopperLayersSel->SetSelection( 0 );
1047  else if( cu_set == LSET( B_Cu ) )
1048  m_rbCopperLayersSel->SetSelection( 1 );
1049  else if( cu_set.any() )
1050  m_rbCopperLayersSel->SetSelection( 2 );
1051  else
1052  m_rbCopperLayersSel->SetSelection( 3 );
1053 
1054  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
1055  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
1056 
1057  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
1058  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
1059 
1060  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
1061  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
1062 
1063  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
1064  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
1065 
1066  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
1067  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
1068 
1069  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
1070 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:673
Class LSET is a set of PCB_LAYER_IDs.
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 118 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), DIALOG_SHIM::IsQuasiModal(), DIALOG_LAYERS_SETUP::OnInitDialog(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

119 {
120  wxSize sz( x, y );
121  SetSize( ConvertDialogToPixels( sz ) );
122 }
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 146 of file dialog_shim.cpp.

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, max, wxPoint::x, and wxPoint::y.

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SHIM::IsQuasiModal(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_FOOTPRINTS::OnQuit(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), SCH_COMPONENT::SetPosition(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

147 {
148  bool ret;
149  const char* hash_key;
150 
151  if( m_hash_key.size() )
152  {
153  // a special case like EDA_LIST_DIALOG, which has multiple uses.
154  hash_key = m_hash_key.c_str();
155  }
156  else
157  {
158  hash_key = typeid(*this).name();
159  }
160 
161  // Show or hide the window. If hiding, save current position and size.
162  // If showing, use previous position and size.
163  if( show )
164  {
165 #ifndef __WINDOWS__
166  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
167 #endif
168  ret = wxDialog::Show( show );
169 
170  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
171  EDA_RECT savedDialogRect = class_map[ hash_key ];
172 
173  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
174  {
175  SetSize( savedDialogRect.GetPosition().x,
176  savedDialogRect.GetPosition().y,
177  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
178  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
179  0 );
180  }
181  }
182  else
183  {
184  // Save the dialog's position & size before hiding, using classname as key
185  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
186 
187 #ifdef __WXMAC__
188  if ( m_eventLoop )
189  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
190 #endif
191 
192  ret = wxDialog::Show( show );
193  }
194 
195  return ret;
196 }
const wxSize GetSize() const
Definition: eda_rect.h:101
std::string m_hash_key
Definition: dialog_shim.h:151
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:113
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 552 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), SCH_EDIT_FRAME::InstallHierarchyFrame(), InvokeDialogCreateBOMEditor(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

553 {
554  // This is an exception safe way to zero a pointer before returning.
555  // Yes, even though DismissModal() clears this first normally, this is
556  // here in case there's an exception before the dialog is dismissed.
557  struct NULLER
558  {
559  void*& m_what;
560  NULLER( void*& aPtr ) : m_what( aPtr ) {}
561  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
562  } clear_this( (void*&) m_qmodal_loop );
563 
564  // release the mouse if it's currently captured as the window having it
565  // will be disabled when this dialog is shown -- but will still keep the
566  // capture making it impossible to do anything in the modal dialog itself
567  wxWindow* win = wxWindow::GetCapture();
568  if( win )
569  win->ReleaseMouse();
570 
571  // Get the optimal parent
572  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
573 
574  // Show the optimal parent
575  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
576 
577  wxASSERT_MSG( !m_qmodal_parent_disabler,
578  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
579 
580  // quasi-modal: disable only my "optimal" parent
582 
583 #ifdef __WXMAC__
584  // Apple in its infinite wisdom will raise a disabled window before even passing
585  // us the event, so we have no way to stop it. Instead, we must set an order on
586  // the windows so that the quasi-modal will be pushed in front of the disabled
587  // window when it is raised.
588  ReparentQuasiModal();
589 #endif
590  Show( true );
591 
592  m_qmodal_showing = true;
593 
594  EVENT_LOOP event_loop;
595 
596  m_qmodal_loop = &event_loop;
597 
598  event_loop.Run();
599 
600  return GetReturnCode();
601 }
bool m_qmodal_showing
Definition: dialog_shim.h:155
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:154
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:156
Toggle a window&#39;s "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
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 1359 of file dialog_pad_properties.cpp.

References MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), D_PAD::DeletePrimitivesList(), DisplayError(), DO_NOT_DRAW, BOARD::FindNet(), FlipLayerMask(), D_PAD::FlipPrimitives(), D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), D_PAD::GetBoundingBox(), EDA_DRAW_FRAME::GetCanvas(), D_PAD::GetCustomShapeInZoneOpt(), D_PAD::GetDelta(), D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetLocalSolderPasteMargin(), D_PAD::GetLocalSolderPasteMarginRatio(), D_PAD::GetName(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetname(), D_PAD::GetOffset(), MODULE::GetOrientation(), D_PAD::GetOrientation(), D_PAD::GetPadToDieLength(), D_PAD::GetParent(), MODULE::GetPosition(), D_PAD::GetPosition(), D_PAD::GetPrimitives(), D_PAD::GetRoundRectRadiusRatio(), D_PAD::GetShape(), D_PAD::GetSize(), D_PAD::GetThermalGap(), D_PAD::GetThermalWidth(), D_PAD::GetZoneConnection(), m_board, m_currentPad, m_isFlipped, DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel, m_padMaster, DIALOG_PAD_PROPERTIES_BASE::m_PadNetNameCtrl, DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral, m_parent, BOARD::m_Status_Pcb, COMMIT::Modify(), PAD_ATTRIB_HOLE_NOT_PLATED, PAD_SHAPE_CUSTOM, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_ZONE_CONN_NONE, padValuesOK(), BOARD_COMMIT::Push(), EDA_DRAW_PANEL::RefreshDrawingRect(), RotatePoint(), D_PAD::SetAnchorPadShape(), D_PAD::SetAttribute(), D_PAD::SetCustomShapeInZoneOpt(), D_PAD::SetDelta(), D_PAD::SetDrillShape(), D_PAD::SetDrillSize(), EDA_ITEM::SetFlags(), MODULE::SetLastEditTime(), D_PAD::SetLayerSet(), D_PAD::SetLocalClearance(), D_PAD::SetLocalSolderMaskMargin(), D_PAD::SetLocalSolderPasteMargin(), D_PAD::SetLocalSolderPasteMarginRatio(), EDA_DRAW_FRAME::SetMsgPanel(), D_PAD::SetName(), BOARD_CONNECTED_ITEM::SetNetCode(), D_PAD::SetOffset(), D_PAD::SetOrientation(), D_PAD::SetPadToDieLength(), D_PAD::SetPos0(), D_PAD::SetPosition(), D_PAD::SetPrimitives(), D_PAD::SetRoundRectRadiusRatio(), D_PAD::SetShape(), D_PAD::SetSize(), D_PAD::SetThermalGap(), D_PAD::SetThermalWidth(), D_PAD::SetZoneConnection(), transferDataToPad(), NETINFO_LIST::UNCONNECTED, and wxPoint::y.

1360 {
1361  BOARD_COMMIT commit( m_parent );
1362 
1363  if( !wxDialog::TransferDataFromWindow() )
1364  return false;
1365 
1366  if( !m_panelGeneral->TransferDataFromWindow() )
1367  return false;
1368 
1369  if( !m_localSettingsPanel->TransferDataFromWindow() )
1370  return false;
1371 
1372  if( !padValuesOK() )
1373  return false;
1374 
1375  bool rastnestIsChanged = false;
1376  int isign = m_isFlipped ? -1 : 1;
1377 
1379  // m_padMaster is a pattern: ensure there is no net for this pad:
1381 
1382  if( !m_currentPad ) // Set current Pad parameters
1383  return true;
1384 
1385  commit.Modify( m_currentPad );
1386 
1387  // redraw the area where the pad was, without pad (delete pad on screen)
1391 
1392  // Update values
1395 
1397  {
1399  rastnestIsChanged = true;
1400  }
1401 
1402  wxSize size;
1403  MODULE* footprint = m_currentPad->GetParent();
1404 
1405  if( footprint )
1406  {
1407  footprint->SetLastEditTime();
1408 
1409  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
1410  // i.e. relative to footprint origin (footprint position)
1411  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
1412  RotatePoint( &pt, -footprint->GetOrientation() );
1413  m_currentPad->SetPos0( pt );
1415  + footprint->GetOrientation() );
1416  }
1417 
1419 
1420  size = m_padMaster->GetDelta();
1421  size.y *= isign;
1422  m_currentPad->SetDelta( size );
1423 
1426 
1427  wxPoint offset = m_padMaster->GetOffset();
1428  offset.y *= isign;
1429  m_currentPad->SetOffset( offset );
1430 
1432 
1435 
1436 
1439 
1440  if( m_isFlipped )
1441  {
1444  }
1445 
1447  {
1448  rastnestIsChanged = true;
1450  }
1451 
1452  if( m_isFlipped )
1453  {
1455  }
1456 
1458 
1459  wxString padNetname;
1460 
1461  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1463  padNetname = m_PadNetNameCtrl->GetValue();
1464 
1465  if( m_currentPad->GetNetname() != padNetname )
1466  {
1467  const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname );
1468 
1469  if( !padNetname.IsEmpty() && netinfo == NULL )
1470  {
1471  DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
1472  }
1473  else if( netinfo )
1474  {
1475  rastnestIsChanged = true;
1476  m_currentPad->SetNetCode( netinfo->GetNet() );
1477  }
1478  }
1479 
1487 
1490  else
1492 
1493 
1494  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1495  // So set the right shape (and perhaps issues with a radius = 0)
1498  {
1500  }
1501 
1502  // define the way the clearance area is defined in zones
1504 
1505  if( footprint )
1506  footprint->CalculateBoundingBox();
1507 
1509 
1510  // redraw the area where the pad was
1512 
1513  commit.Push( _( "Modify pad" ) );
1514 
1515  if( rastnestIsChanged ) // The net ratsnest must be recalculated
1516  m_board->m_Status_Pcb = 0;
1517 
1518  return true;
1519 }
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:226
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known.
Definition: lset.cpp:518
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:336
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:433
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
int GetPadToDieLength() const
Definition: class_pad.h:401
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:403
MODULE * GetParent() const
Definition: class_pad.h:162
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:319
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:381
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:274
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the...
Definition: class_pad.h:620
void SetLastEditTime(time_t aTime)
Definition: class_module.h:302
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
Pads are not covered.
Definition: zones.h:57
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:253
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:282
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:469
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:790
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12)...
Definition: class_pad.h:182
double GetOrientation() const
Definition: class_module.h:180
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:262
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:649
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:395
int GetThermalWidth() const
Definition: class_pad.cpp:660
int GetThermalGap() const
Definition: class_pad.cpp:671
void SetThermalWidth(int aWidth)
Definition: class_pad.h:472
const wxSize & GetSize() const
Definition: class_pad.h:269
void SetSize(const wxSize &aSize)
Definition: class_pad.h:268
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
const wxString & GetName() const
Definition: class_pad.h:190
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:409
void SetPadToDieLength(int aLength)
Definition: class_pad.h:400
int GetNet() const
Function GetNet.
Definition: netinfo.h:227
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:391
int GetLocalClearance() const
Definition: class_pad.h:406
void SetLocalClearance(int aClearance)
Definition: class_pad.h:407
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:412
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:413
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:394
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
const wxString & GetNetname() const
Function GetNetname.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:608
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:379
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:404
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:232
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:375
const wxSize & GetDelta() const
Definition: class_pad.h:272
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:217
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:400
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:283
bool padValuesOK()
test if all values are acceptable for the pad
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:410
void SetCustomShapeInZoneOpt(CUST_PAD_SHAPE_IN_ZONE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones. ...
Definition: class_pad.h:242
const wxPoint GetPosition() const override
Definition: class_pad.h:220
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:74
void SetThermalGap(int aGap)
Definition: class_pad.h:475
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:461
const wxPoint GetPosition() const override
Definition: class_module.h:175
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
void DeletePrimitivesList()
clear the basic shapes list
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_pad.cpp:198
const wxPoint & GetOffset() const
Definition: class_pad.h:278
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:139
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237
bool DIALOG_PAD_PROPERTIES::transferDataToPad ( D_PAD aPad)
private

Copy values from dialog field to aPad's members.

Definition at line 1522 of file dialog_pad_properties.cpp.

References LSET::AllCuMask(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, CHOICE_SHAPE_CUSTOM_RECT_ANCHOR, code_shape, code_type, CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL, CUST_PAD_SHAPE_IN_ZONE_OUTLINE, delta, DisplayError(), Dwgs_User, Eco1_User, Eco2_User, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, BOARD::FindNet(), D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), NETINFO_ITEM::GetNet(), D_PAD::GetShape(), D_PAD::GetSize(), m_board, DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl, DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel, DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceValueCtrl, m_OrientValidator, m_OrientValue, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Ctrl, 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_PadNetNameCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, DIALOG_PAD_PROPERTIES_BASE::m_PadType, DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral, m_primitives, DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel, DIALOG_PAD_PROPERTIES_BASE::m_ShapeDelta_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthCtrl, DIALOG_PAD_PROPERTIES_BASE::m_trapDeltaDirChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_ATTRIB_SMD, PAD_ATTRIB_STANDARD, PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, D_PAD::SetAnchorPadShape(), D_PAD::SetAttribute(), D_PAD::SetCustomShapeInZoneOpt(), D_PAD::SetDelta(), D_PAD::SetDrillShape(), D_PAD::SetDrillSize(), D_PAD::SetLayerSet(), D_PAD::SetLocalClearance(), D_PAD::SetLocalSolderMaskMargin(), D_PAD::SetLocalSolderPasteMargin(), D_PAD::SetLocalSolderPasteMarginRatio(), D_PAD::SetName(), BOARD_CONNECTED_ITEM::SetNetCode(), D_PAD::SetOffset(), D_PAD::SetOrientation(), D_PAD::SetPadToDieLength(), D_PAD::SetPos0(), D_PAD::SetPosition(), D_PAD::SetPrimitives(), D_PAD::SetRoundRectRadiusRatio(), D_PAD::SetShape(), D_PAD::SetSize(), D_PAD::SetThermalGap(), D_PAD::SetThermalWidth(), D_PAD::SetZoneConnection(), NETINFO_LIST::UNCONNECTED, and ValueFromTextCtrl().

Referenced by editPrimitive(), onAddPrimitive(), onCornerSizePercentChange(), onDeletePrimitive(), OnDrillShapeSelected(), onDuplicatePrimitive(), onGeometryTransform(), OnPadShapeSelection(), OnSetLayers(), OnValuesChanged(), PadOrientEvent(), padValuesOK(), and TransferDataFromWindow().

1523 {
1524  wxString msg;
1525  int x, y;
1526 
1527  if( !Validate() )
1528  return true;
1529  if( !m_panelGeneral->Validate() )
1530  return true;
1531  if( !m_localSettingsPanel->Validate() )
1532  return true;
1533 
1534  m_OrientValidator.TransferFromWindow();
1535 
1536  aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
1537  aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
1540 
1541  if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
1542  aPad->SetPrimitives( m_primitives );
1543 
1544  // Read pad clearances values:
1550  double dtmp = 0.0;
1551  msg = m_SolderPasteMarginRatioCtrl->GetValue();
1552  msg.ToDouble( &dtmp );
1553 
1554  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
1555  if( dtmp < -50.0 )
1556  dtmp = -50.0;
1557  // A margin ratio is always <= 0
1558  // 0 means use full pad copper area
1559  if( dtmp > 0.0 )
1560  dtmp = 0.0;
1561 
1562  aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
1563 
1564  switch( m_ZoneConnectionChoice->GetSelection() )
1565  {
1566  default:
1567  case 0:
1569  break;
1570 
1571  case 1:
1573  break;
1574 
1575  case 2:
1577  break;
1578 
1579  case 3:
1581  break;
1582  }
1583 
1584  // Read pad position:
1587 
1588  aPad->SetPosition( wxPoint( x, y ) );
1589  aPad->SetPos0( wxPoint( x, y ) );
1590 
1591  // Read pad drill:
1594 
1595  if( m_DrillShapeCtrl->GetSelection() == 0 )
1596  {
1598  y = x;
1599  }
1600  else
1602 
1603  aPad->SetDrillSize( wxSize( x, y ) );
1604 
1605  // Read pad shape size:
1608 
1609  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1610  y = x;
1611 
1612  // for custom shped pads, the pad size is the anchor pad size:
1613  if( aPad->GetShape() == PAD_SHAPE_CUSTOM && aPad->GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
1614  y = x;
1615 
1616  aPad->SetSize( wxSize( x, y ) );
1617 
1618  // Read pad length die
1620 
1621  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1622  // remember DeltaSize.x is the Y size variation
1623  bool error = false;
1624 
1625  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1626  {
1627  wxSize delta;
1628 
1629  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1630  // the direction.
1631  if( m_trapDeltaDirChoice->GetSelection() == 0 )
1632  delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1633  else
1634  delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1635 
1636  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1637  {
1638  delta.x = -aPad->GetSize().y + 2;
1639  error = true;
1640  }
1641 
1642  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1643  {
1644  delta.x = aPad->GetSize().y - 2;
1645  error = true;
1646  }
1647 
1648  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1649  {
1650  delta.y = -aPad->GetSize().x + 2;
1651  error = true;
1652  }
1653 
1654  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1655  {
1656  delta.y = aPad->GetSize().x - 2;
1657  error = true;
1658  }
1659 
1660  aPad->SetDelta( delta );
1661  }
1662 
1663  // Read pad shape offset:
1666  aPad->SetOffset( wxPoint( x, y ) );
1667 
1668  aPad->SetOrientation( m_OrientValue * 10.0 );
1669  aPad->SetName( m_PadNumCtrl->GetValue() );
1670 
1671  // Check if user has set an existing net name
1672  const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
1673 
1674  if( netinfo != NULL )
1675  aPad->SetNetCode( netinfo->GetNet() );
1676  else
1678 
1679  // Clear some values, according to the pad type and shape
1680  switch( aPad->GetShape() )
1681  {
1682  case PAD_SHAPE_CIRCLE:
1683  aPad->SetOffset( wxPoint( 0, 0 ) );
1684  aPad->SetDelta( wxSize( 0, 0 ) );
1685  x = aPad->GetSize().x;
1686  aPad->SetSize( wxSize( x, x ) );
1687  break;
1688 
1689  case PAD_SHAPE_RECT:
1690  aPad->SetDelta( wxSize( 0, 0 ) );
1691  break;
1692 
1693  case PAD_SHAPE_OVAL:
1694  aPad->SetDelta( wxSize( 0, 0 ) );
1695  break;
1696 
1697  case PAD_SHAPE_TRAPEZOID:
1698  break;
1699 
1700  case PAD_SHAPE_ROUNDRECT:
1701  aPad->SetDelta( wxSize( 0, 0 ) );
1702  break;
1703 
1704  case PAD_SHAPE_CUSTOM:
1705  aPad->SetOffset( wxPoint( 0, 0 ) );
1706  aPad->SetDelta( wxSize( 0, 0 ) );
1707 
1708  // The pad custom has a "anchor pad" (a basic shape: round or rect pad)
1709  // that is the minimal area of this pad, and is usefull to ensure a hole
1710  // diameter is acceptable, and is used in Gerber files as flashed area
1711  // reference
1712  if( aPad->GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
1713  {
1714  x = aPad->GetSize().x;
1715  aPad->SetSize( wxSize( x, x ) );
1716  }
1717 
1718  // define the way the clearance area is defined in zones
1719  aPad->SetCustomShapeInZoneOpt( m_ZoneCustomPadShape->GetSelection() == 0 ?
1722 
1723  break;
1724 
1725  default:
1726  ;
1727  }
1728 
1729  switch( aPad->GetAttribute() )
1730  {
1731  case PAD_ATTRIB_STANDARD:
1732  break;
1733 
1734  case PAD_ATTRIB_CONN:
1735  case PAD_ATTRIB_SMD:
1736  // SMD and PAD_ATTRIB_CONN has no hole.
1737  // basically, SMD and PAD_ATTRIB_CONN are same type of pads
1738  // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD
1739  // and are intended to be used in virtual edge board connectors
1740  // However we can accept a non null offset,
1741  // mainly to allow complex pads build from a set of basic pad shapes
1742  aPad->SetDrillSize( wxSize( 0, 0 ) );
1743  break;
1744 
1746  // Mechanical purpose only:
1747  // no offset, no net name, no pad name allowed
1748  aPad->SetOffset( wxPoint( 0, 0 ) );
1749  aPad->SetName( wxEmptyString );
1751  break;
1752 
1753  default:
1754  DisplayError( NULL, wxT( "Error: unknown pad type" ) );
1755  break;
1756  }
1757 
1758  if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT )
1759  {
1760  wxString value = m_tcCornerSizeRatio->GetValue();
1761  double rrRadiusRatioPercent;
1762 
1763  if( value.ToDouble( &rrRadiusRatioPercent ) )
1764  aPad->SetRoundRectRadiusRatio( rrRadiusRatioPercent / 100.0 );
1765  }
1766 
1767  LSET padLayerMask;
1768 
1769  switch( m_rbCopperLayersSel->GetSelection() )
1770  {
1771  case 0:
1772  padLayerMask.set( F_Cu );
1773  break;
1774 
1775  case 1:
1776  padLayerMask.set( B_Cu );
1777  break;
1778 
1779  case 2:
1780  padLayerMask |= LSET::AllCuMask();
1781  break;
1782 
1783  case 3: // No copper layers
1784  break;
1785  }
1786 
1787  if( m_PadLayerAdhCmp->GetValue() )
1788  padLayerMask.set( F_Adhes );
1789 
1790  if( m_PadLayerAdhCu->GetValue() )
1791  padLayerMask.set( B_Adhes );
1792 
1793  if( m_PadLayerPateCmp->GetValue() )
1794  padLayerMask.set( F_Paste );
1795 
1796  if( m_PadLayerPateCu->GetValue() )
1797  padLayerMask.set( B_Paste );
1798 
1799  if( m_PadLayerSilkCmp->GetValue() )
1800  padLayerMask.set( F_SilkS );
1801 
1802  if( m_PadLayerSilkCu->GetValue() )
1803  padLayerMask.set( B_SilkS );
1804 
1805  if( m_PadLayerMaskCmp->GetValue() )
1806  padLayerMask.set( F_Mask );
1807 
1808  if( m_PadLayerMaskCu->GetValue() )
1809  padLayerMask.set( B_Mask );
1810 
1811  if( m_PadLayerECO1->GetValue() )
1812  padLayerMask.set( Eco1_User );
1813 
1814  if( m_PadLayerECO2->GetValue() )
1815  padLayerMask.set( Eco2_User );
1816 
1817  if( m_PadLayerDraft->GetValue() )
1818  padLayerMask.set( Dwgs_User );
1819 
1820  aPad->SetLayerSet( padLayerMask );
1821 
1822  return error;
1823 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:673
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:226
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:61
wxFloatingPointValidator< double > m_OrientValidator
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:274
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the...
Definition: class_pad.h:620
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
static const int delta[8][2]
Definition: solve.cpp:112
static PAD_SHAPE_T code_shape[]
Pads are not covered.
Definition: zones.h:57
static PAD_ATTR_T code_type[]
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:253
Class LSET is a set of PCB_LAYER_IDs.
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:469
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12)...
Definition: class_pad.h:182
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:262
void SetThermalWidth(int aWidth)
Definition: class_pad.h:472
const wxSize & GetSize() const
Definition: class_pad.h:269
void SetSize(const wxSize &aSize)
Definition: class_pad.h:268
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetPadToDieLength(int aLength)
Definition: class_pad.h:400
int GetNet() const
Function GetNet.
Definition: netinfo.h:227
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:385
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:62
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:391
void SetLocalClearance(int aClearance)
Definition: class_pad.h:407
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:413
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:394
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
std::vector< PAD_CS_PRIMITIVE > m_primitives
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:379
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:404
Usual pad.
Definition: pad_shapes.h:60
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:217
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:400
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:410
void SetCustomShapeInZoneOpt(CUST_PAD_SHAPE_IN_ZONE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones. ...
Definition: class_pad.h:242
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:74
void SetThermalGap(int aGap)
Definition: class_pad.h:475
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:461
Use thermal relief for pads.
Definition: zones.h:58
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
pads are covered by copper
Definition: zones.h:59
bool DIALOG_PAD_PROPERTIES::TransferDataToWindow ( )
overrideprivate

Definition at line 1344 of file dialog_pad_properties.cpp.

References DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel, and DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral.

Referenced by DIALOG_PAD_PROPERTIES().

1345 {
1346  if( !wxDialog::TransferDataToWindow() )
1347  return false;
1348 
1349  if( !m_panelGeneral->TransferDataToWindow() )
1350  return false;
1351 
1352  if( !m_localSettingsPanel->TransferDataToWindow() )
1353  return false;
1354 
1355  return true;
1356 }
void DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues ( )
private

Definition at line 428 of file dialog_pad_properties.cpp.

References Format(), g_UserUnit, D_PAD::GetRoundRectCornerRadius(), D_PAD::GetRoundRectRadiusRatio(), D_PAD::GetShape(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerRadiusValue, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, and StringFromValue().

Referenced by initValues(), OnPadShapeSelection(), and OnValuesChanged().

429 {
430  // Note:
431  // To avoid generating a wxEVT_TEXT event from m_tcCornerSizeRatio
432  // we use ChangeValue instead of SetValue, to set the displayed string
434  {
435  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
439  }
440  else if( m_dummyPad->GetShape() == PAD_SHAPE_RECT )
441  {
442  m_tcCornerSizeRatio->ChangeValue( "0" );
443  m_staticTextCornerRadiusValue->SetLabel( "0" );
444  }
445  else
446  {
447  m_tcCornerSizeRatio->ChangeValue( wxEmptyString );
448  m_staticTextCornerRadiusValue->SetLabel( wxEmptyString );
449  }
450 }
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:204
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:511
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:608
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 132 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_SHIM::IsQuasiModal(), and DIALOG_LAYERS_SETUP::OnInitDialog().

133 {
134  wxSize sz( 0, y );
135  return ConvertDialogToPixels( sz ).y;
136 }

Member Data Documentation

KIGFX::ORIGIN_VIEWITEM* DIALOG_PAD_PROPERTIES::m_axisOrigin
private

Definition at line 69 of file dialog_pad_properties.h.

Referenced by prepareCanvas(), and ~DIALOG_PAD_PROPERTIES().

BOARD* DIALOG_PAD_PROPERTIES::m_board
private
wxBoxSizer* DIALOG_PAD_PROPERTIES_BASE::m_bSizerPanelPrimitives
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonAddShape
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonDel
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonDup
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonEditShape
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonGeometry
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonImport
protectedinherited
bool DIALOG_PAD_PROPERTIES::m_canEditNetName
private

Definition at line 82 of file dialog_pad_properties.h.

Referenced by initValues(), and PadTypeSelected().

bool DIALOG_PAD_PROPERTIES::m_canUpdate
private
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline
protectedinherited
D_PAD* DIALOG_PAD_PROPERTIES::m_currentPad
private
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_customOrientUnits
protectedinherited
bool DIALOG_PAD_PROPERTIES::m_drawPadOutlineMode = false
staticprivate
bool DIALOG_SHIM::m_fixupsRun
protectedinherited

Definition at line 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

wxStaticBitmap* DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningIcon
protectedinherited
wxBoxSizer* DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningSizer
protectedinherited
KIGFX::GAL_DISPLAY_OPTIONS DIALOG_PAD_PROPERTIES_BASE::m_galOptions
protectedinherited
std::string DIALOG_SHIM::m_hash_key
protectedinherited
std::vector<DRAWSEGMENT*> DIALOG_PAD_PROPERTIES::m_highligth
private

Definition at line 89 of file dialog_pad_properties.h.

Referenced by redraw().

bool DIALOG_PAD_PROPERTIES::m_isFlipped
private

Definition at line 79 of file dialog_pad_properties.h.

Referenced by initValues(), and TransferDataFromWindow().

TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel
protectedinherited