int SCH_SCREEN::UpdatePickList() { ITEM_PICKER picker; EDA_RECT area; unsigned count; area.SetOrigin( m_BlockLocate.GetOrigin() ); area.SetSize( m_BlockLocate.GetSize() ); area.Normalize(); for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) { // An item is picked if its bounding box intersects the reference area. if( item->HitTest( area ) ) { picker.SetItem( item ); m_BlockLocate.PushItem( picker ); } } // if the block is composed of one item, // select it as the current item count = m_BlockLocate.GetCount(); if( count == 1 ) { SetCurItem( (SCH_ITEM*) m_BlockLocate.GetItem( 0 ) ); } else { SetCurItem( NULL ); } return count; }
void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { EDA_ITEM* PtStruct; int track_fill_copy = DisplayOpt.DisplayDrawItems; if( Segment == NULL ) return; if( Segment->IsNew() ) // Trace in progress. { // Delete current segment. DisplayOpt.DisplayDrawItems = SKETCH; Segment->Draw( m_canvas, DC, GR_XOR ); PtStruct = Segment->Back(); Segment ->DeleteStructure(); if( PtStruct && (PtStruct->Type() == PCB_LINE_T ) ) Segment = (DRAWSEGMENT*) PtStruct; DisplayOpt.DisplayDrawItems = track_fill_copy; SetCurItem( NULL ); } else if( Segment->GetFlags() == 0 ) { Segment->Draw( m_canvas, DC, GR_XOR ); Segment->ClearFlags(); SaveCopyInUndoList(Segment, UR_DELETED); Segment->UnLink(); SetCurItem( NULL ); OnModify(); } }
void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); bool tmp = displ_opts->m_DisplayDrawItemsFill; if( Segment == NULL ) return; int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED ); if( Segment->IsNew() ) // Trace in progress. { // Delete current segment. displ_opts->m_DisplayDrawItemsFill = SKETCH; Segment->Draw( m_canvas, DC, GR_XOR ); Segment->DeleteStructure(); displ_opts->m_DisplayDrawItemsFill = tmp; SetCurItem( NULL ); } else if( ( Segment->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved { Segment->Draw( m_canvas, DC, GR_XOR ); Segment->ClearFlags(); SaveCopyInUndoList(Segment, UR_DELETED); Segment->UnLink(); SetCurItem( NULL ); OnModify(); } }
/* 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; }
void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() { FOOTPRINT_WIZARD* footprintWizard = GetMyWizard(); if( !footprintWizard ) return; SetCurItem( NULL ); // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); // Creates the module MODULE* module = footprintWizard->GetModule(); if( module ) { // Add the object to board module->SetParent( (EDA_ITEM*) GetBoard() ); GetBoard()->m_Modules.Append( module ); module->SetPosition( wxPoint( 0, 0 ) ); } else { DBG(printf( "footprintWizard->GetModule() returns NULL\n" );) } m_canvas->Refresh(); }
void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() { FOOTPRINT_WIZARD* footprintWizard = GetMyWizard(); if( !footprintWizard ) return; SetCurItem( NULL ); // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); // Creates the module wxString msg; MODULE* module = footprintWizard->GetFootprint( &msg ); DisplayBuildMessage( msg ); if( module ) { // Add the object to board GetBoard()->Add( module, ADD_APPEND ); module->SetPosition( wxPoint( 0, 0 ) ); } else { DBG(printf( "footprintWizard->GetFootprint() returns NULL\n" );) } m_canvas->Refresh(); }
void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* aZone ) { aZone->ClearFlags(); m_canvas->SetMouseCapture( NULL, NULL ); if( DC ) aZone->Draw( m_canvas, DC, GR_OR ); OnModify(); s_AddCutoutToCurrentZone = false; s_CurrentZone = NULL; SetCurItem( NULL ); // This outline can be deleted when merging outlines // Combine zones if possible GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone ); m_canvas->Refresh(); int ii = GetBoard()->GetAreaIndex( aZone ); // test if aZone exists if( ii < 0 ) aZone = NULL; // was removed by combining zones UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() ); SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED); s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( aZone, true ); if( error_count ) { DisplayError( this, _( "Area: DRC outline error" ) ); } }
bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery ) { if( GetBoard() == NULL ) return false; if( aQuery && GetScreen()->IsModify() ) { if( GetBoard()->m_Modules ) { if( !IsOK( this, _( "Current Footprint will be lost and this operation cannot be undone. Continue ?" ) ) ) return false; } } // Clear undo and redo lists GetScreen()->ClearUndoRedoList(); // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); // init pointeurs et variables GetScreen()->GetFileName().Empty(); SetCurItem( NULL ); // preserve grid size accross call to InitDataPoints() // wxRealPoint gridsize = GetScreen()->GetGridSize(); GetScreen()->InitDataPoints( GetPageSizeIU() ); // GetScreen()->SetGrid( gridsize ); Zoom_Automatique( false ); return true; }
void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC ) { if( aTarget == NULL ) return; aTarget->Draw( m_canvas, DC, GR_OR ); m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); OnModify(); if( aTarget->IsNew() ) { SaveCopyInUndoList( aTarget, UR_NEW ); aTarget->ClearFlags(); return; } if( aTarget->GetFlags() == IS_MOVED ) { SaveCopyInUndoList( aTarget, UR_MOVED, aTarget->GetPosition() - s_TargetCopy.GetPosition() ); aTarget->ClearFlags(); return; } if( (aTarget->GetFlags() & IN_EDIT) ) { aTarget->SwapData( &s_TargetCopy ); SaveCopyInUndoList( aTarget, UR_CHANGED ); aTarget->SwapData( &s_TargetCopy ); } aTarget->ClearFlags(); }
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 ); } }
/* Routine to view one selected library content. */ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) { if( m_libraryName.IsEmpty() ) return; int selection = m_FootprintList->FindString( m_footprintName ); if( aMode == NEXT_PART ) { if( selection != wxNOT_FOUND && selection < (int)m_FootprintList->GetCount()-1 ) selection++; } if( aMode == PREVIOUS_PART ) { if( selection != wxNOT_FOUND && selection > 0) selection--; } if( selection != wxNOT_FOUND ) { m_footprintName = m_FootprintList->GetString( selection ); SetCurItem( NULL ); // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); GetModuleLibrary( m_libraryName + wxT(".") + LegacyFootprintLibPathExtension, m_footprintName, true ); Update3D_Frame(); } DisplayLibInfos(); Zoom_Automatique( false ); m_canvas->Refresh( ); }
int PCB_EDIT_FRAME::OnHotkeyCopyItem() { BOARD_ITEM* item = GetCurItem(); bool itemCurrentlyEdited = item && item->GetFlags(); if( itemCurrentlyEdited ) return 0; item = PcbGeneralLocateAndDisplay(); if( item == NULL ) return 0; SetCurItem( item ); int eventId = 0; switch( item->Type() ) { case PCB_TEXT_T: eventId = ID_POPUP_PCB_COPY_TEXTEPCB; break; default: eventId = 0; break; } return eventId; }
int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC ) { ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour; if( !zone ) return 0; if( !zone->GetNumCorners() ) return 0; zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR ); if( zone->GetNumCorners() > 2 ) { zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 ); if( m_canvas->IsMouseCaptured() ) m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); } else { m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); zone->RemoveAllContours(); zone->ClearFlags(); } return zone->GetNumCorners(); }
void ODSTree :: ResetCurItem (ItemData *pItemData, logical recursive ) { if ( IsCurItem(pItemData,recursive) ) SetCurItem(NULL); }
bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand ) { BOARD_ITEM* item = GetCurItem(); bool itemCurrentlyEdited = item && item->GetFlags(); bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE; if( itemCurrentlyEdited || blockActive ) return false; item = ModeditLocateAndDisplay(); if( item == NULL ) return false; SetCurItem( item ); int evt_type = 0; // Used to post a wxCommandEvent on demand switch( item->Type() ) { case PCB_MODULE_T: if( aIdCommand == HK_EDIT_ITEM ) evt_type = ID_POPUP_PCB_EDIT_MODULE_PRMS; break; case PCB_PAD_T: if( aIdCommand == HK_EDIT_ITEM ) evt_type = ID_POPUP_PCB_EDIT_PAD; break; case PCB_MODULE_TEXT_T: if( aIdCommand == HK_EDIT_ITEM ) evt_type = ID_POPUP_PCB_EDIT_TEXTMODULE; break; case PCB_MODULE_EDGE_T: if( aIdCommand == HK_EDIT_ITEM ) evt_type = ID_POPUP_MODEDIT_EDIT_BODY_ITEM; break; default: break; } if( evt_type != 0 ) { wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED ); evt.SetEventObject( this ); evt.SetId( evt_type ); wxPostEvent( this, evt ); return true; } return false; }
void PCB_EDIT_FRAME::Block_Delete() { OnModify(); SetCurItem( NULL ); PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems(); itemsList->m_Status = UR_DELETED; // unlink items and clear flags for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ ) { BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii ); itemsList->SetPickedItemStatus( UR_DELETED, ii ); GetBoard()->GetConnectivity()->Remove( item ); switch( item->Type() ) { case PCB_MODULE_T: { MODULE* module = (MODULE*) item; module->ClearFlags(); module->UnLink(); m_Pcb->m_Status_Pcb = 0; } break; case PCB_ZONE_AREA_T: // a zone area m_Pcb->Remove( item ); break; case PCB_LINE_T: // a segment not on copper layers case PCB_TEXT_T: // a text on a layer 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) case PCB_DIMENSION_T: // a dimension (graphic item) case PCB_TARGET_T: // a target (graphic item) item->UnLink(); break; // These items are deleted, but not put in undo list case PCB_MARKER_T: // a marker used to show something case PCB_ZONE_T: // SEG_ZONE items are now deprecated item->UnLink(); itemsList->RemovePicker( ii ); ii--; item->DeleteStructure(); break; default: wxMessageBox( wxT( "PCB_EDIT_FRAME::Block_Delete( ) error: unexpected type" ) ); break; } } SaveCopyInUndoList( *itemsList, UR_DELETED ); Compile_Ratsnest( NULL, true ); m_canvas->Refresh( true ); }
/* * Show module property dialog. */ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) { if( Module == NULL ) return; #ifdef __WXMAC__ // avoid Avoid "writes" in the dialog, creates errors with WxOverlay and NSView & Modal // Raising an Exception - Fixes #764678 DC = NULL; #endif DIALOG_MODULE_BOARD_EDITOR* dlg = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC ); int retvalue = dlg->ShowModal(); /* retvalue = * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_ABORT if abort, * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_EXCHANGE_FP if exchange module, * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_EDIT_OK for normal edition * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_MODEDIT for a goto editor command */ dlg->Destroy(); #ifdef __WXMAC__ // If something edited, push a refresh request if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_EDIT_OK ) m_canvas->Refresh(); #endif if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_MODEDIT ) { FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true ); editor->Load_Module_From_BOARD( Module ); SetCurItem( NULL ); editor->Show( true ); editor->Raise(); // Iconize( false ); } if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP ) { InstallExchangeModuleFrame( Module ); // Warning: the current item can be deleted by exchange module SetCurItem( NULL ); } }
/** * Function Clear_Pcb * delete all and reinitialize the current board * @param aQuery = true to prompt user for confirmation, false to initialize silently */ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) { if( GetBoard() == NULL ) return false; if( aQuery ) { if( GetBoard()->m_Drawings || GetBoard()->m_Modules || GetBoard()->m_Track || GetBoard()->m_Zone ) { if( !IsOK( this, _( "Current Board will be lost and this operation cannot be undone. Continue ?" ) ) ) return false; } } // Clear undo and redo lists because we want a full deletion GetScreen()->ClearUndoRedoList(); /* Items visibility flags will be set becuse a new board will be created. * Grid and ratsnest can be left to their previous state */ bool showGrid = IsElementVisible( GRID_VISIBLE ); bool showRats = IsElementVisible( RATSNEST_VISIBLE ); // delete the old BOARD and create a new BOARD so that the default // layer names are put into the BOARD. SetBoard( new BOARD() ); SetElementVisibility( GRID_VISIBLE, showGrid ); SetElementVisibility( RATSNEST_VISIBLE, showRats ); SetCurItem( NULL ); // clear filename, to avoid overwriting an old file GetScreen()->GetFileName().Empty(); // preserve grid size accross call to InitDataPoints() // wxRealPoint gridsize = GetScreen()->GetGridSize(); GetScreen()->InitDataPoints( GetPageSizeIU() ); // GetScreen()->SetGrid( gridsize ); GetBoard()->ResetHighLight(); // Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled) GetBoard()->SetEnabledLayers( ALL_LAYERS ); // Default copper layers count set to 2: double layer board GetBoard()->SetCopperLayerCount( 2 ); // Update display: GetBoard()->SetVisibleLayers( ALL_LAYERS ); ReFillLayerWidget(); Zoom_Automatique( false ); return true; }
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; }
TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC ) { if( !IsCopperLayer( GetActiveLayer() ) ) return NULL; bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetFlags(); // Ensure the track tool is active if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited ) { wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); cmd.SetId( ID_TRACK_BUTT ); GetEventHandler()->ProcessEvent( cmd ); } if( GetToolId() != ID_TRACK_BUTT ) return NULL; TRACK* track = NULL; if( !itemCurrentlyEdited ) // no track in progress: { track = Begin_Route( NULL, aDC ); SetCurItem( track ); if( track ) m_canvas->SetAutoPanRequest( true ); } else if( GetCurItem()->IsNew() ) { track = Begin_Route( (TRACK*) GetCurItem(), aDC ); // SetCurItem() must not write to the msg panel // because a track info is displayed while moving the mouse cursor if( track ) // A new segment was created SetCurItem( track, false ); m_canvas->SetAutoPanRequest( true ); } return track; }
void PCB_EDIT_FRAME::BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC ) { if( aTarget == NULL ) return; s_TargetCopy = *aTarget; aTarget->SetFlags( IS_MOVED ); m_canvas->SetMouseCapture( ShowTargetShapeWhileMovingMouse, AbortMoveAndEditTarget ); SetCurItem( aTarget ); }
void PCB_EDIT_FRAME::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) { if( TextePcb == NULL ) return; TextePcb->Draw( m_canvas, DC, GR_XOR ); SaveCopyInUndoList( TextePcb, UR_DELETED ); TextePcb->UnLink(); m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); }
bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) { BOARD_ITEM* item = GetCurItem(); bool itemCurrentlyEdited = item && item->GetFlags(); int evt_type = 0; // Used to post a wxCommandEvent on demand wxASSERT( aIdCommand == HK_ROTATE_ITEM ); // Allows block rotate operation on hot key. if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK ) { evt_type = ID_POPUP_ROTATE_BLOCK; } else { if( !itemCurrentlyEdited ) item = PcbGeneralLocateAndDisplay(); if( item == NULL ) return false; SetCurItem( item ); switch( item->Type() ) { case PCB_MODULE_T: evt_type = ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE; break; case PCB_TEXT_T: evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB; break; case PCB_MODULE_TEXT_T: evt_type = ID_POPUP_PCB_ROTATE_TEXTMODULE; break; default: break; } } if( evt_type != 0 ) { wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED ); evt.SetEventObject( this ); evt.SetId( evt_type ); GetEventHandler()->ProcessEvent( evt ); return true; } return false; }
/* * Place graphic element of type DRAWSEGMENT. */ void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) { if( drawitem == NULL ) return; drawitem->ClearFlags(); SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition); drawitem->Draw( m_canvas, DC, GR_OR ); m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); OnModify(); }
void 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 ); }
// Start move of a graphic element type DRAWSEGMENT void 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 ); }
/* * 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; } }
void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* aEdge ) { if( aEdge == NULL ) return; aEdge->Move( -MoveVector ); aEdge->ClearFlags(); m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); OnModify(); MODULE* module = (MODULE*) aEdge->GetParent(); module->CalculateBoundingBox(); m_canvas->Refresh( ); }
/* * Place the current dimension text being moving */ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC ) { m_canvas->SetMouseCapture( NULL, NULL ); SetCurItem( NULL ); if( aItem == NULL ) return; aItem->Draw( m_canvas, DC, GR_OR ); OnModify(); wxPoint tmp = aItem->Text().GetTextPosition(); aItem->Text().SetTextPosition( initialTextPosition ); SaveCopyInUndoList( aItem, UR_CHANGED ); aItem->Text().SetTextPosition( tmp ); aItem->ClearFlags(); }
void GERBVIEW_FRAME::Erase_Current_DrawLayer( bool query ) { int layer = GetActiveLayer(); wxString msg; msg.Printf( _( "Clear layer %d?" ), layer + 1 ); if( query && !IsOK( this, msg ) ) return; SetCurItem( NULL ); GetImagesList()->DeleteImage( layer ); ReFillLayerWidget(); syncLayerBox(); m_canvas->Refresh(); }