From 31c88d1bcb422e5ad5a2ca99e201f82475f7393f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 13 Sep 2023 10:27:14 +0100 Subject: [PATCH] Don't show cursor or grid axes in pad preview; do show the pad anchor axes. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15631 --- pcbnew/dialogs/dialog_pad_properties.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 8c4b0fbb4f..e50a7cab34 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -334,20 +334,22 @@ void DIALOG_PAD_PROPERTIES::OnCancel( wxCommandEvent& event ) void DIALOG_PAD_PROPERTIES::prepareCanvas() { + KIGFX::GAL_DISPLAY_OPTIONS opts = m_parent->GetGalDisplayOptions(); + COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings(); + + opts.m_forceDisplayCursor = false; + // Initialize the canvas to display the pad m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( m_boardViewPanel, -1, wxDefaultPosition, - wxDefaultSize, - m_parent->GetGalDisplayOptions(), + wxDefaultSize, opts, m_parent->GetCanvas()->GetBackend() ); m_padPreviewSizer->Add( m_padPreviewGAL, 12, wxEXPAND | wxALL, 5 ); // Show the X and Y axis. It is useful because pad shape can have an offset // or be a complex shape. - KIGFX::COLOR4D axis_color = LIGHTBLUE; - - m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( axis_color, KIGFX::ORIGIN_VIEWITEM::CROSS, - pcbIUScale.mmToIU( 0.2 ), + m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( colorSettings->GetColor( LAYER_GRID ), + KIGFX::ORIGIN_VIEWITEM::CROSS, 100000, VECTOR2D( m_previewPad->GetPosition() ) ); m_axisOrigin->SetDrawAtZero( true ); @@ -375,6 +377,7 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas() // And do not show the grid: view->GetGAL()->SetGridVisibility( false ); + view->GetGAL()->SetAxesEnabled( false ); view->Add( m_previewPad ); view->Add( m_axisOrigin ); @@ -1420,7 +1423,10 @@ void DIALOG_PAD_PROPERTIES::redraw() if( !m_canUpdate ) return; - KIGFX::VIEW* view = m_padPreviewGAL->GetView(); + KIGFX::VIEW* view = m_padPreviewGAL->GetView(); + KIGFX::PCB_PAINTER* painter = static_cast( view->GetPainter() ); + KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings(); + m_padPreviewGAL->StopDrawing(); // The layer used to place primitive items selected when editing custom pad shapes @@ -1428,10 +1434,10 @@ void DIALOG_PAD_PROPERTIES::redraw() #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 ); + m_axisOrigin->SetPosition( m_previewPad->GetPosition() ); + view->Update( m_previewPad ); // delete previous items if highlight list