本文整理汇总了C++中LIB_ID::GetLibNickname方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_ID::GetLibNickname方法的具体用法?C++ LIB_ID::GetLibNickname怎么用?C++ LIB_ID::GetLibNickname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_ID
的用法示例。
在下文中一共展示了LIB_ID::GetLibNickname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRevert
void LIB_EDIT_FRAME::OnRevert( wxCommandEvent& aEvent )
{
LIB_ID libId = getTargetLibId();
const wxString& libName = libId.GetLibNickname();
const wxString& partName = libId.GetLibItemName(); // Empty if this is the library itself that is selected
wxString msg = wxString::Format( _( "Revert \"%s\" to last version saved?" ),
partName.IsEmpty() ? libName : partName );
if( !ConfirmRevertDialog( this, msg ) )
return;
bool reload_currentPart = false;
wxString curr_partName = partName;
if( GetCurPart() )
{
// the library itself is reverted: the current part will be reloaded only if it is
// owned by this library
if( partName.IsEmpty() )
{
LIB_ID curr_libId = GetCurPart()->GetLibId();
reload_currentPart = libName == curr_libId.GetLibNickname();
if( reload_currentPart )
curr_partName = curr_libId.GetLibItemName();
}
else
reload_currentPart = isCurrentPart( libId );
}
int unit = m_unit;
if( reload_currentPart )
emptyScreen();
if( partName.IsEmpty() )
{
m_libMgr->RevertLibrary( libName );
}
else
{
libId = m_libMgr->RevertPart( libId.GetLibItemName(), libId.GetLibNickname() );
m_treePane->GetLibTree()->SelectLibId( libId );
m_libMgr->ClearPartModified( libId.GetLibItemName(), libId.GetLibNickname() );
}
if( reload_currentPart && m_libMgr->PartExists( curr_partName, libName ) )
loadPart( curr_partName, libName, unit );
m_treePane->Refresh();
refreshSchematic();
}
示例2: isCurrentPart
bool LIB_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const
{
// This will return the root part of any alias
LIB_PART* part = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(), aLibId.GetLibNickname() );
// Now we can compare the libId of the current part and the root part
return ( part && GetCurPart() && part->GetLibId() == GetCurPart()->GetLibId() );
}
示例3: OnCopyCutPart
void LIB_EDIT_FRAME::OnCopyCutPart( wxCommandEvent& aEvent )
{
int dummyUnit;
LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
LIB_PART* part = m_libMgr->GetBufferedPart( libId.GetLibItemName(), libId.GetLibNickname() );
if( !part )
return;
STRING_FORMATTER formatter;
SCH_LEGACY_PLUGIN::FormatPart( part, formatter );
auto clipboard = wxTheClipboard;
wxClipboardLocker clipboardLock( clipboard );
if( !clipboardLock || !clipboard->IsOpened() )
return;
auto data = new wxTextDataObject( wxString( formatter.GetString().c_str(), wxConvUTF8 ) );
clipboard->SetData( data );
clipboard->Flush();
if( aEvent.GetId() == ID_LIBEDIT_CUT_PART )
OnRemovePart( aEvent );
}
示例4: OnUpdateSaveAs
void FOOTPRINT_EDIT_FRAME::OnUpdateSaveAs( wxUpdateUIEvent& aEvent )
{
LIB_ID libId = getTargetFPID();
const wxString& libName = libId.GetLibNickname();
const wxString& partName = libId.GetLibItemName();
aEvent.Enable( !libName.IsEmpty() || !partName.IsEmpty() );
}
示例5: retainLastFootprint
void FOOTPRINT_EDIT_FRAME::retainLastFootprint()
{
LIB_ID id = GetLoadedFPID();
if( id.IsValid() )
{
Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_NICKNAME, id.GetLibNickname() );
Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FPNAME, id.GetLibItemName() );
}
}
示例6: OnRemovePart
void LIB_EDIT_FRAME::OnRemovePart( wxCommandEvent& aEvent )
{
LIB_ID libId = getTargetLibId();
if( m_libMgr->IsPartModified( libId.GetLibItemName(), libId.GetLibNickname() )
&& !IsOK( this, _( wxString::Format( "Component %s has been modified\n"
"Do you want to remove it from the library?",
libId.GetUniStringLibItemName() ) ) ) )
{
return;
}
if( isCurrentPart( libId ) )
emptyScreen();
m_libMgr->RemovePart( libId.GetLibItemName(), libId.GetLibNickname() );
refreshSchematic();
}
示例7: getTargetLibId
LIB_ID LIB_EDIT_FRAME::getTargetLibId() const
{
LIB_ID id = m_treePane->GetLibTree()->GetSelectedLibId();
wxString nickname = id.GetLibNickname();
if( nickname.IsEmpty() && GetCurPart() )
id = GetCurPart()->GetLibId();
return id;
}
示例8: getTargetFPID
LIB_ID FOOTPRINT_EDIT_FRAME::getTargetFPID() const
{
LIB_ID id = m_treePane->GetLibTree()->GetSelectedLibId();
wxString nickname = id.GetLibNickname();
if( nickname.IsEmpty() )
return GetLoadedFPID();
return id;
}
示例9: OnPasteDuplicatePart
void LIB_EDIT_FRAME::OnPasteDuplicatePart( wxCommandEvent& aEvent )
{
int dummyUnit;
LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
wxString lib = libId.GetLibNickname();
if( !m_libMgr->LibraryExists( lib ) )
return;
LIB_PART* srcPart = nullptr;
LIB_PART* newPart = nullptr;
if( aEvent.GetId() == ID_LIBEDIT_DUPLICATE_PART )
{
srcPart = m_libMgr->GetBufferedPart( libId.GetLibItemName(), lib );
newPart = new LIB_PART( *srcPart );
}
else if( aEvent.GetId() == ID_LIBEDIT_PASTE_PART )
{
auto clipboard = wxTheClipboard;
wxClipboardLocker clipboardLock( clipboard );
if( !clipboardLock || ! clipboard->IsSupported( wxDF_TEXT ) )
return;
wxTextDataObject data;
clipboard->GetData( data );
wxString partSource = data.GetText();
STRING_LINE_READER reader( TO_UTF8( partSource ), "Clipboard" );
try
{
reader.ReadLine();
newPart = SCH_LEGACY_PLUGIN::ParsePart( reader );
}
catch( IO_ERROR& e )
{
wxLogError( wxString::Format( "Malformed clipboard: %s" ), GetChars( e.What() ) );
return;
}
}
else
wxFAIL;
if( !newPart )
return;
fixDuplicateAliases( newPart, lib );
m_libMgr->UpdatePart( newPart, lib );
SyncLibraries( false );
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, newPart->GetName() ) );
delete newPart;
}
示例10: OnUpdateRevert
void LIB_EDIT_FRAME::OnUpdateRevert( wxUpdateUIEvent& aEvent )
{
LIB_ID libId = getTargetLibId();
const wxString& libName = libId.GetLibNickname();
const wxString& partName = libId.GetLibItemName();
if( partName.IsEmpty() )
aEvent.Enable( !libName.IsEmpty() && m_libMgr->IsLibraryModified( libName ) );
else
aEvent.Enable( !libName.IsEmpty() && m_libMgr->IsPartModified( partName, libName ) );
}
示例11: ShowModal
bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent )
{
if( aFootprint && !aFootprint->IsEmpty() )
{
wxString msg;
LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
LIB_ID fpid;
fpid.Parse( *aFootprint, LIB_ID::ID_PCB, true );
if( fpid.IsValid() )
{
wxString nickname = fpid.GetLibNickname();
if( !fpTable->HasLibrary( fpid.GetLibNickname(), false ) )
{
msg.sprintf( _( "The current configuration does not include a library with the\n"
"nickname \"%s\". Use Manage Footprint Libraries\n"
"to edit the configuration." ), nickname );
DisplayErrorMessage( aParent, _( "Footprint library not found." ), msg );
}
else if ( !fpTable->HasLibrary( fpid.GetLibNickname(), true ) )
{
msg.sprintf( _( "The library with the nickname \"%s\" is not enabled\n"
"in the current configuration. Use Manage Footprint Libraries to\n"
"edit the configuration." ), nickname );
DisplayErrorMessage( aParent, _( "Footprint library not enabled." ), msg );
}
else
{
setCurNickname( nickname );
setCurFootprintName( fpid.GetLibItemName() );
ReCreateFootprintList();
}
SelectAndViewFootprint( NEW_PART );
}
}
return KIWAY_PLAYER::ShowModal( aFootprint, aParent );
}
示例12: ConvertPart
void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent, wxDC* DC )
{
if( !aComponent )
return;
LIB_ID id = aComponent->GetLibId();
LIB_PART* part = GetLibPart( id );
if( part )
{
wxString msg;
if( !part->HasConversion() )
{
msg.Printf( _( "No alternate body style found for symbol \"%s\" in library \"%s\"." ),
id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
DisplayError( this, msg );
return;
}
STATUS_FLAGS flags = aComponent->GetFlags();
if( aComponent->GetFlags() )
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
aComponent->SetConvert( aComponent->GetConvert() + 1 );
// ensure m_Convert = 0, 1 or 2
// 0 and 1 = shape 1 = not converted
// 2 = shape 2 = first converted shape
// > 2 is not used but could be used for more shapes
// like multiple shapes for a programmable component
// When m_Convert = val max, return to the first shape
if( aComponent->GetConvert() > 2 )
aComponent->SetConvert( 1 );
// The alternate symbol may cause a change in the connection status so test the
// connections so the connection indicators are drawn correctly.
GetScreen()->TestDanglingEnds();
aComponent->ClearFlags();
aComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
/* Redraw the component in the new position. */
if( aComponent->IsMoving() )
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
OnModify();
}
}
示例13: ShowModal
bool LIB_VIEW_FRAME::ShowModal( wxString* aSymbol, wxWindow* aParent )
{
if( aSymbol && !aSymbol->IsEmpty() )
{
wxString msg;
LIB_TABLE* libTable = Prj().SchSymbolLibTable();
LIB_ID libid;
libid.Parse( *aSymbol, LIB_ID::ID_SCH, true );
if( libid.IsValid() )
{
wxString nickname = libid.GetLibNickname();
if( !libTable->HasLibrary( libid.GetLibNickname(), false ) )
{
msg.sprintf( _( "The current configuration does not include a library with the\n"
"nickname \"%s\". Use Manage Symbol Libraries\n"
"to edit the configuration." ), nickname );
DisplayErrorMessage( aParent, _( "Symbol library not found." ), msg );
}
else if ( !libTable->HasLibrary( libid.GetLibNickname(), true ) )
{
msg.sprintf( _( "The library with the nickname \"%s\" is not enabled\n"
"in the current configuration. Use Manage Symbol Libraries to\n"
"edit the configuration." ), nickname );
DisplayErrorMessage( aParent, _( "Symbol library not enabled." ), msg );
}
else
{
SetSelectedLibrary( libid.GetLibNickname() );
SetSelectedComponent( libid.GetLibItemName() );
}
}
}
return KIWAY_PLAYER::ShowModal( aSymbol, aParent );
}
示例14: OnSaveAs
void LIB_EDIT_FRAME::OnSaveAs( wxCommandEvent& aEvent )
{
LIB_ID libId = getTargetLibId();
const wxString& libName = libId.GetLibNickname();
const wxString& partName = libId.GetLibItemName();
if( partName.IsEmpty() )
saveLibrary( libName, true );
else
savePartAs();
m_treePane->Refresh();
refreshSchematic();
}
示例15: LoadComponentAndSelectLib
bool LIB_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert )
{
if( GetScreen()->IsModify() && GetCurPart() )
{
if( !HandleUnsavedChanges( this, _( "The current symbol has been modified. Save changes?" ),
[&]()->bool { return saveCurrentPart(); } ) )
{
return false;
}
}
SelectActiveLibrary( aLibId.GetLibNickname() );
return LoadComponentFromCurrentLib( aLibId.GetLibItemName(), aUnit, aConvert );
}