本文整理汇总了C++中PCB_BASE_EDIT_FRAME::GetScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_BASE_EDIT_FRAME::GetScreen方法的具体用法?C++ PCB_BASE_EDIT_FRAME::GetScreen怎么用?C++ PCB_BASE_EDIT_FRAME::GetScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCB_BASE_EDIT_FRAME
的用法示例。
在下文中一共展示了PCB_BASE_EDIT_FRAME::GetScreen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Properties
int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
if( !hoverSelection( selection, false ) )
return 0;
// Properties are displayed when there is only one item selected
if( selection.Size() == 1 )
{
// Display properties dialog
BOARD_ITEM* item = selection.Item<BOARD_ITEM>( 0 );
std::vector<PICKED_ITEMS_LIST*>& undoList = editFrame->GetScreen()->m_UndoList.m_CommandsList;
// Some of properties dialogs alter pointers, so we should deselect them
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
STATUS_FLAGS flags = item->GetFlags();
item->ClearFlags();
// It is necessary to determine if anything has changed
PICKED_ITEMS_LIST* lastChange = undoList.empty() ? NULL : undoList.back();
// Display properties dialog
editFrame->OnEditItemRequest( NULL, item );
PICKED_ITEMS_LIST* currentChange = undoList.empty() ? NULL : undoList.back();
if( lastChange != currentChange ) // Something has changed
{
processChanges( currentChange );
updateRatsnest( true );
getModel<BOARD>()->GetRatsnest()->Recalculate();
item->ViewUpdate();
m_toolMgr->RunAction( COMMON_ACTIONS::pointEditorUpdate, true );
}
item->SetFlags( flags );
}
return 0;
}
示例2: processUndoBuffer
void EDIT_TOOL::processUndoBuffer( const PICKED_ITEMS_LIST* aLastChange )
{
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
const std::vector<PICKED_ITEMS_LIST*>& undoList = editFrame->GetScreen()->m_UndoList.m_CommandsList;
bool process = false;
BOOST_FOREACH( const PICKED_ITEMS_LIST* list, undoList )
{
if( process )
processPickedList( list );
else if( list == aLastChange )
process = true; // Start processing starting with the next undo save point
}
// If we could not find the requested save point in the current undo list
// then the undo list must have been completely altered, so process everything
if( !process )
{
BOOST_FOREACH( const PICKED_ITEMS_LIST* list, undoList )
processPickedList( list );
}
示例3: Properties
int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
// Shall the selection be cleared at the end?
bool unselect = selection.Empty();
if( !hoverSelection( selection, false ) )
return 0;
// Tracks & vias are treated in a special way:
if( ( SELECTION_CONDITIONS::OnlyTypes( m_tracksViasType ) )( selection ) )
{
DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection );
if( dlg.ShowModal() )
{
RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
editFrame->OnModify();
editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED );
dlg.Apply();
selection.ForAll<KIGFX::VIEW_ITEM>( boost::bind( &KIGFX::VIEW_ITEM::ViewUpdate, _1,
KIGFX::VIEW_ITEM::ALL ) );
selection.ForAll<BOARD_ITEM>( boost::bind( &RN_DATA::Update, ratsnest, _1 ) );
ratsnest->Recalculate();
}
}
else if( selection.Size() == 1 ) // Properties are displayed when there is only one item selected
{
// Display properties dialog
BOARD_ITEM* item = selection.Item<BOARD_ITEM>( 0 );
// Store the head of the undo list to compare if anything has changed
std::vector<PICKED_ITEMS_LIST*>& undoList = editFrame->GetScreen()->m_UndoList.m_CommandsList;
// Some of properties dialogs alter pointers, so we should deselect them
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
STATUS_FLAGS flags = item->GetFlags();
item->ClearFlags();
// It is necessary to determine if anything has changed, so store the current undo save point
PICKED_ITEMS_LIST* undoSavePoint = undoList.empty() ? NULL : undoList.back();
// Display properties dialog provided by the legacy canvas frame
editFrame->OnEditItemRequest( NULL, item );
if( !undoList.empty() && undoList.back() != undoSavePoint ) // Undo buffer has changed
{
// Process changes stored after undoSavePoint
processUndoBuffer( undoSavePoint );
// Update the modified item
item->ViewUpdate();
RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
ratsnest->Recalculate();
// TODO OBSERVER! I miss you so much..
m_toolMgr->RunAction( COMMON_ACTIONS::pointEditorUpdate, true );
}
item->SetFlags( flags );
}
if( unselect )
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
return 0;
}
示例4: Properties
int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
if( !makeSelection( selection ) )
{
setTransitions();
return 0;
}
// Properties are displayed when there is only one item selected
if( selection.Size() == 1 )
{
// Display properties dialog
BOARD_ITEM* item = selection.Item<BOARD_ITEM>( 0 );
// Check if user wants to edit pad or module properties
if( item->Type() == PCB_MODULE_T )
{
VECTOR2D cursor = getViewControls()->GetCursorPosition();
for( D_PAD* pad = static_cast<MODULE*>( item )->Pads(); pad; pad = pad->Next() )
{
if( pad->ViewBBox().Contains( cursor ) )
{
// Turns out that user wants to edit a pad properties
item = pad;
break;
}
}
}
std::vector<PICKED_ITEMS_LIST*>& undoList = editFrame->GetScreen()->m_UndoList.m_CommandsList;
// Some of properties dialogs alter pointers, so we should deselect them
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
STATUS_FLAGS flags = item->GetFlags();
item->ClearFlags();
// It is necessary to determine if anything has changed
PICKED_ITEMS_LIST* lastChange = undoList.empty() ? NULL : undoList.back();
// Display properties dialog
editFrame->OnEditItemRequest( NULL, item );
PICKED_ITEMS_LIST* currentChange = undoList.empty() ? NULL : undoList.back();
if( lastChange != currentChange ) // Something has changed
{
processChanges( currentChange );
updateRatsnest( true );
getModel<BOARD>()->GetRatsnest()->Recalculate();
item->ViewUpdate();
m_toolMgr->RunAction( COMMON_ACTIONS::pointEditorUpdate, true );
}
item->SetFlags( flags );
}
setTransitions();
return 0;
}