102 return editor->IsSymbolEditable() && !
editor->IsSymbolAlias();
105 static const std::vector<KICAD_T> pinTypes = {
SCH_PIN_T };
128 commit.
Modify( parentSymbol );
138 std::vector<bool> got_unit( parentSymbol->
GetUnitCount() + 1 );
140 got_unit[
static_cast<size_t>(aPin->
GetUnit())] =
true;
150 if( got_unit[
static_cast<size_t>( other->GetUnit() )] )
153 if( other->GetPosition() == original_pin.
GetPosition()
155 && other->GetType() == original_pin.
GetType()
156 && other->IsVisible() == original_pin.
IsVisible()
157 && other->GetName() == original_pin.
GetName() )
164 else if( other->GetBodyStyle() == aPin->
GetBodyStyle() )
167 other->ChangeLength( aPin->
GetLength() );
168 other->SetShape( aPin->
GetShape() );
178 other->SetType( aPin->
GetType() );
180 other->SetName( aPin->
GetName() );
184 got_unit[
static_cast<size_t>( other->GetUnit() )] =
true;
189 commit.
Push(
_(
"Edit Pin Properties" ) );
191 std::vector<MSG_PANEL_ITEM> items;
213 bool ask_for_pin =
true;
229 msg.Printf(
_(
"This position is already occupied by another pin, in unit %d." ),
232 KIDIALOG dlg(
m_frame, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
233 dlg.SetOKLabel(
_(
"Place Pin Anyway" ) );
236 bool status = dlg.
ShowModal() == wxID_OK;
297 pin->SetPosition( aPosition );
347 unknownNum.Printf(
"%s-U%c", aPin->
GetNumber(), wxChar(
'A' + ii - 1 ) );
357 catch(
const boost::bad_pointer& e )
359 wxFAIL_MSG( wxString::Format( wxT(
"Boost pointer exception occurred: %s" ),
383 if(
pin == sourcePin )
424 switch(
pin->GetOrientation() )
427 case PIN_ORIENTATION::PIN_RIGHT: step.
y =
schIUScale.
MilsToIU(-settings->m_Repeat.pin_step);
break;
428 case PIN_ORIENTATION::PIN_UP: step.
x =
schIUScale.
MilsToIU(settings->m_Repeat.pin_step);
break;
429 case PIN_ORIENTATION::PIN_DOWN: step.
x =
schIUScale.
MilsToIU(settings->m_Repeat.pin_step);
break;
430 case PIN_ORIENTATION::PIN_LEFT: step.
y =
schIUScale.
MilsToIU(-settings->m_Repeat.pin_step);
break;
435 wxString nextName =
pin->GetName();
437 pin->SetName( nextName );
439 wxString nextNumber =
pin->GetNumber();
441 pin->SetNumber( nextNumber );
448 commit.
Push(
_(
"Repeat Pin" ) );
constexpr EDA_IU_SCALE schIUScale
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
EDA_ITEM_FLAGS GetEditFlags() const
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
static TOOL_ACTION pushPinNameSize
static TOOL_ACTION pushPinNumSize
static TOOL_ACTION pushPinLength
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
Define a library symbol object.
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
void ClearTempFlags() override
Clears the status flag all draw objects in this symbol.
std::vector< SCH_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
void RemoveDrawItem(SCH_ITEM *aItem)
Remove draw aItem from list.
int GetUnitCount() const override
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
virtual SETTINGS_MANAGER & GetSettingsManager() const
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
const SYMBOL * GetParentSymbol() const
virtual void SetUnit(int aUnit)
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
int GetNumberTextSize() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void SetNumber(const wxString &aNumber)
const wxString & GetName() const
PIN_ORIENTATION GetOrientation() const
VECTOR2I GetPosition() const override
int GetNameTextSize() const
const wxString & GetNumber() const
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
The symbol library editor main window.
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_NEW
New item, just created.
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
KICOMMON_API bool IncrementString(wxString &name, int aIncrement)
Generic string incrementer.
This file is part of the common library.
PGM_BASE & Pgm()
The global Program "get" accessor.
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
@ PT_INPUT
usual pin input: must be connected
PIN_ORIENTATION
The symbol library pin object orientations.
@ PIN_RIGHT
The pin extends rightwards from the connection point.
constexpr int MilsToIU(int mils) const