Push grid settings dialogs down into common.

This also gives support for fast grid switching and a user grid
to eeschema.

Fixes https://gitlab.com/kicad/code/kicad/issues/2200
This commit is contained in:
Jeff Young 2020-06-14 16:08:47 +01:00
parent b7ec66dc9b
commit ad12c42e8b
49 changed files with 1049 additions and 1485 deletions

View File

@ -10,7 +10,6 @@ include_directories( BEFORE ${INC_BEFORE} )
include_directories( ${INC_AFTER} )
set( BITMAP2COMPONENT_SRCS
${CMAKE_SOURCE_DIR}/common/base_units.cpp
${CMAKE_SOURCE_DIR}/common/single_top.cpp
bitmap2cmp_main.cpp
bitmap2cmp_settings.cpp

View File

@ -163,6 +163,8 @@ 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_image_editor.cpp
dialogs/dialog_image_editor_base.cpp

View File

@ -41,12 +41,16 @@
#include <title_block.h>
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
#define IU_TO_MM( x ) ( x / IU_PER_MM )
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )
#define IU_TO_MILS( x ) ( x / IU_PER_MILS )
#define MM_TO_IU( x ) ( x * IU_PER_MM )
#define IN_TO_IU( x ) ( x * IU_PER_MILS * 1000 )
#define MILS_TO_IU( x ) ( x * IU_PER_MILS )
#else
#error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW."
#endif
// Helper function to print a float number without using scientific notation

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2020 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
@ -21,48 +21,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dialog_set_grid_base.h>
#include <dialog_grid_settings.h>
#include <base_units.h>
#include <common.h>
#include <settings/app_settings.h>
#include <pcbnew_settings.h>
#include <widgets/unit_binder.h>
#include <pcb_base_edit_frame.h>
#include <tools/pcb_actions.h>
#include <eda_draw_frame.h>
#include <tool/tool_manager.h>
#include <id.h>
#include <tool/common_tools.h>
#include <math/util.h> // for KiROUND
#include <tool/actions.h>
#include <tool/grid_menu.h>
// Max values for grid size
static const int MAX_GRID_SIZE = KiROUND( 1000.0 * IU_PER_MM );
static const int MIN_GRID_SIZE = KiROUND( 0.001 * IU_PER_MM );
class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE
{
PCB_BASE_FRAME* m_parent;
public:
/// This has no dependencies on calling wxFrame derivative, such as PCB_BASE_FRAME.
DIALOG_SET_GRID( PCB_BASE_FRAME* aParent );
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
private:
void OnResetGridOrgClick( wxCommandEvent& event ) override;
UNIT_BINDER m_gridOriginX;
UNIT_BINDER m_gridOriginY;
UNIT_BINDER m_userGridX;
UNIT_BINDER m_userGridY;
};
DIALOG_SET_GRID::DIALOG_SET_GRID( PCB_BASE_FRAME* aParent ):
DIALOG_SET_GRID_BASE( aParent ),
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 ),
@ -71,9 +41,23 @@ DIALOG_SET_GRID::DIALOG_SET_GRID( PCB_BASE_FRAME* aParent ):
{
wxArrayString grids;
GRID_MENU::BuildChoiceList( &grids, m_parent->config(), GetUserUnits() != EDA_UNITS::INCHES );
m_currentGridCtrl->Append( grids );
m_grid1Ctrl->Append( grids );
m_grid2Ctrl->Append( grids );
if( m_parent->IsType( FRAME_SCH )
|| m_parent->IsType( FRAME_SCH_LIB_EDITOR )
|| m_parent->IsType( FRAME_SCH_VIEWER )
|| m_parent->IsType( FRAME_SCH_VIEWER_MODAL )
|| m_parent->IsType( FRAME_SIMULATOR ) )
{
m_book->SetSelection( 1 );
}
else
{
m_book->SetSelection( 0 );
}
m_sdbSizerOK->SetDefault(); // set OK button as default response to 'Enter' key
SetInitialFocus( m_GridOriginXCtrl );
@ -84,25 +68,24 @@ DIALOG_SET_GRID::DIALOG_SET_GRID( PCB_BASE_FRAME* aParent ):
}
bool DIALOG_SET_GRID::TransferDataFromWindow()
bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
{
// Validate new settings
if( !m_userGridX.Validate( MIN_GRID_SIZE, MAX_GRID_SIZE ) )
if( !m_userGridX.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
return false;
if( !m_userGridY.Validate( MIN_GRID_SIZE, MAX_GRID_SIZE ) )
if( !m_userGridY.Validate( 0.001, 1000.0, EDA_UNITS::MILLIMETRES ) )
return false;
// Apply the new settings
GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid;
// Because grid origin is saved in board, show as modified
m_parent->OnModify();
gridCfg.last_size_idx = m_currentGridCtrl->GetSelection();
m_parent->SetGridOrigin( wxPoint( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) );
gridCfg.user_grid_x = StringFromValue( GetUserUnits(), m_userGridX.GetValue(), true, true );
gridCfg.user_grid_y = StringFromValue( GetUserUnits(), m_userGridY.GetValue(), true, true );
m_parent->Settings().m_FastGrid1 = m_grid1Ctrl->GetSelection();
m_parent->Settings().m_FastGrid2 = m_grid2Ctrl->GetSelection();
gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection();
gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection();
// Notify GAL
TOOL_MANAGER* mgr = m_parent->GetToolManager();
@ -115,18 +98,20 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
}
bool DIALOG_SET_GRID::TransferDataToWindow()
bool DIALOG_GRID_SETTINGS::TransferDataToWindow()
{
GRID_SETTINGS& settings = m_parent->config()->m_Window.grid;
GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid;
m_userGridX.SetValue( ValueFromString( GetUserUnits(), settings.user_grid_x, true ) );
m_userGridY.SetValue( ValueFromString( GetUserUnits(), settings.user_grid_y, true ) );
m_currentGridCtrl->SetSelection( m_parent->config()->m_Window.grid.last_size_idx );
m_userGridX.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_x, true ) );
m_userGridY.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_y, true ) );
m_gridOriginX.SetValue( m_parent->GetGridOrigin().x );
m_gridOriginY.SetValue( m_parent->GetGridOrigin().y );
m_grid1Ctrl->SetSelection( m_parent->Settings().m_FastGrid1 );
m_grid2Ctrl->SetSelection( m_parent->Settings().m_FastGrid2 );
m_grid1Ctrl->SetSelection( gridCfg.fast_grid_1 );
m_grid2Ctrl->SetSelection( gridCfg.fast_grid_2 );
int hk1 = ACTIONS::gridFast1.GetHotKey();
int hk2 = ACTIONS::gridFast2.GetHotKey();
@ -137,19 +122,10 @@ bool DIALOG_SET_GRID::TransferDataToWindow()
}
void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event )
void DIALOG_GRID_SETTINGS::OnResetGridOriginClick( wxCommandEvent& event )
{
m_gridOriginX.SetValue( 0 );
m_gridOriginY.SetValue( 0 );
}
void PCB_BASE_EDIT_FRAME::OnGridSettings( wxCommandEvent& event )
{
DIALOG_SET_GRID dlg( this );
dlg.ShowModal();
UpdateStatusBar();
GetCanvas()->Refresh();
}

View File

@ -0,0 +1,51 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2020 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
*/
#ifndef DIALOG_GRID_SETTINGS_H
#define DIALOG_GRID_SETTINGS_H
#include <dialog_grid_settings_base.h>
#include <widgets/unit_binder.h>
class DIALOG_GRID_SETTINGS : public DIALOG_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 );
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
private:
void OnResetGridOriginClick( wxCommandEvent& event ) override;
UNIT_BINDER m_gridOriginX;
UNIT_BINDER m_gridOriginY;
UNIT_BINDER m_userGridX;
UNIT_BINDER m_userGridY;
};
#endif // DIALOG_GRID_SETTINGS_H

View File

@ -5,11 +5,11 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_set_grid_base.h"
#include "dialog_grid_settings_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
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 );
@ -19,8 +19,11 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
m_book = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
wxPanel* gridOriginPage;
gridOriginPage = new wxPanel( m_book, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxStaticBoxSizer* sbLeftSizer;
sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Origin") ), wxVERTICAL );
sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( gridOriginPage, wxID_ANY, _("Grid Origin") ), wxVERTICAL );
wxFlexGridSizer* fgSizerGridOrigin;
fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 0, 0 );
@ -54,7 +57,27 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
sbLeftSizer->Add( fgSizerGridOrigin, 0, wxEXPAND|wxALL, 5 );
bUpperSizer->Add( sbLeftSizer, 1, wxEXPAND|wxALL, 5 );
gridOriginPage->SetSizer( sbLeftSizer );
gridOriginPage->Layout();
sbLeftSizer->Fit( gridOriginPage );
m_book->AddPage( gridOriginPage, _("a page"), false );
wxPanel* currentGridPage;
currentGridPage = new wxPanel( m_book, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxStaticBoxSizer* sbSizer5;
sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( currentGridPage, wxID_ANY, _("Current Grid") ), wxVERTICAL );
wxArrayString m_currentGridCtrlChoices;
m_currentGridCtrl = new wxChoice( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_currentGridCtrlChoices, 0 );
m_currentGridCtrl->SetSelection( 0 );
sbSizer5->Add( m_currentGridCtrl, 0, wxALL|wxEXPAND, 5 );
currentGridPage->SetSizer( sbSizer5 );
currentGridPage->Layout();
sbSizer5->Fit( currentGridPage );
m_book->AddPage( currentGridPage, _("a page"), false );
bUpperSizer->Add( m_book, 1, wxEXPAND | wxALL, 5 );
wxStaticBoxSizer* sbUserGridSizer;
sbUserGridSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Defined Grid") ), wxVERTICAL );
@ -136,7 +159,7 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
fgSizer3->Add( m_grid2HotKey, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbFastSwitchSizer->Add( fgSizer3, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
sbFastSwitchSizer->Add( fgSizer3, 0, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
bSizerMain->Add( sbFastSwitchSizer, 0, wxEXPAND|wxALL, 10 );
@ -171,18 +194,18 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
bSizerMain->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SET_GRID_BASE::OnInitDlg ) );
m_buttonReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRID_SETTINGS_BASE::OnInitDlg ) );
m_buttonReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnResetGridOriginClick ), 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_SET_GRID_BASE::~DIALOG_SET_GRID_BASE()
DIALOG_GRID_SETTINGS_BASE::~DIALOG_GRID_SETTINGS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SET_GRID_BASE::OnInitDlg ) );
m_buttonReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnResetGridOrgClick ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRID_SETTINGS_BASE::OnInitDlg ) );
m_buttonReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GRID_SETTINGS_BASE::OnResetGridOriginClick ), 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 );
}

View File

@ -20,7 +20,9 @@
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/choice.h>
#include <wx/simplebook.h>
#include <wx/statline.h>
#include <wx/bitmap.h>
#include <wx/image.h>
@ -32,19 +34,21 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SET_GRID_BASE
/// Class DIALOG_GRID_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SET_GRID_BASE : public DIALOG_SHIM
class DIALOG_GRID_SETTINGS_BASE : public DIALOG_SHIM
{
private:
protected:
wxSimplebook* m_book;
wxStaticText* m_staticTextGridPosX;
wxTextCtrl* m_GridOriginXCtrl;
wxStaticText* m_TextPosXUnits;
wxStaticText* m_staticTextGridPosY;
wxTextCtrl* m_GridOriginYCtrl;
wxStaticText* m_TextPosYUnits;
wxChoice* m_currentGridCtrl;
wxStaticText* m_staticTextSizeX;
wxTextCtrl* m_OptGridSizeX;
wxStaticText* m_TextSizeXUnits;
@ -65,15 +69,15 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnResetGridOrgClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetGridOriginClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_SET_GRID_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 );
~DIALOG_SET_GRID_BASE();
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 );
~DIALOG_GRID_SETTINGS_BASE();
};

View File

@ -257,10 +257,10 @@ void DIALOG_PAGES_SETTINGS::initDialog()
void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{
if( !m_customSizeX.Validate( Mils2iu( MIN_PAGE_SIZE ), Mils2iu( m_maxPageSizeMils.x ) ) )
if( !m_customSizeX.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x, EDA_UNITS::INCHES, true ) )
return;
if( !m_customSizeY.Validate( Mils2iu( MIN_PAGE_SIZE ), Mils2iu( m_maxPageSizeMils.y ) ) )
if( !m_customSizeY.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y, EDA_UNITS::INCHES, true ) )
return;
if( SavePageSettings() )
@ -701,8 +701,8 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
{
int lyWidth, lyHeight;
wxSize clamped_layout_size( Clamp( MIN_PAGE_SIZE, m_layout_size.x, m_maxPageSizeMils.x ),
Clamp( MIN_PAGE_SIZE, m_layout_size.y, m_maxPageSizeMils.y ) );
wxSize clamped_layout_size( Clamp( MIN_PAGE_SIZE_MILS, m_layout_size.x, m_maxPageSizeMils.x ),
Clamp( MIN_PAGE_SIZE_MILS, m_layout_size.y, m_maxPageSizeMils.y ) );
double lyRatio = clamped_layout_size.x < clamped_layout_size.y ?
(double) clamped_layout_size.y / clamped_layout_size.x :

View File

@ -55,11 +55,17 @@
#include <view/view.h>
#include <ws_draw_item.h>
#include <wx/snglinst.h>
#include <dialogs/dialog_grid_settings.h>
#define FR_HISTORY_LIST_CNT 10 ///< Maximum size of the find/replace history stacks.
BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, EDA_DRAW_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, EDA_DRAW_FRAME::OnUpdateSelectZoom )
END_EVENT_TABLE()
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) :
@ -231,6 +237,30 @@ void EDA_DRAW_FRAME::EraseMsgBox()
}
void EDA_DRAW_FRAME::UpdateGridSelectBox()
{
UpdateStatusBar();
DisplayUnitsMsg();
if( m_gridSelectBox == NULL )
return;
// Update grid values with the current units setting.
m_gridSelectBox->Clear();
wxArrayString gridsList;
GRID_MENU::BuildChoiceList( &gridsList, config(), GetUserUnits() != EDA_UNITS::INCHES );
for( const wxString& grid : gridsList )
m_gridSelectBox->Append( grid );
m_gridSelectBox->Append( wxT( "---" ) );
m_gridSelectBox->Append( _( "Edit User Grid..." ) );
m_gridSelectBox->SetSelection( config()->m_Window.grid.last_size_idx );
}
void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
{
// No need to update the grid select box if it doesn't exist or the grid setting change
@ -239,9 +269,9 @@ void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
return;
int idx = config()->m_Window.grid.last_size_idx;
idx = std::max( 0, std::min( idx, (int) m_gridSelectBox->GetCount() - 1 ) );
if( idx >= 0 && idx < int( m_gridSelectBox->GetCount() )
&& idx != m_gridSelectBox->GetSelection() )
if( idx != m_gridSelectBox->GetSelection() )
m_gridSelectBox->SetSelection( idx );
}
@ -288,6 +318,18 @@ 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
{
return config()->m_Window.grid.show;
@ -314,12 +356,50 @@ void EDA_DRAW_FRAME::SetGridVisibility( bool aVisible )
}
void EDA_DRAW_FRAME::InitExitKey()
void EDA_DRAW_FRAME::UpdateZoomSelectBox()
{
wxAcceleratorEntry entries[1];
entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
wxAcceleratorTable accel( 1, entries );
SetAcceleratorTable( accel );
if( m_zoomSelectBox == NULL )
return;
double zoom = m_canvas->GetGAL()->GetZoomFactor() / ZOOM_COEFF;
m_zoomSelectBox->Clear();
m_zoomSelectBox->Append( _( "Zoom Auto" ) );
m_zoomSelectBox->SetSelection( 0 );
for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); ++i )
{
double current = config()->m_Window.zoom_factors[i];
m_zoomSelectBox->Append( wxString::Format( _( "Zoom %.2f" ), current ) );
if( zoom == current )
m_zoomSelectBox->SetSelection( i + 1 );
}
}
void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
{
if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )
return;
int current = 0; // display Auto if no match found
// check for a match within 1%
double zoom = GetCanvas()->GetGAL()->GetZoomFactor() / ZOOM_COEFF;
for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); i++ )
{
if( std::fabs( zoom - config()->m_Window.zoom_factors[i] ) < ( zoom / 100.0 ) )
{
current = i + 1;
break;
}
}
if( current != m_zoomSelectBox->GetSelection() )
m_zoomSelectBox->SetSelection( current );
}
@ -384,6 +464,15 @@ void EDA_DRAW_FRAME::AddStandardSubMenus( TOOL_MENU& aToolMenu )
}
void EDA_DRAW_FRAME::InitExitKey()
{
wxAcceleratorEntry entries[1];
entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
wxAcceleratorTable accel( 1, entries );
SetAcceleratorTable( accel );
}
void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
{
SetStatusText( msg, 6 );

View File

@ -113,14 +113,14 @@ bool APP_SETTINGS_BASE::MigrateFromLegacy( wxConfigBase* aCfg )
migrateFindReplace( aCfg );
ret &= fromLegacy<int>( aCfg, "canvas_type", "graphics.canvas_type" );
ret &= fromLegacy<int>( aCfg, "canvas_type", "graphics.canvas_type" );
ret &= fromLegacy<int>( aCfg, "P22LIB_TREE_MODEL_ADAPTERSelectorColumnWidth",
"lib_tree.column_width" );
ret &= fromLegacy<int>( aCfg, "P22LIB_TREE_MODEL_ADAPTERSelectorColumnWidth",
"lib_tree.column_width" );
ret &= fromLegacy<bool>( aCfg, "PrintMonochrome", "printing.monochrome" );
ret &= fromLegacy<double>( aCfg, "PrintScale", "printing.scale" );
ret &= fromLegacy<bool>( aCfg, "PrintPageFrame", "printing.title_block" );
ret &= fromLegacy<bool>( aCfg, "PrintMonochrome", "printing.monochrome" );
ret &= fromLegacy<double>( aCfg, "PrintScale", "printing.scale" );
ret &= fromLegacy<bool>( aCfg, "PrintPageFrame", "printing.title_block" );
{
nlohmann::json js = nlohmann::json::array();
@ -194,7 +194,9 @@ bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::stri
{
bool ret = true;
const std::string gd = "GalDisplayOptions";
const std::string frameGDO = aFrame + "GalDisplayOptions";
const std::string cursorPath = aJsonPath + ".cursor";
const std::string gridPath = aJsonPath + ".grid";
ret &= fromLegacy<bool>( aCfg, aFrame + "Maximized", aJsonPath + ".maximized" );
ret &= fromLegacyString( aCfg, aFrame + "MostRecentlyUsedPath", aJsonPath + ".mru_path" );
@ -204,34 +206,20 @@ bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::stri
ret &= fromLegacy<int>( aCfg, aFrame + "Pos_x", aJsonPath + ".pos_x" );
ret &= fromLegacy<int>( aCfg, aFrame + "Pos_y", aJsonPath + ".pos_y" );
ret &= fromLegacy<bool>( aCfg,
aFrame + gd + "ForceDisplayCursor", aJsonPath + ".cursor.always_show_cursor" );
ret &= fromLegacy<bool>( aCfg,
aFrame + gd + "CursorFullscreen", aJsonPath + ".cursor.fullscreen_cursor" );
ret &= fromLegacy<bool>( aCfg, frameGDO + "ForceDisplayCursor", cursorPath + ".always_show_cursor" );
ret &= fromLegacy<bool>( aCfg, frameGDO + "CursorFullscreen", cursorPath + ".fullscreen_cursor" );
ret &= fromLegacy<int>( aCfg,
aFrame + "_LastGridSize", aJsonPath + ".grid.last_size" );
ret &= fromLegacy<int>( aCfg, aFrame + "_LastGridSize", gridPath + ".last_size" );
double x, y;
ret &= fromLegacy<int>( aCfg, aFrame + "FastGrid1", gridPath + ".fast_grid_1" );
ret &= fromLegacy<int>( aCfg, aFrame + "FastGrid2", gridPath + ".fast_grid_2" );
if( aCfg->Read( aFrame + "PcbUserGrid_X", &x ) && aCfg->Read( aFrame + "PcbUserGrid_Y", &y ) )
{
EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( aFrame + "PcbUserGrid_Unit",
static_cast<long>( EDA_UNITS::INCHES ) ) );
( *this )[PointerFromString( ".grid.user_grid_x" )] = StringFromValue( u, x, true, true );
( *this )[PointerFromString( ".grid.user_grid_y" )] = StringFromValue( u, y, true, true );
}
ret &= fromLegacy<bool>( aCfg,
aFrame + gd + "GridAxesEnabled", aJsonPath + ".grid.axes_enabled" );
ret &= fromLegacy<double>( aCfg,
aFrame + gd + "GridLineWidth", aJsonPath + ".grid.line_width" );
ret &= fromLegacy<double>( aCfg,
aFrame + gd + "GridMaxDensity", aJsonPath + ".grid.min_spacing" );
ret &= fromLegacy<bool>( aCfg, aFrame + gd + "ShowGrid", aJsonPath + ".grid.show" );
ret &= fromLegacy<int>( aCfg, aFrame + gd + "GridStyle", aJsonPath + ".grid.style" );
ret &= fromLegacyColor( aCfg, aFrame + gd + "GridColor", aJsonPath + ".grid.color" );
ret &= fromLegacy<bool>( aCfg, frameGDO + "GridAxesEnabled", gridPath + ".axes_enabled" );
ret &= fromLegacy<double>( aCfg, frameGDO + "GridLineWidth", gridPath + ".line_width" );
ret &= fromLegacy<double>( aCfg, frameGDO + "GridMaxDensity", gridPath + ".min_spacing" );
ret &= fromLegacy<bool>( aCfg, frameGDO + "ShowGrid", gridPath + ".show" );
ret &= fromLegacy<int>( aCfg, frameGDO + "GridStyle", gridPath + ".style" );
ret &= fromLegacyColor( aCfg, frameGDO + "GridColor", gridPath + ".color" );
return ret;
}
@ -262,16 +250,22 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std:
m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.axes_enabled",
&aWindow->grid.axes_enabled, false ) );
m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.last_size",
&aWindow->grid.last_size_idx, 0 ) );
m_params.emplace_back( new PARAM_LIST<wxString>( aJsonPath + ".grid.sizes",
&aWindow->grid.sizes, {} ) );
m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.last_size",
&aWindow->grid.last_size_idx, 0 ) );
m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.fast_grid_1",
&aWindow->grid.fast_grid_1, 0 ) );
m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.fast_grid_2",
&aWindow->grid.fast_grid_2, 1 ) );
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.user_grid_x",
&aWindow->grid.user_grid_x, "12.5 mil" ) );
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.user_grid_x",
&aWindow->grid.user_grid_x, "12.5 mil" ) );
m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.user_grid_y",
&aWindow->grid.user_grid_y, "12.5 mil" ) );
m_params.emplace_back( new PARAM<double>( aJsonPath + ".grid.line_width",
&aWindow->grid.line_width, 1.0 ) );

View File

@ -409,6 +409,18 @@ int COMMON_TOOLS::OnGridChanged()
}
int COMMON_TOOLS::GridFast1( const TOOL_EVENT& aEvent )
{
return GridPreset( m_frame->config()->m_Window.grid.fast_grid_1 );
}
int COMMON_TOOLS::GridFast2( const TOOL_EVENT& aEvent )
{
return GridPreset( m_frame->config()->m_Window.grid.fast_grid_2 );
}
int COMMON_TOOLS::ToggleGrid( const TOOL_EVENT& aEvent )
{
m_frame->SetGridVisibility( !m_frame->IsGridVisible() );
@ -551,6 +563,8 @@ void COMMON_TOOLS::setTransitions()
Go( &COMMON_TOOLS::GridNext, ACTIONS::gridNext.MakeEvent() );
Go( &COMMON_TOOLS::GridPrev, ACTIONS::gridPrev.MakeEvent() );
Go( &COMMON_TOOLS::GridPreset, ACTIONS::gridPreset.MakeEvent() );
Go( &COMMON_TOOLS::GridFast1, ACTIONS::gridFast1.MakeEvent() );
Go( &COMMON_TOOLS::GridFast2, ACTIONS::gridFast2.MakeEvent() );
Go( &COMMON_TOOLS::ToggleGrid, ACTIONS::toggleGrid.MakeEvent() );
Go( &COMMON_TOOLS::GridProperties, ACTIONS::gridProperties.MakeEvent() );

View File

@ -168,7 +168,7 @@ void UNIT_BINDER::delayedFocusHandler( wxCommandEvent& )
}
bool UNIT_BINDER::Validate( long long int aMin, long long int aMax, bool setFocusOnError )
bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits, bool aUseMils )
{
wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_value );
@ -179,34 +179,28 @@ bool UNIT_BINDER::Validate( long long int aMin, long long int aMax, bool setFocu
return true;
}
if( GetValue() < aMin )
if( GetValue() < From_User_Unit( aUnits, aMin, aUseMils ) )
{
m_errorMessage = wxString::Format( _( "%s must be at least %s." ),
valueDescriptionFromLabel( m_label ),
StringFromValue( m_units, aMin, true ) );
if( setFocusOnError )
{
textEntry->SelectAll();
// Don't focus directly; we might be inside a KillFocus event handler
wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
}
textEntry->SelectAll();
// Don't focus directly; we might be inside a KillFocus event handler
wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
return false;
}
if( GetValue() > aMax )
if( GetValue() > From_User_Unit( aUnits, aMax, aUseMils ) )
{
m_errorMessage = wxString::Format( _( "%s must be less than %s." ),
valueDescriptionFromLabel( m_label ),
StringFromValue( m_units, aMax, true ) );
if( setFocusOnError )
{
textEntry->SelectAll();
// Don't focus directly; we might be inside a KillFocus event handler
wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
}
textEntry->SelectAll();
// Don't focus directly; we might be inside a KillFocus event handler
wxPostEvent( this, wxCommandEvent( DELAY_FOCUS ) );
return false;
}

View File

@ -249,7 +249,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
// Zoom selection choice box.
m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, 0, NULL );
updateZoomSelectBox();
UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox );
// after adding the buttons to the toolbar, must call Realize() to reflect

View File

@ -90,8 +90,6 @@ set( EESCHEMA_DLGS
dialogs/dialog_schematic_find.cpp
dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_schematic_setup.cpp
dialogs/dialog_set_grid.cpp
dialogs/dialog_set_grid_base.cpp
dialogs/dialog_symbol_remap.cpp
dialogs/dialog_symbol_remap_base.cpp
dialogs/dialog_update_fields.cpp

View File

@ -44,11 +44,6 @@ class SCH_EDIT_FRAME;
class SCH_TEXT;
// Don't allow text to disappear; it can be difficult to correct if you can't select it
const int MIN_TEXTSIZE = (int)( 0.01 * IU_PER_MM );
const int MAX_TEXTSIZE = INT_MAX;
DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DIALOG_LABEL_EDITOR_BASE( aParent ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, false ),
@ -392,7 +387,8 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
if( !wxDialog::TransferDataFromWindow() )
return false;
if( !m_textSize.Validate( MIN_TEXTSIZE, MAX_TEXTSIZE ) )
// Don't allow text to disappear; it can be difficult to correct if you can't select it
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
return false;
wxString text;

View File

@ -427,7 +427,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
{
if( !m_textSize.Validate( Mils2iu( 1 ), Mils2iu( 10000 ) ) ) // 1 mil .. 10 inches
if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::INCHES, true ) ) // 1 mil .. 10 inches
return false;
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();

View File

@ -1,88 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2020 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 <dialog_set_grid_base.h>
#include <common.h>
#include <tool/tool_manager.h>
#include <settings/app_settings.h>
#include <sch_base_frame.h>
#include <tool/grid_menu.h>
class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE
{
SCH_BASE_FRAME* m_frame;
public:
DIALOG_SET_GRID( SCH_BASE_FRAME* aParent );
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
};
DIALOG_SET_GRID::DIALOG_SET_GRID( SCH_BASE_FRAME* aParent ):
DIALOG_SET_GRID_BASE( aParent ),
m_frame( aParent )
{
m_sdbSizerOK->SetDefault();
FinishDialogSettings();
}
bool DIALOG_SET_GRID::TransferDataToWindow()
{
int idx = m_frame->config()->m_Window.grid.last_size_idx;
wxArrayString grids;
GRID_MENU::BuildChoiceList( &grids, m_frame->config(), GetUserUnits() != EDA_UNITS::INCHES );
for( const wxString& grid : grids )
m_choiceGridSize->Append( grid );
if( idx >= 0 && idx < int( m_choiceGridSize->GetCount() ) )
m_choiceGridSize->SetSelection( idx );
return true;
}
bool DIALOG_SET_GRID::TransferDataFromWindow()
{
int idx = m_choiceGridSize->GetSelection();
m_frame->GetToolManager()->RunAction( "common.Control.gridPreset", true, idx );
return true;
}
void SCH_BASE_FRAME::OnGridSettings( wxCommandEvent& aEvent )
{
DIALOG_SET_GRID dlg( this );
dlg.ShowModal();
UpdateStatusBar();
GetCanvas()->Refresh();
}

View File

@ -1,71 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_set_grid_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_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 );
wxFlexGridSizer* fgSizer32;
fgSizer32 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer32->AddGrowableCol( 1 );
fgSizer32->SetFlexibleDirection( wxBOTH );
fgSizer32->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("&Grid size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer32->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
wxArrayString m_choiceGridSizeChoices;
m_choiceGridSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceGridSizeChoices, 0 );
m_choiceGridSize->SetSelection( 0 );
fgSizer32->Add( m_choiceGridSize, 0, wxEXPAND|wxLEFT, 5 );
m_units = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_units->Wrap( -1 );
fgSizer32->Add( m_units, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bSizerMain->Add( fgSizer32, 1, wxEXPAND|wxALL, 15 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 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();
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SET_GRID_BASE::OnInitDlg ) );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this );
}
DIALOG_SET_GRID_BASE::~DIALOG_SET_GRID_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SET_GRID_BASE::OnInitDlg ) );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SET_GRID_BASE::OnOkClick ), NULL, this );
}

View File

@ -1,478 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_set_grid_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_set_grid</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_SET_GRID_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Grid Settings</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog">OnInitDlg</event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">15</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">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">fgSizer32</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Grid size:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText3</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices"></property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_choiceGridSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnChoice"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">mils</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_units</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOkClick</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -1,59 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SET_GRID_BASE_H__
#define __DIALOG_SET_GRID_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SET_GRID_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SET_GRID_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText3;
wxChoice* m_choiceGridSize;
wxStaticText* m_units;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_SET_GRID_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 );
~DIALOG_SET_GRID_BASE();
};
#endif //__DIALOG_SET_GRID_BASE_H__

View File

@ -416,10 +416,7 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
EDA_DRAW_FRAME::LoadSettings( aCfg );
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
wxCHECK( cfg, /*void*/ );
if( cfg->m_Window.grid.sizes.empty() )
if( aCfg->m_Window.grid.sizes.empty() )
{
/*
* Do NOT add others values (mainly grid values in mm), because they can break the
@ -431,13 +428,13 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
* The 100 mil grid is added to help conform to the KiCad Library Convention which
* states: "Using a 100mil grid, pin ends and origin must lie on grid nodes IEC-60617"
*/
cfg->m_Window.grid.sizes = { "100 mil",
"50 mil",
"25 mil",
"10 mil",
"5 mil",
"2 mil",
"1 mil" };
aCfg->m_Window.grid.sizes = { "100 mil",
"50 mil",
"25 mil",
"10 mil",
"5 mil",
"2 mil",
"1 mil" };
}
if( aCfg->m_Window.zoom_factors.empty() )
@ -463,20 +460,25 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
for( double& factor : aCfg->m_Window.zoom_factors )
factor = std::min( factor, MAX_ZOOM_FACTOR );
wxString templateFieldNames = cfg->m_Drawing.field_names;
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
if( !templateFieldNames.IsEmpty() )
if( cfg )
{
TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
wxString templateFieldNames = cfg->m_Drawing.field_names;
try
if( !templateFieldNames.IsEmpty() )
{
m_templateFieldNames.Parse( &lexer, true );
}
catch( const IO_ERROR& DBG( e ) )
{
// @todo show error msg
DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
try
{
m_templateFieldNames.Parse( &lexer, true );
}
catch( const IO_ERROR& DBG( e ) )
{
// @todo show error msg
DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
}
}
}
}

View File

@ -144,8 +144,6 @@ public:
}
void SetGridOrigin( const wxPoint& aPoint ) override {}
void OnGridSettings( wxCommandEvent& aEvent ) override;
const TITLE_BLOCK& GetTitleBlock() const override;
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;

View File

@ -52,13 +52,11 @@
#include <view/view.h>
#include <base_screen.h>
#include <gerbview_painter.h>
#include <geometry/shape_poly_set.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_gerbview_settings.h>
#include <dialogs/panel_gerbview_display_options.h>
#include <panel_hotkeys_editor.h>
#include <wx/wupdlock.h>
#include <tool/grid_menu.h>
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
: EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition,
@ -1095,7 +1093,7 @@ void GERBVIEW_FRAME::unitsChangeRefresh()
// Called on units change (see EDA_DRAW_FRAME)
EDA_DRAW_FRAME::unitsChangeRefresh();
updateDCodeSelectBox();
updateGridSelectBox();
UpdateGridSelectBox();
}
@ -1167,50 +1165,6 @@ void GERBVIEW_FRAME::setupTools()
}
void GERBVIEW_FRAME::updateGridSelectBox()
{
UpdateStatusBar();
DisplayUnitsMsg();
if( m_gridSelectBox == NULL )
return;
// Update grid values with the current units setting.
m_gridSelectBox->Clear();
wxArrayString gridsList;
GRID_MENU::BuildChoiceList( &gridsList, config(), GetUserUnits() != EDA_UNITS::INCHES );
for( const wxString& grid : gridsList )
m_gridSelectBox->Append( grid );
m_gridSelectBox->SetSelection( config()->m_Window.grid.last_size_idx );
}
void GERBVIEW_FRAME::updateZoomSelectBox()
{
if( m_zoomSelectBox == NULL )
return;
double zoom = GetCanvas()->GetGAL()->GetZoomFactor() / ZOOM_COEFF;
m_zoomSelectBox->Clear();
m_zoomSelectBox->Append( _( "Zoom Auto" ) );
m_zoomSelectBox->SetSelection( 0 );
for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); ++i )
{
double current = config()->m_Window.zoom_factors[i];
m_zoomSelectBox->Append( wxString::Format( _( "Zoom %.2f" ), current ) );
if( zoom == current )
m_zoomSelectBox->SetSelection( i + 1 );
}
}
void GERBVIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );

View File

@ -169,8 +169,6 @@ private:
void updateNetnameListSelectBox();
void updateAperAttributesSelectBox();
void updateDCodeSelectBox();
void updateGridSelectBox();
void updateZoomSelectBox();
void unitsChangeRefresh() override; // See class EDA_DRAW_FRAME
void OnClearJobFileHistory( wxCommandEvent& aEvent );

View File

@ -165,8 +165,8 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
updateNetnameListSelectBox();
updateAperAttributesSelectBox();
updateDCodeSelectBox();
updateGridSelectBox();
updateZoomSelectBox();
UpdateGridSelectBox();
UpdateZoomSelectBox();
// combobox sizes can have changed: apply new best sizes
auto item = m_auxiliaryToolBar->FindTool( ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE );

View File

@ -25,10 +25,6 @@
#ifndef CONVERT_TO_BIU_H_
#define CONVERT_TO_BIU_H_
/**
* @file convert_to_biu.h
*/
/**
* @brief some define and functions to convert a value in mils, decimils or mm
* to the internal unit used in pcbnew, cvpcb or gerbview (nanometer or deci-mil)
@ -86,13 +82,12 @@ constexpr inline int Iu2Mils( int iu )
return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 );
}
#else
// Here, we do not know the value of internal units: just use something safe to allow
// easier packaging of compilation units
constexpr double IU_PER_MM = 1;
constexpr double IU_PER_MILS = IU_PER_MM * 0.0254;
// Here, we do not know the value of internal units: do not define
// conversion functions (They do not have meaning)
#define UNKNOWN_IU
#endif
#ifndef UNKNOWN_IU
// Other definitions used in a few files
constexpr double MM_PER_IU = ( 1 / IU_PER_MM );
@ -122,6 +117,8 @@ constexpr inline double Iu2Millimeter( int iu )
constexpr int ARC_LOW_DEF = Millimeter2iu( 0.02 );
constexpr int ARC_HIGH_DEF = Millimeter2iu( 0.005 );
#endif
/* ZOOM LIMITS
The largest distance that wx can support is INT_MAX, since it represents

View File

@ -240,11 +240,6 @@ public:
*/
virtual void ExecuteRemoteCommand( const char* cmdline ){}
/**
* Return a human readable value for display in dialogs.
*/
const wxString GetZoomLevelIndicator() const;
void EraseMsgBox();
void ReCreateMenuBar() override { }
@ -273,9 +268,36 @@ public:
* @param event - Command event passed by selecting grid size from the
* grid size combobox on the toolbar.
*/
virtual void OnSelectGrid( wxCommandEvent& event );
void OnSelectGrid( wxCommandEvent& event );
virtual void OnGridSettings( wxCommandEvent& event ) { };
void OnGridSettings( wxCommandEvent& event );
/**
* Rebuild the grid combobox to respond to any changes in the GUI (units, user
* grid changes, etc.)
*/
void UpdateGridSelectBox();
/**
* Update the checked item in the grid combobox.
*/
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
/**
* Rebuild the grid combobox to respond to any changes in the GUI (units, user
* grid changes, etc.)
*/
void UpdateZoomSelectBox();
/**
* Update the checked item in the zoom combobox.
*/
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
/**
* Return a human readable value for display in dialogs.
*/
const wxString GetZoomLevelIndicator() const;
/**
* Set the zoom factor when selected by the zoom list box in the main tool bar.
@ -286,10 +308,6 @@ public:
*/
virtual void OnSelectZoom( wxCommandEvent& event );
// Update user interface event handlers shared by all applications derived from
// EDA_DRAW_FRAME.
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
/**
* Recalculate the size of toolbars and display panel when the frame size changes.
*/
@ -459,6 +477,8 @@ public:
* Rebuild all toolbars, and update the checked state of ckeck tools
*/
void RecreateToolbars();
DECLARE_EVENT_TABLE()
};
#endif // DRAW_FRAME_H_

View File

@ -36,7 +36,7 @@
#include <base_units.h> // for IU_PER_MILS
/// Min and max page sizes for clamping, in mils.
#define MIN_PAGE_SIZE 4000
#define MIN_PAGE_SIZE_MILS 4000
#define MAX_PAGE_SIZE_PCBNEW_MILS 48000
#define MAX_PAGE_SIZE_MILS 120000

View File

@ -79,7 +79,6 @@ protected:
PCBNEW_SETTINGS* m_Settings; // No ownership, just a shortcut
void updateZoomSelectBox();
virtual void unitsChangeRefresh() override;
/**
@ -225,8 +224,6 @@ public:
PCB_SCREEN* GetScreen() const override { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
void UpdateGridSelectBox();
/**
* Shows the 3D view frame.
* If it does not exist, it is created.
@ -394,9 +391,6 @@ public:
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
// User interface update event handlers.
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
virtual void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) {}
/**
@ -420,8 +414,6 @@ public:
* Always returns false. Should be overriden in derived classes which support autozoom.
*/
virtual bool GetAutoZoom() { return false; }
DECLARE_EVENT_TABLE()
};
#endif // PCB_BASE_FRAME_H

View File

@ -43,6 +43,8 @@ struct GRID_SETTINGS
wxString user_grid_x;
wxString user_grid_y;
int last_size_idx;
int fast_grid_1;
int fast_grid_2;
double line_width;
double min_spacing;
bool show;

View File

@ -78,6 +78,8 @@ public:
int GridNext( const TOOL_EVENT& aEvent );
int GridPrev( const TOOL_EVENT& aEvent );
int GridPreset( const TOOL_EVENT& aEvent );
int GridFast1( const TOOL_EVENT& aEvent );
int GridFast2( const TOOL_EVENT& aEvent );
int ToggleGrid( const TOOL_EVENT& aEvent );
int GridProperties( const TOOL_EVENT& aEvent );
int GridPreset( int idx );

View File

@ -121,11 +121,14 @@ public:
* Function Validate
* Validates the control against the given range, informing the user of any errors found.
*
* @param aMin a minimum value (in internal units) for validation
* @param aMax a maximum value (in internal units) for validation
* @param aMin a minimum value for validation
* @param aMax a maximum value for validation
* @param aUnits the units of the min/max parameters (use UNSCALED for internal units)
* @param aUseMils if \a aUnits is EDA_UNITS::INCHES, interpret as mils
* @return false on error.
*/
virtual bool Validate( long long int aMin, long long int aMax, bool setFocusOnError = true );
virtual bool Validate( double aMin, double aMax, EDA_UNITS aUnits = EDA_UNITS::UNSCALED,
bool aUseMils = false );
void SetLabel( const wxString& aLabel );

View File

@ -15,7 +15,6 @@ include_directories(
set( KICAD_SRCS
${CMAKE_SOURCE_DIR}/common/base_units.cpp
dialogs/dialog_template_selector_base.cpp
dialogs/dialog_template_selector.cpp
files-io.cpp

View File

@ -10,7 +10,6 @@ include_directories(
)
set( PCB_CALCULATOR_SRCS
${CMAKE_SOURCE_DIR}/common/base_units.cpp
attenuators.cpp
board_classes_values.cpp
colorcode.cpp

View File

@ -128,8 +128,6 @@ set( PCBNEW_DIALOGS
dialogs/dialog_print_pcbnew.cpp
dialogs/dialog_select_net_from_list.cpp
dialogs/dialog_select_net_from_list_base.cpp
dialogs/dialog_set_grid.cpp
dialogs/dialog_set_grid_base.cpp
dialogs/dialog_swap_layers.cpp
dialogs/dialog_swap_layers_base.cpp
dialogs/dialog_target_properties.cpp

View File

@ -80,25 +80,25 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow()
bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow()
{
if( !m_minClearance.Validate( 0, Mils2iu( 10000 ) ) ) // 0 to 10 inches
if( !m_minClearance.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false;
if( !m_trackMinWidth.Validate( 0, Mils2iu( 10000 ) ) ) // 0 to 10 inches
if( !m_trackMinWidth.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false;
if( !m_viaMinAnnulus.Validate( 0, Mils2iu( 10000 ) ) ) // 0 to 10 inches
if( !m_viaMinAnnulus.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false;
if( !m_viaMinSize.Validate( 0, Mils2iu( 10000 ) ) ) // 0 to 10 inches
if( !m_viaMinSize.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false;
if( !m_edgeClearance.Validate( 0, Mils2iu( 10000 ) ) ) // 0 to 10 inches
if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false;
if( !m_throughHoleMin.Validate( Mils2iu( 2 ), Mils2iu( 1000 ) ) ) // #107 to 1 inch
if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::INCHES, true ) ) // #107 to 1 inch
return false;
if( !m_holeToHoleMin.Validate( 0, Mils2iu( 10000 ) ) ) // 0 to 10 inches
if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false;
m_BrdSettings->m_BlindBuriedViaAllowed = m_OptAllowBlindBuriedVias->GetValue();

View File

@ -26,7 +26,7 @@
#include <settings/parameters.h>
#include <settings/settings_manager.h>
#include <wx/config.h>
#include <base_units.h>
extern const char* traceSettings;
@ -267,7 +267,7 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<int>( aCfg, "FpEditorValueDefaultLayer", "design_settings.default_footprint_text_items.1.2" );
const std::string f = "ModEdit";
std::string f = "ModEdit";
// Migrate color settings that were stored in the pcbnew config file
// We create a copy of the user scheme for the footprint editor context
@ -315,6 +315,22 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
( *this )[PointerFromString( "appearance.color_theme" )] = "user_footprints";
double x, y;
f = "ModEditFrame";
if( aCfg->Read( f + "PcbUserGrid_X", &x ) && aCfg->Read( f + "PcbUserGrid_Y", &y ) )
{
EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( f + "PcbUserGrid_Unit",
static_cast<long>( EDA_UNITS::INCHES ) ) );
// Convert to internal units
x = From_User_Unit( u, x );
y = From_User_Unit( u, y );
( *this )[PointerFromString( "window.grid.user_grid_x" )] = StringFromValue( u, x, true, true );
( *this )[PointerFromString( "window.grid.user_grid_y" )] = StringFromValue( u, y, true, true );
}
return ret;
}

View File

@ -36,14 +36,10 @@
#include <footprint_viewer_frame.h>
#include <fp_lib_table.h>
#include <kiway.h>
#include <lib_id.h>
#include <memory>
#include <msgpanel.h>
#include <pcb_draw_panel_gal.h>
#include <pcb_painter.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <pcbnew_settings.h>
#include <footprint_editor_settings.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
@ -85,8 +81,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
EVT_CHOICE( ID_ON_ZOOM_SELECT, FOOTPRINT_VIEWER_FRAME::OnSelectZoom )
EVT_CHOICE( ID_ON_GRID_SELECT, FOOTPRINT_VIEWER_FRAME::OnSelectGrid )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, FOOTPRINT_VIEWER_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, FOOTPRINT_VIEWER_FRAME::OnUpdateSelectZoom )
EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton )
EVT_TEXT( ID_MODVIEW_LIB_FILTER, FOOTPRINT_VIEWER_FRAME::OnLibFilter )

View File

@ -36,6 +36,7 @@
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
#include <tools/pcb_actions.h>
#include <dialogs/dialog_grid_settings.h>
PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
FRAME_T aFrameType, const wxString& aTitle,

View File

@ -182,8 +182,6 @@ public:
///> @copydoc PCB_BASE_FRAME::SetBoard()
virtual void SetBoard( BOARD* aBoard ) override;
void OnGridSettings( wxCommandEvent& aEvent ) override;
COLOR_SETTINGS* GetColorSettings() override;
protected:

View File

@ -54,12 +54,6 @@
wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
END_EVENT_TABLE()
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) :
@ -449,30 +443,6 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
}
void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
{
if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )
return;
int current = 0; // display Auto if no match found
// check for a match within 1%
double zoom = GetCanvas()->GetGAL()->GetZoomFactor() / ZOOM_COEFF;
for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); i++ )
{
if( std::fabs( zoom - config()->m_Window.zoom_factors[i] ) < ( zoom / 100.0 ) )
{
current = i + 1;
break;
}
}
if( current != m_zoomSelectBox->GetSelection() )
m_zoomSelectBox->SetSelection( current );
}
GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
{
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->GetVisibleLayers(), GetActiveLayer(),
@ -749,53 +719,6 @@ void PCB_BASE_FRAME::OnModify()
}
void PCB_BASE_FRAME::UpdateGridSelectBox()
{
UpdateStatusBar();
DisplayUnitsMsg();
if( m_gridSelectBox == NULL )
return;
// Update grid values with the current units setting.
m_gridSelectBox->Clear();
wxArrayString gridsList;
GRID_MENU::BuildChoiceList( &gridsList, config(), GetUserUnits() != EDA_UNITS::INCHES );
for( const wxString& grid : gridsList )
m_gridSelectBox->Append( grid );
m_gridSelectBox->Append( wxT( "---" ) );
m_gridSelectBox->Append( _( "Edit User Grid..." ) );
m_gridSelectBox->SetSelection( config()->m_Window.grid.last_size_idx );
}
void PCB_BASE_FRAME::updateZoomSelectBox()
{
if( m_zoomSelectBox == NULL )
return;
double zoom = GetCanvas()->GetGAL()->GetZoomFactor() / ZOOM_COEFF;
m_zoomSelectBox->Clear();
m_zoomSelectBox->Append( _( "Zoom Auto" ) );
m_zoomSelectBox->SetSelection( 0 );
for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); ++i )
{
double current = config()->m_Window.zoom_factors[i];
m_zoomSelectBox->Append( wxString::Format( _( "Zoom %.2f" ), current ) );
if( zoom == current )
m_zoomSelectBox->SetSelection( i + 1 );
}
}
PCB_DRAW_PANEL_GAL* PCB_BASE_FRAME::GetCanvas() const
{
return static_cast<PCB_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );

View File

@ -35,6 +35,7 @@
#include <wx/tokenzr.h>
#include <zones.h>
#include <widgets/ui_common.h>
#include <base_units.h>
#include "../3d-viewer/3d_viewer/3d_viewer_settings.h"
@ -63,8 +64,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_FootprintViewer(),
m_FootprintWizard(),
m_Display(),
m_FastGrid1( 0 ),
m_FastGrid2( 0 ),
m_Use45DegreeGraphicSegments( false ),
m_FlipLeftRight( false ),
m_PolarCoords( false ),
@ -97,10 +96,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<int>( "footprint_chooser.sash_v",
&m_FootprintChooser.sash_v, -1 ) );
m_params.emplace_back( new PARAM<int>( "grid.fast_grid_1", &m_FastGrid1, 0 ) );
m_params.emplace_back( new PARAM<int>( "grid.fast_grid_2", &m_FastGrid2, 0 ) );
m_params.emplace_back( new PARAM<bool>( "editing.flip_left_right", &m_FlipLeftRight, true ) );
m_params.emplace_back(
@ -441,9 +436,6 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<int>( aCfg, "FootprintChooserWidth", "footprint_chooser.width" );
ret &= fromLegacy<int>( aCfg, "FootprintChooserHeight", "footprint_chooser.height" );
ret &= fromLegacy<int>( aCfg, f + "FastGrid1", "grid.fast_grid_1" );
ret &= fromLegacy<int>( aCfg, f + "FastGrid2", "grid.fast_grid_2" );
ret &= fromLegacy<bool>( aCfg, "FlipLeftRight", "editing.flip_left_right" );
ret &= fromLegacy<bool>( aCfg, "MagneticGraphics", "editing.magnetic_graphics" );
ret &= fromLegacy<int>( aCfg, "MagneticPads", "editing.magnetic_pads" );
@ -635,11 +627,9 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
ret &= fromLegacy<bool>( aCfg, p + "StartDiagonal", "tools.pns.start_diagonal" );
ret &= fromLegacy<int>( aCfg, p + "ShoveTimeLimit", "tools.pns.shove_time_limit" );
ret &= fromLegacy<int>( aCfg, p + "ShoveIterationLimit", "tools.pns.shove_iteration_limit" );
ret &= fromLegacy<int>( aCfg,
p + "WalkaroundIterationLimit", "tools.pns.walkaround_iteration_limit" );
ret &= fromLegacy<int>( aCfg, p + "WalkaroundIterationLimit", "tools.pns.walkaround_iteration_limit" );
ret &= fromLegacy<bool>( aCfg, p + "JumpOverObstacles", "tools.pns.jump_over_obstacles" );
ret &= fromLegacy<bool>( aCfg,
p + "SmoothDraggedSegments", "tools.pns.smooth_dragged_segments" );
ret &= fromLegacy<bool>( aCfg, p + "SmoothDraggedSegments", "tools.pns.smooth_dragged_segments" );
ret &= fromLegacy<bool>( aCfg, p + "CanViolateDRC", "tools.pns.can_violate_drc" );
ret &= fromLegacy<bool>( aCfg, p + "SuggestFinish", "tools.pns.suggest_finish" );
ret &= fromLegacy<bool>( aCfg, p + "FreeAngleMode", "tools.pns.free_angle_mode" );
@ -683,6 +673,21 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
Pgm().GetSettingsManager().SaveColorSettings( cs, "board" );
double x, y;
if( aCfg->Read( f + "PcbUserGrid_X", &x ) && aCfg->Read( f + "PcbUserGrid_Y", &y ) )
{
EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( f + "PcbUserGrid_Unit",
static_cast<long>( EDA_UNITS::INCHES ) ) );
// Convert to internal units
x = From_User_Unit( u, x );
y = From_User_Unit( u, y );
( *this )[PointerFromString( "window.grid.user_grid_x" )] = StringFromValue( u, x, true, true );
( *this )[PointerFromString( "window.grid.user_grid_y" )] = StringFromValue( u, y, true, true );
}
// Footprint editor settings were stored in pcbnew config file. Migrate them here.
auto fpedit = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( false );
fpedit->MigrateFromLegacy( aCfg );

View File

@ -242,10 +242,6 @@ public:
MAGNETIC_SETTINGS m_MagneticItems;
int m_FastGrid1;
int m_FastGrid2;
bool m_Use45DegreeGraphicSegments; // True to constraint graphic lines to horizontal,
// vertical and 45º
bool m_FlipLeftRight; // True: Flip footprints across Y axis

View File

@ -111,7 +111,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, 0, NULL );
updateZoomSelectBox();
UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox );
KiScaledSeparator( m_mainToolBar, this );

View File

@ -89,7 +89,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, 0, NULL );
updateZoomSelectBox();
UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox );
// after adding the buttons to the toolbar, must call Realize() to

View File

@ -488,7 +488,7 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, 0, NULL );
updateZoomSelectBox();
UpdateZoomSelectBox();
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
// after adding the buttons to the toolbar, must call Realize()

View File

@ -365,20 +365,6 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
// Grid control
int PCBNEW_CONTROL::GridFast1( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( "common.Control.gridPreset", true, m_frame->Settings().m_FastGrid1 );
return 0;
}
int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( "common.Control.gridPreset", true, m_frame->Settings().m_FastGrid2 );
return 0;
}
void PCBNEW_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
BOARD_ITEM* originViewItem, const VECTOR2D& aPoint )
{
@ -1082,8 +1068,6 @@ void PCBNEW_CONTROL::setTransitions()
Go( &PCBNEW_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
// Grid control
Go( &PCBNEW_CONTROL::GridFast1, ACTIONS::gridFast1.MakeEvent() );
Go( &PCBNEW_CONTROL::GridFast2, ACTIONS::gridFast2.MakeEvent() );
Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );

View File

@ -70,8 +70,6 @@ public:
int LayerAlphaDec( const TOOL_EVENT& aEvent );
// Grid control
int GridFast1( const TOOL_EVENT& aEvent );
int GridFast2( const TOOL_EVENT& aEvent );
int GridSetOrigin( const TOOL_EVENT& aEvent );
int GridResetOrigin( const TOOL_EVENT& aEvent );