diff --git a/common/gl_context_mgr.cpp b/common/gl_context_mgr.cpp index 930e74b221..cf32fde430 100644 --- a/common/gl_context_mgr.cpp +++ b/common/gl_context_mgr.cpp @@ -102,7 +102,9 @@ void GL_CONTEXT_MANAGER::UnlockCtx( wxGLContext* aContext ) } else { - wxLogDebug( "Trying to unlock GL context mutex from a wrong context" ); + wxLogDebug( + "Trying to unlock GL context mutex from a wrong context: aContext %p m_glCtx %p", + aContext, m_glCtx ); } } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 8bef1abfa2..867de3c352 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -153,6 +153,18 @@ void DIALOG_PAD_PROPERTIES::OnInitDialog( wxInitDialogEvent& event ) } +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(); + + // Now call default handler for wxID_CANCEL command event + event.Skip(); +} + + void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable ) { // Enable or disable the widgets in page managing custom shape primitives @@ -188,8 +200,8 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas() m_panelShowPadGal->Show(); m_panelShowPad->Hide(); auto view = m_panelShowPadGal->GetView(); - // gives a non null grid size (0.01mm) because GAL layer does not like a 0 size grid: - double gridsize = 0.01 * IU_PER_MM; + // 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 ) ); view->Add( m_dummyPad ); view->Add( m_axisOrigin ); diff --git a/pcbnew/dialogs/dialog_pad_properties.h b/pcbnew/dialogs/dialog_pad_properties.h index 875b8b7af1..462859350d 100644 --- a/pcbnew/dialogs/dialog_pad_properties.h +++ b/pcbnew/dialogs/dialog_pad_properties.h @@ -6,10 +6,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2008-2013 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -113,6 +113,7 @@ private: // event handlers: void OnInitDialog( wxInitDialogEvent& event ) override; void OnResize( wxSizeEvent& event ); + void OnCancel( wxCommandEvent& event ) override; void OnPadShapeSelection( wxCommandEvent& event ) override; void OnDrillShapeSelected( wxCommandEvent& event ) override; diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index 2425d7eae5..48183140c9 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -633,7 +633,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind bSizerDisplayPad->Add( m_panelShowPad, 4, wxRIGHT|wxTOP|wxEXPAND, 5 ); - m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); + m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO); bSizerDisplayPad->Add( m_panelShowPadGal, 4, wxEXPAND|wxRIGHT|wxTOP, 5 ); @@ -704,6 +704,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_buttonGeometry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this ); m_buttonImport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this ); m_panelShowPad->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this ); } DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE() @@ -749,6 +750,7 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE() m_buttonGeometry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this ); m_buttonImport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this ); m_panelShowPad->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index ecb4639c44..2cdccf90c9 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -88,12 +88,12 @@ - + m_MainSizer wxVERTICAL none - + 5 wxEXPAND 1 @@ -10210,7 +10210,7 @@ 0 PCB_DRAW_PANEL_GAL 1 - m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ); + m_panelShowPadGal = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), wxDefaultSize, m_galOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO); 1 PCB_DRAW_PANEL_GAL* m_panelShowPadGal; KIGFX::GAL_DISPLAY_OPTIONS m_galOptions; @@ -10379,7 +10379,7 @@ m_sdbSizer protected - + OnCancel diff --git a/pcbnew/dialogs/dialog_pad_properties_base.h b/pcbnew/dialogs/dialog_pad_properties_base.h index f86e4fad4d..cfd8141e49 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.h +++ b/pcbnew/dialogs/dialog_pad_properties_base.h @@ -198,6 +198,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM virtual void onGeometryTransform( wxCommandEvent& event ) { event.Skip(); } virtual void onImportPrimitives( wxCommandEvent& event ) { event.Skip(); } virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } public: