Fix a minor issue in pad editor dialog: in GAL mode, the pad was sometimes shown in outline mode, sometimes in filled mode

Fixes: lp:1740668
https://bugs.launchpad.net/kicad/+bug/1740668
This commit is contained in:
jean-pierre charras 2018-01-12 19:46:44 +01:00
parent 786312b103
commit 79a9f401a3
4 changed files with 27 additions and 4 deletions

View File

@ -278,7 +278,7 @@ protected:
class PAINTER
{
public:
/*
/**
* Constructor PAINTER( GAL* )
* initializes this object for painting on any of the polymorphic
* GRAPHICS_ABSTRACTION_LAYER* derivatives.

View File

@ -44,6 +44,7 @@
#include <class_board.h>
#include <class_module.h>
#include <pcb_painter.h>
#include <dialog_pad_properties.h>
#include <html_messagebox.h>
@ -201,9 +202,21 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
{
m_panelShowPadGal->UseColorScheme( &m_parent->Settings().Colors() );
m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() );
m_panelShowPadGal->Show();
m_panelShowPad->Hide();
auto 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() );
bool filled = true; // could be an option in dialog
settings->SetSketchMode( LAYER_PADS_TH, !filled );
settings->SetSketchMode( LAYER_PAD_FR, !filled );
settings->SetSketchMode( LAYER_PAD_BK, !filled );
settings->SetSketchModeGraphicItems( !filled );
// 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 ) );
@ -1168,7 +1181,7 @@ void DIALOG_PAD_PROPERTIES::redraw()
{
if( m_parent->IsGalCanvasActive() )
{
auto view = m_panelShowPadGal->GetView();
KIGFX::VIEW* view = m_panelShowPadGal->GetView();
m_panelShowPadGal->StopDrawing();
view->SetTopLayer( F_SilkS );

View File

@ -133,7 +133,7 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOption
m_sketchFpGfx = !aOptions->m_DisplayModEdgeFill;
// Whether to draw tracks, vias & pads filled or as outlines
m_sketchMode[LAYER_PADS_TH] = !aOptions->m_DisplayPadFill;
m_sketchMode[LAYER_PADS_TH] = !aOptions->m_DisplayPadFill;
m_sketchMode[LAYER_VIA_THROUGH] = !aOptions->m_DisplayViaFill;
m_sketchMode[LAYER_VIA_BBLIND] = !aOptions->m_DisplayViaFill;
m_sketchMode[LAYER_VIA_MICROVIA] = !aOptions->m_DisplayViaFill;

View File

@ -126,6 +126,16 @@ public:
return m_sketchMode[aItemLayer];
}
/**
* Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts).
* @param aEnabled decides if it is drawn in sketch mode (true for sketched mode,
* false for filled mode).
*/
inline void SetSketchModeGraphicItems( bool aEnabled )
{
m_sketchBoardGfx = aEnabled;
}
inline bool IsBackgroundDark() const
{
auto luma = m_layerColors[ LAYER_PCB_BACKGROUND ].GetBrightness();