diff --git a/eeschema/default_values.h b/eeschema/default_values.h new file mode 100644 index 0000000000..c520fdca95 --- /dev/null +++ b/eeschema/default_values.h @@ -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 \ No newline at end of file diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 0b1c03350c..e1e119a765 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -52,6 +52,7 @@ #include #include #include "erc.h" +#include // For some default values static double s_textOffsetRatio = 0.08; diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index 8b73313926..5a7994a5cc 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -30,7 +30,7 @@ #include #include #include -#include // For some default values +#include // For some default values ///! Update the schema version whenever a migration is required const int eeschemaSchemaVersion = 0; diff --git a/eeschema/general.h b/eeschema/general.h index a497134782..a2d553dd6c 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -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 diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 33859cbe57..f2141f2bec 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -35,6 +35,7 @@ #include #include #include +#include // For some default values LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) : diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index f442045383..3c3ec0409f 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -37,6 +37,7 @@ #include #include #include +#include // For some default values LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) : diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 5fe601a762..62cde9905f 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -34,12 +34,12 @@ #include #include #include -#include #include #include #include #include #include +#include // For some default values LIB_FIELD::LIB_FIELD(LIB_PART * aParent, int idfield ) : diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 38b5e1bbd2..910f9c1f90 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -53,6 +53,7 @@ #include #include #include +#include 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 ); } } diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 95d5fd33de..51017dda7e 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // For some default values LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) : diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 2d9987f18e..12a4181b31 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // For some default values LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) : diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index dc2acf5da0..0a8999d6f9 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -41,13 +41,14 @@ #include #include #include +#include // 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 ) ) ); } diff --git a/eeschema/libedit/libedit_settings.cpp b/eeschema/libedit/libedit_settings.cpp index 2705220f18..3db5e47953 100644 --- a/eeschema/libedit/libedit_settings.cpp +++ b/eeschema/libedit/libedit_settings.cpp @@ -25,6 +25,7 @@ #include #include #include "libedit_settings.h" +#include ///! 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( "defaults.line_width", &m_Defaults.line_width, 6 ) ); + m_params.emplace_back( new PARAM( "defaults.line_width", + &m_Defaults.line_width, DEFAULT_LINE_THICKNESS ) ); - m_params.emplace_back( new PARAM( "defaults.text_size", &m_Defaults.text_size, 50 ) ); + m_params.emplace_back( new PARAM( "defaults.text_size", + &m_Defaults.text_size, DEFAULT_TEXT_SIZE ) ); - m_params.emplace_back( new PARAM( "defaults.pin_length", &m_Defaults.pin_length, 100 ) ); + m_params.emplace_back( new PARAM( "defaults.pin_length", + &m_Defaults.pin_length, DEFAULT_PIN_LENGTH ) ); - m_params.emplace_back( - new PARAM( "defaults.pin_name_size", &m_Defaults.pin_name_size, 50 ) ); + m_params.emplace_back( new PARAM( "defaults.pin_name_size", + &m_Defaults.pin_name_size, DEFAULT_PINNAME_SIZE ) ); - m_params.emplace_back( - new PARAM( "defaults.pin_num_size", &m_Defaults.pin_num_size, 50 ) ); + m_params.emplace_back( new PARAM( "defaults.pin_num_size", + &m_Defaults.pin_num_size, DEFAULT_PINNUM_SIZE ) ); m_params.emplace_back( new PARAM( "repeat.label_delta", &m_Repeat.label_delta, 1 ) ); diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 5a689220c0..8528941e60 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -41,6 +41,7 @@ #include #include #include +#include // 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(); diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 65caec41ed..10ee4eea95 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -37,14 +37,15 @@ #include #include #include +#include // 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; diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 90608f034e..099cb89d60 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -46,6 +46,7 @@ #include #include #include +#include // For some default values SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName ) : diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index fc277d0379..0e5604eeb7 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -67,6 +67,7 @@ #include // for PropPowerSymsOnly definintion. #include #include +#include // For some default values #define Mils2Iu( x ) Mils2iu( x ) diff --git a/eeschema/sch_legacy_plugin.h b/eeschema/sch_legacy_plugin.h index e48016f328..f3e65fefff 100644 --- a/eeschema/sch_legacy_plugin.h +++ b/eeschema/sch_legacy_plugin.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include // for EESCHEMA_VERSION definition class KIWAY; diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index b8abaa1e67..19c53462fc 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -40,6 +40,7 @@ #include #include #include +#include // For some default values static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType ) diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index 1620da0a89..2d24909788 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -35,17 +35,17 @@ #include #include -#include #include #include #include +#include // 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 ); } diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index ebc222440d..aca97cd67e 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -60,6 +60,7 @@ #include #include #include +#include #include "sch_painter.h" diff --git a/eeschema/sch_sexpr_parser.h b/eeschema/sch_sexpr_parser.h index 29e8feb961..7715d6519f 100644 --- a/eeschema/sch_sexpr_parser.h +++ b/eeschema/sch_sexpr_parser.h @@ -35,8 +35,8 @@ #include // KiROUND, Clamp #include -#include #include +#include // For some default values class LIB_ARC; diff --git a/eeschema/sch_sexpr_plugin.cpp b/eeschema/sch_sexpr_plugin.cpp index 819cf22300..1574f8c4ce 100644 --- a/eeschema/sch_sexpr_plugin.cpp +++ b/eeschema/sch_sexpr_plugin.cpp @@ -43,7 +43,6 @@ #include #include -#include #include #include #include @@ -78,6 +77,8 @@ #include // for PropPowerSymsOnly definintion. #include #include +#include // 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() ); diff --git a/eeschema/sch_sexpr_plugin.h b/eeschema/sch_sexpr_plugin.h index 3d8708ec3b..09ec4e98f8 100644 --- a/eeschema/sch_sexpr_plugin.h +++ b/eeschema/sch_sexpr_plugin.h @@ -25,7 +25,6 @@ #include #include #include -#include class KIWAY; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 91fd19f4d7..655315ce26 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -46,6 +46,7 @@ #include #include #include +#include // For some default values #include