Пример #1
0
static void DrawMovingItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
    auto screen = static_cast<PL_EDITOR_SCREEN*>( aPanel->GetScreen() );
    auto frame = static_cast<PL_EDITOR_FRAME*>( aPanel->GetParent() );

    // Get items
    std::vector<WS_DRAW_ITEM_BASE*> items;
    WS_DRAW_ITEM_LIST drawList;
    ConfigureDrawList( &drawList, screen, frame );
    drawList.GetAllItems( &items );

    // Draw items
    for( auto item: items )
    {
        if( item->HitTest( screen->m_BlockLocate ) )
        {
            item->DrawWsItem( NULL, aDC, screen->m_BlockLocate.GetMoveVector(),
                    g_XorMode, g_GhostColor );
        }
    }
}
Пример #2
0
void PL_EDITOR_FRAME::Block_Move( wxDC* DC )
{
    auto screen = static_cast<PL_EDITOR_SCREEN*>( GetScreen() );

    wxPoint delta;
    wxPoint oldpos;

    oldpos = GetCrossHairPosition();
    m_canvas->SetMouseCaptureCallback( NULL );

    SetCrossHairPosition( oldpos );
    m_canvas->MoveCursorToCrossHair();
    GetScreen()->SetModify();
    GetScreen()->m_BlockLocate.Normalize();

    // Calculate displacement vectors.
    delta = GetScreen()->m_BlockLocate.GetMoveVector();

    // Get the items
    std::vector<WS_DRAW_ITEM_BASE*> items;
    WS_DRAW_ITEM_LIST drawList;
    ConfigureDrawList( &drawList, screen, this );
    drawList.GetAllItems( &items );

    // Move items in block
    SaveCopyInUndoList();
    for( auto item: items )
    {
        if( item->HitTest( screen->m_BlockLocate ) )
        {
            auto data_item = item->GetParent();
            data_item->MoveToUi( data_item->GetStartPosUi() + delta );
        }
    }

    m_canvas->Refresh( true );
}