mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 10:51:41 +00:00
Remove more legacy editing code.
This commit is contained in:
parent
0a6b1ea256
commit
9d9745b555
common
eeschema
gerbview
events_called_functions.cppgerbview_frame.cppgerbview_layer_widget.cppgerbview_layer_widget.hhotkeys.cppmenubar.cpp
include
pcbnew
autorouter
cross-probing.cppdialogs
dialog_cleanup_tracks_and_vias.cppdialog_edit_footprint_for_BoardEditor.cppdialog_edit_footprint_for_BoardEditor.hdialog_global_edit_tracks_and_vias.cppdialog_pad_properties.cppdialog_select_net_from_list.cppdialog_set_grid.cpp
dimension.cppedit.cppeditedge.cppfiles.cppfootprint_edit_frame.cppfootprint_edit_frame.hfootprint_editor_utils.cppfootprint_libraries_utils.cppfootprint_viewer_frame.cppfootprint_wizard_frame.cppfootprint_wizard_frame_functions.cpphotkeys_board_editor.cpplayer_widget.cpplayer_widget.hload_select_footprint.cppmenubar_footprint_editor.cppmenubar_pcb_editor.cppmove-drag_pads.cppmove_or_drag_track.cppnetlist.cpppad_edit_functions.cpppcb_base_frame.cpppcb_edit_frame.cpppcb_edit_frame.hpcb_layer_widget.cpppcb_layer_widget.hpcbnew_id.hswig
target_edit.cppzones_by_polygon.cppzones_by_polygon_fill_functions.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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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() )
|
||||
|
@ -79,10 +79,8 @@ static std::unique_ptr<wxStaticBitmap> 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 )
|
||||
{
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<KIGFX::GERBVIEW_PAINTER*>( GetGalCanvas()->GetView()->GetPainter() )->GetSettings();
|
||||
|
||||
switch( event.GetId() )
|
||||
{
|
||||
auto settings = static_cast<KIGFX::GERBVIEW_PAINTER*>( 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;
|
||||
|
@ -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<GERBVIEW_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
||||
|
||||
// Prepare worksheet template
|
||||
auto worksheet =
|
||||
new KIGFX::WS_PROXY_VIEW_ITEM( IU_PER_MILS, &GetPageSettings(), &GetTitleBlock() );
|
||||
|
||||
if( screen != NULL )
|
||||
{
|
||||
auto drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( 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++ )
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
//-----</LAYER_WIDGET callbacks>------------------------------------------
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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<BOARD_ITEM*>( pad ) :
|
||||
static_cast<BOARD_ITEM*>( module )
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCrossHairPosition( pos );
|
||||
RedrawScreen( pos, false );
|
||||
}
|
||||
GetToolManager()->RunAction( PCB_ACTIONS::crossProbeSchToPcb,
|
||||
true,
|
||||
pad ?
|
||||
static_cast<BOARD_ITEM*>( pad ) :
|
||||
static_cast<BOARD_ITEM*>( module )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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() )
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<KIGFX::PCB_RENDER_SETTINGS*>( 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<KIGFX::PCB_RENDER_SETTINGS*>( 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<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
|
||||
// fix the pad render mode (filled/not filled)
|
||||
KIGFX::PCB_RENDER_SETTINGS* settings =
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( 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<KIGFX::PCB_RENDER_SETTINGS*>( 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<KIGFX::PCB_RENDER_SETTINGS*>( 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user