本文整理汇总了C++中EDA_ITEM::ViewUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ EDA_ITEM::ViewUpdate方法的具体用法?C++ EDA_ITEM::ViewUpdate怎么用?C++ EDA_ITEM::ViewUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDA_ITEM
的用法示例。
在下文中一共展示了EDA_ITEM::ViewUpdate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processChanges
void EDIT_TOOL::processChanges( const PICKED_ITEMS_LIST* aList )
{
for( unsigned int i = 0; i < aList->GetCount(); ++i )
{
UNDO_REDO_T operation = aList->GetPickedItemStatus( i );
EDA_ITEM* updItem = aList->GetPickedItem( i );
switch( operation )
{
case UR_CHANGED:
case UR_MODEDIT:
updItem->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
break;
case UR_DELETED:
if( updItem->Type() == PCB_MODULE_T )
static_cast<MODULE*>( updItem )->RunOnChildren( boost::bind( &KIGFX::VIEW::Remove,
getView(), _1 ) );
getView()->Remove( updItem );
break;
case UR_NEW:
if( updItem->Type() == PCB_MODULE_T )
static_cast<MODULE*>( updItem )->RunOnChildren( boost::bind( &KIGFX::VIEW::Add,
getView(), _1 ) );
getView()->Add( updItem );
updItem->ViewUpdate();
break;
default:
assert( false ); // Not handled
break;
}
}
}
示例2: OnSelectionChange
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
if( selection.Size() == 1 )
{
Activate();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
KIGFX::VIEW* view = getView();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
EDA_ITEM* item = selection.items.GetPickedItem( 0 );
m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
if( !m_editPoints )
return 0;
view->Add( m_editPoints.get() );
m_editedPoint = NULL;
bool modified = false;
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
if( !m_editPoints ||
evt->Matches( m_selectionTool->ClearedEvent ) ||
evt->Matches( m_selectionTool->UnselectedEvent ) ||
evt->Matches( m_selectionTool->SelectedEvent ) )
{
break;
}
if( evt->IsMotion() )
{
EDIT_POINT* point = m_editPoints->FindPoint( evt->Position() );
if( m_editedPoint != point )
setEditedPoint( point );
}
else if( evt->IsAction( &COMMON_ACTIONS::pointEditorAddCorner ) )
{
addCorner( controls->GetCursorPosition() );
updatePoints();
}
else if( evt->IsAction( &COMMON_ACTIONS::pointEditorRemoveCorner ) )
{
if( m_editedPoint )
{
removeCorner( m_editedPoint );
updatePoints();
}
}
else if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
{
if( !modified )
{
// Save items, so changes can be undone
editFrame->OnModify();
editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED );
controls->ForceCursorPosition( false );
m_original = *m_editedPoint; // Save the original position
controls->SetAutoPan( true );
modified = true;
}
bool enableAltConstraint = !!evt->Modifier( MD_CTRL );
if( enableAltConstraint != (bool) m_altConstraint ) // alternative constraint
setAltConstraint( enableAltConstraint );
m_editedPoint->SetPosition( controls->GetCursorPosition() );
if( m_altConstraint )
m_altConstraint->Apply();
else
m_editedPoint->ApplyConstraint();
updateItem();
updatePoints();
m_editPoints->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
else if( evt->IsAction( &COMMON_ACTIONS::pointEditorUpdate ) )
{
updatePoints();
}
else if( evt->IsMouseUp( BUT_LEFT ) )
{
controls->SetAutoPan( false );
setAltConstraint( false );
modified = false;
m_toolMgr->PassEvent();
}
else if( evt->IsCancel() )
//.........这里部分代码省略.........