Fix focus issues with dialog previews.

Use SetStealsFocus() to fix the Pad Properties dialog, and remove
mouse-enter-kill-focus to fix 3D preview in Footprint Properties
dialog.

Fixes: lp:1761321
* https://bugs.launchpad.net/kicad/+bug/1761321

Fixes: lp:1690766
* https://bugs.launchpad.net/kicad/+bug/1690766

(cherry picked from commit e0c1fc9)
This commit is contained in:
Jeff Young 2018-07-07 21:40:24 +01:00
parent deed1d67b3
commit a4c5e2c82f
3 changed files with 10 additions and 18 deletions

View File

@ -66,15 +66,11 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE*
aFrame->Prj().Get3DCacheManager() );
m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
m_previewPane->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( PANEL_PREV_3D::onEnterPreviewCanvas ), nullptr, this );
}
PANEL_PREV_3D::~PANEL_PREV_3D()
{
m_previewPane->Disconnect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( PANEL_PREV_3D::onEnterPreviewCanvas ), nullptr, this );
delete m_settings3Dviewer;
delete m_dummyBoard;
delete m_previewPane;

View File

@ -136,11 +136,6 @@ private:
wxString formatRotationValue( double aValue );
wxString formatOffsetValue( double aValue );
void onEnterPreviewCanvas( wxMouseEvent& event )
{
m_previewPane->SetFocus();
}
void View3DISO( wxCommandEvent& event ) override
{
m_settings3Dviewer->CameraGet().ToggleProjection();

View File

@ -229,8 +229,10 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
{
m_panelShowPadGal->UseColorScheme( &m_parent->Settings().Colors() );
m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() );
m_panelShowPadGal->GetViewControls()->
EnableMousewheelPan( m_parent->GetCanvas()->GetEnableMousewheelPan() );
m_panelShowPadGal->SetStealsFocus( false );
bool mousewheelPan = m_parent->GetCanvas()->GetEnableMousewheelPan();
m_panelShowPadGal->GetViewControls()->EnableMousewheelPan( mousewheelPan );
m_panelShowPadGal->Show();
m_panelShowPad->Hide();
@ -238,13 +240,12 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
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 = !m_cbShowPadOutline->IsChecked();
settings->SetSketchMode( LAYER_PADS_TH, !filled );
settings->SetSketchMode( LAYER_PAD_FR, !filled );
settings->SetSketchMode( LAYER_PAD_BK, !filled );
settings->SetSketchModeGraphicItems( !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;