Commit 94479d87 authored by jean-pierre charras's avatar jean-pierre charras

eeschema: fix minor Bug #1446779 (repeat parameters not initialized until a project config is read)

Now these parameters are stored in user config, not project config ( they are not really related to a given project, they are just a setup during an edition),
and the schematic editor and the component editor have now separate parameters, because they are separate editors with different constraints.
component editor: repeat pin enhancement (from and idea of Edward Johns)
parent 584f35e6
......@@ -443,10 +443,10 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
}
else
{
my_clone->Move( wxPoint( g_RepeatStep.GetWidth(), g_RepeatStep.GetHeight() ) );
my_clone->Move( GetRepeatStep() );
if( my_clone->CanIncrementLabel() )
( (SCH_TEXT*) my_clone )->IncrementLabel();
( (SCH_TEXT*) my_clone )->IncrementLabel( GetRepeatDeltaLabel() );
GetScreen()->Append( my_clone );
GetScreen()->TestDanglingEnds();
......
......@@ -134,7 +134,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText16->Wrap( -1 );
fgSizer1->Add( m_staticText16, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
m_spinRepeatLabel = new wxSpinCtrl( m_panel1, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 0, 10, 1 );
m_spinRepeatLabel = new wxSpinCtrl( m_panel1, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, -10, 10, 1 );
fgSizer1->Add( m_spinRepeatLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
......@@ -213,7 +213,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel1->SetSizer( p1mainSizer );
m_panel1->Layout();
p1mainSizer->Fit( m_panel1 );
m_notebook->AddPage( m_panel1, _("General Options"), false );
m_notebook->AddPage( m_panel1, _("General Options"), true );
m_panel2 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel2->SetToolTip( _("User defined field names for schematic components. ") );
......@@ -258,7 +258,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel2->SetSizer( bSizer6 );
m_panel2->Layout();
bSizer6->Fit( m_panel2 );
m_notebook->AddPage( m_panel2, _("Template Field Names"), true );
m_notebook->AddPage( m_panel2, _("Template Field Names"), false );
bOptionsSizer->Add( m_notebook, 1, wxALL|wxEXPAND, 5 );
......
......@@ -187,7 +187,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">General Options</property>
<property name="select">0</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
......@@ -2117,7 +2117,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">0</property>
<property name="min">-10</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
......@@ -3419,7 +3419,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Template Field Names</property>
<property name="select">1</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
......
......@@ -31,12 +31,17 @@
#include <class_base_screen.h>
#include <dialog_libedit_options.h>
#include <libeditframe.h>
DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( wxWindow* parent ) :
DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) :
DIALOG_LIBEDIT_OPTIONS_BASE( parent )
{
m_sdbSizer1OK->SetDefault();
m_sdbSizerOK->SetDefault();
SetRepeatLabelInc( Parent()->GetRepeatDeltaLabel() );
SetItemRepeatStep( Parent()->GetRepeatStep() );
SetPinRepeatStep( Parent()->GetRepeatPinStep() );
}
void DIALOG_LIBEDIT_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id )
......
......@@ -33,10 +33,14 @@
#include <dialog_libedit_options_base.h>
class LIB_EDIT_FRAME;
class DIALOG_LIBEDIT_OPTIONS : public DIALOG_LIBEDIT_OPTIONS_BASE
{
public:
DIALOG_LIBEDIT_OPTIONS( wxWindow* parent );
DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent );
LIB_EDIT_FRAME* Parent() { return (LIB_EDIT_FRAME*) GetParent(); }
void SetGridSelection( int select ) { m_choiceGridSize->SetSelection( select ); }
int GetGridSelection( void ) { return m_choiceGridSize->GetSelection(); }
......@@ -56,6 +60,31 @@ public:
void SetPinNameSize( int text_size ) { m_spinPinNameSize->SetValue( text_size ); }
int GetPinNameSize( void ) { return m_spinPinNameSize->GetValue(); }
void SetPinRepeatStep( int aValue ) { m_choicePinDisplacement->SetSelection( aValue == 50 ? 1 : 0 ); }
int GetPinRepeatStep( void )
{
return m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100;
}
void SetItemRepeatStep( wxPoint aValue )
{
m_spinRepeatHorizontal->SetValue( aValue.x );
m_spinRepeatVertical->SetValue( aValue.y );
}
wxPoint GetItemRepeatStep( void )
{
wxPoint step;
step.x = m_spinRepeatHorizontal->GetValue();
step.y = m_spinRepeatVertical->GetValue();
return step;
}
void SetRepeatLabelInc( int aValue ) { m_spinRepeatLabel->SetValue( aValue ); }
int GetRepeatLabelInc( void )
{
return m_spinRepeatLabel->GetValue();
}
};
#endif // __DIALOG_LIBEDIT_OPTIONS__
......@@ -50,7 +50,7 @@ DIALOG_LIBEDIT_OPTIONS_BASE::DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWi
m_staticText5->Wrap( -1 );
fgSizer->Add( m_staticText5, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
m_spinLineWidth = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 1 );
m_spinLineWidth = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 6 );
fgSizer->Add( m_spinLineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
m_staticLineWidthUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -90,6 +90,52 @@ DIALOG_LIBEDIT_OPTIONS_BASE::DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWi
m_staticRepeatXUnits->Wrap( -1 );
fgSizer->Add( m_staticRepeatXUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 3 );
m_staticText11 = new wxStaticText( this, wxID_ANY, _("Repeat draw item &horizontal displacement:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
fgSizer->Add( m_staticText11, 0, wxALL, 5 );
m_spinRepeatHorizontal = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -1000, 1000, 0 );
fgSizer->Add( m_spinRepeatHorizontal, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticText12 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 );
fgSizer->Add( m_staticText12, 0, wxALL, 5 );
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Repeat draw item &vertical displacement:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13->Wrap( -1 );
fgSizer->Add( m_staticText13, 0, wxALL, 5 );
m_spinRepeatVertical = new wxSpinCtrl( this, wxID_ANY, wxT("100"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -1000, 1000, 0 );
fgSizer->Add( m_spinRepeatVertical, 0, wxALL|wxEXPAND, 5 );
m_staticText14 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText14->Wrap( -1 );
fgSizer->Add( m_staticText14, 0, wxALL, 5 );
m_staticText15 = new wxStaticText( this, wxID_ANY, _("Repeat pin displacement"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText15->Wrap( -1 );
fgSizer->Add( m_staticText15, 0, wxALL, 5 );
wxString m_choicePinDisplacementChoices[] = { _("100"), _("50") };
int m_choicePinDisplacementNChoices = sizeof( m_choicePinDisplacementChoices ) / sizeof( wxString );
m_choicePinDisplacement = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePinDisplacementNChoices, m_choicePinDisplacementChoices, 0 );
m_choicePinDisplacement->SetSelection( 0 );
fgSizer->Add( m_choicePinDisplacement, 0, wxALL|wxEXPAND, 5 );
m_staticText16 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText16->Wrap( -1 );
fgSizer->Add( m_staticText16, 0, wxALL, 5 );
m_staticText17 = new wxStaticText( this, wxID_ANY, _("&Repeat label increment:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText17->Wrap( -1 );
fgSizer->Add( m_staticText17, 0, wxALL, 5 );
m_spinRepeatLabel = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -10, 10, 1 );
fgSizer->Add( m_spinRepeatLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
fgSizer->Add( 0, 0, 0, 0, 5 );
bSizer3->Add( fgSizer, 0, wxALIGN_CENTER|wxEXPAND, 0 );
......@@ -114,14 +160,14 @@ DIALOG_LIBEDIT_OPTIONS_BASE::DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWi
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bOptionsSizer->Add( m_staticline2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
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();
bOptionsSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 6 );
bOptionsSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 6 );
mainSizer->Add( bOptionsSizer, 1, wxEXPAND, 12 );
......
......@@ -54,16 +54,27 @@ class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM
wxStaticText* m_staticText9;
wxSpinCtrl* m_spinPinNameSize;
wxStaticText* m_staticRepeatXUnits;
wxStaticText* m_staticText11;
wxSpinCtrl* m_spinRepeatHorizontal;
wxStaticText* m_staticText12;
wxStaticText* m_staticText13;
wxSpinCtrl* m_spinRepeatVertical;
wxStaticText* m_staticText14;
wxStaticText* m_staticText15;
wxChoice* m_choicePinDisplacement;
wxStaticText* m_staticText16;
wxStaticText* m_staticText17;
wxSpinCtrl* m_spinRepeatLabel;
wxStaticLine* m_staticline3;
wxCheckBox* m_checkShowGrid;
wxStaticLine* m_staticline2;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
public:
DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 492,244 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 492,403 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIBEDIT_OPTIONS_BASE();
};
......
......@@ -292,9 +292,9 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
/* Function to increment bus label members numbers,
* i.e. when a text is ending with a number, adds
* <RepeatDeltaLabel> to this number
* aIncrement to this number
*/
void IncrementLabelMember( wxString& name )
void IncrementLabelMember( wxString& name, int aIncrement )
{
int ii, nn;
long number = 0;
......@@ -314,7 +314,7 @@ void IncrementLabelMember( wxString& name )
if( litt_number.ToLong( &number ) )
{
number += g_RepeatDeltaLabel;
number += aIncrement;
name.Remove( ii ); name << number;
}
}
......@@ -48,13 +48,10 @@
#include <kiway.h>
// Global variables
wxSize g_RepeatStep;
int g_RepeatDeltaLabel;
int g_DefaultBusWidth;
// The main sheet of the project
SCH_SHEET* g_RootSheet = NULL;
// a transform matrix, to display components in lib editor
TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 );
......
......@@ -57,7 +57,7 @@
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
static int s_defaultBusThickness = 15;
static int s_defaultBusThickness = DEFAULTBUSTHICKNESS;
int GetDefaultBusThickness()
{
......@@ -93,7 +93,7 @@ void SetDefaultTextSize( int aTextSize )
* Default line (in Eeschema units) thickness used to draw/plot items having a
* default thickness line value (i.e. = 0 ).
*/
static int s_drawDefaultLineThickness;
static int s_drawDefaultLineThickness = DEFAULTDRAWLINETHICKNESS;
int GetDefaultLineThickness()
......@@ -320,9 +320,9 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
dlg.SetBusWidth( GetDefaultBusThickness() );
dlg.SetLineWidth( GetDefaultLineThickness() );
dlg.SetTextSize( GetDefaultTextSize() );
dlg.SetRepeatHorizontal( g_RepeatStep.x );
dlg.SetRepeatVertical( g_RepeatStep.y );
dlg.SetRepeatLabel( g_RepeatDeltaLabel );
dlg.SetRepeatHorizontal( GetRepeatStep().x );
dlg.SetRepeatVertical( GetRepeatStep().y );
dlg.SetRepeatLabel( GetRepeatDeltaLabel() );
dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 );
dlg.SetRefIdSeparator( LIB_PART::GetSubpartIdSeparator(),
LIB_PART::GetSubpartFirstId() );
......@@ -367,15 +367,11 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
saveProjectConfig = true;
}
if( g_RepeatStep.x != dlg.GetRepeatHorizontal() ||
g_RepeatStep.y != dlg.GetRepeatVertical() ||
g_RepeatDeltaLabel != dlg.GetRepeatLabel() )
{
g_RepeatStep.x = dlg.GetRepeatHorizontal();
g_RepeatStep.y = dlg.GetRepeatVertical();
g_RepeatDeltaLabel = dlg.GetRepeatLabel();
saveProjectConfig = true;
}
wxPoint step;
step.x = dlg.GetRepeatHorizontal();
step.y = dlg.GetRepeatVertical();
SetRepeatStep( step );
SetRepeatDeltaLabel( dlg.GetRepeatLabel() );
SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 );
SetGridVisibility( dlg.GetShowGrid() );
......@@ -441,15 +437,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParametersList()
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "SpiceUseNetNumbers" ),
&m_spiceNetlistUseNetcodeAsNetname, false ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
&g_RepeatStep.x,
0, -1000, +1000 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_Y" ),
&g_RepeatStep.y,
100, -1000, +1000 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptLab" ),
&g_RepeatDeltaLabel,
1, -10, +10 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ),
&s_defaultTextSize,
DEFAULT_SIZE_TEXT, 5,
......@@ -545,6 +532,10 @@ static const wxChar lastLibImportPathEntry[] = wxT( "LastLibraryImportPath"
static const wxChar defaultPinNumSizeEntry[] = wxT( "LibeditPinNumSize" );
static const wxChar defaultPinNameSizeEntry[] = wxT( "LibeditPinNameSize" );
static const wxChar DefaultPinLengthEntry[] = wxT( "DefaultPinLength" );
static const wxChar repeatLibLabelIncEntry[] = wxT( "LibeditRepeatLabelInc" );
static const wxChar pinRepeatStepEntry[] = wxT( "LibeditPinRepeatStep" );
static const wxChar repeatLibStepXEntry[] = wxT( "LibeditRepeatStepX" );
static const wxChar repeatLibStepYEntry[] = wxT( "LibeditRepeatStepY" );
PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings()
......@@ -562,6 +553,19 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings()
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintSheetReferenceAndTitleBlock" ),
&m_printSheetReference, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RepeatStepX" ),
&m_repeatStep.x,
DEFAULT_REPEAT_OFFSET_X,
-REPEAT_OFFSET_MAX,
REPEAT_OFFSET_MAX ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RepeatStepY" ),
&m_repeatStep.y,
DEFAULT_REPEAT_OFFSET_Y,
-REPEAT_OFFSET_MAX,
REPEAT_OFFSET_MAX ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RepeatLabelIncrement" ),
&m_repeatDeltaLabel,
DEFAULT_REPEAT_LABEL_INC, -10, +10 ) );
return m_configSettings;
}
......@@ -746,6 +750,12 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
SetDefaultPinLength( aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
m_textPinNumDefaultSize = aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
m_textPinNameDefaultSize = aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE );
SetRepeatDeltaLabel( aCfg->Read( repeatLibLabelIncEntry, DEFAULT_REPEAT_LABEL_INC ) );
SetRepeatPinStep( aCfg->Read( pinRepeatStepEntry, DEFAULT_REPEAT_OFFSET_PIN ) );
wxPoint step;
step.x = aCfg->Read( repeatLibStepXEntry, (long)DEFAULT_REPEAT_OFFSET_X );
step.y = aCfg->Read( repeatLibStepYEntry, (long)DEFAULT_REPEAT_OFFSET_Y );
SetRepeatStep( step );
}
......@@ -758,10 +768,15 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( lastLibExportPathEntry, m_lastLibExportPath );
aCfg->Write( lastLibImportPathEntry, m_lastLibImportPath );
aCfg->Write( DefaultPinLengthEntry, (long) GetDefaultPinLength() );
aCfg->Write( defaultPinNumSizeEntry, (long) m_textPinNumDefaultSize );
aCfg->Write( defaultPinNameSizeEntry, (long) m_textPinNameDefaultSize );
aCfg->Write( defaultPinNumSizeEntry, (long) GetPinNumDefaultSize() );
aCfg->Write( defaultPinNameSizeEntry, (long) GetPinNameDefaultSize() );
aCfg->Write( repeatLibLabelIncEntry, (long) GetRepeatDeltaLabel() );
aCfg->Write( pinRepeatStepEntry, (long) GetRepeatPinStep() );
aCfg->Write( repeatLibStepXEntry, (long) GetRepeatStep().x );
aCfg->Write( repeatLibStepYEntry, (long) GetRepeatStep().y );
}
void LIB_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
{
wxArrayString units;
......@@ -790,6 +805,9 @@ void LIB_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
m_textPinNumDefaultSize = dlg.GetPinNumSize();
m_textPinNameDefaultSize = dlg.GetPinNameSize();
SetGridVisibility( dlg.GetShowGrid() );
SetRepeatPinStep( dlg.GetPinRepeatStep() );
SetRepeatStep( dlg.GetItemRepeatStep() );
SetRepeatDeltaLabel( dlg.GetRepeatLabelInc() );
SaveSettings( config() ); // save values shared by eeschema applications.
......
......@@ -37,11 +37,19 @@ class SCH_SHEET;
#define EESCHEMA_VERSION 2
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers
#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers
#define DANGLING_SYMBOL_SIZE 12
#define DEFAULT_REPEAT_OFFSET_X 0 ///< the default X value (overwritten by the eeschema config)
#define DEFAULT_REPEAT_OFFSET_Y 100 ///< the default Y value (overwritten by the eeschema config)
#define REPEAT_OFFSET_MAX 1000 ///< the max value of repeat offset value
#define DEFAULT_REPEAT_LABEL_INC 1 ///< the default value (overwritten by the eeschema config)
#define DEFAULT_REPEAT_OFFSET_PIN 100 ///< the default value (overwritten by the eeschema config)
///< when repeating a pin
///< The thickness to draw busses that do not have a specific width
//</ (can be changed in preference menu)
///< (can be changed in preference menu)
#define DEFAULTBUSTHICKNESS 12
///< The thickness to draw lines that thickness is set to 0 (default thickness)
......@@ -103,14 +111,11 @@ inline LAYERSCH_ID operator++( LAYERSCH_ID& a )
/* 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
* Y draw axis is to to bottom so we must have a default matix that reverses
* Y draw axis is to to bottom so we must have a default matrix that reverses
* the Y coordinate and keeps the X coordiate
*/
extern TRANSFORM DefaultTransform;
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
/* First and main (root) screen */
extern SCH_SHEET* g_RootSheet;
......
......@@ -194,6 +194,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_drawSpecificUnit = false;
m_HotkeysZoomAndGridList = g_Libedit_Hokeys_Descr;
m_editPinsPerPartOrConvert = false;
m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
// Delayed initialization
if( m_textSize == -1 )
......
......@@ -119,6 +119,9 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
/// Default pin length
static int m_defaultPinLength;
/// Default repeat offset for pins in repeat place pin
int m_repeatPinStep;
static wxSize m_clientSize;
friend class DIALOG_LIB_EDIT_TEXT;
......@@ -172,7 +175,20 @@ public:
/** Set the default pin len.
*/
static void SetDefaultPinLength( int aLength ) { m_defaultPinLength = aLength; }
static void SetDefaultPinLength( int aLength ) { m_defaultPinLength = aLength; }
/**
* @return the increment value of the position of a pin
* for the pin repeat command
*/
int GetRepeatPinStep() const { return m_repeatPinStep; }
/**
* Sets the repeat step value for pins repeat command
* @param aStep the increment value of the position of an item
* for the repeat command
*/
void SetRepeatPinStep( int aStep) { m_repeatPinStep = aStep; }
void ReCreateMenuBar();
......
......@@ -46,7 +46,7 @@
#include <dialog_lib_edit_pin.h>
extern void IncrementLabelMember( wxString& name );
extern void IncrementLabelMember( wxString& name, int aIncrement );
static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC );
......@@ -572,13 +572,34 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
pin->ClearFlags();
pin->SetFlags( IS_NEW );
pin->Move( pin->GetPosition() + wxPoint( g_RepeatStep.x, -g_RepeatStep.y ) );
wxPoint step;
switch( pin->GetOrientation() )
{
case PIN_UP:
step.x = GetRepeatPinStep();
break;
case PIN_DOWN:
step.x = GetRepeatPinStep();
break;
case PIN_LEFT:
step.y = - GetRepeatPinStep();
break;
case PIN_RIGHT:
step.y = - GetRepeatPinStep();
break;
}
pin->Move( pin->GetPosition() + step );
wxString nextName = pin->GetName();
IncrementLabelMember( nextName );
IncrementLabelMember( nextName, GetRepeatDeltaLabel() );
pin->SetName( nextName );
pin->PinStringNum( msg );
IncrementLabelMember( msg );
IncrementLabelMember( msg, GetRepeatDeltaLabel() );
pin->SetPinNumFromString( msg );
m_drawItem = pin;
......
......@@ -28,6 +28,9 @@
#include <base_units.h>
#include <kiway.h>
// Sttaic members:
SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
FRAME_T aWindowType, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize, long aStyle,
......@@ -35,10 +38,12 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition,
aSize, aStyle, aFrameName )
{
m_zoomLevelCoeff = 11.0; // Adjusted to roughly displays zoom level = 1
m_zoomLevelCoeff = 11.0; // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
// but this is an acceptable value
m_repeatStep = wxPoint( DEFAULT_REPEAT_OFFSET_X, DEFAULT_REPEAT_OFFSET_Y );
m_repeatDeltaLabel = DEFAULT_REPEAT_LABEL_INC;
}
......
......@@ -47,6 +47,13 @@ class SCHLIB_FILTER;
*/
class SCH_BASE_FRAME : public EDA_DRAW_FRAME
{
protected:
wxPoint m_repeatStep; ///< the increment value of the position of an item
///< when it is repeated
int m_repeatDeltaLabel; ///< the increment value of labels like bus members
///< when they are repeated
public:
SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
FRAME_T aWindowType,
......@@ -56,6 +63,33 @@ public:
SCH_SCREEN* GetScreen() const; // overload EDA_DRAW_FRAME
/**
* @return the increment value of the position of an item
* for the repeat command
*/
const wxPoint GetRepeatStep() const { return m_repeatStep; }
/**
* Sets the repeat step value for repeat command
* @param aStep the increment value of the position of an item
* for the repeat command
*/
void SetRepeatStep( const wxPoint& aStep) { m_repeatStep = aStep; }
/**
* @return the increment value of labels like bus members
* for the repeat command
*/
int GetRepeatDeltaLabel() const { return m_repeatDeltaLabel; }
/**
* Sets the repeat delta label value for repeat command
* @param aDelta the increment value of labels like bus members
* for the repeat command
*/
void SetRepeatDeltaLabel( int aDelta ) { m_repeatDeltaLabel = aDelta; }
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
......
......@@ -46,7 +46,7 @@
#include <class_netlist_object.h>
extern void IncrementLabelMember( wxString& name );
extern void IncrementLabelMember( wxString& name, int aIncrement );
/* Names of sheet label types. */
......@@ -131,9 +131,9 @@ EDA_ITEM* SCH_TEXT::Clone() const
}
void SCH_TEXT::IncrementLabel()
void SCH_TEXT::IncrementLabel( int aIncrement )
{
IncrementLabelMember( m_Text );
IncrementLabelMember( m_Text, aIncrement );
}
......
......@@ -98,9 +98,11 @@ public:
/**
* Function IncrementLabel
* increments the label text.
* increments the label text, if it ends with a number.
* @param aIncrement = the increment value to add to the number
* ending the text
*/
void IncrementLabel();
void IncrementLabel( int aIncrement );
/**
* Function SetOrientation
......
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