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++ )
194 [
this]( wxCommandEvent& aEvent )
204 "De Morgan symbols." ) );
208 wxGridCellAttr* attr;
210 attr =
new wxGridCellAttr;
215 attr =
new wxGridCellAttr;
253 if( !DIALOG_SHIM::TransferDataToWindow() )
275 wxString commonUnitsToolTip;
279 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl(
m_infoBar, wxID_ANY,
280 _(
"Exit sync pins mode" ),
283 button->Bind( wxEVT_COMMAND_HYPERLINK,
284 std::function<
void( wxHyperlinkEvent& aEvent )>(
285 [&]( wxHyperlinkEvent& aEvent )
295 commonUnitsToolTip =
_(
"Synchronized pins mode is enabled.\n"
296 "Similar pins will be edited regardless of this option." );
300 commonUnitsToolTip =
_(
"If checked, this pin will exist in all units." );
304 commonUnitsToolTip =
_(
"This symbol only has one unit. This control has no effect." );
334 if( !DIALOG_SHIM::TransferDataFromWindow() )
339 const int standard_grid = 50;
345 wxString msg = wxString::Format(
_(
"This pin is not on a %d mils grid which will make it "
346 "difficult to connect to in the schematic.\n"
347 "Do you wish to continue?" ),
349 if( !
IsOK(
this, msg ) )
370 alternates[ alt.m_Name ] = alt;
382 wxSize dc_size = dc.GetSize();
383 dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
392 double xscale = (double) dc_size.x / bBox.
GetWidth();
393 double yscale = (double) dc_size.y / bBox.
GetHeight();
394 double scale = std::min( xscale, yscale );
417 if( !IsShownOnScreen() )
439 return _(
"Synchronized Pins Mode." );
441 return _(
"Synchronized Pins Mode. New pin will be added to all units." );
443 return _(
"Synchronized Pins Mode. Matching pins in other units will be updated." );
453 newAlt.
m_Name = wxEmptyString;
482 curRow = std::max( 0, curRow - 1 );
493 wxGridUpdateLocker deferRepaintsTillLeavingScope;
505 auto new_size =
event.GetSize();
539 if( !event.GetCollapsed() )
541 wxTopLevelWindow* tlw =
dynamic_cast<wxTopLevelWindow*
>( wxGetTopLevelParent(
this ) );
545 tlw->InvalidateBestSize();
546 wxSize bestSize = tlw->GetBestSize();
547 wxSize currentSize = tlw->GetSize();
548 tlw->SetSize( wxMax( bestSize.GetWidth(), currentSize.GetWidth() ),
549 wxMax( bestSize.GetHeight(), currentSize.GetHeight() ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
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 LIB_PIN::ALT &aAlt)
int GetNumberCols() override
bool IsEmptyCell(int row, int col) override
int GetNumberRows() override
coord_type GetHeight() const
coord_type GetWidth() const
Class DIALOG_PIN_PROPERTIES_BASE.
wxTextCtrl * m_numberSizeCtrl
wxTextCtrl * m_textPinNumber
WX_GRID * m_alternatesGrid
wxTextCtrl * m_textPinName
wxCollapsiblePane * m_alternatesTurndown
wxBitmapComboBox * m_choiceOrientation
wxCheckBox * m_checkApplyToAllConversions
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
LIB_SYMBOL * m_dummyParent
wxString getSyncPinsMessage()
DIALOG_PIN_PROPERTIES(SYMBOL_EDIT_FRAME *parent, LIB_PIN *aPin)
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
bool TransferDataFromWindow() override
static bool s_alternatesTurndownOpen
void OnDeleteAlternate(wxCommandEvent &event) override
int m_originalColWidths[COL_COUNT]
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
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetPrintDC(wxDC *aDC)
virtual void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed)
Draw an item.
LIB_SYMBOL * GetParent() const
void SetConvert(int aConvert)
void SetShape(GRAPHIC_PINSHAPE aShape)
ELECTRICAL_PINTYPE GetType() const
void SetPosition(const VECTOR2I &aPos) override
const BOX2I GetBoundingBox() const override
void SetName(const wxString &aName)
void SetNameTextSize(int aSize)
void SetType(ELECTRICAL_PINTYPE aType)
PIN_ORIENTATION GetOrientation() const
int GetNumberTextSize() const
void SetVisible(bool aVisible)
void ChangeLength(int aLength)
Change the length of a pin and adjust its position based on orientation.
VECTOR2I GetPosition() const override
std::map< wxString, ALT > & GetAlternates()
const wxString & GetNumber() const
void SetOrientation(PIN_ORIENTATION aOrientation)
GRAPHIC_PINSHAPE GetShape() const
void SetNumber(const wxString &aNumber)
const wxString & GetName() const
void SetLength(int aLength)
int GetNameTextSize() const
void SetNumberTextSize(int aSize)
Define a library symbol object.
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
GRAPHIC_PINSHAPE GetPinShapeSelection()
void SetSelection(GRAPHIC_PINSHAPE aShape)
void SetSelection(ELECTRICAL_PINTYPE aType)
ELECTRICAL_PINTYPE GetPinTypeSelection()
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
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 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.
TRANSFORM DefaultTransform
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.
ELECTRICAL_PINTYPE m_Type
Functions for manipulating tab traversal in forms and dialogs.