mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 10:40:13 +00:00
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:
parent
b7ec66dc9b
commit
ad12c42e8b
bitmap2component
common
CMakeLists.txtbase_units.cpp
dialogs
dialog_grid_settings.cppdialog_grid_settings.hdialog_grid_settings_base.cppdialog_grid_settings_base.fbpdialog_grid_settings_base.hdialog_page_settings.cpp
eda_draw_frame.cppsettings
tool
widgets
cvpcb
eeschema
CMakeLists.txt
dialogs
dialog_edit_label.cppdialog_global_edit_text_and_graphics.cppdialog_set_grid.cppdialog_set_grid_base.cppdialog_set_grid_base.fbpdialog_set_grid_base.h
eeschema_config.cppsch_base_frame.hgerbview
include
kicad
pcb_calculator
pcbnew
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
51
common/dialogs/dialog_grid_settings.h
Normal file
51
common/dialogs/dialog_grid_settings.h
Normal 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
|
@ -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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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();
|
||||
|
||||
};
|
||||
|
@ -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 :
|
||||
|
@ -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 );
|
||||
|
@ -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 ) );
|
||||
|
@ -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() );
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
@ -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 );
|
||||
|
||||
}
|
@ -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">&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>
|
@ -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__
|
@ -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() ) ); )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user