本文整理汇总了C++中PCB_EDIT_FRAME::SetCurItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PCB_EDIT_FRAME::SetCurItem方法的具体用法?C++ PCB_EDIT_FRAME::SetCurItem怎么用?C++ PCB_EDIT_FRAME::SetCurItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCB_EDIT_FRAME
的用法示例。
在下文中一共展示了PCB_EDIT_FRAME::SetCurItem方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Abort_Create_Track
/* Function called to abort a track creation
*/
static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent();
BOARD* pcb = frame->GetBoard();
TRACK* track = (TRACK*) frame->GetCurItem();
if( track && ( track->Type()==PCB_VIA_T || track->Type()==PCB_TRACE_T ) )
{
// Erase the current drawing
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
if( pcb->IsHighLightNetON() )
frame->HighLight( DC );
pcb->PopHighLight();
if( pcb->IsHighLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() );
frame->ClearMsgPanel();
// Undo pending changes (mainly a lock point creation) and clear the
// undo picker list:
frame->PutDataInPreviousState( &s_ItemsListPicker, false, false );
s_ItemsListPicker.ClearListAndDeleteItems();
// Delete current (new) track
g_CurrentTrackList.DeleteAll();
}
frame->SetCurItem( NULL );
}
示例2: Abort_MoveTrack
/** Abort function for drag or move track
*/
static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) aPanel->GetParent();
BOARD * pcb = frame->GetBoard();
pcb->HighLightOFF();
pcb->PopHighLight();
frame->SetCurItem( NULL );
aPanel->SetMouseCapture( NULL, NULL );
// Undo move and redraw trace segments.
for( unsigned jj=0 ; jj < g_DragSegmentList.size(); jj++ )
{
TRACK* track = g_DragSegmentList[jj].m_Track;
g_DragSegmentList[jj].RestoreInitialValues();
track->SetState( IN_EDIT, false );
track->ClearFlags();
}
// Clear the undo picker list:
s_ItemsListPicker.ClearListAndDeleteItems();
EraseDragList();
aPanel->Refresh();
}
示例3: Abort_Zone_Create_Outline
/**
* Function Abort_Zone_Create_Outline
* cancels the Begin_Zone command if at least one EDGE_ZONE was created.
*/
static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
if( zone )
{
zone->DrawWhileCreateOutline( Panel, DC, GR_XOR );
zone->ClearFlags();
zone->RemoveAllContours();
}
pcbframe->SetCurItem( NULL );
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
Panel->SetMouseCapture( NULL, NULL );
}
示例4: Abort_Zone_Move_Corner_Or_Outlines
/**
* Function Abort_Zone_Move_Corner_Or_Outlines
* cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
*/
void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( zone->IsMoving() )
{
wxPoint offset;
offset = s_CornerInitialPosition - s_CursorLastPosition;
zone->Move( offset );
}
else if( zone->IsDragging() )
{
wxPoint offset;
offset = s_CornerInitialPosition - s_CursorLastPosition;
zone->MoveEdge( offset );
}
else
{
if( s_CornerIsNew )
{
zone->m_Poly->DeleteCorner( zone->m_CornerSelection );
}
else
{
wxPoint pos = s_CornerInitialPosition;
zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y );
}
}
Panel->SetMouseCapture( NULL, NULL );
s_AuxiliaryList.ClearListAndDeleteItems();
s_PickedList. ClearListAndDeleteItems();
Panel->Refresh();
pcbframe->SetCurItem( NULL );
zone->ClearFlags();
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
}
示例5: Process_Special_Functions
//.........这里部分代码省略.........
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
BOARD_COMMIT commit( pcbframe );
// Create the "new" module
MODULE* newmodule = new MODULE( *module_in_edit );
newmodule->SetParent( mainpcb );
newmodule->SetLink( 0 );
if( source_module ) // this is an update command
{
// In the main board,
// the new module replace the old module (pos, orient, ref, value
// and connexions are kept)
// and the source_module (old module) is deleted
pcbframe->Exchange_Module( source_module, newmodule, commit );
newmodule->SetTimeStamp( module_in_edit->GetLink() );
commit.Push( wxT( "Update module" ) );
}
else // This is an insert command
{
wxPoint cursor_pos = pcbframe->GetCrossHairPosition();
commit.Add( newmodule );
pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
pcbframe->PlaceModule( newmodule, NULL );
newmodule->SetPosition( wxPoint( 0, 0 ) );
pcbframe->SetCrossHairPosition( cursor_pos );
newmodule->SetTimeStamp( GetNewTimeStamp() );
commit.Push( wxT( "Insert module" ) );
}
newmodule->ClearFlags();
GetScreen()->ClrModify();
pcbframe->SetCurItem( NULL );
// @todo LEGACY should be unnecessary
mainpcb->m_Status_Pcb = 0;
}
break;
case ID_MODEDIT_IMPORT_PART:
if( ! Clear_Pcb( true ) )
break; // //this command is aborted
SetCrossHairPosition( wxPoint( 0, 0 ) );
Import_Module();
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
GetScreen()->ClrModify();
Zoom_Automatique( false );
m_canvas->Refresh();
{
EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
if( draw3DFrame )
draw3DFrame->NewDisplay();
}
break;
case ID_MODEDIT_EXPORT_PART:
if( GetBoard()->m_Modules )
Export_Module( GetBoard()->m_Modules );
break;
示例6: Process_Special_Functions
//.........这里部分代码省略.........
case ID_OPEN_MODULE_VIEWER:
{
FOOTPRINT_VIEWER_FRAME * viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
if( viewer == NULL )
{
viewer = new FOOTPRINT_VIEWER_FRAME( this, NULL );
viewer->Show( true );
viewer->Zoom_Automatique( false );
}
else
{
if( viewer->IsIconized() )
viewer->Iconize( false );
viewer->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != viewer )
viewer->SetFocus();
}
}
break;
case ID_MODEDIT_DELETE_PART:
DeleteModuleFromCurrentLibrary();
break;
case ID_MODEDIT_NEW_MODULE:
{
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
MODULE* module = Create_1_Module( wxEmptyString );
if( module ) // i.e. if create module command not aborted
{
// Initialize data relative to nets and netclasses (for a new
// module the defaults are used)
// This is mandatory to handle and draw pads
GetBoard()->BuildListOfNets();
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
Zoom_Automatique( false );
}
}
break;
case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
{
Clear_Pcb( true );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
wxSemaphore semaphore( 0, 1 );
FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore,
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
wizard->Show( true );
示例7: SaveFootprintToBoard
bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
{
// update module in the current board,
// not just add it to the board with total disregard for the netlist...
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
if( pcbframe == NULL ) // happens when the board editor is not active (or closed)
{
DisplayErrorMessage( this, _("No board currently open." ) );
return false;
}
BOARD* mainpcb = pcbframe->GetBoard();
MODULE* source_module = NULL;
MODULE* module_in_edit = GetBoard()->m_Modules;
// Search the old module (source) if exists
// Because this source could be deleted when editing the main board...
if( module_in_edit->GetLink() ) // this is not a new module ...
{
source_module = mainpcb->m_Modules;
for( ; source_module != NULL; source_module = source_module->Next() )
{
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
break;
}
}
if( !aAddNew && source_module == NULL ) // source not found
{
DisplayError( this, _( "Unable to find the footprint on the main board.\nCannot save." ) );
return false;
}
if( aAddNew && source_module != NULL )
{
DisplayError( this, _( "Footprint already exists on board." ) );
return false;
}
m_toolManager->RunAction( PCB_ACTIONS::selectionClear, true );
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
BOARD_COMMIT commit( pcbframe );
// Create the "new" module
MODULE* newmodule = new MODULE( *module_in_edit );
newmodule->SetParent( mainpcb );
newmodule->SetLink( 0 );
if( source_module ) // this is an update command
{
// In the main board,
// the new module replace the old module (pos, orient, ref, value
// and connexions are kept)
// and the source_module (old module) is deleted
pcbframe->Exchange_Module( source_module, newmodule, commit );
newmodule->SetTimeStamp( module_in_edit->GetLink() );
commit.Push( wxT( "Update module" ) );
}
else // This is an insert command
{
wxPoint cursor_pos = pcbframe->GetCrossHairPosition();
commit.Add( newmodule );
pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
pcbframe->PlaceModule( newmodule, NULL );
newmodule->SetPosition( wxPoint( 0, 0 ) );
pcbframe->SetCrossHairPosition( cursor_pos );
newmodule->SetTimeStamp( GetNewTimeStamp() );
commit.Push( wxT( "Insert module" ) );
}
newmodule->ClearFlags();
pcbframe->SetCurItem( NULL );
// @todo LEGACY should be unnecessary
mainpcb->m_Status_Pcb = 0;
return true;
}