37#include <wx/hyperlink.h>
54 case COL_NAME:
return _(
"Alternate Pin Name" );
55 case COL_TYPE:
return _(
"Electrical Type" );
57 default: wxFAIL;
return wxEmptyString;
66 wxString
GetValue(
int aRow,
int aCol )
override
70 case COL_NAME:
return at( aRow ).m_Name;
73 default: wxFAIL;
return wxEmptyString;
77 void SetValue(
int aRow,
int aCol,
const wxString &aValue )
override
82 at( aRow ).m_Name = aValue;
109 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
110 GetView()->ProcessTableMessage( msg );
116 erase( begin() + aRow );
120 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
121 GetView()->ProcessTableMessage( msg );
128 bool aFocusPinNumber ) :
132 m_posX( parent, m_posXLabel, m_posXCtrl, m_posXUnits ),
133 m_posY( parent, m_posYLabel, m_posYCtrl, m_posYUnits ),
134 m_pinLength( parent, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
135 m_nameSize( parent, m_nameSizeLabel, m_nameSizeCtrl, m_nameSizeUnits ),
136 m_numberSize( parent, m_numberSizeLabel, m_numberSizeCtrl, m_numberSizeUnits ),
137 m_delayedFocusRow( -1 ),
138 m_delayedFocusColumn( -1 ),
139 m_initialized( false )
150 RECURSE_MODE::NO_RECURSE );
165 wxBoxSizer* previewSizer =
new wxBoxSizer( wxHORIZONTAL );
172 for (
unsigned ii = 0; ii < orientationNames.GetCount(); ii++ )
219 [
this]( wxCommandEvent& aEvent )
229 "De Morgan symbols." ) );
233 wxGridCellAttr* attr;
235 attr =
new wxGridCellAttr;
240 attr =
new wxGridCellAttr;
278 if( !DIALOG_SHIM::TransferDataToWindow() )
301 wxString commonUnitsToolTip;
305 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl(
m_infoBar, wxID_ANY,
306 _(
"Exit sync pins mode" ),
309 button->Bind( wxEVT_COMMAND_HYPERLINK,
310 std::function<
void( wxHyperlinkEvent& aEvent )>(
311 [&]( wxHyperlinkEvent& aEvent )
321 commonUnitsToolTip =
_(
"Synchronized pins mode is enabled.\n"
322 "Similar pins will be edited regardless of this option." );
326 commonUnitsToolTip =
_(
"If checked, this pin will exist in all units." );
330 commonUnitsToolTip =
_(
"This symbol only has one unit. This control has no effect." );
360 if( !DIALOG_SHIM::TransferDataFromWindow() )
365 const int standard_grid = 50;
371 wxString msg = wxString::Format(
_(
"This pin is not on a %d mils grid which will make it "
372 "difficult to connect to in the schematic.\n"
373 "Do you wish to continue?" ),
375 if( !
IsOK(
this, msg ) )
396 alternates[ alt.m_Name ] = alt;
404 if( !IsShownOnScreen() )
427 return _(
"Synchronized Pins Mode." );
429 return _(
"Synchronized Pins Mode. New pin will be added to all units." );
431 return _(
"Synchronized Pins Mode. Matching pins in other units will be updated." );
441 newAlt.
m_Name = wxEmptyString;
470 curRow = std::max( 0, curRow - 1 );
481 wxGridUpdateLocker deferRepaintsTillLeavingScope;
493 auto new_size =
event.GetSize();
529 if( !event.GetCollapsed() )
531 wxTopLevelWindow* tlw =
dynamic_cast<wxTopLevelWindow*
>( wxGetTopLevelParent(
this ) );
535 tlw->InvalidateBestSize();
536 wxSize bestSize = tlw->GetBestSize();
537 wxSize currentSize = tlw->GetSize();
538 tlw->SetSize( wxMax( bestSize.GetWidth(), currentSize.GetWidth() ),
539 wxMax( bestSize.GetHeight(), currentSize.GetHeight() ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
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
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
bool TransferDataToWindow() override
void OnAddAlternate(wxCommandEvent &event) override
SYMBOL_PREVIEW_WIDGET * m_previewWidget
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
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Define a library symbol object.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
GRAPHIC_PINSHAPE GetPinShapeSelection()
void SetSelection(GRAPHIC_PINSHAPE aShape)
void SetSelection(ELECTRICAL_PINTYPE aType)
ELECTRICAL_PINTYPE GetPinTypeSelection()
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Base class for any item which can be embedded within the SCHEMATIC container class,...
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
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
void SetNameTextSize(int aSize)
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.
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.
ELECTRICAL_PINTYPE m_Type
Functions for manipulating tab traversal in forms and dialogs.