Completely remove reading SCH grid sizes from config files.
It messes up too many things if you put metric grids in there. Fixes https://gitlab.com/kicad/code/kicad/issues/13345
This commit is contained in:
parent
c5d7e447c7
commit
3b021d98be
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
|
||||
#include <dialogs/dialog_grid_settings.h>
|
||||
#include <base_units.h>
|
||||
#include <common.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <eda_draw_frame.h>
|
||||
|
@ -30,6 +29,8 @@
|
|||
#include <tool/actions.h>
|
||||
#include <tool/grid_menu.h>
|
||||
#include <tool/common_tools.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ):
|
||||
DIALOG_GRID_SETTINGS_BASE( aParent ),
|
||||
|
@ -114,7 +115,8 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
|
|||
return false;
|
||||
|
||||
// Apply the new settings
|
||||
GRID_SETTINGS& gridCfg = m_parent->config()->m_Window.grid;
|
||||
APP_SETTINGS_BASE* cfg = m_parent->config();
|
||||
GRID_SETTINGS& gridCfg = cfg->m_Window.grid;
|
||||
|
||||
gridCfg.last_size_idx = m_currentGridCtrl->GetSelection();
|
||||
m_parent->SetGridOrigin( wxPoint( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -177,7 +177,7 @@ DIALOG_GRID_SETTINGS_BASE::DIALOG_GRID_SETTINGS_BASE( wxWindow* parent, wxWindow
|
|||
m_buttonResetSizes->Hide();
|
||||
m_buttonResetSizes->SetToolTip( _("Resets the list of grid sizes to default values") );
|
||||
|
||||
bButtonSizer->Add( m_buttonResetSizes, 0, wxALL, 5 );
|
||||
bButtonSizer->Add( m_buttonResetSizes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bButtonSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="15" />
|
||||
<FileVersion major="1" minor="16" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
|
@ -14,6 +14,7 @@
|
|||
<property name="file">dialog_grid_settings_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_grid_settings</property>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -50,6 +52,7 @@
|
|||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Grid Settings</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
|
@ -1599,6 +1602,7 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -1661,7 +1665,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1672,6 +1676,7 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -24,10 +24,10 @@
|
|||
#include <wx/choice.h>
|
||||
#include <wx/simplebook.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -78,6 +78,7 @@ class DIALOG_GRID_SETTINGS_BASE : public DIALOG_SHIM
|
|||
public:
|
||||
|
||||
DIALOG_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
|
||||
~DIALOG_GRID_SETTINGS_BASE();
|
||||
|
||||
};
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <settings/json_settings_internals.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <base_units.h>
|
||||
|
||||
|
||||
APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion ) :
|
||||
|
@ -316,16 +315,29 @@ 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_LIST<wxString>( aJsonPath + ".grid.sizes",
|
||||
&aWindow->grid.sizes, DefaultGridSizeList() ) );
|
||||
|
||||
int defaultGridIdx;
|
||||
|
||||
if( m_filename == "eeschema" || m_filename == "symbol_editor" || m_filename == "pl_editor" )
|
||||
if( m_filename == "pl_editor" )
|
||||
{
|
||||
defaultGridIdx = 1;
|
||||
|
||||
m_params.emplace_back( new PARAM_LIST<wxString>( aJsonPath + ".grid.sizes",
|
||||
&aWindow->grid.sizes, DefaultGridSizeList() ) );
|
||||
}
|
||||
else if( m_filename == "eeschema" || m_filename == "symbol_editor" )
|
||||
{
|
||||
defaultGridIdx = 1;
|
||||
|
||||
// Eeschema's grids are fixed to keep wires/pins connected
|
||||
}
|
||||
else
|
||||
{
|
||||
defaultGridIdx = 4;
|
||||
|
||||
m_params.emplace_back( new PARAM_LIST<wxString>( aJsonPath + ".grid.sizes",
|
||||
&aWindow->grid.sizes, DefaultGridSizeList() ) );
|
||||
}
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.last_size",
|
||||
&aWindow->grid.last_size_idx, defaultGridIdx ) );
|
||||
|
||||
|
|
|
@ -188,32 +188,34 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
EDA_DRAW_FRAME::LoadSettings( aCfg );
|
||||
|
||||
// Currently values read from config file are not used because the user cannot
|
||||
// change this config
|
||||
// if( aCfg->m_Window.grid.sizes.empty() ) // Will be probably never enabled
|
||||
{
|
||||
/*
|
||||
* Do NOT add others values (mainly grid values in mm), because they can break the
|
||||
* schematic: Because wires and pins are considered as connected when the are to the
|
||||
* same coordinate we cannot mix coordinates in mils (internal units) and mm (that
|
||||
* cannot exactly converted in mils in many cases). In fact schematic must only use
|
||||
* 50 and 25 mils to place labels, wires and symbols others values are useful only
|
||||
* for graphic items (mainly in library editor) so use integer values in mils only.
|
||||
* 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"
|
||||
*/
|
||||
aCfg->m_Window.grid.sizes = { "100 mil",
|
||||
"50 mil",
|
||||
"25 mil",
|
||||
"10 mil",
|
||||
"5 mil",
|
||||
"2 mil",
|
||||
"1 mil" };
|
||||
}
|
||||
/*
|
||||
* Do NOT add other values (particularly grid values in mm), because they can break the
|
||||
* schematic: Because wires and pins are considered as connected when the are to the same
|
||||
* coordinate we cannot mix coordinates in mils (internal units) and mm (that cannot exactly
|
||||
* converted in mils in many cases). In fact schematic must only use 50 and 25 mils to
|
||||
* place labels, wires and symbols others values are useful only for graphic items (mainly
|
||||
* in library editor) so use integer values in mils only.
|
||||
* 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"
|
||||
*/
|
||||
aCfg->m_Window.grid.sizes = { "100 mil",
|
||||
"50 mil",
|
||||
"25 mil",
|
||||
"10 mil",
|
||||
"5 mil",
|
||||
"2 mil",
|
||||
"1 mil" };
|
||||
|
||||
// Currently values read from config file are not used because the user cannot
|
||||
// change this config
|
||||
// if( aCfg->m_Window.zoom_factors.empty() )
|
||||
if( aCfg->m_Window.grid.last_size_idx > (int) aCfg->m_Window.grid.sizes.size() )
|
||||
aCfg->m_Window.grid.last_size_idx = 1;
|
||||
|
||||
if( aCfg->m_Window.grid.fast_grid_1 > (int) aCfg->m_Window.grid.sizes.size() )
|
||||
aCfg->m_Window.grid.fast_grid_1 = 1;
|
||||
|
||||
if( aCfg->m_Window.grid.fast_grid_2 > (int) aCfg->m_Window.grid.sizes.size() )
|
||||
aCfg->m_Window.grid.fast_grid_2 = 2;
|
||||
|
||||
if( aCfg->m_Window.zoom_factors.empty() )
|
||||
{
|
||||
aCfg->m_Window.zoom_factors = { ZOOM_LIST_EESCHEMA };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue