38#include <wx/hyperlink.h>
55 case COL_NAME:
return _(
"Alternate Pin Name" );
56 case COL_TYPE:
return _(
"Electrical Type" );
58 default: wxFAIL;
return wxEmptyString;
67 wxString
GetValue(
int aRow,
int aCol )
override
71 case COL_NAME:
return at( aRow ).m_Name;
74 default: wxFAIL;
return wxEmptyString;
78 void SetValue(
int aRow,
int aCol,
const wxString &aValue )
override
83 at( aRow ).m_Name = aValue;
110 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
111 GetView()->ProcessTableMessage( msg );
117 erase( begin() + aRow );
121 wxGridTableMessage msg(
this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aRow, 1 );
122 GetView()->ProcessTableMessage( msg );
129 bool aFocusPinNumber ) :
162 m_frame->GetCanvas()->GetBackend() );
167 wxBoxSizer* previewSizer =
new wxBoxSizer( wxHORIZONTAL );
176 for (
unsigned ii = 0; ii < orientationNames.GetCount(); ii++ )
205 if (
m_pin->GetAlternates().size() > 0 )
216 [
this]( wxCommandEvent& aEvent )
227 "multiple body styles." ) );
231 wxGridCellAttr* attr;
233 attr =
new wxGridCellAttr;
238 attr =
new wxGridCellAttr;
277 if( !DIALOG_SHIM::TransferDataToWindow() )
300 wxString commonUnitsToolTip;
304 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl(
m_infoBar, wxID_ANY,
_(
"Exit sync pins mode" ),
307 button->Bind( wxEVT_COMMAND_HYPERLINK,
308 std::function<
void( wxHyperlinkEvent& aEvent )>(
309 [&]( wxHyperlinkEvent& aEvent )
311 m_frame->m_SyncPinEdit =
false;
319 commonUnitsToolTip =
_(
"Synchronized pins mode is enabled.\n"
320 "Similar pins will be edited regardless of this option." );
324 commonUnitsToolTip =
_(
"If checked, this pin will exist in all units." );
327 if( !
m_pin->GetParentSymbol()->IsMultiUnit() )
328 commonUnitsToolTip =
_(
"This symbol only has one unit. This control has no effect." );
332 for(
const std::pair<const wxString, SCH_PIN::ALT>& alt :
m_pin->GetAlternates() )
361 if( !DIALOG_SHIM::TransferDataFromWindow() )
366 const int standard_grid = 50;
370 && ( (
m_posX.GetValue() % standard_grid ) || (
m_posY.GetValue() % standard_grid ) ) )
372 wxString msg = wxString::Format(
_(
"This pin is not on a %d mils grid which will make it "
373 "difficult to connect to in the schematic.\n"
374 "Do you wish to continue?" ),
376 if( !
IsOK(
this, msg ) )
385 m_pin->SetPosition( newPos );
393 std::map<wxString, SCH_PIN::ALT>& alternates =
m_pin->GetAlternates();
397 alternates[ alt.m_Name ] = alt;
405 if( !IsShownOnScreen() )
431 return _(
"Synchronized Pins Mode." );
432 else if(
m_pin->IsNew() )
433 return _(
"Synchronized Pins Mode. New pin will be added to all units." );
435 return _(
"Synchronized Pins Mode. Matching pins in other units will be updated." );
445 [&]() -> std::pair<int, int>
448 newAlt.
m_Name = wxEmptyString;
473 wxGridUpdateLocker deferRepaintsTillLeavingScope;
484 auto new_size =
event.GetSize();
520 if( !event.GetCollapsed() )
522 wxTopLevelWindow* tlw =
dynamic_cast<wxTopLevelWindow*
>( wxGetTopLevelParent(
this ) );
526 tlw->InvalidateBestSize();
527 wxSize bestSize = tlw->GetBestSize();
528 wxSize currentSize = tlw->GetSize();
529 tlw->SetSize( wxMax( bestSize.GetWidth(), currentSize.GetWidth() ),
530 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