34#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 );
164 m_frame->GetCanvas()->GetBackend() );
169 wxBoxSizer* previewSizer =
new wxBoxSizer( wxHORIZONTAL );
181 wxStaticText* hint =
new wxStaticText(
this, wxID_ANY, hintText );
191 wxBoxSizer* bAlternatesSizer;
192 bAlternatesSizer =
new wxBoxSizer( wxVERTICAL );
210 wxBoxSizer* bButtonSizer;
211 bButtonSizer =
new wxBoxSizer( wxHORIZONTAL );
214 bButtonSizer->Add(
m_addAlternate, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
215 bButtonSizer->AddSpacer( 20 );
222 bAlternatesSizer->Add( bButtonSizer, 0, wxTOP | wxBOTTOM, 3 );
224 alternatesWindow->SetSizer( bAlternatesSizer );
225 alternatesWindow->Layout();
226 bAlternatesSizer->Fit( alternatesWindow );
231 [
this]( wxCommandEvent& aEvent )
239 InvalidateBestSize();
240 wxSize bestSize = GetBestSize();
241 wxSize currentSize = GetSize();
242 SetSize( wxMax( bestSize.GetWidth(), currentSize.GetWidth() ),
243 wxMax( bestSize.GetHeight(), currentSize.GetHeight() ) );
256 if (
m_pin->GetAlternates().size() > 0 )
267 [
this]( wxCommandEvent& aEvent )
274 wxGridCellAttr* attr;
276 attr =
new wxGridCellAttr;
281 attr =
new wxGridCellAttr;
294 for (
unsigned ii = 0; ii < orientationNames.GetCount(); ii++ )
356 if( !DIALOG_SHIM::TransferDataToWindow() )
379 wxString commonUnitsToolTip;
381 if(
m_frame->SynchronizePins() )
384 m_infoBar->AddLink(
_(
"Exit sync pins mode" ),
385 [&]( wxHyperlinkEvent& aEvent )
388 cfg->m_SyncPinEdit = !cfg->m_SyncPinEdit;
395 commonUnitsToolTip =
_(
"Synchronized pins mode is enabled.\n"
396 "Similar pins will be edited regardless of this option." );
400 commonUnitsToolTip =
_(
"If checked, this pin will exist in all units." );
403 if( !
m_pin->GetParentSymbol()->IsMultiUnit() )
404 commonUnitsToolTip =
_(
"This symbol only has one unit. This control has no effect." );
408 for(
const std::pair<const wxString, SCH_PIN::ALT>& alt :
m_pin->GetAlternates() )
440 if( !DIALOG_SHIM::TransferDataFromWindow() )
445 const int standard_grid = 50;
449 && ( (
m_posX.GetValue() % standard_grid ) || (
m_posY.GetValue() % standard_grid ) ) )
451 wxString msg = wxString::Format(
_(
"This pin is not on a %d mils grid which will make it "
452 "difficult to connect to in the schematic.\n"
453 "Do you wish to continue?" ),
455 if( !
IsOK(
this, msg ) )
464 m_pin->SetPosition( newPos );
474 std::map<wxString, SCH_PIN::ALT>& alternates =
m_pin->GetAlternates();
478 alternates[ alt.m_Name ] = alt;
487 if( !IsShownOnScreen() )
513 return _(
"Synchronized Pins Mode." );
514 else if(
m_pin->IsNew() )
515 return _(
"Synchronized Pins Mode. New pin will be added to all units." );
517 return _(
"Synchronized Pins Mode. Matching pins in other units will be updated." );
527 [&]() -> std::pair<int, int>
530 newAlt.
m_Name = wxEmptyString;
557 wxGridUpdateLocker deferRepaintsTillLeavingScope;
569 wxSize new_size =
event.GetSize();
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
wxStaticText * m_pinLengthLabel
wxTextCtrl * m_textPinName
wxStaticText * m_nameSizeUnits
wxStaticText * m_nameSizeLabel
wxCheckBox * m_checkApplyToAllBodyStyles
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)
wxBoxSizer * m_lowerSizer
wxStaticText * m_pinLengthUnits
wxStaticText * m_numberSizeLabel
wxStaticText * m_posXUnits
wxStaticText * m_posYUnits
wxCheckBox * m_checkApplyToAllParts
PINSHAPE_COMBOBOX * m_choiceStyle
wxStaticText * m_posXLabel
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 onDeleteAlternate(wxCommandEvent &event)
~DIALOG_PIN_PROPERTIES() override
void OnPropertiesChange(wxCommandEvent &event) override
bool TransferDataToWindow() override
STD_BITMAP_BUTTON * m_deleteAlternate
WX_GRID * m_alternatesGrid
SYMBOL_PREVIEW_WIDGET * m_previewWidget
ALT_PIN_DATA_MODEL * m_alternatesDataModel
WX_COLLAPSIBLE_PANE * m_alternatesTurndown
void OnSize(wxSizeEvent &event) override
void onAddAlternate(wxCommandEvent &event)
DIALOG_PIN_PROPERTIES(SYMBOL_EDIT_FRAME *parent, SCH_PIN *aPin, bool aFocusPinNumber)
bool TransferDataFromWindow() override
STD_BITMAP_BUTTON * m_addAlternate
static bool s_alternatesTurndownOpen
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
A better wxCollapsiblePane that.
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.
KICOMMON_API wxFont GetControlFont(wxWindow *aWindow)
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()
#define NO_PIN_FUNCTIONS_WITH_MULTIPLE_BODY_STYLES
ELECTRICAL_PINTYPE m_Type
Functions for manipulating tab traversal in forms and dialogs.
VECTOR2< int32_t > VECTOR2I
const KICOMMON_API wxEventTypeTag< wxCommandEvent > WX_COLLAPSIBLE_PANE_CHANGED