本文整理汇总了C++中PCB_EDIT_FRAME类的典型用法代码示例。如果您正苦于以下问题:C++ PCB_EDIT_FRAME类的具体用法?C++ PCB_EDIT_FRAME怎么用?C++ PCB_EDIT_FRAME使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PCB_EDIT_FRAME类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainLoop
int ROUTER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
{
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
BOARD* board = getModel<BOARD>();
// Deselect all items
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
Activate();
m_router->SetMode ( aMode );
m_ctls->SetSnapping( true );
m_ctls->ShowCursor( true );
std::auto_ptr<ROUTER_TOOL_MENU> ctxMenu ( new ROUTER_TOOL_MENU( board, aMode ) );
SetContextMenu ( ctxMenu.get() );
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
if( m_needsSync )
{
m_router->SyncWorld();
m_router->SetView( getView() );
m_needsSync = false;
}
if( evt->IsCancel() || evt->IsActivate() )
break; // Finish
else if( evt->Action() == TA_UNDO_REDO )
m_needsSync = true;
else if( evt->IsMotion() )
updateStartItem( *evt );
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
{
updateStartItem( *evt );
if( evt->Modifier( MD_CTRL ) )
performDragging();
else
performRouting();
}
else if( evt->IsAction( &ACT_Drag ) )
performDragging();
handleCommonEvents( *evt );
}
// Restore the default settings
m_ctls->SetAutoPan( false );
m_ctls->ShowCursor( false );
frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
// Store routing settings till the next invocation
m_savedSettings = m_router->Settings();
m_savedSizes = m_router->Sizes();
return 0;
}
示例2: performDragging
void ROUTER_TOOL::performDragging()
{
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
bool saveUndoBuffer = true;
VIEW_CONTROLS* ctls = getViewControls();
bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem );
if( !dragStarted )
return;
if( m_startItem && m_startItem->Net() >= 0 )
highlightNet( true, m_startItem->Net() );
ctls->ForceCursorPosition( false );
ctls->SetAutoPan( true );
while( OPT_TOOL_EVENT evt = Wait() )
{
if( evt->IsCancel() || evt->IsActivate() )
break;
else if( evt->Action() == TA_UNDO_REDO )
{
saveUndoBuffer = false;
break;
}
else if( evt->IsMotion() )
{
updateEndItem( *evt );
m_router->Move( m_endSnapPoint, m_endItem );
}
else if( evt->IsClick( BUT_LEFT ) )
{
if( m_router->FixRoute( m_endSnapPoint, m_endItem ) )
break;
}
handleCommonEvents( *evt );
}
if( m_router->RoutingInProgress() )
m_router->StopRouting();
if( saveUndoBuffer )
{
// Save the recent changes in the undo buffer
frame->SaveCopyInUndoList( m_router->GetUndoBuffer(), UR_UNSPECIFIED );
m_router->ClearUndoBuffer();
frame->OnModify();
}
else
{
// It was interrupted by TA_UNDO_REDO event, so we have to sync the world now
m_needsSync = true;
}
ctls->SetAutoPan( false );
ctls->ForceCursorPosition( false );
highlightNet( false );
}
示例3: GetParent
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
{
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
wxString libname = m_libraryName + wxT( "." ) + LegacyFootprintLibPathExtension;
MODULE* oldmodule = GetBoard()->m_Modules;
MODULE* module = LoadModuleFromLibrary( libname, parent->FootprintLibs(),
false );
if( module )
{
module->SetPosition( wxPoint( 0, 0 ) );
// Only one footprint allowed: remove the previous footprint (if exists)
if( oldmodule )
{
GetBoard()->Remove( oldmodule );
delete oldmodule;
}
m_footprintName = FROM_UTF8( module->GetFPID().GetFootprintName().c_str() );
module->ClearFlags();
SetCurItem( NULL );
Zoom_Automatique( false );
m_canvas->Refresh();
Update3D_Frame();
m_footprintList->SetStringSelection( m_footprintName );
}
}
示例4: Kiway
void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent )
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
MODULE* module_in_edit = GetBoard()->m_Modules;
bool canInsert = frame && module_in_edit && !module_in_edit->GetLink();
// If the source was deleted, the module can inserted but not updated in the board.
if( frame && module_in_edit && module_in_edit->GetLink() ) // this is not a new module
{
BOARD* mainpcb = frame->GetBoard();
MODULE* source_module = mainpcb->m_Modules;
// search if the source module was not deleted:
for( ; source_module != NULL; source_module = source_module->Next() )
{
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
break;
}
canInsert = ( source_module == NULL );
}
aEvent.Enable( canInsert );
}
示例5: Show_Zone_Corner_Or_Outline_While_Move_Mouse
/// Redraws the zone outline when moving a corner according to the cursor position
void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( aErase ) // Undraw edge in old position
{
zone->Draw( aPanel, aDC, GR_XOR );
}
wxPoint pos = pcbframe->GetScreen()->GetCrossHairPosition();
if( zone->IsMoving() )
{
wxPoint offset;
offset = pos - s_CursorLastPosition;
zone->Move( offset );
s_CursorLastPosition = pos;
}
else if( zone->IsDragging() )
{
wxPoint offset;
offset = pos - s_CursorLastPosition;
zone->MoveEdge( offset );
s_CursorLastPosition = pos;
}
else
{
zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y );
}
zone->Draw( aPanel, aDC, GR_XOR );
}
示例6: Show_New_Edge_While_Move_Mouse
/* Redraws the zone outlines when moving mouse
*/
static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
wxPoint c_pos = pcbframe->GetScreen()->GetCrossHairPosition();
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
if( !zone )
return;
int icorner = zone->GetNumCorners() - 1;
if( icorner < 1 )
return; // We must have 2 (or more) corners
if( aErase ) // Undraw edge in old position
{
zone->DrawWhileCreateOutline( aPanel, aDC );
}
// Redraw the current edge in its new position
if( pcbframe->GetZoneSettings().m_Zone_45_Only )
{
// calculate the new position as allowed
wxPoint StartPoint = zone->GetCornerPosition( icorner - 1 );
CalculateSegmentEndPoint( c_pos, StartPoint.x, StartPoint.y, &c_pos.x, &c_pos.y );
}
zone->SetCornerPosition( icorner, c_pos );
zone->DrawWhileCreateOutline( aPanel, aDC );
}
示例7: InlineDrag
int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
{
const BOARD_CONNECTED_ITEM* item = aEvent.Parameter<const BOARD_CONNECTED_ITEM*>();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
VIEW_CONTROLS* ctls = getViewControls();
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
Activate();
m_router->SyncWorld();
m_startItem = m_router->GetWorld()->FindItemByParent( item );
if( m_startItem && m_startItem->IsLocked() )
{
if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
return false;
}
VECTOR2I p0 = ctls->GetCursorPosition();
bool dragStarted = m_router->StartDragging( p0, m_startItem );
if( !dragStarted )
return 0;
ctls->ForceCursorPosition( false );
ctls->SetAutoPan( true );
frame->UndoRedoBlock( true );
while( OPT_TOOL_EVENT evt = Wait() )
{
if( evt->IsCancel() )
{
break;
}
else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
{
updateEndItem( *evt );
m_router->Move( m_endSnapPoint, m_endItem );
}
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
{
updateEndItem( *evt );
m_router->FixRoute( m_endSnapPoint, m_endItem );
break;
}
}
if( m_router->RoutingInProgress() )
m_router->StopRouting();
ctls->SetAutoPan( false );
ctls->ShowCursor( false );
frame->UndoRedoBlock( false );
return 0;
}
示例8: 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();
}
示例9: Kiway
bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
{
MODULE* newModule;
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
if( frame == NULL ) // happens if no board editor opened
return false;
if( aModule == NULL )
{
if( ! frame->GetBoard() || ! frame->GetBoard()->m_Modules )
return false;
aModule = SelectFootprint( frame->GetBoard() );
}
if( aModule == NULL )
return false;
SetCurItem( NULL );
Clear_Pcb( false );
GetBoard()->m_Status_Pcb = 0;
newModule = new MODULE( *aModule );
newModule->SetParent( GetBoard() );
newModule->SetLink( aModule->GetTimeStamp() );
aModule = newModule;
GetBoard()->Add( newModule );
newModule->ClearFlags();
// Clear references to net info, because the footprint editor
// does know any thing about nets handled by the current edited board.
// Morever the main board can change or the net info relative to this main board
// can change while editing this footprint in the footprint editor
for( D_PAD* pad = newModule->Pads(); pad; pad = pad->Next() )
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
SetCrossHairPosition( wxPoint( 0, 0 ) );
PlaceModule( newModule, NULL );
// Put it on FRONT layer,
// because this is the default in ModEdit, and in libs
if( newModule->GetLayer() != LAYER_N_FRONT )
newModule->Flip( newModule->GetPosition() );
// Put it in orientation 0,
// because this is the default orientation in ModEdit, and in libs
Rotate_Module( NULL, newModule, 0, false );
GetScreen()->ClrModify();
Zoom_Automatique( false );
return true;
}
示例10: GetTopWindow
/* MacOSX: Needed for file association
* http://wiki.wxwidgets.org/WxMac-specific_topics
*/
void EDA_APP::MacOpenFile( const wxString& fileName )
{
wxFileName filename = fileName;
PCB_EDIT_FRAME* frame = ( (PCB_EDIT_FRAME*) GetTopWindow() );
if( !filename.FileExists() )
return;
frame->LoadOnePcbFile( fileName, false );
}
示例11: LayerNext
int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
LAYER_NUM layer = editFrame->GetActiveLayer();
layer = ( layer + 1 ) % ( LAST_COPPER_LAYER + 1 );
assert( IsCopperLayer( layer ) );
editFrame->SwitchLayer( NULL, layer );
editFrame->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
示例12: GetParent
void DIALOG_PLOT::onRunDRC( wxCommandEvent& event )
{
PCB_EDIT_FRAME* parent = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
if( parent )
{
// First close an existing dialog if open
// (low probability, but can happen)
parent->GetDrcController()->DestroyDRCDialog( wxID_OK );
// Open a new drc dialod, with the right parent frame, and in Modal Mode
parent->GetDrcController()->ShowDRCDialog( this );
}
}
示例13:
TOOL_SETTINGS::TOOL_SETTINGS( TOOL_BASE* aTool )
{
m_tool = aTool;
if( !aTool )
{
m_config = NULL;
return;
}
// fixme: make independent of pcbnew (post-stable)
PCB_EDIT_FRAME* frame = aTool->getEditFrame<PCB_EDIT_FRAME>();
m_config = frame->GetSettings();
}
示例14: changeAllFootprints
bool DIALOG_EXCHANGE_MODULE::changeAllFootprints()
{
MODULE* Module, * PtBack;
bool change = false;
int ShowErr = 3; // Post 3 error max.
if( m_parent->GetBoard()->m_Modules == NULL )
return false;
if( !IsOK( this, _( "Are you sure you want to change all footprints?" ) ) )
return false;
/* The change is done from the last module because the function
* change_1_Module () modifies the last module in the list
*
* note: for the first module in chain (the last here), Module->Back()
* points the board or is NULL
*/
Module = m_parent->GetBoard()->m_Modules.GetLast();
for( ; Module && ( Module->Type() == PCB_MODULE_T ); Module = PtBack )
{
PtBack = Module->Back();
if( change_1_Module( Module, Module->GetFPID(), ShowErr ) )
change = true;
else if( ShowErr )
ShowErr--;
}
return change;
}
示例15: OnOkClick
void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event )
{
m_selectionMode = m_Selection->GetSelection();
bool result = false;
switch( m_Selection->GetSelection() )
{
case 0:
result = changeCurrentFootprint();
break;
case 1:
result = changeSameFootprints( false );
break;
case 2:
result = changeSameFootprints( true );
break;
case 3:
result = changeAllFootprints();
break;
}
if( result )
{
if( m_parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
m_parent->Compile_Ratsnest( NULL, true );
m_parent->GetCanvas()->Refresh();
}
m_commit.Push( wxT( "Changed footprint" ) );
}