本文整理汇总了C++中LIB_ALIAS::IsRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ LIB_ALIAS::IsRoot方法的具体用法?C++ LIB_ALIAS::IsRoot怎么用?C++ LIB_ALIAS::IsRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LIB_ALIAS
的用法示例。
在下文中一共展示了LIB_ALIAS::IsRoot方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetHtmlDesc
void SetHtmlDesc()
{
wxString raw_desc;
if( m_part->IsRoot() )
{
raw_desc = m_part->GetDescription();
}
else
{
LIB_PART* root = m_part->GetPart();
for( size_t i = 0; i < root->GetAliasCount(); ++i )
{
LIB_ALIAS* alias = root->GetAlias( i );
if( alias && !alias->GetDescription().empty() )
{
raw_desc = alias->GetDescription();
break;
}
}
}
m_html.Replace( "__DESC__", wxString::Format( DescFormat, EscapedHTML( raw_desc ) ) );
}
示例2: OnHandlePreviewRepaint
void DIALOG_CHOOSE_COMPONENT::OnHandlePreviewRepaint( wxPaintEvent& aRepaintEvent )
{
int unit = 0;
LIB_ALIAS* selection = m_search_container->GetSelectedAlias( &unit );
LIB_PART* part = selection ? selection->GetPart() : NULL;
// Don't draw anything (not even the background) if we don't have
// a part to show
if( !part )
return;
if( selection->IsRoot() )
{
// just show the part directly
renderPreview( part, unit );
}
else
{
// switch out the name temporarily for the alias name
wxString tmp( part->GetName() );
part->SetName( selection->GetName() );
renderPreview( part, unit );
part->SetName( tmp );
}
}
示例3: RedrawActiveWindow
/**
* Function RedrawActiveWindow
* Display the current selected component.
* If the component is an alias, the ROOT component is displayed
*/
void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
LIB_COMPONENT* component;
LIB_ALIAS* entry;
CMP_LIBRARY* lib;
wxString msg;
wxString tmp;
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
if( lib == NULL )
return;
entry = lib->FindEntry( m_entryName );
if( entry == NULL )
return;
component = entry->GetComponent();
m_canvas->DrawBackGround( DC );
if( !entry->IsRoot() )
{
if( component == NULL ) // Should not occur
return;
// Temporarily change the name field text to reflect the alias name.
msg = entry->GetName();
tmp = component->GetName();
component->SetName( msg );
if( m_unit < 1 )
m_unit = 1;
if( m_convert < 1 )
m_convert = 1;
}
else
{
msg = _( "None" );
}
component->Draw( m_canvas, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE );
/* Redraw the cursor */
m_canvas->DrawCrossHair( DC );
if( !tmp.IsEmpty() )
component->SetName( tmp );
ClearMsgPanel();
AppendMsgPanel( _( "Part" ), component->GetName(), BLUE, 6 );
AppendMsgPanel( _( "Alias" ), msg, RED, 6 );
AppendMsgPanel( _( "Description" ), entry->GetDescription(), CYAN, 6 );
AppendMsgPanel( _( "Key words" ), entry->GetKeyWords(), DARKDARKGRAY );
}
示例4: SetHtmlAliasOf
void SetHtmlAliasOf()
{
if( m_part->IsRoot() )
{
m_html.Replace( "__ALIASOF__", wxEmptyString );
}
else
{
LIB_PART* root = m_part->GetPart();
const wxString root_name = ( root ? root->GetName() : _( "Unknown" ) );
m_html.Replace(
"__ALIASOF__", wxString::Format( AliasOfFormat, EscapedHTML( root_name ) ) );
}
}
示例5: RedrawActiveWindow
void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
LIB_ALIAS* entry = Prj().SchLibs()->FindLibraryAlias( m_entryName, m_libraryName );
if( !entry )
return;
LIB_PART* part = entry->GetPart();
if( !part )
return;
wxString msg;
wxString tmp;
m_canvas->DrawBackGround( DC );
if( !entry->IsRoot() )
{
// Temporarily change the name field text to reflect the alias name.
msg = entry->GetName();
tmp = part->GetName();
part->SetName( msg );
if( m_unit < 1 )
m_unit = 1;
if( m_convert < 1 )
m_convert = 1;
}
else
msg = _( "None" );
part->Draw( m_canvas, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE );
// Redraw the cursor
m_canvas->DrawCrossHair( DC );
if( !tmp.IsEmpty() )
part->SetName( tmp );
ClearMsgPanel();
AppendMsgPanel( _( "Part" ), part->GetName(), BLUE, 6 );
AppendMsgPanel( _( "Alias" ), msg, RED, 6 );
AppendMsgPanel( _( "Description" ), entry->GetDescription(), CYAN, 6 );
AppendMsgPanel( _( "Key words" ), entry->GetKeyWords(), DARKDARKGRAY );
}
示例6: updateSelection
bool DIALOG_CHOOSE_COMPONENT::updateSelection()
{
int unit = 0;
LIB_ALIAS* selection = m_search_container->GetSelectedAlias( &unit );
m_componentView->Refresh();
m_componentDetails->Clear();
if( selection == NULL )
return false;
m_componentDetails->Freeze();
wxFont font_normal = m_componentDetails->GetFont();
wxFont font_bold = m_componentDetails->GetFont();
font_bold.SetWeight( wxFONTWEIGHT_BOLD );
wxTextAttr headline_attribute;
headline_attribute.SetFont( font_bold );
wxTextAttr text_attribute;
text_attribute.SetFont( font_normal );
const wxString name = selection->GetName();
if ( !name.empty() )
{
m_componentDetails->SetDefaultStyle( headline_attribute );
m_componentDetails->AppendText( name );
}
const wxString description = selection->GetDescription();
if( !description.empty() )
{
if ( !m_componentDetails->IsEmpty() )
m_componentDetails->AppendText( wxT( "\n\n" ) );
m_componentDetails->SetDefaultStyle( headline_attribute );
m_componentDetails->AppendText( _( "Description\n" ) );
m_componentDetails->SetDefaultStyle( text_attribute );
m_componentDetails->AppendText( description );
}
const wxString keywords = selection->GetKeyWords();
if( !keywords.empty() )
{
if ( !m_componentDetails->IsEmpty() )
m_componentDetails->AppendText( wxT( "\n\n" ) );
m_componentDetails->SetDefaultStyle( headline_attribute );
m_componentDetails->AppendText( _( "Keywords\n" ) );
m_componentDetails->SetDefaultStyle( text_attribute );
m_componentDetails->AppendText( keywords );
}
if ( !selection->IsRoot() )
{
LIB_PART* root_part = selection->GetPart();
const wxString root_component_name( root_part ? root_part->GetName() : _( "Unknown" ) );
if ( !m_componentDetails->IsEmpty() )
m_componentDetails->AppendText( wxT( "\n\n" ) );
m_componentDetails->SetDefaultStyle( headline_attribute );
m_componentDetails->AppendText( _( "Alias of " ) );
m_componentDetails->SetDefaultStyle( text_attribute );
m_componentDetails->AppendText( root_component_name );
}
m_componentDetails->SetInsertionPoint( 0 ); // scroll up.
m_componentDetails->Thaw();
return true;
}