当前位置: 首页>>代码示例>>C++>>正文


C++ SCH_ITEM::GetMsgPanelInfo方法代码示例

本文整理汇总了C++中SCH_ITEM::GetMsgPanelInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ SCH_ITEM::GetMsgPanelInfo方法的具体用法?C++ SCH_ITEM::GetMsgPanelInfo怎么用?C++ SCH_ITEM::GetMsgPanelInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SCH_ITEM的用法示例。


在下文中一共展示了SCH_ITEM::GetMsgPanelInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LocateItem


//.........这里部分代码省略.........
    else if( m_collectedItems.GetCount() == 1 )
    {
        item = m_collectedItems[0];
    }
    else
    {
        // There are certain parent/child and enclosure combinations that can be handled
        // automatically.  Since schematics are meant to be human-readable we don't have
        // all the various overlap and coverage issues that we do in Pcbnew.
        if( m_collectedItems.GetCount() == 2 )
        {
            SCH_ITEM* a = m_collectedItems[ 0 ];
            SCH_ITEM* b = m_collectedItems[ 1 ];

            if( a->GetParent() == b )
                item = a;
            else if( a == b->GetParent() )
                item = b;
            else if( a->Type() == SCH_SHEET_T && b->Type() != SCH_SHEET_T )
                item = b;
            else if( b->Type() == SCH_SHEET_T && a->Type() != SCH_SHEET_T )
                item = a;
        }

        // There are certain combinations of items that do not need clarification such as
        // a corner were two lines meet or all the items form a junction.
        if( aHotKeyCommandId )
        {
            switch( aHotKeyCommandId )
            {
            case HK_DRAG:
                if( m_collectedItems.IsCorner() || m_collectedItems.IsNode( false )
                    || m_collectedItems.IsDraggableJunction() )
                {
                    item = m_collectedItems[0];
                }
                break;

            case HK_MOVE_COMPONENT_OR_ITEM:
                if( m_collectedItems.GetCount() == 2 &&
                        dynamic_cast< SCH_SHEET_PIN * >( m_collectedItems[0] ) &&
                        dynamic_cast< SCH_SHEET * >( m_collectedItems[1] ) )
                {
                    item = m_collectedItems[0];
                }
                break;

            default:
                ;
            }
        }

        if( item == NULL )
        {
            wxASSERT_MSG( m_collectedItems.GetCount() <= MAX_SELECT_ITEM_IDS,
                          wxT( "Select item clarification context menu size limit exceeded." ) );

            wxMenu selectMenu;

            AddMenuItem( &selectMenu, wxID_NONE, _( "Clarify Selection" ), KiBitmap( info_xpm ) );
            selectMenu.AppendSeparator();

            for( int i = 0;  i < m_collectedItems.GetCount() && i < MAX_SELECT_ITEM_IDS;  i++ )
            {
                wxString text = m_collectedItems[i]->GetSelectMenuText( m_UserUnits );
                BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage();
                AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, KiBitmap( xpm ) );
            }

            // Set to NULL in case the user aborts the clarification context menu.
            GetScreen()->SetCurItem( NULL );
            m_canvas->SetAbortRequest( true );   // Changed to false if an item is selected
            PopupMenu( &selectMenu );

            if( !m_canvas->GetAbortRequest() )
            {
                m_canvas->MoveCursorToCrossHair();
                item = GetScreen()->GetCurItem();
            }
        }
    }

    GetScreen()->SetCurItem( item );

    if( item )
    {
        if( item->Type() == SCH_COMPONENT_T )
            ( (SCH_COMPONENT*) item )->SetCurrentSheetPath( &GetCurrentSheet() );

        MSG_PANEL_ITEMS items;
        item->GetMsgPanelInfo( m_UserUnits, items );
        SetMsgPanel( items );
    }
    else
    {
        ClearMsgPanel();
    }

    return item;
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:101,代码来源:controle.cpp

示例2: LocateItem

SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aFilterList[],
                                      int aHotKeyCommandId )
{
    SCH_ITEM* item = NULL;

    m_collectedItems.Collect( GetScreen()->GetDrawItems(), aFilterList, aPosition );

    if( m_collectedItems.GetCount() == 0 )
    {
        ClearMsgPanel();
    }
    else if( m_collectedItems.GetCount() == 1 )
    {
        item = m_collectedItems[0];
    }
    else
    {
        // There are certain combinations of items that do not need clarification such as
        // a corner were two lines meet or all the items form a junction.
        if( aHotKeyCommandId )
        {
            switch( aHotKeyCommandId )
            {
            case HK_DRAG:
                if( m_collectedItems.IsCorner() || m_collectedItems.IsNode( false )
                    || m_collectedItems.IsDraggableJunction() )
                {
                    item = m_collectedItems[0];
                }
            default:
                ;
            }
        }

        if( item == NULL )
        {
            wxASSERT_MSG( m_collectedItems.GetCount() <= MAX_SELECT_ITEM_IDS,
                          wxT( "Select item clarification context menu size limit exceeded." ) );

            wxMenu selectMenu;
            wxMenuItem* title = new wxMenuItem( &selectMenu, wxID_NONE, _( "Clarify Selection" ) );

            selectMenu.Append( title );
            selectMenu.AppendSeparator();

            for( int i = 0;  i < m_collectedItems.GetCount() && i < MAX_SELECT_ITEM_IDS;  i++ )
            {
                wxString text = m_collectedItems[i]->GetSelectMenuText();
                BITMAP_DEF xpm = m_collectedItems[i]->GetMenuImage();
                AddMenuItem( &selectMenu, ID_SELECT_ITEM_START + i, text, KiBitmap( xpm ) );
            }

            // Set to NULL in case user aborts the clarification context menu.
            GetScreen()->SetCurItem( NULL );
            m_canvas->SetAbortRequest( true );   // Changed to false if an item is selected
            PopupMenu( &selectMenu );
            m_canvas->MoveCursorToCrossHair();
            item = GetScreen()->GetCurItem();
        }
    }

    GetScreen()->SetCurItem( item );

    if( item )
    {
        if( item->Type() == SCH_COMPONENT_T )
            ( (SCH_COMPONENT*) item )->SetCurrentSheetPath( &GetCurrentSheet() );

        MSG_PANEL_ITEMS items;
        item->GetMsgPanelInfo( items );
        SetMsgPanel( items );
    }
    else
    {
        ClearMsgPanel();
    }

    return item;
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:79,代码来源:controle.cpp


注:本文中的SCH_ITEM::GetMsgPanelInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。