diff --git a/common/dialogs/dialog_grid_settings.cpp b/common/dialogs/dialog_grid_settings.cpp index 42f7ccce01..54cc3a7b15 100644 --- a/common/dialogs/dialog_grid_settings.cpp +++ b/common/dialogs/dialog_grid_settings.cpp @@ -55,15 +55,22 @@ DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( wxWindow* aParent, wxWindow* aEventS bool DIALOG_GRID_SETTINGS::TransferDataFromWindow() { double gridX = m_gridSizeX.GetDoubleValue(); - double gridY = m_checkLinked->IsChecked() ? gridX : m_gridSizeY.GetDoubleValue(); - if( gridX <= 0.0f || gridY <= 0.0f ) + if( !m_gridSizeX.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) ) { - wxMessageBox( _( "Grid size must be greater than zero." ), _( "Error" ), - wxOK | wxICON_ERROR ); + wxMessageBox( _( "Grid size X out of range." ), _( "Error" ), wxOK | wxICON_ERROR ); return false; } + if( !m_checkLinked->IsChecked() + && !m_gridSizeY.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) ) + { + wxMessageBox( _( "Grid size Y out of range." ), _( "Error" ), wxOK | wxICON_ERROR ); + return false; + } + + double gridY = m_checkLinked->IsChecked() ? gridX : m_gridSizeY.GetDoubleValue(); + m_grid.name = m_textName->GetValue(); // Grid X/Y are always stored in millimeters so we can compare them easily m_grid.x = EDA_UNIT_UTILS::UI::StringFromValue( m_unitsProvider->GetIuScale(), diff --git a/common/dialogs/panel_grid_settings.cpp b/common/dialogs/panel_grid_settings.cpp index 241bb47f8f..9469d44f97 100644 --- a/common/dialogs/panel_grid_settings.cpp +++ b/common/dialogs/panel_grid_settings.cpp @@ -42,30 +42,20 @@ PANEL_GRID_SETTINGS::PANEL_GRID_SETTINGS( wxWindow* aParent, UNITS_PROVIDER* aUn FRAME_T aFrameType ) : PANEL_GRID_SETTINGS_BASE( aParent ), m_unitsProvider( aUnitsProvider ), m_cfg( aCfg ), m_frameType( aFrameType ), - m_eventSource( aEventSource ), - m_gridOverrideConnected( aUnitsProvider, aEventSource, m_staticTextConnected, - m_GridOverrideConnectedSize, m_staticTextConnectedUnits ), - m_gridOverrideWires( aUnitsProvider, aEventSource, m_staticTextWires, - m_GridOverrideWiresSize, m_staticTextWiresUnits ), - m_gridOverrideVias( aUnitsProvider, aEventSource, m_staticTextVias, m_GridOverrideViasSize, - m_staticTextViasUnits ), - m_gridOverrideText( aUnitsProvider, aEventSource, m_staticTextText, m_GridOverrideTextSize, - m_staticTextTextUnits ), - m_gridOverrideGraphics( aUnitsProvider, aEventSource, m_staticTextGraphics, - m_GridOverrideGraphicsSize, m_staticTextGraphicsUnits ) + m_eventSource( aEventSource ) { RebuildGridSizes(); if( m_frameType == FRAME_PCB_EDITOR || m_frameType == FRAME_FOOTPRINT_EDITOR ) { - m_staticTextConnected->SetLabel( wxT( "Footprints/pads:" ) ); - m_staticTextWires->SetLabel( wxT( "Tracks:" ) ); + m_checkGridOverrideConnected->SetLabel( wxT( "Footprints/pads:" ) ); + m_checkGridOverrideWires->SetLabel( wxT( "Tracks:" ) ); } else { - m_GridOverrideViasSize->SetValue( wxT( "50 mil" ) ); + m_gridOverrideViasChoice->SetSelection( 0 ); + m_gridOverrideViasChoice->Show( false ); m_checkGridOverrideVias->Show( false ); - m_gridOverrideVias.Show( false ); if( m_frameType != FRAME_SCH && m_frameType != FRAME_SCH_SYMBOL_EDITOR @@ -74,10 +64,10 @@ PANEL_GRID_SETTINGS::PANEL_GRID_SETTINGS( wxWindow* aParent, UNITS_PROVIDER* aUn && m_frameType != FRAME_SIMULATOR ) { m_checkGridOverrideConnected->Show( false ); - m_gridOverrideConnected.Show( false ); + m_gridOverrideConnectedChoice->Show( false ); m_checkGridOverrideWires->Show( false ); - m_gridOverrideWires.Show( false ); + m_gridOverrideWiresChoice->Show( false ); } } @@ -106,9 +96,16 @@ void PANEL_GRID_SETTINGS::ResetPanel() void PANEL_GRID_SETTINGS::RebuildGridSizes() { wxString savedCurrentGrid = m_currentGridCtrl->GetStringSelection(); + wxString savedGrid1 = m_grid1Ctrl->GetStringSelection(); wxString savedGrid2 = m_grid2Ctrl->GetStringSelection(); + wxString savedConnectables = m_gridOverrideConnectedChoice->GetStringSelection(); + wxString savedWires = m_gridOverrideWiresChoice->GetStringSelection(); + wxString savedVias = m_gridOverrideViasChoice->GetStringSelection(); + wxString savedText = m_gridOverrideTextChoice->GetStringSelection(); + wxString savedGraphics = m_gridOverrideGraphicsChoice->GetStringSelection(); + wxArrayString grids; wxString msg; EDA_IU_SCALE scale = m_unitsProvider->GetIuScale(); @@ -131,9 +128,16 @@ void PANEL_GRID_SETTINGS::RebuildGridSizes() } m_currentGridCtrl->Set( grids ); + m_grid1Ctrl->Set( grids ); m_grid2Ctrl->Set( grids ); + m_gridOverrideConnectedChoice->Set( grids ); + m_gridOverrideWiresChoice->Set( grids ); + m_gridOverrideViasChoice->Set( grids ); + m_gridOverrideTextChoice->Set( grids ); + m_gridOverrideGraphicsChoice->Set( grids ); + if( !m_currentGridCtrl->SetStringSelection( savedCurrentGrid ) ) m_currentGridCtrl->SetStringSelection( grids.front() ); @@ -142,36 +146,44 @@ void PANEL_GRID_SETTINGS::RebuildGridSizes() if( !m_grid2Ctrl->SetStringSelection( savedGrid2 ) ) m_grid2Ctrl->SetStringSelection( grids.back() ); + + if( !m_gridOverrideConnectedChoice->SetStringSelection( savedConnectables ) ) + m_gridOverrideConnectedChoice->SetStringSelection( grids.front() ); + + if( !m_gridOverrideWiresChoice->SetStringSelection( savedWires ) ) + m_gridOverrideWiresChoice->SetStringSelection( grids.front() ); + + if( !m_gridOverrideViasChoice->SetStringSelection( savedVias ) ) + m_gridOverrideViasChoice->SetStringSelection( grids.front() ); + + if( !m_gridOverrideTextChoice->SetStringSelection( savedText ) ) + m_gridOverrideTextChoice->SetStringSelection( grids.front() ); + + if( !m_gridOverrideGraphicsChoice->SetStringSelection( savedGraphics ) ) + m_gridOverrideGraphicsChoice->SetStringSelection( grids.front() ); } bool PANEL_GRID_SETTINGS::TransferDataFromWindow() { - // Validate new settings - for( UNIT_BINDER* entry : { &m_gridOverrideConnected, &m_gridOverrideWires, - &m_gridOverrideVias, &m_gridOverrideText, &m_gridOverrideGraphics } ) - { - if( !entry->Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) ) - return false; - } - // Apply the new settings GRID_SETTINGS& gridCfg = m_cfg->m_Window.grid; gridCfg.last_size_idx = m_currentGridCtrl->GetSelection(); + gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection(); gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection(); gridCfg.override_connected = m_checkGridOverrideConnected->GetValue(); - gridCfg.override_connected_size = m_unitsProvider->StringFromValue( m_gridOverrideConnected.GetValue(), true ); + gridCfg.override_connected_idx = m_gridOverrideConnectedChoice->GetSelection(); gridCfg.override_wires = m_checkGridOverrideWires->GetValue(); - gridCfg.override_wires_size = m_unitsProvider->StringFromValue( m_gridOverrideWires.GetValue(), true ); + gridCfg.override_wires_idx = m_gridOverrideWiresChoice->GetSelection(); gridCfg.override_vias = m_checkGridOverrideVias->GetValue(); - gridCfg.override_vias_size = m_unitsProvider->StringFromValue( m_gridOverrideVias.GetValue(), true ); + gridCfg.override_vias_idx = m_gridOverrideViasChoice->GetSelection(); gridCfg.override_text = m_checkGridOverrideText->GetValue(); - gridCfg.override_text_size = m_unitsProvider->StringFromValue( m_gridOverrideText.GetValue(), true ); + gridCfg.override_text_idx = m_gridOverrideTextChoice->GetSelection(); gridCfg.override_graphics = m_checkGridOverrideGraphics->GetValue(); - gridCfg.override_graphics_size = m_unitsProvider->StringFromValue( m_gridOverrideGraphics.GetValue(), true ); + gridCfg.override_graphics_idx = m_gridOverrideGraphicsChoice->GetSelection(); return RESETTABLE_PANEL::TransferDataFromWindow(); } @@ -181,24 +193,33 @@ bool PANEL_GRID_SETTINGS::TransferDataToWindow() { GRID_SETTINGS& gridCfg = m_cfg->m_Window.grid; + // lambda that gives us a safe index into grids regardless of config idx + auto safeGrid = [&gridCfg]( int idx ) -> int + { + if( idx < 0 || idx >= (int) gridCfg.grids.size() ) + return 0; + + return idx; + }; + Layout(); - m_currentGridCtrl->SetSelection( gridCfg.last_size_idx ); + m_currentGridCtrl->SetSelection( safeGrid( gridCfg.last_size_idx ) ); - m_gridOverrideConnected.SetValue( m_unitsProvider->ValueFromString( gridCfg.override_connected_size ) ); - m_gridOverrideWires.SetValue( m_unitsProvider->ValueFromString( gridCfg.override_wires_size ) ); - m_gridOverrideVias.SetValue( m_unitsProvider->ValueFromString( gridCfg.override_vias_size ) ); - m_gridOverrideText.SetValue( m_unitsProvider->ValueFromString( gridCfg.override_text_size ) ); - m_gridOverrideGraphics.SetValue( m_unitsProvider->ValueFromString( gridCfg.override_graphics_size ) ); + m_grid1Ctrl->SetSelection( safeGrid( gridCfg.fast_grid_1 ) ); + m_grid2Ctrl->SetSelection( safeGrid( gridCfg.fast_grid_2 ) ); - m_checkGridOverrideConnected->SetValue( gridCfg.override_connected ); - m_checkGridOverrideWires->SetValue( gridCfg.override_wires ); - m_checkGridOverrideVias->SetValue( gridCfg.override_vias ); - m_checkGridOverrideText->SetValue( gridCfg.override_text ); - m_checkGridOverrideGraphics->SetValue( gridCfg.override_graphics ); + m_gridOverrideConnectedChoice->SetSelection( safeGrid( gridCfg.override_connected_idx ) ); + m_gridOverrideWiresChoice->SetSelection( safeGrid( gridCfg.override_wires_idx ) ); + m_gridOverrideViasChoice->SetSelection( safeGrid( gridCfg.override_vias_idx ) ); + m_gridOverrideTextChoice->SetSelection( safeGrid( gridCfg.override_text_idx ) ); + m_gridOverrideGraphicsChoice->SetSelection( safeGrid( gridCfg.override_graphics_idx ) ); - m_grid1Ctrl->SetSelection( gridCfg.fast_grid_1 ); - m_grid2Ctrl->SetSelection( gridCfg.fast_grid_2 ); + m_checkGridOverrideConnected->SetValue( safeGrid( gridCfg.override_connected ) ); + m_checkGridOverrideWires->SetValue( safeGrid( gridCfg.override_wires ) ); + m_checkGridOverrideVias->SetValue( safeGrid( gridCfg.override_vias ) ); + m_checkGridOverrideText->SetValue( safeGrid( gridCfg.override_text ) ); + m_checkGridOverrideGraphics->SetValue( safeGrid( gridCfg.override_graphics ) ); return RESETTABLE_PANEL::TransferDataToWindow(); } diff --git a/common/dialogs/panel_grid_settings_base.cpp b/common/dialogs/panel_grid_settings_base.cpp index 007c96ee62..284c981076 100644 --- a/common/dialogs/panel_grid_settings_base.cpp +++ b/common/dialogs/panel_grid_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -111,90 +111,50 @@ PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID bSizerRightCol->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 ); wxFlexGridSizer* fgGridOverrides; - fgGridOverrides = new wxFlexGridSizer( 5, 4, 4, 0 ); - fgGridOverrides->AddGrowableCol( 2 ); + fgGridOverrides = new wxFlexGridSizer( 0, 2, 4, 0 ); + fgGridOverrides->AddGrowableCol( 1 ); fgGridOverrides->SetFlexibleDirection( wxBOTH ); fgGridOverrides->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_checkGridOverrideConnected = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideConnected, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT, 8 ); + m_checkGridOverrideConnected = new wxCheckBox( this, wxID_ANY, _("Connected items:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgGridOverrides->Add( m_checkGridOverrideConnected, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 ); - m_staticTextConnected = new wxStaticText( this, wxID_ANY, _("Connected items:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextConnected->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextConnected, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT, 5 ); + wxArrayString m_gridOverrideConnectedChoiceChoices; + m_gridOverrideConnectedChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideConnectedChoiceChoices, 0 ); + m_gridOverrideConnectedChoice->SetSelection( 0 ); + fgGridOverrides->Add( m_gridOverrideConnectedChoice, 0, wxALL, 5 ); - m_GridOverrideConnectedSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_GridOverrideConnectedSize->SetMinSize( wxSize( 80,-1 ) ); + m_checkGridOverrideWires = new wxCheckBox( this, wxID_ANY, _("Wires:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgGridOverrides->Add( m_checkGridOverrideWires, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 ); - fgGridOverrides->Add( m_GridOverrideConnectedSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + wxArrayString m_gridOverrideWiresChoiceChoices; + m_gridOverrideWiresChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideWiresChoiceChoices, 0 ); + m_gridOverrideWiresChoice->SetSelection( 0 ); + fgGridOverrides->Add( m_gridOverrideWiresChoice, 0, wxALL, 5 ); - m_staticTextConnectedUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextConnectedUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextConnectedUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_checkGridOverrideVias = new wxCheckBox( this, wxID_ANY, _("Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgGridOverrides->Add( m_checkGridOverrideVias, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 ); - m_checkGridOverrideWires = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideWires, 0, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxLEFT, 8 ); + wxArrayString m_gridOverrideViasChoiceChoices; + m_gridOverrideViasChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideViasChoiceChoices, 0 ); + m_gridOverrideViasChoice->SetSelection( 0 ); + fgGridOverrides->Add( m_gridOverrideViasChoice, 0, wxALL, 5 ); - m_staticTextWires = new wxStaticText( this, wxID_ANY, _("Wires:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextWires->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextWires, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + m_checkGridOverrideText = new wxCheckBox( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgGridOverrides->Add( m_checkGridOverrideText, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 ); - m_GridOverrideWiresSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_GridOverrideWiresSize->SetMinSize( wxSize( 80,-1 ) ); + wxArrayString m_gridOverrideTextChoiceChoices; + m_gridOverrideTextChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideTextChoiceChoices, 0 ); + m_gridOverrideTextChoice->SetSelection( 0 ); + fgGridOverrides->Add( m_gridOverrideTextChoice, 0, wxALL, 5 ); - fgGridOverrides->Add( m_GridOverrideWiresSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + m_checkGridOverrideGraphics = new wxCheckBox( this, wxID_ANY, _("Graphics:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgGridOverrides->Add( m_checkGridOverrideGraphics, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 ); - m_staticTextWiresUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextWiresUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextWiresUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); - - m_checkGridOverrideVias = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideVias, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 8 ); - - m_staticTextVias = new wxStaticText( this, wxID_ANY, _("Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextVias->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextVias, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_GridOverrideViasSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_GridOverrideViasSize->SetMinSize( wxSize( 80,-1 ) ); - - fgGridOverrides->Add( m_GridOverrideViasSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_staticTextViasUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextViasUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextViasUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_checkGridOverrideText = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideText, 0, wxALIGN_CENTER|wxLEFT, 8 ); - - m_staticTextText = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextText->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextText, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 5 ); - - m_GridOverrideTextSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_GridOverrideTextSize->SetMinSize( wxSize( 80,-1 ) ); - - fgGridOverrides->Add( m_GridOverrideTextSize, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_staticTextTextUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextTextUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextTextUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 ); - - m_checkGridOverrideGraphics = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideGraphics, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 8 ); - - m_staticTextGraphics = new wxStaticText( this, wxID_ANY, _("Graphics:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextGraphics->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextGraphics, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_GridOverrideGraphicsSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_GridOverrideGraphicsSize->SetMinSize( wxSize( 80,-1 ) ); - - fgGridOverrides->Add( m_GridOverrideGraphicsSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextGraphicsUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextGraphicsUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextGraphicsUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); + wxArrayString m_gridOverrideGraphicsChoiceChoices; + m_gridOverrideGraphicsChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideGraphicsChoiceChoices, 0 ); + m_gridOverrideGraphicsChoice->SetSelection( 0 ); + fgGridOverrides->Add( m_gridOverrideGraphicsChoice, 0, wxALL, 5 ); bSizerRightCol->Add( fgGridOverrides, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10 ); diff --git a/common/dialogs/panel_grid_settings_base.fbp b/common/dialogs/panel_grid_settings_base.fbp index 6058331265..2660fa64c2 100644 --- a/common/dialogs/panel_grid_settings_base.fbp +++ b/common/dialogs/panel_grid_settings_base.fbp @@ -1170,20 +1170,20 @@ wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT 0 - 4 + 2 wxBOTH - 2 + 1 0 fgGridOverrides wxFLEX_GROWMODE_SPECIFIED none - 5 + 0 4 8 - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT 0 1 @@ -1214,7 +1214,7 @@ 0 0 wxID_ANY - + Connected items: 0 @@ -1245,11 +1245,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT + wxALL 0 - + 1 1 1 @@ -1263,6 +1263,7 @@ 1 0 + 1 1 @@ -1277,8 +1278,6 @@ 0 0 wxID_ANY - Connected items: - 0 0 @@ -1286,67 +1285,7 @@ 0 1 - m_staticTextConnected - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_LEFT - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - 80,-1 - 1 - m_GridOverrideConnectedSize + m_gridOverrideConnectedChoice 1 @@ -1354,86 +1293,25 @@ 1 Resizable + 0 1 - + ; ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mm - 0 - - 0 - - - 0 - - 1 - m_staticTextConnectedUnits - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - 8 - wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT 0 1 @@ -1464,7 +1342,7 @@ 0 0 wxID_ANY - + Wires: 0 @@ -1495,11 +1373,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxLEFT + wxALL 0 - + 1 1 1 @@ -1513,6 +1391,7 @@ 1 0 + 1 1 @@ -1527,8 +1406,6 @@ 0 0 wxID_ANY - Wires: - 0 0 @@ -1536,67 +1413,7 @@ 0 1 - m_staticTextWires - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_LEFT - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - 80,-1 - 1 - m_GridOverrideWiresSize + m_gridOverrideWiresChoice 1 @@ -1604,86 +1421,25 @@ 1 Resizable + 0 1 - + ; ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mm - 0 - - 0 - - - 0 - - 1 - m_staticTextWiresUnits - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - 8 - wxALIGN_CENTER_VERTICAL|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT 0 1 @@ -1714,7 +1470,7 @@ 0 0 wxID_ANY - + Vias: 0 @@ -1745,11 +1501,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxLEFT + wxALL 0 - + 1 1 1 @@ -1763,6 +1519,7 @@ 1 0 + 1 1 @@ -1777,8 +1534,6 @@ 0 0 wxID_ANY - Vias: - 0 0 @@ -1786,67 +1541,7 @@ 0 1 - m_staticTextVias - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - 80,-1 - 1 - m_GridOverrideViasSize + m_gridOverrideViasChoice 1 @@ -1854,6 +1549,7 @@ 1 Resizable + 0 1 @@ -1864,76 +1560,14 @@ wxFILTER_NONE wxDefaultValidator - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mm - 0 - - 0 - - - 0 - - 1 - m_staticTextViasUnits - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - 8 - wxALIGN_CENTER|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT 0 1 @@ -1964,7 +1598,7 @@ 0 0 wxID_ANY - + Text: 0 @@ -1995,11 +1629,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT + wxALL 0 - + 1 1 1 @@ -2013,6 +1647,7 @@ 1 0 + 1 1 @@ -2027,8 +1662,6 @@ 0 0 wxID_ANY - Text: - 0 0 @@ -2036,67 +1669,7 @@ 0 1 - m_staticTextText - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_LEFT - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - 80,-1 - 1 - m_GridOverrideTextSize + m_gridOverrideTextChoice 1 @@ -2104,86 +1677,25 @@ 1 Resizable + 0 1 - + ; ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mm - 0 - - 0 - - - 0 - - 1 - m_staticTextTextUnits - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_LEFT - ; ; forward_declare - 0 - - - - - -1 - - 8 - wxALIGN_CENTER_VERTICAL|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT 0 1 @@ -2214,7 +1726,7 @@ 0 0 wxID_ANY - + Graphics: 0 @@ -2245,11 +1757,11 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxLEFT + wxALL 0 - + 1 1 1 @@ -2263,6 +1775,7 @@ 1 0 + 1 1 @@ -2277,8 +1790,6 @@ 0 0 wxID_ANY - Graphics: - 0 0 @@ -2286,67 +1797,7 @@ 0 1 - m_staticTextGraphics - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_LEFT - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - 80,-1 - 1 - m_GridOverrideGraphicsSize + m_gridOverrideGraphicsChoice 1 @@ -2354,83 +1805,22 @@ 1 Resizable + 0 1 - + ; ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mm - 0 - - 0 - - - 0 - - 1 - m_staticTextGraphicsUnits - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_LEFT - ; ; forward_declare - 0 - - - - - -1 - - diff --git a/common/dialogs/panel_grid_settings_base.h b/common/dialogs/panel_grid_settings_base.h index 4e04748ab1..245fc6f323 100644 --- a/common/dialogs/panel_grid_settings_base.h +++ b/common/dialogs/panel_grid_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -29,7 +29,6 @@ class STD_BITMAP_BUTTON; #include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -60,25 +59,15 @@ class PANEL_GRID_SETTINGS_BASE : public RESETTABLE_PANEL wxStaticText* m_overridesLabel; wxStaticLine* m_staticline3; wxCheckBox* m_checkGridOverrideConnected; - wxStaticText* m_staticTextConnected; - wxTextCtrl* m_GridOverrideConnectedSize; - wxStaticText* m_staticTextConnectedUnits; + wxChoice* m_gridOverrideConnectedChoice; wxCheckBox* m_checkGridOverrideWires; - wxStaticText* m_staticTextWires; - wxTextCtrl* m_GridOverrideWiresSize; - wxStaticText* m_staticTextWiresUnits; + wxChoice* m_gridOverrideWiresChoice; wxCheckBox* m_checkGridOverrideVias; - wxStaticText* m_staticTextVias; - wxTextCtrl* m_GridOverrideViasSize; - wxStaticText* m_staticTextViasUnits; + wxChoice* m_gridOverrideViasChoice; wxCheckBox* m_checkGridOverrideText; - wxStaticText* m_staticTextText; - wxTextCtrl* m_GridOverrideTextSize; - wxStaticText* m_staticTextTextUnits; + wxChoice* m_gridOverrideTextChoice; wxCheckBox* m_checkGridOverrideGraphics; - wxStaticText* m_staticTextGraphics; - wxTextCtrl* m_GridOverrideGraphicsSize; - wxStaticText* m_staticTextGraphicsUnits; + wxChoice* m_gridOverrideGraphicsChoice; // Virtual event handlers, override them in your derived class virtual void OnAddGrid( wxCommandEvent& event ) { event.Skip(); } diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 05b392d32c..8671914ad1 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -368,24 +368,20 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std: m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_vias", &aWindow->grid.override_vias, false ) ); m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_text", - &aWindow->grid.override_text, false ) ); + &aWindow->grid.override_text, true ) ); m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_graphics", &aWindow->grid.override_graphics, false ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connected_size", - &aWindow->grid.override_connected_size, - "50 mil" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_wires_size", - &aWindow->grid.override_wires_size, - "50 mil" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_vias_size", - &aWindow->grid.override_vias_size, - "50 mil" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_text_size", - &aWindow->grid.override_text_size, "10 mil" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_graphics_size", - &aWindow->grid.override_graphics_size, - "25 mil" ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connected_idx", + &aWindow->grid.override_connected_idx, 1 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_wires_idx", + &aWindow->grid.override_wires_idx, 1 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_vias_idx", + &aWindow->grid.override_vias_idx, 0 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_text_idx", + &aWindow->grid.override_text_idx, 3 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_graphics_idx", + &aWindow->grid.override_graphics_idx, 2 ) ); } else { @@ -402,20 +398,16 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std: m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_graphics", &aWindow->grid.override_graphics, false ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connected_size", - &aWindow->grid.override_connected_size, - "0.25 mm" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_text_size", - &aWindow->grid.override_text_size, ".05 mm" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_wires_size", - &aWindow->grid.override_wires_size, - "0.05 mm" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_vias_size", - &aWindow->grid.override_vias_size, - "0.1 mm" ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_graphics_size", - &aWindow->grid.override_graphics_size, - "1 mm" ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connected_idx", + &aWindow->grid.override_connected_idx, 16 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_text_idx", + &aWindow->grid.override_text_idx, 18 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_wires_idx", + &aWindow->grid.override_wires_idx, 19 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_vias_idx", + &aWindow->grid.override_vias_idx, 18 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_graphics_idx", + &aWindow->grid.override_graphics_idx, 15 ) ); } diff --git a/common/settings/grid_settings.cpp b/common/settings/grid_settings.cpp index b4bf89220f..4c38abdae1 100644 --- a/common/settings/grid_settings.cpp +++ b/common/settings/grid_settings.cpp @@ -63,6 +63,15 @@ wxString GRID::UserUnitsMessageText( UNITS_PROVIDER* aProvider, bool aDisplayUni } +VECTOR2D GRID::ToDouble( EDA_IU_SCALE aScale ) const +{ + return VECTOR2D{ + EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MILLIMETRES, x ), + EDA_UNIT_UTILS::UI::DoubleValueFromString( aScale, EDA_UNITS::MILLIMETRES, y ), + }; +} + + bool GRID::operator==( const GRID& aOther ) const { return x == aOther.x && y == aOther.y; diff --git a/eeschema/tools/ee_grid_helper.cpp b/eeschema/tools/ee_grid_helper.cpp index abc8994136..224d39095a 100644 --- a/eeschema/tools/ee_grid_helper.cpp +++ b/eeschema/tools/ee_grid_helper.cpp @@ -247,6 +247,7 @@ VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, GRID_HELPER_GR VECTOR2D EE_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const { const GRID_SETTINGS& grid = m_toolMgr->GetSettings()->m_Window.grid; + int idx = -1; VECTOR2D g = m_toolMgr->GetView()->GetGAL()->GetGridSize(); @@ -257,37 +258,25 @@ VECTOR2D EE_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const { case GRID_CONNECTABLE: if( grid.override_connected ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( schIUScale, EDA_UNITS::MILS, - grid.override_connected_size ); - } + idx = grid.override_connected_idx; break; case GRID_WIRES: if( grid.override_wires ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( schIUScale, EDA_UNITS::MILS, - grid.override_wires_size ); - } + idx = grid.override_wires_idx; break; case GRID_TEXT: if( grid.override_text ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( schIUScale, EDA_UNITS::MILS, - grid.override_text_size ); - } + idx = grid.override_text_idx; break; case GRID_GRAPHICS: if( grid.override_graphics ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( schIUScale, EDA_UNITS::MILS, - grid.override_graphics_size ); - } + idx = grid.override_graphics_idx; break; @@ -295,6 +284,9 @@ VECTOR2D EE_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const break; } + if( idx >= 0 && idx < (int) grid.grids.size() ) + g = grid.grids[idx].ToDouble( schIUScale ); + return g; } diff --git a/include/dialogs/panel_grid_settings.h b/include/dialogs/panel_grid_settings.h index 761ef8f2b7..8dd2304848 100644 --- a/include/dialogs/panel_grid_settings.h +++ b/include/dialogs/panel_grid_settings.h @@ -56,12 +56,6 @@ private: APP_SETTINGS_BASE* m_cfg; FRAME_T m_frameType; wxWindow* m_eventSource; - - UNIT_BINDER m_gridOverrideConnected; - UNIT_BINDER m_gridOverrideWires; - UNIT_BINDER m_gridOverrideVias; - UNIT_BINDER m_gridOverrideText; - UNIT_BINDER m_gridOverrideGraphics; }; #endif // PANEL_GRID_SETTINGS_H diff --git a/include/settings/grid_settings.h b/include/settings/grid_settings.h index 50d1db33a0..50f43fc8d2 100644 --- a/include/settings/grid_settings.h +++ b/include/settings/grid_settings.h @@ -46,6 +46,8 @@ struct GRID */ wxString UserUnitsMessageText( UNITS_PROVIDER* aProvider, bool aDisplayUnits = true ) const; + VECTOR2D ToDouble( EDA_IU_SCALE aScale ) const; + wxString name; wxString x; wxString y; @@ -75,15 +77,15 @@ struct GRID_SETTINGS bool force_component_snap; bool overrides_enabled; bool override_connected; - wxString override_connected_size; + int override_connected_idx; bool override_wires; - wxString override_wires_size; + int override_wires_idx; bool override_vias; - wxString override_vias_size; + int override_vias_idx; bool override_text; - wxString override_text_size; + int override_text_idx; bool override_graphics; - wxString override_graphics_size; + int override_graphics_idx; }; #endif diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 4f6f71929c..f424841f1d 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -415,6 +415,7 @@ GRID_HELPER_GRIDS PCB_GRID_HELPER::GetItemGrid( const EDA_ITEM* aItem ) const VECTOR2D PCB_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const { const GRID_SETTINGS& grid = m_toolMgr->GetSettings()->m_Window.grid; + int idx = -1; VECTOR2D g = m_toolMgr->GetView()->GetGAL()->GetGridSize(); @@ -425,46 +426,31 @@ VECTOR2D PCB_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const { case GRID_CONNECTABLE: if( grid.override_connected ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( - pcbIUScale, EDA_UNITS::MILLIMETRES, grid.override_connected_size ); - } + idx = grid.override_connected_idx; break; case GRID_WIRES: if( grid.override_wires ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MILLIMETRES, - grid.override_wires_size ); - } + idx = grid.override_wires_idx; break; case GRID_VIAS: if( grid.override_vias ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MILLIMETRES, - grid.override_vias_size ); - } + idx = grid.override_vias_idx; break; case GRID_TEXT: if( grid.override_text ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MILLIMETRES, - grid.override_text_size ); - } + idx = grid.override_text_idx; break; case GRID_GRAPHICS: if( grid.override_graphics ) - { - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MILLIMETRES, - grid.override_graphics_size ); - } + idx = grid.override_graphics_idx; break; @@ -472,6 +458,9 @@ VECTOR2D PCB_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const break; } + if( idx >= 0 && idx < (int) grid.grids.size() ) + g = grid.grids[idx].ToDouble( pcbIUScale ); + return g; }