50                                                     std::vector<PICKED_SYMBOL>&  aHistoryList,
 
   51                                                     std::vector<PICKED_SYMBOL>&  aAlreadyPlaced,
 
   52                                                     bool aShowFootprints, 
const LIB_ID* aHighlight,
 
   58    if( !dialogLock.try_lock() )
 
   61    bool aCancelled = 
false;
 
   64                               aAllowFields, aShowFootprints, aCancelled );
 
   66    if( aCancelled || dlg.
ShowModal() == wxID_CANCEL )
 
   88        aHistoryList.insert( aHistoryList.begin(), sel );
 
 
  106    const int currentUnit = aSymbol->
GetUnit();
 
  108    if( unitCount <= 1 || currentUnit == aUnit )
 
  111    if( aUnit > unitCount )
 
  115    bool                         swapWithOther = 
false;
 
  117                                                                          aSymbol->
GetRef( &sheetPath, 
false ),
 
  124        wxString otherSheetName = otherSymbolRef->GetSheetPath().PathHumanReadable( 
true, 
true );
 
  126        if( otherSheetName.IsEmpty() )
 
  127            otherSheetName = 
_( 
"Root" );
 
  129        const wxString msg = wxString::Format( 
_( 
"Symbol unit '%s' is already placed (on sheet '%s')" ),
 
  130                                               targetUnitName, otherSheetName );
 
  132        KIDIALOG dlg( 
this, msg, 
_( 
"Unit Already Placed" ), wxYES_NO | wxCANCEL | wxICON_WARNING );
 
  133        dlg.SetYesNoLabels( wxString::Format( 
_( 
"&Swap '%s' and '%s'" ), targetUnitName, currUnitName ),
 
  134                            wxString::Format( 
_( 
"&Duplicate '%s'" ), targetUnitName ) );
 
  139        if( ret == wxID_CANCEL )
 
  142        if( ret == wxID_YES )
 
  143            swapWithOther = 
true;
 
  149        wxASSERT( otherSymbolRef );
 
  151        SCH_SYMBOL* otherSymbol = otherSymbolRef->GetSymbol();
 
  154            commit.
Modify( otherSymbol, otherSymbolRef->GetSheetPath().LastScreen() );
 
  157        otherSymbol->
SetUnitSelection( &otherSymbolRef->GetSheetPath(), currentUnit );
 
  158        otherSymbol->
SetUnit( currentUnit );
 
  168    if( !commit.
Empty() )
 
  170        if( 
eeconfig()->m_AutoplaceFields.enable )
 
  179            commit.
Push( 
_( 
"Swap Units" ) );
 
  181            commit.
Push( 
_( 
"Change Unit" ) );
 
 
  194    if( bodyStyleCount <= 1 || currentBodyStyle == aBodyStyle )
 
  197    if( aBodyStyle > bodyStyleCount )
 
  198        aBodyStyle = bodyStyleCount;
 
  210    commit.
Push( 
_( 
"Change Body Style" ) );
 
 
  222    if( aFunction == aPin->
GetName() )
 
  223        aPin->
SetAlt( wxEmptyString );
 
  225        aPin->
SetAlt( aFunction );
 
  227    commit.
Push( 
_( 
"Set Pin Function" ) );
 
 
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
 
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
 
std::vector< std::pair< FIELD_T, wxString > > GetFields() const
Get a list of fields edited by the user.
 
static std::mutex g_Mutex
 
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
To be called after this dialog returns from ShowModal().
 
A base class for most all the KiCad significant classes used in schematics and boards.
 
EDA_ITEM_FLAGS GetEditFlags() const
 
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
 
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
 
A logical library item identifier and consists of various portions much like a URI.
 
bool IsValid() const
Check if this LID_ID is valid.
 
Define a library symbol object.
 
int GetBodyStyleCount() const override
 
int GetUnitCount() const override
 
wxString GetUnitDisplayName(int aUnit, bool aLabel) const override
Return the user-defined display name for aUnit for symbols with units.
 
PICKED_SYMBOL PickSymbolFromLibrary(const SYMBOL_LIBRARY_FILTER *aFilter, std::vector< PICKED_SYMBOL > &aHistoryList, std::vector< PICKED_SYMBOL > &aAlreadyPlaced, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Call the library viewer to select symbol to import into schematic.
 
EESCHEMA_SETTINGS * eeconfig() const
 
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
 
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
 
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
 
void SetAltPinFunction(SCH_PIN *aPin, const wxString &aFunction)
 
void SelectBodyStyle(SCH_SYMBOL *aSymbol, int aBodyStyle)
 
SCH_SHEET_PATH & GetCurrentSheet() const
 
void SelectUnit(SCH_SYMBOL *aSymbol, int aUnit)
 
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
 
virtual void SetUnit(int aUnit)
 
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
 
void SetAlt(const wxString &aAlt)
Set the name of the alternate pin.
 
const wxString & GetName() const
 
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
 
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Automatically orient all the fields in the symbol.
 
void SetBodyStyle(int aBodyStyle) override
 
const LIB_ID & GetLibId() const override
 
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
 
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
 
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
 
Helper object to filter a list of libraries.
 
This file is part of the common library.
 
std::vector< std::pair< FIELD_T, wxString > > Fields