Browse Source
Move grid definitions to Prefs and grid origin to a separate dlg.
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/2262newinvert
54 changed files with 3360 additions and 3560 deletions
-
4common/CMakeLists.txt
-
303common/dialogs/dialog_grid_settings.cpp
-
276common/dialogs/dialog_grid_settings_base.cpp
-
2698common/dialogs/dialog_grid_settings_base.fbp
-
35common/dialogs/dialog_unit_entry_base.cpp
-
110common/dialogs/dialog_unit_entry_base.fbp
-
293common/dialogs/panel_grid_settings.cpp
-
228common/dialogs/panel_grid_settings_base.cpp
-
2443common/dialogs/panel_grid_settings_base.fbp
-
54common/dialogs/panel_grid_settings_base.h
-
19common/eda_base_frame.cpp
-
16common/eda_draw_frame.cpp
-
16common/settings/app_settings.cpp
-
24common/tool/actions.cpp
-
34common/tool/common_tools.cpp
-
7common/tool/grid_menu.cpp
-
4cvpcb/display_footprints_frame.cpp
-
37eeschema/eeschema.cpp
-
15eeschema/menubar.cpp
-
2eeschema/sch_edit_frame.cpp
-
15eeschema/symbol_editor/menubar_symbol_editor.cpp
-
1eeschema/symbol_editor/symbol_edit_frame.cpp
-
1eeschema/symbol_editor/toolbars_symbol_editor.cpp
-
1eeschema/symbol_viewer_frame.cpp
-
1eeschema/toolbars_sch_editor.cpp
-
2eeschema/toolbars_symbol_viewer.cpp
-
20eeschema/tools/ee_grid_helper.cpp
-
6eeschema/tools/sch_move_tool.cpp
-
1gerbview/events_called_functions.cpp
-
37include/dialogs/panel_grid_settings.h
-
6include/eda_draw_frame.h
-
7include/frame_type.h
-
1include/id.h
-
6include/settings/app_settings.h
-
3include/tool/actions.h
-
1include/tool/common_tools.h
-
34include/tool/grid_helper.h
-
6include/tool/tool_manager.h
-
11include/units_provider.h
-
15pagelayout_editor/menubar.cpp
-
18pagelayout_editor/pl_editor.cpp
-
2pagelayout_editor/pl_editor_frame.cpp
-
1pagelayout_editor/toolbars_pl_editor.cpp
-
1pcbnew/footprint_edit_frame.cpp
-
1pcbnew/footprint_viewer_frame.cpp
-
16pcbnew/menubar_footprint_editor.cpp
-
20pcbnew/menubar_pcb_editor.cpp
-
3pcbnew/pcb_edit_frame.cpp
-
37pcbnew/pcbnew.cpp
-
1pcbnew/toolbars_footprint_editor.cpp
-
1pcbnew/toolbars_pcb_editor.cpp
-
4pcbnew/tools/pcb_control.cpp
-
2pcbnew/tools/pcb_control.h
-
20pcbnew/tools/pcb_grid_helper.cpp
@ -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 <bitmaps.h>
|
|||
#include <confirm.h>
|
|||
#include <wx/textdlg.h>
|
|||
#include <dialogs/dialog_grid_settings.h>
|
|||
#include <widgets/std_bitmap_button.h>
|
|||
#include <common.h>
|
|||
#include <settings/app_settings.h>
|
|||
#include <eda_draw_frame.h>
|
|||
#include <tool/tool_manager.h>
|
|||
#include <tool/actions.h>
|
|||
#include <tool/grid_menu.h>
|
|||
#include <tool/common_tools.h>
|
|||
#include <pgm_base.h>
|
|||
#include <settings/settings_manager.h>
|
|||
|
|||
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 ); |
|||
} |
|||
@ -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 ); |
|||
|
|||
} |
|||
2698
common/dialogs/dialog_grid_settings_base.fbp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -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 <bitmaps.h>
|
|||
#include <confirm.h>
|
|||
#include <wx/textdlg.h>
|
|||
#include <dialogs/panel_grid_settings.h>
|
|||
#include <widgets/std_bitmap_button.h>
|
|||
#include <common.h>
|
|||
#include <settings/app_settings.h>
|
|||
#include <eda_draw_frame.h>
|
|||
#include <tool/tool_manager.h>
|
|||
#include <tool/actions.h>
|
|||
#include <tool/grid_menu.h>
|
|||
#include <tool/common_tools.h>
|
|||
#include <pgm_base.h>
|
|||
#include <settings/settings_manager.h>
|
|||
|
|||
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 ); |
|||
} |
|||
@ -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 ); |
|||
|
|||
} |
|||
2443
common/dialogs/panel_grid_settings_base.fbp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue