diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 513d837b0e..62141bd93f 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -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(); diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp index 6347d48c8c..cd4356e01b 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -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 ); diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp index c70445ab2c..ecbf7736a2 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -187,7 +187,7 @@ General Options - 0 + 1 1 1 @@ -2117,7 +2117,7 @@ 0 - 0 + -10 0 @@ -3419,7 +3419,7 @@ Template Field Names - 1 + 0 1 1 diff --git a/eeschema/dialogs/dialog_libedit_options.cpp b/eeschema/dialogs/dialog_libedit_options.cpp index 578a728a46..db65d6e22c 100644 --- a/eeschema/dialogs/dialog_libedit_options.cpp +++ b/eeschema/dialogs/dialog_libedit_options.cpp @@ -31,12 +31,17 @@ #include #include +#include -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 ) diff --git a/eeschema/dialogs/dialog_libedit_options.h b/eeschema/dialogs/dialog_libedit_options.h index 59042502a2..9600dbaad5 100644 --- a/eeschema/dialogs/dialog_libedit_options.h +++ b/eeschema/dialogs/dialog_libedit_options.h @@ -33,10 +33,14 @@ #include +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__ diff --git a/eeschema/dialogs/dialog_libedit_options_base.cpp b/eeschema/dialogs/dialog_libedit_options_base.cpp index ff15ede07d..597b7a6be3 100644 --- a/eeschema/dialogs/dialog_libedit_options_base.cpp +++ b/eeschema/dialogs/dialog_libedit_options_base.cpp @@ -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 ); diff --git a/eeschema/dialogs/dialog_libedit_options_base.fbp b/eeschema/dialogs/dialog_libedit_options_base.fbp index a05612d082..6d1cfafef9 100644 --- a/eeschema/dialogs/dialog_libedit_options_base.fbp +++ b/eeschema/dialogs/dialog_libedit_options_base.fbp @@ -44,7 +44,7 @@ DIALOG_LIBEDIT_OPTIONS_BASE - 492,244 + 492,403 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Library Editor Options @@ -505,7 +505,7 @@ 0 0 wxID_ANY - 1 + 6 100 0 @@ -1406,6 +1406,949 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Repeat draw item &horizontal displacement: + + 0 + + + 0 + + 1 + m_staticText11 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + 1000 + + 0 + + -1000 + + 0 + + 1 + m_spinRepeatHorizontal + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + + 0 + + + 0 + + 1 + m_staticText12 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Repeat draw item &vertical displacement: + + 0 + + + 0 + + 1 + m_staticText13 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0 + 1000 + + 0 + + -1000 + + 0 + + 1 + m_spinRepeatVertical + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + 100 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + + 0 + + + 0 + + 1 + m_staticText14 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Repeat pin displacement + + 0 + + + 0 + + 1 + m_staticText15 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "100" "50" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choicePinDisplacement + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + + 0 + + + 0 + + 1 + m_staticText16 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Repeat label increment: + + 0 + + + 0 + + 1 + m_staticText17 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 10 + + 0 + + -10 + + 0 + + 1 + m_spinRepeatLabel + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 0 + protected + 0 + + @@ -1687,7 +2630,7 @@ 0 0 - m_sdbSizer1 + m_sdbSizer protected diff --git a/eeschema/dialogs/dialog_libedit_options_base.h b/eeschema/dialogs/dialog_libedit_options_base.h index 88de1b6d08..2b43354c44 100644 --- a/eeschema/dialogs/dialog_libedit_options_base.h +++ b/eeschema/dialogs/dialog_libedit_options_base.h @@ -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(); }; diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 049bdc8081..2be1d87b16 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -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 - * 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; } } diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 5f32e567d1..9472f557e7 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -48,13 +48,10 @@ #include - -// 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 ); diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 113e7868a3..5c6b140b99 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -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. diff --git a/eeschema/general.h b/eeschema/general.h index 42ecad26b1..7f8b147437 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -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 -// -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; diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 672c0db17f..c57e1bc161 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -28,6 +28,9 @@ #include #include +// 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; } diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 0998623bd9..c99e1a603e 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -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 diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 12a99405ef..7422662ce7 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -46,7 +46,7 @@ #include -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 ); } diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 6c068da39e..a570bfc57f 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -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