From afeebc89449d77895e8872fcce6b685da5478a8d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 4 Sep 2018 01:00:17 +0100 Subject: [PATCH] Grid settings for Eeschema GAL. Split antialiasing options out from display options. Move antialiasing to common. Duplicate the rest of display options for Eeschema. Implement OnSelectGrid and hookup GAL canvas refresh to SetPresetGrid. Add Grid Settings... to View menu and move Show Grid from preferences to View Menu to match Pcbnew. --- common/dialogs/dialog_color_picker_base.cpp | 6 +- common/dialogs/dialog_color_picker_base.fbp | 8 +- common/dialogs/panel_common_settings.cpp | 7 + common/dialogs/panel_common_settings_base.cpp | 139 +- common/dialogs/panel_common_settings_base.fbp | 1632 ++++++++++------- common/dialogs/panel_common_settings_base.h | 6 +- common/gal/gal_display_options.cpp | 56 +- common/legacy_gal/eda_draw_frame.cpp | 47 +- common/legacy_wx/eda_draw_frame.cpp | 27 +- common/pgm_base.cpp | 23 +- common/widgets/gal_options_panel.cpp | 45 +- eeschema/CMakeLists.txt | 2 + eeschema/dialogs/dialog_set_grid.cpp | 91 + eeschema/dialogs/dialog_set_grid_base.cpp | 71 + eeschema/dialogs/dialog_set_grid_base.fbp | 478 +++++ eeschema/dialogs/dialog_set_grid_base.h | 59 + .../panel_eeschema_display_options.cpp | 30 +- .../dialogs/panel_eeschema_display_options.h | 5 +- .../panel_eeschema_display_options_base.cpp | 43 +- .../panel_eeschema_display_options_base.fbp | 463 +---- .../panel_eeschema_display_options_base.h | 12 +- eeschema/dialogs/panel_eeschema_settings.cpp | 4 + .../dialogs/panel_eeschema_settings_base.cpp | 30 +- .../dialogs/panel_eeschema_settings_base.fbp | 109 +- .../dialogs/panel_eeschema_settings_base.h | 2 + eeschema/eeschema_id.h | 1 + eeschema/menubar.cpp | 4 + eeschema/sch_base_frame.h | 2 + eeschema/sch_edit_frame.cpp | 1 + eeschema/widgets/symbol_preview_widget.cpp | 3 +- include/pgm_base.h | 1 + include/widgets/gal_options_panel.h | 2 - 32 files changed, 1984 insertions(+), 1425 deletions(-) create mode 100644 eeschema/dialogs/dialog_set_grid.cpp create mode 100644 eeschema/dialogs/dialog_set_grid_base.cpp create mode 100644 eeschema/dialogs/dialog_set_grid_base.fbp create mode 100644 eeschema/dialogs/dialog_set_grid_base.h diff --git a/common/dialogs/dialog_color_picker_base.cpp b/common/dialogs/dialog_color_picker_base.cpp index 675ed1700b..55cdb94842 100644 --- a/common/dialogs/dialog_color_picker_base.cpp +++ b/common/dialogs/dialog_color_picker_base.cpp @@ -126,7 +126,7 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID bSizerBright->Add( m_staticTextBright, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); m_sliderBrightness = new wxSlider( sbSizerViewHSV->GetStaticBox(), wxID_ANY, 255, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_LABELS|wxSL_LEFT|wxSL_VERTICAL ); - bSizerBright->Add( m_sliderBrightness, 1, wxTOP|wxRIGHT, 5 ); + bSizerBright->Add( m_sliderBrightness, 1, wxTOP|wxRIGHT|wxALIGN_CENTER_HORIZONTAL, 5 ); sbSizerViewHSV->Add( bSizerBright, 0, wxEXPAND, 5 ); @@ -172,10 +172,10 @@ DIALOG_COLOR_PICKER_BASE::DIALOG_COLOR_PICKER_BASE( wxWindow* parent, wxWindowID m_opacityLabel = new wxStaticText( this, wxID_ANY, _("Opacity:"), wxDefaultPosition, wxDefaultSize, 0 ); m_opacityLabel->Wrap( -1 ); - m_SizerTransparency->Add( m_opacityLabel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + m_SizerTransparency->Add( m_opacityLabel, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxLEFT, 5 ); m_sliderTransparency = new wxSlider( this, wxID_ANY, 80, 20, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS|wxSL_LEFT|wxSL_VERTICAL ); - m_SizerTransparency->Add( m_sliderTransparency, 1, wxALL, 5 ); + m_SizerTransparency->Add( m_sliderTransparency, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_HORIZONTAL, 10 ); bSizerUpperMain->Add( m_SizerTransparency, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); diff --git a/common/dialogs/dialog_color_picker_base.fbp b/common/dialogs/dialog_color_picker_base.fbp index e1c0be98c1..c79eba8f19 100644 --- a/common/dialogs/dialog_color_picker_base.fbp +++ b/common/dialogs/dialog_color_picker_base.fbp @@ -1462,7 +1462,7 @@ 5 - wxTOP|wxRIGHT + wxTOP|wxRIGHT|wxALIGN_CENTER_HORIZONTAL 1 1 @@ -1704,7 +1704,7 @@ 5 - wxALIGN_CENTER_HORIZONTAL|wxALL + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxLEFT 0 1 @@ -1786,8 +1786,8 @@ - 5 - wxALL + 10 + wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_HORIZONTAL 1 1 diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index 3eff06ecaa..8b2deeaa37 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "panel_common_settings.h" PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent ) : @@ -55,6 +56,10 @@ bool PANEL_COMMON_SETTINGS::TransferDataToWindow() commonSettings->Read( FILE_HISTORY_SIZE_KEY, &fileHistorySize, DEFAULT_FILE_HISTORY_SIZE ); m_fileHistorySize->SetValue( fileHistorySize ); + int antialiasingMode; + commonSettings->Read( GAL_ANTIALIASING_MODE_KEY, &antialiasingMode, 0 ); + m_antialiasing->SetSelection( antialiasingMode ); + int scale_fourths; commonSettings->Read( ICON_SCALE_KEY, &scale_fourths ); @@ -99,6 +104,8 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow() commonSettings->Write( FILE_HISTORY_SIZE_KEY, m_fileHistorySize->GetValue() ); + commonSettings->Write( GAL_ANTIALIASING_MODE_KEY, m_antialiasing->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 0fb05426e8..af09bbf5e3 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -18,10 +18,10 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind bLeftSizer = new wxBoxSizer( wxVERTICAL ); wxGridBagSizer* gbSizer1; - gbSizer1 = new wxGridBagSizer( 0, 0 ); + gbSizer1 = new wxGridBagSizer( 3, 0 ); gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - gbSizer1->SetEmptyCellSize( wxSize( -1,10 ) ); + gbSizer1->SetEmptyCellSize( wxSize( -1,2 ) ); m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("&Auto save:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextautosave->Wrap( -1 ); @@ -31,60 +31,91 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind bSizer6 = new wxBoxSizer( wxHORIZONTAL ); m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 ); - bSizer6->Add( m_SaveTime, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + bSizer6->Add( m_SaveTime, 0, wxLEFT, 5 ); wxStaticText* minutesLabel; minutesLabel = new wxStaticText( this, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); minutesLabel->Wrap( -1 ); - bSizer6->Add( minutesLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + bSizer6->Add( minutesLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 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|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + 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 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + gbSizer1->Add( m_fileHistorySize, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT, 5 ); - wxStaticText* textEditorLabel; - textEditorLabel = new wxStaticText( this, wxID_ANY, _("Text editor:"), wxDefaultPosition, wxDefaultSize, 0 ); - textEditorLabel->Wrap( -1 ); - gbSizer1->Add( textEditorLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + wxStaticText* antialiasingLabel; + antialiasingLabel = new wxStaticText( this, wxID_ANY, _("Graphics acceleration:"), wxDefaultPosition, wxDefaultSize, 0 ); + antialiasingLabel->Wrap( -1 ); + gbSizer1->Add( antialiasingLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_textEditorPath = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textEditorPath->Enable( false ); - m_textEditorPath->SetMinSize( wxSize( 300,-1 ) ); - - gbSizer1->Add( m_textEditorPath, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_textEditorBtn = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); - m_textEditorBtn->SetMinSize( wxSize( 29,29 ) ); - - gbSizer1->Add( m_textEditorBtn, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - - m_defaultPDFViewer = new wxRadioButton( this, wxID_ANY, _("System default PDF viewer"), wxDefaultPosition, wxDefaultSize, 0 ); - gbSizer1->Add( m_defaultPDFViewer, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_otherPDFViewer = new wxRadioButton( this, wxID_ANY, _("Other:"), wxDefaultPosition, wxDefaultSize, 0 ); - gbSizer1->Add( m_otherPDFViewer, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - - m_PDFViewerPath = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_PDFViewerPath->Enable( false ); - m_PDFViewerPath->SetMinSize( wxSize( 300,-1 ) ); - - gbSizer1->Add( m_PDFViewerPath, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_pdfViewerBtn = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); - m_pdfViewerBtn->SetMinSize( wxSize( 29,29 ) ); - - gbSizer1->Add( m_pdfViewerBtn, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 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 ); gbSizer1->AddGrowableCol( 1 ); - bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + 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->Enable( false ); + 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, wxBU_AUTODRAW ); + 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->Enable( false ); + 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, wxBU_AUTODRAW ); + 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* sbSizer5; sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL ); @@ -97,32 +128,34 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind m_staticText1 = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); - fgSizer11->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 ); + fgSizer11->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 4 ); - m_scaleSlider = new STEPPED_SLIDER( sbSizer5->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS ); - fgSizer11->Add( m_scaleSlider, 0, wxBOTTOM|wxEXPAND, 4 ); + wxBoxSizer* bSizer4; + bSizer4 = new wxBoxSizer( wxHORIZONTAL ); + + m_scaleSlider = new STEPPED_SLIDER( sbSizer5->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|wxALIGN_RIGHT, 4 ); m_staticText2 = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); - fgSizer11->Add( m_staticText2, 0, wxALIGN_BOTTOM|wxBOTTOM, 2 ); + bSizer4->Add( m_staticText2, 0, wxALIGN_BOTTOM|wxBOTTOM|wxRIGHT, 2 ); - fgSizer11->Add( 0, 0, 0, wxEXPAND, 5 ); + fgSizer11->Add( bSizer4, 1, wxEXPAND, 5 ); - m_scaleAuto = new wxCheckBox( sbSizer5->GetStaticBox(), wxID_ANY, _("Auto"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer11->Add( m_scaleAuto, 0, wxTOP|wxLEFT, 9 ); + m_scaleAuto = new wxCheckBox( sbSizer5->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 ); - sbSizer5->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - sbSizer5->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + sbSizer5->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); m_checkBoxIconsInMenus = new wxCheckBox( sbSizer5->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer5->Add( m_checkBoxIconsInMenus, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + sbSizer5->Add( m_checkBoxIconsInMenus, 0, wxALL, 4 ); bLeftSizer->Add( sbSizer5, 0, wxEXPAND|wxALL, 5 ); @@ -133,17 +166,17 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind 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, wxRIGHT|wxLEFT, 5 ); + sbSizer51->Add( m_ZoomCenterOpt, 0, 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, wxLEFT|wxRIGHT|wxTOP, 5 ); + 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, wxALL, 5 ); + sbSizer51->Add( m_AutoPANOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 ); bLeftSizer->Add( sbSizer51, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index ca4d98a936..9a250950b1 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -94,10 +94,10 @@ none 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxALL 1 - -1,10 + -1,2 wxBOTH 1 @@ -106,7 +106,7 @@ gbSizer1 wxFLEX_GROWMODE_SPECIFIED none - 0 + 3 5 1 @@ -200,14 +200,14 @@ wxEXPAND 0 1 - + bSizer6 wxHORIZONTAL none 5 - wxTOP|wxBOTTOM|wxLEFT + wxLEFT 0 1 @@ -295,7 +295,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + wxALIGN_CENTER_VERTICAL|wxRIGHT 0 1 @@ -382,7 +382,7 @@ 5 1 0 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 1 1 @@ -468,7 +468,7 @@ 5 1 1 - wxBOTTOM|wxRIGHT|wxLEFT + wxRIGHT|wxLEFT 1 1 @@ -559,8 +559,8 @@ 5 1 0 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT - 2 + wxALIGN_CENTER_VERTICAL|wxLEFT + 3 1 1 @@ -590,7 +590,7 @@ 0 0 wxID_ANY - Text editor: + Graphics acceleration: 0 @@ -598,7 +598,7 @@ 0 1 - textEditorLabel + antialiasingLabel 1 @@ -643,202 +643,12 @@ 5 - 1 + 2 1 - wxALIGN_CENTER_VERTICAL|wxLEFT - 2 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 3 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - 300,-1 - 1 - m_textEditorPath - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - 1 - 2 - wxALIGN_CENTER_VERTICAL - 2 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - - wxID_ANY - Browse - - 0 - - - 0 - 29,29 - 1 - m_textEditorBtn - 1 - - - protected - 1 - - Resizable - - 1 - - wxBU_AUTODRAW - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnTextEditorClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - 3 - 0 - wxTOP|wxRIGHT|wxLEFT - 4 - 1 - + 1 1 1 @@ -852,6 +662,7 @@ 1 0 + "No Antialiasing" "Subpixel Antialiasing (High Quality)" "Subpixel Antialiasing (Ultra Quality)" "Supersampling (2x)" "Supersampling (4x)" 1 1 @@ -866,7 +677,6 @@ 0 0 wxID_ANY - System default PDF viewer 0 @@ -874,7 +684,7 @@ 0 1 - m_defaultPDFViewer + m_antialiasing 1 @@ -882,6 +692,7 @@ 1 Resizable + 0 1 @@ -892,293 +703,11 @@ wxFILTER_NONE wxDefaultValidator - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - 1 - 0 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT - 5 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Other: - - 0 - - - 0 - - 1 - m_otherPDFViewer - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - 1 - 1 - wxALIGN_CENTER_VERTICAL|wxLEFT - 5 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - 300,-1 - 1 - m_PDFViewerPath - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - 1 - 2 - wxALIGN_CENTER_VERTICAL - 5 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - - wxID_ANY - Browse - - 0 - - - 0 - 29,29 - 1 - m_pdfViewerBtn - 1 - - - protected - 1 - - Resizable - - 1 - - wxBU_AUTODRAW - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnPDFViewerClick - + @@ -1205,6 +734,696 @@ + + 3 + wxEXPAND|wxTOP + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Helper Applications + + sizerHelperApps + wxVERTICAL + 1 + none + + + 5 + wxEXPAND + 0 + + -1,5 + wxBOTH + 1 + + 0 + + gridHelperApps + wxFLEX_GROWMODE_SPECIFIED + none + 0 + + 4 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text editor: + + 0 + + + 0 + + 1 + textEditorLabel + 1 + + + none + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + 360,-1 + 1 + m_textEditorPath + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Browse + + 0 + + + 0 + 29,29 + 1 + m_textEditorBtn + 1 + + + protected + 1 + + Resizable + + 1 + + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnTextEditorClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + 3 + 0 + wxTOP|wxRIGHT|wxLEFT + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + System default PDF viewer + + 0 + + + 0 + + 1 + m_defaultPDFViewer + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Other: + + 0 + + + 0 + + 1 + m_otherPDFViewer + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxLEFT + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + 360,-1 + 1 + m_PDFViewerPath + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Browse + + 0 + + + 0 + 29,29 + 1 + m_pdfViewerBtn + 1 + + + protected + 1 + + Resizable + + 1 + + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnPDFViewerClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND|wxALL @@ -1220,7 +1439,7 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxBOTTOM|wxRIGHT 0 3 @@ -1235,8 +1454,8 @@ 0 0 - 3 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 4 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -1317,210 +1536,211 @@ - - 4 - wxBOTTOM|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 275 - - 0 - - 50 - - 0 - - 1 - m_scaleSlider - 1 - - - protected - 1 - - Resizable - 1 - - wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS - STEPPED_SLIDER; widgets/stepped_slider.h; Not forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnScaleSlider - - - - - - - - - - - - - - - - 2 - wxALIGN_BOTTOM|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - % - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - + 5 wxEXPAND - 0 - - 0 - protected - 0 + 1 + + + bSizer4 + wxHORIZONTAL + none + + 4 + wxBOTTOM|wxEXPAND|wxALIGN_RIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 275 + + 0 + + 50 + + 0 + 240,-1 + 1 + m_scaleSlider + 1 + + + protected + 1 + + Resizable + 1 + + wxSL_HORIZONTAL|wxSL_LABELS + STEPPED_SLIDER; widgets/stepped_slider.h; Not forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnScaleSlider + + + + + + + + + + + + + + + + 2 + wxALIGN_BOTTOM|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + % + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + - 9 - wxTOP|wxLEFT + 25 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -1551,7 +1771,7 @@ 0 0 wxID_ANY - Auto + Automatic 0 @@ -1618,19 +1838,9 @@ - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 0 - protected - 0 - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT + 4 + wxALL 0 1 @@ -1732,7 +1942,7 @@ none - 5 + 4 wxRIGHT|wxLEFT 0 @@ -1820,8 +2030,8 @@ - 5 - wxLEFT|wxRIGHT|wxTOP + 4 + wxALL 0 1 @@ -1908,8 +2118,8 @@ - 5 - wxALL + 4 + wxBOTTOM|wxRIGHT|wxLEFT 0 1 diff --git a/common/dialogs/panel_common_settings_base.h b/common/dialogs/panel_common_settings_base.h index 1adeb67c35..51ad38e7ed 100644 --- a/common/dialogs/panel_common_settings_base.h +++ b/common/dialogs/panel_common_settings_base.h @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include @@ -27,10 +29,9 @@ #include #include #include -#include +#include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -52,6 +53,7 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel wxSpinCtrl* m_SaveTime; wxStaticText* m_staticTextFileHistorySize; wxSpinCtrl* m_fileHistorySize; + wxChoice* m_antialiasing; wxTextCtrl* m_textEditorPath; wxBitmapButton* m_textEditorBtn; wxRadioButton* m_defaultPDFViewer; diff --git a/common/gal/gal_display_options.cpp b/common/gal/gal_display_options.cpp index e3ef839f71..bf7d7004dc 100644 --- a/common/gal/gal_display_options.cpp +++ b/common/gal/gal_display_options.cpp @@ -31,7 +31,6 @@ using namespace KIGFX; /* * Config option strings */ -static const wxString GalGLAntialiasingKeyword( "OpenGLAntialiasingMode" ); static const wxString GalGridStyleConfig( "GridStyle" ); static const wxString GalGridLineWidthConfig( "GridLineWidth" ); static const wxString GalGridMaxDensityConfig( "GridMaxDensity" ); @@ -40,16 +39,6 @@ static const wxString GalFullscreenCursorConfig( "CursorFullscreen" ); static const wxString GalForceDisplayCursorConfig( "ForceDisplayCursor" ); -static const UTIL::CFG_MAP aaModeConfigVals = -{ - { KIGFX::OPENGL_ANTIALIASING_MODE::NONE, 0 }, - { KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH, 1 }, - { KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA, 2 }, - { KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2, 3 }, - { KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4, 4 }, -}; - - static const UTIL::CFG_MAP gridStyleConfigVals = { { KIGFX::GRID_STYLE::DOTS, 0 }, @@ -73,28 +62,15 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, const wxString& aBaseN { long readLong; // Temp value buffer - aCfg->Read( aBaseName + GalGLAntialiasingKeyword, &readLong, - static_cast( KIGFX::OPENGL_ANTIALIASING_MODE::NONE ) ); - gl_antialiasing_mode = UTIL::GetValFromConfig( aaModeConfigVals, readLong ); - aCfg->Read( aBaseName + GalGridStyleConfig, &readLong, static_cast( KIGFX::GRID_STYLE::DOTS ) ); m_gridStyle = UTIL::GetValFromConfig( gridStyleConfigVals, readLong ); - aCfg->Read( aBaseName + GalGridLineWidthConfig, - &m_gridLineWidth, 0.5 ); - - aCfg->Read( aBaseName + GalGridMaxDensityConfig, - &m_gridMinSpacing, 10 ); - - aCfg->Read( aBaseName + GalGridAxesEnabledConfig, - &m_axesEnabled, false ); - - aCfg->Read( aBaseName + GalFullscreenCursorConfig, - &m_fullscreenCursor, false ); - - aCfg->Read( aBaseName + GalForceDisplayCursorConfig, - &m_forceDisplayCursor, false ); + aCfg->Read( aBaseName + GalGridLineWidthConfig, &m_gridLineWidth, 0.5 ); + aCfg->Read( aBaseName + GalGridMaxDensityConfig, &m_gridMinSpacing, 10 ); + aCfg->Read( aBaseName + GalGridAxesEnabledConfig, &m_axesEnabled, false ); + aCfg->Read( aBaseName + GalFullscreenCursorConfig, &m_fullscreenCursor, false ); + aCfg->Read( aBaseName + GalForceDisplayCursorConfig, &m_forceDisplayCursor, false ); NotifyChanged(); } @@ -102,26 +78,14 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, const wxString& aBaseN void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, const wxString& aBaseName ) { - aCfg->Write( aBaseName + GalGLAntialiasingKeyword, - UTIL::GetConfigForVal( aaModeConfigVals, gl_antialiasing_mode ) ); - aCfg->Write( aBaseName + GalGridStyleConfig, UTIL::GetConfigForVal( gridStyleConfigVals, m_gridStyle ) ); - aCfg->Write( aBaseName + GalGridLineWidthConfig, - m_gridLineWidth ); - - aCfg->Write( aBaseName + GalGridMaxDensityConfig, - m_gridMinSpacing ); - - aCfg->Write( aBaseName + GalGridAxesEnabledConfig, - m_axesEnabled ); - - aCfg->Write( aBaseName + GalFullscreenCursorConfig, - m_fullscreenCursor ); - - aCfg->Write( aBaseName + GalForceDisplayCursorConfig, - m_forceDisplayCursor ); + aCfg->Write( aBaseName + GalGridLineWidthConfig, m_gridLineWidth ); + aCfg->Write( aBaseName + GalGridMaxDensityConfig, m_gridMinSpacing ); + aCfg->Write( aBaseName + GalGridAxesEnabledConfig, m_axesEnabled ); + aCfg->Write( aBaseName + GalFullscreenCursorConfig, m_fullscreenCursor ); + aCfg->Write( aBaseName + GalForceDisplayCursorConfig, m_forceDisplayCursor ); } diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp index c88d89938f..8b569e958f 100644 --- a/common/legacy_gal/eda_draw_frame.cpp +++ b/common/legacy_gal/eda_draw_frame.cpp @@ -290,25 +290,30 @@ void EDA_DRAW_FRAME::CommonSettingsChanged() { EDA_BASE_FRAME::CommonSettingsChanged(); + wxConfigBase* settings = Pgm().CommonSettings(); + int autosaveInterval; - Pgm().CommonSettings()->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); + settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); SetAutoSaveInterval( autosaveInterval ); int historySize; - Pgm().CommonSettings()->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE ); + settings->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE ); Kiface().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) ); bool option; - Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); + settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); m_canvas->SetEnableMousewheelPan( option ); - Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); + settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); m_canvas->SetEnableZoomNoCenter( option ); - Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &option ); + settings->Read( ENBL_AUTO_PAN_KEY, &option ); m_canvas->SetEnableAutoPan( option ); - m_galDisplayOptions.ReadConfig( Pgm().CommonSettings(), GAL_DISPLAY_OPTIONS_KEY ); + 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; + m_galDisplayOptions.NotifyChanged(); } @@ -522,17 +527,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) int idx = eventId - ID_POPUP_GRID_LEVEL_1000; - // Notify GAL - TOOL_MANAGER* mgr = GetToolManager(); - - if( mgr && IsGalCanvasActive() ) - { - mgr->RunAction( "common.Control.gridPreset", true, idx ); - } - else - SetPresetGrid( idx ); - - m_canvas->Refresh(); + SetPresetGrid( idx ); } @@ -702,7 +697,8 @@ void EDA_DRAW_FRAME::SetPrevGrid() void EDA_DRAW_FRAME::SetPresetGrid( int aIndex ) { - BASE_SCREEN * screen = GetScreen(); + BASE_SCREEN* screen = GetScreen(); + KIGFX::VIEW* view = GetGalCanvas()->GetView(); if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) ) aIndex = screen->GetGrids()[0].m_CmdId; @@ -724,7 +720,10 @@ void EDA_DRAW_FRAME::SetPresetGrid( int aIndex ) // Be sure m_LastGridSizeId is up to date. m_LastGridSizeId = aIndex; - GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 ); + + screen->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 ); + view->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) ); + view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // Put cursor on new grid SetCrossHairPosition( RefPos( true ) ); @@ -796,6 +795,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) EDA_BASE_FRAME::LoadSettings( aCfg ); wxString baseCfgName = ConfigBaseName(); + wxConfigBase* cmnCfg = Pgm().CommonSettings(); // Read units used in dialogs and toolbars EDA_UNITS_T unitsTmp; @@ -827,7 +827,12 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); - m_galDisplayOptions.ReadConfig( Pgm().CommonSettings(), GAL_DISPLAY_OPTIONS_KEY ); + m_galDisplayOptions.ReadConfig( aCfg, baseCfgName + GAL_DISPLAY_OPTIONS_KEY ); + + 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; + m_galDisplayOptions.NotifyChanged(); } @@ -846,6 +851,8 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg ) if( GetScreen() ) aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) ); + + m_galDisplayOptions.WriteConfig( aCfg, baseCfgName + GAL_DISPLAY_OPTIONS_KEY ); } diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp index ddb1a3a0a3..eb71748b62 100644 --- a/common/legacy_wx/eda_draw_frame.cpp +++ b/common/legacy_wx/eda_draw_frame.cpp @@ -290,25 +290,30 @@ void EDA_DRAW_FRAME::CommonSettingsChanged() { EDA_BASE_FRAME::CommonSettingsChanged(); + wxConfigBase* settings = Pgm().CommonSettings(); + int autosaveInterval; - Pgm().CommonSettings()->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); + settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); SetAutoSaveInterval( autosaveInterval ); int historySize; - Pgm().CommonSettings()->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE ); + settings->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE ); Kiface().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) ); bool option; - Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); + settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); m_canvas->SetEnableMousewheelPan( option ); - Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); + settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); m_canvas->SetEnableZoomNoCenter( option ); - Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &option ); + settings->Read( ENBL_AUTO_PAN_KEY, &option ); m_canvas->SetEnableAutoPan( option ); - m_galDisplayOptions.ReadConfig( Pgm().CommonSettings(), GAL_DISPLAY_OPTIONS_KEY ); + 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; + m_galDisplayOptions.NotifyChanged(); } @@ -797,6 +802,7 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) EDA_BASE_FRAME::LoadSettings( aCfg ); wxString baseCfgName = ConfigBaseName(); + wxConfigBase* cmnCfg = Pgm().CommonSettings(); // Read units used in dialogs and toolbars EDA_UNITS_T unitsTmp; @@ -828,7 +834,12 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); - m_galDisplayOptions.ReadConfig( Pgm().CommonSettings(), GAL_DISPLAY_OPTIONS_KEY ); + m_galDisplayOptions.ReadConfig( aCfg, baseCfgName + GAL_DISPLAY_OPTIONS_KEY ); + + 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; + m_galDisplayOptions.NotifyChanged(); } @@ -847,6 +858,8 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg ) if( GetScreen() ) aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) ); + + m_galDisplayOptions.WriteConfig( aCfg, baseCfgName + GAL_DISPLAY_OPTIONS_KEY ); } diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index 9fb7f1148b..c7997e0f41 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -553,13 +554,14 @@ 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_DISPLAY_OPTIONS_KEY ) ) + || !m_common_settings->HasEntry( GAL_ANTIALIASING_MODE_KEY ) ) { - // 5.0 and earlier saved common settings in each app, and saved GAL display options - // only in pcbnew (which was the only canvas to support them). Since there's no - // single right answer to where to pull the common settings from, we might as well - // get them along with the GAL display options from pcbnew. + // 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 + // no single right answer to where to pull the common settings from, we might as well + // get them along with the hardware antialiasing option from pcbnew. wxConfigBase* pcbnewConfig = GetNewConfig( wxString::FromUTF8( "pcbnew" ) ); + wxString pcbFrameKey( PCB_EDIT_FRAME_NAME ); if( !m_common_settings->HasEntry( ICON_SCALE_KEY ) ) { @@ -579,13 +581,12 @@ void PGM_BASE::loadCommonSettings() m_common_settings->Write( ENBL_AUTO_PAN_KEY, option ); } - if( !m_common_settings->HasEntry( GAL_DISPLAY_OPTIONS_KEY ) ) + if( !m_common_settings->HasEntry( GAL_ANTIALIASING_MODE_KEY ) ) { - KIGFX::GAL_DISPLAY_OPTIONS temp; - temp.ReadConfig( pcbnewConfig, wxString( "PcbFrame" ) + GAL_DISPLAY_OPTIONS_KEY ); - temp.WriteConfig( m_common_settings, GAL_DISPLAY_OPTIONS_KEY ); - - m_common_settings->Write( GAL_DISPLAY_OPTIONS_KEY, 1 ); + int temp; + pcbnewConfig->Read( pcbFrameKey + GAL_DISPLAY_OPTIONS_KEY + GAL_ANTIALIASING_MODE_KEY, + &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); + m_common_settings->Write( GAL_ANTIALIASING_MODE_KEY, temp ); } } diff --git a/common/widgets/gal_options_panel.cpp b/common/widgets/gal_options_panel.cpp index a355670e78..ca32033d08 100644 --- a/common/widgets/gal_options_panel.cpp +++ b/common/widgets/gal_options_panel.cpp @@ -49,16 +49,6 @@ static const UTIL::CFG_MAP gridStyleSelectMap = }; -static const UTIL::CFG_MAP aaModeSelectMap = -{ - { KIGFX::OPENGL_ANTIALIASING_MODE::NONE, 0 }, // Default - { KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH, 1 }, - { KIGFX::OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA, 2 }, - { KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2, 3 }, - { KIGFX::OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4, 4 }, -}; - - GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTIONS& aGalOpts ): wxPanel( aParent, wxID_ANY ), m_galOptions( aGalOpts ) @@ -75,31 +65,7 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI const wxString galOnlySuffix = _( " (not supported in Legacy Toolset)" ); /* - * Anti-aliasing subpanel - */ - { - wxStaticBoxSizer* sOpenGLRenderingSizer; - sOpenGLRenderingSizer = new wxStaticBoxSizer( new wxStaticBox( this, - wxID_ANY, _( "Accelerated Graphics" ) ), wxVERTICAL ); - - wxString m_choiceAntialiasingChoices[] = { - _( "No Antialiasing" ), - _( "Subpixel Antialiasing (High Quality)" ), - _( "Subpixel Antialiasing (Ultra Quality)" ), - _( "Supersampling (2x)" ), - _( "Supersampling (4x)" ) - }; - int m_choiceAntialiasingNChoices = sizeof( m_choiceAntialiasingChoices ) / sizeof( wxString ); - m_choiceAntialiasing = new wxChoice( sOpenGLRenderingSizer->GetStaticBox(), - wxID_ANY, wxDefaultPosition, wxDefaultSize, - m_choiceAntialiasingNChoices, m_choiceAntialiasingChoices, 0 ); - sOpenGLRenderingSizer->Add( m_choiceAntialiasing, 0, wxALL|wxEXPAND, 5 ); - - sLeftSizer->Add( sOpenGLRenderingSizer, 0, wxTOP|wxRIGHT|wxEXPAND, 5 ); - } - - /* - * Grid setting subpanel + * Grid settings subpanel */ { wxStaticBoxSizer* sGridSettings; @@ -178,6 +144,9 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI m_gridMinSpacingIncrementer->SetPrecision( 0 ); // restrict to ints } + /* + * Cursor settings subpanel + */ { wxString cursorDisplayTitle = _( "Cursor Options" ); @@ -225,9 +194,6 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI bool GAL_OPTIONS_PANEL::TransferDataToWindow() { - m_choiceAntialiasing->SetSelection( UTIL::GetConfigForVal( - aaModeSelectMap, m_galOptions.gl_antialiasing_mode ) ); - m_gridStyle->SetSelection( UTIL::GetConfigForVal( gridStyleSelectMap, m_galOptions.m_gridStyle ) ); @@ -245,9 +211,6 @@ bool GAL_OPTIONS_PANEL::TransferDataToWindow() bool GAL_OPTIONS_PANEL::TransferDataFromWindow() { - m_galOptions.gl_antialiasing_mode = UTIL::GetValFromConfig( - aaModeSelectMap, m_choiceAntialiasing->GetSelection() ); - m_galOptions.m_gridStyle = UTIL::GetValFromConfig( gridStyleSelectMap, m_gridStyle->GetSelection() ); diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 6e5e12e18b..bbf5d44f63 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -71,6 +71,8 @@ set( EESCHEMA_DLGS dialogs/dialog_sch_sheet_props_base.cpp dialogs/dialog_schematic_find.cpp dialogs/dialog_schematic_find_base.cpp + dialogs/dialog_set_grid.cpp + dialogs/dialog_set_grid_base.cpp dialogs/dialog_symbol_remap.cpp dialogs/dialog_symbol_remap_base.cpp dialogs/dialog_update_fields.cpp diff --git a/eeschema/dialogs/dialog_set_grid.cpp b/eeschema/dialogs/dialog_set_grid.cpp new file mode 100644 index 0000000000..e7715822a1 --- /dev/null +++ b/eeschema/dialogs/dialog_set_grid.cpp @@ -0,0 +1,91 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2018 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 + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include +#include +#include +#include +#include +#include + + + +class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE +{ + SCH_BASE_FRAME* m_frame; + +public: + DIALOG_SET_GRID( SCH_BASE_FRAME* aParent ); + + bool TransferDataFromWindow() override; + bool TransferDataToWindow() override; +}; + + +DIALOG_SET_GRID::DIALOG_SET_GRID( SCH_BASE_FRAME* aParent ): + DIALOG_SET_GRID_BASE( aParent ), + m_frame( aParent ) +{ + m_sdbSizerOK->SetDefault(); + + FinishDialogSettings(); +} + + +bool DIALOG_SET_GRID::TransferDataToWindow() +{ + const GRIDS& gridSizes = m_frame->GetScreen()->GetGrids(); + + for( size_t i = 0; i < gridSizes.size(); i++ ) + { + m_choiceGridSize->Append( wxString::Format( wxT( "%0.1f" ), gridSizes[i].m_Size.x ) ); + + if( gridSizes[i].m_CmdId == m_frame->GetScreen()->GetGridCmdId() ) + m_choiceGridSize->SetSelection( (int) i ); + } + + return true; +} + + +bool DIALOG_SET_GRID::TransferDataFromWindow() +{ + const GRIDS& gridSizes = m_frame->GetScreen()->GetGrids(); + wxRealPoint gridSize = gridSizes[ (size_t) m_choiceGridSize->GetSelection() ].m_Size; + m_frame->SetLastGridSizeId( m_frame->GetScreen()->SetGrid( gridSize ) ); + + m_frame->GetCanvas()->GetView()->GetGAL()->SetGridSize( VECTOR2D( gridSize ) ); + m_frame->GetCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); + + return true; +} + + +void SCH_BASE_FRAME::OnGridSettings( wxCommandEvent& aEvent ) +{ + DIALOG_SET_GRID dlg( this ); + + dlg.ShowModal(); +} diff --git a/eeschema/dialogs/dialog_set_grid_base.cpp b/eeschema/dialogs/dialog_set_grid_base.cpp new file mode 100644 index 0000000000..159b4dfceb --- /dev/null +++ b/eeschema/dialogs/dialog_set_grid_base.cpp @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 30 2017) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_set_grid_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxFlexGridSizer* fgSizer32; + fgSizer32 = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgSizer32->AddGrowableCol( 1 ); + fgSizer32->SetFlexibleDirection( wxBOTH ); + fgSizer32->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText3 = new wxStaticText( this, wxID_ANY, _("&Grid size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText3->Wrap( -1 ); + fgSizer32->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + wxArrayString m_choiceGridSizeChoices; + m_choiceGridSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceGridSizeChoices, 0 ); + m_choiceGridSize->SetSelection( 0 ); + fgSizer32->Add( m_choiceGridSize, 0, wxEXPAND|wxLEFT, 5 ); + + m_units = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); + m_units->Wrap( -1 ); + fgSizer32->Add( m_units, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + + bSizerMain->Add( fgSizer32, 1, wxEXPAND|wxALL, 15 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); + + // Connect Events + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SET_GRID_BASE::OnInitDlg ) ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_SET_GRID_BASE::~DIALOG_SET_GRID_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SET_GRID_BASE::OnInitDlg ) ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this ); + +} diff --git a/eeschema/dialogs/dialog_set_grid_base.fbp b/eeschema/dialogs/dialog_set_grid_base.fbp new file mode 100644 index 0000000000..380451173b --- /dev/null +++ b/eeschema/dialogs/dialog_set_grid_base.fbp @@ -0,0 +1,478 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_set_grid_base + 1000 + none + 1 + dialog_set_grid + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_SET_GRID_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE + DIALOG_SHIM; dialog_shim.h + Grid Settings + + + + + + + + + + + + + + + + + + + + OnInitDlg + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 15 + wxEXPAND|wxALL + 1 + + 3 + wxBOTH + 1 + + 0 + -1,-1 + fgSizer32 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Grid size: + + 0 + + + 0 + + 1 + m_staticText3 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceGridSize + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + + 0 + + + 0 + + 1 + m_units + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; forward_declare + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/eeschema/dialogs/dialog_set_grid_base.h b/eeschema/dialogs/dialog_set_grid_base.h new file mode 100644 index 0000000000..35a8140850 --- /dev/null +++ b/eeschema/dialogs/dialog_set_grid_base.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 30 2017) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_SET_GRID_BASE_H__ +#define __DIALOG_SET_GRID_BASE_H__ + +#include +#include +#include +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_SET_GRID_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_SET_GRID_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticText3; + wxChoice* m_choiceGridSize; + wxStaticText* m_units; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~DIALOG_SET_GRID_BASE(); + +}; + +#endif //__DIALOG_SET_GRID_BASE_H__ diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp index 1075341d00..cbf4f33ed9 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options.cpp @@ -29,27 +29,23 @@ #include #include #include +#include PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ) : PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( aWindow ), m_frame( aFrame ) -{} +{ + KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_frame->GetGalDisplayOptions(); + m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions ); + + m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 ); +} bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow() { - const GRIDS& gridSizes = m_frame->GetScreen()->GetGrids(); - - for( size_t i = 0; i < gridSizes.size(); i++ ) - { - m_choiceGridSize->Append( wxString::Format( wxT( "%0.1f" ), gridSizes[i].m_Size.x ) ); - - if( gridSizes[i].m_CmdId == m_frame->GetScreen()->GetGridCmdId() ) - m_choiceGridSize->SetSelection( (int) i ); - } - // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1" int refStyleSelection; @@ -66,10 +62,10 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow() m_busWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultBusThickness(), false, true ) ); m_lineWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultLineThickness(), false, true ) ); - m_checkShowGrid->SetValue( m_frame->IsGridVisible() ); m_checkShowHiddenPins->SetValue( m_frame->GetShowAllPins() ); m_checkPageLimits->SetValue( m_frame->ShowPageLimits() ); - m_footprintPreview->SetValue( m_frame->GetFootprintPreview() ); + + m_galOptsPanel->TransferDataToWindow(); return true; } @@ -77,11 +73,6 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow() bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow() { - const GRIDS& gridSizes = m_frame->GetScreen()->GetGrids(); - wxRealPoint gridsize = gridSizes[ (size_t) m_choiceGridSize->GetSelection() ].m_Size; - m_frame->SetLastGridSizeId( m_frame->GetScreen()->SetGrid( gridsize ) ); - m_frame->SetGridVisibility( m_checkShowGrid->GetValue() ); - // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1" int firstRefId, refSeparator; @@ -108,13 +99,14 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow() SetDefaultLineThickness( ValueFromString( INCHES, m_lineWidthCtrl->GetValue(), true ) ); m_frame->SetShowAllPins( m_checkShowHiddenPins->GetValue() ); m_frame->SetShowPageLimits( m_checkPageLimits->GetValue() ); - m_frame->SetFootprintPreview( m_footprintPreview->GetValue() ); // Update canvas m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue(); m_frame->GetCanvas()->GetView()->MarkDirty(); m_frame->GetCanvas()->Refresh(); + m_galOptsPanel->TransferDataFromWindow(); + return true; } diff --git a/eeschema/dialogs/panel_eeschema_display_options.h b/eeschema/dialogs/panel_eeschema_display_options.h index 2ad4ad2bc8..ca83c64a2f 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.h +++ b/eeschema/dialogs/panel_eeschema_display_options.h @@ -23,11 +23,14 @@ #include "panel_eeschema_display_options_base.h" class SCH_EDIT_FRAME; +class GAL_OPTIONS_PANEL; class PANEL_EESCHEMA_DISPLAY_OPTIONS : public PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE { - SCH_EDIT_FRAME* m_frame; + SCH_EDIT_FRAME* m_frame; + + GAL_OPTIONS_PANEL* m_galOptsPanel; public: PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.cpp b/eeschema/dialogs/panel_eeschema_display_options_base.cpp index 5d4713cd33..14f2b1034b 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.cpp @@ -12,10 +12,15 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) { wxBoxSizer* bPanelSizer; - bPanelSizer = new wxBoxSizer( wxVERTICAL ); + bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* bLeftColumn; - bLeftColumn = new wxBoxSizer( wxVERTICAL ); + m_galOptionsSizer = new wxBoxSizer( wxVERTICAL ); + + + bPanelSizer->Add( m_galOptionsSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bRightColumn; + bRightColumn = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* fgSizer32; fgSizer32 = new wxFlexGridSizer( 0, 3, 0, 0 ); @@ -23,19 +28,6 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind fgSizer32->SetFlexibleDirection( wxBOTH ); fgSizer32->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticText3 = new wxStaticText( this, wxID_ANY, _("&Grid size:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText3->Wrap( -1 ); - fgSizer32->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - wxArrayString m_choiceGridSizeChoices; - m_choiceGridSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceGridSizeChoices, 0 ); - m_choiceGridSize->SetSelection( 0 ); - fgSizer32->Add( m_choiceGridSize, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - m_staticGridUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticGridUnits->Wrap( -1 ); - fgSizer32->Add( m_staticGridUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - fgSizer32->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); @@ -76,7 +68,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 ); - m_staticText26 = new wxStaticText( this, wxID_ANY, _("&Part ID notation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText26 = new wxStaticText( this, wxID_ANY, _("Symbol unit notation:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText26->Wrap( -1 ); fgSizer32->Add( m_staticText26, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); @@ -90,32 +82,23 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 ); - bLeftColumn->Add( fgSizer32, 0, wxBOTTOM|wxRIGHT, 5 ); + bRightColumn->Add( fgSizer32, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 5 ); wxBoxSizer* bSizer92; bSizer92 = new wxBoxSizer( wxVERTICAL ); - m_checkShowGrid = new wxCheckBox( this, wxID_ANY, _("&Show grid"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer92->Add( m_checkShowGrid, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_checkShowHiddenPins = new wxCheckBox( this, wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer92->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizer92->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 ); m_checkPageLimits = new wxCheckBox( this, wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkPageLimits->SetValue(true); bSizer92->Add( m_checkPageLimits, 0, wxEXPAND|wxALL, 5 ); - bSizer92->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - m_footprintPreview = new wxCheckBox( this, wxID_ANY, _("Show footprint previews in symbol chooser (experimental)"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer92->Add( m_footprintPreview, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + bRightColumn->Add( bSizer92, 0, wxTOP|wxRIGHT, 5 ); - bLeftColumn->Add( bSizer92, 0, wxTOP|wxRIGHT, 5 ); - - - bPanelSizer->Add( bLeftColumn, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bPanelSizer->Add( bRightColumn, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); this->SetSizer( bPanelSizer ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.fbp b/eeschema/dialogs/panel_eeschema_display_options_base.fbp index ce64db2f7f..01e3c6fc41 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.fbp @@ -81,20 +81,31 @@ bPanelSizer - wxVERTICAL + wxHORIZONTAL none 5 wxEXPAND|wxRIGHT|wxLEFT - 0 + 1 - bLeftColumn + m_galOptionsSizer + wxVERTICAL + protected + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 1 + + + bRightColumn wxVERTICAL none 5 - wxBOTTOM|wxRIGHT + wxBOTTOM|wxRIGHT|wxEXPAND 0 3 @@ -108,260 +119,6 @@ none 0 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Grid size: - - 0 - - - 0 - - 1 - m_staticText3 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_choiceGridSize - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_staticGridUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxEXPAND|wxTOP|wxBOTTOM @@ -968,7 +725,7 @@ 0 0 wxID_ANY - &Part ID notation: + Symbol unit notation: 0 @@ -1130,95 +887,7 @@ none 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Show grid - - 0 - - - 0 - - 1 - m_checkShowGrid - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 1 @@ -1392,104 +1061,6 @@ - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show footprint previews in symbol chooser (experimental) - - 0 - - - 0 - - 1 - m_footprintPreview - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.h b/eeschema/dialogs/panel_eeschema_display_options_base.h index 7cb492c206..c8d8e9870f 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.h +++ b/eeschema/dialogs/panel_eeschema_display_options_base.h @@ -11,15 +11,15 @@ #include #include #include +#include +#include #include #include -#include #include #include #include -#include #include -#include +#include #include #include @@ -33,9 +33,7 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel private: protected: - wxStaticText* m_staticText3; - wxChoice* m_choiceGridSize; - wxStaticText* m_staticGridUnits; + wxBoxSizer* m_galOptionsSizer; wxStaticText* m_busWidthLabel; wxTextCtrl* m_busWidthCtrl; wxStaticText* m_busWidthUnits; @@ -44,10 +42,8 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel wxStaticText* m_lineWidthUnits; wxStaticText* m_staticText26; wxChoice* m_choiceSeparatorRefId; - wxCheckBox* m_checkShowGrid; wxCheckBox* m_checkShowHiddenPins; wxCheckBox* m_checkPageLimits; - wxCheckBox* m_footprintPreview; public: diff --git a/eeschema/dialogs/panel_eeschema_settings.cpp b/eeschema/dialogs/panel_eeschema_settings.cpp index b845ff2f65..6727fdbb85 100644 --- a/eeschema/dialogs/panel_eeschema_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_settings.cpp @@ -45,6 +45,8 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow() m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() ); m_checkHVOrientation->SetValue( m_frame->GetForceHVLines() ); + m_footprintPreview->SetValue( m_frame->GetFootprintPreview() ); + m_checkAutoplaceFields->SetValue( m_frame->GetAutoplaceFields() ); m_checkAutoplaceJustify->SetValue( m_frame->GetAutoplaceJustify() ); m_checkAutoplaceAlign->SetValue( m_frame->GetAutoplaceAlign() ); @@ -70,6 +72,8 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow() m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() ); m_frame->SetForceHVLines( m_checkHVOrientation->GetValue() ); + m_frame->SetFootprintPreview( m_footprintPreview->GetValue() ); + m_frame->SetAutoplaceFields( m_checkAutoplaceFields->GetValue() ); m_frame->SetAutoplaceJustify( m_checkAutoplaceJustify->GetValue() ); m_frame->SetAutoplaceAlign( m_checkAutoplaceAlign->GetValue() ); diff --git a/eeschema/dialogs/panel_eeschema_settings_base.cpp b/eeschema/dialogs/panel_eeschema_settings_base.cpp index 5a342d8151..839d93f76d 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.cpp +++ b/eeschema/dialogs/panel_eeschema_settings_base.cpp @@ -94,23 +94,29 @@ PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wx m_checkHVOrientation = new wxCheckBox( this, wxID_ANY, _("&Restrict buses and wires to H and V orientation"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer9->Add( m_checkHVOrientation, 0, wxEXPAND|wxALL, 5 ); - - bSizer9->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - m_checkAutoplaceFields = new wxCheckBox( this, wxID_ANY, _("A&utomatically place symbol fields"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_checkAutoplaceFields, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_checkAutoplaceJustify = new wxCheckBox( this, wxID_ANY, _("A&llow field autoplace to change justification"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_checkAutoplaceJustify, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_checkAutoplaceAlign = new wxCheckBox( this, wxID_ANY, _("Al&ways align autoplaced fields to the 50 mil grid"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_checkAutoplaceAlign, 0, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 ); + m_footprintPreview = new wxCheckBox( this, wxID_ANY, _("Show footprint previews in symbol chooser"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( m_footprintPreview, 0, wxALL, 5 ); bLeftColumn->Add( bSizer9, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbol Field Automatic Placement") ), wxVERTICAL ); - bPanelSizer->Add( bLeftColumn, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_checkAutoplaceFields = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("A&utomatically place symbol fields"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_checkAutoplaceFields, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_checkAutoplaceJustify = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("A&llow field autoplace to change justification"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_checkAutoplaceJustify, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_checkAutoplaceAlign = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Al&ways align autoplaced fields to the 50 mil grid"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_checkAutoplaceAlign, 0, wxEXPAND|wxALL, 5 ); + + + bLeftColumn->Add( sbSizer1, 0, wxTOP|wxEXPAND, 5 ); + + + bPanelSizer->Add( bLeftColumn, 0, wxRIGHT|wxLEFT, 5 ); this->SetSizer( bPanelSizer ); diff --git a/eeschema/dialogs/panel_eeschema_settings_base.fbp b/eeschema/dialogs/panel_eeschema_settings_base.fbp index 5a8d406033..37af128a30 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.fbp +++ b/eeschema/dialogs/panel_eeschema_settings_base.fbp @@ -85,7 +85,7 @@ none 5 - wxEXPAND|wxRIGHT|wxLEFT + wxRIGHT|wxLEFT 0 @@ -1342,17 +1342,110 @@ 5 - wxEXPAND|wxTOP|wxBOTTOM - 1 - - 0 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show footprint previews in symbol chooser + + 0 + + + 0 + + 1 + m_footprintPreview + 1 + + protected - 0 + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxEXPAND + 0 + + wxID_ANY + Symbol Field Automatic Placement + + sbSizer1 + wxVERTICAL + 1 + none + 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -1528,7 +1621,7 @@ 5 - wxEXPAND|wxLEFT|wxTOP|wxRIGHT + wxEXPAND|wxALL 0 1 diff --git a/eeschema/dialogs/panel_eeschema_settings_base.h b/eeschema/dialogs/panel_eeschema_settings_base.h index ccc65c2425..dca10837c9 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.h +++ b/eeschema/dialogs/panel_eeschema_settings_base.h @@ -22,6 +22,7 @@ #include #include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -53,6 +54,7 @@ class PANEL_EESCHEMA_SETTINGS_BASE : public wxPanel wxStaticText* m_staticText16; wxSpinCtrl* m_spinRepeatLabel; wxCheckBox* m_checkHVOrientation; + wxCheckBox* m_footprintPreview; wxCheckBox* m_checkAutoplaceFields; wxCheckBox* m_checkAutoplaceJustify; wxCheckBox* m_checkAutoplaceAlign; diff --git a/eeschema/eeschema_id.h b/eeschema/eeschema_id.h index 886b081bee..30818ee164 100644 --- a/eeschema/eeschema_id.h +++ b/eeschema/eeschema_id.h @@ -68,6 +68,7 @@ enum id_eeschema_frm ID_EDIT_SYM_LIB_TABLE, ID_REMAP_SYMBOLS, ID_EDIT_COMPONENTS_TO_SYMBOLS_LIB_ID, + ID_GRID_SETTINGS, /* Schematic editor horizontal toolbar IDs */ ID_HIERARCHY, diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 09b7e6709d..f38a88d4ed 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -191,6 +191,10 @@ void prepareViewMenu( wxMenu* aParentMenu ) _( "Show &Grid" ), wxEmptyString, KiBitmap( grid_xpm ), wxITEM_CHECK ); + AddMenuItem( aParentMenu, ID_GRID_SETTINGS, + _( "Grid Settings..." ), wxEmptyString, + KiBitmap( grid_xpm ) ); + // Units submenu wxMenu* unitsSubMenu = new wxMenu; AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_INCH, diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index f7084e4442..0dd27ba336 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -156,6 +156,8 @@ public: } void SetGridOrigin( const wxPoint& aPoint ) override {} + void OnGridSettings( wxCommandEvent& aEvent ); + // Virtual from EDA_DRAW_FRAME // the background color of the draw canvas: COLOR4D GetDrawBgColor() const override; diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index e83fd00e91..193fcb236a 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -294,6 +294,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) + EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) // Tools and buttons for vertical toolbar. EVT_TOOL( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnSelectTool ) diff --git a/eeschema/widgets/symbol_preview_widget.cpp b/eeschema/widgets/symbol_preview_widget.cpp index 9363638a3d..7364a3d544 100644 --- a/eeschema/widgets/symbol_preview_widget.cpp +++ b/eeschema/widgets/symbol_preview_widget.cpp @@ -37,7 +37,8 @@ SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway ) m_statusSizer( nullptr ), m_previewItem( nullptr ) { - m_galDisplayOptions.ReadConfig( Pgm().CommonSettings(), GAL_DISPLAY_OPTIONS_KEY ); + wxConfigBase* eeschemaConfig = GetNewConfig( wxString::FromUTF8( "eeschema" ) ); + m_galDisplayOptions.ReadConfig( eeschemaConfig, GAL_DISPLAY_OPTIONS_KEY ); m_preview = new SCH_PREVIEW_PANEL( aParent, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ), m_galDisplayOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ); diff --git a/include/pgm_base.h b/include/pgm_base.h index 3fd69ba555..c754c8cf3b 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -50,6 +50,7 @@ #define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" ) #define FILE_HISTORY_SIZE_KEY wxT( "FileHistorySize" ) #define GAL_DISPLAY_OPTIONS_KEY wxT( "GalDisplayOptions" ) +#define GAL_ANTIALIASING_MODE_KEY wxT( "OpenGLAntialiasingMode" ) ///@} diff --git a/include/widgets/gal_options_panel.h b/include/widgets/gal_options_panel.h index d94c5753c5..18cb4a3bbc 100644 --- a/include/widgets/gal_options_panel.h +++ b/include/widgets/gal_options_panel.h @@ -51,8 +51,6 @@ private: wxBoxSizer* m_mainSizer; - wxChoice* m_choiceAntialiasing; - wxRadioBox* m_gridStyle; wxStaticText* l_gridLineWidth;