diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index acdb794a07..c01270b5df 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -234,7 +234,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: - m_panelShowPadGal->StopDrawing(); + m_padPreviewGAL->StopDrawing(); // Now call default handler for wxID_CANCEL command event event.Skip(); @@ -256,6 +256,16 @@ void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable ) void DIALOG_PAD_PROPERTIES::prepareCanvas() { // Initialize the canvas to display the pad +#ifdef __WXMAC__ + // Cairo renderer doesn't handle Retina displays + EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL; +#else + EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; +#endif + m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( this, -1, wxDefaultPosition, wxDefaultSize, + m_parent->GetGalDisplayOptions(), backend ); + + m_padPreviewSizer->Add( m_padPreviewGAL, 12, wxEXPAND | wxALL, 5 ); // Show the X and Y axis. It is usefull because pad shape can have an offset // or be a complex shape. @@ -266,16 +276,15 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas() VECTOR2D( m_dummyPad->GetPosition() ) ); m_axisOrigin->SetDrawAtZero( true ); - m_panelShowPadGal->UpdateColors(); - m_panelShowPadGal->SwitchBackend( m_parent->GetCanvas()->GetBackend() ); - m_panelShowPadGal->SetStealsFocus( false ); + m_padPreviewGAL->UpdateColors(); + m_padPreviewGAL->SetStealsFocus( false ); - m_panelShowPadGal->GetViewControls()->ApplySettings( + m_padPreviewGAL->GetViewControls()->ApplySettings( m_parent->GetCanvas()->GetViewControls()->GetSettings() ); - m_panelShowPadGal->Show(); + m_padPreviewGAL->Show(); - KIGFX::VIEW* view = m_panelShowPadGal->GetView(); + KIGFX::VIEW* view = m_padPreviewGAL->GetView(); // fix the pad render mode (filled/not filled) auto settings = static_cast( view->GetPainter()->GetSettings() ); @@ -293,7 +302,7 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas() view->Add( m_dummyPad ); view->Add( m_axisOrigin ); - m_panelShowPadGal->StartDrawing(); + m_padPreviewGAL->StartDrawing(); Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) ); } @@ -766,7 +775,7 @@ void DIALOG_PAD_PROPERTIES::onChangePadMode( wxCommandEvent& event ) { m_sketchPreview = m_cbShowPadOutline->GetValue(); - KIGFX::VIEW* view = m_panelShowPadGal->GetView(); + KIGFX::VIEW* view = m_padPreviewGAL->GetView(); // fix the pad render mode (filled/not filled) KIGFX::PCB_RENDER_SETTINGS* settings = @@ -1199,8 +1208,11 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() void DIALOG_PAD_PROPERTIES::redraw() { - KIGFX::VIEW* view = m_panelShowPadGal->GetView(); - m_panelShowPadGal->StopDrawing(); + if( !m_canUpdate ) + return; + + KIGFX::VIEW* view = m_padPreviewGAL->GetView(); + m_padPreviewGAL->StopDrawing(); // The layer used to place primitive items selected when editing custom pad shapes // we use here a layer never used in a pad: @@ -1298,8 +1310,8 @@ void DIALOG_PAD_PROPERTIES::redraw() // Autozoom view->SetViewport( viewBox ); - m_panelShowPadGal->StartDrawing(); - m_panelShowPadGal->Refresh(); + m_padPreviewGAL->StartDrawing(); + m_padPreviewGAL->Refresh(); } } diff --git a/pcbnew/dialogs/dialog_pad_properties.h b/pcbnew/dialogs/dialog_pad_properties.h index 2669fce350..e4cc61dde9 100644 --- a/pcbnew/dialogs/dialog_pad_properties.h +++ b/pcbnew/dialogs/dialog_pad_properties.h @@ -69,6 +69,7 @@ private: // editing a custom pad shape std::vector m_highlight; // shapes highlighted in GAL mode + PCB_DRAW_PANEL_GAL* m_padPreviewGAL; KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas static bool m_sketchPreview; // session storage diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index 33134ef243..e3bb3ffcf8 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -852,6 +852,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind wxBoxSizer* bSizerDisplayPad; bSizerDisplayPad = new wxBoxSizer( wxVERTICAL ); + bSizerDisplayPad->SetMinSize( wxSize( 290,-1 ) ); bSizerDisplayPad->Add( 0, 0, 0, wxBOTTOM|wxEXPAND|wxTOP, 3 ); @@ -870,10 +871,11 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind bSizerDisplayPad->Add( 0, 0, 1, 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->SetMinSize( wxSize( 280,-1 ) ); + m_padPreviewSizer = new wxBoxSizer( wxVERTICAL ); - bSizerDisplayPad->Add( m_panelShowPadGal, 12, wxEXPAND|wxALL, 5 ); + m_padPreviewSizer->SetMinSize( wxSize( 280,-1 ) ); + + bSizerDisplayPad->Add( m_padPreviewSizer, 12, wxEXPAND, 5 ); m_cbShowPadOutline = new wxCheckBox( this, wxID_ANY, _("Show pad in outline mode"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerDisplayPad->Add( m_cbShowPadOutline, 0, wxBOTTOM|wxRIGHT|wxTOP, 5 ); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index b6522fa82a..858bb87d00 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -9624,7 +9624,7 @@ wxEXPAND|wxTOP|wxRIGHT 1 - -1,-1 + 290,-1 bSizerDisplayPad wxVERTICAL none @@ -9770,66 +9770,15 @@ 0 - + 5 - wxEXPAND|wxALL + wxEXPAND 12 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 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); - - 1 - PCB_DRAW_PANEL_GAL* m_panelShowPadGal; KIGFX::GAL_DISPLAY_OPTIONS m_galOptions; - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - #include <pcb_base_frame.h> #include <pcb_draw_panel_gal.h> - - 0 - - - 0 + 280,-1 - 1 - m_panelShowPadGal - 1 - - + m_padPreviewSizer + wxVERTICAL protected - 1 - - Resizable - - 1 - - - 0 - - - - diff --git a/pcbnew/dialogs/dialog_pad_properties_base.h b/pcbnew/dialogs/dialog_pad_properties_base.h index 180f514887..460d7ebe29 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.h +++ b/pcbnew/dialogs/dialog_pad_properties_base.h @@ -38,8 +38,6 @@ class WX_GRID; #include #include #include -#include -#include #include #include #include @@ -211,8 +209,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_buttonDel; wxStaticText* m_parentInfoLine1; wxStaticText* m_parentInfoLine2; - PCB_DRAW_PANEL_GAL* m_panelShowPadGal; - KIGFX::GAL_DISPLAY_OPTIONS m_galOptions; + wxBoxSizer* m_padPreviewSizer; wxCheckBox* m_cbShowPadOutline; wxStaticLine* m_staticline13; wxStdDialogButtonSizer* m_sdbSizer;