这篇教程C++ GetCrossHairPosition函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetCrossHairPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCrossHairPosition函数的具体用法?C++ GetCrossHairPosition怎么用?C++ GetCrossHairPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetCrossHairPosition函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cmdbool 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,
示例2: wxCHECK_RETvoid 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,
示例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,
示例4: GetCrossHairPositionvoid 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,
示例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,
示例6: GetCrossHairPositionvoid 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,
示例7: GetCrossHairPositionvoid 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,
示例8: GetCrossHairPositionbool 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,
示例9: HighLightvoid 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,
示例10: GetCrossHairPositionbool 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,
示例11: SCH_SHEET_PINSCH_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,
示例12: SaveCopyInUndoListvoid 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,
示例13: INVERTvoid 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,
示例14: SCH_BUS_WIRE_ENTRYSCH_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,
示例15: Genere_Selfvoid 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,
示例16: dlgMODULE* 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,
示例17: GetCrossHairPositionDIMENSION* 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,
示例18: GetScreenvoid 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,
示例19: GetDrawItemvoid 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,
示例20: wxCHECK_RETvoid 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,
示例21: GetRepeatItemvoid SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ){ SCH_ITEM* repeater = GetRepeatItem(); if( !repeater ) return; //D( repeater>Show( 0, std::cout ); ) // clone the repeater, move it, insert into display list, then save a copy // via SetRepeatItem(); SCH_ITEM* my_clone = (SCH_ITEM*) repeater->Clone(); // If cloning a component then put into 'move' mode. if( my_clone->Type() == SCH_COMPONENT_T ) { wxPoint pos = GetCrossHairPosition() - ( (SCH_COMPONENT*) my_clone )->GetPosition(); my_clone->SetFlags( IS_NEW ); ( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() ); my_clone->Move( pos ); my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode ); PrepareMoveItem( my_clone, DC ); } else { my_clone->Move( GetRepeatStep() ); if( my_clone->CanIncrementLabel() ) ( (SCH_TEXT*) my_clone )->IncrementLabel( GetRepeatDeltaLabel() ); GetScreen()->Append( my_clone ); if( my_clone->IsConnectable() ) { GetScreen()->TestDanglingEnds(); m_canvas->Refresh(); } else { my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); } SaveCopyInUndoList( my_clone, UR_NEW ); my_clone->ClearFlags(); } // clone my_clone, now that it has been moved, thus saving new position. SetRepeatItem( my_clone );}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:52,
示例22: GetCrossHairPosition// Start move of a graphic element type DRAWSEGMENTvoid PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ){ if( drawitem == NULL ) return; drawitem->Draw( m_canvas, DC, GR_XOR ); drawitem->SetFlags( IS_MOVED ); s_InitialPosition = s_LastPosition = GetCrossHairPosition(); SetMsgPanel( drawitem ); m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge ); SetCurItem( drawitem ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );}
开发者ID:michaellis,项目名称:kicad-source-mirror,代码行数:14,
示例23: GetCrossHairPositionvoid FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC ){ if( aEdge == NULL ) return; aEdge->Draw( m_canvas, DC, GR_XOR ); aEdge->SetFlags( IS_MOVED ); MoveVector.x = MoveVector.y = 0; CursorInitialPosition = GetCrossHairPosition(); m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline ); SetCurItem( aEdge ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );}
开发者ID:johnbeard,项目名称:kicad,代码行数:13,
示例24: GetCrossHairPositionvoid PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC, ZONE_CONTAINER* aZone, int corner_id ){ aZone->SetFlags( IS_DRAGGED ); aZone->SetSelectedCorner( corner_id ); m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse, Abort_Zone_Move_Corner_Or_Outlines ); s_CursorLastPosition = s_CornerInitialPosition = GetCrossHairPosition(); s_AddCutoutToCurrentZone = false; s_CurrentZone = NULL; s_PickedList.ClearListAndDeleteItems(); s_AuxiliaryList.ClearListAndDeleteItems(); SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:16,
示例25: GetCrossHairPositionvoid LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC ){ if( GetDrawItem() == NULL ) return; wxPoint pos = GetCrossHairPosition( true ); if( GetDrawItem()->ContinueEdit( pos ) ) { GetDrawItem()->Draw( m_canvas, DC, pos, COLOR4D::UNSPECIFIED, g_XorMode, NULL, DefaultTransform ); return; } EndDrawGraphicItem( DC );}
开发者ID:cpavlina,项目名称:kicad,代码行数:16,
示例26: PCB_TARGETPCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ){ PCB_TARGET* target = new PCB_TARGET( GetBoard() ); target->SetFlags( IS_NEW ); GetBoard()->Add( target ); target->SetLayer( Edge_Cuts ); target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth ); target->SetSize( MireDefaultSize ); target->SetPosition( GetCrossHairPosition() ); PlaceTarget( target, DC ); return target;}
开发者ID:asutp,项目名称:kicad-source-mirror,代码行数:17,
示例27: GetCrossHairPositionvoid LIB_EDIT_FRAME::PlaceAnchor(){ if( LIB_PART* part = GetCurPart() ) { const wxPoint& cross_hair = GetCrossHairPosition(); wxPoint offset( -cross_hair.x, cross_hair.y ); OnModify( ); part->SetOffset( offset ); // Redraw the symbol RedrawScreen( wxPoint( 0 , 0 ), true ); m_canvas->Refresh(); }}
开发者ID:RyuKojiro,项目名称:kicad-source-mirror,代码行数:17,
示例28: TEXTE_PCBTEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText ){ TEXTE_PCB* textePcb = new TEXTE_PCB( GetBoard() ); if( aText ) { textePcb->Copy( aText ); GetBoard()->Add( textePcb ); textePcb->SetFlags( IS_NEW ); if( aDC ) StartMoveTextePcb( textePcb, aDC, false ); // Don't erase aText when copying } else { GetBoard()->Add( textePcb ); textePcb->SetFlags( IS_NEW ); LAYER_NUM layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; textePcb->SetLayer( layer ); // Set the mirrored option for layers on the BACK side of the board if( layer == LAYER_N_BACK || layer == SILKSCREEN_N_BACK || layer == SOLDERPASTE_N_BACK || layer == SOLDERMASK_N_BACK || layer == ADHESIVE_N_BACK ) textePcb->SetMirrored( true ); textePcb->SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize ); textePcb->SetTextPosition( GetCrossHairPosition() ); textePcb->SetThickness( GetBoard()->GetDesignSettings().m_PcbTextWidth ); InstallTextPCBOptionsFrame( textePcb, aDC ); if( textePcb->GetText().IsEmpty() ) { textePcb->DeleteStructure(); textePcb = NULL; } else if( aDC ) { StartMoveTextePcb( textePcb, aDC ); } } return textePcb;}
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:45,
注:本文中的GetCrossHairPosition函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetCtrl函数代码示例 C++ GetCreatureListWithEntryInGrid函数代码示例 |