37#include <wx/hyperlink.h>
53 case COL_NAME:
return _(
"Alternate Pin Name" );
54 case COL_TYPE:
return _(
"Electrical Type" );
56 default: wxFAIL;
return wxEmptyString;
65 wxString
GetValue(
int aRow,
int aCol )
override
69 case COL_NAME:
return at( aRow ).m_Name;
72 default: wxFAIL;
return wxEmptyString;
76 void SetValue(
int aRow,
int aCol,
const wxString &aValue )
override
81 at( aRow ).m_Name = aValue;
108 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
109 GetView()->ProcessTableMessage( msg );
115 erase( begin() + aRow );
119 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
120 GetView()->ProcessTableMessage( msg );
130 m_posX( parent, m_posXLabel, m_posXCtrl, m_posXUnits ),
131 m_posY( parent, m_posYLabel, m_posYCtrl, m_posYUnits ),
132 m_pinLength( parent, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
133 m_nameSize( parent, m_nameSizeLabel, m_nameSizeCtrl, m_nameSizeUnits ),
134 m_numberSize( parent, m_numberSizeLabel, m_numberSizeCtrl, m_numberSizeUnits ),
135 m_delayedFocusRow( -1 ),
136 m_delayedFocusColumn( -1 ),
137 m_initialized( false )
152 for (
unsigned ii = 0; ii < orientationNames.GetCount(); ii++ )
195 [
this]( wxCommandEvent& aEvent )
205 "De Morgan symbols." ) );
209 wxGridCellAttr* attr;
211 attr =
new wxGridCellAttr;
216 attr =
new wxGridCellAttr;
255 if( !DIALOG_SHIM::TransferDataToWindow() )
277 wxString commonUnitsToolTip;
281 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl(
m_infoBar, wxID_ANY,
282 _(
"Exit sync pins mode" ),
285 button->Bind( wxEVT_COMMAND_HYPERLINK,
286 std::function<
void( wxHyperlinkEvent& aEvent )>(
287 [&]( wxHyperlinkEvent& aEvent )
297 commonUnitsToolTip =
_(
"Synchronized pins mode is enabled.\n"
298 "Similar pins will be edited regardless of this option." );
302 commonUnitsToolTip =
_(
"If checked, this pin will exist in all units." );
306 commonUnitsToolTip =
_(
"This symbol only has one unit. This control has no effect." );
336 if( !DIALOG_SHIM::TransferDataFromWindow() )
341 const int standard_grid = 50;
347 wxString msg = wxString::Format(
_(
"This pin is not on a %d mils grid which will make it "
348 "difficult to connect to in the schematic.\n"
349 "Do you wish to continue?" ),
351 if( !
IsOK(
this, msg ) )
372 alternates[ alt.m_Name ] = alt;
384 wxSize dc_size = dc.GetSize();
385 dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
396 double xscale = (double) dc_size.x / bBox.
GetWidth();
397 double yscale = (double) dc_size.y / bBox.
GetHeight();
398 double scale = std::min( xscale, yscale );
421 if( !IsShownOnScreen() )
443 return _(
"Synchronized Pins Mode." );
445 return _(
"Synchronized Pins Mode. New pin will be added to all units." );
447 return _(
"Synchronized Pins Mode. Matching pins in other units will be updated." );
457 newAlt.
m_Name = wxEmptyString;
486 curRow = std::max( 0, curRow - 1 );
497 wxGridUpdateLocker deferRepaintsTillLeavingScope;
509 auto new_size =
event.GetSize();
543 if( !event.GetCollapsed() )
545 wxTopLevelWindow* tlw =
dynamic_cast<wxTopLevelWindow*
>( wxGetTopLevelParent(
this ) );
549 tlw->InvalidateBestSize();
550 wxSize bestSize = tlw->GetBestSize();
551 wxSize currentSize = tlw->GetSize();
552 tlw->SetSize( wxMax( bestSize.GetWidth(), currentSize.GetWidth() ),
553 wxMax( bestSize.GetHeight(), currentSize.GetHeight() ) );
constexpr EDA_IU_SCALE schIUScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
wxString GetColLabelValue(int aCol) override
void SetValue(int aRow, int aCol, const wxString &aValue) override
ALT_PIN_DATA_MODEL(EDA_UNITS aUserUnits)
wxString GetValue(int aRow, int aCol) override
void AppendRow(const SCH_PIN::ALT &aAlt)
int GetNumberCols() override
bool IsEmptyCell(int row, int col) override
int GetNumberRows() override
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr size_type GetHeight() const
Class DIALOG_PIN_PROPERTIES_BASE.
wxTextCtrl * m_numberSizeCtrl
wxTextCtrl * m_textPinNumber
WX_GRID * m_alternatesGrid
wxTextCtrl * m_textPinName
wxCheckBox * m_checkApplyToAllBodyStyles
wxCollapsiblePane * m_alternatesTurndown
wxBitmapComboBox * m_choiceOrientation
PinTypeComboBox * m_choiceElectricalType
PinShapeComboBox * m_choiceStyle
wxCheckBox * m_checkApplyToAllParts
STD_BITMAP_BUTTON * m_addAlternate
STD_BITMAP_BUTTON * m_deleteAlternate
wxTextCtrl * m_nameSizeCtrl
wxTextCtrl * m_pinLengthCtrl
wxButton * m_sdbSizerButtonsCancel
wxButton * m_sdbSizerButtonsOK
SYMBOL_EDIT_FRAME * m_frame
void OnUpdateUI(wxUpdateUIEvent &event) override
std::map< int, int > m_originalColWidths
LIB_SYMBOL * m_dummyParent
wxString getSyncPinsMessage()
void OnCollapsiblePaneChange(wxCollapsiblePaneEvent &event) override
~DIALOG_PIN_PROPERTIES() override
void OnPropertiesChange(wxCommandEvent &event) override
void OnPaintShowPanel(wxPaintEvent &event) override
bool TransferDataToWindow() override
void OnAddAlternate(wxCommandEvent &event) override
ALT_PIN_DATA_MODEL * m_alternatesDataModel
void OnSize(wxSizeEvent &event) override
DIALOG_PIN_PROPERTIES(SYMBOL_EDIT_FRAME *parent, SCH_PIN *aPin, bool aFocusPinNumber)
bool TransferDataFromWindow() override
static bool s_alternatesTurndownOpen
void OnDeleteAlternate(wxCommandEvent &event) override
std::vector< wxWindow * > m_tabOrder
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_UNITS GetUserUnits() const
virtual void SetParent(EDA_ITEM *aParent)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
A color representation with 4 components: red, green, blue, alpha.
wxColour ToColour() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetPrintDC(wxDC *aDC)
Define a library symbol object.
GRAPHIC_PINSHAPE GetPinShapeSelection()
void SetSelection(GRAPHIC_PINSHAPE aShape)
void SetSelection(ELECTRICAL_PINTYPE aType)
ELECTRICAL_PINTYPE GetPinTypeSelection()
SCH_RENDER_SETTINGS * GetRenderSettings()
virtual void SetBodyStyle(int aBodyStyle)
const SYMBOL * GetParentSymbol() const
virtual void SetUnit(int aUnit)
int GetNumberTextSize() const
const std::map< wxString, ALT > & GetAlternates() const
void SetNumber(const wxString &aNumber)
void SetVisible(bool aVisible)
void ChangeLength(int aLength)
Change the length of a pin and adjust its position based on orientation.
void SetOrientation(PIN_ORIENTATION aOrientation)
void SetName(const wxString &aName)
void SetPosition(const VECTOR2I &aPos) override
const wxString & GetName() const
void SetLength(int aLength)
PIN_ORIENTATION GetOrientation() const
void SetNumberTextSize(int aSize)
void SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
int GetNameTextSize() const
void SetType(ELECTRICAL_PINTYPE aType)
const wxString & GetNumber() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
void SetNameTextSize(int aSize)
bool m_ShowConnectionPoints
The symbol library editor main window.
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
virtual bool IsMulti() const =0
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
virtual bool HasAlternateBodyStyle() const =0
Test if symbol has more than one body conversion type (DeMorgan).
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
void DestroyTable(wxGridTableBase *aTable)
Work-around for a bug in wxGrid which crashes when deleting the table if the cell edit control was no...
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
void GRResetPenAndBrush(wxDC *DC)
@ LAYER_SCHEMATIC_BACKGROUND
const std::vector< BITMAPS > & PinTypeIcons()
const wxArrayString & PinTypeNames()
int PinOrientationIndex(PIN_ORIENTATION code)
const wxArrayString & PinShapeNames()
const std::vector< BITMAPS > & PinShapeIcons()
const wxArrayString & PinOrientationNames()
PIN_ORIENTATION PinOrientationCode(size_t index)
const std::vector< BITMAPS > & PinOrientationIcons()
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
constexpr int MilsToIU(int mils) const
ELECTRICAL_PINTYPE m_Type
Functions for manipulating tab traversal in forms and dialogs.