From 9d9745b555f5276582b13e1b9b6d36eb432d80bc Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 27 May 2019 17:16:54 +0100 Subject: [PATCH] Remove more legacy editing code. --- common/legacy_gal/eda_draw_frame.cpp | 29 +- common/legacy_wx/eda_draw_frame.cpp | 179 +---- common/legacy_wx/eda_draw_panel.cpp | 63 +- common/widgets/color_swatch.cpp | 15 +- eeschema/sch_draw_panel.cpp | 10 +- gerbview/events_called_functions.cpp | 64 +- gerbview/gerbview_frame.cpp | 71 +- gerbview/gerbview_layer_widget.cpp | 39 +- gerbview/gerbview_layer_widget.h | 2 - gerbview/hotkeys.cpp | 5 - gerbview/menubar.cpp | 16 +- include/draw_frame.h | 9 - include/legacy_wx/class_drawpanel.h | 6 - include/pcb_base_frame.h | 28 - include/widgets/color_swatch.h | 6 +- .../move_and_route_event_functions.cpp | 8 - pcbnew/cross-probing.cpp | 114 ++- .../dialog_cleanup_tracks_and_vias.cpp | 10 +- .../dialog_edit_footprint_for_BoardEditor.cpp | 16 +- .../dialog_edit_footprint_for_BoardEditor.h | 3 +- .../dialog_global_edit_tracks_and_vias.cpp | 9 +- pcbnew/dialogs/dialog_pad_properties.cpp | 261 +++--- .../dialogs/dialog_select_net_from_list.cpp | 23 +- pcbnew/dialogs/dialog_set_grid.cpp | 13 +- pcbnew/dimension.cpp | 66 -- pcbnew/edit.cpp | 582 +------------- pcbnew/editedge.cpp | 60 -- pcbnew/files.cpp | 12 +- pcbnew/footprint_edit_frame.cpp | 15 +- pcbnew/footprint_edit_frame.h | 8 - pcbnew/footprint_editor_utils.cpp | 79 +- pcbnew/footprint_libraries_utils.cpp | 10 +- pcbnew/footprint_viewer_frame.cpp | 7 +- pcbnew/footprint_wizard_frame.cpp | 24 +- pcbnew/footprint_wizard_frame_functions.cpp | 3 +- pcbnew/hotkeys_board_editor.cpp | 14 - pcbnew/layer_widget.cpp | 4 +- pcbnew/layer_widget.h | 7 - pcbnew/load_select_footprint.cpp | 3 +- pcbnew/menubar_footprint_editor.cpp | 16 +- pcbnew/menubar_pcb_editor.cpp | 17 +- pcbnew/move-drag_pads.cpp | 94 --- pcbnew/move_or_drag_track.cpp | 742 ------------------ pcbnew/netlist.cpp | 33 +- pcbnew/pad_edit_functions.cpp | 151 ---- pcbnew/pcb_base_frame.cpp | 32 +- pcbnew/pcb_edit_frame.cpp | 184 ++--- pcbnew/pcb_edit_frame.h | 52 +- pcbnew/pcb_layer_widget.cpp | 77 +- pcbnew/pcb_layer_widget.h | 2 - pcbnew/pcbnew_id.h | 81 +- pcbnew/swig/pcbnew_action_plugins.cpp | 11 +- pcbnew/swig/pcbnew_scripting_helpers.cpp | 15 +- pcbnew/target_edit.cpp | 12 - pcbnew/zones_by_polygon.cpp | 8 +- pcbnew/zones_by_polygon_fill_functions.cpp | 4 +- 56 files changed, 434 insertions(+), 2990 deletions(-) diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp index afd8281cc0..850b097aa3 100644 --- a/common/legacy_gal/eda_draw_frame.cpp +++ b/common/legacy_gal/eda_draw_frame.cpp @@ -107,7 +107,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, m_canvas = NULL; m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; m_galCanvas = NULL; - m_galCanvasActive = false; m_actions = NULL; m_toolManager = NULL; m_toolDispatcher = NULL; @@ -453,7 +452,7 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg ) SetCursor( wxNullCursor ); // Change GAL canvas cursor if requested. - if( IsGalCanvasActive() && aCursor >= 0 ) + if( aCursor >= 0 ) GetGalCanvas()->SetCurrentCursor( aCursor ); DisplayToolMsg( aToolMsg ); @@ -475,8 +474,7 @@ void EDA_DRAW_FRAME::SetNoToolSelected() int defaultCursor = wxCURSOR_DEFAULT; // Change GAL canvas cursor if requested. - if( IsGalCanvasActive() ) - defaultCursor = GetGalCanvas()->GetDefaultCursor(); + defaultCursor = GetGalCanvas()->GetDefaultCursor(); SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString ); } @@ -643,31 +641,16 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas(); // Display the same view after canvas switching - if( aEnable ) - { - // Switch to GAL renderer from legacy - if( !m_galCanvasActive ) - { - // Set up viewport - KIGFX::VIEW* view = galCanvas->GetView(); - view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); - view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); - } - - // Transfer EDA_DRAW_PANEL settings - KIGFX::VIEW_CONTROLS* viewControls = galCanvas->GetViewControls(); - viewControls->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() ); - viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); - viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() ); - } + KIGFX::VIEW_CONTROLS* viewControls = galCanvas->GetViewControls(); + viewControls->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() ); + viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); + viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() ); galCanvas->SetEvtHandlerEnabled( aEnable ); galCanvas->StartDrawing(); // Reset current tool on switch(); SetNoToolSelected(); - - m_galCanvasActive = aEnable; } diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp index d576456f00..ed7327f8e8 100644 --- a/common/legacy_wx/eda_draw_frame.cpp +++ b/common/legacy_wx/eda_draw_frame.cpp @@ -134,7 +134,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, m_canvas = NULL; m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; m_galCanvas = NULL; - m_galCanvasActive = false; m_actions = NULL; m_toolManager = NULL; m_toolDispatcher = NULL; @@ -296,9 +295,6 @@ void EDA_DRAW_FRAME::EraseMsgBox() void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event ) { - if( m_canvas ) - m_canvas->SetCanStartBlock( -1 ); - event.Skip(); // required under wxMAC } @@ -401,8 +397,7 @@ int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, { int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName ); - if( IsGalCanvasActive() ) - GetToolManager()->UpdateHotKeys(); + GetToolManager()->UpdateHotKeys(); return result; } @@ -471,10 +466,8 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) // Notify GAL TOOL_MANAGER* mgr = GetToolManager(); - if( mgr && IsGalCanvasActive() ) + if( mgr ) mgr->RunAction( "common.Control.gridPreset", true, idx ); - else - SetPresetGrid( idx ); m_canvas->Refresh(); } @@ -556,7 +549,7 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg ) m_canvas->SetCurrentCursor( aCursor ); // Change GAL canvas cursor if requested. - if( IsGalCanvasActive() && aCursor >= 0 ) + if( aCursor >= 0 ) GetGalCanvas()->SetCurrentCursor( aCursor ); DisplayToolMsg( aToolMsg ); @@ -578,10 +571,7 @@ void EDA_DRAW_FRAME::SetNoToolSelected() int defaultCursor = wxCURSOR_DEFAULT; // Change GAL canvas cursor if requested. - if( IsGalCanvasActive() ) - defaultCursor = GetGalCanvas()->GetDefaultCursor(); - else if( m_canvas ) - defaultCursor = m_canvas->GetDefaultCursor(); + defaultCursor = GetGalCanvas()->GetDefaultCursor(); SetToolID( ID_NO_TOOL_SELECTED, defaultCursor, wxEmptyString ); } @@ -667,16 +657,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar() const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const { wxString Line; - double level = 0.0; - - if( IsGalCanvasActive() ) - { - level = m_galCanvas->GetGAL()->GetZoomFactor(); - } - else if( BASE_SCREEN* screen = GetScreen() ) - { - level = m_zoomLevelCoeff / (double) screen->GetZoom(); - } + double level = m_galCanvas->GetGAL()->GetZoomFactor(); // returns a human readable value which can be displayed as zoom // level indicator in dialogs. @@ -1029,56 +1010,32 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU ) void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) { - KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::GAL* gal = GetGalCanvas()->GetGAL(); - // Display the same view after canvas switching - if( aEnable ) - { - // Switch to GAL renderer from legacy - if( !m_galCanvasActive ) - { - // Set up viewport - view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); - view->SetCenter(VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); - } + // Set up grid settings + gal->SetGridVisibility( IsGridVisible() ); + gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); + gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) ); - // Set up grid settings - gal->SetGridVisibility( IsGridVisible() ); - gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); - gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) ); - - // Transfer EDA_DRAW_PANEL settings - KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls(); - viewControls->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() ); - viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); - viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() ); - } - else if( m_galCanvasActive ) - { - // Switch to legacy renderer from GAL - m_canvas->SetZoom( GetGalCanvas()->GetLegacyZoom() ); - VECTOR2D center = view->GetCenter(); - AdjustScrollBars( wxPoint( center.x, center.y ) ); - } + // Transfer EDA_DRAW_PANEL settings + KIGFX::VIEW_CONTROLS* viewControls = GetGalCanvas()->GetViewControls(); + viewControls->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() ); + viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); + viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() ); m_canvas->SetEvtHandlerEnabled( !aEnable ); GetGalCanvas()->SetEvtHandlerEnabled( aEnable ); - if( aEnable ) - GetGalCanvas()->StartDrawing(); - else - GetGalCanvas()->StopDrawing(); + GetGalCanvas()->StartDrawing(); // Switch panes - m_auimgr.GetPane( "DrawFrame" ).Show( !aEnable ); - m_auimgr.GetPane( "DrawFrameGal" ).Show( aEnable ); + // JEY TODO: drop down to a single pane.... + m_auimgr.GetPane( "DrawFrame" ).Show( false ); + m_auimgr.GetPane( "DrawFrameGal" ).Show( true ); m_auimgr.Update(); // Reset current tool on switch(); SetNoToolSelected(); - - m_galCanvasActive = aEnable; } @@ -1174,17 +1131,9 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas wxPoint EDA_DRAW_FRAME::GetCrossHairPosition( bool aInvertY ) const { // subject to change, borrow from old BASE_SCREEN for now. - if( IsGalCanvasActive() ) - { - VECTOR2I cursor = GetGalCanvas()->GetViewControls()->GetCursorPosition(); + VECTOR2I cursor = GetGalCanvas()->GetViewControls()->GetCursorPosition(); - return wxPoint( cursor.x, cursor.y ); - } - else - { - BASE_SCREEN* screen = GetScreen(); // virtual call - return screen->getCrossHairPosition( aInvertY ); - } + return wxPoint( cursor.x, cursor.y ); } @@ -1414,40 +1363,12 @@ bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ) { // JEY TODO: OBSOLETE - if( IsGalCanvasActive() ) - return; - - AdjustScrollBars( aCenterPoint ); - - // Move the mouse cursor to the on grid graphic cursor position - if( aWarpPointer ) - m_canvas->MoveCursorToCrossHair(); - - m_canvas->Refresh(); - m_canvas->Update(); } void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore ) { - if( IsGalCanvasActive() ) - return; - - // Account for scrollbars (see EDA_DRAW_FRAME::AdjustScrollBars that takes - // in account scroolbars area to adjust scroll bars) - wxSize scrollbarSize = m_canvas->GetSize() - m_canvas->GetClientSize(); - wxSize sizeAdjusted = m_canvas->GetClientSize() - scrollbarSize; - - wxPoint dPos = posBefore - sizeAdjusted / 2; - - // screen position of crosshair after zoom - wxPoint newScreenPos = m_canvas->ToDeviceXY( GetCrossHairPosition() ); - wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos ); - - AdjustScrollBars( newCenter ); - - m_canvas->Refresh(); - m_canvas->Update(); + // JEY TODO: OBSOLETE } @@ -1495,10 +1416,7 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) if( !screen->m_Initialized ) SetCrossHairPosition( GetScrollCenterPosition() ); - if( !IsGalCanvasActive() ) - RedrawScreen( GetScrollCenterPosition(), aWarpPointer ); - else - m_toolManager->RunAction( "common.Control.zoomFitScreen", true ); + m_toolManager->RunAction( "common.Control.zoomFitScreen", true ); } @@ -1694,52 +1612,25 @@ wxWindow* findDialog( wxWindowList& aList ) void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos, bool aWarpCursor, bool aCenterView ) { - if( IsGalCanvasActive() ) + if( aCenterView ) { - if( aCenterView ) + wxWindow* dialog = findDialog( GetChildren() ); + + // If a dialog partly obscures the window, then center on the uncovered area. + if( dialog ) { - wxWindow* dialog = findDialog( GetChildren() ); - - // If a dialog partly obscures the window, then center on the uncovered area. - if( dialog ) - { - wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ), - dialog->GetSize() ); - GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect ); - } - else - GetGalCanvas()->GetView()->SetCenter( aPos ); + wxRect dialogRect( GetGalCanvas()->ScreenToClient( dialog->GetScreenPosition() ), + dialog->GetSize() ); + GetGalCanvas()->GetView()->SetCenter( aPos, dialogRect ); } - - if( aWarpCursor ) - GetGalCanvas()->GetViewControls()->SetCursorPosition( aPos ); else - GetGalCanvas()->GetViewControls()->SetCrossHairCursorPosition( aPos ); + GetGalCanvas()->GetView()->SetCenter( aPos ); } + + if( aWarpCursor ) + GetGalCanvas()->GetViewControls()->SetCursorPosition( aPos ); else - { - INSTALL_UNBUFFERED_DC( dc, m_canvas ); - - // There may be need to reframe the drawing. - if( aCenterView || !m_canvas->IsPointOnDisplay( aPos ) ) - { - SetCrossHairPosition( aPos ); - RedrawScreen( aPos, aWarpCursor ); - } - else - { - // Put cursor on item position - m_canvas->CrossHairOff( &dc ); - SetCrossHairPosition( aPos ); - - if( aWarpCursor ) - m_canvas->MoveCursorToCrossHair(); - } - - // Be sure cross hair cursor is ON: - m_canvas->CrossHairOn( &dc ); - m_canvas->CrossHairOn( &dc ); - } + GetGalCanvas()->GetViewControls()->SetCrossHairCursorPosition( aPos ); } diff --git a/common/legacy_wx/eda_draw_panel.cpp b/common/legacy_wx/eda_draw_panel.cpp index 731a702265..248e6202fe 100644 --- a/common/legacy_wx/eda_draw_panel.cpp +++ b/common/legacy_wx/eda_draw_panel.cpp @@ -126,7 +126,6 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true ); m_requestAutoPan = false; - m_enableBlockCommands = false; m_minDragEventCount = 0; #ifdef __WXMAC__ @@ -320,14 +319,7 @@ void EDA_DRAW_PANEL::RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackg void EDA_DRAW_PANEL::Refresh( bool eraseBackground, const wxRect* rect ) { - if( GetParent()->IsGalCanvasActive() ) - { - GetParent()->GetGalCanvas()->Refresh(); - } - else - { - wxScrolledWindow::Refresh( eraseBackground, rect ); - } + GetParent()->GetGalCanvas()->Refresh(); } @@ -348,48 +340,7 @@ void EDA_DRAW_PANEL::MoveCursorToCrossHair() void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition ) { - if( GetParent()->IsGalCanvasActive() ) - return; - - int x, y, xPpu, yPpu; - wxPoint screenPos, drawingPos; - wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() ); - - INSTALL_UNBUFFERED_DC( dc, this ); - screenPos.x = dc.LogicalToDeviceX( aPosition.x ); - screenPos.y = dc.LogicalToDeviceY( aPosition.y ); - - // Scroll if the requested mouse position cursor is outside the drawing area. - if( !clientRect.Contains( screenPos ) ) - { - GetViewStart( &x, &y ); - GetScrollPixelsPerUnit( &xPpu, &yPpu ); - CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y ); - - wxLogTrace( kicadTraceCoords, - wxT( "MoveCursor() initial screen position(%d, %d) " ) \ - wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ), - screenPos.x, screenPos.y, clientRect.x, clientRect.y, - clientRect.width, clientRect.height, x, y ); - - if( screenPos.y < clientRect.GetTop() ) - y -= m_scrollIncrementY * yPpu; - else if( screenPos.y > clientRect.GetBottom() ) - y += m_scrollIncrementY * yPpu; - else if( clientRect.GetRight() < screenPos.x ) - x += m_scrollIncrementX * xPpu; - else - x -= m_scrollIncrementX * xPpu; - - Scroll( x, y ); - CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y ); - - wxLogTrace( kicadTraceCoords, - wxT( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ), - screenPos.x, screenPos.y, x, y ); - } - - WarpPointer( screenPos.x, screenPos.y ); + // JEY TODO: OBSOLETE } @@ -652,16 +603,14 @@ void EDA_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable ) { m_enableMousewheelPan = aEnable; - if( GetParent()->IsGalCanvasActive() ) - GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable ); + GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable ); } void EDA_DRAW_PANEL::SetEnableAutoPan( bool aEnable ) { m_enableAutoPan = aEnable; - if( GetParent()->IsGalCanvasActive() ) - GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable ); + GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable ); } @@ -669,8 +618,7 @@ void EDA_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable ) { m_enableZoomNoCenter = aEnable; - if( GetParent()->IsGalCanvasActive() ) - GetParent()->GetGalCanvas()->GetViewControls()->EnableCursorWarping( !aEnable ); + GetParent()->GetGalCanvas()->GetViewControls()->EnableCursorWarping( !aEnable ); } @@ -1160,7 +1108,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) // or this is the end of a double click, already seen // Note also m_ignoreNextLeftButtonRelease can be set by // the call to OnLeftClick(), so do not change it after calling OnLeftClick - bool ignoreEvt = m_ignoreNextLeftButtonRelease; m_ignoreNextLeftButtonRelease = false; } else if( !event.LeftIsDown() ) diff --git a/common/widgets/color_swatch.cpp b/common/widgets/color_swatch.cpp index 7f90c01df5..4d719a697b 100644 --- a/common/widgets/color_swatch.cpp +++ b/common/widgets/color_swatch.cpp @@ -79,10 +79,8 @@ static std::unique_ptr makeColorSwatch( wxWindow* aParent, COLOR } -COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, COLOR4D aColor, int aID, - bool aArbitraryColors, COLOR4D aBackground ): +COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, COLOR4D aColor, int aID, COLOR4D aBackground ): wxPanel( aParent, aID ), - m_arbitraryColors( aArbitraryColors ), m_color( aColor ), m_background( aBackground ) { @@ -159,15 +157,10 @@ void COLOR_SWATCH::GetNewSwatchColor() { COLOR4D newColor = COLOR4D::UNSPECIFIED; - if( m_arbitraryColors ) - { - DIALOG_COLOR_PICKER dialog( ::wxGetTopLevelParent( this ), m_color, true ); + DIALOG_COLOR_PICKER dialog( ::wxGetTopLevelParent( this ), m_color, true ); - if( dialog.ShowModal() == wxID_OK ) - newColor = dialog.GetColor(); - } - else - newColor = DisplayColorFrame( this, m_color ); + if( dialog.ShowModal() == wxID_OK ) + newColor = dialog.GetColor(); if( newColor != COLOR4D::UNSPECIFIED ) { diff --git a/eeschema/sch_draw_panel.cpp b/eeschema/sch_draw_panel.cpp index cb9b7cb3ad..de8e5ea77a 100644 --- a/eeschema/sch_draw_panel.cpp +++ b/eeschema/sch_draw_panel.cpp @@ -171,8 +171,7 @@ void SCH_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable ) { m_enableMousewheelPan = aEnable; - if( GetParent()->IsGalCanvasActive() ) - GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable ); + GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable ); } @@ -180,14 +179,12 @@ void SCH_DRAW_PANEL::SetEnableAutoPan( bool aEnable ) { EDA_DRAW_PANEL::SetEnableAutoPan( aEnable ); - if( GetParent()->IsGalCanvasActive() ) - GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable ); + GetParent()->GetGalCanvas()->GetViewControls()->EnableAutoPan( aEnable ); } void SCH_DRAW_PANEL::SetAutoPanRequest( bool aEnable ) { - wxCHECK( GetParent()->IsGalCanvasActive(), /*void*/ ); GetParent()->GetGalCanvas()->GetViewControls()->SetAutoPan( aEnable ); } @@ -196,8 +193,7 @@ void SCH_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable ) { m_enableZoomNoCenter = aEnable; - if( GetParent()->IsGalCanvasActive() ) - GetParent()->GetGalCanvas()->GetViewControls()->EnableCursorWarping( !aEnable ); + GetParent()->GetGalCanvas()->GetViewControls()->EnableCursorWarping( !aEnable ); } diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 31e0823bd6..80ab0a4750 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -85,10 +85,8 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, GERBVIEW_FRAME::Process_Config ) EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::Process_Config ) - EVT_UPDATE_UI( ID_MENU_CANVAS_LEGACY, GERBVIEW_FRAME::OnUpdateSwitchCanvas ) EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnUpdateSwitchCanvas ) EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, GERBVIEW_FRAME::OnUpdateSwitchCanvas ) - EVT_MENU( ID_MENU_CANVAS_LEGACY, GERBVIEW_FRAME::OnSwitchCanvas ) EVT_MENU( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnSwitchCanvas ) EVT_MENU( ID_MENU_CANVAS_OPENGL, GERBVIEW_FRAME::OnSwitchCanvas ) @@ -146,22 +144,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) { int id = event.GetId(); - switch( id ) - { - case ID_POPUP_CANCEL_CURRENT_COMMAND: - m_canvas->EndMouseCapture(); - - if( GetToolId() == ID_NO_TOOL_SELECTED ) - SetNoToolSelected(); - else - m_canvas->SetCursor( (wxStockCursor) m_canvas->GetCurrentCursor() ); - break; - - default: - m_canvas->EndMouseCapture(); - break; - } - GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem(); switch( id ) @@ -175,13 +157,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) ); break; - case ID_POPUP_CLOSE_CURRENT_TOOL: - SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); - break; - - case ID_POPUP_CANCEL_CURRENT_COMMAND: - break; - case ID_GERBVIEW_SHOW_LIST_DCODES: Liste_D_Codes(); break; @@ -224,31 +199,26 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) void GERBVIEW_FRAME::OnSelectHighlightChoice( wxCommandEvent& event ) { - if( IsGalCanvasActive() ) + auto settings = static_cast( GetGalCanvas()->GetView()->GetPainter() )->GetSettings(); + + switch( event.GetId() ) { - auto settings = static_cast( GetGalCanvas()->GetView()->GetPainter() )->GetSettings(); + case ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE: + settings->m_componentHighlightString = m_SelComponentBox->GetStringSelection(); + break; - switch( event.GetId() ) - { - case ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE: - settings->m_componentHighlightString = m_SelComponentBox->GetStringSelection(); - break; + case ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE: + settings->m_netHighlightString = m_SelNetnameBox->GetStringSelection(); + break; - case ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE: - settings->m_netHighlightString = m_SelNetnameBox->GetStringSelection(); - break; + case ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE: + settings->m_attributeHighlightString = m_SelAperAttributesBox->GetStringSelection(); + break; - case ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE: - settings->m_attributeHighlightString = m_SelAperAttributesBox->GetStringSelection(); - break; - - } - - GetGalCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR ); - GetGalCanvas()->Refresh(); } - else - m_canvas->Refresh(); + + GetGalCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR ); + GetGalCanvas()->Refresh(); } @@ -408,10 +378,6 @@ void GERBVIEW_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent ) { switch( aEvent.GetId() ) { - case ID_MENU_CANVAS_LEGACY: - SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ); - break; - case ID_MENU_CANVAS_CAIRO: SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); break; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index d7d7d2d7df..7e6d16bfc0 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -112,9 +112,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): // GerbView requires draw priority for rendering negative objects galCanvas->GetView()->UseDrawPriority( true ); - if( m_canvas ) - m_canvas->SetEnableBlockCommands( true ); - // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) ); @@ -181,8 +178,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): "and faster experience. This option is turned off by " "default since it is not compatible with all computers.\n\n" "Would you like to try enabling graphics acceleration?\n\n" - "If you'd like to choose later, select Modern Toolset " - "(Accelerated) in the Preferences menu." ); + "If you'd like to choose later, select Accelerated Graphics " + "in the Preferences menu." ); wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO ); @@ -215,19 +212,14 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_firstRunDialogSetting = 1; SaveSettings( config() ); } - else if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) + else { - if( GetGalCanvas()->SwitchBackend( canvasType ) ) - UseGalCanvas( true ); + GetGalCanvas()->SwitchBackend( canvasType ); + UseGalCanvas( true ); wxUpdateUIEvent e; OnUpdateSwitchCanvas( e ); } - else - { - m_colorsSettings->SetLegacyMode( true ); - m_canvas->Refresh(); - } // Enable the axes to match legacy draw style auto& galOptions = GetGalDisplayOptions(); @@ -256,11 +248,8 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) if( m_toolManager ) m_toolManager->DeactivateTool(); - if( IsGalCanvasActive() ) - { - // Be sure any OpenGL event cannot be fired after frame deletion: - GetGalCanvas()->SetEvtHandlerEnabled( false ); - } + // Be sure any OpenGL event cannot be fired after frame deletion: + GetGalCanvas()->SetEvtHandlerEnabled( false ); Destroy(); } @@ -934,15 +923,12 @@ void GERBVIEW_FRAME::SetActiveLayer( int aLayer, bool doLayerWidgetUpdate ) UpdateTitleAndInfo(); - if( IsGalCanvasActive() ) - { - m_toolManager->RunAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools - GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere + m_toolManager->RunAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools + GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere - GetGalCanvas()->SetHighContrastLayer( GERBER_DRAW_LAYER( aLayer ) ); + GetGalCanvas()->SetHighContrastLayer( GERBER_DRAW_LAYER( aLayer ) ); - GetGalCanvas()->Refresh(); - } + GetGalCanvas()->Refresh(); } @@ -954,23 +940,20 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) if( screen ) screen->InitDataPoints( aPageSettings.GetSizeIU() ); - if( IsGalCanvasActive() ) + auto drawPanel = static_cast( GetGalCanvas() ); + + // Prepare worksheet template + auto worksheet = + new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(), &GetTitleBlock() ); + + if( screen != NULL ) { - auto drawPanel = static_cast( GetGalCanvas() ); - - // Prepare worksheet template - auto worksheet = - new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(), &GetTitleBlock() ); - - if( screen != NULL ) - { - worksheet->SetSheetNumber( 1 ); - worksheet->SetSheetCount( 1 ); - } - - // PCB_DRAW_PANEL_GAL takes ownership of the worksheet - drawPanel->SetWorksheet( worksheet ); + worksheet->SetSheetNumber( 1 ); + worksheet->SetSheetCount( 1 ); } + + // PCB_DRAW_PANEL_GAL takes ownership of the worksheet + drawPanel->SetWorksheet( worksheet ); } @@ -1039,8 +1022,7 @@ void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo ) void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor ) { - if( IsGalCanvasActive() ) - GetGalCanvas()->GetGAL()->SetGridColor( aColor ); + GetGalCanvas()->GetGAL()->SetGridColor( aColor ); m_gridColor = aColor; } @@ -1152,7 +1134,8 @@ unsigned GERBVIEW_FRAME::ImagesMaxCount() const void GERBVIEW_FRAME::unitsChangeRefresh() -{ // Called on units change (see EDA_DRAW_FRAME) +{ + // Called on units change (see EDA_DRAW_FRAME) EDA_DRAW_FRAME::unitsChangeRefresh(); updateDCodeSelectBox(); updateGridSelectBox(); @@ -1285,7 +1268,7 @@ void GERBVIEW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent ) int current = 0; // display Auto if no match found // check for a match within 1% - double zoom = IsGalCanvasActive() ? GetGalCanvas()->GetLegacyZoom() : GetScreen()->GetZoom(); + double zoom = GetGalCanvas()->GetLegacyZoom(); for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); i++ ) { diff --git a/gerbview/gerbview_layer_widget.cpp b/gerbview/gerbview_layer_widget.cpp index 8188bba605..d90672cb3b 100644 --- a/gerbview/gerbview_layer_widget.cpp +++ b/gerbview/gerbview_layer_widget.cpp @@ -79,12 +79,6 @@ GERBER_FILE_IMAGE_LIST* GERBER_LAYER_WIDGET::GetImagesList() } -bool GERBER_LAYER_WIDGET::AreArbitraryColorsAllowed() -{ - return myframe->IsGalCanvasActive(); -} - - void GERBER_LAYER_WIDGET::SetLayersManagerTabsText( ) { m_notebook->SetPageText(0, _("Layers") ); @@ -267,12 +261,9 @@ void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor ) myframe->SetLayerColor( GERBER_DRAW_LAYER( aLayer ), aColor ); myframe->m_SelLayerBox->ResyncBitmapOnly(); - if( myframe->IsGalCanvasActive() ) - { - KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView(); - view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->m_colorsSettings ); - view->UpdateLayerColor( GERBER_DRAW_LAYER( aLayer ) ); - } + KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView(); + view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->m_colorsSettings ); + view->UpdateLayerColor( GERBER_DRAW_LAYER( aLayer ) ); myframe->GetCanvas()->Refresh(); } @@ -315,21 +306,14 @@ void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor ) myframe->SetVisibleElementColor( aId, aColor ); auto galCanvas = myframe->GetGalCanvas(); + auto view = galCanvas->GetView(); - if( galCanvas && myframe->IsGalCanvasActive() ) - { - auto view = galCanvas->GetView(); - view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->m_colorsSettings ); - view->UpdateLayerColor( aId ); + view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->m_colorsSettings ); + view->UpdateLayerColor( aId ); - view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); - view->UpdateAllItems( KIGFX::COLOR ); - } - - if( galCanvas && myframe->IsGalCanvasActive() ) - galCanvas->Refresh(); - else - myframe->GetCanvas()->Refresh(); + view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); + view->UpdateAllItems( KIGFX::COLOR ); + galCanvas->Refresh(); } @@ -350,10 +334,7 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) galCanvas->GetView()->SetLayerVisible( aId, isEnabled ); } - if( galCanvas && myframe->IsGalCanvasActive() ) - galCanvas->Refresh(); - else - myframe->GetCanvas()->Refresh(); + galCanvas->Refresh(); } //----------------------------------------------- diff --git a/gerbview/gerbview_layer_widget.h b/gerbview/gerbview_layer_widget.h index 0f66b32660..efeafb2bf8 100644 --- a/gerbview/gerbview_layer_widget.h +++ b/gerbview/gerbview_layer_widget.h @@ -65,8 +65,6 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET */ virtual bool useAlternateBitmap(int aRow) override; - virtual bool AreArbitraryColorsAllowed() override; - GERBER_FILE_IMAGE_LIST* GetImagesList(); public: diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index d4ccdee2d2..40162f0f7c 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -211,11 +211,6 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit cmd.SetId( ID_MENU_CANVAS_OPENGL ); GetEventHandler()->ProcessEvent( cmd ); break; - - case HK_CANVAS_LEGACY: - cmd.SetId( ID_MENU_CANVAS_LEGACY ); - GetEventHandler()->ProcessEvent( cmd ); - break; } return true; diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 8f51f985d1..1f13604091 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -278,22 +278,14 @@ void GERBVIEW_FRAME::ReCreateMenuBar() // Canvas selection configMenu->AppendSeparator(); - if( ADVANCED_CFG::GetCfg().AllowLegacyCanvas() ) - { - text = AddHotkeyName( _( "Legacy Tool&set" ), GerbviewHotkeysDescr, HK_CANVAS_LEGACY ); - AddMenuItem( configMenu, ID_MENU_CANVAS_LEGACY, text, - _( "Use Legacy Toolset (not all features will be available)" ), - KiBitmap( tools_xpm ), wxITEM_RADIO ); - } - - text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), GerbviewHotkeysDescr, HK_CANVAS_OPENGL ); + text = AddHotkeyName( _( "Accelerated Graphics" ), GerbviewHotkeysDescr, HK_CANVAS_OPENGL ); AddMenuItem( configMenu, ID_MENU_CANVAS_OPENGL, text, - _( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ), + _( "Use hardware-accelerated graphics (recommended)" ), KiBitmap( tools_xpm ), wxITEM_RADIO ); - text = AddHotkeyName( _( "Modern Toolset (Fallba&ck)" ), GerbviewHotkeysDescr, HK_CANVAS_CAIRO ); + text = AddHotkeyName( _( "Standard Graphics" ), GerbviewHotkeysDescr, HK_CANVAS_CAIRO ); AddMenuItem( configMenu, ID_MENU_CANVAS_CAIRO, text, - _( "Use Modern Toolset with software graphics (fall-back)" ), + _( "Use software graphics (fall-back)" ), KiBitmap( tools_xpm ), wxITEM_RADIO ); configMenu->AppendSeparator(); diff --git a/include/draw_frame.h b/include/draw_frame.h index 8b179462bd..d9d63e5b82 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -99,7 +99,6 @@ class EDA_DRAW_FRAME : public KIWAY_PLAYER KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions; protected: - bool m_galCanvasActive; ///< whether to use new GAL engine bool m_useSingleCanvasPane; wxSocketServer* m_socketServer; @@ -848,14 +847,6 @@ public: */ virtual bool SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ); - /** - * Function IsGalCanvasActive - * is used to check which canvas (GAL-based or standard) is currently in use. - * - * @return True for GAL-based canvas, false for standard canvas. - */ - bool IsGalCanvasActive() const { return m_galCanvasActive; } - /** * Return a pointer to GAL-based canvas of given EDA draw frame. * diff --git a/include/legacy_wx/class_drawpanel.h b/include/legacy_wx/class_drawpanel.h index fee2284f7c..b0cf925132 100644 --- a/include/legacy_wx/class_drawpanel.h +++ b/include/legacy_wx/class_drawpanel.h @@ -91,8 +91,6 @@ private: */ bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true. - bool m_enableBlockCommands; ///< True enables block commands. - /** * Count the drag events. Used to filter mouse moves before starting a * block command. A block command can be started only if @@ -162,13 +160,9 @@ public: void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; } - void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; } - bool GetPrintMirrored() const { return m_PrintIsMirrored; } void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; } - void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; } - /** * Function DrawBackGround * @param DC = current Device Context diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 41914dfac5..44b06dc4f4 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -370,38 +370,10 @@ public: */ void DeletePad( D_PAD* aPad, bool aQuery = true ); - /** - * Function StartMovePad - * Initialize a drag or move pad command - * @param aPad = the pad to move or drag - * @param aDC = the current device context - * @param aDragConnectedTracks = true to drag connected tracks, - * false to just move the pad - */ - void StartMovePad( D_PAD* aPad, wxDC* aDC, bool aDragConnectedTracks ); - void PlacePad( D_PAD* Pad, wxDC* DC ); void Export_Pad_Settings( D_PAD* aPad ); void Import_Pad_Settings( D_PAD* aPad, bool aDraw ); - /** - * Function DoPushPadProperties - * Function to change pad settings for the given footprint or all identical footprints - * @param aPad is the pattern. The given footprint is the parent of this pad - * @param aSameFootprints: if true, make changes on all identical footprints - * @param aPadShapeFilter: if true, make changes only on pads having the same shape as aPad - * @param aPadOrientFilter: if true, make changes only on pads having the same orientation as aPad - * @param aPadLayerFilter: if true, make changes only on pads having the same layers as aPad - * @param aSaveForUndo: if true: create an entry in the Undo/Redo list - * (usually: true in Schematic editor, false in Module editor) - */ - void DoPushPadProperties( D_PAD* aPad, - bool aSameFootprints, - bool aPadShapeFilter, - bool aPadOrientFilter, - bool aPadLayerFilter, - bool aSaveForUndo ); - /** * Function SelectFootprintFromLibTree * opens a dialog to select a footprint. diff --git a/include/widgets/color_swatch.h b/include/widgets/color_swatch.h index f68d199721..c2a233635c 100644 --- a/include/widgets/color_swatch.h +++ b/include/widgets/color_swatch.h @@ -48,8 +48,7 @@ public: * @param aArbitraryColors true to allow selection of any 32 bits color for GAL canvas, * and false to allow a selection from a set of colors accepted by the legacy canvas. */ - COLOR_SWATCH( wxWindow* aParent, KIGFX::COLOR4D aColor, int aID, - bool aArbitraryColors, KIGFX::COLOR4D aBackground ); + COLOR_SWATCH( wxWindow* aParent, KIGFX::COLOR4D aColor, int aID, KIGFX::COLOR4D aBackground ); /** * Set the current swatch color directly. @@ -82,9 +81,6 @@ private: */ void rePostEvent( wxEvent& aEvt ); - ///> Can the swatch have any color, or only preset ones for legacy canvas? - bool m_arbitraryColors; - ///> The current colour of the swatch KIGFX::COLOR4D m_color; diff --git a/pcbnew/autorouter/move_and_route_event_functions.cpp b/pcbnew/autorouter/move_and_route_event_functions.cpp index 51764de064..1be9cc5a2d 100644 --- a/pcbnew/autorouter/move_and_route_event_functions.cpp +++ b/pcbnew/autorouter/move_and_route_event_functions.cpp @@ -91,14 +91,6 @@ void PCB_EDIT_FRAME::OnPlaceOrRouteFootprints( wxCommandEvent& event ) LockModule( NULL, true ); return; - case ID_POPUP_CANCEL_CURRENT_COMMAND: - if( m_canvas->IsMouseCaptured() ) - { - m_canvas->CallEndMouseCapture( &dc ); - } - - break; - default: // Abort a current command (if any) m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); break; diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index b0ad807be5..47f229408e 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -113,69 +113,53 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) } } - if( IsGalCanvasActive() ) + auto view = m_toolManager->GetView(); + auto rs = view->GetPainter()->GetSettings(); + rs->SetHighlight( ( netcode >= 0 ), netcode ); + view->UpdateAllLayersColor(); + + BOX2I bbox; + bool first = true; + + auto merge_area = [netcode, &bbox, &first]( BOARD_CONNECTED_ITEM* aItem ) { - auto view = m_toolManager->GetView(); - auto rs = view->GetPainter()->GetSettings(); - rs->SetHighlight( ( netcode >= 0 ), netcode ); - view->UpdateAllLayersColor(); - - BOX2I bbox; - bool first = true; - - auto merge_area = [netcode, &bbox, &first]( BOARD_CONNECTED_ITEM* aItem ) + if( aItem->GetNetCode() == netcode ) { - if( aItem->GetNetCode() == netcode ) + if( first ) { - if( first ) - { - bbox = aItem->GetBoundingBox(); - first = false; - } - else - { - bbox.Merge( aItem->GetBoundingBox() ); - } + bbox = aItem->GetBoundingBox(); + first = false; + } + else + { + bbox.Merge( aItem->GetBoundingBox() ); } - }; - - for( auto zone : pcb->Zones() ) - merge_area( zone ); - - for( auto track : pcb->Tracks() ) - merge_area( track ); - - for( auto mod : pcb->Modules() ) - for ( auto mod_pad : mod->Pads() ) - merge_area( mod_pad ); - - if( netcode > 0 && bbox.GetWidth() > 0 && bbox.GetHeight() > 0 ) - { - auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize(); - auto screenSize = view->ToWorld( GetGalCanvas()->GetClientSize(), false ); - double ratio = std::max( fabs( bbSize.x / screenSize.x ), - fabs( bbSize.y / screenSize.y ) ); - double scale = view->GetScale() / ratio; - - view->SetScale( scale ); - view->SetCenter( bbox.Centre() ); } + }; - GetGalCanvas()->Refresh(); - } - else + for( auto zone : pcb->Zones() ) + merge_area( zone ); + + for( auto track : pcb->Tracks() ) + merge_area( track ); + + for( auto mod : pcb->Modules() ) + for ( auto mod_pad : mod->Pads() ) + merge_area( mod_pad ); + + if( netcode > 0 && bbox.GetWidth() > 0 && bbox.GetHeight() > 0 ) { - if( netcode > 0 ) - { - pcb->HighLightON(); - pcb->SetHighLightNet( netcode ); - } - else - { - pcb->HighLightOFF(); - pcb->SetHighLightNet( -1 ); - } + auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize(); + auto screenSize = view->ToWorld( GetGalCanvas()->GetClientSize(), false ); + double ratio = std::max( fabs( bbSize.x / screenSize.x ), + fabs( bbSize.y / screenSize.y ) ); + double scale = view->GetScale() / ratio; + + view->SetScale( scale ); + view->SetCenter( bbox.Centre() ); } + + GetGalCanvas()->Refresh(); } return; @@ -279,20 +263,12 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) if( module ) // if found, center the module on screen, and redraw the screen. { - if( IsGalCanvasActive() ) - { - GetToolManager()->RunAction( PCB_ACTIONS::crossProbeSchToPcb, - true, - pad ? - static_cast( pad ) : - static_cast( module ) - ); - } - else - { - SetCrossHairPosition( pos ); - RedrawScreen( pos, false ); - } + GetToolManager()->RunAction( PCB_ACTIONS::crossProbeSchToPcb, + true, + pad ? + static_cast( pad ) : + static_cast( module ) + ); } } diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp index f957a9f56c..a023e0a8f3 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp @@ -150,10 +150,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem( wxCommandEvent& event ) if( item ) { - // When selecting a item, center it on GAL and just move the graphic - // cursor in legacy mode gives the best result - bool center = m_parentFrame->IsGalCanvasActive() ? true : false; - m_parentFrame->FocusOnLocation( item->GetPointA(), false, center ); + m_parentFrame->FocusOnLocation( item->GetPointA(), false, true ); WINDOW_THAWER thawer( m_parentFrame ); m_parentFrame->GetCanvas()->Refresh(); @@ -177,10 +174,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem( wxMouseEvent& event ) const DRC_ITEM* item = m_ItemsListBox->GetItem( selection ); if( item ) { - // When selecting a item, center it on GAL and just move the graphic - // cursor in legacy mode gives the best result - bool center = m_parentFrame->IsGalCanvasActive() ? true : false; - m_parentFrame->FocusOnLocation( item->GetPointA(), true, center ); + m_parentFrame->FocusOnLocation( item->GetPointA(), true, true ); if( !IsModal() ) { diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp index 582f962bdd..b292c63624 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp @@ -56,7 +56,7 @@ int DIALOG_FOOTPRINT_BOARD_EDITOR::m_page = 0; // remember the last open pag DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, - MODULE* aModule, wxDC* aDC ) : + MODULE* aModule ) : DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( aParent ), m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ), m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ), @@ -70,7 +70,6 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP m_config = Kiface().KifaceSettings(); m_frame = aParent; - m_DC = aDC; m_footprint = aModule; m_texts = new TEXT_MOD_GRID_TABLE( m_units, m_frame ); @@ -622,12 +621,6 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow() if( !m_Panel3D->TransferDataFromWindow() ) return false; - if( m_DC ) - { - m_frame->GetCanvas()->CrossHairOff( m_DC ); - m_footprint->Draw( m_frame->GetCanvas(), m_DC, GR_XOR ); - } - auto view = m_frame->GetGalCanvas()->GetView(); BOARD_COMMIT commit( m_frame ); commit.Modify( m_footprint ); @@ -740,13 +733,6 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow() commit.Push( _( "Modify module properties" ) ); SetReturnCode( PRM_EDITOR_EDIT_OK ); - - if( m_DC ) - { - m_footprint->Draw( m_frame->GetCanvas(), m_DC, GR_OR ); - m_frame->GetCanvas()->CrossHairOn( m_DC ); - } - return true; } diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h index 9f52d20c16..07fe3c4784 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.h @@ -43,7 +43,6 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR: public DIALOG_FOOTPRINT_BOARD_EDITOR_BASE private: wxConfigBase* m_config; PCB_EDIT_FRAME* m_frame; - wxDC* m_DC; MODULE* m_footprint; static int m_page; // remember the last open page during session @@ -82,7 +81,7 @@ public: public: // Constructor and destructor - DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule, wxDC* aDC ); + DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule ); ~DIALOG_FOOTPRINT_BOARD_EDITOR() override; bool Validate() override; diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index 3c23bf0ecd..ebb8ed1dfc 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -339,13 +339,8 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow() { m_parent->SaveCopyInUndoList( itemsListPicker, UR_CHANGED ); - if( m_parent->IsGalCanvasActive() ) - { - for( TRACK* segment = m_brd->m_Track; segment != nullptr; segment = segment->Next() ) - m_parent->GetGalCanvas()->GetView()->Update( segment ); - } - else - m_parent->GetCanvas()->Refresh(); + for( TRACK* segment = m_brd->m_Track; segment != nullptr; segment = segment->Next() ) + m_parent->GetGalCanvas()->GetView()->Update( segment ); } return !m_failedDRC; diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 7494de4c1b..1ddd2f3060 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -209,8 +209,7 @@ void DIALOG_PAD_PROPERTIES::OnCancel( wxCommandEvent& event ) { // Mandatory to avoid m_panelShowPadGal trying to draw something // in a non valid context during closing process: - if( m_parent->IsGalCanvasActive() ) - m_panelShowPadGal->StopDrawing(); + m_panelShowPadGal->StopDrawing(); // Now call default handler for wxID_CANCEL command event event.Skip(); @@ -242,44 +241,36 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas() VECTOR2D( m_dummyPad->GetPosition() ) ); m_axisOrigin->SetDrawAtZero( true ); - if( m_parent->IsGalCanvasActive() ) - { - m_panelShowPadGal->UseColorScheme( &m_parent->Settings().Colors() ); - m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() ); - m_panelShowPadGal->SetStealsFocus( false ); + m_panelShowPadGal->UseColorScheme( &m_parent->Settings().Colors() ); + m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() ); + m_panelShowPadGal->SetStealsFocus( false ); - bool mousewheelPan = m_parent->GetCanvas()->GetEnableMousewheelPan(); - m_panelShowPadGal->GetViewControls()->EnableMousewheelPan( mousewheelPan ); + bool mousewheelPan = m_parent->GetCanvas()->GetEnableMousewheelPan(); + m_panelShowPadGal->GetViewControls()->EnableMousewheelPan( mousewheelPan ); - m_panelShowPadGal->Show(); - m_panelShowPad->Hide(); + m_panelShowPadGal->Show(); + m_panelShowPad->Hide(); - KIGFX::VIEW* view = m_panelShowPadGal->GetView(); + KIGFX::VIEW* view = m_panelShowPadGal->GetView(); - // fix the pad render mode (filled/not filled) - auto settings = static_cast( view->GetPainter()->GetSettings() ); - bool sketchMode = m_cbShowPadOutline->IsChecked(); - settings->SetSketchMode( LAYER_PADS_TH, sketchMode ); - settings->SetSketchMode( LAYER_PAD_FR, sketchMode ); - settings->SetSketchMode( LAYER_PAD_BK, sketchMode ); - settings->SetSketchModeGraphicItems( sketchMode ); + // fix the pad render mode (filled/not filled) + auto settings = static_cast( view->GetPainter()->GetSettings() ); + bool sketchMode = m_cbShowPadOutline->IsChecked(); + settings->SetSketchMode( LAYER_PADS_TH, sketchMode ); + settings->SetSketchMode( LAYER_PAD_FR, sketchMode ); + settings->SetSketchMode( LAYER_PAD_BK, sketchMode ); + settings->SetSketchModeGraphicItems( sketchMode ); - // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid: - double gridsize = 0.001 * IU_PER_MM; - view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) ); - // And do not show the grid: - view->GetGAL()->SetGridVisibility( false ); - view->Add( m_dummyPad ); - view->Add( m_axisOrigin ); + // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid: + double gridsize = 0.001 * IU_PER_MM; + view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) ); + // And do not show the grid: + view->GetGAL()->SetGridVisibility( false ); + view->Add( m_dummyPad ); + view->Add( m_axisOrigin ); - m_panelShowPadGal->StartDrawing(); - Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) ); - } - else - { - m_panelShowPad->Show(); - m_panelShowPadGal->Hide(); - } + m_panelShowPadGal->StartDrawing(); + Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) ); } @@ -902,19 +893,16 @@ void DIALOG_PAD_PROPERTIES::onChangePadMode( wxCommandEvent& event ) { m_sketchPreview = m_cbShowPadOutline->GetValue(); - if( m_parent->IsGalCanvasActive() ) - { - KIGFX::VIEW* view = m_panelShowPadGal->GetView(); + KIGFX::VIEW* view = m_panelShowPadGal->GetView(); - // fix the pad render mode (filled/not filled) - KIGFX::PCB_RENDER_SETTINGS* settings = - static_cast( view->GetPainter()->GetSettings() ); + // fix the pad render mode (filled/not filled) + KIGFX::PCB_RENDER_SETTINGS* settings = + static_cast( view->GetPainter()->GetSettings() ); - settings->SetSketchMode( LAYER_PADS_TH, m_sketchPreview ); - settings->SetSketchMode( LAYER_PAD_FR, m_sketchPreview ); - settings->SetSketchMode( LAYER_PAD_BK, m_sketchPreview ); - settings->SetSketchModeGraphicItems( m_sketchPreview ); - } + settings->SetSketchMode( LAYER_PADS_TH, m_sketchPreview ); + settings->SetSketchMode( LAYER_PAD_FR, m_sketchPreview ); + settings->SetSketchMode( LAYER_PAD_BK, m_sketchPreview ); + settings->SetSketchModeGraphicItems( m_sketchPreview ); redraw(); } @@ -1325,104 +1313,97 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() void DIALOG_PAD_PROPERTIES::redraw() { - if( m_parent->IsGalCanvasActive() ) + KIGFX::VIEW* view = m_panelShowPadGal->GetView(); + m_panelShowPadGal->StopDrawing(); + + // The layer used to place primitive items selected when editing custom pad shapes + // we use here a layer never used in a pad: + #define SELECTED_ITEMS_LAYER Dwgs_User + + view->SetTopLayer( SELECTED_ITEMS_LAYER ); + KIGFX::PCB_RENDER_SETTINGS* settings = + static_cast( view->GetPainter()->GetSettings() ); + settings->SetLayerColor( SELECTED_ITEMS_LAYER, m_selectedColor ); + + view->Update( m_dummyPad ); + + // delete previous items if highlight list + while( m_highlight.size() ) { - KIGFX::VIEW* view = m_panelShowPadGal->GetView(); - m_panelShowPadGal->StopDrawing(); - - // The layer used to place primitive items selected when editing custom pad shapes - // we use here a layer never used in a pad: - #define SELECTED_ITEMS_LAYER Dwgs_User - - view->SetTopLayer( SELECTED_ITEMS_LAYER ); - KIGFX::PCB_RENDER_SETTINGS* settings = - static_cast( view->GetPainter()->GetSettings() ); - settings->SetLayerColor( SELECTED_ITEMS_LAYER, m_selectedColor ); - - view->Update( m_dummyPad ); - - // delete previous items if highlight list - while( m_highlight.size() ) - { - delete m_highlight.back(); // the dtor also removes item from view - m_highlight.pop_back(); - } - - // highlight selected primitives: - long select = m_listCtrlPrimitives->GetFirstSelected(); - - while( select >= 0 ) - { - PAD_CS_PRIMITIVE& primitive = m_primitives[select]; - - DRAWSEGMENT* dummySegment = new DRAWSEGMENT; - dummySegment->SetLayer( SELECTED_ITEMS_LAYER ); - primitive.ExportTo( dummySegment ); - dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() ); - dummySegment->Move( m_dummyPad->GetPosition() ); - - // Update selected primitive (highlight selected) - switch( primitive.m_Shape ) - { - case S_SEGMENT: - case S_ARC: - case S_CURVE: - break; - - case S_CIRCLE: // ring or circle - if( primitive.m_Thickness == 0 ) // filled circle - { // the filled circle option does not exist in a DRAWSEGMENT - // but it is easy to create it with a circle having the - // right radius and outline width - wxPoint end = dummySegment->GetCenter(); - end.x += primitive.m_Radius / 2; - dummySegment->SetEnd( end ); - dummySegment->SetWidth( primitive.m_Radius ); - } - break; - - case S_POLYGON: - break; - - default: - delete dummySegment; - dummySegment = nullptr; - break; - } - - if( dummySegment ) - { - view->Add( dummySegment ); - m_highlight.push_back( dummySegment ); - } - - select = m_listCtrlPrimitives->GetNextSelected( select ); - } - - BOX2I bbox = m_dummyPad->ViewBBox(); - - if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 ) - { - // gives a size to the full drawable area - BOX2I drawbox; - drawbox.Move( m_dummyPad->GetPosition() ); - drawbox.Inflate( bbox.GetSize().x * 2, bbox.GetSize().y * 2 ); - - view->SetBoundary( drawbox ); - - // Autozoom - view->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) ); - - // Add a margin - view->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 ); - - m_panelShowPadGal->StartDrawing(); - m_panelShowPadGal->Refresh(); - } + delete m_highlight.back(); // the dtor also removes item from view + m_highlight.pop_back(); } - else + + // highlight selected primitives: + long select = m_listCtrlPrimitives->GetFirstSelected(); + + while( select >= 0 ) { - m_panelShowPad->Refresh(); + PAD_CS_PRIMITIVE& primitive = m_primitives[select]; + + DRAWSEGMENT* dummySegment = new DRAWSEGMENT; + dummySegment->SetLayer( SELECTED_ITEMS_LAYER ); + primitive.ExportTo( dummySegment ); + dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() ); + dummySegment->Move( m_dummyPad->GetPosition() ); + + // Update selected primitive (highlight selected) + switch( primitive.m_Shape ) + { + case S_SEGMENT: + case S_ARC: + case S_CURVE: + break; + + case S_CIRCLE: // ring or circle + if( primitive.m_Thickness == 0 ) // filled circle + { // the filled circle option does not exist in a DRAWSEGMENT + // but it is easy to create it with a circle having the + // right radius and outline width + wxPoint end = dummySegment->GetCenter(); + end.x += primitive.m_Radius / 2; + dummySegment->SetEnd( end ); + dummySegment->SetWidth( primitive.m_Radius ); + } + break; + + case S_POLYGON: + break; + + default: + delete dummySegment; + dummySegment = nullptr; + break; + } + + if( dummySegment ) + { + view->Add( dummySegment ); + m_highlight.push_back( dummySegment ); + } + + select = m_listCtrlPrimitives->GetNextSelected( select ); + } + + BOX2I bbox = m_dummyPad->ViewBBox(); + + if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 ) + { + // gives a size to the full drawable area + BOX2I drawbox; + drawbox.Move( m_dummyPad->GetPosition() ); + drawbox.Inflate( bbox.GetSize().x * 2, bbox.GetSize().y * 2 ); + + view->SetBoundary( drawbox ); + + // Autozoom + view->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) ); + + // Add a margin + view->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 ); + + m_panelShowPadGal->StartDrawing(); + m_panelShowPadGal->Refresh(); } } diff --git a/pcbnew/dialogs/dialog_select_net_from_list.cpp b/pcbnew/dialogs/dialog_select_net_from_list.cpp index 19c550138b..cd8beb525f 100644 --- a/pcbnew/dialogs/dialog_select_net_from_list.cpp +++ b/pcbnew/dialogs/dialog_select_net_from_list.cpp @@ -221,25 +221,12 @@ void DIALOG_SELECT_NET_FROM_LIST::HighlightNet( const wxString& aNetName ) netCode = net->GetNet(); } - if( m_frame->IsGalCanvasActive() ) - { - auto galCanvas = m_frame->GetGalCanvas(); - KIGFX::RENDER_SETTINGS* render = galCanvas->GetView()->GetPainter()->GetSettings(); - render->SetHighlight( netCode >= 0, netCode ); + auto galCanvas = m_frame->GetGalCanvas(); + KIGFX::RENDER_SETTINGS* render = galCanvas->GetView()->GetPainter()->GetSettings(); + render->SetHighlight( netCode >= 0, netCode ); - galCanvas->GetView()->UpdateAllLayersColor(); - galCanvas->Refresh(); - } - else - { - INSTALL_UNBUFFERED_DC( dc, m_frame->GetCanvas() ); - - if( m_brd->IsHighLightNetON() ) - m_frame->HighLight( &dc ); - - m_brd->SetHighLightNet( netCode ); - m_frame->HighLight( &dc ); - } + galCanvas->GetView()->UpdateAllLayersColor(); + galCanvas->Refresh(); } diff --git a/pcbnew/dialogs/dialog_set_grid.cpp b/pcbnew/dialogs/dialog_set_grid.cpp index a64783d28c..cbe73cd4c2 100644 --- a/pcbnew/dialogs/dialog_set_grid.cpp +++ b/pcbnew/dialogs/dialog_set_grid.cpp @@ -121,15 +121,12 @@ bool DIALOG_SET_GRID::TransferDataFromWindow() // Notify GAL TOOL_MANAGER* mgr = m_parent->GetToolManager(); - if( mgr && m_parent->IsGalCanvasActive() ) - { - mgr->RunAction( "common.Control.gridPreset", true, - screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 ); + mgr->RunAction( "common.Control.gridPreset", true, + screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 ); - TOOL_EVENT gridOriginUpdate = ACTIONS::gridSetOrigin.MakeEvent(); - gridOriginUpdate.SetParameter( new VECTOR2D( m_parent->GetGridOrigin() ) ); - mgr->ProcessEvent( gridOriginUpdate ); - } + TOOL_EVENT gridOriginUpdate = ACTIONS::gridSetOrigin.MakeEvent(); + gridOriginUpdate.SetParameter( new VECTOR2D( m_parent->GetGridOrigin() ) ); + mgr->ProcessEvent( gridOriginUpdate ); m_parent->UpdateGridSelectBox(); diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index 2c74a6d839..c951e7c678 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -51,11 +51,6 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); -static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, - const wxPoint& aPosition, bool aErase ); -static void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC ); - - /* Local variables : */ static int status_dimension; /* Used in dimension creation: * = 0 : initial value: no dimension in progress @@ -211,67 +206,6 @@ void PCB_EDIT_FRAME::DeleteDimension( DIMENSION* aDimension, wxDC* aDC ) */ static wxPoint initialTextPosition; -void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC ) -{ - if( aItem == NULL ) - return; - - // Store the initial position for undo/abort command - initialTextPosition = aItem->Text().GetTextPos(); - - aItem->Draw( m_canvas, DC, GR_XOR ); - aItem->SetFlags( IS_MOVED ); - SetMsgPanel( aItem ); - - SetCrossHairPosition( aItem->Text().GetTextPos() ); - m_canvas->MoveCursorToCrossHair(); - - m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText ); - SetCurItem( aItem ); - m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); -} - - -/* Move dimension text following the cursor. */ -static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, - bool aErase ) -{ - DIMENSION* dimension = (DIMENSION*) aPanel->GetScreen()->GetCurItem(); - - if( dimension == NULL ) - return; - - if( aErase ) - dimension->Draw( aPanel, aDC, GR_XOR ); - - dimension->Text().SetTextPos( aPanel->GetParent()->GetCrossHairPosition() ); - - dimension->Draw( aPanel, aDC, GR_XOR ); -} - - -/* - * Abort current text edit progress. - * - * If a text is selected, its initial coord are regenerated - */ -void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) -{ - DIMENSION* dimension = (DIMENSION*) aPanel->GetScreen()->GetCurItem(); - ( (PCB_EDIT_FRAME*) aPanel->GetParent() )->SetCurItem( NULL ); - - aPanel->SetMouseCapture( NULL, NULL ); - - if( dimension == NULL ) // Should not occur - return; - - dimension->Draw( aPanel, aDC, GR_XOR ); - dimension->Text().SetTextPos( initialTextPosition ); - dimension->ClearFlags(); - dimension->Draw( aPanel, aDC, GR_OR ); -} - - /* * Place the current dimension text being moving */ diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 931007559b..07b897380c 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -79,74 +79,16 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case wxID_COPY: case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: - case ID_POPUP_PCB_EDIT_PCB_TARGET: - case ID_POPUP_PCB_EDIT_MODULE_PRMS: - case ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT: - case ID_POPUP_PCB_STOP_CURRENT_DRAWING: - case ID_POPUP_PCB_BEGIN_TRACK: - case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_PLACE_THROUGH_VIA: case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA: case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA: case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA: case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: - case ID_POPUP_PCB_APPLY_PAD_SETTINGS: - case ID_POPUP_PCB_COPY_PAD_SETTINGS: - case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: - case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: - case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: case ID_POPUP_PCB_FILL_ALL_ZONES: case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE: - case ID_POPUP_PCB_PLACE_ZONE_CORNER: - case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: - case ID_POPUP_PCB_EDIT_ZONE_PARAMS: - case ID_POPUP_PCB_DELETE_ZONE_CORNER: - case ID_POPUP_PCB_MOVE_ZONE_CORNER: - case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: - case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT: - case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: - case ID_POPUP_PCB_ADD_ZONE_CORNER: - case ID_POPUP_PCB_DELETE_TRACKSEG: - case ID_POPUP_PCB_DELETE_TRACK: - case ID_POPUP_PCB_DELETE_TRACKNET: case ID_POPUP_PCB_FILL_ZONE: - case ID_POPUP_PCB_SELECT_LAYER: - case ID_POPUP_PCB_SELECT_CU_LAYER: - case ID_POPUP_PCB_SELECT_LAYER_PAIR: - case ID_POPUP_PCB_SELECT_NO_CU_LAYER: - case ID_POPUP_PCB_MOVE_TRACK_NODE: - case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: - case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: - case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: - case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE: - case ID_POPUP_PCB_BREAK_TRACK: - case ID_POPUP_PCB_EDIT_NET: - case ID_POPUP_PCB_EDIT_TRACK: - case ID_POPUP_PCB_EDIT_TRACKSEG: - case ID_POPUP_PCB_LOCK_ON_TRACKSEG: - case ID_POPUP_PCB_LOCK_OFF_TRACKSEG: - case ID_POPUP_PCB_LOCK_ON_TRACK: - case ID_POPUP_PCB_LOCK_OFF_TRACK: - case ID_POPUP_PCB_LOCK_ON_NET: - case ID_POPUP_PCB_LOCK_OFF_NET: - case ID_POPUP_PCB_GETINFO_MARKER: - case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST: - case ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST: - break; - - case ID_POPUP_CANCEL_CURRENT_COMMAND: - if( m_canvas->IsMouseCaptured() ) - { - m_canvas->EndMouseCapture(); - } - - if( GetToolId() == ID_NO_TOOL_SELECTED ) - SetNoToolSelected(); - else - SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ); - break; default: // Finish (abort) the command @@ -237,63 +179,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) InstallNetlistFrame( &dc ); break; - case ID_POPUP_CLOSE_CURRENT_TOOL: - SetNoToolSelected(); - break; - - case ID_POPUP_CANCEL_CURRENT_COMMAND: - break; - - case ID_POPUP_PCB_END_LINE: - m_canvas->MoveCursorToCrossHair(); - - // EndSegment(&dc); - break; - - case ID_POPUP_PCB_EDIT_TRACK: - if( GetCurItem() == NULL ) - break; - Edit_Track_Width( &dc, (TRACK*) GetCurItem() ); - m_canvas->MoveCursorToCrossHair(); - OnModify(); - break; - - case ID_POPUP_PCB_EDIT_TRACKSEG: - if( GetCurItem() == NULL ) - break; - Edit_TrackSegm_Width( &dc, (TRACK*) GetCurItem() ); - m_canvas->MoveCursorToCrossHair(); - OnModify(); - break; - - case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE: - { - wxCommandEvent dummy; - OnEditTracksAndVias( dummy ); - } - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_BEGIN_TRACK: - m_canvas->MoveCursorToCrossHair(); - OnHotkeyBeginRoute( &dc ); - break; - - case ID_POPUP_PCB_END_TRACK: - m_canvas->MoveCursorToCrossHair(); - End_Route( (TRACK*) GetCurItem(), &dc ); - break; - - case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE: - m_canvas->MoveCursorToCrossHair(); - - if( GetCurItem()->IsDragging() ) - { - PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc ); - } - - break; - case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: /* change the position of initial segment when creating new tracks * switch from _/ to -\ . @@ -321,6 +206,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( GetCurItem()->IsDragging() ) { + // JEY TODO: reachable? PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc ); } else @@ -376,160 +262,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } break; - case ID_POPUP_PCB_DELETE_TRACKSEG: - if( GetCurItem() ) - { - m_canvas->MoveCursorToCrossHair(); - SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) ); - OnModify(); - } - break; - - case ID_POPUP_PCB_DELETE_TRACK: - if( GetCurItem() ) - { - m_canvas->MoveCursorToCrossHair(); - Delete_Track( &dc, (TRACK*) GetCurItem() ); - SetCurItem( NULL ); - OnModify(); - } - break; - - case ID_POPUP_PCB_DELETE_TRACKNET: - m_canvas->MoveCursorToCrossHair(); - Delete_net( &dc, (TRACK*) GetCurItem() ); - SetCurItem( NULL ); - OnModify(); - break; - - case ID_POPUP_PCB_LOCK_ON_TRACKSEG: - Attribut_Segment( (TRACK*) GetCurItem(), &dc, true ); - break; - - case ID_POPUP_PCB_LOCK_OFF_TRACKSEG: - Attribut_Segment( (TRACK*) GetCurItem(), &dc, false ); - break; - - case ID_POPUP_PCB_LOCK_ON_TRACK: - Attribut_Track( (TRACK*) GetCurItem(), &dc, true ); - break; - - case ID_POPUP_PCB_LOCK_OFF_TRACK: - Attribut_Track( (TRACK*) GetCurItem(), &dc, false ); - break; - - case ID_POPUP_PCB_LOCK_ON_NET: - Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), true ); - break; - - case ID_POPUP_PCB_LOCK_OFF_NET: - Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), false ); - break; - - case ID_POPUP_PCB_SETFLAGS_TRACK_MNU: - break; - - case ID_POPUP_PCB_EDIT_ZONE_PARAMS: - Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() ); - SetCurItem( NULL ); // Outlines can have changed - break; - - case ID_POPUP_PCB_ZONE_DUPLICATE: - { - ZONE_CONTAINER* zone = (ZONE_CONTAINER*) GetCurItem(); - duplicateZone( &dc, zone ); - } - break; - - case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE: - m_canvas->MoveCursorToCrossHair(); - m_canvas->SetAutoPanRequest( true ); - Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() ); - break; - - case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE: - m_canvas->MoveCursorToCrossHair(); - m_canvas->SetAutoPanRequest( true ); - Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() ); - break; - - case ID_POPUP_PCB_DELETE_ZONE_CONTAINER: - // Force the main contour selection, to remove the entire zone: - ((ZONE_CONTAINER*) GetCurItem())->SetSelectedCorner( 0 ); - // Fall through - case ID_POPUP_PCB_DELETE_ZONE_CUTOUT: - m_canvas->MoveCursorToCrossHair(); - { - int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNetCode(); - Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() ); - SetCurItem( NULL ); - TestNetConnection( NULL, netcode ); - SetMsgPanel( GetBoard() ); - } - break; - - case ID_POPUP_PCB_DELETE_ZONE_CORNER: - Remove_Zone_Corner( &dc, (ZONE_CONTAINER*) GetCurItem() ); - SetCurItem( NULL ); - break; - - case ID_POPUP_PCB_MOVE_ZONE_CORNER: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false ); - } - break; - - case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() ); - } - break; - - case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Outlines( &dc, zone_cont ); - } - break; - - case ID_POPUP_PCB_ADD_ZONE_CORNER: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - wxPoint pos = GetCrossHairPosition(); - - /* add corner between zone_cont->m_CornerSelection - * and zone_cont->m_CornerSelection+1 - * and start move the new corner - */ - zone_cont->Draw( m_canvas, &dc, GR_XOR ); - zone_cont->Outline()->InsertVertex( zone_cont->GetSelectedCorner(), pos ); - zone_cont->SetSelectedCorner( zone_cont->GetSelectedCorner() + 1 ); - zone_cont->Draw( m_canvas, &dc, GR_XOR ); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true ); - } - break; - - case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: - case ID_POPUP_PCB_PLACE_ZONE_CORNER: - case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont ); - m_canvas->SetAutoPanRequest( false ); - } - break; - case ID_POPUP_PCB_FILL_ALL_ZONES: m_canvas->MoveCursorToCrossHair(); Fill_All_Zones(); @@ -578,190 +310,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; } - case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it - SetCurItem( GetFootprintFromBoardByReference() ); - module = (MODULE*) GetCurItem(); - - if( module == NULL ) - break; - - if( module->IsLocked() ) - { - wxString msg = wxString::Format( - _( "Footprint %s found, but it is locked" ), - module->GetReference().GetData() ); - DisplayInfoMessage( this, msg ); - break; - } - - SendMessageToEESCHEMA( module ); - m_canvas->MoveCursorToCrossHair(); - StartMoveModule( module, &dc, false ); - break; - - case ID_POPUP_PCB_UPDATE_FOOTPRINTS: - if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T ) - { - InstallExchangeModuleFrame( dynamic_cast( GetCurItem() ), true, true ); - m_canvas->MoveCursorToCrossHair(); - } - break; - - case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS: - if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T ) - { - InstallExchangeModuleFrame( dynamic_cast( GetCurItem() ), false, true ); - m_canvas->MoveCursorToCrossHair(); - } - break; - - case ID_POPUP_PCB_EDIT_MODULE_PRMS: - // If the current Item is a pad, text module ...: Get its parent - if( GetCurItem()->Type() != PCB_MODULE_T ) - SetCurItem( GetCurItem()->GetParent() ); - - if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T ) - break; - - InstallFootprintPropertiesDialog( (MODULE*) GetCurItem(), &dc ); - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT: - - // If we don't have a current item, there's nothing we can do here - if( !GetCurItem() ) - break; - - // If the current Item is a pad, text module ...: Get its parent - if( GetCurItem()->Type() != PCB_MODULE_T ) - SetCurItem( GetCurItem()->GetParent() ); - - if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T ) - break; - - if( GetCurItem()->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp - { - GetCurItem()->SetTimeStamp( GetNewTimeStamp() ); - OnModify(); - } - - { - FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true ); - - editor->Load_Module_From_BOARD( (MODULE*)GetCurItem() ); - SetCurItem( NULL ); // the current module could be deleted by - } - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_DRAG_PAD_REQUEST: - module = (MODULE*) GetCurItem()->GetParent(); - - if( !module || module->Type() != PCB_MODULE_T ) - break; - - if( module->IsLocked() ) - { - wxString msg; - msg.Printf( _( "The parent (%s) of the pad is locked" ), - module->GetReference().GetData() ); - DisplayInfoMessage( this, msg ); - break; - } - - m_canvas->MoveCursorToCrossHair(); - StartMovePad( (D_PAD*) GetCurItem(), &dc, true ); - break; - - case ID_POPUP_PCB_MOVE_PAD_REQUEST: - module = (MODULE*) GetCurItem()->GetParent(); - - if( !module || module->Type() != PCB_MODULE_T ) - break; - - if( module->IsLocked() ) - { - wxString msg; - msg.Printf( _( "The parent (%s) of the pad is locked" ), - module->GetReference().GetData() ); - DisplayInfoMessage( this, msg ); - break; - } - - m_canvas->MoveCursorToCrossHair(); - StartMovePad( (D_PAD*) GetCurItem(), &dc, false ); - break; - - case ID_POPUP_PCB_EDIT_PAD: - InstallPadOptionsFrame( (D_PAD*) GetCurItem() ); - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_APPLY_PAD_SETTINGS: - m_canvas->MoveCursorToCrossHair(); - SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED ); - Import_Pad_Settings( (D_PAD*) GetCurItem(), true ); - break; - - case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: - m_canvas->MoveCursorToCrossHair(); - PushPadProperties((D_PAD*) GetCurItem() ); - break; - - case ID_POPUP_PCB_COPY_PAD_SETTINGS: - m_canvas->MoveCursorToCrossHair(); - Export_Pad_Settings( (D_PAD*) GetCurItem() ); - break; - - case ID_POPUP_PCB_SELECT_LAYER: - { - PCB_LAYER_ID itmp = SelectLayer( GetActiveLayer() ); - - if( itmp >= 0 ) - { - // if user changed colors and we are in high contrast mode, then redraw - // because the PAD_ATTRIB_SMD pads may change color. - if( displ_opts->m_ContrastModeDisplay && GetActiveLayer() != itmp ) - { - m_canvas->Refresh(); - } - SetActiveLayer( itmp ); - } - - m_canvas->MoveCursorToCrossHair(); - } - break; - case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: SelectCopperLayerPair(); break; - case ID_POPUP_PCB_SELECT_NO_CU_LAYER: - { - PCB_LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllCuMask() ); - - if( itmp >= 0 ) - SetActiveLayer( itmp ); - - m_canvas->MoveCursorToCrossHair(); - } - break; - - case ID_POPUP_PCB_SELECT_CU_LAYER: - { - PCB_LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask() ); - - if( itmp >= 0 ) - SetActiveLayer( itmp ); - } - break; - - case ID_POPUP_PCB_SELECT_LAYER_PAIR: - SelectCopperLayerPair(); - m_canvas->MoveCursorToCrossHair(); - break; - case ID_TOOLBARH_PCB_SELECT_LAYER: SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) ); @@ -769,130 +321,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->Refresh( true ); break; - case ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST: - BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc ); - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_EDIT_PCB_TARGET: - ShowTargetOptionsDialog( (PCB_TARGET*) GetCurItem(), &dc ); - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_DELETE_PCB_TARGET: - m_canvas->MoveCursorToCrossHair(); - DeleteTarget( (PCB_TARGET*) GetCurItem(), &dc ); - SetCurItem( NULL ); - break; - - case ID_POPUP_PCB_DELETE_DIMENSION: - m_canvas->MoveCursorToCrossHair(); - DeleteDimension( (DIMENSION*) GetCurItem(), &dc ); - SetCurItem( NULL ); - break; - - case ID_POPUP_PCB_EDIT_DIMENSION: - ShowDimensionPropertyDialog( (DIMENSION*) GetCurItem(), &dc ); - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST: - BeginMoveDimensionText( (DIMENSION*) GetCurItem(), &dc ); - break; - - case ID_POPUP_PCB_DELETE_MARKER: - RemoveStruct( GetCurItem(), &dc ); - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_GETINFO_MARKER: - if( GetCurItem() && GetCurItem()->Type() == PCB_MARKER_T ) - ( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this ); - - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_DELETE_DRAWING_LAYER: - if( GetCurItem()->GetEditFlags() != 0 ) - break; - - Delete_Drawings_All_Layer( GetCurItem()->GetLayer() ); - SetCurItem( NULL ); - m_canvas->MoveCursorToCrossHair(); - m_canvas->Refresh(); - break; - - case ID_POPUP_PCB_STOP_CURRENT_DRAWING: - m_canvas->MoveCursorToCrossHair(); - - if( GetCurItem() && (GetCurItem()->IsNew()) ) - { - End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc ); - SetCurItem( NULL ); - } - - break; - - case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: - m_canvas->MoveCursorToCrossHair(); - - if( GetCurItem() && (GetCurItem()->IsNew()) ) - { - if( End_Zone( &dc ) ) - SetCurItem( NULL ); - } - - m_canvas->SetAutoPanRequest( false ); - break; - - case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: - m_canvas->MoveCursorToCrossHair(); - - if( GetCurItem() && (GetCurItem()->IsNew()) ) - { - if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline, - SetCurItem( NULL ); - } - - break; - - - case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: - m_canvas->MoveCursorToCrossHair(); - StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id ); - break; - - case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: - case ID_POPUP_PCB_MOVE_TRACK_NODE: - m_canvas->MoveCursorToCrossHair(); - StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id ); - break; - - case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: - m_canvas->MoveCursorToCrossHair(); - Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(), &dc ); - break; - - case ID_POPUP_PCB_BREAK_TRACK: - m_canvas->MoveCursorToCrossHair(); - { - TRACK* track = (TRACK*) GetScreen()->GetCurItem(); - wxPoint pos = GetCrossHairPosition(); - - track->Draw( m_canvas, &dc, GR_XOR ); - PICKED_ITEMS_LIST itemsListPicker; - - TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker ); - - SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED ); - track->Draw( m_canvas, &dc, GR_XOR ); - newtrack->Draw( m_canvas, &dc, GR_XOR ); - - // compute the new ratsnest, because connectivity could change - TestNetConnection( &dc, track->GetNetCode() ); - } - break; - case ID_POPUP_PCB_MOVE_EXACT: moveExact(); break; @@ -917,14 +345,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) Swap_Layers( event ); break; - case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: - { - wxConfigBase* cfg = Pgm().CommonSettings(); - cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName ); - GetAssociatedDocument( this, g_DocModulesFileName, &Kiface().KifaceSearch() ); - } - break; - case ID_MENU_ARCHIVE_MODULES_IN_LIBRARY: ArchiveModulesOnBoard( false ); break; diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 013d6db5c7..7ed568e02e 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -138,66 +138,6 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) } -void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( PCB_LAYER_ID aLayer ) -{ - if( IsCopperLayer( aLayer ) ) - { - DisplayError( this, _( "Copper layer global delete not allowed!" ) ); - return; - } - - wxString msg; - msg.Printf( _( "Delete everything on layer %s?" ), - GetChars( GetBoard()->GetLayerName( aLayer ) ) ); - - if( !IsOK( this, msg ) ) - return; - - // Step 1: build the list of items to remove. - // because we are using iterators, we cannot modify the drawing list during iterate - // so we are using a 2 steps calculation: - // First, collect items. - // Second, remove items. - std::vector list; - - for( auto item : GetBoard()->Drawings() ) - { - switch( item->Type() ) - { - case PCB_LINE_T: - case PCB_TEXT_T: - case PCB_DIMENSION_T: - case PCB_TARGET_T: - if( item->GetLayer() == aLayer ) - list.push_back( item ); - - break; - - default: - wxLogDebug( wxT( "Delete_Drawings_All_Layer() error: unknown type %d" ), item->Type() ); - - } - } - - if( list.size() == 0 ) // No item found - return; - - // Step 2: remove items from main list, and move them to the undo list - PICKED_ITEMS_LIST pickList; - ITEM_PICKER picker( NULL, UR_DELETED ); - - for( auto item : list ) - { - item->UnLink(); - picker.SetItem( item ); - pickList.PushItem( picker ); - } - - OnModify(); - SaveCopyInUndoList(pickList, UR_DELETED); -} - - static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC ) { DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem(); diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index e23ee93691..271acf339f 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -604,15 +604,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in // Select netclass Default as current netclass (it always exists) SetCurrentNetClass( NETCLASS::Default ); - // When GAL is active, the connectivity is rebuilt when the board is loaded - // For legacy, we keep these calls to ensure ratsnest - // todo: Remove legacy code - if( !IsGalCanvasActive() ) - { - // Rebuild list of nets (full ratsnest rebuild) - Compile_Ratsnest( NULL, true ); - GetBoard()->BuildConnectivity(); - } + // Rebuild list of nets (full ratsnest rebuild) + Compile_Ratsnest( NULL, true ); + GetBoard()->BuildConnectivity(); onBoardLoaded(); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 9f52bf3d46..7362b38672 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -140,20 +140,12 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU( ID_POPUP_MODEDIT_EDIT_BODY_ITEM, - FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU( ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE, - FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU( ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE, - FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU( ID_PCB_USER_GRID_SETUP, FOOTPRINT_EDIT_FRAME::OnGridSettings ) // Menu 3D Frame EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_Frame ) // Switching canvases - EVT_MENU( ID_MENU_CANVAS_LEGACY, FOOTPRINT_EDIT_FRAME::OnSwitchCanvas ) EVT_MENU( ID_MENU_CANVAS_CAIRO, FOOTPRINT_EDIT_FRAME::OnSwitchCanvas ) EVT_MENU( ID_MENU_CANVAS_OPENGL, FOOTPRINT_EDIT_FRAME::OnSwitchCanvas ) @@ -532,11 +524,8 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) } } - if( IsGalCanvasActive() ) - { - GetGalCanvas()->SetEventDispatcher( NULL ); - GetGalCanvas()->StopDrawing(); - } + GetGalCanvas()->SetEventDispatcher( NULL ); + GetGalCanvas()->StopDrawing(); // Do not show the layer manager during closing to avoid flicker // on some platforms (Windows) that generate useless redraw of items in diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index c38d44c00e..e71d0731e3 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -342,14 +342,6 @@ public: /// Function to place a graphic item type EDGE_MODULE currently moved void Place_EdgeMod( EDGE_MODULE* drawitem ); - /** - * Change pad characteristics for the given footprint - * or all footprints which look like the given footprint. - * Options are set by the opened dialog. - * @param aPad is the pattern. The given footprint is the parent of this pad - */ - void PushPadProperties( D_PAD* aPad ); - /** * Delete the given module from its library. */ diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 739263cbfe..ebd1a41acb 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -254,15 +254,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case wxID_COPY: case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_MODEDIT_PAD_SETTINGS: - case ID_POPUP_PCB_COPY_PAD_SETTINGS: - case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: - case ID_POPUP_PCB_STOP_CURRENT_DRAWING: - case ID_POPUP_MODEDIT_EDIT_BODY_ITEM: - case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE: - case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE: break; - case ID_POPUP_CANCEL_CURRENT_COMMAND: default: if( m_canvas->IsMouseCaptured() ) { @@ -270,8 +263,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->CallEndMouseCapture( &dc ); } - if( id != ID_POPUP_CANCEL_CURRENT_COMMAND ) - SetNoToolSelected(); + SetNoToolSelected(); break; } @@ -427,7 +419,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { m_toolManager->GetView()->Update( GetBoard()->m_Modules ); - if( IsGalCanvasActive() && GetGalCanvas() ) + if( GetGalCanvas() ) GetGalCanvas()->ForceRefresh(); else GetCanvas()->Refresh(); @@ -460,7 +452,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_toolManager->GetView()->Update( GetBoard()->m_Modules ); GetScreen()->ClrModify(); - if( IsGalCanvasActive() && GetGalCanvas() ) + if( GetGalCanvas() ) GetGalCanvas()->ForceRefresh(); else GetCanvas()->Refresh(); @@ -594,26 +586,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) } break; - case ID_POPUP_CLOSE_CURRENT_TOOL: - break; - - case ID_POPUP_CANCEL_CURRENT_COMMAND: - break; - - case ID_POPUP_PCB_EDIT_MODULE_PRMS: - editFootprintProperties( (MODULE*) GetScreen()->GetCurItem() ); - m_canvas->MoveCursorToCrossHair(); - m_canvas->Refresh(); - break; - - case ID_POPUP_PCB_MOVE_PAD_REQUEST: - m_canvas->MoveCursorToCrossHair(); - StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc, false ); - break; - - case ID_POPUP_PCB_EDIT_PAD: - InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem() ); - m_canvas->MoveCursorToCrossHair(); break; case ID_POPUP_PCB_MOVE_EXACT: @@ -626,44 +598,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) // JEY TODO: many (most? all?) of these are legacy-only and can be removed. - case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: - SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED ); - // Calls the global change dialog: - PushPadProperties((D_PAD*) GetScreen()->GetCurItem()); - m_canvas->MoveCursorToCrossHair(); - break; - - case ID_POPUP_PCB_COPY_PAD_SETTINGS: - m_canvas->MoveCursorToCrossHair(); - Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() ); - break; - - case ID_POPUP_PCB_STOP_CURRENT_DRAWING: - m_canvas->MoveCursorToCrossHair(); - - if( GetScreen()->GetCurItem()->IsNew() ) - { - End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem() ); - SetCurItem( NULL ); - } - break; - - case ID_POPUP_MODEDIT_EDIT_BODY_ITEM : - InstallGraphicItemPropertiesDialog( GetScreen()->GetCurItem() ); - break; - - case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE: - m_canvas->MoveCursorToCrossHair(); - Edit_Edge_Width( NULL ); - m_canvas->Refresh(); - break; - - case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE: - m_canvas->MoveCursorToCrossHair(); - Edit_Edge_Layer( NULL ); - m_canvas->Refresh(); - break; - case ID_GEN_IMPORT_GRAPHICS_FILE: if( GetBoard()->m_Modules ) { @@ -866,11 +800,8 @@ void FOOTPRINT_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer ) m_Layers->SelectLayer( GetActiveLayer() ); m_Layers->OnLayerSelected(); - if( IsGalCanvasActive() ) - { - GetGalCanvas()->SetHighContrastLayer( aLayer ); - GetGalCanvas()->Refresh(); - } + GetGalCanvas()->SetHighContrastLayer( aLayer ); + GetGalCanvas()->Refresh(); } bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, int aCtl ) diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index cc5e7ae076..1afcf93a49 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -329,8 +329,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName ) SetMsgPanel( module ); PlaceModule( module, NULL ); - if( IsGalCanvasActive() ) - module->SetPosition( wxPoint( 0, 0 ) ); + module->SetPosition( wxPoint( 0, 0 ) ); GetBoard()->m_Status_Pcb = 0; GetBoard()->BuildListOfNets(); @@ -856,11 +855,8 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) newmodule->SetTimeStamp( GetNewTimeStamp() ); commit.Push( wxT( "Insert module" ) ); - if( pcbframe->IsGalCanvasActive() ) - { - pcbframe->Raise(); - pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::placeModule, true, newmodule ); - } + pcbframe->Raise(); + pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::placeModule, true, newmodule ); } newmodule->ClearFlags(); diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 97561ad087..dd402a745e 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -499,11 +499,8 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& event ) newmodule->SetTimeStamp( GetNewTimeStamp() ); commit.Push( wxT( "Insert module" ) ); - if( pcbframe->IsGalCanvasActive() ) - { - pcbframe->Raise(); - pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::placeModule, true, newmodule ); - } + pcbframe->Raise(); + pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::placeModule, true, newmodule ); newmodule->ClearFlags(); pcbframe->SetCurItem( NULL ); diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 884f69b08d..e74e941bf9 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -256,12 +256,9 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME() // Delete the GRID_TRICKS. m_parameterGrid->PopEventHandler( true ); - if( IsGalCanvasActive() ) - { - GetGalCanvas()->StopDrawing(); - // Be sure any event cannot be fired after frame deletion: - GetGalCanvas()->SetEvtHandlerEnabled( false ); - } + GetGalCanvas()->StopDrawing(); + // Be sure any event cannot be fired after frame deletion: + GetGalCanvas()->SetEvtHandlerEnabled( false ); // Be sure a active tool (if exists) is desactivated: if( m_toolManager ) @@ -328,15 +325,12 @@ void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void FOOTPRINT_WIZARD_FRAME::updateView() { - if( IsGalCanvasActive() ) - { - auto dp = static_cast( GetGalCanvas() ); - dp->UseColorScheme( &Settings().Colors() ); - dp->DisplayBoard( GetBoard() ); - m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); - m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); - UpdateMsgPanel(); - } + auto dp = static_cast( GetGalCanvas() ); + dp->UseColorScheme( &Settings().Colors() ); + dp->DisplayBoard( GetBoard() ); + m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); + m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); + UpdateMsgPanel(); } diff --git a/pcbnew/footprint_wizard_frame_functions.cpp b/pcbnew/footprint_wizard_frame_functions.cpp index 6b6183514b..4a25b02473 100644 --- a/pcbnew/footprint_wizard_frame_functions.cpp +++ b/pcbnew/footprint_wizard_frame_functions.cpp @@ -104,8 +104,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() SetCurItem( NULL ); - if( IsGalCanvasActive() ) - m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); + m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 652170bb93..224a4810ae 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -413,10 +413,6 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit evt_type = ID_MENU_CANVAS_OPENGL; break; - case HK_CANVAS_LEGACY: - evt_type = ID_MENU_CANVAS_LEGACY; - break; - case HK_ZONE_FILL_OR_REFILL: evt_type = ID_POPUP_PCB_FILL_ALL_ZONES; break; @@ -522,16 +518,6 @@ bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand ) evt_type = ID_POPUP_PCB_CREATE_ARRAY; break; - case HK_DUPLICATE_ITEM_AND_INCREMENT: - if( canDuplicate ) - evt_type = ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT; - break; - - case HK_DUPLICATE: - if( canDuplicate ) - evt_type = ID_POPUP_PCB_DUPLICATE_ITEM; - break; - case HK_MOVE_ITEM_EXACT: evt_type = ID_POPUP_PCB_MOVE_EXACT; break; diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 73f78bad50..d9eae839c8 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -328,7 +328,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) col = COLUMN_COLORBM; auto bmb = new COLOR_SWATCH( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ), - AreArbitraryColorsAllowed(), getBackgroundLayerColor() ); + getBackgroundLayerColor() ); bmb->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this ); bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnLayerSwatchChanged, this ); bmb->SetToolTip( _("Left double click or middle click for color change, right click for menu" ) ); @@ -403,7 +403,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) if( aSpec.color != COLOR4D::UNSPECIFIED ) { auto bmb = new COLOR_SWATCH( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ), - AreArbitraryColorsAllowed(), getBackgroundLayerColor() ); + getBackgroundLayerColor() ); bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnRenderSwatchChanged, this ); bmb->SetToolTip( _( "Left double click or middle click for color change" ) ); m_RenderFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags ); diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index 4241c669b0..9d50797b70 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -144,13 +144,6 @@ protected: */ virtual bool useAlternateBitmap(int aRow) { return false; } - /** - * Subclasses can override this to provide logic for allowing - * arbitrary color selection via wxColourPicker instead of DisplayColorFrame. - */ - // LEGACY TODO: obsolete once legacy canvas removed - virtual bool AreArbitraryColorsAllowed() { return false; } - /** * Subclasses can override this to provide accurate representation * of transparent colour swatches. diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 8a025c8312..1a52509d68 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -159,8 +159,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) Update3DView(); - if( IsGalCanvasActive() ) - updateView(); + updateView(); m_canvas->Refresh(); diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index b51a4f254b..7f9967ecef 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -334,22 +334,14 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() prefs_menu->AppendSeparator(); - if( ADVANCED_CFG::GetCfg().AllowLegacyCanvas() ) - { - text = AddHotkeyName( _( "Legacy Tool&set" ), m_hotkeysDescrList, HK_CANVAS_LEGACY ); - AddMenuItem( prefs_menu, ID_MENU_CANVAS_LEGACY, text, - _( "Use Legacy Toolset (not all features will be available)" ), - KiBitmap( tools_xpm ), wxITEM_RADIO ); - } - - text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), m_hotkeysDescrList, HK_CANVAS_OPENGL ); + text = AddHotkeyName( _( "Accelerated Graphics" ), m_hotkeysDescrList, HK_CANVAS_OPENGL ); AddMenuItem( prefs_menu, ID_MENU_CANVAS_OPENGL, text, - _( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ), + _( "Use hardware-accelerated graphics (recommended)" ), KiBitmap( tools_xpm ), wxITEM_RADIO ); - text = AddHotkeyName( _( "Modern Toolset (&Fallback)" ), m_hotkeysDescrList, HK_CANVAS_CAIRO ); + text = AddHotkeyName( _( "Standard Graphics" ), m_hotkeysDescrList, HK_CANVAS_CAIRO ); AddMenuItem( prefs_menu, ID_MENU_CANVAS_CAIRO, text, - _( "Use Modern Toolset with software graphics (fall-back)" ), + _( "Use software graphics (fall-back)" ), KiBitmap( tools_xpm ), wxITEM_RADIO ); prefs_menu->AppendSeparator(); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index d068116841..d61ef363f9 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -475,25 +475,16 @@ void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu ) _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); - if( ADVANCED_CFG::GetCfg().AllowLegacyCanvas() ) - { - text = AddHotkeyName( - _( "Legacy Tool&set" ), g_Board_Editor_Hotkeys_Descr, HK_CANVAS_LEGACY ); - AddMenuItem( aParentMenu, ID_MENU_CANVAS_LEGACY, text, - _( "Use Legacy Toolset (not all features will be available)" ), - KiBitmap( tools_xpm ), wxITEM_RADIO ); - } - - text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Board_Editor_Hotkeys_Descr, + text = AddHotkeyName( _( "Accelerated Graphics" ), g_Board_Editor_Hotkeys_Descr, HK_CANVAS_OPENGL ); AddMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL, text, - _( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ), + _( "Use hardware-accelerated graphics (recommended)" ), KiBitmap( tools_xpm ), wxITEM_RADIO ); - text = AddHotkeyName( _( "Modern Toolset (Fallbac&k)" ), g_Board_Editor_Hotkeys_Descr, + text = AddHotkeyName( _( "Standard Graphics" ), g_Board_Editor_Hotkeys_Descr, HK_CANVAS_CAIRO ); AddMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO, text, - _( "Use Modern Toolset with software graphics (fall-back)" ), + _( "Use software graphics (fall-back)" ), KiBitmap( tools_xpm ), wxITEM_RADIO ); aParentMenu->AppendSeparator(); diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index 4a4f9cfc3d..7ad07d5e69 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -19,103 +19,9 @@ #include -static D_PAD* s_CurrentSelectedPad; static wxPoint Pad_OldPos; -/* Cancel move pad command. - */ -static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC ) -{ - D_PAD* pad = s_CurrentSelectedPad; - - Panel->SetMouseCapture( NULL, NULL ); - - if( pad == NULL ) - return; - - pad->Draw( Panel, DC, GR_XOR ); - pad->ClearFlags(); - pad->SetPosition( Pad_OldPos ); - pad->Draw( Panel, DC, GR_XOR ); - - // Pad move in progress: restore origin of dragged tracks, if any. - for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) - { - TRACK* track = g_DragSegmentList[ii].m_Track; - track->Draw( Panel, DC, GR_XOR ); - track->SetState( IN_EDIT, false ); - track->ClearFlags(); - g_DragSegmentList[ii].RestoreInitialValues(); - track->Draw( Panel, DC, GR_OR ); - } - - EraseDragList(); - s_CurrentSelectedPad = NULL; -} - - -/* Draw in drag mode when moving a pad. - */ -static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, - bool aErase ) -{ - TRACK* Track; - D_PAD* pad = s_CurrentSelectedPad; - - if( pad == NULL ) // Should not occur - return; - - if( aErase ) - pad->Draw( aPanel, aDC, GR_XOR ); - - pad->SetPosition( aPanel->GetParent()->GetCrossHairPosition() ); - pad->Draw( aPanel, aDC, GR_XOR ); - - for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) - { - Track = g_DragSegmentList[ii].m_Track; - - if( aErase ) - Track->Draw( aPanel, aDC, GR_XOR ); - - g_DragSegmentList[ii].SetTrackEndsCoordinates( wxPoint(0, 0) ); - - Track->Draw( aPanel, aDC, GR_XOR ); - } -} - - -// Function to initialize the "move pad" command -void PCB_BASE_FRAME::StartMovePad( D_PAD* aPad, wxDC* aDC, bool aDragConnectedTracks ) -{ - if( aPad == NULL ) - return; - - s_CurrentSelectedPad = aPad; - - Pad_OldPos = aPad->GetPosition(); - - SetMsgPanel( aPad ); - m_canvas->SetMouseCapture( Show_Pad_Move, Abort_Move_Pad ); - - // Draw the pad, in SKETCH mode - aPad->Draw( m_canvas, aDC, GR_XOR ); - aPad->SetFlags( IS_MOVED ); - aPad->Draw( m_canvas, aDC, GR_XOR ); - - EraseDragList(); - - // Build the list of track segments to drag if the command is a drag pad - if( aDragConnectedTracks ) - { - DRAG_LIST drglist( GetBoard() ); - drglist.BuildDragListe( aPad ); - UndrawAndMarkSegmentsToDrag( m_canvas, aDC ); - } -} - - // Routine to place a moved pad. void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC ) { diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 0fac5c5769..4a44bf5403 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -45,751 +45,9 @@ #include -static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, - bool aErase ); -static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, - wxDC* aDC, - const wxPoint& aPosition, - bool aErase ); -static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ); -static bool InitialiseDragParameters(); - - -static wxPoint PosInit, s_LastPos; -static double s_StartSegmentSlope, s_EndSegmentSlope, - s_MovingSegmentSlope, - s_StartSegment_Yorg, s_EndSegment_Yorg, - s_MovingSegment_Yorg; //slope and intercept parameters of lines -bool s_StartPointVertical, s_EndPointVertical, - s_MovingSegmentVertical, s_MovingSegmentHorizontal, - s_StartPointHorizontal, s_EndPointHorizontal; // vertical or - // horizontal line - // indicators -bool s_StartSegmentPresent, s_EndSegmentPresent; - static PICKED_ITEMS_LIST s_ItemsListPicker; -/** Abort function for drag or move track - */ -static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) -{ - PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) aPanel->GetParent(); - BOARD * pcb = frame->GetBoard(); - - pcb->HighLightOFF(); - pcb->PopHighLight(); - - frame->SetCurItem( NULL ); - aPanel->SetMouseCapture( NULL, NULL ); - - // Undo move and redraw trace segments. - for( unsigned jj=0 ; jj < g_DragSegmentList.size(); jj++ ) - { - TRACK* track = g_DragSegmentList[jj].m_Track; - g_DragSegmentList[jj].RestoreInitialValues(); - track->SetState( IN_EDIT, false ); - track->ClearFlags(); - } - - // Clear the undo picker list: - s_ItemsListPicker.ClearListAndDeleteItems(); - EraseDragList(); - aPanel->Refresh(); -} - - -// Redraw the moved node according to the mouse cursor position -static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, - bool aErase ) -{ - auto displ_opts = (PCB_DISPLAY_OPTIONS*) aPanel->GetDisplayOptions(); - wxPoint moveVector; - int tmp = displ_opts->m_DisplayPcbTrackFill; - GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT; - - displ_opts->m_DisplayPcbTrackFill = false; - -#ifndef USE_WX_OVERLAY - aErase = true; -#else - aErase = false; -#endif - - // set the new track coordinates - wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition(); - - moveVector = Pos - s_LastPos; - s_LastPos = Pos; - - TRACK *track = NULL; - - for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) - { - track = g_DragSegmentList[ii].m_Track; - - if( aErase ) - track->Draw( aPanel, aDC, draw_mode ); - - if( track->GetFlags() & STARTPOINT ) - track->SetStart( track->GetStart() + moveVector ); - - if( track->GetFlags() & ENDPOINT ) - track->SetEnd( track->GetEnd() + moveVector ); - - if( track->Type() == PCB_VIA_T ) - track->SetEnd( track->GetStart() ); - - track->Draw( aPanel, aDC, draw_mode ); - } - - displ_opts->m_DisplayPcbTrackFill = tmp; - - // Display track length - if( track ) - { - PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); - frame->SetMsgPanel( track ); - } -} - - -/* drawing the track segment movement - * > s_MovingSegmentSlope slope = moving track segment slope - * > s_StartSegmentSlope slope = slope of the segment connected to the start - * point of the moving segment - * > s_EndSegmentSlope slope = slope of the segment connected to the end point - * of the moving segment - * - * moved segment function : - * yt=s_MovingSegmentSlope * x + s_MovingSegment_Yorg - * - * segment connected to moved segment's start: - * y1 = s_StartSegmentSlope * x + s_StartSegment_Yorg - * - * segment connected to moved segment's end: - * y2=s_EndSegmentSlope * x + s_EndSegment_Yorg - * - * first intersection point will be located at - * y1=yt -> - * - * xi1=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_StartSegmentSlope-s_MovingSegmentSlope) - * yi1=s_MovingSegmentSlope*xi1+s_MovingSegment_Yorg - * or yi1=s_StartSegmentSlope*xi1+s_MovingSegment_Yorg - * - * second intersection point - * y2=yt -> - * - * xi2=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_MovingSegmentSlope-s_MovingSegmentSlope) - * yi2=s_MovingSegmentSlope*xi2+s_MovingSegment_Yorg - * or yi1=s_EndSegmentSlope*xi2+s_MovingSegment_Yorg - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !!!!! special attention to vertical segments because - * !!!!! their slope=infinite - * !!!!! intersection point will be calculated using the - * !!!!! segment intersecting it - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * Slope parameters are computed once, because they can become undetermined - * when moving segments - * (i.e. when a segment length is 0) and we want keep them constant - */ -static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC* aDC, - const wxPoint& aPosition, bool aErase ) -{ - double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated intersection points - double tx1, tx2, ty1, ty2; // temporary storage of points - int dx, dy; - bool update = true; - TRACK* Track; - TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL; - - if( g_DragSegmentList.size() == 0 ) - return; - - /* get the segments : - * from last to first in list are: - * the segment to move - * the segment connected to its end point (if exists) - * the segment connected to its start point (if exists) - */ - int ii = g_DragSegmentList.size() - 1; - Track = g_DragSegmentList[ii].m_Track; - - if( Track == NULL ) - return; - - ii--; - - if( ii >= 0) - { - if( s_EndSegmentPresent ) - { - // Get the segment connected to the end point - tSegmentToEnd = g_DragSegmentList[ii].m_Track; - ii--; - } - - if( s_StartSegmentPresent ) - { - // Get the segment connected to the start point - if( ii >= 0 ) - tSegmentToStart = g_DragSegmentList[ii].m_Track; - } - } - - GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT; - - // Undraw the current moved track segments before modification - -#ifndef USE_WX_OVERLAY -// if( erase ) - { - Track->Draw( aPanel, aDC, draw_mode ); - - if( tSegmentToStart ) - tSegmentToStart->Draw( aPanel, aDC, draw_mode ); - - if( tSegmentToEnd ) - tSegmentToEnd->Draw( aPanel, aDC, draw_mode ); - } -#endif - - // Compute the new track segment position - wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition(); - - dx = Pos.x - s_LastPos.x; - dy = Pos.y - s_LastPos.y; - - // move the line by dx and dy - tx1 = (double) ( Track->GetStart().x + dx ); - ty1 = (double) ( Track->GetStart().y + dy ); - tx2 = (double) ( Track->GetEnd().x + dx ); - ty2 = (double) ( Track->GetEnd().y + dy ); - - // recalculate the segments new parameters and intersection points - // only the intercept will change, segment slopes does not change - // because we are moving parallel with is initial state - if( !s_MovingSegmentVertical ) - s_MovingSegment_Yorg = ty1 - ( s_MovingSegmentSlope * tx1 ); - - if( ( !s_EndPointVertical ) && ( !s_MovingSegmentVertical ) ) - { - xi2 = ( s_MovingSegment_Yorg - s_EndSegment_Yorg ) - / ( s_EndSegmentSlope - s_MovingSegmentSlope ); - } - else - { - if( !s_EndPointVertical ) - xi2 = tx2; - else - { - //P1=P2 - if( !s_EndPointHorizontal ) - xi2 = tx2 - dx; - else - update = false; - } - } - - if( !s_MovingSegmentVertical ) - yi2 = ( s_MovingSegmentSlope * xi2 ) + s_MovingSegment_Yorg; - else - { - if( !s_EndPointVertical ) - yi2 = ( s_EndSegmentSlope * xi2 ) + s_EndSegment_Yorg; - else - { - if( !s_EndPointHorizontal ) - update = false; - else - yi2 = ( s_MovingSegmentSlope * xi2 ) + s_MovingSegment_Yorg; - } - } - - if( ( !s_StartPointVertical ) && ( !s_MovingSegmentVertical ) ) - { - xi1 = ( s_MovingSegment_Yorg - s_StartSegment_Yorg ) - / ( s_StartSegmentSlope - s_MovingSegmentSlope ); - } - else - { - if( !s_StartPointVertical ) - xi1 = tx1; - else - { - //P1=P2 - if( !s_StartPointHorizontal ) - xi1 = tx1 - dx; - else - { - if( !s_StartPointHorizontal ) - update = false; - } - } - } - - if( !s_MovingSegmentVertical ) - yi1 = ( s_MovingSegmentSlope * xi1 ) + s_MovingSegment_Yorg; - else - { - if( !s_StartPointVertical ) - yi1 = ( s_StartSegmentSlope * xi1 ) + s_StartSegment_Yorg; - else - { - if( !s_StartPointHorizontal ) - update = false; - else - yi2 = ( s_MovingSegmentSlope * xi1 ) + s_MovingSegment_Yorg; - } - } - - // update the segment coordinates (if possible) - if( tSegmentToStart == NULL ) - { - xi1 = tx1; - yi1 = ty1; - } - - if( tSegmentToEnd == NULL ) - { - xi2 = tx2; - yi2 = ty2; - } - - if( update ) - { - s_LastPos = Pos; - Track->SetStart( wxPoint( KiROUND( xi1 ), KiROUND( yi1 ) ) ); - Track->SetEnd( wxPoint( KiROUND( xi2 ), KiROUND( yi2 ) ) ); - - if( tSegmentToEnd ) - { - if( tSegmentToEnd->GetFlags() & STARTPOINT ) - tSegmentToEnd->SetStart( Track->GetEnd() ); - else - tSegmentToEnd->SetEnd( Track->GetEnd() ); - } - - if( tSegmentToStart ) - { - if( tSegmentToStart->GetFlags() & STARTPOINT ) - tSegmentToStart->SetStart( Track->GetStart() ); - else - tSegmentToStart->SetEnd( Track->GetStart() ); - } - } - - Track->Draw( aPanel, aDC, draw_mode ); - - if( tSegmentToStart ) - tSegmentToStart->Draw( aPanel, aDC, draw_mode ); - - if( tSegmentToEnd ) - tSegmentToEnd->Draw( aPanel, aDC, draw_mode ); - - // Display track length - PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); - frame->SetMsgPanel( Track ); -} - - -/* Init variables (slope, Y intersect point, flags) for - * Show_Drag_Track_Segment_With_Cte_Slope() - * return true if Ok, false if dragging is not possible - * (2 colinear segments) - */ -bool InitialiseDragParameters() -{ - double tx1, tx2, ty1, ty2; // temporary storage of points - TRACK* Track; - TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL; - - if( g_DragSegmentList.size() == 0 ) - return false; - - /* get the segments : - * from last to first in list are: - * the segment to move - * the segment connected to its end point (if exists) - * the segment connected to its start point (if exists) - */ - int ii = g_DragSegmentList.size() - 1; - Track = g_DragSegmentList[ii].m_Track; - if( Track == NULL ) - return false; - - ii--; - - if( ii >= 0) - { - if( s_EndSegmentPresent ) - { - tSegmentToEnd = g_DragSegmentList[ii].m_Track; // Get the segment connected to - // the end point - ii--; - } - - if( s_StartSegmentPresent ) - { - if( ii >= 0 ) - tSegmentToStart = g_DragSegmentList[ii].m_Track; // Get the segment connected to - // the start point - } - } - - // would be nice to eliminate collinear segments here, so we don't - // have to deal with that annoying "Unable to drag this segment: two - // collinear segments" - - s_StartPointVertical = false; - s_EndPointVertical = false; - s_MovingSegmentVertical = false; - s_StartPointHorizontal = false; - s_EndPointHorizontal = false; - s_MovingSegmentHorizontal = false; - - // Init parameters for the starting point of the moved segment - if( tSegmentToStart ) - { - if( tSegmentToStart->GetFlags() & ENDPOINT ) - { - tx1 = (double) tSegmentToStart->GetStart().x; - ty1 = (double) tSegmentToStart->GetStart().y; - tx2 = (double) tSegmentToStart->GetEnd().x; - ty2 = (double) tSegmentToStart->GetEnd().y; - } - else - { - tx1 = (double) tSegmentToStart->GetEnd().x; - ty1 = (double) tSegmentToStart->GetEnd().y; - tx2 = (double) tSegmentToStart->GetStart().x; - ty2 = (double) tSegmentToStart->GetStart().y; - } - } - else // move the start point on a line starting at Track->GetStart(), and perpendicular to Track - { - tx1 = (double) Track->GetStart().x; - ty1 = (double) Track->GetStart().y; - tx2 = (double) Track->GetEnd().x; - ty2 = (double) Track->GetEnd().y; - RotatePoint( &tx2, &ty2, tx1, ty1, 900 ); - } - - if( tx1 != tx2 ) - { - s_StartSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 ); - s_StartSegment_Yorg = ty1 - ( ty2 - ty1 ) * tx1 / ( tx2 - tx1 ); - } - else - { - s_StartPointVertical = true; //signal first segment vertical - } - - if( ty1 == ty2 ) - { - s_StartPointHorizontal = true; - } - - // Init parameters for the ending point of the moved segment - if( tSegmentToEnd ) - { - //check if second line is vertical - if( tSegmentToEnd->GetFlags() & STARTPOINT ) - { - tx1 = (double) tSegmentToEnd->GetStart().x; - ty1 = (double) tSegmentToEnd->GetStart().y; - tx2 = (double) tSegmentToEnd->GetEnd().x; - ty2 = (double) tSegmentToEnd->GetEnd().y; - } - else - { - tx1 = (double) tSegmentToEnd->GetEnd().x; - ty1 = (double) tSegmentToEnd->GetEnd().y; - tx2 = (double) tSegmentToEnd->GetStart().x; - ty2 = (double) tSegmentToEnd->GetStart().y; - } - } - else // move the start point on a line starting at Track->GetEnd(), and perpendicular to Track - { - tx1 = (double) Track->GetEnd().x; - ty1 = (double) Track->GetEnd().y; - tx2 = (double) Track->GetStart().x; - ty2 = (double) Track->GetStart().y; - RotatePoint( &tx2, &ty2, tx1, ty1, -900 ); - } - - if( tx2 != tx1 ) - { - s_EndSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 ); - s_EndSegment_Yorg = ty1 - ( ty2 - ty1 ) * tx1 / ( tx2 - tx1 ); - } - else - { - s_EndPointVertical = true; //signal second segment vertical - } - - if( ty1 == ty2 ) - { - s_EndPointHorizontal = true; - } - - // Init parameters for the moved segment - tx1 = (double) Track->GetStart().x; - ty1 = (double) Track->GetStart().y; - tx2 = (double) Track->GetEnd().x; - ty2 = (double) Track->GetEnd().y; - - if( tx2 != tx1 ) - { - s_MovingSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 ); - } - else - { - s_MovingSegmentVertical = true; // signal vertical line - } - - if( ty1 == ty2 ) - { - s_MovingSegmentHorizontal = true; - } - - // Test if drag is possible: - if( s_MovingSegmentVertical ) - { - if( s_EndPointVertical || s_StartPointVertical ) - return false; - } - else - { - if( !s_EndPointVertical && ( s_MovingSegmentSlope == s_EndSegmentSlope ) ) - return false; - - if( !s_StartPointVertical && ( s_MovingSegmentSlope == s_StartSegmentSlope ) ) - return false; - } - - return true; -} - - -void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand ) -{ - if( !aTrack ) - return; - - EraseDragList(); - - // Change highlighted net: the new one will be highlighted - GetBoard()->PushHighLight(); - - if( GetBoard()->IsHighLightNetON() ) - HighLight( aDC ); - - PosInit = GetCrossHairPosition(); - - if( aTrack->Type() == PCB_VIA_T ) - { - aTrack->SetFlags( IS_DRAGGED | STARTPOINT | ENDPOINT ); - AddSegmentToDragList( aTrack->GetFlags(), aTrack ); - - if( aCommand != ID_POPUP_PCB_MOVE_TRACK_SEGMENT ) - { - Collect_TrackSegmentsToDrag( GetBoard(), aTrack->GetStart(), - aTrack->GetLayerSet(), - aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); - } - - PosInit = aTrack->GetStart(); - } - else - { - STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetCrossHairPosition(), -1 ); - wxPoint pos; - - switch( aCommand ) - { - case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: // Move segment - aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT ); - AddSegmentToDragList( aTrack->GetFlags(), aTrack ); - break; - - case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: // drag a segment - pos = aTrack->GetStart(); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerSet(), - aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); - pos = aTrack->GetEnd(); - aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT ); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerSet(), - aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); - break; - - case ID_POPUP_PCB_MOVE_TRACK_NODE: // Drag via or move node - pos = (diag & STARTPOINT) ? aTrack->GetStart() : aTrack->GetEnd(); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerSet(), - aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); - PosInit = pos; - break; - } - - aTrack->SetFlags( IS_DRAGGED ); - } - - // Prepare the Undo command - ITEM_PICKER picker( aTrack, UR_CHANGED ); - picker.SetLink( aTrack->Clone() ); - s_ItemsListPicker.PushItem( picker ); - - for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) - { - TRACK* draggedtrack = g_DragSegmentList[ii].m_Track; - picker.SetItem( draggedtrack ); - picker.SetLink( draggedtrack->Clone() ); - s_ItemsListPicker.PushItem( picker ); - draggedtrack = (TRACK*) picker.GetLink(); - draggedtrack->SetStatus( 0 ); - draggedtrack->ClearFlags(); - } - - s_LastPos = PosInit; - m_canvas->SetMouseCapture( Show_MoveNode, Abort_MoveTrack ); - - GetBoard()->SetHighLightNet( aTrack->GetNetCode() ); - GetBoard()->HighLightON(); - - GetBoard()->DrawHighLight( m_canvas, aDC, GetBoard()->GetHighLightNetCode() ); - m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true ); - - UndrawAndMarkSegmentsToDrag( m_canvas, aDC ); -} - - -void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ) -{ - TRACK* TrackToStartPoint = NULL; - TRACK* TrackToEndPoint = NULL; - bool error = false; - - if( !track ) - return; - - // TODO: Use cleanup functions to merge collinear segments if track - // is connected to a collinear segment. - - s_StartSegmentPresent = s_EndSegmentPresent = true; - - if( ( track->start == NULL ) || ( track->start->Type() == PCB_TRACE_T ) ) - TrackToStartPoint = track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_START, true, false ); - - // Test if more than one segment is connected to this point - if( TrackToStartPoint ) - { - TrackToStartPoint->SetState( BUSY, true ); - - if( ( TrackToStartPoint->Type() == PCB_VIA_T ) - || track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_START, true, false ) ) - error = true; - - TrackToStartPoint->SetState( BUSY, false ); - } - - if( ( track->end == NULL ) || ( track->end->Type() == PCB_TRACE_T ) ) - TrackToEndPoint = track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_END, true, false ); - - // Test if more than one segment is connected to this point - if( TrackToEndPoint ) - { - TrackToEndPoint->SetState( BUSY, true ); - - if( (TrackToEndPoint->Type() == PCB_VIA_T) - || track->GetTrack( GetBoard()->m_Track, NULL, ENDPOINT_END, true, false ) ) - error = true; - - TrackToEndPoint->SetState( BUSY, false ); - } - - if( error ) - { - DisplayError( this, - _( "Unable to drag this segment: too many segments connected" ) ); - return; - } - - if( !TrackToStartPoint || ( TrackToStartPoint->Type() != PCB_TRACE_T ) ) - s_StartSegmentPresent = false; - - if( !TrackToEndPoint || ( TrackToEndPoint->Type() != PCB_TRACE_T ) ) - s_EndSegmentPresent = false; - - // Change high light net: the new one will be highlighted - GetBoard()->PushHighLight(); - - if( GetBoard()->IsHighLightNetON() ) - HighLight( DC ); - - EraseDragList(); - - track->SetFlags( IS_DRAGGED ); - - if( TrackToStartPoint ) - { - STATUS_FLAGS flag = STARTPOINT; - - if( track->GetStart() != TrackToStartPoint->GetStart() ) - flag = ENDPOINT; - - AddSegmentToDragList( flag, TrackToStartPoint ); - track->SetFlags( STARTPOINT ); - } - - if( TrackToEndPoint ) - { - STATUS_FLAGS flag = STARTPOINT; - - if( track->GetEnd() != TrackToEndPoint->GetStart() ) - flag = ENDPOINT; - - AddSegmentToDragList( flag, TrackToEndPoint ); - track->SetFlags( ENDPOINT ); - } - - AddSegmentToDragList( track->GetFlags(), track ); - - UndrawAndMarkSegmentsToDrag( m_canvas, DC ); - - - PosInit = GetCrossHairPosition(); - s_LastPos = GetCrossHairPosition(); - m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack ); - - GetBoard()->SetHighLightNet( track->GetNetCode() ); - GetBoard()->HighLightON(); - GetBoard()->DrawHighLight( m_canvas, DC, GetBoard()->GetHighLightNetCode() ); - - // Prepare the Undo command - ITEM_PICKER picker( NULL, UR_CHANGED ); - - for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) - { - TRACK* draggedtrack = g_DragSegmentList[ii].m_Track; - picker.SetItem( draggedtrack); - picker.SetLink ( draggedtrack->Clone() ); - s_ItemsListPicker.PushItem( picker ); - draggedtrack = (TRACK*) picker.GetLink(); - draggedtrack->SetStatus( 0 ); - draggedtrack->ClearFlags(); - } - - if( !InitialiseDragParameters() ) - { - DisplayError( this, _( "Unable to drag this segment: two collinear segments" ) ); - m_canvas->SetMouseCaptureCallback( NULL ); - Abort_MoveTrack( m_canvas, DC ); - return; - } -} - - // Place a dragged (or moved) track segment or via bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) { diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 191dfdd79a..dfc2cb7012 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -115,35 +115,24 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, wxPoint areaPosition = GetCrossHairPosition(); EDA_RECT bbox = board->GetBoundingBox(); - if( !IsGalCanvasActive() ) - { - // In legacy mode place area to the left side of the board. - // if the board is empty, the bbox position is (0,0) - areaPosition.x = bbox.GetEnd().x + Millimeter2iu( 10 ); - areaPosition.y = bbox.GetOrigin().y; - } - toolManager->RunAction( PCB_ACTIONS::selectionClear, true ); SpreadFootprints( &newFootprints, false, false, areaPosition, false ); - if( IsGalCanvasActive() ) + // Start drag command for new modules + if( !newFootprints.empty() ) { - // Start drag command for new modules - if( !newFootprints.empty() ) - { - for( MODULE* footprint : newFootprints ) - toolManager->RunAction( PCB_ACTIONS::selectItem, true, footprint ); + for( MODULE* footprint : newFootprints ) + toolManager->RunAction( PCB_ACTIONS::selectItem, true, footprint ); - *aRunDragCommand = true; + *aRunDragCommand = true; - // Now fix a reference point to move the footprints. - // We use the first footprint in list as reference point - // The graphic cursor will be on this fp when moving the footprints. - SELECTION_TOOL* selTool = toolManager->GetTool(); - SELECTION& selection = selTool->GetSelection(); - selection.SetReferencePoint( newFootprints[0]->GetPosition() ); - } + // Now fix a reference point to move the footprints. + // We use the first footprint in list as reference point + // The graphic cursor will be on this fp when moving the footprints. + SELECTION_TOOL* selTool = toolManager->GetTool(); + SELECTION& selection = selTool->GetSelection(); + selection.SetReferencePoint( newFootprints[0]->GetPosition() ); } GetCanvas()->Refresh(); diff --git a/pcbnew/pad_edit_functions.cpp b/pcbnew/pad_edit_functions.cpp index 3815e0e106..f88c847c65 100644 --- a/pcbnew/pad_edit_functions.cpp +++ b/pcbnew/pad_edit_functions.cpp @@ -185,154 +185,3 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery ) OnModify(); } - - -/* - * PCB_EDIT_FRAME::Function PushPadProperties - * Function to change pad caracteristics for the given footprint or all identical footprints - * Options are set by the opened dialog. - */ -void PCB_EDIT_FRAME::PushPadProperties( D_PAD* aPad ) -{ - if( !aPad ) - return; - - MODULE* module = aPad->GetParent(); - - if( !module ) - return; - - SetMsgPanel( module ); - - DIALOG_PUSH_PAD_PROPERTIES dlg( this ); - int retCode = dlg.ShowModal(); - - if( retCode == wxID_CANCEL ) - return; - - bool edit_Same_Modules = ( retCode == 1 ); - - DoPushPadProperties( aPad, edit_Same_Modules, - DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter, - DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter, - DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter, - true ); -} - -/* - * FOOTPRINT_EDIT_FRAME::Function PushPadProperties - * Function to change pad caracteristics for the footprint. - * Options are set by the opened dialog. - */ -void FOOTPRINT_EDIT_FRAME::PushPadProperties( D_PAD* aPad ) -{ - if( !aPad ) - return; - - MODULE* module = aPad->GetParent(); - - if( !module ) - return; - - SetMsgPanel( module ); - - DIALOG_PUSH_PAD_PROPERTIES dlg( this ); - int retCode = dlg.ShowModal(); - - if( retCode == wxID_CANCEL ) - return; - - bool edit_Same_Modules = ( retCode == 1 ); - - DoPushPadProperties( aPad, edit_Same_Modules, - DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter, - DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter, - DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter, - false ); -} - -/* - * Function DoPushPadProperties - * Function to change pad properties for the given footprint or all identical footprints - * aPad is the pattern. The given footprint is the parent of this pad - * aSameFootprints: if true, make changes on all identical footprints - * aPadShapeFilter: if true, make changes only on pads having the same shape as aPad - * aPadOrientFilter: if true, make changes only on pads having the same orientation as aPad - * aPadLayerFilter: if true, make changes only on pads having the same layers as aPad - * aSaveForUndo: if true: create an entry in the Undo/Redo list - * (usually: true in Schematic editor, false in Module editor) - */ -void PCB_BASE_FRAME::DoPushPadProperties( D_PAD* aPad, bool aSameFootprints, - bool aPadShapeFilter, - bool aPadOrientFilter, - bool aPadLayerFilter, - bool aSaveForUndo ) -{ - MODULE* Module_Ref = aPad->GetParent(); - double pad_orient = aPad->GetOrientation() - Module_Ref->GetOrientation(); - - // Prepare an undo list: - if( aSaveForUndo ) - { - PICKED_ITEMS_LIST itemsList; - - if( aSameFootprints ) - { - for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() ) - { - if( module->GetFPID() == Module_Ref->GetFPID() ) - { - ITEM_PICKER itemWrapper( module, UR_CHANGED ); - itemsList.PushItem( itemWrapper ); - } - } - } - else - { - ITEM_PICKER itemWrapper( Module_Ref, UR_CHANGED ); - itemsList.PushItem( itemWrapper ); - } - - SaveCopyInUndoList( itemsList, UR_CHANGED ); - } - - // Update the current module and same others modules if requested. - for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() ) - { - if( !aSameFootprints && (module != Module_Ref) ) - continue; - - if( module->GetFPID() != Module_Ref->GetFPID() ) - continue; - - // Erase module on screen - module->SetFlags( DO_NOT_DRAW ); - m_canvas->RefreshDrawingRect( module->GetBoundingBox() ); - module->ClearFlags( DO_NOT_DRAW ); - - for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() ) - { - if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) ) - continue; - - double currpad_orient = pad->GetOrientation() - module->GetOrientation(); - - if( aPadOrientFilter && ( currpad_orient != pad_orient ) ) - continue; - - if( aPadLayerFilter && ( pad->GetLayerSet() != aPad->GetLayerSet() ) ) - continue; - - // Do not copy pad to itself, it can create issues with custom pad primitives. - if( pad == aPad ) - continue; - - pad->ImportSettingsFromMaster( *aPad ); - } - - module->CalculateBoundingBox(); - m_canvas->RefreshDrawingRect( module->GetBoundingBox() ); - } - - OnModify(); -} diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 3449ac5990..cb88967cab 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -89,7 +89,6 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid ) EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom ) // Switching canvases - EVT_UPDATE_UI( ID_MENU_CANVAS_LEGACY, PCB_BASE_FRAME::OnUpdateSwitchCanvas ) EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, PCB_BASE_FRAME::OnUpdateSwitchCanvas ) EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, PCB_BASE_FRAME::OnUpdateSwitchCanvas ) @@ -225,10 +224,7 @@ void PCB_BASE_FRAME::AddModuleToBoard( MODULE* module ) module->SetFlags( IS_NEW ); - if( IsGalCanvasActive() ) - module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment - else - module->SetPosition( GetCrossHairPosition() ); + module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment module->SetTimeStamp( GetNewTimeStamp() ); GetBoard()->m_Status_Pcb = 0; @@ -601,10 +597,6 @@ void PCB_BASE_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent ) { switch( aEvent.GetId() ) { - case ID_MENU_CANVAS_LEGACY: - SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ); - break; - case ID_MENU_CANVAS_CAIRO: SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); break; @@ -624,7 +616,7 @@ void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent ) int current = 0; // display Auto if no match found // check for a match within 1% - double zoom = IsGalCanvasActive() ? GetGalCanvas()->GetLegacyZoom() : GetScreen()->GetZoom(); + double zoom = GetGalCanvas()->GetLegacyZoom(); for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); i++ ) { @@ -676,16 +668,9 @@ void PCB_BASE_FRAME::UpdateMsgPanel() MSG_PANEL_ITEMS items; if( item ) - { item->GetMsgPanelInfo( m_UserUnits, items ); - } else // show general information about the board - { - if( IsGalCanvasActive() ) - GetGalCanvas()->GetMsgPanelInfo( m_UserUnits, items ); - else - m_Pcb->GetMsgPanelInfo( m_UserUnits, items ); - } + GetGalCanvas()->GetMsgPanelInfo( m_UserUnits, items ); SetMsgPanel( items ); } @@ -929,11 +914,8 @@ void PCB_BASE_FRAME::OnModify() GetScreen()->SetModify(); GetScreen()->SetSave(); - if( IsGalCanvasActive() ) - { - UpdateStatusBar(); - UpdateMsgPanel(); - } + UpdateStatusBar(); + UpdateMsgPanel(); } @@ -1060,12 +1042,10 @@ void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent ) EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas(); EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; - if( IsGalCanvasActive() && gal_canvas ) - canvasType = gal_canvas->GetBackend(); + canvasType = gal_canvas->GetBackend(); struct { int menuId; int galType; } menuList[] = { - { ID_MENU_CANVAS_LEGACY, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE }, { ID_MENU_CANVAS_OPENGL, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL }, { ID_MENU_CANVAS_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO }, }; diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 4a1a3f8425..cfa0c31e60 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -183,7 +183,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, PCB_EDIT_FRAME::Show3D_Frame ) // Switching canvases - EVT_MENU( ID_MENU_CANVAS_LEGACY, PCB_EDIT_FRAME::OnSwitchCanvas ) EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_EDIT_FRAME::OnSwitchCanvas ) EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_EDIT_FRAME::OnSwitchCanvas ) @@ -240,7 +239,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) // popup menus - EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, PCB_EDIT_FRAME::Process_Special_Functions ) @@ -365,7 +363,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_canvasType = LoadCanvasTypeSetting(); - // Nudge user to switch to OpenGL if they are on legacy or Cairo + // Nudge user to switch to OpenGL if they are on Cairo if( m_firstRunDialogSetting < 1 ) { if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) @@ -374,11 +372,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : "and faster experience. This option is turned off by " "default since it is not compatible with all computers.\n\n" "Would you like to try enabling graphics acceleration?\n\n" - "If you'd like to choose later, select Modern Toolset " - "(Accelerated) in the Preferences menu." ); + "If you'd like to choose later, select Accelerated Graphics " + "in the Preferences menu." ); - wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), - wxYES_NO ); + wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO ); dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) ); @@ -400,8 +397,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : } else { - // If they were on legacy, or they've been coerced into GAL - // due to unavailable legacy (GTK3), switch to Cairo + // If they were on legacy, switch to Cairo wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO ); GetEventHandler()->ProcessEvent( evt ); } @@ -411,13 +407,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SaveSettings( config() ); } - if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) - { - if( GetGalCanvas()->SwitchBackend( m_canvasType ) ) - UseGalCanvas( true ); - } - - enableGALSpecificMenus(); + GetGalCanvas()->SwitchBackend( m_canvasType ); + UseGalCanvas( true ); // disable Export STEP item if kicad2step does not exist wxString strK2S = Pgm().GetExecutablePath(); @@ -453,13 +444,10 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) { PCB_BASE_EDIT_FRAME::SetBoard( aBoard ); - if( IsGalCanvasActive() ) - { - aBoard->GetConnectivity()->Build( aBoard ); + aBoard->GetConnectivity()->Build( aBoard ); - // reload the worksheet - SetPageSettings( aBoard->GetPageSettings() ); - } + // reload the worksheet + SetPageSettings( aBoard->GetPageSettings() ); } @@ -473,30 +461,27 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) { PCB_BASE_FRAME::SetPageSettings( aPageSettings ); - if( IsGalCanvasActive() ) + PCB_DRAW_PANEL_GAL* drawPanel = static_cast( GetGalCanvas() ); + + // Prepare worksheet template + KIGFX::WS_PROXY_VIEW_ITEM* worksheet; + worksheet = new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS ,&m_Pcb->GetPageSettings(), + &m_Pcb->GetTitleBlock() ); + worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) ); + + BASE_SCREEN* screen = GetScreen(); + + if( screen != NULL ) { - PCB_DRAW_PANEL_GAL* drawPanel = static_cast( GetGalCanvas() ); - - // Prepare worksheet template - KIGFX::WS_PROXY_VIEW_ITEM* worksheet; - worksheet = new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS ,&m_Pcb->GetPageSettings(), - &m_Pcb->GetTitleBlock() ); - worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) ); - - BASE_SCREEN* screen = GetScreen(); - - if( screen != NULL ) - { - worksheet->SetSheetNumber( screen->m_ScreenNumber ); - worksheet->SetSheetCount( screen->m_NumberOfScreens ); - } - - if( auto board = GetBoard() ) - worksheet->SetFileName( TO_UTF8( board->GetFileName() ) ); - - // PCB_DRAW_PANEL_GAL takes ownership of the worksheet - drawPanel->SetWorksheet( worksheet ); + worksheet->SetSheetNumber( screen->m_ScreenNumber ); + worksheet->SetSheetCount( screen->m_NumberOfScreens ); } + + if( auto board = GetBoard() ) + worksheet->SetFileName( TO_UTF8( board->GetFileName() ) ); + + // PCB_DRAW_PANEL_GAL takes ownership of the worksheet + drawPanel->SetWorksheet( worksheet ); } @@ -584,16 +569,13 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) } } - if( IsGalCanvasActive() ) - { - // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes - // when closing this frame if a footprint was selected, and the footprint editor called - // to edit this footprint, and when closing pcbnew if this footprint is still selected - // See https://bugs.launchpad.net/kicad/+bug/1655858 - // I think this is certainly a OpenGL event fired after frame deletion, so this workaround - // avoid the crash (JPC) - GetGalCanvas()->SetEvtHandlerEnabled( false ); - } + // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes + // when closing this frame if a footprint was selected, and the footprint editor called + // to edit this footprint, and when closing pcbnew if this footprint is still selected + // See https://bugs.launchpad.net/kicad/+bug/1655858 + // I think this is certainly a OpenGL event fired after frame deletion, so this workaround + // avoid the crash (JPC) + GetGalCanvas()->SetEvtHandlerEnabled( false ); GetGalCanvas()->StopDrawing(); @@ -645,67 +627,20 @@ void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event ) void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) { - if( !aEnable ) - Compile_Ratsnest( NULL, true ); - PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable ); COLORS_DESIGN_SETTINGS& cds = Settings().Colors(); - if( aEnable ) - { - cds.SetLegacyMode( false ); - GetGalCanvas()->GetGAL()->SetGridColor( cds.GetLayerColor( LAYER_GRID ) ); - auto view = GetGalCanvas()->GetView(); - view->GetPainter()->GetSettings()->ImportLegacyColors( &cds ); - GetGalCanvas()->Refresh(); - } - - enableGALSpecificMenus(); - - // Force colors to be legacy-compatible in case they were changed in GAL - if( !aEnable ) - { - cds.SetLegacyMode( true ); - Refresh(); - } + cds.SetLegacyMode( false ); + GetGalCanvas()->GetGAL()->SetGridColor( cds.GetLayerColor( LAYER_GRID ) ); + auto view = GetGalCanvas()->GetView(); + view->GetPainter()->GetSettings()->ImportLegacyColors( &cds ); + GetGalCanvas()->Refresh(); // Re-create the layer manager to allow arbitrary colors when GAL is enabled UpdateUserInterface(); } -void PCB_EDIT_FRAME::enableGALSpecificMenus() -{ - // some menus are active only in GAL mode and do nothing in legacy mode. - // So enable or disable them, depending on the display mode - - ReCreateMenuBar(); - - if( GetMenuBar() ) - { - // Enable / disable some menus which are usable only on GAL - pcbnew_ids id_list[] = - { - ID_MENU_INTERACTIVE_ROUTER_SETTINGS, - ID_DIFF_PAIR_BUTT, - ID_TUNE_SINGLE_TRACK_LEN_BUTT, - ID_TUNE_DIFF_PAIR_LEN_BUTT, - ID_TUNE_DIFF_PAIR_SKEW_BUTT, - ID_MENU_DIFF_PAIR_DIMENSIONS, - ID_MENU_PCB_FLIP_VIEW - }; - - bool enable = IsGalCanvasActive(); - - for( auto& id : id_list ) - { - if( GetMenuBar()->FindItem( id ) ) - GetMenuBar()->FindItem( id )->Enable( enable ); - } - } -} - - void PCB_EDIT_FRAME::ShowBoardSetupDialog( wxCommandEvent& event ) { DoShowBoardSetupDialog(); @@ -727,13 +662,10 @@ void PCB_EDIT_FRAME::DoShowBoardSetupDialog( const wxString& aInitialPage, UpdateUserInterface(); ReCreateAuxiliaryToolbar(); - if( IsGalCanvasActive() ) - { - for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) - GetGalCanvas()->GetView()->Update( module ); + for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) + GetGalCanvas()->GetView()->Update( module ); - GetGalCanvas()->Refresh(); - } + GetGalCanvas()->Refresh(); //this event causes the routing tool to reload its design rules information TOOL_EVENT toolEvent( TC_COMMAND, TA_MODEL_CHANGE, AS_ACTIVE ); @@ -804,10 +736,7 @@ void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor ) Settings().Colors().SetItemColor( LAYER_GRID, aColor ); - if( IsGalCanvasActive() ) - { - GetGalCanvas()->GetGAL()->SetGridColor( aColor ); - } + GetGalCanvas()->GetGAL()->SetGridColor( aColor ); } @@ -838,14 +767,11 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer ) syncLayerWidgetLayer(); - if( IsGalCanvasActive() ) - { - m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools - GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere + m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools + GetGalCanvas()->SetFocus(); // allow capture of hotkeys - GetGalCanvas()->SetHighContrastLayer( aLayer ); - GetGalCanvas()->Refresh(); - } + GetGalCanvas()->SetHighContrastLayer( aLayer ); + GetGalCanvas()->Refresh(); } @@ -1072,7 +998,7 @@ void PCB_EDIT_FRAME::OnLayerColorChange( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent ) { - // switches currently used canvas (default / Cairo / OpenGL). + // switches currently used canvas (Cairo / OpenGL). PCB_BASE_FRAME::OnSwitchCanvas( aEvent ); // The base class method *does not reinit* the layers manager. @@ -1321,13 +1247,7 @@ void PCB_EDIT_FRAME::InstallFootprintPropertiesDialog( 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_FOOTPRINT_BOARD_EDITOR* dlg = new DIALOG_FOOTPRINT_BOARD_EDITOR( this, Module, DC ); + DIALOG_FOOTPRINT_BOARD_EDITOR* dlg = new DIALOG_FOOTPRINT_BOARD_EDITOR( this, Module ); int retvalue = dlg->ShowModal(); /* retvalue = @@ -1342,10 +1262,8 @@ void PCB_EDIT_FRAME::InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_OK ) { -#ifdef __WXMAC__ // If something edited, push a refresh request m_canvas->Refresh(); -#endif } else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_BOARD_FOOTPRINT ) { diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index ccaf305060..3bc8974975 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -100,29 +100,13 @@ protected: // The Tool Framework initalization void setupTools(); - // we'll use lower case function names for private member functions. - void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu ); - void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu ); - void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu ); - void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu ); - void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu ); - void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ); - void createPopUpBlockMenu( wxMenu* menu ); - void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu ); - wxString createBackupFile( const wxString& aFileName ); - /** - * an helper function to enable some menus only active when the display - * is switched to GAL mode and which do nothing in legacy mode - */ - void enableGALSpecificMenus(); - /** * switches currently used canvas (default / Cairo / OpenGL). * It also reinit the layers manager that slightly changes with canvases */ - virtual void OnSwitchCanvas( wxCommandEvent& aEvent ) override; + void OnSwitchCanvas( wxCommandEvent& aEvent ) override; #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU) /** @@ -874,9 +858,8 @@ public: * @return true if Ok. */ bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit, - bool aExport3DFiles, bool aUseRelativePaths, - bool aUsePlainPCB, const wxString & a3D_Subdir, - double aXRef, double aYRef ); + bool aExport3DFiles, bool aUseRelativePaths, bool aUsePlainPCB, + const wxString & a3D_Subdir, double aXRef, double aYRef ); /** * Function OnExportIDF3 @@ -997,15 +980,6 @@ public: */ void StartMoveModule( MODULE* aModule, wxDC* aDC, bool aDragConnectedTracks ); - /** - * Function PushPadProperties - * Function to change pad caracteristics for the given footprint - * or all footprints which look like the given footprint - * Options are set by the opened dialog. - * @param aPad is the pattern. The given footprint is the parent of this pad - */ - void PushPadProperties( D_PAD* aPad ); - /** * Function Delete Module * Remove a footprint from m_Modules linked list and put it in undelete buffer @@ -1159,26 +1133,8 @@ public: void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ); void Attribut_net( wxDC* DC, int net_code, bool Flag_On ); - /** - * Function StartMoveOneNodeOrSegment - * initializes the parameters to move one via or/and a terminal point of a track segment - * The terminal point of other connected segments (if any) are moved too. - */ - void StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand ); - bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ); - /** - * @todo This function is broken, because it merge segments having different - * widths or without any connectivity test. - * 2 collinear segments can be merged only if no other segment or via is - * connected to the common point and if they have the same width. See - * cleanup.cpp for merge functions and consider MarkTrace() to locate segments - * that can be merged - */ - bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); - - void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) override; /** @@ -1364,7 +1320,6 @@ public: // Target handling PCB_TARGET* CreateTarget( wxDC* DC ); void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC ); - void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC ); void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC ); void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC ); @@ -1372,7 +1327,6 @@ public: DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC ); void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Delete_Drawings_All_Layer( PCB_LAYER_ID aLayer ); // Dimension handling: void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC ); diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp index 58d07a3f3f..3da0c2c94e 100644 --- a/pcbnew/pcb_layer_widget.cpp +++ b/pcbnew/pcb_layer_widget.cpp @@ -133,12 +133,6 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn } -bool PCB_LAYER_WIDGET::AreArbitraryColorsAllowed() -{ - return myframe->IsGalCanvasActive(); -} - - COLOR4D PCB_LAYER_WIDGET::getBackgroundLayerColor() { return myframe->Settings().Colors().GetLayerColor( LAYER_PCB_BACKGROUND ); @@ -580,24 +574,12 @@ void PCB_LAYER_WIDGET::ReFill() void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor ) { - // Avoid setting the alpha channel, when we are in legacy mode, - // because in legacy mode the alpha channel is not used, but changing it - // destroys the GAL color setup - if( !myframe->IsGalCanvasActive() ) - { - COLOR4D oldColor = myframe->Settings().Colors().GetLayerColor( aLayer ); - aColor.a = oldColor.a; - } - myframe->Settings().Colors().SetLayerColor( aLayer, aColor ); - if( myframe->IsGalCanvasActive() ) - { - KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView(); - view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() ); - view->UpdateLayerColor( aLayer ); - view->UpdateLayerColor( GetNetnameLayer( aLayer ) ); - } + KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView(); + view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() ); + view->UpdateLayerColor( aLayer ); + view->UpdateLayerColor( GetNetnameLayer( aLayer ) ); myframe->ReCreateHToolbar(); @@ -685,22 +667,19 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor ) EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); - if( galCanvas && myframe->IsGalCanvasActive() ) - { - if( aId == LAYER_GRID ) - galCanvas->GetGAL()->SetGridColor( aColor ); + if( aId == LAYER_GRID ) + galCanvas->GetGAL()->SetGridColor( aColor ); - KIGFX::VIEW* view = galCanvas->GetView(); - view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() ); - view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest - view->UpdateLayerColor( aId ); + KIGFX::VIEW* view = galCanvas->GetView(); + view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() ); + view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest + view->UpdateLayerColor( aId ); - // plated-through-holes don't have their own color; they use the background color - if( aId == LAYER_PCB_BACKGROUND ) - view->UpdateLayerColor( LAYER_PADS_PLATEDHOLES ); + // plated-through-holes don't have their own color; they use the background color + if( aId == LAYER_PCB_BACKGROUND ) + view->UpdateLayerColor( LAYER_PADS_PLATEDHOLES ); - galCanvas->ForceRefresh(); - } + galCanvas->ForceRefresh(); myframe->ReCreateHToolbar(); @@ -725,25 +704,21 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); - if( galCanvas && myframe->IsGalCanvasActive() ) + if( aId == LAYER_GRID ) { - if( aId == LAYER_GRID ) - { - galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() ); - galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); - } - else if( aId == LAYER_RATSNEST ) - { - // don't touch the layers. ratsnest is enabled on per-item basis. - galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); - galCanvas->GetView()->SetLayerVisible( aId, true ); - } - else - galCanvas->GetView()->SetLayerVisible( aId, isEnabled ); - - galCanvas->Refresh(); + galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() ); + galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); } + else if( aId == LAYER_RATSNEST ) + { + // don't touch the layers. ratsnest is enabled on per-item basis. + galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); + galCanvas->GetView()->SetLayerVisible( aId, true ); + } + else + galCanvas->GetView()->SetLayerVisible( aId, isEnabled ); + galCanvas->Refresh(); myframe->GetCanvas()->Refresh(); } diff --git a/pcbnew/pcb_layer_widget.h b/pcbnew/pcb_layer_widget.h index cde102723b..ab6b7c2350 100644 --- a/pcbnew/pcb_layer_widget.h +++ b/pcbnew/pcb_layer_widget.h @@ -137,8 +137,6 @@ protected: ID_LAST_VALUE }; - virtual bool AreArbitraryColorsAllowed() override; - virtual COLOR4D getBackgroundLayerColor() override; /** diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index adb7b83dd9..5d4fb2eb67 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -57,62 +57,17 @@ enum pcbnew_ids ID_MENU_PCB_FLIP_VIEW, ID_POPUP_PCB_START_RANGE, - ID_POPUP_PCB_EDIT_MODULE_PRMS, - ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT, - ID_POPUP_PCB_UPDATE_FOOTPRINTS, - ID_POPUP_PCB_EXCHANGE_FOOTPRINTS, - ID_POPUP_PCB_EDIT_PAD, - ID_POPUP_PCB_MOVE_PAD_REQUEST, - ID_POPUP_PCB_DRAG_PAD_REQUEST, - ID_POPUP_PCB_DUPLICATE_ITEM, - ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT, ID_POPUP_PCB_MOVE_EXACT, ID_POPUP_PCB_CREATE_ARRAY, - ID_POPUP_PCB_DELETE_DRAWING_LAYER, ID_POPUP_PCB_END_LINE, - ID_POPUP_PCB_BEGIN_TRACK, - ID_POPUP_PCB_EDIT_TRACK, - ID_POPUP_PCB_DELETE_TRACK, - ID_POPUP_PCB_DELETE_TRACKNET, - ID_POPUP_PCB_DELETE_TRACK_MNU, - - ID_POPUP_PCB_MOVE_ZONE_CORNER, - ID_POPUP_PCB_ADD_ZONE_CORNER, - ID_POPUP_PCB_DELETE_ZONE_CORNER, - ID_POPUP_PCB_PLACE_ZONE_CORNER, - ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, - ID_POPUP_PCB_EDIT_ZONE_PARAMS, - ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, ID_POPUP_PCB_FILL_ALL_ZONES, ID_POPUP_PCB_FILL_ZONE, - ID_POPUP_PCB_DELETE_ZONE_CONTAINER, - ID_POPUP_PCB_ZONE_DUPLICATE, - ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE, - ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE, - ID_POPUP_PCB_DELETE_ZONE_CUTOUT, - ID_POPUP_PCB_MOVE_ZONE_OUTLINES, - ID_POPUP_PCB_PLACE_ZONE_OUTLINES, - ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT, - ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE, - ID_POPUP_PCB_DELETE_MARKER, - - ID_POPUP_PCB_DELETE_DIMENSION, - ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST, - - ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST, - ID_POPUP_PCB_DELETE_PCB_TARGET, - ID_POPUP_PCB_EDIT_PCB_TARGET, - - ID_POPUP_PCB_STOP_CURRENT_DRAWING, - - ID_POPUP_PCB_EDIT_DIMENSION, - ID_POPUP_PCB_END_TRACK, ID_POPUP_PCB_PLACE_THROUGH_VIA, ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA, ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA, @@ -120,39 +75,8 @@ enum pcbnew_ids ID_POPUP_PCB_PLACE_MICROVIA, ID_POPUP_PCB_SWITCH_TRACK_POSTURE, - ID_POPUP_PCB_APPLY_PAD_SETTINGS, - ID_POPUP_PCB_COPY_PAD_SETTINGS, - - ID_POPUP_PCB_EDIT_TRACKSEG, - ID_POPUP_PCB_EDIT_TRACK_MNU, - ID_POPUP_PCB_EDIT_NET, - ID_POPUP_PCB_SELECT_LAYER, - ID_POPUP_PCB_SELECT_CU_LAYER, - ID_POPUP_PCB_SELECT_NO_CU_LAYER, - ID_POPUP_PCB_SELECT_LAYER_PAIR, - ID_POPUP_PCB_DELETE_EDGE, - ID_POPUP_PCB_MOVE_EDGE, - ID_POPUP_PCB_PLACE_EDGE, - ID_POPUP_PCB_END_EDGE, - ID_POPUP_PCB_LOCK_ON_TRACKSEG, - ID_POPUP_PCB_LOCK_OFF_TRACKSEG, - ID_POPUP_PCB_LOCK_ON_TRACK, - ID_POPUP_PCB_LOCK_OFF_TRACK, - ID_POPUP_PCB_LOCK_ON_NET, - ID_POPUP_PCB_LOCK_OFF_NET, - ID_POPUP_PCB_SETFLAGS_TRACK_MNU, - - ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, - ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, - ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, - ID_POPUP_PCB_MOVE_TRACK_NODE, - ID_POPUP_PCB_BREAK_TRACK, - ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE, - ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE, - ID_POPUP_PCB_DRAG_TRACK_SEGMENT, - ID_POPUP_PCB_MOVE_TRACK_SEGMENT, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, - ID_POPUP_PCB_GETINFO_MARKER, + ID_POPUP_PCB_END_RANGE, // Tracks and vias sizes general options @@ -295,9 +219,6 @@ enum pcbnew_ids ID_MODEDIT_MEASUREMENT_TOOL, // ID used in module editor: - ID_POPUP_MODEDIT_GLOBAL_EDIT_EDGE, - ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE, - ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE, ID_MODEDIT_CHECK, ID_MODEDIT_CREATE_NEW_LIB, ID_MODEDIT_ADD_LIBRARY, diff --git a/pcbnew/swig/pcbnew_action_plugins.cpp b/pcbnew/swig/pcbnew_action_plugins.cpp index 63c0744243..77d7921975 100644 --- a/pcbnew/swig/pcbnew_action_plugins.cpp +++ b/pcbnew/swig/pcbnew_action_plugins.cpp @@ -380,16 +380,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin ) GetScreen()->PushCommandToUndoList( oldBuffer ); - if( IsGalCanvasActive() ) - { - UseGalCanvas( GetGalCanvas() ); - } - else - { - UpdateUserInterface(); - GetScreen()->SetModify(); - Refresh(); - } + UseGalCanvas( GetGalCanvas() ); } diff --git a/pcbnew/swig/pcbnew_scripting_helpers.cpp b/pcbnew/swig/pcbnew_scripting_helpers.cpp index 7b863419c1..c0fd6d5f4c 100644 --- a/pcbnew/swig/pcbnew_scripting_helpers.cpp +++ b/pcbnew/swig/pcbnew_scripting_helpers.cpp @@ -155,18 +155,11 @@ void Refresh() auto board = s_PcbEditFrame->GetBoard(); board->BuildConnectivity(); - if( s_PcbEditFrame->IsGalCanvasActive() ) - { - auto gal_canvas = static_cast( s_PcbEditFrame->GetGalCanvas() ); + auto gal_canvas = static_cast( s_PcbEditFrame->GetGalCanvas() ); - // Reinit everything: this is the easy way to do that - s_PcbEditFrame->UseGalCanvas( true ); - gal_canvas->Refresh(); - } - else - // first argument is erase background, second is a wxRect that - // defines a reftresh area (all canvas if null) - s_PcbEditFrame->GetCanvas()->Refresh( true, NULL ); + // Reinit everything: this is the easy way to do that + s_PcbEditFrame->UseGalCanvas( true ); + gal_canvas->Refresh(); } } diff --git a/pcbnew/target_edit.cpp b/pcbnew/target_edit.cpp index d27a92331b..0a61ac8fe7 100644 --- a/pcbnew/target_edit.cpp +++ b/pcbnew/target_edit.cpp @@ -216,18 +216,6 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) } -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::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC ) { if( aTarget == NULL ) diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 3088cd943e..16e594f4f0 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -924,10 +924,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) ZONE_CONTAINER* edge_zone = GetBoard()->GetArea( ii ); edge_zone->Draw( m_canvas, DC, GR_XOR ); - if( IsGalCanvasActive() ) - { - GetGalCanvas()->GetView()->Update( edge_zone ); - } + GetGalCanvas()->GetView()->Update( edge_zone ); } zoneInfo.ExportSetting( *aZone ); @@ -979,9 +976,6 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) GetBoard()->GetConnectivity()->RecalculateRatsnest(); s_PickedList.ClearItemsList(); // s_ItemsListPicker is no longer owner of picked items - - if( !IsGalCanvasActive() ) - m_canvas->Refresh(); } diff --git a/pcbnew/zones_by_polygon_fill_functions.cpp b/pcbnew/zones_by_polygon_fill_functions.cpp index 2bd813c926..6619ff4118 100644 --- a/pcbnew/zones_by_polygon_fill_functions.cpp +++ b/pcbnew/zones_by_polygon_fill_functions.cpp @@ -81,9 +81,7 @@ void PCB_EDIT_FRAME::Check_All_Zones( wxWindow* aActiveWindow ) { m_ZoneFillsDirty = false; - if( IsGalCanvasActive() && GetGalCanvas() ) - GetGalCanvas()->ForceRefresh(); - + GetGalCanvas()->ForceRefresh(); GetCanvas()->Refresh(); } }