本文整理汇总了C++中LIB_ID::SetLibItemName方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_ID::SetLibItemName方法的具体用法?C++ LIB_ID::SetLibItemName怎么用?C++ LIB_ID::SetLibItemName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_ID
的用法示例。
在下文中一共展示了LIB_ID::SetLibItemName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SyncLibraries
void LIB_EDIT_FRAME::SyncLibraries( bool aShowProgress )
{
LIB_ID selected;
if( m_treePane )
selected = m_treePane->GetLibTree()->GetSelectedLibId();
if( aShowProgress )
{
wxProgressDialog progressDlg( _( "Loading Symbol Libraries" ), wxEmptyString,
m_libMgr->GetAdapter()->GetLibrariesCount(), this );
m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName )
{
progressDlg.Update( progress, wxString::Format( _( "Loading library \"%s\"" ), libName ) );
} );
}
else
{
m_libMgr->Sync( true );
}
if( m_treePane )
{
wxDataViewItem found;
if( selected.IsValid() )
{
// Check if the previously selected item is still valid,
// if not - it has to be unselected to prevent crash
found = m_libMgr->GetAdapter()->FindItem( selected );
if( !found )
m_treePane->GetLibTree()->Unselect();
}
m_treePane->Regenerate();
// Try to select the parent library, in case the part is not found
if( !found && selected.IsValid() )
{
selected.SetLibItemName( "" );
found = m_libMgr->GetAdapter()->FindItem( selected );
if( found )
m_treePane->GetLibTree()->SelectLibId( selected );
}
// If no selection, see if there's a current part to centre
if( !selected.IsValid() && GetCurPart() )
{
LIB_ID current( GetCurLib(), GetCurPart()->GetName() );
m_treePane->GetLibTree()->CenterLibId( current );
}
}
}
示例2: ClickOnFootprintList
void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
{
if( m_footprintList->GetCount() == 0 )
return;
int ii = m_footprintList->GetSelection();
if( ii < 0 )
return;
wxString name = m_footprintList->GetString( ii );
if( getCurFootprintName().CmpNoCase( name ) != 0 )
{
setCurFootprintName( name );
// Delete the current footprint (MUST reset tools first)
GetToolManager()->ResetTools( TOOL_BASE::MODEL_RELOAD );
SetCurItem( nullptr );
GetBoard()->m_Modules.DeleteAll();
LIB_ID id;
id.SetLibNickname( getCurNickname() );
id.SetLibItemName( getCurFootprintName() );
try
{
GetBoard()->Add( loadFootprint( id ) );
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format(
_( "Could not load footprint \"%s\" from library \"%s\".\n\nError %s." ),
GetChars( getCurFootprintName() ),
GetChars( getCurNickname() ),
GetChars( ioe.What() ) );
DisplayError( this, msg );
}
UpdateTitle();
updateView();
m_canvas->Refresh();
Update3D_Frame();
}
}
示例3: restoreLastFootprint
void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
{
const wxString& curFootprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FPNAME );
const wxString& curNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_NICKNAME );
if( curNickname.Length() && curFootprintName.Length() )
{
LIB_ID id;
id.SetLibNickname( curNickname );
id.SetLibItemName( curFootprintName );
MODULE* module = loadFootprint( id );
if( module )
AddModuleToBoard( module );
}
}
示例4: SyncLibraryTree
void FOOTPRINT_EDIT_FRAME::SyncLibraryTree( bool aProgress )
{
FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
LIB_ID target = getTargetFPID();
bool targetSelected = ( target == m_treePane->GetLibTree()->GetSelectedLibId() );
// Sync FOOTPRINT_INFO list to the libraries on disk
if( aProgress )
{
WX_PROGRESS_REPORTER progressReporter( this, _( "Updating Footprint Libraries" ), 2 );
GFootprintList.ReadFootprintFiles( fpTable, NULL, &progressReporter );
progressReporter.Show( false );
}
else
{
GFootprintList.ReadFootprintFiles( fpTable, NULL, NULL );
}
// Sync the LIB_TREE to the FOOTPRINT_INFO list
adapter->Sync();
m_treePane->GetLibTree()->Unselect();
m_treePane->Regenerate();
if( target.IsValid() )
{
if( adapter->FindItem( target ) )
{
if( targetSelected )
m_treePane->GetLibTree()->SelectLibId( target );
else
m_treePane->GetLibTree()->CenterLibId( target );
}
else
{
// Try to focus on parent
target.SetLibItemName( wxEmptyString );
m_treePane->GetLibTree()->CenterLibId( target );
}
}
}
示例5: ExportSelectedFootprint
void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event )
{
int ii = m_footprintList->GetSelection();
if( ii >= 0 )
{
wxString fp_name = m_footprintList->GetString( ii );
LIB_ID fpid;
fpid.SetLibNickname( getCurNickname() );
fpid.SetLibItemName( fp_name );
DismissModal( true, fpid.Format() );
}
else
{
DismissModal( false );
}
Close( true );
}
示例6: wxASSERT
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent,
FRAME_T aFrameType ) :
PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Library Browser" ),
wxDefaultPosition, wxDefaultSize,
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ? ( aParent ? PARENT_STYLE : MODAL_STYLE )
: NONMODAL_STYLE,
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ? FOOTPRINT_VIEWER_FRAME_NAME_MODAL
: FOOTPRINT_VIEWER_FRAME_NAME )
{
wxASSERT( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ||
aFrameType == FRAME_PCB_MODULE_VIEWER );
if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL )
SetModal( true );
// Force the frame name used in config. the footprint viewer frame has a name
// depending on aFrameType (needed to identify the frame by wxWidgets),
// but only one configuration is preferable.
m_configFrameName = FOOTPRINT_VIEWER_FRAME_NAME;
m_showAxis = true; // true to draw axis.
// Give an icon
wxIcon icon;
icon.CopyFromBitmap( KiBitmap( modview_icon_xpm ) );
SetIcon( icon );
m_hotkeysDescrList = g_Module_Viewer_Hotkeys_Descr;
m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
SetBoard( new BOARD() );
// In viewer, the default net clearance is not known (it depends on the actual board).
// So we do not show the default clearance, by setting it to 0
// The footprint or pad specific clearance will be shown
GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0);
// Don't show the default board solder mask clearance in the footprint viewer. Only the
// footprint or pad clearance setting should be shown if it is not 0.
GetBoard()->GetDesignSettings().m_SolderMaskMargin = 0;
// Ensure all layers and items are visible:
GetBoard()->SetVisibleAlls();
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
GetScreen()->m_Center = true; // Center coordinate origins on screen.
LoadSettings( config() );
GetGalDisplayOptions().m_axesEnabled = true;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
// Menu bar is not mandatory: uncomment/comment the next line
// to add/remove the menubar
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateLibraryList();
UpdateTitle();
// Create GAL canvas
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(),
LoadCanvasTypeSetting() );
SetGalCanvas( drawPanel );
// Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
drawPanel->GetViewControls(), this );
m_actions = new PCB_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
drawPanel->SetEventDispatcher( m_toolDispatcher );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->InitTools();
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
// If a footprint was previously loaded, reload it
if( getCurNickname().size() && getCurFootprintName().size() )
{
LIB_ID id;
id.SetLibNickname( getCurNickname() );
id.SetLibItemName( getCurFootprintName() );
GetBoard()->Add( loadFootprint( id ) );
}
drawPanel->DisplayBoard( m_Pcb );
m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
//.........这里部分代码省略.........