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)
 
void OnInitDialog (wxInitDialogEvent &event) override
 
 ~DIALOG_PAD_PROPERTIES ()
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
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 FixOSXCancelButtonIssue ()
 A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms. 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
 
wxTextCtrl * m_PadPosition_X_Ctrl
 
wxStaticText * m_PadPosX_Unit
 
wxStaticText * m_staticText41
 
wxTextCtrl * m_PadPosition_Y_Ctrl
 
wxStaticText * m_PadPosY_Unit
 
wxStaticText * m_staticText12
 
wxTextCtrl * m_ShapeSize_X_Ctrl
 
wxStaticText * m_PadShapeSizeX_Unit
 
wxStaticText * m_staticText15
 
wxTextCtrl * m_ShapeSize_Y_Ctrl
 
wxStaticText * m_PadShapeSizeY_Unit
 
wxStaticText * m_PadOrientText
 
wxChoice * m_PadOrient
 
wxStaticText * m_staticText491
 
wxTextCtrl * m_PadOrientCtrl
 
wxStaticText * m_customOrientUnits
 
wxStaticText * m_staticText17
 
wxTextCtrl * m_ShapeOffset_X_Ctrl
 
wxStaticText * m_PadShapeOffsetX_Unit
 
wxStaticText * m_staticText19
 
wxTextCtrl * m_ShapeOffset_Y_Ctrl
 
wxStaticText * m_PadShapeOffsetY_Unit
 
wxStaticText * m_staticText38
 
wxTextCtrl * m_LengthPadToDieCtrl
 
wxStaticText * m_PadLengthDie_Unit
 
wxStaticLine * m_staticline4
 
wxStaticLine * m_staticline5
 
wxStaticLine * m_staticline6
 
wxStaticText * m_staticText21
 
wxTextCtrl * m_ShapeDelta_Ctrl
 
wxStaticText * m_PadShapeDelta_Unit
 
wxStaticText * m_staticText23
 
wxChoice * m_trapDeltaDirChoice
 
wxStaticLine * m_staticline7
 
wxStaticLine * m_staticline8
 
wxStaticLine * m_staticline9
 
wxStaticText * m_staticTextCornerSizeRatio
 
wxTextCtrl * m_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
 
wxTextCtrl * m_PadDrill_X_Ctrl
 
wxStaticText * m_PadDrill_X_Unit
 
wxStaticText * m_textPadDrillY
 
wxTextCtrl * m_PadDrill_Y_Ctrl
 
wxStaticText * m_PadDrill_Y_Unit
 
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
 
wxStaticText * m_staticTitleModuleRot
 
wxStaticText * m_staticModuleRotValue
 
wxStaticText * m_staticTitleModuleSide
 
wxStaticText * m_staticModuleSideValue
 
wxPanel * m_localSettingsPanel
 
wxStaticText * m_staticTextNetClearance
 
wxTextCtrl * m_NetClearanceValueCtrl
 
wxStaticText * m_NetClearanceUnits
 
wxStaticText * m_MaskClearanceTitle
 
wxTextCtrl * m_SolderMaskMarginCtrl
 
wxStaticText * m_SolderMaskMarginUnits
 
wxStaticText * m_staticTextSolderPaste
 
wxTextCtrl * m_SolderPasteMarginCtrl
 
wxStaticText * m_SolderPasteMarginUnits
 
wxStaticText * m_staticTextRatio
 
wxTextCtrl * m_SolderPasteMarginRatioCtrl
 
wxStaticText * m_SolderPasteRatioMarginUnits
 
wxStaticText * m_staticText40
 
wxChoice * m_ZoneConnectionChoice
 
wxStaticText * m_staticText53
 
wxStaticText * m_staticText49
 
wxTextCtrl * m_ThermalWidthCtrl
 
wxStaticText * m_ThermalWidthUnits
 
wxStaticText * m_staticText52
 
wxTextCtrl * m_ThermalGapCtrl
 
wxStaticText * m_ThermalGapUnits
 
wxStaticText * m_staticTextWarning
 
wxPanel * m_panelShowPad
 
PCB_DRAW_PANEL_GALm_panelShowPadGal
 
KIGFX::GAL_DISPLAY_OPTIONS m_galOptions
 
wxStaticText * m_staticTextWarningPadFlipped
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
std::string m_hash_key
 
EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void initValues ()
 
bool padValuesOK ()
 test if all values are acceptable for the pad More...
 
void redraw ()
 
void updateRoundRectCornerValues ()
 
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 OnResize (wxSizeEvent &event)
 
void OnPadShapeSelection (wxCommandEvent &event) override
 
void OnDrillShapeSelected (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
 

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
 
wxFloatingPointValidator< double > m_OrientValidator
 
double m_OrientValue
 

Detailed Description

class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder

Definition at line 55 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 101 of file dialog_pad_properties.cpp.

References KIGFX::VIEW::Add(), KIGFX::ORIGIN_VIEWITEM::CROSS, DIALOG_SHIM::FinishDialogSettings(), EDA_DRAW_PANEL_GAL::GetBackend(), PCB_BASE_FRAME::GetBoard(), BOARD::GetColorsSettings(), PCB_BASE_FRAME::GetDesignSettings(), EDA_DRAW_FRAME::GetGalCanvas(), D_PAD::GetPosition(), EDA_DRAW_PANEL_GAL::GetView(), initValues(), EDA_DRAW_FRAME::IsGalCanvasActive(), m_axisOrigin, m_board, m_canUpdate, m_currentPad, m_dummyPad, m_OrientValidator, BOARD_DESIGN_SETTINGS::m_Pad_Master, m_padMaster, DIALOG_PAD_PROPERTIES_BASE::m_PadOrientCtrl, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerOK, OnResize(), KIGFX::ORIGIN_VIEWITEM::SetDrawAtZero(), EDA_DRAW_PANEL_GAL::StartDrawing(), PCB_DRAW_PANEL_GAL::SwitchBackend(), TransferDataToWindow(), and PCB_DRAW_PANEL_GAL::UseColorScheme().

101  :
102  DIALOG_PAD_PROPERTIES_BASE( aParent ),
104 {
105  m_canUpdate = false;
106  m_parent = aParent;
107  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
108  // from the footprint editor to set default pad setup
109 
111 
112  m_OrientValidator.SetRange( -360.0, 360.0 );
113  m_PadOrientCtrl->SetValidator( m_OrientValidator );
114  m_OrientValidator.SetWindow( m_PadOrientCtrl );
115 
117  m_dummyPad = new D_PAD( (MODULE*) NULL );
118 
119  if( aPad )
120  *m_dummyPad = *aPad;
121  else // We are editing a "master" pad, i.e. a template to create new pads
123 
124  // Show the X and Y axis. It is usefull because pad shape can have an offset
125  // or be a complex shape.
126  m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D(0.0, 0.0, 0.8, 1.0),
128  Millimeter2iu( 0.2 ),
130  m_axisOrigin->SetDrawAtZero( true );
131 
132  if( m_parent->IsGalCanvasActive() )
133  {
136  m_panelShowPadGal->Show();
137  m_panelShowPad->Hide();
141  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
142  }
143  else
144  {
145  m_panelShowPad->Show();
146  m_panelShowPadGal->Hide();
147  }
148 
149  initValues();
151 
152  m_sdbSizerOK->SetDefault();
153  m_canUpdate = true;
154 
155  // Now all widgets have the size fixed, call FinishDialogSettings
157 }
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
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
bool TransferDataToWindow() override
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
void SetDrawAtZero(bool aDrawFlag)
Function SetDrawAtZero() Set the draw at zero flag.
COLORS_DESIGN_SETTINGS * GetColorsSettings() const
Function GetColorSettings.
Definition: class_board.h:561
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:795
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
void UseColorScheme(const COLORS_DESIGN_SETTINGS *aSettings)
Function UseColorScheme Applies layer color settings.
bool SwitchBackend(GAL_TYPE aGalType) override
Function SwitchBackend Switches method of rendering graphics.
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(785, 659), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER)
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:803
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:311
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES ( )
inline

Definition at line 60 of file dialog_pad_properties.h.

References m_axisOrigin, and m_dummyPad.

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

Member Function Documentation

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 182 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues().

183 {
184  // so we can do logging of this state change:
185 
186 #if defined(DEBUG)
187  const char* type_id = typeid( *this ).name();
188  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
189 #endif
190 
191  return wxDialog::Enable( enable );
192 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 540 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 HK_PROMPT_DIALOG::EndFlexible(), 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_MODULE::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

541 {
542  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
543  // handle validation in the same way as other dialogs.
544  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
545  return;
546 
547  SetReturnCode( retCode );
548 
549  if( !IsQuasiModal() )
550  {
551  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
552  return;
553  }
554 
555  m_qmodal_showing = false;
556 
557  if( m_qmodal_loop )
558  {
559  if( m_qmodal_loop->IsRunning() )
560  m_qmodal_loop->Exit( 0 );
561  else
562  m_qmodal_loop->ScheduleExit( 0 );
563 
564  m_qmodal_loop = NULL;
565  }
566 
569 
570  Show( false );
571 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool IsQuasiModal()
Definition: dialog_shim.h:93
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
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 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_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), 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_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_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(), 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(), DialogEditModuleText::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_MODULE_MODULE_EDITOR::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_MODULE_BOARD_EDITOR::OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), and DIALOG_SIGNAL_LIST::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 }
void DIALOG_SHIM::FixOSXCancelButtonIssue ( )
protectedinherited

A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.

Definition at line 117 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::Show().

118 {
119 #ifdef __WXMAC__
120  // A ugly hack to fix an issue on OSX: ctrl+c closes the dialog instead of
121  // copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer
122  // created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority
123  // to copy text standard accelerator, and the dlg is closed when trying to copy text
124  wxButton* button = dynamic_cast< wxButton* > ( wxWindow::FindWindowById( wxID_CANCEL, this ) );
125 
126  if( button )
127  button->SetLabel( _( "Cancel" ) );
128 #endif
129 }
void DIALOG_PAD_PROPERTIES::initValues ( )
private

Definition at line 319 of file dialog_pad_properties.cpp.

References PNS::angle(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, CHOICE_SHAPE_CIRCLE, CHOICE_SHAPE_OVAL, CHOICE_SHAPE_RECT, CHOICE_SHAPE_ROUNDRECT, CHOICE_SHAPE_TRAPEZOID, code_type, DIM, Dwgs_User, Eco1_User, Eco2_User, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, FlipLayerMask(), FRAME_PCB, g_UserUnit, GetAbbreviatedUnitsLabel(), D_PAD::GetAttribute(), 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(), BOARD_CONNECTED_ITEM::GetNetname(), D_PAD::GetOffset(), MODULE::GetOrientation(), D_PAD::GetOrientation(), MODULE::GetOrientationDegrees(), D_PAD::GetPadName(), D_PAD::GetPadToDieLength(), D_PAD::GetParent(), D_PAD::GetPosition(), D_PAD::GetShape(), D_PAD::GetSize(), D_PAD::GetThermalGap(), D_PAD::GetThermalWidth(), D_PAD::GetZoneConnection(), D_PAD::IsFlipped(), EDA_BASE_FRAME::IsType(), m_board, m_canEditNetName, m_currentPad, DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, m_dummyPad, 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, 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_staticTextWarningPadFlipped, 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, NORMALIZE_ANGLE_180(), OnDrillShapeSelected(), OnPadShapeSelection(), PAD_ATTRIB_HOLE_NOT_PLATED, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CIRCLE, 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().

320 {
321  wxString msg;
322  double angle;
323 
324  // Disable pad net name wxTextCtrl if the caller is the footprint editor
325  // because nets are living only in the board managed by the board editor
327 
328 
329  // Setup layers names from board
330  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
331  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
332  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
333 
334  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
335  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
337  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
339  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
340  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
341  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
342  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
343  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
345 
346  m_isFlipped = false;
347 
348  if( m_currentPad )
349  {
351 
352  if( m_isFlipped )
353  m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
354 
355  // Diplay footprint rotation ( angles are in 0.1 degree )
356  MODULE* footprint = m_currentPad->GetParent();
357 
358  if( footprint )
359  msg.Printf( "%.1f", footprint->GetOrientationDegrees() );
360  else
361  msg = _("No footprint" );
362 
363  m_staticModuleRotValue->SetLabel( msg );
364  }
365 
366  if( m_isFlipped )
367  {
368  wxPoint pt = m_dummyPad->GetOffset();
369  pt.y = -pt.y;
370  m_dummyPad->SetOffset( pt );
371 
372  wxSize sz = m_dummyPad->GetDelta();
373  sz.y = -sz.y;
374  m_dummyPad->SetDelta( sz );
375 
376  // flip pad's layers
378  }
379 
381 
382  m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
383  m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
384 
385  // Set the unit name in dialog:
386  wxStaticText* unitTexts[] =
387  {
395  };
396 
397  for( unsigned ii = 0; ii < DIM( unitTexts ); ++ii )
398  unitTexts[ii]->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
399 
400  // Display current pad parameters units:
403 
406 
409 
412 
413  if( m_dummyPad->GetDelta().x )
414  {
416  m_trapDeltaDirChoice->SetSelection( 0 );
417  }
418  else
419  {
421  m_trapDeltaDirChoice->SetSelection( 1 );
422  }
423 
425 
430 
431  // These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
433 
435  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
436 
437  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
438 
439  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
440  // Sometimes Printf adds a sign if the value is small
441  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
442  else
443  m_SolderPasteMarginRatioCtrl->SetValue( msg );
444 
445  switch( m_dummyPad->GetZoneConnection() )
446  {
447  default:
449  m_ZoneConnectionChoice->SetSelection( 0 );
450  break;
451 
452  case PAD_ZONE_CONN_FULL:
453  m_ZoneConnectionChoice->SetSelection( 1 );
454  break;
455 
457  m_ZoneConnectionChoice->SetSelection( 2 );
458  break;
459 
460  case PAD_ZONE_CONN_NONE:
461  m_ZoneConnectionChoice->SetSelection( 3 );
462  break;
463  }
464 
465  if( m_currentPad )
466  {
467  angle = m_currentPad->GetOrientation();
468  MODULE* footprint = m_currentPad->GetParent();
469 
470  if( footprint )
471  angle -= footprint->GetOrientation();
472 
473  if( m_isFlipped )
474  angle = -angle;
475 
476  m_dummyPad->SetOrientation( angle );
477  }
478 
479  angle = m_dummyPad->GetOrientation();
480 
481  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
482 
483  // Set layers used by this pad: :
485 
486  // Pad Orient
487  switch( int( angle ) )
488  {
489  case 0:
490  m_PadOrient->SetSelection( 0 );
491  break;
492 
493  case 900:
494  m_PadOrient->SetSelection( 1 );
495  break;
496 
497  case -900:
498  m_PadOrient->SetSelection( 2 );
499  break;
500 
501  case 1800:
502  case -1800:
503  m_PadOrient->SetSelection( 3 );
504  break;
505 
506  default:
507  m_PadOrient->SetSelection( 4 );
508  break;
509  }
510 
511  switch( m_dummyPad->GetShape() )
512  {
513  default:
514  case PAD_SHAPE_CIRCLE:
515  m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE );
516  break;
517 
518  case PAD_SHAPE_OVAL:
519  m_PadShape->SetSelection( CHOICE_SHAPE_OVAL );
520  break;
521 
522  case PAD_SHAPE_RECT:
523  m_PadShape->SetSelection( CHOICE_SHAPE_RECT );
524  break;
525 
526  case PAD_SHAPE_TRAPEZOID:
527  m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID );
528  break;
529 
530  case PAD_SHAPE_ROUNDRECT:
531  m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT );
532  break;
533  }
534 
535  m_OrientValue = angle / 10.0;
536 
537  // Type of pad selection
538  m_PadType->SetSelection( 0 );
539 
540  for( unsigned ii = 0; ii < DIM( code_type ); ii++ )
541  {
542  if( code_type[ii] == m_dummyPad->GetAttribute() )
543  {
544  m_PadType->SetSelection( ii );
545  break;
546  }
547  }
548 
549  // Enable/disable Pad name,and pad length die
550  // (disable for NPTH pads (mechanical pads)
552 
553  m_PadNumCtrl->Enable( enable );
554  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
555  m_LengthPadToDieCtrl->Enable( enable );
556 
558  m_DrillShapeCtrl->SetSelection( 0 );
559  else
560  m_DrillShapeCtrl->SetSelection( 1 );
561 
562  // Update some dialog widgets state (Enable/disable options):
563  wxCommandEvent cmd_event;
565  OnDrillShapeSelected( cmd_event );
566  OnPadShapeSelection( cmd_event );
568 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
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:491
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:238
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:63
int GetPadToDieLength() const
Definition: class_pad.h:241
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:243
MODULE * GetParent() const
Definition: class_pad.h:108
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:221
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:292
const wxSize & GetDrillSize() const
Definition: class_pad.h:188
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
Pads are not covered.
Definition: zones.h:57
static PAD_ATTR_T code_type[]
double GetOrientationDegrees() const
Definition: class_module.h:149
double GetOrientation() const
Definition: class_module.h:148
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:479
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:610
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:235
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:621
void OnPadShapeSelection(wxCommandEvent &event) override
int GetThermalGap() const
Definition: class_pad.cpp:632
const wxSize & GetSize() const
Definition: class_pad.h:182
void OnDrillShapeSelected(wxCommandEvent &event) override
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:249
bool IsFlipped() const
Definition: class_pad.cpp:124
int GetLocalClearance() const
Definition: class_pad.h:246
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:252
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:265
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:234
const wxString & GetNetname() const
Function GetNetname.
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:214
const wxSize & GetDelta() const
Definition: class_pad.h:185
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:357
wxString GetPadName() const
Definition: class_pad.cpp:433
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:216
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:190
Use thermal relief for pads.
Definition: zones.h:58
const wxPoint & GetOffset() const
Definition: class_pad.h:191
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:184
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.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), 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(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), LIB_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallModuleOptionsFrame(), KIWAY_PLAYER::language_change(), SCH_SHEET::Load(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), 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::ReadNetListAndLinkFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), 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(), and DIALOG_EXCHANGE_MODULE::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::onCornerSizePercentChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 288 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().

289 {
291  return;
292 
293  wxString value = m_tcCornerSizeRatio->GetValue();
294  double rrRadiusRatioPercent;
295 
296  if( value.ToDouble( &rrRadiusRatioPercent ) )
297  {
298  // Clamp rrRadiusRatioPercent to acceptable value (0.0 to 50.0)
299  if( rrRadiusRatioPercent < 0.0 )
300  {
301  rrRadiusRatioPercent = 0.0;
302  m_tcCornerSizeRatio->ChangeValue( "0.0" );
303  }
304 
305  if( rrRadiusRatioPercent > 50.0 )
306  {
307  rrRadiusRatioPercent = 0.5;
308  m_tcCornerSizeRatio->ChangeValue( "50.0" );
309  }
310 
314  redraw();
315  }
316 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad'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:203
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:351
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 636 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().

637 {
638  if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
639  {
640  // pad type = SMD or CONN: no hole allowed
641  m_PadDrill_X_Ctrl->Enable( false );
642  m_PadDrill_Y_Ctrl->Enable( false );
643  }
644  else
645  {
646  switch( m_DrillShapeCtrl->GetSelection() )
647  {
648  case 0: //CIRCLE:
649  m_PadDrill_X_Ctrl->Enable( true );
650  m_PadDrill_Y_Ctrl->Enable( false );
651  break;
652 
653  case 1: //OVALE:
654  m_PadDrill_X_Ctrl->Enable( true );
655  m_PadDrill_Y_Ctrl->Enable( true );
656  break;
657  }
658  }
659 
661  redraw();
662 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
void DIALOG_PAD_PROPERTIES::OnInitDialog ( wxInitDialogEvent &  event)
overridevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 159 of file dialog_pad_properties.cpp.

References DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl.

160 {
161  m_PadNumCtrl->SetFocus();
162  m_PadNumCtrl->SetSelection( -1, -1 );
163 }
void DIALOG_PAD_PROPERTIES::OnPadShapeSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 578 of file dialog_pad_properties.cpp.

References CHOICE_SHAPE_CIRCLE, CHOICE_SHAPE_OVAL, CHOICE_SHAPE_RECT, CHOICE_SHAPE_ROUNDRECT, CHOICE_SHAPE_TRAPEZOID, Format(), D_PAD::GetRoundRectRadiusRatio(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, 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_trapDeltaDirChoice, redraw(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by initValues().

579 {
580  switch( m_PadShape->GetSelection() )
581  {
582  case CHOICE_SHAPE_CIRCLE:
583  m_ShapeDelta_Ctrl->Enable( false );
584  m_trapDeltaDirChoice->Enable( false );
585  m_ShapeSize_Y_Ctrl->Enable( false );
586  m_ShapeOffset_X_Ctrl->Enable( false );
587  m_ShapeOffset_Y_Ctrl->Enable( false );
588  break;
589 
590  case CHOICE_SHAPE_OVAL:
591  m_ShapeDelta_Ctrl->Enable( false );
592  m_trapDeltaDirChoice->Enable( false );
593  m_ShapeSize_Y_Ctrl->Enable( true );
594  m_ShapeOffset_X_Ctrl->Enable( true );
595  m_ShapeOffset_Y_Ctrl->Enable( true );
596  break;
597 
598  case CHOICE_SHAPE_RECT:
599  m_ShapeDelta_Ctrl->Enable( false );
600  m_trapDeltaDirChoice->Enable( false );
601  m_ShapeSize_Y_Ctrl->Enable( true );
602  m_ShapeOffset_X_Ctrl->Enable( true );
603  m_ShapeOffset_Y_Ctrl->Enable( true );
604  break;
605 
607  m_ShapeDelta_Ctrl->Enable( true );
608  m_trapDeltaDirChoice->Enable( true );
609  m_ShapeSize_Y_Ctrl->Enable( true );
610  m_ShapeOffset_X_Ctrl->Enable( true );
611  m_ShapeOffset_Y_Ctrl->Enable( true );
612  break;
613 
615  m_ShapeDelta_Ctrl->Enable( false );
616  m_trapDeltaDirChoice->Enable( false );
617  m_ShapeSize_Y_Ctrl->Enable( true );
618  m_ShapeOffset_X_Ctrl->Enable( true );
619  m_ShapeOffset_Y_Ctrl->Enable( true );
620  // Ensure m_tcCornerSizeRatio contains the right value:
621  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
623  break;
624  }
625 
626  // A few widgets are enabled only for rounded rect pads:
627  m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT );
628 
630 
632  redraw();
633 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:450
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_PAD_PROPERTIES::OnPaintShowPanel ( wxPaintEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 165 of file dialog_pad_properties.cpp.

References abs, B_Cu, BLACK, color, DARKGRAY, D_PAD::DrawShape(), F_Cu, D_PAD::GetAttribute(), D_PAD::GetBoundingRadius(), D_PAD::GetDelta(), D_PAD::GetDrillSize(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetPosition(), D_PAD::GetShape(), D_PAD::GetSize(), BOARD::GetVisibleElementColor(), GRLine(), GRResetPenAndBrush(), LAYER_PAD_BK, LAYER_PAD_FR, LIGHTBLUE, LIGHTGRAY, m_board, PAD_DRAWINFO::m_Color, PAD_DRAWINFO::m_Display_netname, PAD_DRAWINFO::m_Display_padnum, m_dummyPad, PAD_DRAWINFO::m_HoleColor, PAD_DRAWINFO::m_Offset, PAD_DRAWINFO::m_PadClearance, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, PAD_DRAWINFO::m_ShowNotPlatedHole, min, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_SHAPE_CIRCLE, and scale.

166 {
167  wxPaintDC dc( m_panelShowPad );
168  PAD_DRAWINFO drawInfo;
169 
171 
172  if( m_dummyPad->GetLayerSet()[F_Cu] )
173  {
175  }
176 
177  if( m_dummyPad->GetLayerSet()[B_Cu] )
178  {
179  color = color.LegacyMix( m_board->GetVisibleElementColor( LAYER_PAD_BK ) );
180  }
181 
182  // What could happen: the pad color is *actually* black, or no
183  // copper was selected
184  if( color == BLACK )
185  color = LIGHTGRAY;
186 
187  drawInfo.m_Color = color;
188  drawInfo.m_HoleColor = DARKGRAY;
189  drawInfo.m_Offset = m_dummyPad->GetPosition();
190  drawInfo.m_Display_padnum = true;
191  drawInfo.m_Display_netname = true;
192 
194  drawInfo.m_ShowNotPlatedHole = true;
195 
196  // Shows the local pad clearance
198 
199  wxSize dc_size = dc.GetSize();
200  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
201 
202  // Calculate a suitable scale to fit the available draw area
203  int dim = m_dummyPad->GetBoundingRadius() *2;
204 
205  // Invalid x size. User could enter zero, or have deleted all text prior to
206  // entering a new value; this is also treated as zero. If dim is left at
207  // zero, the drawing scale is zero and we get a crash.
208  if( dim == 0 )
209  {
210  // If drill size has been set, use that. Otherwise default to 1mm.
211  dim = m_dummyPad->GetDrillSize().x;
212  if( dim == 0 )
213  dim = Millimeter2iu( 1.0 );
214  }
215 
216  if( m_dummyPad->GetLocalClearance() > 0 )
217  dim += m_dummyPad->GetLocalClearance() * 2;
218 
219  double scale = (double) dc_size.x / dim;
220 
221  // If the pad is a circle, use the x size here instead.
222  int ysize;
224  ysize = m_dummyPad->GetSize().x;
225  else
226  ysize = m_dummyPad->GetSize().y;
227 
228  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
229 
230  // Invalid y size. See note about x size above.
231  if( dim == 0 )
232  {
233  dim = m_dummyPad->GetDrillSize().y;
234  if( dim == 0 )
235  dim = Millimeter2iu( 0.1 );
236  }
237 
238  if( m_dummyPad->GetLocalClearance() > 0 )
239  dim += m_dummyPad->GetLocalClearance() * 2;
240 
241  double altscale = (double) dc_size.y / dim;
242  scale = std::min( scale, altscale );
243 
244  // Give a margin
245  scale *= 0.7;
246  dc.SetUserScale( scale, scale );
247 
248  GRResetPenAndBrush( &dc );
249  m_dummyPad->DrawShape( NULL, &dc, drawInfo );
250 
251  // Draw X and Y axis. Hhis is particularly useful to show the
252  // reference position of pads with offset and no hole, or custom pad shapes
253  const int linethickness = 0;
254  GRLine( NULL, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0,
255  linethickness, LIGHTBLUE ); // X axis
256  GRLine( NULL, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ),
257  linethickness, LIGHTBLUE ); // Y axis
258 
259  event.Skip();
260 }
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:196
bool m_Display_padnum
Definition: class_pad.h:66
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:238
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:63
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
COLOR4D GetVisibleElementColor(GAL_LAYER_ID LAYER_aPCB)
Function GetVisibleElementColor returns the color of a pcb visible element.
const wxSize & GetDrillSize() const
Definition: class_pad.h:188
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
#define abs(a)
Definition: auxiliary.h:84
smd pads, back layer
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:428
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
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:235
COLOR4D m_HoleColor
Definition: class_pad.h:62
const wxSize & GetSize() const
Definition: class_pad.h:182
bool m_ShowNotPlatedHole
Definition: class_pad.h:71
void DrawShape(EDA_RECT *aClipBox, wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
Function DrawShape basic function to draw a pad.
int m_PadClearance
Definition: class_pad.h:64
int GetLocalClearance() const
Definition: class_pad.h:246
wxPoint m_Offset
Definition: class_pad.h:74
const int scale
smd pads, front layer
const wxSize & GetDelta() const
Definition: class_pad.h:185
COLOR4D m_Color
Definition: class_pad.h:60
Definition: colors.h:45
bool m_Display_netname
Definition: class_pad.h:67
#define min(a, b)
Definition: auxiliary.h:85
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void DIALOG_PAD_PROPERTIES::OnResize ( wxSizeEvent &  event)
private

Definition at line 571 of file dialog_pad_properties.cpp.

References redraw().

Referenced by DIALOG_PAD_PROPERTIES().

572 {
573  redraw();
574  event.Skip();
575 }
void DIALOG_PAD_PROPERTIES::OnSetLayers ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 758 of file dialog_pad_properties.cpp.

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

759 {
761  redraw();
762 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad'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 1349 of file dialog_pad_properties.cpp.

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

1350 {
1351  if( m_canUpdate )
1352  {
1354  // If the pad size has changed, update the displayed values
1355  // for rounded rect pads
1357 
1358  redraw();
1359  }
1360 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
void DIALOG_PAD_PROPERTIES::PadOrientEvent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 665 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().

666 {
667  switch( m_PadOrient->GetSelection() )
668  {
669  case 0:
671  break;
672 
673  case 1:
674  m_dummyPad->SetOrientation( 900 );
675  break;
676 
677  case 2:
678  m_dummyPad->SetOrientation( -900 );
679  break;
680 
681  case 3:
682  m_dummyPad->SetOrientation( 1800 );
683  break;
684 
685  default:
686  break;
687  }
688 
690  m_OrientValidator.TransferToWindow();
691 
693  redraw();
694 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad'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:214
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:357
void DIALOG_PAD_PROPERTIES::PadTypeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 697 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().

698 {
699  unsigned ii = m_PadType->GetSelection();
700 
701  if( ii >= DIM( code_type ) ) // catches < 0 also
702  ii = 0;
703 
704  LSET layer_mask = std_pad_layers[ii];
705  setPadLayersList( layer_mask );
706 
707  // Enable/disable drill dialog items:
708  event.SetId( m_DrillShapeCtrl->GetSelection() );
709  OnDrillShapeSelected( event );
710 
711  if( ii == 0 || ii == DIM( code_type )-1 )
712  m_DrillShapeCtrl->Enable( true );
713  else
714  m_DrillShapeCtrl->Enable( false );
715 
716  // Enable/disable Pad name,and pad length die
717  // (disable for NPTH pads (mechanical pads)
718  bool enable = ii != 3;
719  m_PadNumCtrl->Enable( enable );
720  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
721  m_LengthPadToDieCtrl->Enable( enable );
722 }
#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 766 of file dialog_pad_properties.cpp.

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

Referenced by TransferDataFromWindow().

767 {
768  bool error = transferDataToPad( m_dummyPad );
769  bool skip_tstoffset = false; // the offset prm is not always tested
770 
771  wxArrayString error_msgs;
772  wxString msg;
773 
774  // Test for incorrect values
775  if( (m_dummyPad->GetSize().x <= 0) ||
776  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
777  {
778  error_msgs.Add( _( "Pad size must be greater than zero" ) );
779  }
780 
781  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
782  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
783  {
784  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
785  skip_tstoffset = true; // offset prm will be not tested because if the drill value
786  // is incorrect the offset prm is always seen as incorrect, even if it is 0
787  }
788 
789  LSET padlayers_mask = m_dummyPad->GetLayerSet();
790 
791  if( padlayers_mask == 0 )
792  error_msgs.Add( _( "Error: pad has no layer" ) );
793 
794  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
795  {
797  {
798  // Note: he message is shown in an HTML window
799  msg = _( "Error: the pad is not on a copper layer and has a hole" );
800 
802  {
803  msg += wxT( "<br><br><i>" );
804  msg += _( "For NPTH pad, set pad size value to pad drill value,"
805  " if you do not want this pad plotted in gerber files"
806  );
807  }
808 
809  error_msgs.Add( msg );
810  }
811  }
812 
813  if( !skip_tstoffset )
814  {
815  wxPoint max_size;
816  max_size.x = std::abs( m_dummyPad->GetOffset().x );
817  max_size.y = std::abs( m_dummyPad->GetOffset().y );
818  max_size.x += m_dummyPad->GetDrillSize().x / 2;
819  max_size.y += m_dummyPad->GetDrillSize().y / 2;
820 
821  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
822  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
823  {
824  error_msgs.Add( _( "Incorrect value for pad offset" ) );
825  }
826  }
827 
828  if( error )
829  {
830  error_msgs.Add( _( "Too large value for pad delta size" ) );
831  }
832 
833  switch( m_dummyPad->GetAttribute() )
834  {
835  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
836  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
837  if( m_dummyPad->GetDrillSize().x <= 0 )
838  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
839  break;
840 
841  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
842  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
843  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
844  "Use SMD pads instead" ) );
845  // Fall trough
846  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
847  {
848  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
849 
850  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
851  innerlayers_mask.count() != 0 )
852  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
853  }
854  break;
855  }
856 
857 
859  {
860  wxString value = m_tcCornerSizeRatio->GetValue();
861  double rrRadiusRatioPercent;
862 
863  if( !value.ToDouble( &rrRadiusRatioPercent ) )
864  error_msgs.Add( _( "Incorrect corner size value" ) );
865  else
866  {
867  if( rrRadiusRatioPercent < 0.0 )
868  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
869  else if( rrRadiusRatioPercent > 50.0 )
870  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
871  }
872  }
873 
874  if( error_msgs.GetCount() )
875  {
876  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
877  dlg.ListSet( error_msgs );
878  dlg.ShowModal();
879  }
880 
881  return error_msgs.GetCount() == 0;
882 }
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:238
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:63
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:59
const wxSize & GetDrillSize() const
Definition: class_pad.h:188
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
#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:235
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:599
const wxSize & GetSize() const
Definition: class_pad.h:182
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:60
Usual pad.
Definition: pad_shapes.h:58
const wxPoint & GetOffset() const
Definition: class_pad.h:191
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::AnnotateComponents(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), LIB_VIEW_FRAME::BestZoom(), DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_MODULE_MODULE_EDITOR::Cfg3DPath(), DIALOG_MODULE_BOARD_EDITOR::Cfg3DPath(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_SCREEN::CheckComponentsToPartsLinks(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), SCH_EDIT_FRAME::CreateArchiveLibrary(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), LIB_EDIT_FRAME::DeleteOnePart(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG(), DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE(), DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR(), DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName(), DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), LIB_EDIT_FRAME::GetCurPart(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), FOOTPRINT_EDIT_FRAME::getLibPath(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_EDIT_FRAME::InstallConfigFrame(), SCH_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), DIALOG_BOM_EDITOR::LoadComponents(), CVPCB_MAINFRAME::LoadFootprintFiles(), SCH_EDIT_FRAME::LoadOneEEFile(), LIB_EDIT_FRAME::LoadOneLibraryPart(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), LIB_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), DIALOG_NETLIST::OnSaveMessagesToFile(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectIcLib(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OnSelectUnit(), DIALOG_SPICE_MODEL::onSemiSelectLib(), 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(), SCH_EDIT_FRAME::prepareForNetlist(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndLinkFiles(), 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(), SCH_EDIT_FRAME::RescueProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_SCREEN::Save(), LIB_EDIT_FRAME::SaveActiveLibrary(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_ERC::TestErc(), DIALOG_SPICE_MODEL::updateFromFile(), SIM_PLOT_FRAME::updateNetlistExporter(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR(), and DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_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:144
void DIALOG_PAD_PROPERTIES::redraw ( )
private

Definition at line 885 of file dialog_pad_properties.cpp.

References EDA_DRAW_FRAME::GetGalCanvas(), BOX2< Vec >::GetOrigin(), D_PAD::GetPosition(), KIGFX::VIEW::GetScale(), BOX2< Vec >::GetSize(), EDA_DRAW_PANEL_GAL::GetView(), BOX2< Vec >::Inflate(), EDA_DRAW_FRAME::IsGalCanvasActive(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, BOX2< Vec >::Move(), EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::VIEW::SetBoundary(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::SetViewport(), KIGFX::VIEW::Update(), D_PAD::ViewBBox(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by onCornerSizePercentChange(), OnDrillShapeSelected(), OnPadShapeSelection(), OnResize(), OnSetLayers(), OnValuesChanged(), and PadOrientEvent().

886 {
887  if( m_parent->IsGalCanvasActive() )
888  {
890 
891  BOX2I bbox = m_dummyPad->ViewBBox();
892 
893  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
894  {
895  // gives a size to the full drawable area
896  BOX2I drawbox;
897  drawbox.Move( m_dummyPad->GetPosition() );
898  drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
899  m_panelShowPadGal->GetView()->SetBoundary( drawbox );
900 
901  // Autozoom
902  m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
903 
904  // Add a margin
906 
908  }
909  }
910  else
911  {
912  m_panelShowPad->Refresh();
913  }
914 }
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:513
BOX2< VECTOR2D > BOX2D
Definition: box2.h:469
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
virtual const BOX2I ViewBBox() const override
Definition: class_pad.cpp:1238
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:795
void Update(VIEW_ITEM *aItem)
Function Update() For dynamic VIEWs, informs the associated VIEW that the graphical representation of...
Definition: view.cpp:1379
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
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
double GetScale() const
Function GetScale()
Definition: view.h:265
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:803
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(), 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
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 725 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().

726 {
727  LSET cu_set = layer_mask & LSET::AllCuMask();
728 
729  if( cu_set == LSET( F_Cu ) )
730  m_rbCopperLayersSel->SetSelection( 0 );
731  else if( cu_set == LSET( B_Cu ) )
732  m_rbCopperLayersSel->SetSelection( 1 );
733  else if( cu_set.any() )
734  m_rbCopperLayersSel->SetSelection( 2 );
735  else
736  m_rbCopperLayersSel->SetSelection( 3 );
737 
738  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
739  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
740 
741  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
742  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
743 
744  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
745  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
746 
747  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
748  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
749 
750  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
751  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
752 
753  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
754 }
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:639
Class LSET is a set of PCB_LAYER_IDs.
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 139 of file dialog_shim.cpp.

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

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_MODULE::OnQuit(), CVPCB_MAINFRAME::ReadNetListAndLinkFiles(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

140 {
141  bool ret;
142  const char* hash_key;
143 
144  if( m_hash_key.size() )
145  {
146  // a special case like EDA_LIST_DIALOG, which has multiple uses.
147  hash_key = m_hash_key.c_str();
148  }
149  else
150  {
151  hash_key = typeid(*this).name();
152  }
153 
154  // Show or hide the window. If hiding, save current position and size.
155  // If showing, use previous position and size.
156  if( show )
157  {
158  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
159  ret = wxDialog::Show( show );
160 
161  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
162  EDA_RECT r = class_map[ hash_key ];
163 
164  if( r.GetSize().x != 0 && r.GetSize().y != 0 )
165  SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
166  }
167  else
168  {
169  // Save the dialog's position & size before hiding, using classname as key
170  EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
171  class_map[ hash_key ] = r;
172 
173  ret = wxDialog::Show( show );
174  }
175 
177 
178  return ret;
179 }
std::string m_hash_key
Definition: dialog_shim.h:128
void FixOSXCancelButtonIssue()
A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.
static RECT_MAP class_map
const wxPoint & GetPosition() const
Class EDA_RECT handles the component boundary box.
const wxSize & GetSize() const
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 495 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 LIB_EDIT_FRAME::DeleteOnePart(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), LIB_VIEW_FRAME::OnSelectSymbol(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

496 {
497  // This is an exception safe way to zero a pointer before returning.
498  // Yes, even though DismissModal() clears this first normally, this is
499  // here in case there's an exception before the dialog is dismissed.
500  struct NULLER
501  {
502  void*& m_what;
503  NULLER( void*& aPtr ) : m_what( aPtr ) {}
504  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
505  } clear_this( (void*&) m_qmodal_loop );
506 
507  // release the mouse if it's currently captured as the window having it
508  // will be disabled when this dialog is shown -- but will still keep the
509  // capture making it impossible to do anything in the modal dialog itself
510  wxWindow* win = wxWindow::GetCapture();
511  if( win )
512  win->ReleaseMouse();
513 
514  // Get the optimal parent
515  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
516 
517  // Show the optimal parent
518  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
519 
520  wxASSERT_MSG( !m_qmodal_parent_disabler,
521  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
522 
523  // quasi-modal: disable only my "optimal" parent
525 
526  Show( true );
527 
528  m_qmodal_showing = true;
529 
530  EVENT_LOOP event_loop;
531 
532  m_qmodal_loop = &event_loop;
533 
534  event_loop.Run();
535 
536  return GetReturnCode();
537 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
Toggle a window'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 932 of file dialog_pad_properties.cpp.

References MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), DisplayError(), DO_NOT_DRAW, BOARD::FindNet(), FlipLayerMask(), D_PAD::GetAttribute(), D_PAD::GetBoundingBox(), EDA_DRAW_FRAME::GetCanvas(), D_PAD::GetDelta(), D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetLocalSolderPasteMargin(), D_PAD::GetLocalSolderPasteMarginRatio(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetname(), D_PAD::GetOffset(), MODULE::GetOrientation(), D_PAD::GetOrientation(), D_PAD::GetPadName(), D_PAD::GetPadToDieLength(), D_PAD::GetParent(), MODULE::GetPosition(), D_PAD::GetPosition(), 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_RECT, PAD_SHAPE_ROUNDRECT, padValuesOK(), BOARD_COMMIT::Push(), EDA_DRAW_PANEL::RefreshDrawingRect(), RotatePoint(), D_PAD::SetAttribute(), 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(), BOARD_CONNECTED_ITEM::SetNetCode(), D_PAD::SetOffset(), D_PAD::SetOrientation(), D_PAD::SetPadName(), D_PAD::SetPadToDieLength(), D_PAD::SetPos0(), D_PAD::SetPosition(), 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.

933 {
934  BOARD_COMMIT commit( m_parent );
935 
936  if( !wxDialog::TransferDataFromWindow() )
937  return false;
938 
939  if( !m_panelGeneral->TransferDataFromWindow() )
940  return false;
941 
942  if( !m_localSettingsPanel->TransferDataFromWindow() )
943  return false;
944 
945  if( !padValuesOK() )
946  return false;
947 
948  bool rastnestIsChanged = false;
949  int isign = m_isFlipped ? -1 : 1;
950 
952  // m_padMaster is a pattern: ensure there is no net for this pad:
954 
955  if( !m_currentPad ) // Set current Pad parameters
956  return true;
957 
958  commit.Modify( m_currentPad );
959 
960  // redraw the area where the pad was, without pad (delete pad on screen)
964 
965  // Update values
968 
970  {
972  rastnestIsChanged = true;
973  }
974 
975  wxSize size;
976  MODULE* footprint = m_currentPad->GetParent();
977 
978  if( footprint )
979  {
980  footprint->SetLastEditTime();
981 
982  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
983  // i.e. relative to footprint origin (footprint position)
984  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
985  RotatePoint( &pt, -footprint->GetOrientation() );
986  m_currentPad->SetPos0( pt );
988  + footprint->GetOrientation() );
989  }
990 
992 
993  size = m_padMaster->GetDelta();
994  size.y *= isign;
995  m_currentPad->SetDelta( size );
996 
999 
1000  wxPoint offset = m_padMaster->GetOffset();
1001  offset.y *= isign;
1002  m_currentPad->SetOffset( offset );
1003 
1005 
1007  {
1008  rastnestIsChanged = true;
1010  }
1011 
1012  if( m_isFlipped )
1013  {
1015  }
1016 
1018 
1019  wxString padNetname;
1020 
1021  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1023  padNetname = m_PadNetNameCtrl->GetValue();
1024 
1025  if( m_currentPad->GetNetname() != padNetname )
1026  {
1027  const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname );
1028 
1029  if( !padNetname.IsEmpty() && netinfo == NULL )
1030  {
1031  DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
1032  }
1033  else if( netinfo )
1034  {
1035  rastnestIsChanged = true;
1036  m_currentPad->SetNetCode( netinfo->GetNet() );
1037  }
1038  }
1039 
1048 
1049  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1050  // So set the right shape (and perhaps issues with a radius = 0)
1053  {
1055  }
1056 
1057  footprint->CalculateBoundingBox();
1059 
1060  // redraw the area where the pad was
1062 
1063  commit.Push( _( "Modify pad" ) );
1064 
1065  if( rastnestIsChanged ) // The net ratsnest must be recalculated
1066  m_board->m_Status_Pcb = 0;
1067 
1068  return true;
1069 }
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:491
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:238
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:63
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
int GetPadToDieLength() const
Definition: class_pad.h:241
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
const wxPoint & GetPosition() const override
Definition: class_module.h:144
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:243
MODULE * GetParent() const
Definition: class_pad.h:108
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:169
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:306
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:221
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:187
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
const wxSize & GetDrillSize() const
Definition: class_pad.h:188
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:462
void SetLastEditTime(time_t aTime)
Definition: class_module.h:270
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:309
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:754
double GetOrientation() const
Definition: class_module.h:148
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:175
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:610
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:235
int GetThermalWidth() const
Definition: class_pad.cpp:621
int GetThermalGap() const
Definition: class_pad.cpp:632
void SetThermalWidth(int aWidth)
Definition: class_pad.h:312
const wxSize & GetSize() const
Definition: class_pad.h:182
void SetSize(const wxSize &aSize)
Definition: class_pad.h:181
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:249
void SetPadToDieLength(int aLength)
Definition: class_pad.h:240
int GetNet() const
Function GetNet.
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:348
int GetLocalClearance() const
Definition: class_pad.h:246
void SetLocalClearance(int aClearance)
Definition: class_pad.h:247
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:252
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:253
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:234
Class NETINFO_ITEM handles the data for a net.
const wxString & GetNetname() const
Function GetNetname.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:450
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:218
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:244
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:214
const wxSize & GetDelta() const
Definition: class_pad.h:185
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:167
void SetPadName(const wxString &name)
Set the pad name (sometimes called pad number, although it can be an array ref like AA12 the pad name...
Definition: class_pad.cpp:455
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:357
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
bool padValuesOK()
test if all values are acceptable for the pad
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:250
wxString GetPadName() const
Definition: class_pad.cpp:433
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:190
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
void SetThermalGap(int aGap)
Definition: class_pad.h:315
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_pad.cpp:181
const wxPoint & GetOffset() const
Definition: class_pad.h:191
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:125
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:184
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
bool DIALOG_PAD_PROPERTIES::transferDataToPad ( D_PAD aPad)
private

Copy values from dialog field to aPad's members.

Definition at line 1072 of file dialog_pad_properties.cpp.

References LSET::AllCuMask(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, code_shape, code_type, delta, DisplayError(), Dwgs_User, Eco1_User, Eco2_User, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, BOARD::FindNet(), 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, 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, 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_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::SetAttribute(), D_PAD::SetDelta(), D_PAD::SetDrillShape(), D_PAD::SetDrillSize(), D_PAD::SetLayerSet(), D_PAD::SetLocalClearance(), D_PAD::SetLocalSolderMaskMargin(), D_PAD::SetLocalSolderPasteMargin(), D_PAD::SetLocalSolderPasteMarginRatio(), BOARD_CONNECTED_ITEM::SetNetCode(), D_PAD::SetOffset(), D_PAD::SetOrientation(), D_PAD::SetPadName(), D_PAD::SetPadToDieLength(), D_PAD::SetPos0(), D_PAD::SetPosition(), 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 onCornerSizePercentChange(), OnDrillShapeSelected(), OnPadShapeSelection(), OnSetLayers(), OnValuesChanged(), PadOrientEvent(), padValuesOK(), and TransferDataFromWindow().

1073 {
1074  wxString msg;
1075  int x, y;
1076 
1077  if( !Validate() )
1078  return true;
1079  if( !m_panelGeneral->Validate() )
1080  return true;
1081  if( !m_localSettingsPanel->Validate() )
1082  return true;
1083 
1084  m_OrientValidator.TransferFromWindow();
1085 
1086  aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
1087  aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
1088 
1089 
1090  // Read pad clearances values:
1096  double dtmp = 0.0;
1097  msg = m_SolderPasteMarginRatioCtrl->GetValue();
1098  msg.ToDouble( &dtmp );
1099 
1100  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
1101  if( dtmp < -50.0 )
1102  dtmp = -50.0;
1103  // A margin ratio is always <= 0
1104  // 0 means use full pad copper area
1105  if( dtmp > 0.0 )
1106  dtmp = 0.0;
1107 
1108  aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
1109 
1110  switch( m_ZoneConnectionChoice->GetSelection() )
1111  {
1112  default:
1113  case 0:
1115  break;
1116 
1117  case 1:
1119  break;
1120 
1121  case 2:
1123  break;
1124 
1125  case 3:
1127  break;
1128  }
1129 
1130  // Read pad position:
1133 
1134  aPad->SetPosition( wxPoint( x, y ) );
1135  aPad->SetPos0( wxPoint( x, y ) );
1136 
1137  // Read pad drill:
1140 
1141  if( m_DrillShapeCtrl->GetSelection() == 0 )
1142  {
1144  y = x;
1145  }
1146  else
1148 
1149  aPad->SetDrillSize( wxSize( x, y ) );
1150 
1151  // Read pad shape size:
1154 
1155  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1156  y = x;
1157 
1158  aPad->SetSize( wxSize( x, y ) );
1159 
1160  // Read pad length die
1162 
1163  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1164  // remember DeltaSize.x is the Y size variation
1165  bool error = false;
1166 
1167  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1168  {
1169  wxSize delta;
1170 
1171  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1172  // the direction.
1173  if( m_trapDeltaDirChoice->GetSelection() == 0 )
1174  delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1175  else
1176  delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1177 
1178  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1179  {
1180  delta.x = -aPad->GetSize().y + 2;
1181  error = true;
1182  }
1183 
1184  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1185  {
1186  delta.x = aPad->GetSize().y - 2;
1187  error = true;
1188  }
1189 
1190  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1191  {
1192  delta.y = -aPad->GetSize().x + 2;
1193  error = true;
1194  }
1195 
1196  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1197  {
1198  delta.y = aPad->GetSize().x - 2;
1199  error = true;
1200  }
1201 
1202  aPad->SetDelta( delta );
1203  }
1204 
1205  // Read pad shape offset:
1208  aPad->SetOffset( wxPoint( x, y ) );
1209 
1210  aPad->SetOrientation( m_OrientValue * 10.0 );
1211 
1212  msg = m_PadNumCtrl->GetValue().Left( 4 );
1213  aPad->SetPadName( msg );
1214 
1215  // Check if user has set an existing net name
1216  const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
1217 
1218  if( netinfo != NULL )
1219  aPad->SetNetCode( netinfo->GetNet() );
1220  else
1222 
1223  // Clear some values, according to the pad type and shape
1224  switch( aPad->GetShape() )
1225  {
1226  case PAD_SHAPE_CIRCLE:
1227  aPad->SetOffset( wxPoint( 0, 0 ) );
1228  aPad->SetDelta( wxSize( 0, 0 ) );
1229  x = aPad->GetSize().x;
1230  aPad->SetSize( wxSize( x, x ) );
1231  break;
1232 
1233  case PAD_SHAPE_RECT:
1234  aPad->SetDelta( wxSize( 0, 0 ) );
1235  break;
1236 
1237  case PAD_SHAPE_OVAL:
1238  aPad->SetDelta( wxSize( 0, 0 ) );
1239  break;
1240 
1241  case PAD_SHAPE_TRAPEZOID:
1242  break;
1243 
1244  case PAD_SHAPE_ROUNDRECT:
1245  aPad->SetDelta( wxSize( 0, 0 ) );
1246  break;
1247 
1248  default:
1249  ;
1250  }
1251 
1252  switch( aPad->GetAttribute() )
1253  {
1254  case PAD_ATTRIB_STANDARD:
1255  break;
1256 
1257  case PAD_ATTRIB_CONN:
1258  case PAD_ATTRIB_SMD:
1259  // SMD and PAD_ATTRIB_CONN has no hole.
1260  // basically, SMD and PAD_ATTRIB_CONN are same type of pads
1261  // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD
1262  // and are intended to be used in virtual edge board connectors
1263  // However we can accept a non null offset,
1264  // mainly to allow complex pads build from a set of basic pad shapes
1265  aPad->SetDrillSize( wxSize( 0, 0 ) );
1266  break;
1267 
1269  // Mechanical purpose only:
1270  // no offset, no net name, no pad name allowed
1271  aPad->SetOffset( wxPoint( 0, 0 ) );
1272  aPad->SetPadName( wxEmptyString );
1274  break;
1275 
1276  default:
1277  DisplayError( NULL, wxT( "Error: unknown pad type" ) );
1278  break;
1279  }
1280 
1281  if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT )
1282  {
1283  wxString value = m_tcCornerSizeRatio->GetValue();
1284  double rrRadiusRatioPercent;
1285 
1286  if( value.ToDouble( &rrRadiusRatioPercent ) )
1287  aPad->SetRoundRectRadiusRatio( rrRadiusRatioPercent / 100.0 );
1288  }
1289 
1290  LSET padLayerMask;
1291 
1292  switch( m_rbCopperLayersSel->GetSelection() )
1293  {
1294  case 0:
1295  padLayerMask.set( F_Cu );
1296  break;
1297 
1298  case 1:
1299  padLayerMask.set( B_Cu );
1300  break;
1301 
1302  case 2:
1303  padLayerMask |= LSET::AllCuMask();
1304  break;
1305 
1306  case 3: // No copper layers
1307  break;
1308  }
1309 
1310  if( m_PadLayerAdhCmp->GetValue() )
1311  padLayerMask.set( F_Adhes );
1312 
1313  if( m_PadLayerAdhCu->GetValue() )
1314  padLayerMask.set( B_Adhes );
1315 
1316  if( m_PadLayerPateCmp->GetValue() )
1317  padLayerMask.set( F_Paste );
1318 
1319  if( m_PadLayerPateCu->GetValue() )
1320  padLayerMask.set( B_Paste );
1321 
1322  if( m_PadLayerSilkCmp->GetValue() )
1323  padLayerMask.set( F_SilkS );
1324 
1325  if( m_PadLayerSilkCu->GetValue() )
1326  padLayerMask.set( B_SilkS );
1327 
1328  if( m_PadLayerMaskCmp->GetValue() )
1329  padLayerMask.set( F_Mask );
1330 
1331  if( m_PadLayerMaskCu->GetValue() )
1332  padLayerMask.set( B_Mask );
1333 
1334  if( m_PadLayerECO1->GetValue() )
1335  padLayerMask.set( Eco1_User );
1336 
1337  if( m_PadLayerECO2->GetValue() )
1338  padLayerMask.set( Eco2_User );
1339 
1340  if( m_PadLayerDraft->GetValue() )
1341  padLayerMask.set( Dwgs_User );
1342 
1343  aPad->SetLayerSet( padLayerMask );
1344 
1345  return error;
1346 }
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:639
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:238
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:63
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:59
wxFloatingPointValidator< double > m_OrientValidator
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:169
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:187
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:462
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
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[]
Class LSET is a set of PCB_LAYER_IDs.
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:309
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:175
void SetThermalWidth(int aWidth)
Definition: class_pad.h:312
const wxSize & GetSize() const
Definition: class_pad.h:182
void SetSize(const wxSize &aSize)
Definition: class_pad.h:181
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetPadToDieLength(int aLength)
Definition: class_pad.h:240
int GetNet() const
Function GetNet.
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:384
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:60
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:348
void SetLocalClearance(int aClearance)
Definition: class_pad.h:247
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:253
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:234
Class NETINFO_ITEM handles the data for a net.
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:218
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:244
Usual pad.
Definition: pad_shapes.h:58
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:167
void SetPadName(const wxString &name)
Set the pad name (sometimes called pad number, although it can be an array ref like AA12 the pad name...
Definition: class_pad.cpp:455
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:357
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:250
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:190
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
void SetThermalGap(int aGap)
Definition: class_pad.h:315
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Use thermal relief for pads.
Definition: zones.h:58
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:184
pads are covered by copper
Definition: zones.h:59
bool DIALOG_PAD_PROPERTIES::TransferDataToWindow ( )
overrideprivate

Definition at line 917 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().

918 {
919  if( !wxDialog::TransferDataToWindow() )
920  return false;
921 
922  if( !m_panelGeneral->TransferDataToWindow() )
923  return false;
924 
925  if( !m_localSettingsPanel->TransferDataToWindow() )
926  return false;
927 
928  return true;
929 }
void DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues ( )
private

Definition at line 263 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().

264 {
265  // Note:
266  // To avoid generating a wxEVT_TEXT event from m_tcCornerSizeRatio
267  // we use ChangeValue instead of SetValue, to set the displayed string
269  {
270  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
274  }
275  else if( m_dummyPad->GetShape() == PAD_SHAPE_RECT )
276  {
277  m_tcCornerSizeRatio->ChangeValue( "0" );
278  m_staticTextCornerRadiusValue->SetLabel( "0" );
279  }
280  else
281  {
282  m_tcCornerSizeRatio->ChangeValue( wxEmptyString );
283  m_staticTextCornerRadiusValue->SetLabel( wxEmptyString );
284  }
285 }
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:203
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:351
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
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:450
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

Member Data Documentation

KIGFX::ORIGIN_VIEWITEM* DIALOG_PAD_PROPERTIES::m_axisOrigin
private

Definition at line 68 of file dialog_pad_properties.h.

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

BOARD* DIALOG_PAD_PROPERTIES::m_board
private
bool DIALOG_PAD_PROPERTIES::m_canEditNetName
private

Definition at line 81 of file dialog_pad_properties.h.

Referenced by initValues(), and PadTypeSelected().

bool DIALOG_PAD_PROPERTIES::m_canUpdate
private

Definition at line 80 of file dialog_pad_properties.h.

Referenced by DIALOG_PAD_PROPERTIES(), and OnValuesChanged().

D_PAD* DIALOG_PAD_PROPERTIES::m_currentPad
private
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_customOrientUnits
protectedinherited
KIGFX::GAL_DISPLAY_OPTIONS DIALOG_PAD_PROPERTIES_BASE::m_galOptions
protectedinherited
std::string DIALOG_SHIM::m_hash_key
protectedinherited
bool DIALOG_PAD_PROPERTIES::m_isFlipped
private

Definition at line 78 of file dialog_pad_properties.h.

Referenced by initValues(), and TransferDataFromWindow().

wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_MaskClearanceTitle
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceUnits
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceValueCtrl
protectedinherited
wxNotebook* DIALOG_PAD_PROPERTIES_BASE::m_notebook
protectedinherited
wxFloatingPointValidator<double> DIALOG_PAD_PROPERTIES::m_OrientValidator
private
double DIALOG_PAD_PROPERTIES::m_OrientValue
private

Definition at line 84 of file dialog_pad_properties.h.

Referenced by initValues(), PadOrientEvent(), and transferDataToPad().

wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Ctrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Unit
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Ctrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Unit
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCu
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerDraft
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO1
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO2
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCu
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCu
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCu
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadLengthDie_Unit
protectedinherited
D_PAD* DIALOG_PAD_PROPERTIES::m_padMaster
private

Definition at line 71 of file dialog_pad_properties.h.

Referenced by DIALOG_PAD_PROPERTIES(), and TransferDataFromWindow().

wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadNameText
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadNumText
protectedinherited
wxChoice* DIALOG_PAD_PROPERTIES_BASE::m_PadOrient
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_PadOrientCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadOrientText
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_X_Ctrl
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_Y_Ctrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadPosX_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadPosY_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeDelta_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetX_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetY_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeX_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeY_Unit
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad
protectedinherited
PCB_DRAW_PANEL_GAL* DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal
protectedinherited
PCB_BASE_FRAME* DIALOG_PAD_PROPERTIES::m_parent
private
EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 131 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited
wxChoice* DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel
protectedinherited
wxStdDialogButtonSizer* DIALOG_PAD_PROPERTIES_BASE::m_sdbSizer
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerCancel
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerOK
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_ShapeDelta_Ctrl
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_X_Ctrl
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_Y_Ctrl
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_X_Ctrl
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_Y_Ctrl
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginUnits
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginCtrl
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginUnits
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteRatioMarginUnits
protectedinherited
wxStaticLine* DIALOG_PAD_PROPERTIES_BASE::m_staticline4
protectedinherited
wxStaticLine* DIALOG_PAD_PROPERTIES_BASE::m_staticline5
protectedinherited
wxStaticLine* DIALOG_PAD_PROPERTIES_BASE::m_staticline6
protectedinherited
wxStaticLine* DIALOG_PAD_PROPERTIES_BASE::m_staticline7
protectedinherited
wxStaticLine* DIALOG_PAD_PROPERTIES_BASE::m_staticline8
protectedinherited
wxStaticLine* DIALOG_PAD_PROPERTIES_BASE::m_staticline9
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticModuleRotValue
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticModuleSideValue
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText12
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText15
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText17
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText19
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText21
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText23
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText38
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText4
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText40
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText41
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText44
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText45
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText47
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText49
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText491
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText51
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText511
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText52
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticText53
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerRadius
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerRadiusValue
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeRatio
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeRatioUnit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeUnit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextNetClearance
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextRatio
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextSolderPaste
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextWarning
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTextWarningPadFlipped
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTitleModuleRot
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_staticTitleModuleSide
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_textPadDrillX
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_textPadDrillY
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapUnits
protectedinherited
wxTextCtrl* DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthUnits
protectedinherited
wxChoice* DIALOG_PAD_PROPERTIES_BASE::m_trapDeltaDirChoice
protectedinherited
wxChoice* DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice
protectedinherited

The documentation for this class was generated from the following files: