本文整理汇总了C++中GetCrossHairPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCrossHairPosition函数的具体用法?C++ GetCrossHairPosition怎么用?C++ GetCrossHairPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCrossHairPosition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmd
bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
bool eventHandled = true;
// Filter out the 'fake' mouse motion after a keyboard movement
if( !aHotKey && m_movingCursorWithKeyboard )
{
m_movingCursorWithKeyboard = false;
return false;
}
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
wxPoint pos = aPosition;
wxPoint oldpos = GetCrossHairPosition();
GeneralControlKeyMovement( aHotKey, &pos, true );
switch( aHotKey )
{
case WXK_F1:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_F2:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_F3:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_F4:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_HOME:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case ' ':
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
default:
eventHandled = false;
}
SetCrossHairPosition( pos );
RefreshCrossHair( oldpos, aPosition, aDC );
UpdateStatusBar(); /* Display new cursor coordinates */
return eventHandled;
}
示例2: wxCHECK_RET
void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
initialPosition = aItem->GetStartPos();
initialPositionUi = aItem->GetStartPosUi();
initialCursorPosition = GetCrossHairPosition();
if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
{
initialPosition = aItem->GetEndPos();
initialPositionUi = aItem->GetEndPosUi();
}
if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
{
SetCrossHairPosition( initialPositionUi, false );
initialCursorPosition = GetCrossHairPosition();
if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
{
m_canvas->MoveCursorToCrossHair();
m_canvas->Refresh();
}
else
{
RedrawScreen( initialCursorPosition, true );
}
}
m_canvas->SetMouseCapture( moveItem, abortMoveItem );
GetScreen()->SetCurItem( aItem );
}
示例3: GetDesignSettings
/* Initialize the drawing of a segment of type other than trace.
*/
DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC )
{
int lineWidth;
DRAWSEGMENT* DrawItem;
lineWidth = GetDesignSettings().GetLineThickness( GetActiveLayer() );
if( Segment == NULL ) // Create new segment.
{
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->SetFlags( IS_NEW );
Segment->SetLayer( GetActiveLayer() );
Segment->SetWidth( lineWidth );
Segment->SetShape( shape );
Segment->SetAngle( 900 );
Segment->SetStart( GetCrossHairPosition() );
Segment->SetEnd( GetCrossHairPosition() );
m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
}
else
{
// The ending point coordinate Segment->m_End was updated by the function
// DrawSegment() called on a move mouse event during the segment creation
if( Segment->GetStart() != Segment->GetEnd() )
{
if( Segment->GetShape() == S_SEGMENT )
{
SaveCopyInUndoList( Segment, UR_NEW );
GetBoard()->Add( Segment );
OnModify();
Segment->ClearFlags();
Segment->Draw( m_canvas, DC, GR_OR );
DrawItem = Segment;
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->SetFlags( IS_NEW );
Segment->SetLayer( DrawItem->GetLayer() );
Segment->SetWidth( lineWidth );
Segment->SetShape( DrawItem->GetShape() );
Segment->SetType( DrawItem->GetType() );
Segment->SetAngle( DrawItem->GetAngle() );
Segment->SetStart( DrawItem->GetEnd() );
Segment->SetEnd( DrawItem->GetEnd() );
DrawSegment( m_canvas, DC, wxDefaultPosition, false );
}
else
{
End_Edge( Segment, DC );
Segment = NULL;
}
}
}
return Segment;
}
示例4: GetCrossHairPosition
void PL_EDITOR_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;
}
wxPoint pos = aPosition;
wxPoint oldpos = GetCrossHairPosition();
GeneralControlKeyMovement( aHotKey, &pos, true );
// Update cursor position.
SetCrossHairPosition( pos, true );
RefreshCrossHair( oldpos, aPosition, aDC );
if( aHotKey )
{
OnHotKey( aDC, aHotKey, aPosition );
}
UpdateStatusBar();
}
示例5: SetRepeatItem
// Create hierarchy sheet.
SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
{
SetRepeatItem( NULL );
SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
sheet->SetFlags( IS_NEW | IS_RESIZED );
sheet->SetTimeStamp( GetNewTimeStamp() );
sheet->SetParent( GetScreen() );
sheet->SetScreen( NULL );
// need to check if this is being added to the GetDrawItems().
// also need to update the hierarchy, if we are adding
// a sheet to a screen that already has multiple instances (!)
GetScreen()->SetCurItem( sheet );
m_canvas->SetMouseCapture( resizeSheetWithMouseCursor, ExitSheet );
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
m_canvas->CrossHairOff( aDC );
SetCrossHairPosition( sheet->GetResizePosition() );
m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC );
return sheet;
}
示例6: GetCrossHairPosition
void EDA_DRAW_FRAME::RefreshCrossHair( const wxPoint &aOldPos,
const wxPoint &aEvtPos,
wxDC* aDC )
{
wxPoint newpos = GetCrossHairPosition();
// Redraw the crosshair if it moved
if( aOldPos != newpos )
{
SetCrossHairPosition( aOldPos, false );
m_canvas->CrossHairOff( aDC );
SetCrossHairPosition( newpos, false );
m_canvas->CrossHairOn( aDC );
if( m_canvas->IsMouseCaptured() )
{
#ifdef USE_WX_OVERLAY
wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC );
oDC.Clear();
m_canvas->CallMouseCapture( aDC, aEvtPos, false );
#else
m_canvas->CallMouseCapture( aDC, aEvtPos, true );
#endif
}
#ifdef USE_WX_OVERLAY
else
{
m_overlay.Reset();
}
#endif
}
}
示例7: GetCrossHairPosition
void GERBVIEW_FRAME::Block_Move( wxDC* DC )
{
wxPoint delta;
wxPoint oldpos;
oldpos = GetCrossHairPosition();
m_canvas->SetMouseCaptureCallback( NULL );
SetCrossHairPosition( oldpos );
m_canvas->MoveCursorToCrossHair();
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();
/* Calculate displacement vectors. */
delta = GetScreen()->m_BlockLocate.GetMoveVector();
/* Move items in block */
for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
gerb_item->MoveAB( delta );
}
m_canvas->Refresh( true );
}
示例8: GetCrossHairPosition
bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
bool eventHandled = true;
// Filter out the 'fake' mouse motion after a keyboard movement
if( !aHotKey && m_movingCursorWithKeyboard )
{
m_movingCursorWithKeyboard = false;
return false;
}
wxPoint pos = aPosition;
wxPoint oldpos = GetCrossHairPosition();
GeneralControlKeyMovement( aHotKey, &pos, true );
// Update cursor position.
SetCrossHairPosition( pos, true );
RefreshCrossHair( oldpos, aPosition, aDC );
if( aHotKey )
{
SCH_SCREEN* screen = GetScreen();
if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
else
eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
}
UpdateStatusBar(); // Display cursor coordinates info.
return eventHandled;
}
示例9: HighLight
void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* aZone )
{
// Show the Net
if( aZone->IsOnCopperLayer() ) // Show the Net
{
if( GetBoard()->IsHighLightNetON() )
{
HighLight( DC ); // Remove old highlight selection
}
ZONE_SETTINGS zoneInfo = GetZoneSettings();
zoneInfo.m_NetcodeSelection = aZone->GetNet();
SetZoneSettings( zoneInfo );
GetBoard()->SetHighLightNet( aZone->GetNet() );
HighLight( DC );
}
s_PickedList.ClearListAndDeleteItems();
s_AuxiliaryList.ClearListAndDeleteItems();
SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNet(),
aZone->GetLayer() );
aZone->SetFlags( IS_MOVED );
m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
s_CursorLastPosition = s_CornerInitialPosition = GetCrossHairPosition();
s_CornerIsNew = false;
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
}
示例10: GetCrossHairPosition
bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
bool eventHandled = true;
// Filter out the 'fake' mouse motion after a keyboard movement
if( !aHotKey && m_movingCursorWithKeyboard )
{
m_movingCursorWithKeyboard = false;
return false;
}
// 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 );
SetCrossHairPosition( pos, snapToGrid );
RefreshCrossHair( oldpos, aPosition, aDC );
if( aHotKey )
{
eventHandled = OnHotKey( aDC, aHotKey, aPosition );
}
UpdateStatusBar();
return eventHandled;
}
示例11: SCH_SHEET_PIN
SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
{
wxString line;
SCH_SHEET_PIN* sheetPin;
sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), line );
sheetPin->SetFlags( IS_NEW );
sheetPin->SetSize( m_lastSheetPinTextSize );
sheetPin->SetShape( m_lastSheetPinType );
int response = EditSheetPin( sheetPin, NULL );
if( sheetPin->GetText().IsEmpty() || (response == wxID_CANCEL) )
{
delete sheetPin;
return NULL;
}
m_lastSheetPinType = sheetPin->GetShape();
m_lastSheetPinTextSize = sheetPin->GetSize();
sheetPin->SetPosition( GetCrossHairPosition() );
sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( (SCH_ITEM*) sheetPin, aDC );
OnModify();
return sheetPin;
}
示例12: SaveCopyInUndoList
void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{
if( Text != NULL )
{
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
// Update the coordinates for anchor.
MODULE* Module = static_cast<MODULE*>( Text->GetParent() );
if( Module )
{
// Prepare undo command (a rotation can be made while moving)
double tmp = Text->GetTextAngle();
Text->SetTextAngle( TextInitialOrientation );
if( IsType( FRAME_PCB ) )
SaveCopyInUndoList( Module, UR_CHANGED );
else
SaveCopyInUndoList( Module, UR_CHANGED );
Text->SetTextAngle( tmp );
// Set the new position for text.
Text->SetTextPos( GetCrossHairPosition() );
wxPoint textRelPos = Text->GetTextPos() - Module->GetPosition();
RotatePoint( &textRelPos, -Module->GetOrientation() );
Text->SetPos0( textRelPos );
Text->ClearFlags();
Module->ClearFlags();
Module->SetLastEditTime();
OnModify();
// Redraw text.
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
}
else
{
Text->SetTextPos( GetCrossHairPosition() );
}
}
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
m_canvas->SetMouseCapture( NULL, NULL );
}
示例13: INVERT
void PCB_EDIT_FRAME::Block_Flip()
{
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
wxPoint memo;
wxPoint center; // Position of the axis for inversion of all elements
OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_FLIPPED;
memo = GetCrossHairPosition();
center = GetScreen()->m_BlockLocate.Centre();
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
wxASSERT( item );
itemsList->SetPickedItemStatus( UR_FLIPPED, ii );
item->Flip( center );
switch( item->Type() )
{
case PCB_MODULE_T:
item->ClearFlags();
m_Pcb->m_Status_Pcb = 0;
break;
// Move and rotate the track segments
case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like track segment on a copper layer)
m_Pcb->m_Status_Pcb = 0;
break;
case PCB_ZONE_AREA_T:
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_TARGET_T:
case PCB_DIMENSION_T:
break;
// This item is not put in undo list
case PCB_ZONE_T: // SEG_ZONE items are now deprecated
itemsList->RemovePicker( ii );
ii--;
break;
default:
wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Flip( ) error: unexpected type" ) );
break;
}
}
SaveCopyInUndoList( *itemsList, UR_FLIPPED, center );
Compile_Ratsnest( NULL, true );
m_canvas->Refresh( true );
}
示例14: SCH_BUS_WIRE_ENTRY
SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry()
{
// Create and place a new bus entry at cursor position
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList();
return busEntry;
}
示例15: Genere_Self
void PCB_EDIT_FRAME::Begin_Self( wxDC* DC )
{
if( s_inductor_pattern.m_Flag )
{
Genere_Self( DC );
return;
}
s_inductor_pattern.m_Start = GetCrossHairPosition();
s_inductor_pattern.m_End = s_inductor_pattern.m_Start;
s_inductor_pattern.m_Flag = true;
// Update the initial coordinates.
GetScreen()->m_O_Curseur = GetCrossHairPosition();
UpdateStatusBar();
m_canvas->SetMouseCapture( ShowBoundingBoxMicroWaveInductor, Exit_Self );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
}