本文整理汇总了C++中BLOCK_SELECTOR::GetMoveVector方法的典型用法代码示例。如果您正苦于以下问题:C++ BLOCK_SELECTOR::GetMoveVector方法的具体用法?C++ BLOCK_SELECTOR::GetMoveVector怎么用?C++ BLOCK_SELECTOR::GetMoveVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLOCK_SELECTOR
的用法示例。
在下文中一共展示了BLOCK_SELECTOR::GetMoveVector方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawMovingBlockOutlines
/* Traces the outline of the search block structures
* The entire block follows the cursor
*/
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
BASE_SCREEN* screen = aPanel->GetScreen();
BLOCK_SELECTOR* block = &screen->m_BlockLocate;
SCH_ITEM* schitem;
/* Erase old block contents. */
if( aErase )
{
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{
schitem = (SCH_ITEM*) block->GetItem( ii );
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
}
}
/* Repaint new view. */
block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{
schitem = (SCH_ITEM*) block->GetItem( ii );
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
}
}
示例2: DrawMovingBlockOutlines
/*
* 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 );
}
示例3: HandleBlockPlace
void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
if( !m_canvas->IsMouseCaptured() )
{
DisplayError( this, wxT( "HandleBlockPLace() : m_mouseCaptureCallback = NULL" ) );
}
if( block->GetCount() == 0 )
{
wxString msg;
msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
block->GetCommand(), block->GetState() );
DisplayError( this, msg );
}
block->SetState( STATE_BLOCK_STOP );
switch( block->GetCommand() )
{
case BLOCK_DRAG: // Drag from mouse
case BLOCK_DRAG_ITEM: // Drag from a component selection and drag command
case BLOCK_MOVE:
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
SaveCopyInUndoList( block->GetItems(), UR_MOVED, block->GetMoveVector() );
MoveItemsInList( block->GetItems(), block->GetMoveVector() );
block->ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
SaveCopyInUndoList( block->GetItems(),
( block->GetCommand() == BLOCK_PRESELECT_MOVE ) ? UR_CHANGED : UR_NEW );
block->ClearItemsList();
break;
case BLOCK_PASTE:
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
PasteListOfItems( DC );
block->ClearItemsList();
break;
default: // others are handled by HandleBlockEnd()
break;
}
OnModify();
// clear dome flags and pointers
GetScreen()->ClearDrawingState();
GetScreen()->ClearBlockCommand();
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds( m_canvas, DC );
if( block->GetCount() )
{
DisplayError( this, wxT( "HandleBlockPLace() error: some items left in buffer" ) );
block->ClearItemsList();
}
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
m_canvas->Refresh();
}
示例4: DrawMovingBlockOutlines
/* Traces the outline of the search block structures
* The entire block follows the cursor
*/
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
BASE_SCREEN* screen = aPanel->GetScreen();
FOOTPRINT_EDIT_FRAME* moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor( aPanel->GetParent() );
wxASSERT( moduleEditFrame );
MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules;
BLOCK_SELECTOR* block = &screen->m_BlockLocate;
GRSetDrawMode( aDC, g_XorMode );
if( aErase )
{
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
if( currentModule )
{
wxPoint move_offset = -block->GetMoveVector();
BOARD_ITEM* item = currentModule->GraphicalItems();
for( ; item != NULL; item = item->Next() )
{
if( !item->IsSelected() )
continue;
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
case PCB_MODULE_EDGE_T:
item->Draw( aPanel, aDC, g_XorMode, move_offset );
break;
default:
break;
}
}
D_PAD* pad = currentModule->Pads();
for( ; pad != NULL; pad = pad->Next() )
{
if( !pad->IsSelected() )
continue;
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
}
}
}
// Repaint new view.
block->SetMoveVector( moduleEditFrame->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
if( currentModule )
{
BOARD_ITEM* item = currentModule->GraphicalItems();
wxPoint move_offset = - block->GetMoveVector();
for( ; item != NULL; item = item->Next() )
{
if( !item->IsSelected() )
continue;
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
case PCB_MODULE_EDGE_T:
item->Draw( aPanel, aDC, g_XorMode, move_offset );
break;
default:
break;
}
}
D_PAD* pad = currentModule->Pads();
for( ; pad != NULL; pad = pad->Next() )
{
if( !pad->IsSelected() )
continue;
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
}
}
}
示例5: HandleBlockPlace
void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
wxPoint pt;
if( !m_canvas->IsMouseCaptured() )
{
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
}
block->SetState( STATE_BLOCK_STOP );
switch( block->GetCommand() )
{
case BLOCK_IDLE:
break;
case BLOCK_DRAG: // Drag
case BLOCK_DRAG_ITEM:
case BLOCK_MOVE: // Move
case BLOCK_DUPLICATE: // Duplicate
if( GetCurPart() && !block->AppendUndo() )
SaveCopyInUndoList( GetCurPart() );
pt = block->GetMoveVector();
if( GetCurPart() )
BlockMoveSelectedItems( pt, GetCurPart(), block );
block->ClearItemsList();
break;
case BLOCK_PASTE: // Paste (recopy the last block saved)
if( GetCurPart() )
SaveCopyInUndoList( GetCurPart() );
pt = block->GetMoveVector();
pasteClipboard( pt );
block->ClearItemsList();
break;
case BLOCK_ZOOM: // Handled by HandleBlockEnd
case BLOCK_DELETE:
case BLOCK_COPY:
case BLOCK_ABORT:
default:
break;
}
RebuildView();
GetCanvas()->Refresh();
OnModify();
block->SetState( STATE_NO_BLOCK );
block->SetCommand( BLOCK_IDLE );
GetScreen()->SetCurItem( NULL );
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
GetCanvas()->GetView()->ClearPreview();
GetCanvas()->GetView()->ClearHiddenFlags();
}