diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b5cb960e8..a7b8f166aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -604,7 +604,7 @@ endif() # # Find Cairo library, required # -find_package( Cairo 1.8.8 REQUIRED ) +find_package( Cairo 1.12 REQUIRED ) find_package( Pixman 0.30 REQUIRED ) # diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index 07695c103b..42a988a2ef 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -60,6 +60,9 @@ bool PANEL_COMMON_SETTINGS::TransferDataToWindow() commonSettings->Read( GAL_ANTIALIASING_MODE_KEY, &antialiasingMode, 0 ); m_antialiasing->SetSelection( antialiasingMode ); + commonSettings->Read( CAIRO_ANTIALIASING_MODE_KEY, &antialiasingMode, 0 ); + m_antialiasingFallback->SetSelection( antialiasingMode ); + int scale_fourths; commonSettings->Read( ICON_SCALE_KEY, &scale_fourths ); @@ -106,6 +109,8 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow() commonSettings->Write( GAL_ANTIALIASING_MODE_KEY, m_antialiasing->GetSelection() ); + commonSettings->Write( CAIRO_ANTIALIASING_MODE_KEY, m_antialiasingFallback->GetSelection() ); + const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25; commonSettings->Write( ICON_SCALE_KEY, scale_fourths ); diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index acc08c4528..b9ed4fb361 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Nov 23 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,186 +9,197 @@ /////////////////////////////////////////////////////////////////////////// -PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) { wxBoxSizer* bPanelSizer; bPanelSizer = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); - + wxGridBagSizer* gbSizer1; gbSizer1 = new wxGridBagSizer( 3, 0 ); gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizer1->SetEmptyCellSize( wxSize( -1,2 ) ); - + m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("&Auto save:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextautosave->Wrap( -1 ); gbSizer1->Add( m_staticTextautosave, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - + wxBoxSizer* bSizer6; bSizer6 = new wxBoxSizer( wxHORIZONTAL ); - + m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 ); m_SaveTime->SetToolTip( _("Delay after the first change to create a backup file of the board on disk.\nIf set to 0, auto backup is disabled") ); - + bSizer6->Add( m_SaveTime, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - + wxStaticText* minutesLabel; minutesLabel = new wxStaticText( this, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); minutesLabel->Wrap( -1 ); bSizer6->Add( minutesLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - + + gbSizer1->Add( bSizer6, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); - + m_staticTextFileHistorySize = new wxStaticText( this, wxID_ANY, _("File history size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextFileHistorySize->Wrap( -1 ); gbSizer1->Add( m_staticTextFileHistorySize, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - + m_fileHistorySize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); gbSizer1->Add( m_fileHistorySize, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - + wxStaticText* antialiasingLabel; - antialiasingLabel = new wxStaticText( this, wxID_ANY, _("Graphics acceleration:"), wxDefaultPosition, wxDefaultSize, 0 ); + antialiasingLabel = new wxStaticText( this, wxID_ANY, _("Graphics (Accelerated):"), wxDefaultPosition, wxDefaultSize, 0 ); antialiasingLabel->Wrap( -1 ); gbSizer1->Add( antialiasingLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - + wxString m_antialiasingChoices[] = { _("No Antialiasing"), _("Subpixel Antialiasing (High Quality)"), _("Subpixel Antialiasing (Ultra Quality)"), _("Supersampling (2x)"), _("Supersampling (4x)") }; int m_antialiasingNChoices = sizeof( m_antialiasingChoices ) / sizeof( wxString ); m_antialiasing = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingNChoices, m_antialiasingChoices, 0 ); m_antialiasing->SetSelection( 0 ); gbSizer1->Add( m_antialiasing, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - + + wxStaticText* antialiasingLabel1; + antialiasingLabel1 = new wxStaticText( this, wxID_ANY, _("Graphics (Fallback):"), wxDefaultPosition, wxDefaultSize, 0 ); + antialiasingLabel1->Wrap( -1 ); + gbSizer1->Add( antialiasingLabel1, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + wxString m_antialiasingFallbackChoices[] = { _("No Antialiasing"), _("Fast Antialiasing"), _("Balanced Antialiasing"), _("High Quality Antialiasing") }; + int m_antialiasingFallbackNChoices = sizeof( m_antialiasingFallbackChoices ) / sizeof( wxString ); + m_antialiasingFallback = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingFallbackNChoices, m_antialiasingFallbackChoices, 0 ); + m_antialiasingFallback->SetSelection( 0 ); + gbSizer1->Add( m_antialiasingFallback, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + + gbSizer1->AddGrowableCol( 1 ); - + bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxALL, 5 ); - - + + bLeftSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 3 ); - + wxStaticBoxSizer* sizerHelperApps; sizerHelperApps = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Helper Applications") ), wxVERTICAL ); - + wxGridBagSizer* gridHelperApps; gridHelperApps = new wxGridBagSizer( 0, 0 ); gridHelperApps->SetFlexibleDirection( wxBOTH ); gridHelperApps->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gridHelperApps->SetEmptyCellSize( wxSize( -1,5 ) ); - + wxStaticText* textEditorLabel; textEditorLabel = new wxStaticText( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Text editor:"), wxDefaultPosition, wxDefaultSize, 0 ); textEditorLabel->Wrap( -1 ); gridHelperApps->Add( textEditorLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 ); - + m_textEditorPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textEditorPath->SetMinSize( wxSize( 360,-1 ) ); - + gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + + m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); m_textEditorBtn->SetMinSize( wxSize( 29,29 ) ); - + gridHelperApps->Add( m_textEditorBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - + m_defaultPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("System default PDF viewer"), wxDefaultPosition, wxDefaultSize, 0 ); gridHelperApps->Add( m_defaultPDFViewer, wxGBPosition( 2, 0 ), wxGBSpan( 1, 3 ), wxTOP|wxRIGHT|wxLEFT, 4 ); - + m_otherPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Other:"), wxDefaultPosition, wxDefaultSize, 0 ); gridHelperApps->Add( m_otherPDFViewer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 ); - + m_PDFViewerPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_PDFViewerPath->SetMinSize( wxSize( 360,-1 ) ); - + gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + + m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); m_pdfViewerBtn->SetMinSize( wxSize( 29,29 ) ); - + gridHelperApps->Add( m_pdfViewerBtn, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - - + + gridHelperApps->AddGrowableCol( 1 ); - + sizerHelperApps->Add( gridHelperApps, 0, wxEXPAND, 5 ); - - + + bLeftSizer->Add( sizerHelperApps, 0, wxEXPAND|wxALL, 5 ); - + wxStaticBoxSizer* sbSizerIconsOpts; sbSizerIconsOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL ); - + wxFlexGridSizer* fgSizer11; fgSizer11 = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizer11->AddGrowableCol( 1 ); fgSizer11->SetFlexibleDirection( wxBOTH ); fgSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTexticonscale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTexticonscale->Wrap( -1 ); fgSizer11->Add( m_staticTexticonscale, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 4 ); - + wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxHORIZONTAL ); - + m_scaleSlider = new STEPPED_SLIDER( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); m_scaleSlider->SetMinSize( wxSize( 240,-1 ) ); - + bSizer4->Add( m_scaleSlider, 1, wxBOTTOM|wxEXPAND, 4 ); - + m_staticTextPerCent = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPerCent->Wrap( -1 ); bSizer4->Add( m_staticTextPerCent, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 ); - - + + fgSizer11->Add( bSizer4, 1, wxEXPAND, 5 ); - + m_scaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer11->Add( m_scaleAuto, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 25 ); - - + + fgSizer11->Add( 0, 0, 0, wxEXPAND, 5 ); - - + + sbSizerIconsOpts->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); - + m_checkBoxIconsInMenus = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerIconsOpts->Add( m_checkBoxIconsInMenus, 0, wxALL, 4 ); - - + + bLeftSizer->Add( sbSizerIconsOpts, 0, wxEXPAND|wxALL, 5 ); - + wxStaticBoxSizer* sbSizer51; sbSizer51 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); - + m_ZoomCenterOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Ce&nter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); m_ZoomCenterOpt->SetToolTip( _("Center the cursor on screen when zooming.") ); - + sbSizer51->Add( m_ZoomCenterOpt, 0, wxTOP|wxRIGHT|wxLEFT, 4 ); - + m_MousewheelPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 ); m_MousewheelPANOpt->SetToolTip( _("Enable touchpad-friendly controls (pan with scroll action, zoom with Ctrl+scroll).") ); - + sbSizer51->Add( m_MousewheelPANOpt, 0, wxALL, 4 ); - + m_AutoPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_AUTOPAN, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 ); m_AutoPANOpt->SetToolTip( _("When drawing a track or moving an item, pan when approaching the edge of the display.") ); - + sbSizer51->Add( m_AutoPANOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); - - + + bLeftSizer->Add( sbSizer51, 0, wxEXPAND|wxALL, 5 ); - - + + bPanelSizer->Add( bLeftSizer, 0, 0, 5 ); - - + + this->SetSizer( bPanelSizer ); this->Layout(); bPanelSizer->Fit( this ); - + // Connect Events m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this ); m_PDFViewerPath->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this ); @@ -223,5 +234,5 @@ PANEL_COMMON_SETTINGS_BASE::~PANEL_COMMON_SETTINGS_BASE() m_scaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this ); m_scaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleAuto ), NULL, this ); - + } diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index a42cf5d32f..51519427c4 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -49,43 +49,6 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bPanelSizer @@ -177,36 +140,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -216,7 +149,7 @@ wxEXPAND 0 1 - + bSizer6 wxHORIZONTAL @@ -281,39 +214,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -375,36 +275,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -471,36 +341,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -566,39 +406,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -636,7 +443,7 @@ 0 0 wxID_ANY - Graphics acceleration: + Graphics (Accelerated): 0 0 @@ -663,36 +470,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -760,37 +537,137 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxLEFT + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Graphics (Fallback): + 0 + + 0 + + + 0 + + 1 + antialiasingLabel1 + 1 + + + none + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "No Antialiasing" "Fast Antialiasing" "Balanced Antialiasing" "High Quality Antialiasing" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_antialiasingFallback + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + @@ -817,7 +694,6 @@ wxVERTICAL 1 none - 5 wxEXPAND @@ -895,36 +771,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -992,40 +838,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1101,37 +913,7 @@ - - - - - - OnTextEditorClick - - - - - - - - - - - - - - - - - - - - - - - - @@ -1199,37 +981,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1297,37 +1048,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1395,39 +1115,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - onUpdateUIPdfPath @@ -1504,36 +1191,7 @@ - - - - - - OnPDFViewerClick - - - - - - - - - - - - - - - - - - - - - - - onUpdateUIPdfPath @@ -1553,7 +1211,6 @@ wxVERTICAL 1 none - 5 wxEXPAND|wxBOTTOM|wxRIGHT @@ -1629,36 +1286,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1733,57 +1360,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnScaleSlider - - - - - - - - - - - - - @@ -1845,36 +1422,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1941,37 +1488,7 @@ - - - - - - - - OnScaleAuto - - - - - - - - - - - - - - - - - - - - - - @@ -2048,37 +1565,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2095,7 +1581,6 @@ wxVERTICAL 1 none - 4 wxTOP|wxRIGHT|wxLEFT @@ -2158,37 +1643,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2253,37 +1707,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2348,37 +1771,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dialogs/panel_common_settings_base.h b/common/dialogs/panel_common_settings_base.h index bb4cf912e3..1c2bcedf23 100644 --- a/common/dialogs/panel_common_settings_base.h +++ b/common/dialogs/panel_common_settings_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 11 2018) +// C++ code generated with wxFormBuilder (version Nov 23 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __PANEL_COMMON_SETTINGS_BASE_H__ -#define __PANEL_COMMON_SETTINGS_BASE_H__ +#pragma once #include #include @@ -39,21 +38,22 @@ /////////////////////////////////////////////////////////////////////////////// /// Class PANEL_COMMON_SETTINGS_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_COMMON_SETTINGS_BASE : public wxPanel +class PANEL_COMMON_SETTINGS_BASE : public wxPanel { private: - + protected: enum { wxID_AUTOPAN = 1000 }; - + wxStaticText* m_staticTextautosave; wxSpinCtrl* m_SaveTime; wxStaticText* m_staticTextFileHistorySize; wxSpinCtrl* m_fileHistorySize; wxChoice* m_antialiasing; + wxChoice* m_antialiasingFallback; wxTextCtrl* m_textEditorPath; wxBitmapButton* m_textEditorBtn; wxRadioButton* m_defaultPDFViewer; @@ -68,20 +68,19 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel wxCheckBox* m_ZoomCenterOpt; wxCheckBox* m_MousewheelPANOpt; wxCheckBox* m_AutoPANOpt; - + // Virtual event handlers, overide them in your derived class virtual void OnTextEditorClick( wxCommandEvent& event ) { event.Skip(); } virtual void onUpdateUIPdfPath( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnPDFViewerClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); } virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + + PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~PANEL_COMMON_SETTINGS_BASE(); - + }; -#endif //__PANEL_COMMON_SETTINGS_BASE_H__ diff --git a/common/gal/cairo/cairo_compositor.cpp b/common/gal/cairo/cairo_compositor.cpp index 611db796e3..21714214dc 100644 --- a/common/gal/cairo/cairo_compositor.cpp +++ b/common/gal/cairo/cairo_compositor.cpp @@ -34,7 +34,8 @@ using namespace KIGFX; CAIRO_COMPOSITOR::CAIRO_COMPOSITOR( cairo_t** aMainContext ) : - m_current( 0 ), m_currentContext( aMainContext ), m_mainContext( *aMainContext ) + m_current( 0 ), m_currentContext( aMainContext ), m_mainContext( *aMainContext ), + m_currentAntialiasingMode( CAIRO_ANTIALIAS_NONE ) { // Do not have uninitialized members: cairo_matrix_init_identity( &m_matrix ); @@ -55,6 +56,28 @@ void CAIRO_COMPOSITOR::Initialize() } +void CAIRO_COMPOSITOR::SetAntialiasingMode( CAIRO_ANTIALIASING_MODE aMode ) +{ + + switch( aMode ) + { + case CAIRO_ANTIALIASING_MODE::FAST: + m_currentAntialiasingMode = CAIRO_ANTIALIAS_FAST; + break; + case CAIRO_ANTIALIASING_MODE::GOOD: + m_currentAntialiasingMode = CAIRO_ANTIALIAS_GOOD; + break; + case CAIRO_ANTIALIASING_MODE::BEST: + m_currentAntialiasingMode = CAIRO_ANTIALIAS_BEST; + break; + default: + m_currentAntialiasingMode = CAIRO_ANTIALIAS_NONE; + } + + clean(); +} + + void CAIRO_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight ) { clean(); @@ -86,7 +109,7 @@ unsigned int CAIRO_COMPOSITOR::CreateBuffer() #endif /* __WXDEBUG__ */ // Set default settings for the buffer - cairo_set_antialias( context, CAIRO_ANTIALIAS_NONE ); + cairo_set_antialias( context, m_currentAntialiasingMode ); cairo_set_line_join( context, CAIRO_LINE_JOIN_ROUND ); cairo_set_line_cap( context, CAIRO_LINE_CAP_ROUND ); diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 9d082f0075..aa81d5a9a5 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -739,6 +739,7 @@ void CAIRO_GAL_BASE::EnableDepthTest( bool aEnabled ) void CAIRO_GAL_BASE::resetContext() { + cairo_set_antialias( context, CAIRO_ANTIALIAS_NONE ); ClearScreen(); @@ -1227,6 +1228,7 @@ void CAIRO_GAL::setCompositor() // Recreate the compositor with the new Cairo context compositor.reset( new CAIRO_COMPOSITOR( ¤tContext ) ); compositor->Resize( screenSize.x, screenSize.y ); + compositor->SetAntialiasingMode( options.cairo_antialiasing_mode ); // Prepare buffers mainBuffer = compositor->CreateBuffer(); @@ -1254,6 +1256,16 @@ bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) { bool refresh = false; + if( validCompositor && aOptions.cairo_antialiasing_mode != compositor->GetAntialiasingMode() ) + { + + compositor->SetAntialiasingMode( options.cairo_antialiasing_mode ); + validCompositor = false; + deinitSurface(); + + refresh = true; + } + if( super::updatedGalDisplayOptions( aOptions ) ) { Refresh(); diff --git a/common/gal/gal_display_options.cpp b/common/gal/gal_display_options.cpp index bf7d7004dc..4aad4388d7 100644 --- a/common/gal/gal_display_options.cpp +++ b/common/gal/gal_display_options.cpp @@ -49,6 +49,7 @@ static const UTIL::CFG_MAP gridStyleConfigVals = GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS() : gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ), + cairo_antialiasing_mode( CAIRO_ANTIALIASING_MODE::NONE ), m_gridStyle( GRID_STYLE::DOTS ), m_gridLineWidth( 0.5 ), m_gridMinSpacing( 10.0 ), diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp index 978d9c68e4..b9a8eba415 100644 --- a/common/legacy_gal/eda_draw_frame.cpp +++ b/common/legacy_gal/eda_draw_frame.cpp @@ -302,6 +302,10 @@ void EDA_DRAW_FRAME::CommonSettingsChanged() int tmp; settings->Read( GAL_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) tmp; + + settings->Read( CAIRO_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE ); + m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) tmp; + m_galDisplayOptions.NotifyChanged(); } @@ -849,6 +853,10 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) int temp; cmnCfg->Read( GAL_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) temp; + + cmnCfg->Read( CAIRO_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE ); + m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) temp; + m_galDisplayOptions.NotifyChanged(); } diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp index b315977096..56851af91f 100644 --- a/common/legacy_wx/eda_draw_frame.cpp +++ b/common/legacy_wx/eda_draw_frame.cpp @@ -304,6 +304,10 @@ void EDA_DRAW_FRAME::CommonSettingsChanged() int tmp; settings->Read( GAL_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) tmp; + + settings->Read( CAIRO_ANTIALIASING_MODE_KEY, &tmp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE ); + m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) tmp; + m_galDisplayOptions.NotifyChanged(); } @@ -868,6 +872,10 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) int temp; cmnCfg->Read( GAL_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); m_galDisplayOptions.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) temp; + + cmnCfg->Read( CAIRO_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE ); + m_galDisplayOptions.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) temp; + m_galDisplayOptions.NotifyChanged(); } diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index 5f05f13a10..19a6b943ef 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -553,7 +553,8 @@ void PGM_BASE::loadCommonSettings() m_common_settings->Write( USE_ICONS_IN_MENUS_KEY, defaultUseIconsInMenus ); if( !m_common_settings->HasEntry( ICON_SCALE_KEY ) - || !m_common_settings->HasEntry( GAL_ANTIALIASING_MODE_KEY ) ) + || !m_common_settings->HasEntry( GAL_ANTIALIASING_MODE_KEY ) + || !m_common_settings->HasEntry( CAIRO_ANTIALIASING_MODE_KEY ) ) { // 5.0 and earlier saved common settings in each app, and saved hardware antialiasing // options only in pcbnew (which was the only canvas to support them). Since there's @@ -588,6 +589,14 @@ void PGM_BASE::loadCommonSettings() &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); m_common_settings->Write( GAL_ANTIALIASING_MODE_KEY, temp ); } + + if( !m_common_settings->HasEntry( CAIRO_ANTIALIASING_MODE_KEY ) ) + { + int temp; + pcbnewConfig->Read( pcbFrameKey + GAL_DISPLAY_OPTIONS_KEY + CAIRO_ANTIALIASING_MODE_KEY, + &temp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE ); + m_common_settings->Write( CAIRO_ANTIALIASING_MODE_KEY, temp ); + } } m_editor_name = m_common_settings->Read( "Editor" ); diff --git a/include/gal/cairo/cairo_compositor.h b/include/gal/cairo/cairo_compositor.h index a21cd123c3..b742555971 100644 --- a/include/gal/cairo/cairo_compositor.h +++ b/include/gal/cairo/cairo_compositor.h @@ -32,6 +32,7 @@ #define CAIRO_COMPOSITOR_H_ #include +#include #include #include #include @@ -74,6 +75,22 @@ public: /// @copydoc COMPOSITOR::Present() virtual void Present() override; + void SetAntialiasingMode( CAIRO_ANTIALIASING_MODE aMode ); // clears all buffers + CAIRO_ANTIALIASING_MODE GetAntialiasingMode() const + { + switch( m_currentAntialiasingMode ) + { + case CAIRO_ANTIALIAS_FAST: + return CAIRO_ANTIALIASING_MODE::FAST; + case CAIRO_ANTIALIAS_GOOD: + return CAIRO_ANTIALIASING_MODE::GOOD; + case CAIRO_ANTIALIAS_BEST: + return CAIRO_ANTIALIASING_MODE::BEST; + default: + return CAIRO_ANTIALIASING_MODE::NONE; + } + } + /** * Function SetMainContext() * Sets a context to be treated as the main context (ie. as a target of buffers rendering and @@ -116,6 +133,8 @@ protected: unsigned int m_stride; ///< Stride to use given the desired format and width unsigned int m_bufferSize; ///< Amount of memory needed to store a buffer + cairo_antialias_t m_currentAntialiasingMode; + /** * Function clean() * performs freeing of resources. diff --git a/include/gal/gal_display_options.h b/include/gal/gal_display_options.h index 55c7e190f6..0b592d7a32 100644 --- a/include/gal/gal_display_options.h +++ b/include/gal/gal_display_options.h @@ -50,6 +50,14 @@ namespace KIGFX SUPERSAMPLING_X4, }; + enum class CAIRO_ANTIALIASING_MODE + { + NONE, + FAST, + GOOD, + BEST, + }; + class GAL_DISPLAY_OPTIONS; class GAL_DISPLAY_OPTIONS_OBSERVER @@ -73,6 +81,8 @@ namespace KIGFX OPENGL_ANTIALIASING_MODE gl_antialiasing_mode; + CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode; + ///> The grid style to draw the grid in KIGFX::GRID_STYLE m_gridStyle; diff --git a/include/pgm_base.h b/include/pgm_base.h index c3f665146f..05cecd00f5 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -52,6 +52,7 @@ #define FILE_HISTORY_SIZE_KEY wxT( "FileHistorySize" ) #define GAL_DISPLAY_OPTIONS_KEY wxT( "GalDisplayOptions" ) #define GAL_ANTIALIASING_MODE_KEY wxT( "OpenGLAntialiasingMode" ) +#define CAIRO_ANTIALIASING_MODE_KEY wxT( "CairoAntialiasingMode" ) ///@} diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index d09d4d6073..8d9ce75bdc 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -390,6 +390,9 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow* commonCfg->Read( GAL_ANTIALIASING_MODE_KEY, &itemp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); gal_opts.gl_antialiasing_mode = (KIGFX::OPENGL_ANTIALIASING_MODE) itemp; + + commonCfg->Read( CAIRO_ANTIALIASING_MODE_KEY, &itemp, (int) KIGFX::CAIRO_ANTIALIASING_MODE::NONE ); + gal_opts.cairo_antialiasing_mode = (KIGFX::CAIRO_ANTIALIASING_MODE) itemp; } #ifdef __WXMAC__