Eeschema: move some default values to default_values.h.
These default values are used in many files, and some files were using magic numbers.
This commit is contained in:
parent
45dabde68e
commit
952e7a5fb4
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2016-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 DEFAUT_VALUES_H
|
||||
#define DEFAUT_VALUES_H
|
||||
|
||||
|
||||
#define DANGLING_SYMBOL_SIZE 12
|
||||
|
||||
#define TXT_MARGIN 4
|
||||
|
||||
///< The default pin len value when creating pins(can be changed in preference menu)
|
||||
#define DEFAULT_PIN_LENGTH 100
|
||||
|
||||
///< The default pin number size when creating pins(can be changed in preference menu)
|
||||
#define DEFAULT_PINNUM_SIZE 50
|
||||
|
||||
///< The default pin name size when creating pins(can be changed in preference menu)
|
||||
#define DEFAULT_PINNAME_SIZE 50
|
||||
|
||||
///< The default selection highlight thickness (can be changed in preference menu)
|
||||
#define DEFAULTSELECTIONTHICKNESS 3
|
||||
|
||||
///< The default line width in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_LINE_THICKNESS 6
|
||||
|
||||
///< The default wire width in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_WIRE_THICKNESS 6
|
||||
|
||||
///< The default bus width in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_BUS_THICKNESS 12
|
||||
|
||||
///< The default noconnect size in mils.
|
||||
#define DEFAULT_NOCONNECT_SIZE 48
|
||||
|
||||
///< The default junction diameter in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_JUNCTION_DIAM 40
|
||||
|
||||
///< The default bus and wire enty size in mils.
|
||||
#define DEFAULT_SCH_ENTRY_SIZE 100
|
||||
|
||||
///< The default text size in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_TEXT_SIZE 50
|
||||
|
||||
#endif
|
|
@ -52,6 +52,7 @@
|
|||
#include <widgets/ui_common.h>
|
||||
#include <dialogs/dialog_schematic_setup.h>
|
||||
#include "erc.h"
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
static double s_textOffsetRatio = 0.08;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <settings/settings_manager.h>
|
||||
#include <wx/config.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <general.h> // For some default values
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
///! Update the schema version whenever a migration is required
|
||||
const int eeschemaSchemaVersion = 0;
|
||||
|
|
|
@ -40,35 +40,6 @@ class ERC_SETTINGS;
|
|||
#define EESCHEMA_VERSION 5
|
||||
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
|
||||
|
||||
#define DANGLING_SYMBOL_SIZE 12
|
||||
|
||||
|
||||
#define TXT_MARGIN 4
|
||||
|
||||
///< The default pin len value when creating pins(can be changed in preference menu)
|
||||
#define DEFAULTPINLENGTH 100
|
||||
|
||||
///< The default pin number size when creating pins(can be changed in preference menu)
|
||||
#define DEFAULTPINNUMSIZE 50
|
||||
|
||||
///< The default pin name size when creating pins(can be changed in preference menu)
|
||||
#define DEFAULTPINNAMESIZE 50
|
||||
|
||||
///< The default selection highlight thickness (can be changed in preference menu)
|
||||
#define DEFAULTSELECTIONTHICKNESS 3
|
||||
|
||||
///< The default line width in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_LINE_THICKNESS 6
|
||||
|
||||
///< The default wire width in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_WIRE_THICKNESS 6
|
||||
|
||||
///< The default bus width in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_BUS_THICKNESS 12
|
||||
|
||||
///< The default function diameter in mils. (can be changed in preference menu)
|
||||
#define DEFAULT_JUNCTION_DIAM 40
|
||||
|
||||
/* Rotation, mirror of graphic items in components bodies are handled by a
|
||||
* transform matrix. The default matrix is useful to draw lib entries with
|
||||
* using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <lib_bezier.h>
|
||||
#include <transform.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <lib_circle.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <transform.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
|
||||
|
|
|
@ -34,12 +34,12 @@
|
|||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <general.h>
|
||||
#include <class_libentry.h>
|
||||
#include <transform.h>
|
||||
#include <lib_field.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
LIB_FIELD::LIB_FIELD(LIB_PART * aParent, int idfield ) :
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include <settings/color_settings.h>
|
||||
#include <trace_helpers.h>
|
||||
#include <libedit/libedit_settings.h>
|
||||
#include <default_values.h>
|
||||
|
||||
static const int pin_orientation_codes[] =
|
||||
{
|
||||
|
@ -166,9 +167,9 @@ LIB_PIN::LIB_PIN( LIB_PART* aParent )
|
|||
}
|
||||
else // Use hardcoded eeschema defaults: libedit settings are not existing.
|
||||
{
|
||||
m_length = Mils2iu( 100 );
|
||||
m_numTextSize = Mils2iu( 50 );
|
||||
m_nameTextSize = Mils2iu( 50 );
|
||||
m_length = Mils2iu( DEFAULT_PIN_LENGTH );
|
||||
m_numTextSize = Mils2iu( DEFAULT_PINNUM_SIZE );
|
||||
m_nameTextSize = Mils2iu( DEFAULT_PINNAME_SIZE );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <lib_polyline.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <transform.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <lib_rectangle.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <transform.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) :
|
||||
|
|
|
@ -41,13 +41,14 @@
|
|||
#include <transform.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <lib_text.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
LIB_TEXT::LIB_TEXT( LIB_PART * aParent ) :
|
||||
LIB_ITEM( LIB_TEXT_T, aParent ),
|
||||
EDA_TEXT()
|
||||
{
|
||||
SetTextSize( wxSize( Mils2iu( 50 ), Mils2iu( 50 ) ) );
|
||||
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <settings/parameters.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include "libedit_settings.h"
|
||||
#include <default_values.h>
|
||||
|
||||
|
||||
///! Update the schema version whenever a migration is required
|
||||
|
@ -41,17 +42,20 @@ LIBEDIT_SETTINGS::LIBEDIT_SETTINGS() : APP_SETTINGS_BASE( "libedit", libeditSche
|
|||
// Init settings:
|
||||
SetLegacyFilename( "eeschema" );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.line_width", &m_Defaults.line_width, 6 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.line_width",
|
||||
&m_Defaults.line_width, DEFAULT_LINE_THICKNESS ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.text_size", &m_Defaults.text_size, 50 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.text_size",
|
||||
&m_Defaults.text_size, DEFAULT_TEXT_SIZE ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.pin_length", &m_Defaults.pin_length, 100 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.pin_length",
|
||||
&m_Defaults.pin_length, DEFAULT_PIN_LENGTH ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<int>( "defaults.pin_name_size", &m_Defaults.pin_name_size, 50 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.pin_name_size",
|
||||
&m_Defaults.pin_name_size, DEFAULT_PINNAME_SIZE ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<int>( "defaults.pin_num_size", &m_Defaults.pin_num_size, 50 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "defaults.pin_num_size",
|
||||
&m_Defaults.pin_num_size, DEFAULT_PINNUM_SIZE ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "repeat.label_delta", &m_Repeat.label_delta, 1 ) );
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <tool/tool_dispatcher.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
|
||||
|
@ -85,7 +86,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
|
|||
m_defaultLineWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS ),
|
||||
m_defaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
|
||||
m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
|
||||
m_defaultTextSize( 50.0 * IU_PER_MILS ),
|
||||
m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
|
||||
m_showPinElectricalTypeName( false )
|
||||
{
|
||||
createCanvas();
|
||||
|
|
|
@ -37,14 +37,15 @@
|
|||
#include <sch_line.h>
|
||||
#include <sch_text.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, char shape ) :
|
||||
SCH_ITEM( NULL, aType )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_size.x = Mils2iu( 100 );
|
||||
m_size.y = Mils2iu( 100 );
|
||||
m_size.x = Mils2iu( DEFAULT_SCH_ENTRY_SIZE );
|
||||
m_size.y = Mils2iu( DEFAULT_SCH_ENTRY_SIZE );
|
||||
|
||||
if( shape == '/' )
|
||||
m_size.y *= -1;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <settings/color_settings.h>
|
||||
#include <kicad_string.h>
|
||||
#include <trace_helpers.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName ) :
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include <symbol_lib_table.h> // for PropPowerSymsOnly definintion.
|
||||
#include <confirm.h>
|
||||
#include <tool/selection.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
#define Mils2Iu( x ) Mils2iu( x )
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <memory>
|
||||
#include <sch_io_mgr.h>
|
||||
#include <stack>
|
||||
#include <general.h>
|
||||
#include <general.h> // for EESCHEMA_VERSION definition
|
||||
|
||||
|
||||
class KIWAY;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <settings/color_settings.h>
|
||||
#include <netlist_object.h>
|
||||
#include <sch_view.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType )
|
||||
|
|
|
@ -35,17 +35,17 @@
|
|||
#include <plotter.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <general.h>
|
||||
#include <sch_no_connect.h>
|
||||
#include <netlist_object.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
|
||||
SCH_ITEM( NULL, SCH_NO_CONNECT_T )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_size = Mils2iu( 48 ); ///< No-connect symbol size.
|
||||
m_size = Mils2iu( DEFAULT_NOCONNECT_SIZE ); ///< No-connect symbol size.
|
||||
|
||||
SetLayer( LAYER_NOCONNECT );
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include <settings/color_settings.h>
|
||||
#include <view/view.h>
|
||||
#include <kiface_i.h>
|
||||
#include <default_values.h>
|
||||
|
||||
#include "sch_painter.h"
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include <math/util.h> // KiROUND, Clamp
|
||||
|
||||
#include <class_library.h>
|
||||
#include <general.h>
|
||||
#include <schematic_lexer.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
class LIB_ARC;
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include <properties.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <general.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_component.h>
|
||||
|
@ -78,6 +77,8 @@
|
|||
#include <symbol_lib_table.h> // for PropPowerSymsOnly definintion.
|
||||
#include <confirm.h>
|
||||
#include <tool/selection.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
using namespace TSCHEMATIC_T;
|
||||
|
||||
|
@ -1793,15 +1794,15 @@ void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
|
|||
|
||||
int nestLevel = 0;
|
||||
|
||||
if( aPin->GetNameTextSize() != Mils2iu( DEFAULTPINNAMESIZE )
|
||||
|| aPin->GetNumberTextSize() != Mils2iu( DEFAULTPINNUMSIZE ) )
|
||||
if( aPin->GetNameTextSize() != Mils2iu( DEFAULT_PINNAME_SIZE )
|
||||
|| aPin->GetNumberTextSize() != Mils2iu( DEFAULT_PINNUM_SIZE ) )
|
||||
{
|
||||
aFormatter.Print( 0, "\n" );
|
||||
aFormatter.Print( aNestLevel + 1, "(name %s",
|
||||
aFormatter.Quotew( aPin->GetName() ).c_str() );
|
||||
|
||||
// This follows the EDA_TEXT effects formatting for future expansion.
|
||||
if( aPin->GetNameTextSize() != Mils2iu( DEFAULTPINNAMESIZE ) )
|
||||
if( aPin->GetNameTextSize() != Mils2iu( DEFAULT_PINNAME_SIZE ) )
|
||||
aFormatter.Print( 0, " (effects (font (size %s %s)))",
|
||||
FormatInternalUnits( aPin->GetNameTextSize() ).c_str(),
|
||||
FormatInternalUnits( aPin->GetNameTextSize() ).c_str() );
|
||||
|
@ -1811,7 +1812,7 @@ void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
|
|||
aFormatter.Quotew( aPin->GetNumber() ).c_str() );
|
||||
|
||||
// This follows the EDA_TEXT effects formatting for future expansion.
|
||||
if( aPin->GetNumberTextSize() != Mils2iu( DEFAULTPINNUMSIZE ) )
|
||||
if( aPin->GetNumberTextSize() != Mils2iu( DEFAULT_PINNUM_SIZE ) )
|
||||
aFormatter.Print( 0, " (effects (font (size %s %s)))",
|
||||
FormatInternalUnits( aPin->GetNumberTextSize() ).c_str(),
|
||||
FormatInternalUnits( aPin->GetNumberTextSize() ).c_str() );
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <memory>
|
||||
#include <sch_io_mgr.h>
|
||||
#include <stack>
|
||||
#include <general.h>
|
||||
|
||||
|
||||
class KIWAY;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <netlist_object.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <trace_helpers.h>
|
||||
#include <default_values.h> // For some default values
|
||||
|
||||
#include <wx/debug.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue