本文整理汇总了C++中GetCrossHairPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCrossHairPosition函数的具体用法?C++ GetCrossHairPosition怎么用?C++ GetCrossHairPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCrossHairPosition函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:antogg,项目名称:kicad-source-mirror,代码行数:60,代码来源:class_DisplayFootprintsFrame.cpp
示例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 );
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:32,代码来源:events_functions.cpp
示例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;
}
开发者ID:johnbeard,项目名称:kicad,代码行数:61,代码来源:editedge.cpp
示例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();
}
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:25,代码来源:controle.cpp
示例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;
}
开发者ID:bpkempke,项目名称:kicad-source-mirror,代码行数:27,代码来源:sheet.cpp
示例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
}
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:32,代码来源:draw_frame.cpp
示例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 );
}
开发者ID:barrem,项目名称:kicad-source-mirror,代码行数:27,代码来源:block.cpp
示例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;
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:33,代码来源:controle.cpp
示例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;
}
开发者ID:jerkey,项目名称:kicad,代码行数:31,代码来源:zones_by_polygon.cpp
示例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;
}
开发者ID:flighta-zeng,项目名称:kicad-source-mirror,代码行数:35,代码来源:moduleframe.cpp
示例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;
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:28,代码来源:sheetlab.cpp
示例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 );
}
开发者ID:johnbeard,项目名称:kicad,代码行数:47,代码来源:edtxtmod.cpp
示例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 );
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:59,代码来源:block.cpp
示例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;
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:10,代码来源:busentry.cpp
示例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 );
}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:20,代码来源:muonde.cpp
示例16: dlg
MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
{
MODULE* module;
wxString moduleName;
wxPoint newpos;
moduleName = aModuleName;
// Ask for the new module reference
if( moduleName.IsEmpty() )
{
wxTextEntryDialog dlg( this, FMT_MOD_REF, FMT_MOD_CREATE, moduleName );
dlg.SetTextValidator( FOOTPRINT_NAME_VALIDATOR( &moduleName ) );
if( dlg.ShowModal() != wxID_OK )
return NULL; //Aborted by user
}
moduleName.Trim( true );
moduleName.Trim( false );
if( moduleName.IsEmpty() )
{
DisplayInfoMessage( this, FMT_NO_REF_ABORTED );
return NULL;
}
// Creates the new module and add it to the head of the linked list of modules
module = new MODULE( GetBoard() );
GetBoard()->Add( module );
// Update parameters: position, timestamp ...
newpos = GetCrossHairPosition();
module->SetPosition( newpos );
module->SetLastEditTime();
// Update its name in lib
module->SetFPID( FPID( moduleName ) );
// Update reference:
module->SetReference( moduleName );
module->Reference().SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->Reference().SetSize( GetDesignSettings().m_ModuleTextSize );
// Set the value field to a default value
module->SetValue( wxT( "VAL**" ) );
module->Value().SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->Value().SetSize( GetDesignSettings().m_ModuleTextSize );
module->SetPosition( wxPoint( 0, 0 ) );
SetMsgPanel( module );
return module;
}
开发者ID:ianohara,项目名称:kicad-source-mirror,代码行数:54,代码来源:librairi.cpp
示例17: GetCrossHairPosition
DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
{
wxPoint pos;
if( aDimension == NULL )
{
status_dimension = 1;
pos = GetCrossHairPosition();
aDimension = new DIMENSION( GetBoard() );
aDimension->SetFlags( IS_NEW );
aDimension->SetLayer( GetActiveLayer() );
aDimension->SetOrigin( pos );
aDimension->SetEnd( pos );
aDimension->Text().SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, aDimension->Text().GetSize() );
if( width > maxthickness )
{
width = maxthickness;
}
aDimension->Text().SetThickness( width );
aDimension->SetWidth( width );
aDimension->AdjustDimensionDetails();
aDimension->Draw( m_canvas, aDC, GR_XOR );
m_canvas->SetMouseCapture( BuildDimension, AbortBuildDimension );
return aDimension;
}
// Dimension != NULL
if( status_dimension == 1 )
{
status_dimension = 2;
return aDimension;
}
aDimension->Draw( m_canvas, aDC, GR_OR );
aDimension->ClearFlags();
/* ADD this new item in list */
GetBoard()->Add( aDimension );
// Add store it in undo/redo list
SaveCopyInUndoList( aDimension, UR_NEW );
OnModify();
m_canvas->SetMouseCapture( NULL, NULL );
return NULL;
}
开发者ID:OpenEE,项目名称:micad,代码行数:54,代码来源:dimension.cpp
示例18: GetScreen
void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection )
{
PICKED_ITEMS_LIST pickList;
SCH_SCREEN* screen = GetScreen();
wxPoint pos = GetCrossHairPosition();
if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 )
{
DeleteItemsInList( m_canvas, pickList );
OnModify();
}
}
开发者ID:p12tic,项目名称:kicad-source-mirror,代码行数:12,代码来源:schedit.cpp
示例19: GetDrawItem
void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
{
LIB_ITEM* item = GetDrawItem();
if( item == NULL )
return;
TempCopyComponent();
item->BeginEdit( IS_RESIZED, GetCrossHairPosition( true ) );
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:12,代码来源:symbdraw.cpp
示例20: wxCHECK_RET
void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot move invalid schematic item" ) );
SetRepeatItem( NULL );
if( !aItem->IsNew() )
{
if( (aItem->Type() == SCH_SHEET_PIN_T) || (aItem->Type() == SCH_FIELD_T) )
SetUndoItem( (SCH_ITEM*) aItem->GetParent() );
else
SetUndoItem( aItem );
}
if( aItem->Type() == SCH_FIELD_T && aItem->GetParent()->Type() == SCH_COMPONENT_T )
{
// Now that we're moving a field, they're no longer autoplaced.
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( aItem->GetParent() );
parent->ClearFieldsAutoplaced();
}
aItem->SetFlags( IS_MOVED );
// For some items, moving the cursor to anchor is not good
// (for instance large hierarchical sheets od componants can have
// the anchor position outside the canvas)
// these items return IsMovableFromAnchorPoint() == false
// For these items, do not wrap the cursor
if( aItem->IsMovableFromAnchorPoint() )
{
SetCrossHairPosition( aItem->GetPosition() );
m_canvas->MoveCursorToCrossHair();
aItem->SetStoredPos( wxPoint( 0,0 ) );
}
else
{
// Round the point under the cursor to a multiple of the grid
wxPoint cursorpos = GetCrossHairPosition() - aItem->GetPosition();
wxPoint gridsize = GetScreen()->GetGridSize();
cursorpos.x = ( cursorpos.x / gridsize.x ) * gridsize.x;
cursorpos.y = ( cursorpos.y / gridsize.y ) * gridsize.y;
aItem->SetStoredPos( cursorpos );
}
OnModify();
GetScreen()->SetCurItem( aItem );
m_canvas->SetMouseCapture( moveItemWithMouseCursor, abortMoveItem );
m_canvas->Refresh();
}
开发者ID:imr,项目名称:kicad-source-mirror,代码行数:52,代码来源:schedit.cpp
注:本文中的GetCrossHairPosition函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论