From 4fefd95e0cadfd26c7d8cf84e0228489561d8fff Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 26 Aug 2023 13:29:24 +0100 Subject: [PATCH] Move grid definitions to Prefs and grid origin to a separate dlg. Grid origin is document-wide, while grid definitions are app-wide. Fixes https://gitlab.com/kicad/code/kicad/-/issues/2262 --- common/CMakeLists.txt | 4 +- common/dialogs/dialog_grid_settings.cpp | 303 -- common/dialogs/dialog_grid_settings_base.cpp | 276 -- common/dialogs/dialog_grid_settings_base.fbp | 2698 ----------------- common/dialogs/dialog_unit_entry_base.cpp | 35 +- common/dialogs/dialog_unit_entry_base.fbp | 110 +- common/dialogs/panel_grid_settings.cpp | 293 ++ common/dialogs/panel_grid_settings_base.cpp | 228 ++ common/dialogs/panel_grid_settings_base.fbp | 2443 +++++++++++++++ ...ings_base.h => panel_grid_settings_base.h} | 54 +- common/eda_base_frame.cpp | 19 +- common/eda_draw_frame.cpp | 16 +- common/settings/app_settings.cpp | 16 +- common/tool/actions.cpp | 24 +- common/tool/common_tools.cpp | 34 +- common/tool/grid_menu.cpp | 7 +- cvpcb/display_footprints_frame.cpp | 4 +- eeschema/eeschema.cpp | 37 + eeschema/menubar.cpp | 15 - eeschema/sch_edit_frame.cpp | 2 - .../symbol_editor/menubar_symbol_editor.cpp | 15 - eeschema/symbol_editor/symbol_edit_frame.cpp | 1 - .../symbol_editor/toolbars_symbol_editor.cpp | 1 + eeschema/symbol_viewer_frame.cpp | 1 - eeschema/toolbars_sch_editor.cpp | 1 + eeschema/toolbars_symbol_viewer.cpp | 2 - eeschema/tools/ee_grid_helper.cpp | 20 +- eeschema/tools/sch_move_tool.cpp | 6 +- gerbview/events_called_functions.cpp | 1 - ..._grid_settings.h => panel_grid_settings.h} | 37 +- include/eda_draw_frame.h | 6 +- include/frame_type.h | 7 +- include/id.h | 1 - include/settings/app_settings.h | 6 +- include/tool/actions.h | 3 +- include/tool/common_tools.h | 1 + include/tool/grid_helper.h | 34 +- include/tool/tool_manager.h | 6 +- include/units_provider.h | 11 + pagelayout_editor/menubar.cpp | 15 - pagelayout_editor/pl_editor.cpp | 18 +- pagelayout_editor/pl_editor_frame.cpp | 2 - pagelayout_editor/toolbars_pl_editor.cpp | 1 + pcbnew/footprint_edit_frame.cpp | 1 - pcbnew/footprint_viewer_frame.cpp | 1 - pcbnew/menubar_footprint_editor.cpp | 16 - pcbnew/menubar_pcb_editor.cpp | 20 - pcbnew/pcb_edit_frame.cpp | 3 - pcbnew/pcbnew.cpp | 37 + pcbnew/toolbars_footprint_editor.cpp | 1 + pcbnew/toolbars_pcb_editor.cpp | 1 + pcbnew/tools/pcb_control.cpp | 4 +- pcbnew/tools/pcb_control.h | 2 +- pcbnew/tools/pcb_grid_helper.cpp | 20 +- 54 files changed, 3360 insertions(+), 3560 deletions(-) delete mode 100644 common/dialogs/dialog_grid_settings.cpp delete mode 100644 common/dialogs/dialog_grid_settings_base.cpp delete mode 100644 common/dialogs/dialog_grid_settings_base.fbp create mode 100644 common/dialogs/panel_grid_settings.cpp create mode 100644 common/dialogs/panel_grid_settings_base.cpp create mode 100644 common/dialogs/panel_grid_settings_base.fbp rename common/dialogs/{dialog_grid_settings_base.h => panel_grid_settings_base.h} (65%) rename include/dialogs/{dialog_grid_settings.h => panel_grid_settings.h} (66%) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 03ce7a46a9..d063d63dec 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -114,8 +114,6 @@ set( COMMON_DLG_SRCS dialogs/dialog_edit_library_tables.cpp dialogs/dialog_global_lib_table_config.cpp dialogs/dialog_global_lib_table_config_base.cpp - dialogs/dialog_grid_settings.cpp - dialogs/dialog_grid_settings_base.cpp dialogs/dialog_hotkey_list.cpp dialogs/dialog_HTML_reporter_base.cpp dialogs/dialog_locked_items_query.cpp @@ -150,6 +148,8 @@ set( COMMON_DLG_SRCS dialogs/panel_hotkeys_editor.cpp dialogs/panel_image_editor.cpp dialogs/panel_image_editor_base.cpp + dialogs/panel_grid_settings.cpp + dialogs/panel_grid_settings_base.cpp dialogs/panel_mouse_settings.cpp dialogs/panel_mouse_settings_base.cpp dialogs/panel_setup_netclasses.cpp diff --git a/common/dialogs/dialog_grid_settings.cpp b/common/dialogs/dialog_grid_settings.cpp deleted file mode 100644 index f025f53c7b..0000000000 --- a/common/dialogs/dialog_grid_settings.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 1992-2023 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 -#include -#include -#include -#include -#include -#include -#include - -DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ) : - DIALOG_GRID_SETTINGS_BASE( aParent ), m_parent( aParent ), - m_gridOriginX( aParent, m_staticTextGridPosX, m_GridOriginXCtrl, m_TextPosXUnits ), - m_gridOriginY( aParent, m_staticTextGridPosY, m_GridOriginYCtrl, m_TextPosYUnits ), - m_gridOverrideConnectables( aParent, m_staticTextConnectables, - m_GridOverrideConnectablesSize, m_staticTextConnectablesUnits ), - m_gridOverrideWires( aParent, m_staticTextWires, m_GridOverrideWiresSize, - m_staticTextWiresUnits ), - m_gridOverrideVias( aParent, m_staticTextVias, m_GridOverrideViasSize, - m_staticTextViasUnits ), - m_gridOverrideText( aParent, m_staticTextText, m_GridOverrideTextSize, - m_staticTextTextUnits ), - m_gridOverrideGraphics( aParent, m_staticTextGraphics, m_GridOverrideGraphicsSize, - m_staticTextGraphicsUnits ) -{ - // Configure display origin transforms - m_gridOriginX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD ); - m_gridOriginY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD ); - - RebuildGridSizes(); - - if( m_parent->IsType( FRAME_SCH ) - || m_parent->IsType( FRAME_SCH_SYMBOL_EDITOR ) - || m_parent->IsType( FRAME_SCH_VIEWER ) - || m_parent->IsType( FRAME_SCH_VIEWER_MODAL ) - || m_parent->IsType( FRAME_SIMULATOR ) ) - { - // Eeschema and friends don't use grid origin - sbGridOriginSizer->ShowItems( false ); - - // No vias in the schematics - m_GridOverrideViasSize->SetValue( wxT( "50 mil" ) ); - m_checkGridOverrideVias->Hide(); - m_staticTextVias->Hide(); - m_GridOverrideViasSize->Hide(); - m_staticTextViasUnits->Hide(); - } - else - { - m_staticTextConnectables->SetLabel( wxT( "Footprints/pads:" ) ); - m_staticTextWires->SetLabel( wxT( "Tracks:" ) ); - } - - int hk1 = ACTIONS::gridFast1.GetHotKey(); - int hk2 = ACTIONS::gridFast2.GetHotKey(); - m_grid1HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk1 ) ) ); - m_grid2HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk2 ) ) ); - - m_addGridButton->SetBitmap( KiBitmap( BITMAPS::small_plus ) ); - m_removeGridButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) ); - m_moveUpButton->SetBitmap( KiBitmap( BITMAPS::small_up ) ); - m_moveDownButton->SetBitmap( KiBitmap( BITMAPS::small_down ) ); - - SetupStandardButtons(); - SetInitialFocus( m_GridOriginXCtrl ); - - Layout(); - - // Now all widgets have the size fixed, call FinishDialogSettings - finishDialogSettings(); - - m_buttonResetSizes->Bind( wxEVT_BUTTON, - [&]( wxCommandEvent& ) - { - APP_SETTINGS_BASE* settings = m_parent->config(); - settings->m_Window.grid.sizes = settings->DefaultGridSizeList(); - RebuildGridSizes(); - settings->m_Window.grid.last_size_idx = m_currentGridCtrl->GetSelection(); - } ); -} - - -void DIALOG_GRID_SETTINGS::RebuildGridSizes() -{ - APP_SETTINGS_BASE* settings = m_parent->config(); - - wxString savedCurrentGrid = m_currentGridCtrl->GetStringSelection(); - wxString savedGrid1 = m_grid1Ctrl->GetStringSelection(); - wxString savedGrid2 = m_grid2Ctrl->GetStringSelection(); - - wxArrayString grids; - GRID_MENU::BuildChoiceList( &grids, settings, m_parent ); - - m_currentGridCtrl->Set( grids ); - m_grid1Ctrl->Set( grids ); - m_grid2Ctrl->Set( grids ); - - if( !m_currentGridCtrl->SetStringSelection( savedCurrentGrid ) ) - m_currentGridCtrl->SetStringSelection( grids.front() ); - - if( !m_grid1Ctrl->SetStringSelection( savedGrid1 ) ) - m_grid1Ctrl->SetStringSelection( grids.front() ); - - if( !m_grid2Ctrl->SetStringSelection( savedGrid2 ) ) - m_grid2Ctrl->SetStringSelection( grids.back() ); -} - - -bool DIALOG_GRID_SETTINGS::TransferDataFromWindow() -{ - // Validate new settings - for( UNIT_BINDER* entry : { &m_gridOverrideConnectables, &m_gridOverrideWires, - &m_gridOverrideVias, &m_gridOverrideText, &m_gridOverrideGraphics } ) - { - if( !entry->Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) ) - return false; - } - - // Apply the new settings - APP_SETTINGS_BASE* cfg = m_parent->config(); - GRID_SETTINGS& gridCfg = cfg->m_Window.grid; - - gridCfg.last_size_idx = m_currentGridCtrl->GetSelection(); - m_parent->SetGridOrigin( VECTOR2I( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) ); - gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection(); - gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection(); - - gridCfg.override_connectables = m_checkGridOverrideConnectables->GetValue(); - gridCfg.override_connectables_size = - m_parent->StringFromValue( m_gridOverrideConnectables.GetValue(), true ); - gridCfg.override_wires = m_checkGridOverrideWires->GetValue(); - gridCfg.override_wires_size = m_parent->StringFromValue( m_gridOverrideWires.GetValue(), true ); - gridCfg.override_vias = m_checkGridOverrideVias->GetValue(); - gridCfg.override_vias_size = m_parent->StringFromValue( m_gridOverrideVias.GetValue(), true ); - gridCfg.override_text = m_checkGridOverrideText->GetValue(); - gridCfg.override_text_size = m_parent->StringFromValue( m_gridOverrideText.GetValue(), true ); - gridCfg.override_graphics = m_checkGridOverrideGraphics->GetValue(); - gridCfg.override_graphics_size = - m_parent->StringFromValue( m_gridOverrideGraphics.GetValue(), true ); - - // Notify TOOLS - TOOL_MANAGER* mgr = m_parent->GetToolManager(); - mgr->ResetTools( TOOL_BASE::REDRAW ); - - // Notify GAL - mgr->RunAction( ACTIONS::gridPreset, gridCfg.last_size_idx ); - mgr->RunAction( ACTIONS::gridSetOrigin, new VECTOR2D( m_parent->GetGridOrigin() ) ); - - m_parent->UpdateGridSelectBox(); - - return wxDialog::TransferDataFromWindow(); -} - - -bool DIALOG_GRID_SETTINGS::TransferDataToWindow() -{ - APP_SETTINGS_BASE* settings = m_parent->config(); - - GRID_SETTINGS& gridCfg = settings->m_Window.grid; - - Layout(); - - m_currentGridCtrl->SetSelection( settings->m_Window.grid.last_size_idx ); - - m_gridOverrideConnectables.SetValue( - m_parent->ValueFromString( gridCfg.override_connectables_size ) ); - m_gridOverrideWires.SetValue( m_parent->ValueFromString( gridCfg.override_wires_size ) ); - m_gridOverrideVias.SetValue( m_parent->ValueFromString( gridCfg.override_vias_size ) ); - m_gridOverrideText.SetValue( m_parent->ValueFromString( gridCfg.override_text_size ) ); - m_gridOverrideGraphics.SetValue( m_parent->ValueFromString( gridCfg.override_graphics_size ) ); - - m_checkGridOverrideConnectables->SetValue( gridCfg.override_connectables ); - 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_gridOriginX.SetValue( m_parent->GetGridOrigin().x ); - m_gridOriginY.SetValue( m_parent->GetGridOrigin().y ); - - m_grid1Ctrl->SetSelection( gridCfg.fast_grid_1 ); - m_grid2Ctrl->SetSelection( gridCfg.fast_grid_2 ); - - return wxDialog::TransferDataToWindow(); -} - - -void DIALOG_GRID_SETTINGS::OnAddGrid( wxCommandEvent& event ) -{ - wxTextEntryDialog dlg( this, _( "New grid:" ), _( "Add Grid" ) ); - - if( dlg.ShowModal() != wxID_OK ) - return; - - int row = m_currentGridCtrl->GetSelection(); - GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid; - EDA_IU_SCALE scale = m_parent->GetIuScale(); - EDA_UNITS units = m_parent->GetUserUnits(); - double gridSize = EDA_UNIT_UTILS::UI::DoubleValueFromString( scale, units, dlg.GetValue() ); - - - if( gridSize == 0.0f ) - { - DisplayError( this, _( "Grid must have a valid size." ) ); - return; - } - - wxString gridSizeStr = - EDA_UNIT_UTILS::UI::StringFromValue( scale, EDA_UNITS::MILLIMETRES, gridSize ); - - for( const wxString& size : gridCfg.sizes ) - { - if( gridSizeStr == size ) - { - DisplayError( this, - wxString::Format( _( "Grid size '%s' already exists." ), gridSizeStr ) ); - return; - } - } - - gridCfg.sizes.insert( gridCfg.sizes.begin() + row, gridSizeStr ); - RebuildGridSizes(); - m_currentGridCtrl->SetSelection( row ); -} - - -void DIALOG_GRID_SETTINGS::OnRemoveGrid( wxCommandEvent& event ) -{ - GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid; - int row = m_currentGridCtrl->GetSelection(); - - if( gridCfg.sizes.size() <= 1 ) - { - DisplayError( this, wxString::Format( _( "At least one grid size is required." ) ) ); - return; - } - - gridCfg.sizes.erase( gridCfg.sizes.begin() + row ); - RebuildGridSizes(); - - if( row != 0 ) - m_currentGridCtrl->SetSelection( row - 1 ); -} - - -void DIALOG_GRID_SETTINGS::OnMoveGridUp( wxCommandEvent& event ) -{ - GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid; - int row = m_currentGridCtrl->GetSelection(); - - if( gridCfg.sizes.size() <= 1 || row == 0 ) - return; - - std::swap( gridCfg.sizes[row], gridCfg.sizes[row - 1] ); - RebuildGridSizes(); - - if( row != 0 ) - m_currentGridCtrl->SetSelection( row - 1 ); -} - - -void DIALOG_GRID_SETTINGS::OnMoveGridDown( wxCommandEvent& event ) -{ - GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid; - int row = m_currentGridCtrl->GetSelection(); - - if( gridCfg.sizes.size() <= 1 || row == ( (int) gridCfg.sizes.size() - 1 ) ) - return; - - std::swap( gridCfg.sizes[row], gridCfg.sizes[row + 1] ); - RebuildGridSizes(); - - if( row != 0 ) - m_currentGridCtrl->SetSelection( row + 1 ); -} diff --git a/common/dialogs/dialog_grid_settings_base.cpp b/common/dialogs/dialog_grid_settings_base.cpp deleted file mode 100644 index 23a2b34c30..0000000000 --- a/common/dialogs/dialog_grid_settings_base.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "widgets/std_bitmap_button.h" - -#include "dialog_grid_settings_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_GRID_SETTINGS_BASE::DIALOG_GRID_SETTINGS_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 ); - - wxBoxSizer* bSizerColumns; - bSizerColumns = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbCurrentGrid; - sbCurrentGrid = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current Grid") ), wxVERTICAL ); - - m_currentGridCtrl = new wxListBox( sbCurrentGrid->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - sbCurrentGrid->Add( m_currentGridCtrl, 1, wxEXPAND|wxBOTTOM, 3 ); - - wxBoxSizer* bSizer4; - bSizer4 = new wxBoxSizer( wxHORIZONTAL ); - - m_addGridButton = new STD_BITMAP_BUTTON( sbCurrentGrid->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - bSizer4->Add( m_addGridButton, 0, 0, 5 ); - - - bSizer4->Add( 20, 0, 0, wxEXPAND, 5 ); - - m_removeGridButton = new STD_BITMAP_BUTTON( sbCurrentGrid->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - bSizer4->Add( m_removeGridButton, 0, 0, 5 ); - - - bSizer4->Add( 20, 0, 1, wxEXPAND, 5 ); - - m_moveUpButton = new STD_BITMAP_BUTTON( sbCurrentGrid->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - bSizer4->Add( m_moveUpButton, 0, wxRIGHT, 5 ); - - m_moveDownButton = new STD_BITMAP_BUTTON( sbCurrentGrid->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - bSizer4->Add( m_moveDownButton, 0, 0, 5 ); - - - sbCurrentGrid->Add( bSizer4, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - - bSizerColumns->Add( sbCurrentGrid, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxBoxSizer* bSizerRightCol; - bSizerRightCol = new wxBoxSizer( wxVERTICAL ); - - sbGridOriginSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Origin") ), wxVERTICAL ); - - wxFlexGridSizer* fgSizerGridOrigin; - fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 5, 0 ); - fgSizerGridOrigin->AddGrowableCol( 1 ); - fgSizerGridOrigin->SetFlexibleDirection( wxBOTH ); - fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticTextGridPosX = new wxStaticText( sbGridOriginSizer->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextGridPosX->Wrap( -1 ); - fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_GridOriginXCtrl = new wxTextCtrl( sbGridOriginSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxLEFT, 5 ); - - m_TextPosXUnits = new wxStaticText( sbGridOriginSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextPosXUnits->Wrap( -1 ); - fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 5 ); - - m_staticTextGridPosY = new wxStaticText( sbGridOriginSizer->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextGridPosY->Wrap( -1 ); - fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_GridOriginYCtrl = new wxTextCtrl( sbGridOriginSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxEXPAND|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_TextPosYUnits = new wxStaticText( sbGridOriginSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextPosYUnits->Wrap( -1 ); - fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 5 ); - - - sbGridOriginSizer->Add( fgSizerGridOrigin, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - - bSizerRightCol->Add( sbGridOriginSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - wxStaticBoxSizer* sbFastSwitchSizer; - sbFastSwitchSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fast Switching") ), wxVERTICAL ); - - wxFlexGridSizer* fgSizer3; - fgSizer3 = new wxFlexGridSizer( 2, 3, 6, 5 ); - fgSizer3->AddGrowableCol( 1 ); - fgSizer3->SetFlexibleDirection( wxBOTH ); - fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticTextGrid1 = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextGrid1->Wrap( -1 ); - fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - wxArrayString m_grid1CtrlChoices; - m_grid1Ctrl = new wxChoice( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_grid1CtrlChoices, 0 ); - m_grid1Ctrl->SetSelection( 0 ); - fgSizer3->Add( m_grid1Ctrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - m_grid1HotKey = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("(hotkey)"), wxDefaultPosition, wxDefaultSize, 0 ); - m_grid1HotKey->Wrap( -1 ); - fgSizer3->Add( m_grid1HotKey, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextGrid2 = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextGrid2->Wrap( -1 ); - fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - - wxArrayString m_grid2CtrlChoices; - m_grid2Ctrl = new wxChoice( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_grid2CtrlChoices, 0 ); - m_grid2Ctrl->SetSelection( 0 ); - fgSizer3->Add( m_grid2Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_grid2HotKey = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("(hotkey)"), wxDefaultPosition, wxDefaultSize, 0 ); - m_grid2HotKey->Wrap( -1 ); - fgSizer3->Add( m_grid2HotKey, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - sbFastSwitchSizer->Add( fgSizer3, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - - bSizerRightCol->Add( sbFastSwitchSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - sbGridOverridesSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Overrides") ), wxVERTICAL ); - - wxFlexGridSizer* fgGridOverrides; - fgGridOverrides = new wxFlexGridSizer( 5, 4, 4, 0 ); - fgGridOverrides->AddGrowableCol( 2 ); - fgGridOverrides->SetFlexibleDirection( wxBOTH ); - fgGridOverrides->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_checkGridOverrideConnectables = new wxCheckBox( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideConnectables, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10 ); - - m_staticTextConnectables = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, _("Connectable items:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextConnectables->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextConnectables, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT, 5 ); - - m_GridOverrideConnectablesSize = new wxTextCtrl( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_GridOverrideConnectablesSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextConnectablesUnits = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextConnectablesUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextConnectablesUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_checkGridOverrideWires = new wxCheckBox( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideWires, 0, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_staticTextWires = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, _("Wires:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextWires->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextWires, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_GridOverrideWiresSize = new wxTextCtrl( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_GridOverrideWiresSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextWiresUnits = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), 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( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideVias, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextVias = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, _("Vias:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextVias->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextVias, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_GridOverrideViasSize = new wxTextCtrl( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_GridOverrideViasSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_staticTextViasUnits = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextViasUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextViasUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_checkGridOverrideText = new wxCheckBox( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideText, 0, wxALIGN_CENTER, 5 ); - - m_staticTextText = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), 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( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_GridOverrideTextSize, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_staticTextTextUnits = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), 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( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_checkGridOverrideGraphics, 0, wxALIGN_CENTER_VERTICAL, 10 ); - - m_staticTextGraphics = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), 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( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgGridOverrides->Add( m_GridOverrideGraphicsSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticTextGraphicsUnits = new wxStaticText( sbGridOverridesSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - m_staticTextGraphicsUnits->Wrap( -1 ); - fgGridOverrides->Add( m_staticTextGraphicsUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - - sbGridOverridesSizer->Add( fgGridOverrides, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - - bSizerRightCol->Add( sbGridOverridesSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - - - bSizerColumns->Add( bSizerRightCol, 1, wxEXPAND, 5 ); - - - bSizerMain->Add( bSizerColumns, 1, wxEXPAND, 5 ); - - wxBoxSizer* bButtonSizer; - bButtonSizer = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonResetSizes = new wxButton( this, wxID_ANY, _("Reset Grids"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonResetSizes->SetToolTip( _("Resets the list of grid sizes to default values") ); - - bButtonSizer->Add( m_buttonResetSizes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bButtonSizer->Add( 40, 0, 1, wxEXPAND, 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(); - - bButtonSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); - - - bSizerMain->Add( bButtonSizer, 0, wxEXPAND|wxLEFT, 10 ); - - - this->SetSizer( bSizerMain ); - this->Layout(); - bSizerMain->Fit( this ); - - // Connect Events - this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRID_SETTINGS_BASE::OnInitDlg ) ); - m_addGridButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnAddGrid ), NULL, this ); - m_removeGridButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnRemoveGrid ), NULL, this ); - m_moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridUp ), NULL, this ); - m_moveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridDown ), NULL, this ); - m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnCancelClick ), NULL, this ); - m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnOkClick ), NULL, this ); -} - -DIALOG_GRID_SETTINGS_BASE::~DIALOG_GRID_SETTINGS_BASE() -{ - // Disconnect Events - this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRID_SETTINGS_BASE::OnInitDlg ) ); - m_addGridButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnAddGrid ), NULL, this ); - m_removeGridButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnRemoveGrid ), NULL, this ); - m_moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridUp ), NULL, this ); - m_moveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnMoveGridDown ), NULL, this ); - m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnCancelClick ), NULL, this ); - m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnOkClick ), NULL, this ); - -} diff --git a/common/dialogs/dialog_grid_settings_base.fbp b/common/dialogs/dialog_grid_settings_base.fbp deleted file mode 100644 index f8a2b9603a..0000000000 --- a/common/dialogs/dialog_grid_settings_base.fbp +++ /dev/null @@ -1,2698 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_grid_settings_base - 1000 - none - - - 1 - dialog_grid_settings - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_GRID_SETTINGS_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - Grid Settings - - 0 - - - - OnInitDlg - - - bSizerMain - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - bSizerColumns - wxHORIZONTAL - none - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 1 - - wxID_ANY - Current Grid - - sbCurrentGrid - wxVERTICAL - 1 - none - - 3 - wxEXPAND|wxBOTTOM - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - -1,-1 - 1 - m_currentGridCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - - bSizer4 - wxHORIZONTAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Add Grid - - 0 - - 0 - - - 0 - - 1 - m_addGridButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddGrid - - - - 5 - wxEXPAND - 0 - - 0 - protected - 20 - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Remove Grid - - 0 - - 0 - - - 0 - - 1 - m_removeGridButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRemoveGrid - - - - 5 - wxEXPAND - 1 - - 0 - protected - 20 - - - - 5 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move grid up in list - - 0 - - 0 - - - 0 - - 1 - m_moveUpButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnMoveGridUp - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move grid up in list - - 0 - - 0 - - - 0 - - 1 - m_moveDownButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnMoveGridDown - - - - - - - - 5 - wxEXPAND - 1 - - - bSizerRightCol - wxVERTICAL - none - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - wxID_ANY - Grid Origin - - sbGridOriginSizer - wxVERTICAL - 1 - protected - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 3 - wxBOTH - 1 - - 0 - - fgSizerGridOrigin - wxFLEX_GROWMODE_SPECIFIED - none - 2 - 5 - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - X: - 0 - - 0 - - - 0 - - 1 - m_staticTextGridPosX - 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 - - 0 - - 1 - m_GridOriginXCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT - 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_TextPosXUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Y: - 0 - - 0 - - - 0 - - 1 - m_staticTextGridPosY - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|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 - - 1 - m_GridOriginYCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT - 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_TextPosYUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 1 - - wxID_ANY - Fast Switching - - sbFastSwitchSizer - wxVERTICAL - 1 - none - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 3 - wxBOTH - 1 - - 5 - - fgSizer3 - wxFLEX_GROWMODE_SPECIFIED - none - 2 - 6 - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Grid 1: - 0 - - 0 - - - 0 - - 1 - m_staticTextGrid1 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - -1,-1 - 1 - m_grid1Ctrl - 1 - - - protected - 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 - (hotkey) - 0 - - 0 - - - 0 - - 1 - m_grid1HotKey - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Grid 2: - 0 - - 0 - - - 0 - - 1 - m_staticTextGrid2 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - -1,-1 - 1 - m_grid2Ctrl - 1 - - - protected - 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 - (hotkey) - 0 - - 0 - - - 0 - - 1 - m_grid2HotKey - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - wxID_ANY - Grid Overrides - - sbGridOverridesSizer - wxVERTICAL - 1 - protected - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 4 - wxBOTH - 2 - - 0 - - fgGridOverrides - wxFLEX_GROWMODE_SPECIFIED - none - 5 - 4 - - 10 - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - m_checkGridOverrideConnectables - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Connectable items: - 0 - - 0 - - - 0 - - 1 - m_staticTextConnectables - 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 - - 1 - m_GridOverrideConnectablesSize - 1 - - - protected - 1 - - Resizable - 1 - - - - 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_staticTextConnectablesUnits - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - m_checkGridOverrideWires - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 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 - Wires: - 0 - - 0 - - - 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 - - 1 - m_GridOverrideWiresSize - 1 - - - protected - 1 - - Resizable - 1 - - - - 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 - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - m_checkGridOverrideVias - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 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 - Vias: - 0 - - 0 - - - 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 - - 1 - m_GridOverrideViasSize - 1 - - - protected - 1 - - Resizable - 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_staticTextViasUnits - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - m_checkGridOverrideText - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Text: - 0 - - 0 - - - 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 - - 1 - m_GridOverrideTextSize - 1 - - - protected - 1 - - Resizable - 1 - - - - 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 - - - - 10 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - m_checkGridOverrideGraphics - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 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 - Graphics: - 0 - - 0 - - - 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 - - 1 - m_GridOverrideGraphicsSize - 1 - - - protected - 1 - - Resizable - 1 - - - - 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 - - - - - - - - - - - - 10 - wxEXPAND|wxLEFT - 0 - - - bButtonSizer - wxHORIZONTAL - none - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Reset Grids - - 0 - - 0 - - - 0 - - 1 - m_buttonResetSizes - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - Resets the list of grid sizes to default values - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 40 - - - - 5 - wxALL|wxEXPAND - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - OnCancelClick - OnOkClick - - - - - - - - diff --git a/common/dialogs/dialog_unit_entry_base.cpp b/common/dialogs/dialog_unit_entry_base.cpp index 346d9df4a6..f87f519931 100644 --- a/common/dialogs/dialog_unit_entry_base.cpp +++ b/common/dialogs/dialog_unit_entry_base.cpp @@ -24,8 +24,6 @@ WX_UNIT_ENTRY_DIALOG_BASE::WX_UNIT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindow bSizerContent->Add( m_label, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); m_textCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textCtrl->SetMinSize( wxSize( 300,-1 ) ); - bSizerContent->Add( m_textCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_unit_label = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -35,6 +33,12 @@ WX_UNIT_ENTRY_DIALOG_BASE::WX_UNIT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindow bSizerMain->Add( bSizerContent, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + wxBoxSizer* bSizerButtons; + bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); + + + bSizerButtons->Add( 100, 0, 1, 0, 5 ); + m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); @@ -42,7 +46,10 @@ WX_UNIT_ENTRY_DIALOG_BASE::WX_UNIT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindow m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - bSizerMain->Add( m_sdbSizer1, 0, wxALL|wxALIGN_RIGHT, 5 ); + bSizerButtons->Add( m_sdbSizer1, 0, wxALL, 5 ); + + + bSizerMain->Add( bSizerButtons, 1, wxEXPAND, 5 ); this->SetSizer( bSizerMain ); @@ -65,6 +72,7 @@ WX_PT_ENTRY_DIALOG_BASE::WX_PT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindowID i wxFlexGridSizer* fgSizer; fgSizer = new wxFlexGridSizer( 0, 3, 5, 0 ); + fgSizer->AddGrowableCol( 1 ); fgSizer->SetFlexibleDirection( wxBOTH ); fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -73,9 +81,7 @@ WX_PT_ENTRY_DIALOG_BASE::WX_PT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindowID i fgSizer->Add( m_labelX, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); m_textCtrlX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textCtrlX->SetMinSize( wxSize( 300,-1 ) ); - - fgSizer->Add( m_textCtrlX, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizer->Add( m_textCtrlX, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_unitsX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_unitsX->Wrap( -1 ); @@ -86,16 +92,20 @@ WX_PT_ENTRY_DIALOG_BASE::WX_PT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindowID i fgSizer->Add( m_labelY, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); m_textCtrlY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textCtrlY->SetMinSize( wxSize( 300,-1 ) ); - - fgSizer->Add( m_textCtrlY, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + fgSizer->Add( m_textCtrlY, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_unitsY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_unitsY->Wrap( -1 ); fgSizer->Add( m_unitsY, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - bSizerMain->Add( fgSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + bSizerMain->Add( fgSizer, 1, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizerButtons; + bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); + + + bSizerButtons->Add( 100, 0, 1, wxALIGN_CENTER_VERTICAL, 5 ); m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); @@ -104,7 +114,10 @@ WX_PT_ENTRY_DIALOG_BASE::WX_PT_ENTRY_DIALOG_BASE( wxWindow* parent, wxWindowID i m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - bSizerMain->Add( m_sdbSizer1, 0, wxALL|wxALIGN_RIGHT, 5 ); + bSizerButtons->Add( m_sdbSizer1, 0, wxALL, 5 ); + + + bSizerMain->Add( bSizerButtons, 0, wxEXPAND, 5 ); this->SetSizer( bSizerMain ); diff --git a/common/dialogs/dialog_unit_entry_base.fbp b/common/dialogs/dialog_unit_entry_base.fbp index 2bfc6d4c38..bd3054740e 100644 --- a/common/dialogs/dialog_unit_entry_base.fbp +++ b/common/dialogs/dialog_unit_entry_base.fbp @@ -169,7 +169,7 @@ 0 - 300,-1 + -1,-1 1 m_textCtrl 1 @@ -258,22 +258,43 @@ - + 5 - wxALL|wxALIGN_RIGHT - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 + wxEXPAND + 1 + - m_sdbSizer1 - protected + bSizerButtons + wxHORIZONTAL + none + + 5 + + 1 + + 0 + protected + 100 + + + + 5 + wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + @@ -312,12 +333,12 @@ none 5 - wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + wxEXPAND|wxALL 1 3 wxBOTH - + 1 0 @@ -389,8 +410,8 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 1 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND + 0 1 1 @@ -425,7 +446,7 @@ 0 - 300,-1 + -1,-1 1 m_textCtrlX 1 @@ -575,7 +596,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND 0 1 @@ -611,7 +632,7 @@ 0 - 300,-1 + -1,-1 1 m_textCtrlY 1 @@ -702,20 +723,41 @@ 5 - wxALL|wxALIGN_RIGHT + wxEXPAND 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 + - m_sdbSizer1 - protected + bSizerButtons + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL + 1 + + 0 + protected + 100 + + + + 5 + wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + diff --git a/common/dialogs/panel_grid_settings.cpp b/common/dialogs/panel_grid_settings.cpp new file mode 100644 index 0000000000..a9b640d816 --- /dev/null +++ b/common/dialogs/panel_grid_settings.cpp @@ -0,0 +1,293 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2023 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 +#include +#include +#include +#include +#include +#include +#include + +PANEL_GRID_SETTINGS::PANEL_GRID_SETTINGS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider, + wxWindow* aEventSource, APP_SETTINGS_BASE* aCfg, + FRAME_T aFrameType ) : + PANEL_GRID_SETTINGS_BASE( aParent ), + m_unitsProvider( aUnitsProvider ), + m_cfg( aCfg ), + m_frameType( aFrameType ), + 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 ) +{ + RebuildGridSizes(); + + if( m_frameType == FRAME_PCB_EDITOR || m_frameType == FRAME_FOOTPRINT_EDITOR ) + { + m_staticTextConnected->SetLabel( wxT( "Footprints/pads:" ) ); + m_staticTextWires->SetLabel( wxT( "Tracks:" ) ); + } + else + { + m_GridOverrideViasSize->SetValue( wxT( "50 mil" ) ); + m_checkGridOverrideVias->Show( false ); + m_gridOverrideVias.Show( false ); + + if( m_frameType != FRAME_SCH + && m_frameType != FRAME_SCH_SYMBOL_EDITOR + && m_frameType != FRAME_SCH_VIEWER + && m_frameType != FRAME_SCH_VIEWER_MODAL + && m_frameType != FRAME_SIMULATOR ) + { + m_checkGridOverrideConnected->Show( false ); + m_gridOverrideConnected.Show( false ); + + m_checkGridOverrideWires->Show( false ); + m_gridOverrideWires.Show( false ); + } + } + + int hk1 = ACTIONS::gridFast1.GetHotKey(); + int hk2 = ACTIONS::gridFast2.GetHotKey(); + m_grid1HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk1 ) ) ); + m_grid2HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk2 ) ) ); + + m_addGridButton->SetBitmap( KiBitmap( BITMAPS::small_plus ) ); + m_removeGridButton->SetBitmap( KiBitmap( BITMAPS::small_trash ) ); + m_moveUpButton->SetBitmap( KiBitmap( BITMAPS::small_up ) ); + m_moveDownButton->SetBitmap( KiBitmap( BITMAPS::small_down ) ); + + Layout(); +} + + +void PANEL_GRID_SETTINGS::ResetPanel() +{ + m_cfg->m_Window.grid.sizes = m_cfg->DefaultGridSizeList(); + RebuildGridSizes(); + m_cfg->m_Window.grid.last_size_idx = m_currentGridCtrl->GetSelection(); +} + + +void PANEL_GRID_SETTINGS::RebuildGridSizes() +{ + wxString savedCurrentGrid = m_currentGridCtrl->GetStringSelection(); + wxString savedGrid1 = m_grid1Ctrl->GetStringSelection(); + wxString savedGrid2 = m_grid2Ctrl->GetStringSelection(); + + wxArrayString grids; + wxString msg; + EDA_IU_SCALE scale = m_unitsProvider->GetIuScale(); + EDA_UNITS primaryUnit; + EDA_UNITS secondaryUnit; + + m_unitsProvider->GetUnitPair( primaryUnit, secondaryUnit ); + + for( const wxString& gridSize : m_cfg->m_Window.grid.sizes ) + { + double val = EDA_UNIT_UTILS::UI::DoubleValueFromString( scale, EDA_UNITS::MILLIMETRES, + gridSize ); + + msg.Printf( _( "%s (%s)" ), + EDA_UNIT_UTILS::UI::MessageTextFromValue( scale, primaryUnit, val ), + EDA_UNIT_UTILS::UI::MessageTextFromValue( scale, secondaryUnit, val ) ); + + grids.Add( msg ); + } + + m_currentGridCtrl->Set( grids ); + m_grid1Ctrl->Set( grids ); + m_grid2Ctrl->Set( grids ); + + if( !m_currentGridCtrl->SetStringSelection( savedCurrentGrid ) ) + m_currentGridCtrl->SetStringSelection( grids.front() ); + + if( !m_grid1Ctrl->SetStringSelection( savedGrid1 ) ) + m_grid1Ctrl->SetStringSelection( grids.front() ); + + if( !m_grid2Ctrl->SetStringSelection( savedGrid2 ) ) + m_grid2Ctrl->SetStringSelection( grids.back() ); +} + + +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_wires = m_checkGridOverrideWires->GetValue(); + gridCfg.override_wires_size = m_unitsProvider->StringFromValue( m_gridOverrideWires.GetValue(), true ); + gridCfg.override_vias = m_checkGridOverrideVias->GetValue(); + gridCfg.override_vias_size = m_unitsProvider->StringFromValue( m_gridOverrideVias.GetValue(), true ); + gridCfg.override_text = m_checkGridOverrideText->GetValue(); + gridCfg.override_text_size = m_unitsProvider->StringFromValue( m_gridOverrideText.GetValue(), true ); + gridCfg.override_graphics = m_checkGridOverrideGraphics->GetValue(); + gridCfg.override_graphics_size = m_unitsProvider->StringFromValue( m_gridOverrideGraphics.GetValue(), true ); + + return RESETTABLE_PANEL::TransferDataFromWindow(); +} + + +bool PANEL_GRID_SETTINGS::TransferDataToWindow() +{ + GRID_SETTINGS& gridCfg = m_cfg->m_Window.grid; + + Layout(); + + m_currentGridCtrl->SetSelection( 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_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_grid1Ctrl->SetSelection( gridCfg.fast_grid_1 ); + m_grid2Ctrl->SetSelection( gridCfg.fast_grid_2 ); + + return RESETTABLE_PANEL::TransferDataToWindow(); +} + + +void PANEL_GRID_SETTINGS::OnAddGrid( wxCommandEvent& event ) +{ + wxTextEntryDialog dlg( this, _( "New grid:" ), _( "Add Grid" ) ); + + if( dlg.ShowModal() != wxID_OK ) + return; + + int row = m_currentGridCtrl->GetSelection(); + GRID_SETTINGS& gridCfg = m_cfg->m_Window.grid; + EDA_IU_SCALE scale = m_unitsProvider->GetIuScale(); + EDA_UNITS units = m_unitsProvider->GetUserUnits(); + double gridSize = EDA_UNIT_UTILS::UI::DoubleValueFromString( scale, units, dlg.GetValue() ); + + + if( gridSize == 0.0f ) + { + DisplayError( this, _( "Grid must have a valid size." ) ); + return; + } + + wxString gridSizeStr = + EDA_UNIT_UTILS::UI::StringFromValue( scale, EDA_UNITS::MILLIMETRES, gridSize ); + + for( const wxString& size : gridCfg.sizes ) + { + if( gridSizeStr == size ) + { + DisplayError( this, + wxString::Format( _( "Grid size '%s' already exists." ), gridSizeStr ) ); + return; + } + } + + gridCfg.sizes.insert( gridCfg.sizes.begin() + row, gridSizeStr ); + RebuildGridSizes(); + m_currentGridCtrl->SetSelection( row ); +} + + +void PANEL_GRID_SETTINGS::OnRemoveGrid( wxCommandEvent& event ) +{ + GRID_SETTINGS& gridCfg = m_cfg->m_Window.grid; + int row = m_currentGridCtrl->GetSelection(); + + if( gridCfg.sizes.size() <= 1 ) + { + DisplayError( this, wxString::Format( _( "At least one grid size is required." ) ) ); + return; + } + + gridCfg.sizes.erase( gridCfg.sizes.begin() + row ); + RebuildGridSizes(); + + if( row != 0 ) + m_currentGridCtrl->SetSelection( row - 1 ); +} + + +void PANEL_GRID_SETTINGS::OnMoveGridUp( wxCommandEvent& event ) +{ + GRID_SETTINGS& gridCfg = m_cfg->m_Window.grid; + int row = m_currentGridCtrl->GetSelection(); + + if( gridCfg.sizes.size() <= 1 || row == 0 ) + return; + + std::swap( gridCfg.sizes[row], gridCfg.sizes[row - 1] ); + RebuildGridSizes(); + + if( row != 0 ) + m_currentGridCtrl->SetSelection( row - 1 ); +} + + +void PANEL_GRID_SETTINGS::OnMoveGridDown( wxCommandEvent& event ) +{ + GRID_SETTINGS& gridCfg = m_cfg->m_Window.grid; + int row = m_currentGridCtrl->GetSelection(); + + if( gridCfg.sizes.size() <= 1 || row == ( (int) gridCfg.sizes.size() - 1 ) ) + return; + + std::swap( gridCfg.sizes[row], gridCfg.sizes[row + 1] ); + RebuildGridSizes(); + + if( row != 0 ) + m_currentGridCtrl->SetSelection( row + 1 ); +} diff --git a/common/dialogs/panel_grid_settings_base.cpp b/common/dialogs/panel_grid_settings_base.cpp new file mode 100644 index 0000000000..007c96ee62 --- /dev/null +++ b/common/dialogs/panel_grid_settings_base.cpp @@ -0,0 +1,228 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "widgets/std_bitmap_button.h" + +#include "panel_grid_settings_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerColumns; + bSizerColumns = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerLeftCol; + bSizerLeftCol = new wxBoxSizer( wxVERTICAL ); + + m_gridsLabel = new wxStaticText( this, wxID_ANY, _("Grids:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_gridsLabel->Wrap( -1 ); + bSizerLeftCol->Add( m_gridsLabel, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_currentGridCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_currentGridCtrl->SetMinSize( wxSize( 240,-1 ) ); + + bSizerLeftCol->Add( m_currentGridCtrl, 1, wxEXPAND|wxBOTTOM|wxLEFT, 3 ); + + wxBoxSizer* bSizerGridButtons; + bSizerGridButtons = new wxBoxSizer( wxHORIZONTAL ); + + m_addGridButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + bSizerGridButtons->Add( m_addGridButton, 0, wxRIGHT|wxLEFT, 5 ); + + m_moveUpButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + bSizerGridButtons->Add( m_moveUpButton, 0, wxRIGHT, 5 ); + + m_moveDownButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + bSizerGridButtons->Add( m_moveDownButton, 0, 0, 5 ); + + + bSizerGridButtons->Add( 25, 0, 0, wxEXPAND, 5 ); + + m_removeGridButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + bSizerGridButtons->Add( m_removeGridButton, 0, 0, 5 ); + + + bSizerLeftCol->Add( bSizerGridButtons, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); + + + bSizerColumns->Add( bSizerLeftCol, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + bSizerColumns->Add( 16, 0, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerRightCol; + bSizerRightCol = new wxBoxSizer( wxVERTICAL ); + + m_staticText21 = new wxStaticText( this, wxID_ANY, _("Fast Grid Switching"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21->Wrap( -1 ); + bSizerRightCol->Add( m_staticText21, 0, wxRIGHT|wxLEFT, 12 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerRightCol->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 2, 3, 6, 5 ); + fgSizer3->AddGrowableCol( 1 ); + fgSizer3->SetFlexibleDirection( wxBOTH ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextGrid1 = new wxStaticText( this, wxID_ANY, _("Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrid1->Wrap( -1 ); + fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 8 ); + + wxArrayString m_grid1CtrlChoices; + m_grid1Ctrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_grid1CtrlChoices, 0 ); + m_grid1Ctrl->SetSelection( 0 ); + fgSizer3->Add( m_grid1Ctrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_grid1HotKey = new wxStaticText( this, wxID_ANY, _("(hotkey)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_grid1HotKey->Wrap( -1 ); + fgSizer3->Add( m_grid1HotKey, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextGrid2 = new wxStaticText( this, wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrid2->Wrap( -1 ); + fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT, 8 ); + + wxArrayString m_grid2CtrlChoices; + m_grid2Ctrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_grid2CtrlChoices, 0 ); + m_grid2Ctrl->SetSelection( 0 ); + fgSizer3->Add( m_grid2Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_grid2HotKey = new wxStaticText( this, wxID_ANY, _("(hotkey)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_grid2HotKey->Wrap( -1 ); + fgSizer3->Add( m_grid2HotKey, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizerRightCol->Add( fgSizer3, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10 ); + + m_overridesLabel = new wxStaticText( this, wxID_ANY, _("Grid Overrides"), wxDefaultPosition, wxDefaultSize, 0 ); + m_overridesLabel->Wrap( -1 ); + bSizerRightCol->Add( m_overridesLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 ); + + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerRightCol->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 ); + + wxFlexGridSizer* fgGridOverrides; + fgGridOverrides = new wxFlexGridSizer( 5, 4, 4, 0 ); + fgGridOverrides->AddGrowableCol( 2 ); + 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_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 ); + + m_GridOverrideConnectedSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_GridOverrideConnectedSize->SetMinSize( wxSize( 80,-1 ) ); + + fgGridOverrides->Add( m_GridOverrideConnectedSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 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_checkGridOverrideWires = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgGridOverrides->Add( m_checkGridOverrideWires, 0, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxLEFT, 8 ); + + 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_GridOverrideWiresSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_GridOverrideWiresSize->SetMinSize( wxSize( 80,-1 ) ); + + fgGridOverrides->Add( m_GridOverrideWiresSize, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + 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 ); + + + bSizerRightCol->Add( fgGridOverrides, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10 ); + + + bSizerColumns->Add( bSizerRightCol, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + + bSizerMain->Add( bSizerColumns, 1, wxEXPAND|wxTOP, 8 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); + + // Connect Events + m_addGridButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnAddGrid ), NULL, this ); + m_moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnMoveGridUp ), NULL, this ); + m_moveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnMoveGridDown ), NULL, this ); + m_removeGridButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnRemoveGrid ), NULL, this ); +} + +PANEL_GRID_SETTINGS_BASE::~PANEL_GRID_SETTINGS_BASE() +{ + // Disconnect Events + m_addGridButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnAddGrid ), NULL, this ); + m_moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnMoveGridUp ), NULL, this ); + m_moveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnMoveGridDown ), NULL, this ); + m_removeGridButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_GRID_SETTINGS_BASE::OnRemoveGrid ), NULL, this ); + +} diff --git a/common/dialogs/panel_grid_settings_base.fbp b/common/dialogs/panel_grid_settings_base.fbp new file mode 100644 index 0000000000..6058331265 --- /dev/null +++ b/common/dialogs/panel_grid_settings_base.fbp @@ -0,0 +1,2443 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + panel_grid_settings_base + 1000 + none + + + 1 + panel_grid_settings_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_GRID_SETTINGS_BASE + + -1,-1 + RESETTABLE_PANEL; widgets/resettable_panel.h; forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + bSizerMain + wxVERTICAL + none + + 8 + wxEXPAND|wxTOP + 1 + + + bSizerColumns + wxHORIZONTAL + none + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizerLeftCol + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grids: + 0 + + 0 + + + 0 + + 1 + m_gridsLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 3 + wxEXPAND|wxBOTTOM|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 240,-1 + 1 + m_currentGridCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT + 0 + + + bSizerGridButtons + wxHORIZONTAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Add Grid + + 0 + + 0 + + + 0 + + 1 + m_addGridButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddGrid + + + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Move grid up in list + + 0 + + 0 + + + 0 + + 1 + m_moveUpButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveGridUp + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Move grid up in list + + 0 + + 0 + + + 0 + + 1 + m_moveDownButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveGridDown + + + + 5 + wxEXPAND + 0 + + 0 + protected + 25 + + + + 5 + + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Remove Grid + + 0 + + 0 + + + 0 + + 1 + m_removeGridButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveGrid + + + + + + + + 5 + wxEXPAND + 0 + + 0 + protected + 16 + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + + bSizerRightCol + wxVERTICAL + none + + 12 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Fast Grid Switching + 0 + + 0 + + + 0 + + 1 + m_staticText21 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 2 + 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_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 10 + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 3 + wxBOTH + 1 + + 5 + + fgSizer3 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 6 + + 8 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grid 1: + 0 + + 0 + + + 0 + + 1 + m_staticTextGrid1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + -1,-1 + 1 + m_grid1Ctrl + 1 + + + protected + 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 + (hotkey) + 0 + + 0 + + + 0 + + 1 + m_grid1HotKey + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + 8 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grid 2: + 0 + + 0 + + + 0 + + 1 + m_staticTextGrid2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + -1,-1 + 1 + m_grid2Ctrl + 1 + + + protected + 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 + (hotkey) + 0 + + 0 + + + 0 + + 1 + m_grid2HotKey + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + 13 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Grid Overrides + 0 + + 0 + + + 0 + + 1 + m_overridesLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 2 + 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_staticline3 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 10 + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 4 + wxBOTH + 2 + + 0 + + fgGridOverrides + wxFLEX_GROWMODE_SPECIFIED + none + 5 + 4 + + 8 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_checkGridOverrideConnected + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Connected items: + 0 + + 0 + + + 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 + 1 + + + protected + 1 + + Resizable + 1 + + + + 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 + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_checkGridOverrideWires + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 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 + Wires: + 0 + + 0 + + + 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 + 1 + + + protected + 1 + + Resizable + 1 + + + + 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 + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_checkGridOverrideVias + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 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 + Vias: + 0 + + 0 + + + 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 + 1 + + + protected + 1 + + Resizable + 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_staticTextViasUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 8 + wxALIGN_CENTER|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_checkGridOverrideText + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text: + 0 + + 0 + + + 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 + 1 + + + protected + 1 + + Resizable + 1 + + + + 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 + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_checkGridOverrideGraphics + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 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 + Graphics: + 0 + + 0 + + + 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 + 1 + + + protected + 1 + + Resizable + 1 + + + + 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/dialog_grid_settings_base.h b/common/dialogs/panel_grid_settings_base.h similarity index 65% rename from common/dialogs/dialog_grid_settings_base.h rename to common/dialogs/panel_grid_settings_base.h index 7b7645e07e..4e04748ab1 100644 --- a/common/dialogs/dialog_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-g8feb16b3) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -12,60 +12,57 @@ #include class STD_BITMAP_BUTTON; -#include "dialog_shim.h" +#include "widgets/resettable_panel.h" #include -#include +#include #include #include #include #include +#include #include #include #include #include #include #include -#include -#include -#include +#include #include #include -#include +#include +#include /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_GRID_SETTINGS_BASE +/// Class PANEL_GRID_SETTINGS_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_GRID_SETTINGS_BASE : public DIALOG_SHIM +class PANEL_GRID_SETTINGS_BASE : public RESETTABLE_PANEL { private: protected: + wxStaticText* m_gridsLabel; wxListBox* m_currentGridCtrl; STD_BITMAP_BUTTON* m_addGridButton; - STD_BITMAP_BUTTON* m_removeGridButton; STD_BITMAP_BUTTON* m_moveUpButton; STD_BITMAP_BUTTON* m_moveDownButton; - wxStaticBoxSizer* sbGridOriginSizer; - wxStaticText* m_staticTextGridPosX; - wxTextCtrl* m_GridOriginXCtrl; - wxStaticText* m_TextPosXUnits; - wxStaticText* m_staticTextGridPosY; - wxTextCtrl* m_GridOriginYCtrl; - wxStaticText* m_TextPosYUnits; + STD_BITMAP_BUTTON* m_removeGridButton; + wxStaticText* m_staticText21; + wxStaticLine* m_staticline2; wxStaticText* m_staticTextGrid1; wxChoice* m_grid1Ctrl; wxStaticText* m_grid1HotKey; wxStaticText* m_staticTextGrid2; wxChoice* m_grid2Ctrl; wxStaticText* m_grid2HotKey; - wxStaticBoxSizer* sbGridOverridesSizer; - wxCheckBox* m_checkGridOverrideConnectables; - wxStaticText* m_staticTextConnectables; - wxTextCtrl* m_GridOverrideConnectablesSize; - wxStaticText* m_staticTextConnectablesUnits; + wxStaticText* m_overridesLabel; + wxStaticLine* m_staticline3; + wxCheckBox* m_checkGridOverrideConnected; + wxStaticText* m_staticTextConnected; + wxTextCtrl* m_GridOverrideConnectedSize; + wxStaticText* m_staticTextConnectedUnits; wxCheckBox* m_checkGridOverrideWires; wxStaticText* m_staticTextWires; wxTextCtrl* m_GridOverrideWiresSize; @@ -82,26 +79,19 @@ class DIALOG_GRID_SETTINGS_BASE : public DIALOG_SHIM wxStaticText* m_staticTextGraphics; wxTextCtrl* m_GridOverrideGraphicsSize; wxStaticText* m_staticTextGraphicsUnits; - wxButton* m_buttonResetSizes; - wxStdDialogButtonSizer* m_sdbSizer; - wxButton* m_sdbSizerOK; - wxButton* m_sdbSizerCancel; // Virtual event handlers, override them in your derived class - virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnAddGrid( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRemoveGrid( wxCommandEvent& event ) { event.Skip(); } virtual void OnMoveGridUp( wxCommandEvent& event ) { event.Skip(); } virtual void OnMoveGridDown( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRemoveGrid( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_GRID_SETTINGS_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|wxRESIZE_BORDER ); + PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); - ~DIALOG_GRID_SETTINGS_BASE(); + ~PANEL_GRID_SETTINGS_BASE(); }; diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index e3c70976cc..94f9726623 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -1095,18 +1095,20 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent kiface->GetActions( hotkeysPanel->ActionsList() ); if( GetFrameType() == FRAME_SCH_SYMBOL_EDITOR ) - expand.push_back( book->GetPageCount() ); + expand.push_back( (int) book->GetPageCount() ); book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_GRIDS ), _( "Grids" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) ); if( GetFrameType() == FRAME_SCH ) - expand.push_back( book->GetPageCount() ); + expand.push_back( (int) book->GetPageCount() ); book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_GRIDS ), _( "Grids" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) ); @@ -1123,26 +1125,28 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent kiface->GetActions( hotkeysPanel->ActionsList() ); if( GetFrameType() == FRAME_FOOTPRINT_EDITOR ) - expand.push_back( book->GetPageCount() ); + expand.push_back( (int) book->GetPageCount() ); book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_GRIDS ), _( "Grids" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) ); if( GetFrameType() == FRAME_PCB_EDITOR ) - expand.push_back( book->GetPageCount() ); + expand.push_back( (int) book->GetPageCount() ); book->AddPage( new wxPanel( book ), _( "PCB Editor" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_GRIDS ), _( "Grids" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) ); if( GetFrameType() == FRAME_PCB_DISPLAY3D ) - expand.push_back( book->GetPageCount() ); + expand.push_back( (int) book->GetPageCount() ); book->AddPage( new wxPanel( book ), _( "3D Viewer" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) ); @@ -1160,7 +1164,7 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent kiface->GetActions( hotkeysPanel->ActionsList() ); if( GetFrameType() == FRAME_GERBER ) - expand.push_back( book->GetPageCount() ); + expand.push_back( (int) book->GetPageCount() ); book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) ); @@ -1177,10 +1181,11 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent kiface->GetActions( hotkeysPanel->ActionsList() ); if( GetFrameType() == FRAME_PL_EDITOR ) - expand.push_back( book->GetPageCount() ); + expand.push_back( (int) book->GetPageCount() ); book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_DS_GRIDS ), _( "Grids" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) ); book->AddLazyPage( diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index a0108c4d83..f25857379a 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include @@ -334,6 +333,9 @@ void EDA_DRAW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars m_galDisplayOptions.ReadCommonConfig( *settings, this ); + GetToolManager()->RunAction( ACTIONS::gridPreset, config()->m_Window.grid.last_size_idx ); + UpdateGridSelectBox(); + #ifndef __WXMAC__ resolveCanvasType(); @@ -487,18 +489,6 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) } -void EDA_DRAW_FRAME::OnGridSettings( wxCommandEvent& aEvent ) -{ - DIALOG_GRID_SETTINGS dlg( this ); - - if( dlg.ShowModal() == wxID_OK ) - { - UpdateStatusBar(); - GetCanvas()->Refresh(); - } -} - - bool EDA_DRAW_FRAME::IsGridVisible() const { wxCHECK( config(), true ); diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 85e29f6f9b..dc2de4a9a0 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -351,8 +351,8 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std: { m_params.emplace_back( new PARAM( aJsonPath + ".grid.overrides_enabled", &aWindow->grid.overrides_enabled, true ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connectables", - &aWindow->grid.override_connectables, true ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connected", + &aWindow->grid.override_connected, true ) ); m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_wires", &aWindow->grid.override_wires, true ) ); m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_vias", @@ -362,8 +362,8 @@ 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_connectables_size", - &aWindow->grid.override_connectables_size, + 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, @@ -381,8 +381,8 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std: { m_params.emplace_back( new PARAM( aJsonPath + ".grid.overrides_enabled", &aWindow->grid.overrides_enabled, false ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connectables", - &aWindow->grid.override_connectables, false ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_connected", + &aWindow->grid.override_connected, false ) ); m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_wires", &aWindow->grid.override_wires, false ) ); m_params.emplace_back( new PARAM( aJsonPath + ".grid.override_vias", @@ -392,8 +392,8 @@ 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_connectables_size", - &aWindow->grid.override_connectables_size, + 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" ) ); diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index e4faccfa29..25bbadcade 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2021-2023 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 @@ -542,7 +542,7 @@ TOOL_ACTION ACTIONS::gridSetOrigin( TOOL_ACTION_ARGS() .Scope( AS_GLOBAL ) .LegacyHotkeyName( "Set Grid Origin" ) .MenuText( _( "Grid Origin" ) ) - .Tooltip( _( "Set the grid origin point" ) ) + .Tooltip( _( "Place the grid origin point" ) ) .Icon( BITMAPS::grid_select_axis ) .Parameter( nullptr ) ); @@ -557,24 +557,32 @@ TOOL_ACTION ACTIONS::gridPreset( TOOL_ACTION_ARGS() .Parameter( 0 ) ); // Default to the 1st element of the list TOOL_ACTION ACTIONS::toggleGrid( TOOL_ACTION_ARGS() - .Name("common.Control.toggleGrid") + .Name( "common.Control.toggleGrid" ) .Scope( AS_GLOBAL) .MenuText( _( "Show Grid" ) ) .Tooltip( _( "Display background grid in the edit window" ) ) .Icon( BITMAPS::grid ) ); TOOL_ACTION ACTIONS::toggleGridOverrides( TOOL_ACTION_ARGS() - .Name("common.Control.toggleGridOverrides") + .Name( "common.Control.toggleGridOverrides" ) .DefaultHotkey( MD_CTRL + MD_SHIFT + 'G' ) .Scope( AS_GLOBAL) .MenuText( _( "Grid Overrides" ) ) .Tooltip( _( "Enables item-specific grids that override the current grid" ) ) .Icon( BITMAPS::grid_override ) ); -TOOL_ACTION ACTIONS::gridProperties( "common.Control.gridProperties", - AS_GLOBAL, 0, "", - _( "Grid Properties..." ), _( "Set grid dimensions" ), - BITMAPS::grid_select ); +TOOL_ACTION ACTIONS::gridProperties( TOOL_ACTION_ARGS() + .Name( "common.Control.editGrids" ) + .Scope( AS_GLOBAL ) + .MenuText( _( "Edit Grids..." ) ) + .Tooltip( _( "Edit grid definitions" ) ) + .Icon( BITMAPS::grid_select ) ); + +TOOL_ACTION ACTIONS::gridOrigin( TOOL_ACTION_ARGS() + .Name( "common.Control.editGridOrigin" ) + .Scope( AS_GLOBAL ) + .MenuText( _( "Grid Origin..." ) ) + .Tooltip( _( "Set the grid origin point" ) ) ); TOOL_ACTION ACTIONS::inchesUnits( TOOL_ACTION_ARGS() .Name( "common.Control.imperialUnits" ) diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index e96593d298..08c99b46f0 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -524,7 +525,6 @@ int COMMON_TOOLS::GridFastCycle( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::ToggleGrid( const TOOL_EVENT& aEvent ) { m_frame->SetGridVisibility( !m_frame->IsGridVisible() ); - return 0; } @@ -532,17 +532,40 @@ int COMMON_TOOLS::ToggleGrid( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::ToggleGridOverrides( const TOOL_EVENT& aEvent ) { m_frame->SetGridOverrides( !m_frame->IsGridOverridden() ); - return 0; } int COMMON_TOOLS::GridProperties( const TOOL_EVENT& aEvent ) { - wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); +#define SHOW_GRID_PREFS( parentName ) m_frame->ShowPreferences( _( "Grids" ), parentName ) + + switch( m_frame->GetFrameType() ) + { + case FRAME_SCH: SHOW_GRID_PREFS( _( "Schematic Editor" ) ); break; + case FRAME_SCH_SYMBOL_EDITOR: SHOW_GRID_PREFS( _( "Symbol Editor" ) ); break; + case FRAME_PCB_EDITOR: SHOW_GRID_PREFS( _( "PCB Editor" ) ); break; + case FRAME_FOOTPRINT_EDITOR: SHOW_GRID_PREFS( _( "Footprint Editor" ) ); break; + case FRAME_PL_EDITOR: SHOW_GRID_PREFS( _( "Drawing Sheet Editor" ) ); break; + default: wxFAIL_MSG( "Unknown frame: " + GetName() ); break; + } + return 0; +} - cmd.SetId( ID_GRID_SETTINGS ); - m_frame->ProcessEvent( cmd ); + +int COMMON_TOOLS::GridOrigin( const TOOL_EVENT& aEvent ) +{ + VECTOR2I origin = m_frame->GetGridOrigin(); + WX_PT_ENTRY_DIALOG dlg( m_frame, _( "Grid Origin" ), _( "X:" ), _( "Y:" ), origin ); + + if( dlg.ShowModal() == wxID_OK ) + { + m_frame->SetGridOrigin( dlg.GetValue() ); + + m_toolMgr->ResetTools( TOOL_BASE::REDRAW ); + m_toolMgr->RunAction( ACTIONS::gridSetOrigin, new VECTOR2D( m_frame->GetGridOrigin() ) ); + m_frame->GetCanvas()->ForceRefresh(); + } return 0; } @@ -687,6 +710,7 @@ void COMMON_TOOLS::setTransitions() Go( &COMMON_TOOLS::ToggleGrid, ACTIONS::toggleGrid.MakeEvent() ); Go( &COMMON_TOOLS::ToggleGridOverrides, ACTIONS::toggleGridOverrides.MakeEvent() ); Go( &COMMON_TOOLS::GridProperties, ACTIONS::gridProperties.MakeEvent() ); + Go( &COMMON_TOOLS::GridOrigin, ACTIONS::gridOrigin.MakeEvent() ); // Units and coordinates Go( &COMMON_TOOLS::SwitchUnits, ACTIONS::inchesUnits.MakeEvent() ); diff --git a/common/tool/grid_menu.cpp b/common/tool/grid_menu.cpp index 1702fd8286..2e999d3064 100644 --- a/common/tool/grid_menu.cpp +++ b/common/tool/grid_menu.cpp @@ -70,7 +70,7 @@ void GRID_MENU::update() APP_SETTINGS_BASE* settings = m_parent->config(); unsigned int current = settings->m_Window.grid.last_size_idx; wxArrayString gridsList; - int i = 0; + int i = ID_POPUP_GRID_START; GRID_MENU::BuildChoiceList( &gridsList, settings, m_parent ); @@ -78,10 +78,7 @@ void GRID_MENU::update() Delete( FindItemByPosition( 0 ) ); for( const wxString& grid : gridsList ) - { - Append( i, grid, wxEmptyString, wxITEM_CHECK )->Check( i == (int) current ); - i++; - } + Append( i++, grid, wxEmptyString, wxITEM_CHECK )->Check( i == (int) current ); } void GRID_MENU::BuildChoiceList( wxArrayString* aGridsList, APP_SETTINGS_BASE* aCfg, diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index 621c5dfb16..1bb8a47edf 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Wayne Stambaugh - * Copyright (C) 2007-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2007-2023 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 @@ -54,7 +54,6 @@ #include // Shared conditions with other Pcbnew frames #include // shared tools with other Pcbnew frames #include -#include #include #include #include @@ -64,7 +63,6 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow ) EVT_CHOICE( ID_ON_ZOOM_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectZoom ) EVT_CHOICE( ID_ON_GRID_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectGrid ) - EVT_MENU( ID_GRID_SETTINGS, DISPLAY_FOOTPRINTS_FRAME::OnGridSettings ) END_EVENT_TABLE() diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index b47cb0340e..26623db62e 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -197,6 +198,24 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER return new PANEL_SYM_DISPLAY_OPTIONS( aParent, cfg ); } + case PANEL_SYM_EDIT_GRIDS: + { + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + APP_SETTINGS_BASE* cfg = mgr.GetAppSettings(); + EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_SCH_VIEWER, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_SCH, false ); + + if( frame ) + SetUserUnits( frame->GetUserUnits() ); + + return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_SCH_SYMBOL_EDITOR ); + } + case PANEL_SYM_EDIT_OPTIONS: { EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false ); @@ -224,6 +243,24 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, cfg ); } + case PANEL_SCH_GRIDS: + { + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + APP_SETTINGS_BASE* cfg = mgr.GetAppSettings(); + EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_SCH_VIEWER, false ); + + if( frame ) + SetUserUnits( frame->GetUserUnits() ); + + return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_SCH ); + } + case PANEL_SCH_EDIT_OPTIONS: { EDA_BASE_FRAME* frame = aKiway->Player( FRAME_SCH, false ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index dadcd6b160..112cd2b0c5 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -197,21 +197,6 @@ void SCH_EDIT_FRAME::doReCreateMenuBar() viewMenu->Add( ACTIONS::zoomTool ); viewMenu->Add( ACTIONS::zoomRedraw ); - viewMenu->AppendSeparator(); - viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); - viewMenu->Add( ACTIONS::gridProperties ); - - // Units submenu - ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool ); - unitsSubMenu->SetTitle( _( "&Units" ) ); - unitsSubMenu->SetIcon( BITMAPS::unit_mm ); - unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); - viewMenu->Add( unitsSubMenu ); - - viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); - viewMenu->AppendSeparator(); viewMenu->Add( EE_ACTIONS::toggleHiddenPins, ACTION_MENU::CHECK ); viewMenu->Add( EE_ACTIONS::toggleHiddenFields, ACTION_MENU::CHECK ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 92354cc1cc..3d6a67415e 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -111,8 +111,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME ) EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit ) EVT_MENU( wxID_CLOSE, SCH_EDIT_FRAME::OnExit ) - EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) - // Drop files event EVT_DROP_FILES( SCH_EDIT_FRAME::OnDropFiles ) END_EVENT_TABLE() diff --git a/eeschema/symbol_editor/menubar_symbol_editor.cpp b/eeschema/symbol_editor/menubar_symbol_editor.cpp index a61cfacbc0..ca033ab570 100644 --- a/eeschema/symbol_editor/menubar_symbol_editor.cpp +++ b/eeschema/symbol_editor/menubar_symbol_editor.cpp @@ -116,21 +116,6 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar() viewMenu->Add( ACTIONS::zoomTool ); viewMenu->Add( ACTIONS::zoomRedraw ); - viewMenu->AppendSeparator(); - viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); - viewMenu->Add( ACTIONS::gridProperties ); - - // Units submenu - ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool ); - unitsSubMenu->SetTitle( _( "&Units" ) ); - unitsSubMenu->SetIcon( BITMAPS::unit_mm ); - unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); - viewMenu->Add( unitsSubMenu ); - - viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); - viewMenu->AppendSeparator(); viewMenu->Add( EE_ACTIONS::showSymbolTree, ACTION_MENU::CHECK ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index b4b54262f4..982650dc78 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -86,7 +86,6 @@ BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, SCH_BASE_FRAME ) // menubar commands EVT_MENU( wxID_EXIT, SYMBOL_EDIT_FRAME::OnExitKiCad ) EVT_MENU( wxID_CLOSE, SYMBOL_EDIT_FRAME::CloseWindow ) - EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) // Update user interface elements. EVT_UPDATE_UI( ID_LIBEDIT_SELECT_UNIT_NUMBER, SYMBOL_EDIT_FRAME::OnUpdateUnitNumber ) diff --git a/eeschema/symbol_editor/toolbars_symbol_editor.cpp b/eeschema/symbol_editor/toolbars_symbol_editor.cpp index a4fdbf76d5..f29d6b0dc4 100644 --- a/eeschema/symbol_editor/toolbars_symbol_editor.cpp +++ b/eeschema/symbol_editor/toolbars_symbol_editor.cpp @@ -177,6 +177,7 @@ void SYMBOL_EDIT_FRAME::ReCreateOptToolbar() EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); gridMenu->Add( ACTIONS::gridProperties ); + gridMenu->Add( ACTIONS::gridOrigin ); m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); m_optionsToolBar->Realize(); diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp index 2043ed3313..2d5044e5bb 100644 --- a/eeschema/symbol_viewer_frame.cpp +++ b/eeschema/symbol_viewer_frame.cpp @@ -93,7 +93,6 @@ BEGIN_EVENT_TABLE( SYMBOL_VIEWER_FRAME, SCH_BASE_FRAME ) // Menu (and/or hotkey) events EVT_MENU( wxID_CLOSE, SYMBOL_VIEWER_FRAME::CloseLibraryViewer ) - EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) EVT_UPDATE_UI( ID_LIBVIEW_SELECT_UNIT_NUMBER, SYMBOL_VIEWER_FRAME::onUpdateUnitChoice ) diff --git a/eeschema/toolbars_sch_editor.cpp b/eeschema/toolbars_sch_editor.cpp index 512c9f6bc6..2c1598b67b 100644 --- a/eeschema/toolbars_sch_editor.cpp +++ b/eeschema/toolbars_sch_editor.cpp @@ -223,6 +223,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); gridMenu->Add( ACTIONS::gridProperties ); + gridMenu->Add( ACTIONS::gridOrigin ); m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); m_optionsToolBar->KiRealize(); diff --git a/eeschema/toolbars_symbol_viewer.cpp b/eeschema/toolbars_symbol_viewer.cpp index ab04910303..497edbf6e9 100644 --- a/eeschema/toolbars_symbol_viewer.cpp +++ b/eeschema/toolbars_symbol_viewer.cpp @@ -122,8 +122,6 @@ void SYMBOL_VIEWER_FRAME::doReCreateMenuBar() viewMenu->Add( ACTIONS::zoomRedraw ); viewMenu->AppendSeparator(); - viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); - viewMenu->Add( ACTIONS::gridProperties ); viewMenu->AppendSeparator(); viewMenu->Add( EE_ACTIONS::showElectricalTypes, ACTION_MENU::CHECK ); diff --git a/eeschema/tools/ee_grid_helper.cpp b/eeschema/tools/ee_grid_helper.cpp index 7db817c7b5..abc8994136 100644 --- a/eeschema/tools/ee_grid_helper.cpp +++ b/eeschema/tools/ee_grid_helper.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 CERN - * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Tomasz Wlostowski * * This program is free software; you can redistribute it and/or @@ -256,29 +256,41 @@ VECTOR2D EE_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const switch( aGrid ) { case GRID_CONNECTABLE: - if( grid.override_connectables ) - g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( - schIUScale, EDA_UNITS::MILS, grid.override_connectables_size ); + if( grid.override_connected ) + { + g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( schIUScale, EDA_UNITS::MILS, + grid.override_connected_size ); + } 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 ); + } 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 ); + } 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 ); + } break; + default: break; } diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index a92953eccc..0ec559f00f 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -1564,10 +1564,10 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta ) int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent ) { - EE_GRID_HELPER grid( m_toolMgr); - EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::MovableItems ); + EE_GRID_HELPER grid( m_toolMgr); + EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::MovableItems ); GRID_HELPER_GRIDS selectionGrid = grid.GetSelectionGrid( selection ); - SCH_COMMIT commit( m_toolMgr ); + SCH_COMMIT commit( m_toolMgr ); auto doMoveItem = [&]( EDA_ITEM* item, const VECTOR2I& delta ) diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index b660b0b1e0..3708c96f8c 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -76,7 +76,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME ) GERBVIEW_FRAME::OnSelectHighlightChoice ) EVT_CHOICE( ID_ON_ZOOM_SELECT, GERBVIEW_FRAME::OnSelectZoom ) EVT_CHOICE( ID_ON_GRID_SELECT, GERBVIEW_FRAME::OnSelectGrid ) - EVT_MENU( ID_GRID_SETTINGS, GERBVIEW_FRAME::OnGridSettings ) EVT_UPDATE_UI( ID_ON_GRID_SELECT, GERBVIEW_FRAME::OnUpdateSelectGrid ) EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnUpdateSelectDCode ) diff --git a/include/dialogs/dialog_grid_settings.h b/include/dialogs/panel_grid_settings.h similarity index 66% rename from include/dialogs/dialog_grid_settings.h rename to include/dialogs/panel_grid_settings.h index 9e1a076879..b6f8021f9a 100644 --- a/include/dialogs/dialog_grid_settings.h +++ b/include/dialogs/panel_grid_settings.h @@ -21,24 +21,28 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef DIALOG_GRID_SETTINGS_H -#define DIALOG_GRID_SETTINGS_H +#ifndef PANEL_GRID_SETTINGS_H +#define PANEL_GRID_SETTINGS_H -#include +#include #include +#include +class APP_SETTINGS_BASE; -class DIALOG_GRID_SETTINGS : public DIALOG_GRID_SETTINGS_BASE -{ - EDA_DRAW_FRAME* m_parent; +class PANEL_GRID_SETTINGS : public PANEL_GRID_SETTINGS_BASE +{ public: /// This has no dependencies on calling wxFrame derivative, such as PCB_BASE_FRAME. - DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ); + PANEL_GRID_SETTINGS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource, + APP_SETTINGS_BASE* aCfg, FRAME_T aFrameType ); bool TransferDataFromWindow() override; bool TransferDataToWindow() override; + void ResetPanel() override; + private: void OnAddGrid( wxCommandEvent& event ) override; void OnRemoveGrid( wxCommandEvent& event ) override; @@ -47,13 +51,16 @@ private: void RebuildGridSizes(); - UNIT_BINDER m_gridOriginX; - UNIT_BINDER m_gridOriginY; - UNIT_BINDER m_gridOverrideConnectables; - UNIT_BINDER m_gridOverrideWires; - UNIT_BINDER m_gridOverrideVias; - UNIT_BINDER m_gridOverrideText; - UNIT_BINDER m_gridOverrideGraphics; +private: + UNITS_PROVIDER* m_unitsProvider; + APP_SETTINGS_BASE* m_cfg; + FRAME_T m_frameType; + + UNIT_BINDER m_gridOverrideConnected; + UNIT_BINDER m_gridOverrideWires; + UNIT_BINDER m_gridOverrideVias; + UNIT_BINDER m_gridOverrideText; + UNIT_BINDER m_gridOverrideGraphics; }; -#endif // DIALOG_GRID_SETTINGS_H +#endif // PANEL_GRID_SETTINGS_H diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h index 59a6340510..3606625c4d 100644 --- a/include/eda_draw_frame.h +++ b/include/eda_draw_frame.h @@ -3,7 +3,7 @@ * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -131,7 +131,7 @@ public: * The primary unit is the main unit of the frame, and the secondary unit is the unit * of the other system that was used most recently. */ - void GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondaryUnits ); + void GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondaryUnits ) override; /** * Return the absolute coordinates of the origin of the snap grid. @@ -234,8 +234,6 @@ public: */ void OnSelectGrid( wxCommandEvent& event ); - void OnGridSettings( wxCommandEvent& event ); - /** * Rebuild the grid combobox to respond to any changes in the GUI (units, user * grid changes, etc.). diff --git a/include/frame_type.h b/include/frame_type.h index d3b0295d18..aa865379ae 100644 --- a/include/frame_type.h +++ b/include/frame_type.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 CERN - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -66,21 +66,25 @@ enum FRAME_T FRAME_T_COUNT, PANEL_SYM_DISP_OPTIONS = FRAME_T_COUNT, + PANEL_SYM_EDIT_GRIDS, PANEL_SYM_EDIT_OPTIONS, PANEL_SYM_COLORS, PANEL_SCH_DISP_OPTIONS, + PANEL_SCH_GRIDS, PANEL_SCH_EDIT_OPTIONS, PANEL_SCH_ANNO_OPTIONS, PANEL_SCH_COLORS, PANEL_SCH_FIELD_NAME_TEMPLATES, PANEL_FP_DISPLAY_OPTIONS, + PANEL_FP_GRIDS, PANEL_FP_EDIT_OPTIONS, PANEL_FP_COLORS, PANEL_FP_DEFAULT_VALUES, PANEL_PCB_DISPLAY_OPTIONS, + PANEL_PCB_GRIDS, PANEL_PCB_EDIT_OPTIONS, PANEL_PCB_COLORS, PANEL_PCB_ACTION_PLUGINS, @@ -96,6 +100,7 @@ enum FRAME_T PANEL_GBR_COLORS, PANEL_DS_DISPLAY_OPTIONS, + PANEL_DS_GRIDS, PANEL_DS_COLORS, // Library table dialogs are transient and are never returned diff --git a/include/id.h b/include/id.h index b88b9fe001..332493cd26 100644 --- a/include/id.h +++ b/include/id.h @@ -143,7 +143,6 @@ enum main_id ID_ON_ZOOM_SELECT, ID_ON_GRID_SELECT, - ID_GRID_SETTINGS, // Popup Menu (mouse Right button) (id consecutifs) diff --git a/include/settings/app_settings.h b/include/settings/app_settings.h index e496922cc1..b96700eb69 100644 --- a/include/settings/app_settings.h +++ b/include/settings/app_settings.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2023 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 @@ -63,8 +63,8 @@ struct GRID_SETTINGS int snap; bool force_component_snap; bool overrides_enabled; - bool override_connectables; - wxString override_connectables_size; + bool override_connected; + wxString override_connected_size; bool override_wires; wxString override_wires_size; bool override_vias; diff --git a/include/tool/actions.h b/include/tool/actions.h index 781a43a042..773b7e1ef9 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013-2016 CERN - * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -145,6 +145,7 @@ public: static TOOL_ACTION toggleGrid; static TOOL_ACTION toggleGridOverrides; static TOOL_ACTION gridProperties; + static TOOL_ACTION gridOrigin; // Units static TOOL_ACTION inchesUnits; diff --git a/include/tool/common_tools.h b/include/tool/common_tools.h index f3e12e4849..0166a20216 100644 --- a/include/tool/common_tools.h +++ b/include/tool/common_tools.h @@ -87,6 +87,7 @@ public: int ToggleGridOverrides( const TOOL_EVENT& aEvent ); int GridProperties( const TOOL_EVENT& aEvent ); int GridPreset( int idx ); + int GridOrigin( const TOOL_EVENT& aEvent ); int OnGridChanged( bool aFromHotkey = true ); const std::vector Grids() const { return m_grids; } diff --git a/include/tool/grid_helper.h b/include/tool/grid_helper.h index aba0517836..d37183658b 100644 --- a/include/tool/grid_helper.h +++ b/include/tool/grid_helper.h @@ -170,23 +170,23 @@ protected: const VECTOR2I& aOffset ) const; protected: - std::vector m_anchors; - - TOOL_MANAGER* m_toolMgr; - std::optional m_auxAxis; - - int m_maskTypes; // Mask of allowed snap types - - bool m_enableSnap; // Allow snapping to other items on the layers - bool m_enableGrid; // If true, allow snapping to grid - bool m_enableSnapLine; // Allow drawing lines from snap points - ANCHOR* m_snapItem; // Pointer to the currently snapped item in m_anchors - // (NULL if not snapped) - VECTOR2I m_skipPoint; // When drawing a line, we avoid snapping to the source - // point - KIGFX::ORIGIN_VIEWITEM m_viewSnapPoint; - KIGFX::ORIGIN_VIEWITEM m_viewSnapLine; - KIGFX::ORIGIN_VIEWITEM m_viewAxis; + std::vector m_anchors; + + TOOL_MANAGER* m_toolMgr; + std::optional m_auxAxis; + + int m_maskTypes; // Mask of allowed snap types + + bool m_enableSnap; // Allow snapping to other items on the layers + bool m_enableGrid; // If true, allow snapping to grid + bool m_enableSnapLine; // Allow drawing lines from snap points + ANCHOR* m_snapItem; // Pointer to the currently snapped item in m_anchors + // (NULL if not snapped) + VECTOR2I m_skipPoint; // When drawing a line, we avoid snapping to the + // source point + KIGFX::ORIGIN_VIEWITEM m_viewSnapPoint; + KIGFX::ORIGIN_VIEWITEM m_viewSnapLine; + KIGFX::ORIGIN_VIEWITEM m_viewAxis; }; #endif diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h index 961d52272f..c056a5950f 100644 --- a/include/tool/tool_manager.h +++ b/include/tool/tool_manager.h @@ -141,8 +141,7 @@ public: * depends on the action. * @return False if the action was not found. */ - template>* = nullptr> + template>* = nullptr> bool RunAction( const std::string& aActionName, T aParam ) { // Use a cast to ensure the proper type is stored inside the parameter @@ -170,8 +169,7 @@ public: * depends on the action. * @return True if the action was handled immediately */ - template>* = nullptr> + template>* = nullptr> bool RunAction( const TOOL_ACTION& aAction, T aParam ) { // Use a cast to ensure the proper type is stored inside the parameter diff --git a/include/units_provider.h b/include/units_provider.h index 1c6572deb2..7c67649d6e 100644 --- a/include/units_provider.h +++ b/include/units_provider.h @@ -42,6 +42,17 @@ public: EDA_UNITS GetUserUnits() const { return m_userUnits; } void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; } + virtual void GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondaryUnits ) + { + aPrimaryUnit = GetUserUnits(); + aSecondaryUnits = EDA_UNITS::MILS; + + if( EDA_UNIT_UTILS::IsImperialUnit( aPrimaryUnit ) ) + aSecondaryUnits = EDA_UNITS::MILLIMETRES; + else + aSecondaryUnits = EDA_UNITS::MILS; + } + const EDA_IU_SCALE& GetIuScale() const { return m_iuScale; } // No SetIuScale(); scale is invariant diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index 72adbc3422..e393b1eb0e 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -112,21 +112,6 @@ void PL_EDITOR_FRAME::doReCreateMenuBar() viewMenu->Add( ACTIONS::zoomTool ); viewMenu->Add( ACTIONS::zoomRedraw ); - viewMenu->AppendSeparator(); - viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); - viewMenu->Add( ACTIONS::gridProperties ); - - // Units submenu - ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool ); - unitsSubMenu->SetTitle( _( "&Units" ) ); - unitsSubMenu->SetIcon( BITMAPS::unit_mm ); - unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); - viewMenu->Add( unitsSubMenu ); - - viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); - viewMenu->AppendSeparator(); viewMenu->Add( PL_ACTIONS::previewSettings ); diff --git a/pagelayout_editor/pl_editor.cpp b/pagelayout_editor/pl_editor.cpp index a5a1d2ffc1..241fd75a78 100644 --- a/pagelayout_editor/pl_editor.cpp +++ b/pagelayout_editor/pl_editor.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "pl_editor_frame.h" #include "pl_editor_settings.h" @@ -40,12 +41,13 @@ namespace PGE { -static struct IFACE : public KIFACE_BASE +static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER { // Of course all are virtual overloads, implementations of the KIFACE. IFACE( const char* aName, KIWAY::FACE_T aType ) : - KIFACE_BASE( aName, aType ) + KIFACE_BASE( aName, aType ), + UNITS_PROVIDER( drawSheetIUScale, EDA_UNITS::MILLIMETRES ) {} bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override; @@ -68,6 +70,18 @@ static struct IFACE : public KIFACE_BASE return new PANEL_PL_EDITOR_DISPLAY_OPTIONS( aParent, cfg ); } + case PANEL_DS_GRIDS: + { + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + APP_SETTINGS_BASE* cfg = mgr.GetAppSettings(); + EDA_BASE_FRAME* frame = aKiway->Player( FRAME_PL_EDITOR, false ); + + if( frame ) + SetUserUnits( frame->GetUserUnits() ); + + return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_PL_EDITOR ); + } + case PANEL_DS_COLORS: return new PANEL_PL_EDITOR_COLOR_SETTINGS( aParent ); diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index b103b304da..36cf50a226 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -71,8 +71,6 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME ) EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PL_EDITOR_FRAME::OnFileHistory ) EVT_MENU( ID_FILE_LIST_CLEAR, PL_EDITOR_FRAME::OnClearFileHistory ) - EVT_MENU( ID_GRID_SETTINGS, PL_EDITOR_FRAME::OnGridSettings ) - EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner ) EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::OnSelectPage ) diff --git a/pagelayout_editor/toolbars_pl_editor.cpp b/pagelayout_editor/toolbars_pl_editor.cpp index 042a4a2dcd..5e39ae9792 100644 --- a/pagelayout_editor/toolbars_pl_editor.cpp +++ b/pagelayout_editor/toolbars_pl_editor.cpp @@ -174,6 +174,7 @@ void PL_EDITOR_FRAME::ReCreateOptToolbar() PL_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); gridMenu->Add( ACTIONS::gridProperties ); + gridMenu->Add( ACTIONS::gridOrigin ); m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 1da72ab6c8..da242d5c36 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -88,7 +88,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_EDIT_FRAME::OnSaveFootprintToBoard ) // Horizontal toolbar - EVT_MENU( ID_GRID_SETTINGS, FOOTPRINT_EDIT_FRAME::OnGridSettings ) EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, FOOTPRINT_EDIT_FRAME::SelectLayer ) // UI update events. diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 1031f29d86..87e050ba6b 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -92,7 +92,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB ) EVT_CHOICE( ID_ON_ZOOM_SELECT, FOOTPRINT_VIEWER_FRAME::OnSelectZoom ) EVT_CHOICE( ID_ON_GRID_SELECT, FOOTPRINT_VIEWER_FRAME::OnSelectGrid ) - EVT_MENU( ID_GRID_SETTINGS, FOOTPRINT_VIEWER_FRAME::OnGridSettings ) EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton ) diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 05314bcdf9..ea43604a08 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -129,22 +129,6 @@ void FOOTPRINT_EDIT_FRAME::doReCreateMenuBar() viewMenu->Add( ACTIONS::zoomTool ); viewMenu->Add( ACTIONS::zoomRedraw ); - viewMenu->AppendSeparator(); - viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); - viewMenu->Add( ACTIONS::gridProperties ); - viewMenu->Add( PCB_ACTIONS::togglePolarCoords, ACTION_MENU::CHECK ); - - // Units submenu - ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool ); - unitsSubMenu->SetTitle( _( "&Units" ) ); - unitsSubMenu->SetIcon( BITMAPS::unit_mm ); - unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); - viewMenu->Add( unitsSubMenu ); - - viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); - viewMenu->AppendSeparator(); // Drawing Mode Submenu ACTION_MENU* drawingModeSubMenu = new ACTION_MENU( false, selTool ); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index f7b03b0f98..525c2fcf18 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -237,26 +237,6 @@ void PCB_EDIT_FRAME::doReCreateMenuBar() viewMenu->Add( ACTIONS::zoomTool ); viewMenu->Add( ACTIONS::zoomRedraw ); - viewMenu->AppendSeparator(); - viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); - viewMenu->Add( ACTIONS::gridProperties ); - viewMenu->Add( PCB_ACTIONS::togglePolarCoords, ACTION_MENU::CHECK ); - - // Units submenu - ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool ); - unitsSubMenu->SetTitle( _( "&Units" ) ); - unitsSubMenu->SetIcon( BITMAPS::unit_mm ); - unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); - unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); - viewMenu->Add( unitsSubMenu ); - - viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); - - viewMenu->AppendSeparator(); - viewMenu->Add( PCB_ACTIONS::showRatsnest, ACTION_MENU::CHECK ); - viewMenu->Add( PCB_ACTIONS::ratsnestLineMode, ACTION_MENU::CHECK ); - viewMenu->AppendSeparator(); // Drawing Mode Submenu ACTION_MENU* drawingModeSubMenu = new ACTION_MENU( false, selTool ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 5f9dcbdb2d..4ba7a82c8b 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -153,9 +153,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit ) EVT_MENU( wxID_CLOSE, PCB_EDIT_FRAME::OnQuit ) - // menu Config - EVT_MENU( ID_GRID_SETTINGS, PCB_EDIT_FRAME::OnGridSettings ) - // menu Postprocess EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard ) diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index a6372fe376..f3977106af 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -150,6 +151,24 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER return new PANEL_DISPLAY_OPTIONS( aParent, cfg ); } + case PANEL_FP_GRIDS: + { + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + APP_SETTINGS_BASE* cfg = mgr.GetAppSettings(); + EDA_BASE_FRAME* frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_PCB_EDITOR, false ); + + if( frame ) + SetUserUnits( frame->GetUserUnits() ); + + return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_FOOTPRINT_EDITOR ); + } + case PANEL_FP_EDIT_OPTIONS: { EDA_BASE_FRAME* frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false ); @@ -193,6 +212,24 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER return new PANEL_DISPLAY_OPTIONS( aParent, cfg ); } + case PANEL_PCB_GRIDS: + { + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + APP_SETTINGS_BASE* cfg = mgr.GetAppSettings(); + EDA_BASE_FRAME* frame = aKiway->Player( FRAME_PCB_EDITOR, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false ); + + if( frame ) + SetUserUnits( frame->GetUserUnits() ); + + return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_PCB_EDITOR ); + } + case PANEL_PCB_EDIT_OPTIONS: { EDA_BASE_FRAME* frame = aKiway->Player( FRAME_PCB_EDITOR, false ); diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index 433d18b7ce..b5bd873d8a 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -255,6 +255,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar() PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); gridMenu->Add( ACTIONS::gridProperties ); + gridMenu->Add( ACTIONS::gridOrigin ); m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); m_optionsToolBar->KiRealize(); diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 1f159f2627..e29fdcce9e 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -361,6 +361,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); gridMenu->Add( ACTIONS::gridProperties ); + gridMenu->Add( ACTIONS::gridOrigin ); m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); m_optionsToolBar->KiRealize(); diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 5b9398eaf9..c570dcc8a5 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -541,7 +541,7 @@ void PCB_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame, } -int PCB_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent ) +int PCB_CONTROL::GridPlaceOrigin( const TOOL_EVENT& aEvent ) { VECTOR2D* origin = aEvent.Parameter(); @@ -1680,7 +1680,7 @@ void PCB_CONTROL::setTransitions() Go( &PCB_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() ); // Grid control - Go( &PCB_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() ); + Go( &PCB_CONTROL::GridPlaceOrigin, ACTIONS::gridSetOrigin.MakeEvent() ); Go( &PCB_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() ); Go( &PCB_CONTROL::Undo, ACTIONS::undo.MakeEvent() ); diff --git a/pcbnew/tools/pcb_control.h b/pcbnew/tools/pcb_control.h index 5481985ee1..152879504c 100644 --- a/pcbnew/tools/pcb_control.h +++ b/pcbnew/tools/pcb_control.h @@ -81,7 +81,7 @@ public: int LayerAlphaDec( const TOOL_EVENT& aEvent ); // Grid control - int GridSetOrigin( const TOOL_EVENT& aEvent ); + int GridPlaceOrigin( const TOOL_EVENT& aEvent ); int GridResetOrigin( const TOOL_EVENT& aEvent ); // Low-level access (below undo) to setting the grid origin diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 3d82616906..a71ba4bc70 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -424,34 +424,50 @@ VECTOR2D PCB_GRID_HELPER::GetGridSize( GRID_HELPER_GRIDS aGrid ) const switch( aGrid ) { case GRID_CONNECTABLE: - if( grid.override_connectables ) + if( grid.override_connected ) + { g.x = g.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( - pcbIUScale, EDA_UNITS::MILLIMETRES, grid.override_connectables_size ); + pcbIUScale, EDA_UNITS::MILLIMETRES, grid.override_connected_size ); + } 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 ); + } + 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 ); + } 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 ); + } 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 ); + } break; + default: break; }