本文整理汇总了C++中GetToolId函数的典型用法代码示例。如果您正苦于以下问题:C++ GetToolId函数的具体用法?C++ GetToolId怎么用?C++ GetToolId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetToolId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCurItem
bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
bool itemCurrentlyEdited = item && item->GetFlags();
m_canvas->SetAutoPanRequest( false );
if( itemCurrentlyEdited )
{
m_canvas->SetIgnoreMouseEvents( true );
m_canvas->CrossHairOff( aDC );
switch( item->Type() )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( item->IsDragging() )
PlaceDraggedOrMovedTrackSegment( static_cast<TRACK*>( item ), aDC );
break;
case PCB_TEXT_T:
Place_Texte_Pcb( static_cast<TEXTE_PCB*>( item ), aDC );
break;
case PCB_MODULE_TEXT_T:
PlaceTexteModule( static_cast<TEXTE_MODULE*>( item ), aDC );
break;
case PCB_PAD_T:
PlacePad( static_cast<D_PAD*>( item ), aDC );
break;
case PCB_MODULE_T:
PlaceModule( static_cast<MODULE*>( item ), aDC );
break;
case PCB_TARGET_T:
PlaceTarget( static_cast<PCB_TARGET*>( item ), aDC );
break;
case PCB_LINE_T:
if( no_tool ) // when no tools: existing item moving.
Place_DrawItem( static_cast<DRAWSEGMENT*>( item ), aDC );
break;
default:
break;
}
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->CrossHairOn( aDC );
return true;
}
return false;
}
示例2: GetToolId
void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_component != NULL );
if( m_component != NULL && aEvent.GetEventObject() == m_drawToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
示例3: wxASSERT
void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
{
wxASSERT( m_canvas->IsMouseCaptured() );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
switch( GetScreen()->m_BlockLocate.GetCommand() )
{
case BLOCK_MOVE: /* Move */
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Move( DC );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
default:
wxFAIL_MSG( wxT("HandleBlockPlace: Unexpected block command") );
break;
}
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
GetScreen()->SetModify();
GetScreen()->ClearBlockCommand();
wxASSERT( GetScreen()->m_BlockLocate.GetCount() == 0 );
DisplayToolMsg( wxEmptyString );
}
示例4: GetBoard
void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetBoard()->m_Modules != NULL );
if( aEvent.GetEventObject() == m_drawToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
示例5: GetCurPart
void LIB_EDIT_FRAME::OnUpdateEditingPart( wxUpdateUIEvent& aEvent )
{
LIB_PART* part = GetCurPart();
aEvent.Enable( part != NULL );
if( part && aEvent.GetEventObject() == m_drawToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
示例6: GetBoard
void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{
GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
if( !m_canvas->IsMouseCaptured() )
{
DisplayError( this, wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
}
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
const BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
switch( command )
{
case BLOCK_IDLE:
break;
case BLOCK_DRAG: // Drag
case BLOCK_MOVE: // Move
case BLOCK_PRESELECT_MOVE: // Move with preselection list
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Move();
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: // Copy
case BLOCK_COPY_AND_INCREMENT:
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Duplicate( command == BLOCK_COPY_AND_INCREMENT );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_PASTE:
break;
case BLOCK_ZOOM: // Handled by HandleBlockEnd()
default:
break;
}
OnModify();
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
GetScreen()->ClearBlockCommand();
if( GetScreen()->m_BlockLocate.GetCount() )
{
DisplayError( this, wxT( "Error in HandleBlockPLace some items left in list" ) );
GetScreen()->m_BlockLocate.ClearItemsList();
}
}
示例7: wxUnusedVar
void NewToolDlg::OnButtonOk( wxCommandEvent& event )
{
wxUnusedVar(event);
int rc(wxID_OK);
// load all the tools
ExternalToolsData inData;
m_mgr->GetConfigTool()->ReadObject(wxT("ExternalTools"), &inData);
for(size_t i=0; i<inData.GetTools().size(); i++){
if(GetToolId() == inData.GetTools().at(i).GetId()){
int answer = wxMessageBox(wxString::Format(wxT("Continue updating tool ID '%s'"), GetToolId().c_str()), wxT("EmbeddedLite"), wxYES_NO|wxCANCEL, this);
if(answer != wxYES){
rc = wxID_CANCEL;
}
break;
}
}
EndModal(rc);
}
示例8: GetToolId
void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
{
bool redraw = false;
EDA_DRAW_FRAME::SetToolID( aId, aCursor, aToolMsg );
if( aId < 0 )
return;
// handle color changes for transitions in and out of ID_TRACK_BUTT
if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
|| ( GetToolId() != ID_TRACK_BUTT && aId== ID_TRACK_BUTT ) )
{
if( DisplayOpt.ContrastModeDisplay )
redraw = true;
}
// must do this after the tool has been set, otherwise pad::Draw() does
// not show proper color when DisplayOpt.ContrastModeDisplay is true.
if( redraw && m_canvas)
m_canvas->Refresh();
}
示例9: SaveCopyInUndoList
void LIB_EDIT_FRAME::OnRotateItem( wxCommandEvent& aEvent )
{
if( m_drawItem == NULL )
return;
if( !m_drawItem->InEditMode() )
{
SaveCopyInUndoList( m_component );
m_drawItem->SetUnit( m_unit );
}
m_drawItem->Rotate();
OnModify();
if( !m_drawItem->InEditMode() )
m_drawItem->ClearFlags();
m_canvas->Refresh();
if( GetToolId() == ID_NO_TOOL_SELECTED )
m_lastDrawItem = NULL;
}
示例10: switch
bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
{
bool nextcmd = false;
bool zoom_command = false;
if( m_canvas->IsMouseCaptured() )
switch( GetScreen()->m_BlockLocate.GetCommand() )
{
case BLOCK_MOVE: /* Move */
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
nextcmd = true;
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
break;
case BLOCK_ZOOM: /* Window Zoom */
zoom_command = true;
break;
default:
wxFAIL_MSG( wxT("HandleBlockEnd: Unexpected block command") );
break;
}
if( ! nextcmd )
{
GetScreen()->ClearBlockCommand();
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
false );
}
if( zoom_command )
Window_Zoom( GetScreen()->m_BlockLocate );
return nextcmd ;
}
示例11: GetDrawItem
void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
{
LIB_ITEM* item = GetDrawItem();
if( item == NULL )
return;
if( LIB_PART* part = GetCurPart() )
{
if( GetToolId() != ID_NO_TOOL_SELECTED )
SetCursor( wxCURSOR_PENCIL );
else
SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
if( GetTempCopyComponent() ) // used when editing an existing item
SaveCopyInUndoList( GetTempCopyComponent() );
else
{
// When creating a new item, there is still no change for the
// current symbol. So save it.
SaveCopyInUndoList( part );
}
if( item->IsNew() )
part->AddDrawItem( item );
item->EndEdit( GetCrossHairPosition( true ) );
SetDrawItem( NULL );
OnModify();
m_canvas->SetMouseCapture( NULL, NULL );
m_canvas->Refresh();
}
}
示例12: GetCurItem
/*
* Called on a mouse left button double click
*/
void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
BOARD_ITEM* item = GetCurItem();
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
item = ModeditLocateAndDisplay();
}
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
break;
// Item found
SetCurItem( item );
OnEditItemRequest( DC, item );
break; // end case 0
case ID_PCB_ADD_LINE_BUTT:
{
if( item && item->IsNew() )
{
End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL );
m_canvas->Refresh();
}
break;
}
default:
break;
}
}
示例13: switch
/* Must be called on a click on the left toolbar (options toolbar
* Update variables according to tools states
*/
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool state = event.IsChecked();
switch( id )
{
case ID_TB_OPTIONS_DRC_OFF:
g_Drc_On = !state;
if( GetToolId() == ID_TRACK_BUTT )
{
if( g_Drc_On )
m_canvas->SetCursor( wxCURSOR_PENCIL );
else
m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW );
}
break;
case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility( RATSNEST_VISIBLE, state );
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
Compile_Ratsnest( NULL, true );
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = state; // TODO: use the visibility list
break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK:
g_AutoDeleteOldTrack = state;
break;
case ID_TB_OPTIONS_SHOW_ZONES:
DisplayOpt.DisplayZonesMode = 0;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
DisplayOpt.DisplayZonesMode = 1;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
DisplayOpt.DisplayZonesMode = 2;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
{
DisplayOpt.ContrastModeDisplay = state;
m_canvas->Refresh();
break;
}
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
m_show_microwave_tools = state;
m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR,
m_show_microwave_tools ?
_( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" ));
break;
case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR:
// show auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
m_show_layer_manager_tools ?
_( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ) );
break;
default:
DisplayError( this,
wxT( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) );
break;
}
}
示例14: GetCurPart
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{
LIB_ITEM* item = m_drawItem;
bool item_in_edit = item && item->InEditMode();
bool no_item_edited = !item_in_edit;
LIB_PART* part = GetCurPart();
if( !part ) // No component loaded !
return;
if( ( GetToolId() == ID_NO_TOOL_SELECTED ) && no_item_edited )
{
item = LocateItemUsingCursor( aPosition );
if( item )
{
MSG_PANEL_ITEMS items;
item->GetMsgPanelInfo( items );
SetMsgPanel( items );
}
else
{
DisplayCmpDoc();
if( m_canvas->GetAbortRequest() )
m_canvas->SetAbortRequest( false );
}
}
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
// If an item is currently in edit, finish edit
if( item_in_edit )
{
switch( item->Type() )
{
case LIB_PIN_T:
PlacePin();
break;
default:
EndDrawGraphicItem( DC );
break;
}
}
break;
case ID_LIBEDIT_PIN_BUTT:
if( no_item_edited )
CreatePin( DC );
else
PlacePin();
break;
case ID_LIBEDIT_BODY_LINE_BUTT:
case ID_LIBEDIT_BODY_ARC_BUTT:
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
case ID_LIBEDIT_BODY_RECT_BUTT:
case ID_LIBEDIT_BODY_TEXT_BUTT:
if( no_item_edited )
m_drawItem = CreateGraphicItem( part, DC );
else if( m_drawItem )
{
if( m_drawItem->IsNew() )
GraphicItemBeginDraw( DC );
else
EndDrawGraphicItem( DC );
}
break;
case ID_LIBEDIT_DELETE_ITEM_BUTT:
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem )
deleteItem( DC );
else
DisplayCmpDoc();
break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SaveCopyInUndoList( part );
PlaceAnchor();
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "Unhandled command ID %d" ), GetToolId() ) );
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
break;
}
}
示例15: GetCrossHairPosition
void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
// Filter out the 'fake' mouse motion after a keyboard movement
if( !aHotKey && m_movingCursorWithKeyboard )
{
m_movingCursorWithKeyboard = false;
return;
}
// when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
// for next cursor position
// ( shift or ctrl key down are PAN command with mouse wheel)
bool snapToGrid = true;
if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
snapToGrid = false;
wxPoint oldpos = GetCrossHairPosition();
wxPoint pos = aPosition;
GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
// Put cursor in new position, according to the zoom keys (if any).
SetCrossHairPosition( pos, snapToGrid );
/* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
* cursor is left off grid this is better to reach items to delete off grid,
*/
if( GetToolId() == ID_PCB_DELETE_ITEM_BUTT )
snapToGrid = false;
// Cursor is left off grid if no block in progress
if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
snapToGrid = true;
wxPoint curs_pos = pos;
wxRealPoint gridSize = GetScreen()->GetGridSize();
wxSize igridsize;
igridsize.x = KiROUND( gridSize.x );
igridsize.y = KiROUND( gridSize.y );
if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) )
{
SetCrossHairPosition( pos, false );
}
else
{
// If there's no intrusion and DRC is active, we pass the cursor
// "as is", and let ShowNewTrackWhenMovingCursor figure out what to do.
if( !g_Drc_On || !g_CurrentTrackSegment ||
(BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
!LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
GetScreen()->m_Active_Layer, RefPos( true ) ) )
{
SetCrossHairPosition( curs_pos, snapToGrid );
}
}
RefreshCrossHair( oldpos, aPosition, aDC );
if( aHotKey )
{
OnHotKey( aDC, aHotKey, aPosition );
}
UpdateStatusBar(); // Display new cursor coordinates
}