本文整理汇总了C++中SCH_EDIT_FRAME::GetUndoItem方法的典型用法代码示例。如果您正苦于以下问题:C++ SCH_EDIT_FRAME::GetUndoItem方法的具体用法?C++ SCH_EDIT_FRAME::GetUndoItem怎么用?C++ SCH_EDIT_FRAME::GetUndoItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SCH_EDIT_FRAME
的用法示例。
在下文中一共展示了SCH_EDIT_FRAME::GetUndoItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: abortMoveItem
static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_ITEM* item = screen->GetCurItem();
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
parent->SetRepeatItem( NULL );
screen->SetCurItem( NULL );
if( item == NULL ) /* no current item */
return;
if( item->IsNew() )
{
delete item;
item = NULL;
}
else
{
SCH_ITEM* oldItem = parent->GetUndoItem();
SCH_ITEM* currentItem;
// Items that are children of other objects are undone by swapping the contents
// of the parent items.
if( (item->Type() == SCH_SHEET_PIN_T) || (item->Type() == SCH_FIELD_T) )
{
currentItem = (SCH_ITEM*) item->GetParent();
}
else
{
currentItem = item;
}
wxCHECK_RET( oldItem != NULL && currentItem->Type() == oldItem->Type(),
wxT( "Cannot restore undefined or bad last schematic item." ) );
// Never delete existing item, because it can be referenced by an undo/redo command
// Just restore its data
currentItem->SwapData( oldItem );
// Erase the wire representation before the 'normal' view is drawn.
if ( item->IsWireImage() )
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
item->ClearFlags();
}
aPanel->Refresh();
}
示例2: ExitSheet
// Complete sheet move.
static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_ITEM* item = screen->GetCurItem();
SCH_EDIT_FRAME* parent = (SCH_EDIT_FRAME*) aPanel->GetParent();
if( (item == NULL) || (item->Type() != SCH_SHEET_T) || (parent == NULL) )
return;
parent->SetRepeatItem( NULL );
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
if( item->IsNew() )
{
delete item;
}
else if( item->IsMoving() || item->IsResized() )
{
screen->Remove( item );
delete item;
item = parent->GetUndoItem();
wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) );
screen->Append( item );
// the owner of item is no more parent, this is the draw list of screen:
parent->SetUndoItem( NULL );
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
item->ClearFlags();
}
else
{
item->ClearFlags();
}
screen->SetCurItem( NULL );
}