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


C++ SELECTION_TOOL类代码示例

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


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

示例1: update

    void update() override
    {
        SELECTION_TOOL* selTool = getToolManager()->GetTool<SELECTION_TOOL>();

        // enable zone actions that act on a single zone
        bool singleZoneActionsEnabled = ( SELECTION_CONDITIONS::Count( 1 )
                                          && SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T )
                                        )( selTool->GetSelection() );

        Enable( getMenuId( PCB_ACTIONS::zoneDuplicate ), singleZoneActionsEnabled );
        Enable( getMenuId( PCB_ACTIONS::drawZoneCutout ), singleZoneActionsEnabled );
        Enable( getMenuId( PCB_ACTIONS::drawSimilarZone ), singleZoneActionsEnabled );

        // enable zone actions that ably to a specific set of zones (as opposed to all of them)
        bool nonGlobalActionsEnabled = ( SELECTION_CONDITIONS::MoreThan( 0 ) )( selTool->GetSelection() );

        Enable( getMenuId( PCB_ACTIONS::zoneFill ), nonGlobalActionsEnabled );
        Enable( getMenuId( PCB_ACTIONS::zoneUnfill ), nonGlobalActionsEnabled );

        // lines like this make me really think about a better name for SELECTION_CONDITIONS class
        bool mergeEnabled = ( SELECTION_CONDITIONS::MoreThan( 1 ) &&
                              /*SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) &&*/
                              PCB_SELECTION_CONDITIONS::SameNet( true ) &&
                              PCB_SELECTION_CONDITIONS::SameLayer() )( selTool->GetSelection() );

        Enable( getMenuId( PCB_ACTIONS::zoneMerge ), mergeEnabled );
    }
开发者ID:hyOzd,项目名称:kicad-source-mirror,代码行数:27,代码来源:pcb_editor_control.cpp

示例2: SelectionCrossProbe

int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent )
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();

    if( selection.Size() == 1 )
        m_frame->SendMessageToEESCHEMA( selection.Item<BOARD_ITEM>( 0 ) );

    setTransitions();

    return 0;
}
开发者ID:Elphel,项目名称:kicad-source-mirror,代码行数:12,代码来源:pcb_editor_control.cpp

示例3: update

    void update()
    {
        SELECTION_TOOL* selTool = getToolManager()->GetTool<SELECTION_TOOL>();

        // lines like this make me really think about a better name for SELECTION_CONDITIONS class
        bool mergeEnabled = ( SELECTION_CONDITIONS::MoreThan( 1 ) &&
                              /*SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) &&*/
                              SELECTION_CONDITIONS::SameNet( true ) &&
                              SELECTION_CONDITIONS::SameLayer() )( selTool->GetSelection() );

        Enable( getMenuId( COMMON_ACTIONS::zoneMerge ), mergeEnabled );
    }
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:12,代码来源:pcb_editor_control.cpp

示例4: Init

bool PCB_EDITOR_CONTROL::Init()
{
    auto zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
    zoneMenu->SetTool( this );

    auto lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
    lockMenu->SetTool( this );

    // Add the PCB control menus to relevant other tools

    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();

    if( selTool )
    {
        auto& toolMenu = selTool->GetToolMenu();
        auto& menu = toolMenu.GetMenu();

        toolMenu.AddSubMenu( zoneMenu );
        toolMenu.AddSubMenu( lockMenu );

        menu.AddMenu( zoneMenu.get(), false,
                SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) );

        menu.AddMenu( lockMenu.get(), false,
                SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) );
    }

    DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<DRAWING_TOOL>();

    if( drawingTool )
    {
        auto& toolMenu = drawingTool->GetToolMenu();
        auto& menu = toolMenu.GetMenu();

        toolMenu.AddSubMenu( zoneMenu );

        // Functor to say if the PCB_EDIT_FRAME is in a given mode
        // Capture the tool pointer and tool mode by value
        auto toolActiveFunctor = [=]( DRAWING_TOOL::MODE aMode )
        {
            return [=]( const SELECTION& sel )
            {
                return drawingTool->GetDrawingMode() == aMode;
            };
        };

        menu.AddMenu( zoneMenu.get(), false, toolActiveFunctor( DRAWING_TOOL::MODE::ZONE ) );
    }

    return true;
}
开发者ID:hyOzd,项目名称:kicad-source-mirror,代码行数:51,代码来源:pcb_editor_control.cpp

示例5: Init

bool PCB_EDITOR_CONTROL::Init()
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();

    if( selTool )
    {
        selTool->AddSubMenu( new ZONE_CONTEXT_MENU, wxT( "Zones" ),
                             SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) );
    }

    setTransitions();

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

示例6: Init

bool PCB_EDITOR_CONTROL::Init()
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();

    if( selTool )
    {
        m_zoneMenu = new ZONE_CONTEXT_MENU;
        m_zoneMenu->SetTool( this );
        selTool->GetMenu().AddMenu( m_zoneMenu, _( "Zones" ), false,
                                    SELECTION_CONDITIONS::OnlyType( PCB_ZONE_AREA_T ) );
    }

    return true;
}
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:14,代码来源:pcb_editor_control.cpp

示例7: CrossProbePcbToSch

int PCB_EDITOR_CONTROL::CrossProbePcbToSch( const TOOL_EVENT& aEvent )
{
    if( m_probingSchToPcb )
    {
        m_probingSchToPcb = false;
        return 0;
    }

    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();

    if( selection.Size() == 1 )
        m_frame->SendMessageToEESCHEMA( selection.Item<BOARD_ITEM>( 0 ) );

    return 0;
}
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:16,代码来源:pcb_editor_control.cpp

示例8: CreateArray

int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
{
    // first, check if we have a selection, or try to get one
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();

    // pick up items under the cursor if needed
    if( !hoverSelection() )
        return 0;

    // we have a selection to work on now, so start the tool process
    PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
    GAL_ARRAY_CREATOR array_creator( *editFrame, m_editModules, selection );
    array_creator.Invoke();

    return 0;
}
开发者ID:nikgul,项目名称:kicad-source-mirror,代码行数:17,代码来源:edit_tool.cpp

示例9: UpdateSelectionRatsnest

int PCB_EDITOR_CONTROL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();
    RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();

    // Update "simple" ratsnest, computed for currently modified items
    ratsnest->ClearSimple();

    for( auto item : selection )
    {
        ratsnest->Update( static_cast<BOARD_ITEM*>( item ) );
        ratsnest->AddSimple( static_cast<BOARD_ITEM*>( item ) );
    }

    return 0;
}
开发者ID:hyOzd,项目名称:kicad-source-mirror,代码行数:17,代码来源:pcb_editor_control.cpp

示例10: ZoneUnfill

int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent )
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();

    for( int i = 0; i < selection.Size(); ++i )
    {
        assert( selection.Item<BOARD_ITEM>( i )->Type() == PCB_ZONE_AREA_T );

        ZONE_CONTAINER* zone = selection.Item<ZONE_CONTAINER>( i );
        zone->SetIsFilled( false );
        zone->ClearFilledPolysList();
        zone->ViewUpdate();
    }

    setTransitions();

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

示例11: deleteItem

static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
{
    SELECTION_TOOL* selectionTool = aToolMgr->GetTool<SELECTION_TOOL>();
    assert( selectionTool );

    aToolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
    aToolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );
    selectionTool->SanitizeSelection();

    if( selectionTool->GetSelection().Empty() )
        return true;

    if( IsOK( aToolMgr->GetEditFrame(), _( "Are you sure you want to delete item?" ) ) )
        aToolMgr->RunAction( COMMON_ACTIONS::remove, true );
    else
        aToolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );

    return true;
}
开发者ID:OpenEE,项目名称:micad,代码行数:19,代码来源:pcbnew_control.cpp

示例12: ZoneUnfill

int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();
    RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();

    for( int i = 0; i < selection.Size(); ++i )
    {
        assert( selection.Item<BOARD_ITEM>( i )->Type() == PCB_ZONE_AREA_T );

        ZONE_CONTAINER* zone = selection.Item<ZONE_CONTAINER>( i );
        zone->SetIsFilled( false );
        zone->ClearFilledPolysList();
        ratsnest->Update( zone );
        zone->ViewUpdate();
    }

    ratsnest->Recalculate();

    return 0;
}
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:21,代码来源:pcb_editor_control.cpp

示例13: modifyLockSelected

int PCB_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode )
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();

    if( selection.Empty() )
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );

    bool modified = false;

    for( int i = 0; i < selection.Size(); ++i )
    {
        BOARD_ITEM* item = selection.Item<BOARD_ITEM>( i );
        bool prevState = item->IsLocked();

        switch( aMode )
        {
            case ON:
                item->SetLocked( true );
                break;

            case OFF:
                item->SetLocked( false );
                break;

            case TOGGLE:
                item->SetLocked( !prevState );
                break;
        }

        // Check if we really modified an item
        if( !modified && prevState != item->IsLocked() )
            modified = true;
    }

    if( modified )
        m_frame->OnModify();

    return 0;
}
开发者ID:reportingsjr,项目名称:kicad-source-mirror,代码行数:40,代码来源:pcb_editor_control.cpp

示例14: deleteItem

static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
{
    SELECTION_TOOL* selectionTool = aToolMgr->GetTool<SELECTION_TOOL>();
    assert( selectionTool );

    aToolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
    aToolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );
    selectionTool->SanitizeSelection();

    const SELECTION& selection = selectionTool->GetSelection();

    if( selection.Empty() )
        return true;

    bool canBeRemoved = ( selection.Item<EDA_ITEM>( 0 )->Type() != PCB_MODULE_T );

    if( canBeRemoved || IsOK( aToolMgr->GetEditFrame(), _( "Are you sure you want to delete item?" ) ) )
        aToolMgr->RunAction( COMMON_ACTIONS::remove, true );
    else
        aToolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );

    return true;
}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:23,代码来源:pcbnew_control.cpp

示例15: ToggleLockModule

int PCB_EDITOR_CONTROL::ToggleLockModule( const TOOL_EVENT& aEvent )
{
    SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
    const SELECTION& selection = selTool->GetSelection();
    bool clearSelection = selection.Empty();

    if( clearSelection )
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );

    for( int i = 0; i < selection.Size(); ++i )
    {
        if( selection.Item<BOARD_ITEM>( i )->Type() == PCB_MODULE_T )
        {
            MODULE* module = selection.Item<MODULE>( i );
            module->SetLocked( !module->IsLocked() );
        }
    }

    if( clearSelection )
        m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );

    return 0;
}
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:23,代码来源:pcb_editor_control.cpp


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