From ddb141ff0886ddc78f704f2311dc6bd5aeda80ba Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 4 Sep 2023 11:32:13 +0200 Subject: [PATCH] GAL_OPTIONS_PANEL: replace 2 wxSpinCtrlDouble to try to fix a locale issue. Sometimes the grid thickness setting does not work, depending on some locale setting. Core developers are not able to reproduce this issue related to a double conversion. So these wxSpinCtrlDouble are replaced by a wxSpinCtrl (using ints) and a wxChoice. --- common/CMakeLists.txt | 1 + common/widgets/gal_options_panel.cpp | 176 +--- common/widgets/gal_options_panel_base.cpp | 122 +++ common/widgets/gal_options_panel_base.fbp | 1118 +++++++++++++++++++++ common/widgets/gal_options_panel_base.h | 62 ++ include/widgets/gal_options_panel.h | 29 +- 6 files changed, 1340 insertions(+), 168 deletions(-) create mode 100644 common/widgets/gal_options_panel_base.cpp create mode 100644 common/widgets/gal_options_panel_base.fbp create mode 100644 common/widgets/gal_options_panel_base.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5953bf6855..ae865fb52e 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -179,6 +179,7 @@ set( COMMON_WIDGET_SRCS widgets/footprint_preview_widget.cpp widgets/footprint_select_widget.cpp widgets/gal_options_panel.cpp + widgets/gal_options_panel_base.cpp widgets/grid_bitmap_toggle.cpp widgets/grid_button.cpp widgets/grid_color_swatch_helpers.cpp diff --git a/common/widgets/gal_options_panel.cpp b/common/widgets/gal_options_panel.cpp index 4e3e3e75e2..c573ba7d6c 100644 --- a/common/widgets/gal_options_panel.cpp +++ b/common/widgets/gal_options_panel.cpp @@ -45,9 +45,9 @@ static const double gridThicknessMin = 1.0; static const double gridThicknessMax = 10.0; static const double gridThicknessStep = 0.5; -static const double gridMinSpacingMin = 5; -static const double gridMinSpacingMax = 200; -static const double gridMinSpacingStep = 5; +static const int gridMinSpacingMin = 5; +static const int gridMinSpacingMax = 200; +static const int gridMinSpacingStep = 5; ///TODO: These are duplicated in gal_display_options - Unify! @@ -68,153 +68,40 @@ static const UTIL::CFG_MAP gridSnapConfigVals = GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, APP_SETTINGS_BASE* aAppSettings ) : - wxPanel( aParent, wxID_ANY ), + GAL_OPTIONS_PANEL_BASE( aParent ), m_cfg( aAppSettings ) { - // the main sizer that holds "columns" of settings - m_mainSizer = new wxBoxSizer( wxHORIZONTAL ); - SetSizer( m_mainSizer ); + // Rendering engine +#ifdef __WXMAC__ + // On MAC, Cairo render does not work. + m_renderingEngine->Hide(); +#endif + m_renderingEngine->SetItemToolTip( 0, _( "Hardware-accelerated graphics (recommended)" ) ); + m_renderingEngine->SetItemToolTip( 1, _( "Software graphics (for computers which do not " + "support KiCad's hardware acceleration " + "requirements)" ) ); - // second-level sizers that are one "column" of settings each - wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL ); - m_mainSizer->Add( sLeftSizer, 1, wxRIGHT | wxBOTTOM | wxEXPAND, 5 ); + // Grid settings subpanel +#if 0 + m_gridLineWidth->SetRange( gridThicknessMin, gridThicknessMax ); + m_gridLineWidth->SetIncrement( gridThicknessStep ); +#else + int selection = 0; // default selection - /* - * Rendering engine - */ -#ifndef __WXMAC__ + for( double size = gridThicknessMin; size <= gridThicknessMax; size += gridThicknessStep ) { - wxString engineChoices[] = { _( "Accelerated graphics" ), _( "Fallback graphics" ) }; - m_renderingEngine = new wxRadioBox( this, wxID_ANY, _( "Rendering Engine" ), - wxDefaultPosition, wxDefaultSize, - sizeof( engineChoices ) / sizeof( wxString ), - engineChoices, 1, wxRA_SPECIFY_COLS ); - m_renderingEngine->SetItemToolTip( 0, _( "Hardware-accelerated graphics (recommended)" ) ); - m_renderingEngine->SetItemToolTip( 1, _( "Software graphics (for computers which do not " - "support KiCad's hardware acceleration " - "requirements)" ) ); + m_gridThicknessList.push_back( size ); + m_gridLineWidth->Append( wxString::Format( wxT( "%.1f" ), size ) ); - sLeftSizer->Add( m_renderingEngine, 0, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, 5 ); + if( m_cfg->m_Window.grid.line_width == size ) + selection = m_gridLineWidth->GetCount() - 1; } + + m_gridLineWidth->SetSelection( selection ); #endif - /* - * Grid settings subpanel - */ - { - wxStaticText* gridLabel = new wxStaticText( this, wxID_ANY, _( "Grid Options" ) ); - sLeftSizer->Add( gridLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 ); - - wxStaticLine* staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, - wxDefaultSize, wxLI_HORIZONTAL ); - sLeftSizer->Add( staticline1, 0, wxEXPAND|wxBOTTOM, 5 ); - - wxBoxSizer* sGridSettings = new wxBoxSizer( wxVERTICAL ); - - wxString m_gridStyleChoices[] = { - _( "Dots" ), - _( "Lines" ), - _( "Small crosses" ) - }; - - int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString ); - m_gridStyle = new wxRadioBox( this, wxID_ANY, _( "Grid Style" ), wxDefaultPosition, - wxDefaultSize, m_gridStyleNChoices, m_gridStyleChoices, 1, - wxRA_SPECIFY_COLS ); - sGridSettings->Add( m_gridStyle, 0, wxALL | wxEXPAND, 5 ); - - wxFlexGridSizer* sGridSettingsGrid; - sGridSettingsGrid = new wxFlexGridSizer( 0, 3, 0, 0 ); - sGridSettingsGrid->AddGrowableCol( 1 ); - sGridSettingsGrid->SetFlexibleDirection( wxBOTH ); - sGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - l_gridLineWidth = new wxStaticText( this, wxID_ANY, _( "Grid thickness:" ) ); - l_gridLineWidth->Wrap( -1 ); - sGridSettingsGrid->Add( l_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxTOP, 5 ); - - m_gridLineWidth = new wxSpinCtrlDouble( this, wxID_ANY ); - m_gridLineWidth->SetRange( gridThicknessMin, gridThicknessMax ); - m_gridLineWidth->SetIncrement( gridThicknessStep ); - m_gridLineWidth->SetDigits( 1 ); - sGridSettingsGrid->Add( m_gridLineWidth, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, 5 ); - - l_gridLineWidthUnits = new wxStaticText( this, wxID_ANY, _( "px" ) ); - l_gridLineWidthUnits->Wrap( -1 ); - sGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT | wxTOP, 5 ); - - l_gridMinSpacing = new wxStaticText( this, wxID_ANY, _( "Min grid spacing:" ) ); - l_gridMinSpacing->Wrap( -1 ); - sGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxTOP, 5 ); - - m_gridMinSpacing = new wxSpinCtrlDouble( this, wxID_ANY); - m_gridMinSpacing->SetRange( gridMinSpacingMin, gridMinSpacingMax ); - m_gridMinSpacing->SetIncrement( gridMinSpacingStep ); - m_gridMinSpacing->SetDigits( 0 ); - sGridSettingsGrid->Add( m_gridMinSpacing, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, 5 ); - - l_gridMinSpacingUnits = new wxStaticText( this, wxID_ANY, _( "px" ) ); - l_gridMinSpacingUnits->Wrap( -1 ); - sGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT | wxTOP, 5 ); - - l_gridSnapOptions = new wxStaticText( this, wxID_ANY, _( "Snap to grid:" ) ); - l_gridSnapOptions->Wrap( -1 ); - sGridSettingsGrid->Add( l_gridSnapOptions, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxTOP, 5 ); - - wxString gridSnapChoices[] = { _( "Always" ), _( "When grid shown" ), _( "Never" ) }; - int gridSnapNChoices = sizeof( gridSnapChoices ) / sizeof( wxString ); - m_gridSnapOptions = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - gridSnapNChoices, gridSnapChoices ); - m_gridSnapOptions->Select( 0 ); - sGridSettingsGrid->Add( m_gridSnapOptions, 0, - wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP | wxBOTTOM, 5 ); - - l_gridSnapSpace = new wxStaticText( this, wxID_ANY, _( "px" ) ); - l_gridSnapSpace->Wrap( -1 ); - l_gridSnapSpace->Hide(); - sGridSettingsGrid->Add( l_gridSnapSpace, 0, - wxALIGN_CENTER_VERTICAL | wxALL | wxRESERVE_SPACE_EVEN_IF_HIDDEN, - 5 ); - - - sGridSettings->Add( sGridSettingsGrid, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 ); - - sLeftSizer->Add( sGridSettings, 0, wxEXPAND|wxLEFT, 5 ); - } - - /* - * Cursor settings subpanel - */ - { - sLeftSizer->Add( 0, 15, 0, wxEXPAND, 5 ); - - wxStaticText* gridLabel = new wxStaticText( this, wxID_ANY, _( "Cursor Options" ) ); - sLeftSizer->Add( gridLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 ); - - wxStaticLine* staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, - wxDefaultSize, wxLI_HORIZONTAL ); - sLeftSizer->Add( staticline2, 0, wxEXPAND|wxBOTTOM, 5 ); - - wxBoxSizer* sCursorSettings = new wxBoxSizer( wxVERTICAL ); - sLeftSizer->Add( sCursorSettings, 0, wxEXPAND|wxLEFT, 5 ); - - wxString m_CursorShapeChoices[] = { - _( "Small crosshair" ), - _( "Full window crosshair" ) - }; - - int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString ); - m_cursorShape = new wxRadioBox( this, wxID_ANY, _( "Cursor Shape" ), wxDefaultPosition, - wxDefaultSize, m_CursorShapeNChoices, m_CursorShapeChoices, - 1, wxRA_SPECIFY_COLS ); - - m_cursorShape->SetSelection( 0 ); - m_cursorShape->SetToolTip( _( "Cursor shape for drawing, placement and movement tools" ) ); - sCursorSettings->Add( m_cursorShape, 0, wxALL | wxEXPAND, 5 ); - - m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always show crosshairs" ) ); - sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 ); - } + m_gridMinSpacing->SetRange( gridMinSpacingMin, gridMinSpacingMax ); + m_gridMinSpacing->SetIncrement( gridMinSpacingStep ); } @@ -231,7 +118,7 @@ bool GAL_OPTIONS_PANEL::TransferDataToWindow() m_gridSnapOptions->SetSelection( m_cfg->m_Window.grid.snap ); m_gridStyle->SetSelection( m_cfg->m_Window.grid.style ); - m_gridLineWidth->SetValue( m_cfg->m_Window.grid.line_width ); + m_gridMinSpacing->SetValue( m_cfg->m_Window.grid.min_spacing ); m_cursorShape->SetSelection( m_cfg->m_Window.cursor.fullscreen_cursor ); @@ -245,7 +132,10 @@ bool GAL_OPTIONS_PANEL::TransferDataFromWindow() { m_cfg->m_Window.grid.snap = m_gridSnapOptions->GetSelection(); m_cfg->m_Window.grid.style = m_gridStyle->GetSelection(); - m_cfg->m_Window.grid.line_width = m_gridLineWidth->GetValue(); + + if( m_gridLineWidth->GetSelection() >= 0 ) + m_cfg->m_Window.grid.line_width = m_gridThicknessList[ m_gridLineWidth->GetSelection() ]; + m_cfg->m_Window.grid.min_spacing = m_gridMinSpacing->GetValue(); m_cfg->m_Window.cursor.fullscreen_cursor = m_cursorShape->GetSelection(); diff --git a/common/widgets/gal_options_panel_base.cpp b/common/widgets/gal_options_panel_base.cpp new file mode 100644 index 0000000000..b22c8736a3 --- /dev/null +++ b/common/widgets/gal_options_panel_base.cpp @@ -0,0 +1,122 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "gal_options_panel_base.h" + +/////////////////////////////////////////////////////////////////////////// + +GAL_OPTIONS_PANEL_BASE::GAL_OPTIONS_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* mainSizer; + mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* sLeftSizer; + sLeftSizer = new wxBoxSizer( wxVERTICAL ); + + wxString m_renderingEngineChoices[] = { _("Accelerated graphics"), _("Fallback graphics") }; + int m_renderingEngineNChoices = sizeof( m_renderingEngineChoices ) / sizeof( wxString ); + m_renderingEngine = new wxRadioBox( this, wxID_ANY, _("Rendering Engine"), wxDefaultPosition, wxDefaultSize, m_renderingEngineNChoices, m_renderingEngineChoices, 1, wxRA_SPECIFY_COLS ); + m_renderingEngine->SetSelection( 0 ); + sLeftSizer->Add( m_renderingEngine, 0, wxALL, 5 ); + + + mainSizer->Add( sLeftSizer, 0, wxEXPAND, 5 ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Grid Options"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + mainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + mainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + wxString m_gridStyleChoices[] = { _("Dots"), _("Lines"), _("Small crosses") }; + int m_gridStyleNChoices = sizeof( m_gridStyleChoices ) / sizeof( wxString ); + m_gridStyle = new wxRadioBox( this, wxID_ANY, _("Grid Style"), wxDefaultPosition, wxDefaultSize, m_gridStyleNChoices, m_gridStyleChoices, 1, wxRA_SPECIFY_COLS ); + m_gridStyle->SetSelection( 0 ); + mainSizer->Add( m_gridStyle, 0, wxALL, 5 ); + + wxFlexGridSizer* fgGridSettingsGrid; + fgGridSettingsGrid = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgGridSettingsGrid->AddGrowableCol( 1 ); + fgGridSettingsGrid->SetFlexibleDirection( wxBOTH ); + fgGridSettingsGrid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + l_gridLineWidth = new wxStaticText( this, wxID_ANY, _("Grid thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + l_gridLineWidth->Wrap( -1 ); + fgGridSettingsGrid->Add( l_gridLineWidth, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxArrayString m_gridLineWidthChoices; + m_gridLineWidth = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridLineWidthChoices, 0 ); + m_gridLineWidth->SetSelection( 0 ); + fgGridSettingsGrid->Add( m_gridLineWidth, 0, wxALL|wxEXPAND, 5 ); + + l_gridLineWidthUnits = new wxStaticText( this, wxID_ANY, _("px"), wxDefaultPosition, wxDefaultSize, 0 ); + l_gridLineWidthUnits->Wrap( -1 ); + fgGridSettingsGrid->Add( l_gridLineWidthUnits, 0, wxALL, 5 ); + + l_gridMinSpacing = new wxStaticText( this, wxID_ANY, _("Min grid spacing:"), wxDefaultPosition, wxDefaultSize, 0 ); + l_gridMinSpacing->Wrap( -1 ); + fgGridSettingsGrid->Add( l_gridMinSpacing, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_gridMinSpacing = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 5, 200, 10 ); + fgGridSettingsGrid->Add( m_gridMinSpacing, 0, wxALL|wxEXPAND, 5 ); + + l_gridMinSpacingUnits = new wxStaticText( this, wxID_ANY, _("px"), wxDefaultPosition, wxDefaultSize, 0 ); + l_gridMinSpacingUnits->Wrap( -1 ); + fgGridSettingsGrid->Add( l_gridMinSpacingUnits, 0, wxALL, 5 ); + + l_gridSnapOptions = new wxStaticText( this, wxID_ANY, _("Snap to grid:"), wxDefaultPosition, wxDefaultSize, 0 ); + l_gridSnapOptions->Wrap( -1 ); + fgGridSettingsGrid->Add( l_gridSnapOptions, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_gridSnapOptionsChoices[] = { _("Always"), _("When grid shown"), _("Never") }; + int m_gridSnapOptionsNChoices = sizeof( m_gridSnapOptionsChoices ) / sizeof( wxString ); + m_gridSnapOptions = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridSnapOptionsNChoices, m_gridSnapOptionsChoices, 0 ); + m_gridSnapOptions->SetSelection( 0 ); + fgGridSettingsGrid->Add( m_gridSnapOptions, 0, wxALL|wxEXPAND, 5 ); + + + fgGridSettingsGrid->Add( 0, 0, 1, wxEXPAND, 5 ); + + + mainSizer->Add( fgGridSettingsGrid, 0, wxEXPAND, 5 ); + + + mainSizer->Add( 0, 15, 0, 0, 5 ); + + m_stGridLabel = new wxStaticText( this, wxID_ANY, _("Cursor Options"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stGridLabel->Wrap( -1 ); + mainSizer->Add( m_stGridLabel, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + mainSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* sCursorSettings; + sCursorSettings = new wxBoxSizer( wxVERTICAL ); + + wxString m_cursorShapeChoices[] = { _("Small crosshair"), _("Full window crosshair") }; + int m_cursorShapeNChoices = sizeof( m_cursorShapeChoices ) / sizeof( wxString ); + m_cursorShape = new wxRadioBox( this, wxID_ANY, _("Cursor Shape"), wxDefaultPosition, wxDefaultSize, m_cursorShapeNChoices, m_cursorShapeChoices, 1, wxRA_SPECIFY_COLS ); + m_cursorShape->SetSelection( 0 ); + m_cursorShape->SetToolTip( _("Cursor shape for drawing, placement and movement tools") ); + + sCursorSettings->Add( m_cursorShape, 0, wxALL, 5 ); + + m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _("Always show crosshairs"), wxDefaultPosition, wxDefaultSize, 0 ); + sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL, 5 ); + + + mainSizer->Add( sCursorSettings, 1, wxEXPAND, 5 ); + + + this->SetSizer( mainSizer ); + this->Layout(); +} + +GAL_OPTIONS_PANEL_BASE::~GAL_OPTIONS_PANEL_BASE() +{ +} diff --git a/common/widgets/gal_options_panel_base.fbp b/common/widgets/gal_options_panel_base.fbp new file mode 100644 index 0000000000..5d78ac3c15 --- /dev/null +++ b/common/widgets/gal_options_panel_base.fbp @@ -0,0 +1,1118 @@ + + + + + ; + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + gal_options_panel_base + 1000 + none + + + 1 + GAL_OPTIONS_PANEL_BASE_PRJ + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + GAL_OPTIONS_PANEL_BASE + + 387,523 + ; ; forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + mainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + sLeftSizer + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Accelerated graphics" "Fallback graphics" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Rendering Engine + 1 + + 0 + + + 0 + + 1 + m_renderingEngine + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grid Options + 0 + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND | wxALL + 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 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Dots" "Lines" "Small crosses" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grid Style + 1 + + 0 + + + 0 + + 1 + m_gridStyle + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 0 + + 3 + wxBOTH + 1 + + 0 + + fgGridSettingsGrid + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grid thickness: + 0 + + 0 + + + 0 + + 1 + l_gridLineWidth + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_gridLineWidth + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + px + 0 + + 0 + + + 0 + + 1 + l_gridLineWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Min grid spacing: + 0 + + 0 + + + 0 + + 1 + l_gridMinSpacing + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 10 + 200 + + 0 + + 5 + + 0 + + 1 + m_gridMinSpacing + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + px + 0 + + 0 + + + 0 + + 1 + l_gridMinSpacingUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Snap to grid: + 0 + + 0 + + + 0 + + 1 + l_gridSnapOptions + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Always" "When grid shown" "Never" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_gridSnapOptions + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + 5 + + 0 + + 15 + protected + 0 + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Cursor Options + 0 + + 0 + + + 0 + + 1 + m_stGridLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxEXPAND + 1 + + + sCursorSettings + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Small crosshair" "Full window crosshair" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Cursor Shape + 1 + + 0 + + + 0 + + 1 + m_cursorShape + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + ; ; forward_declare + 0 + Cursor shape for drawing, placement and movement tools + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Always show crosshairs + + 0 + + + 0 + + 1 + m_forceCursorDisplay + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + diff --git a/common/widgets/gal_options_panel_base.h b/common/widgets/gal_options_panel_base.h new file mode 100644 index 0000000000..990c585577 --- /dev/null +++ b/common/widgets/gal_options_panel_base.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class GAL_OPTIONS_PANEL_BASE +/////////////////////////////////////////////////////////////////////////////// +class GAL_OPTIONS_PANEL_BASE : public wxPanel +{ + private: + + protected: + wxRadioBox* m_renderingEngine; + wxStaticText* m_staticText1; + wxStaticLine* m_staticline1; + wxRadioBox* m_gridStyle; + wxStaticText* l_gridLineWidth; + wxChoice* m_gridLineWidth; + wxStaticText* l_gridLineWidthUnits; + wxStaticText* l_gridMinSpacing; + wxSpinCtrl* m_gridMinSpacing; + wxStaticText* l_gridMinSpacingUnits; + wxStaticText* l_gridSnapOptions; + wxChoice* m_gridSnapOptions; + wxStaticText* m_stGridLabel; + wxStaticLine* m_staticline2; + wxRadioBox* m_cursorShape; + wxCheckBox* m_forceCursorDisplay; + + public: + + GAL_OPTIONS_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,523 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~GAL_OPTIONS_PANEL_BASE(); + +}; + diff --git a/include/widgets/gal_options_panel.h b/include/widgets/gal_options_panel.h index dcfe378485..e2427ef340 100644 --- a/include/widgets/gal_options_panel.h +++ b/include/widgets/gal_options_panel.h @@ -24,8 +24,7 @@ #ifndef WIDGETS_GAL_OPTIONS_PANEL__H_ #define WIDGETS_GAL_OPTIONS_PANEL__H_ -#include - +#include <../../common/widgets/gal_options_panel_base.h> #include class wxBoxSizer; @@ -37,7 +36,8 @@ class wxStaticText; class EDA_DRAW_FRAME; class APP_SETTINGS_BASE; -class GAL_OPTIONS_PANEL: public wxPanel + +class GAL_OPTIONS_PANEL: public GAL_OPTIONS_PANEL_BASE { public: @@ -56,28 +56,7 @@ public: bool ResetPanel( APP_SETTINGS_BASE* aAppSettings ); private: - wxBoxSizer* m_mainSizer; - -#ifndef __WXMAC__ - wxRadioBox* m_renderingEngine; -#endif - - wxRadioBox* m_gridStyle; - wxStaticText* l_gridLineWidth; - wxSpinCtrlDouble* m_gridLineWidth; - wxStaticText* l_gridLineWidthUnits; - - wxStaticText* l_gridMinSpacing; - wxSpinCtrlDouble* m_gridMinSpacing; - wxStaticText* l_gridMinSpacingUnits; - - wxStaticText* l_gridSnapOptions; - wxChoice* m_gridSnapOptions; - wxStaticText* l_gridSnapSpace; - - wxRadioBox* m_cursorShape; - wxCheckBox* m_forceCursorDisplay; - + std::vector m_gridThicknessList; // List of available grid thickness APP_SETTINGS_BASE* m_cfg; };