コード例 #1
0
/*
 * Traces the outline of the search block structures
 * The entire block follows the cursor
 */
void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                              bool aErase )
{
    SCH_DRAW_PANEL*    panel =static_cast<SCH_DRAW_PANEL*>( aPanel );
    LIB_EDIT_FRAME*    frame = (LIB_EDIT_FRAME*) aPanel->GetParent();
    KIGFX::SCH_VIEW*   view = panel->GetView();
    KIGFX::VIEW_GROUP* preview = view->GetPreview();

    BASE_SCREEN*       screen = aPanel->GetScreen();
    BLOCK_SELECTOR*    block = &screen->m_BlockLocate;
    LIB_PART*          component = frame->GetCurPart();

    if( component == NULL )
        return;

    block->SetMoveVector( frame->GetCrossHairPosition( true ) - block->GetLastCursorPosition() );

    preview->Clear();
    view->SetVisible( preview, true );

    for( unsigned ii = 0; ii < block->GetCount(); ii++ )
    {
        LIB_ITEM* libItem = (LIB_ITEM*) block->GetItem( ii );
        LIB_ITEM* copy = static_cast<LIB_ITEM*>( libItem->Clone() );

        copy->Move( copy->GetPosition() + block->GetMoveVector() );
        copy->SetFlags( IS_MOVED );
        preview->Add( copy );

        view->Hide( libItem );
    }

    view->Update( preview );
}
コード例 #2
0
ファイル: symbdraw.cpp プロジェクト: cpavlina/kicad
void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
{
    LIB_ITEM* item = GetDrawItem();

    if( item == NULL )
        return;

    SetCursor( wxCURSOR_HAND );

    TempCopyComponent();

    // For fields only, move the anchor point of the field
    // to the cursor position to allow user to see the text justification
    if( item->Type() == LIB_FIELD_T )
        item->BeginEdit( IS_MOVED, item->GetPosition() );
    else
        item->BeginEdit( IS_MOVED, GetCrossHairPosition( true ) );

    m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
    m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
}