Commit 73a8cd61 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Added eeschema option for the default pin length

parent 7dc8fc1f
......@@ -58,6 +58,9 @@ public:
void SetLineWidth( int aWidth ) { m_spinLineWidth->SetValue( aWidth ); }
int GetLineWidth( void ) { return m_spinLineWidth->GetValue(); }
void SetPinLength( int aLength ) { m_spinPinLength->SetValue( aLength ); }
int GetPinLength( void ) { return m_spinPinLength->GetValue(); }
void SetTextSize( int text_size ) { m_spinTextSize->SetValue( text_size ); }
int GetTextSize( void ) { return m_spinTextSize->GetValue(); }
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -35,7 +35,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
bSizer3 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 10, 3, 0, 0 );
fgSizer1 = new wxFlexGridSizer( 11, 3, 0, 0 );
fgSizer1->AddGrowableCol( 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->AddGrowableCol( 2 );
......@@ -89,6 +89,17 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticLineWidthUnits->Wrap( -1 );
fgSizer1->Add( m_staticLineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
m_staticText52 = new wxStaticText( m_panel1, wxID_ANY, _("Default pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText52->Wrap( -1 );
fgSizer1->Add( m_staticText52, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 );
m_spinPinLength = new wxSpinCtrl( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 50, 1000, 100 );
fgSizer1->Add( m_spinPinLength, 0, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );
m_staticPinLengthUnits = new wxStaticText( m_panel1, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticPinLengthUnits->Wrap( -1 );
fgSizer1->Add( m_staticPinLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 );
m_staticText7 = new wxStaticText( m_panel1, wxID_ANY, _("Default text &size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
fgSizer1->Add( m_staticText7, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
......@@ -236,7 +247,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName1 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName1->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName1, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText161 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 2"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -244,7 +254,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText161, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName2 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName2->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText17 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 3"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -252,7 +261,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText17, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName3 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName3->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName3, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText18 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 4"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -260,7 +268,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText18, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName4 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName4->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName4, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText19 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 5"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -268,7 +275,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText19, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName5 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName5->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName5, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText20 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 6"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -276,7 +282,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText20, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName6 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName6->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName6, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText21 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 7"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -284,7 +289,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName7 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName7->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName7, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticText22 = new wxStaticText( m_panel2, wxID_ANY, _("Custom field 8"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -292,7 +296,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer2->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 3 );
m_fieldName8 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fieldName8->SetMaxLength( 0 );
fgSizer2->Add( m_fieldName8, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,8 +11,6 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
......@@ -69,6 +67,9 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxStaticText* m_staticText5;
wxSpinCtrl* m_spinLineWidth;
wxStaticText* m_staticLineWidthUnits;
wxStaticText* m_staticText52;
wxSpinCtrl* m_spinPinLength;
wxStaticText* m_staticPinLengthUnits;
wxStaticText* m_staticText7;
wxSpinCtrl* m_spinTextSize;
wxStaticText* m_staticTextSizeUnits;
......
......@@ -84,7 +84,7 @@ int GetDefaultLineThickness()
return s_drawDefaultLineThickness;
}
void SetDefaultLineThickness( int aThickness)
void SetDefaultLineThickness( int aThickness )
{
if( aThickness >=1 )
s_drawDefaultLineThickness = aThickness;
......@@ -92,6 +92,21 @@ void SetDefaultLineThickness( int aThickness)
s_drawDefaultLineThickness = 1;
}
/*
* Default pin length
*/
static int s_defaultPinLength;
int GetDefaultPinLength()
{
return s_defaultPinLength;
}
void SetDefaultPinLength( int aLength )
{
s_defaultPinLength = aLength;
}
EDA_COLOR_T GetLayerColor( LayerNumber aLayer )
{
return s_layerColor[aLayer];
......@@ -269,6 +284,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
dlg.SetBusWidth( GetDefaultBusThickness() );
dlg.SetLineWidth( GetDefaultLineThickness() );
dlg.SetPinLength( GetDefaultPinLength() );
dlg.SetTextSize( GetDefaultLabelSize() );
dlg.SetRepeatHorizontal( g_RepeatStep.x );
dlg.SetRepeatVertical( g_RepeatStep.y );
......@@ -317,6 +333,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
SetDefaultBusThickness( dlg.GetBusWidth() );
SetDefaultLineThickness( dlg.GetLineWidth() );
SetDefaultPinLength( dlg.GetPinLength() );
SetDefaultLabelSize( dlg.GetTextSize() );
g_RepeatStep.x = dlg.GetRepeatHorizontal();
g_RepeatStep.y = dlg.GetRepeatVertical();
......@@ -477,6 +494,7 @@ void SCH_EDIT_FRAME::SaveProjectSettings( bool aAskForSave )
static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" );
static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" );
static const wxChar DefaultPinLengthEntry[] = wxT( "DefaultPinLength" );
static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" );
static const wxChar HorzVertLinesOnlyEntry[] = wxT( "HorizVertLinesOnly" );
static const wxChar PreviewFramePositionXEntry[] = wxT( "PreviewFramePositionX" );
......@@ -602,6 +620,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, 12l ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, 6l ) );
SetDefaultPinLength( aCfg->Read( DefaultPinLengthEntry, 300l ) );
aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true );
......@@ -691,6 +710,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() );
aCfg->Write( DefaultDrawLineWidthEntry, (long) GetDefaultLineThickness() );
aCfg->Write( DefaultPinLengthEntry, (long) GetDefaultPinLength() );
aCfg->Write( ShowHiddenPinsEntry, m_showAllPins );
aCfg->Write( HorzVertLinesOnlyEntry, GetForceHVLines() );
......
......@@ -74,7 +74,13 @@ extern SCH_SHEET* g_RootSheet;
* default thickness line value (i.e. = 0 ).
*/
int GetDefaultLineThickness();
void SetDefaultLineThickness( int aThickness);
void SetDefaultLineThickness( int aThickness );
/**
* Default length for new pins in module editor
*/
int GetDefaultPinLength();
void SetDefaultPinLength( int aLength );
/**
* Default line thickness used to draw/plot busses.
......
......@@ -185,7 +185,7 @@ const wxChar* MsgPinElectricType[] =
LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) :
LIB_ITEM( LIB_PIN_T, aParent )
{
m_length = DEFAULT_PIN_LENGTH; // default Pin len
m_length = GetDefaultPinLength(); // default Pin len
m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
m_shape = NONE; // Pin shape, bitwise.
m_type = PIN_UNSPECIFIED; // electrical type of pin
......
......@@ -33,7 +33,6 @@
#define TARGET_PIN_RADIUS 12 // Circle diameter drawn at the active end of pins
#define DEFAULT_PIN_LENGTH 300 // Default Length of a pin when it is created.
// pins: special symbols sizes
#define INVERT_PIN_RADIUS 30 // Radius of inverted pin circle.
......
......@@ -59,13 +59,22 @@ static wxPoint PinPreviousPos;
static int LastPinType = PIN_INPUT;
static int LastPinOrient = PIN_RIGHT;
static int LastPinShape = NONE;
static int LastPinLength = DEFAULT_PIN_LENGTH;
static int LastPinNameSize = DEFAULT_TEXT_SIZE;
static int LastPinNumSize = DEFAULT_TEXT_SIZE;
static bool LastPinCommonConvert = false;
static bool LastPinCommonUnit = false;
static bool LastPinVisible = true;
// The -1 is a non-valid value to trigger delayed initialization
static int LastPinLength = -1;
static int GetLastPinLength()
{
if( LastPinLength == -1 )
LastPinLength = GetDefaultPinLength();
return LastPinLength;
}
void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
{
......@@ -136,7 +145,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
pin->SetNumber( dlg.GetPadName() );
pin->SetNumberTextSize( LastPinNumSize );
pin->SetOrientation( LastPinOrient );
pin->SetLength( LastPinLength );
pin->SetLength( GetLastPinLength() );
pin->SetType( LastPinType );
pin->SetShape( LastPinShape );
pin->SetConversion( ( LastPinCommonConvert ) ? 0 : m_convert );
......@@ -389,7 +398,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
pin->SetFlags( IS_LINKED );
pin->Move( GetCrossHairPosition( true ) );
pin->SetLength( LastPinLength );
pin->SetLength( GetLastPinLength() );
pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType );
pin->SetShape( LastPinShape );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment