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 ) :
161 m_frame->GetCanvas()->GetBackend() );
166 wxBoxSizer* previewSizer =
new wxBoxSizer( wxHORIZONTAL );
175 for (
unsigned ii = 0; ii < orientationNames.GetCount(); ii++ )
204 if (
m_pin->GetAlternates().size() > 0 )
215 [
this]( wxCommandEvent& aEvent )
226 "multiple body styles." ) );
230 wxGridCellAttr* attr;
232 attr =
new wxGridCellAttr;
237 attr =
new wxGridCellAttr;
276 if( !DIALOG_SHIM::TransferDataToWindow() )
299 wxString commonUnitsToolTip;
303 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl(
m_infoBar, wxID_ANY,
_(
"Exit sync pins mode" ),
306 button->Bind( wxEVT_COMMAND_HYPERLINK,
307 std::function<
void( wxHyperlinkEvent& aEvent )>(
308 [&]( wxHyperlinkEvent& aEvent )
310 m_frame->m_SyncPinEdit =
false;
318 commonUnitsToolTip =
_(
"Synchronized pins mode is enabled.\n"
319 "Similar pins will be edited regardless of this option." );
323 commonUnitsToolTip =
_(
"If checked, this pin will exist in all units." );
326 if( !
m_pin->GetParentSymbol()->IsMultiUnit() )
327 commonUnitsToolTip =
_(
"This symbol only has one unit. This control has no effect." );
331 for(
const std::pair<const wxString, SCH_PIN::ALT>& alt :
m_pin->GetAlternates() )
360 if( !DIALOG_SHIM::TransferDataFromWindow() )
365 const int standard_grid = 50;
369 && ( (
m_posX.GetValue() % standard_grid ) || (
m_posY.GetValue() % standard_grid ) ) )
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 ) )
384 m_pin->SetPosition( newPos );
392 std::map<wxString, SCH_PIN::ALT>& alternates =
m_pin->GetAlternates();
396 alternates[ alt.m_Name ] = alt;
404 if( !IsShownOnScreen() )
430 return _(
"Synchronized Pins Mode." );
431 else if(
m_pin->IsNew() )
432 return _(
"Synchronized Pins Mode. New pin will be added to all units." );
434 return _(
"Synchronized Pins Mode. Matching pins in other units will be updated." );
444 [&]() -> std::pair<int, int>
447 newAlt.
m_Name = wxEmptyString;
472 wxGridUpdateLocker deferRepaintsTillLeavingScope;
483 auto new_size =
event.GetSize();
519 if( !event.GetCollapsed() )
521 wxTopLevelWindow* tlw =
dynamic_cast<wxTopLevelWindow*
>( wxGetTopLevelParent(
this ) );
525 tlw->InvalidateBestSize();
526 wxSize bestSize = tlw->GetBestSize();
527 wxSize currentSize = tlw->GetSize();
528 tlw->SetSize( wxMax( bestSize.GetWidth(), currentSize.GetWidth() ),
529 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
wxTextCtrl * m_numberSizeCtrl
wxTextCtrl * m_textPinNumber
PINTYPE_COMBOBOX * m_choiceElectricalType
wxStaticText * m_posYLabel
WX_GRID * m_alternatesGrid
wxStaticText * m_pinLengthLabel
wxTextCtrl * m_textPinName
wxStaticText * m_nameSizeUnits
wxStaticText * m_nameSizeLabel
wxCheckBox * m_checkApplyToAllBodyStyles
wxCollapsiblePane * m_alternatesTurndown
DIALOG_PIN_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Pin Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxStaticText * m_pinLengthUnits
wxStaticText * m_numberSizeLabel
wxStaticText * m_posXUnits
wxStaticText * m_posYUnits
wxCheckBox * m_checkApplyToAllParts
STD_BITMAP_BUTTON * m_addAlternate
PINSHAPE_COMBOBOX * m_choiceStyle
wxStaticText * m_posXLabel
STD_BITMAP_BUTTON * m_deleteAlternate
wxTextCtrl * m_nameSizeCtrl
WX_BITMAP_COMBOBOX * m_choiceOrientation
wxStaticText * m_numberSizeUnits
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
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Define a library symbol object.
Base class for any item which can be embedded within the SCHEMATIC container class,...
const SYMBOL * GetParentSymbol() const
virtual void SetUnit(int aUnit)
The symbol library editor main window.
virtual bool IsMultiBodyStyle() const =0
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 IS_NEW
New item, just created.
const std::vector< BITMAPS > & PinTypeIcons()
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
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 m_Type
Functions for manipulating tab traversal in forms and dialogs.
VECTOR2< int32_t > VECTOR2I