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
This commit is contained in:
parent
b3aa8a0c49
commit
4fefd95e0c
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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 );
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">300,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
@ -258,9 +258,28 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerButtons</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">100</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_RIGHT</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="0">
|
||||
<property name="Apply">0</property>
|
||||
|
@ -278,6 +297,8 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
|
@ -312,12 +333,12 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">3</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols"></property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -389,8 +410,8 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -425,7 +446,7 @@
|
|||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">300,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textCtrlX</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
@ -575,7 +596,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -611,7 +632,7 @@
|
|||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">300,-1</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textCtrlY</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
@ -702,7 +723,26 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_RIGHT</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerButtons</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">100</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
|
@ -721,4 +761,6 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
||||
|
|
|
@ -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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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 <wx/intl.h>
|
||||
class STD_BITMAP_BUTTON;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include "widgets/resettable_panel.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// 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();
|
||||
|
||||
};
|
||||
|
|
@ -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(
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include <widgets/properties_panel.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/snglinst.h>
|
||||
#include <dialogs/dialog_grid_settings.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <widgets/search_pane.h>
|
||||
#include <wx/dirdlg.h>
|
||||
|
@ -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 );
|
||||
|
|
|
@ -351,8 +351,8 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std:
|
|||
{
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.overrides_enabled",
|
||||
&aWindow->grid.overrides_enabled, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_connectables",
|
||||
&aWindow->grid.override_connectables, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_connected",
|
||||
&aWindow->grid.override_connected, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_wires",
|
||||
&aWindow->grid.override_wires, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_vias",
|
||||
|
@ -362,8 +362,8 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std:
|
|||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_graphics",
|
||||
&aWindow->grid.override_graphics, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.override_connectables_size",
|
||||
&aWindow->grid.override_connectables_size,
|
||||
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.override_connected_size",
|
||||
&aWindow->grid.override_connected_size,
|
||||
"50 mil" ) );
|
||||
m_params.emplace_back( new PARAM<wxString>( 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<bool>( aJsonPath + ".grid.overrides_enabled",
|
||||
&aWindow->grid.overrides_enabled, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_connectables",
|
||||
&aWindow->grid.override_connectables, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_connected",
|
||||
&aWindow->grid.override_connected, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_wires",
|
||||
&aWindow->grid.override_wires, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_vias",
|
||||
|
@ -392,8 +392,8 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std:
|
|||
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_graphics",
|
||||
&aWindow->grid.override_graphics, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.override_connectables_size",
|
||||
&aWindow->grid.override_connectables_size,
|
||||
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.override_connected_size",
|
||||
&aWindow->grid.override_connected_size,
|
||||
"0.25 mm" ) );
|
||||
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.override_text_size",
|
||||
&aWindow->grid.override_text_size, ".05 mm" ) );
|
||||
|
|
|
@ -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<VECTOR2D*>( nullptr ) );
|
||||
|
||||
|
@ -557,24 +557,32 @@ TOOL_ACTION ACTIONS::gridPreset( TOOL_ACTION_ARGS()
|
|||
.Parameter<int>( 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" )
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <dialogs/dialog_configure_paths.h>
|
||||
#include <dialogs/dialog_unit_entry.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <id.h>
|
||||
|
@ -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 )
|
||||
|
||||
cmd.SetId( ID_GRID_SETTINGS );
|
||||
m_frame->ProcessEvent( cmd );
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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() );
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* 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 <tools/pcb_editor_conditions.h> // Shared conditions with other Pcbnew frames
|
||||
#include <tools/pcb_viewer_tools.h> // shared tools with other Pcbnew frames
|
||||
#include <tools/cvpcb_fpviewer_selection_tool.h>
|
||||
#include <widgets/wx_infobar.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/debug.h>
|
||||
#include <cvpcb_id.h>
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <transform.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <dialogs/dialog_global_sym_lib_table_config.h>
|
||||
#include <dialogs/panel_grid_settings.h>
|
||||
#include <dialogs/panel_sym_lib_table.h>
|
||||
#include <kiway.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
@ -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<SYMBOL_EDITOR_SETTINGS>();
|
||||
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<EESCHEMA_SETTINGS>();
|
||||
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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -177,6 +177,7 @@ void SYMBOL_EDIT_FRAME::ReCreateOptToolbar()
|
|||
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
||||
gridMenu->Add( ACTIONS::gridProperties );
|
||||
gridMenu->Add( ACTIONS::gridOrigin );
|
||||
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
|
||||
|
||||
m_optionsToolBar->Realize();
|
||||
|
|
|
@ -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 )
|
||||
|
||||
|
|
|
@ -223,6 +223,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
|
|||
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
||||
gridMenu->Add( ACTIONS::gridProperties );
|
||||
gridMenu->Add( ACTIONS::gridOrigin );
|
||||
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
|
||||
|
||||
m_optionsToolBar->KiRealize();
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 <dialog_grid_settings_base.h>
|
||||
#include <panel_grid_settings_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <frame_type.h>
|
||||
|
||||
class APP_SETTINGS_BASE;
|
||||
|
||||
|
||||
class DIALOG_GRID_SETTINGS : public DIALOG_GRID_SETTINGS_BASE
|
||||
class PANEL_GRID_SETTINGS : public PANEL_GRID_SETTINGS_BASE
|
||||
{
|
||||
EDA_DRAW_FRAME* m_parent;
|
||||
|
||||
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;
|
||||
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
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* 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.).
|
||||
|
|
|
@ -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 <maciej.suminski@cern.ch>
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* 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;
|
||||
|
|
|
@ -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 <maciej.suminski@cern.ch>
|
||||
*
|
||||
* 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;
|
||||
|
|
|
@ -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<VECTOR2I> Grids() const { return m_grids; }
|
||||
|
|
|
@ -182,8 +182,8 @@ protected:
|
|||
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
|
||||
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;
|
||||
|
|
|
@ -141,8 +141,7 @@ public:
|
|||
* depends on the action.
|
||||
* @return False if the action was not found.
|
||||
*/
|
||||
template<typename T,
|
||||
std::enable_if_t<!std::is_convertible_v<T*, COMMIT*>>* = nullptr>
|
||||
template<typename T, std::enable_if_t<!std::is_convertible_v<T*, COMMIT*>>* = 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<typename T,
|
||||
std::enable_if_t<!std::is_convertible_v<T, COMMIT*>>* = nullptr>
|
||||
template<typename T, std::enable_if_t<!std::is_convertible_v<T, COMMIT*>>* = nullptr>
|
||||
bool RunAction( const TOOL_ACTION& aAction, T aParam )
|
||||
{
|
||||
// Use a cast to ensure the proper type is stored inside the parameter
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <settings/settings_manager.h>
|
||||
#include <dialogs/panel_pl_editor_display_options.h>
|
||||
#include <dialogs/panel_pl_editor_color_settings.h>
|
||||
#include <dialogs/panel_grid_settings.h>
|
||||
|
||||
#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<PL_EDITOR_SETTINGS>();
|
||||
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 );
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
||||
|
|
|
@ -174,6 +174,7 @@ void PL_EDITOR_FRAME::ReCreateOptToolbar()
|
|||
PL_SELECTION_TOOL* selTool = m_toolManager->GetTool<PL_SELECTION_TOOL>();
|
||||
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( 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 );
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 )
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 )
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <footprint_preview_panel.h>
|
||||
#include <footprint_info_impl.h>
|
||||
#include <dialogs/dialog_configure_paths.h>
|
||||
#include <dialogs/panel_grid_settings.h>
|
||||
#include <dialog_global_fp_lib_table_config.h>
|
||||
#include <panel_display_options.h>
|
||||
#include <panel_edit_options.h>
|
||||
|
@ -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<FOOTPRINT_EDITOR_SETTINGS>();
|
||||
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<PCBNEW_SETTINGS>();
|
||||
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 );
|
||||
|
|
|
@ -255,6 +255,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
|
|||
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
|
||||
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
||||
gridMenu->Add( ACTIONS::gridProperties );
|
||||
gridMenu->Add( ACTIONS::gridOrigin );
|
||||
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
|
||||
|
||||
m_optionsToolBar->KiRealize();
|
||||
|
|
|
@ -361,6 +361,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
|
|||
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
|
||||
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
||||
gridMenu->Add( ACTIONS::gridProperties );
|
||||
gridMenu->Add( ACTIONS::gridOrigin );
|
||||
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
|
||||
|
||||
m_optionsToolBar->KiRealize();
|
||||
|
|
|
@ -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<VECTOR2D*>();
|
||||
|
||||
|
@ -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() );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue