From 76737d56d82b23fc16a853da4ffd1f5646740922 Mon Sep 17 00:00:00 2001 From: charras Date: Tue, 23 Mar 2010 19:15:27 +0000 Subject: [PATCH] Eeschema: fixed some issues in undo/redo and ESC commands related to hierarchical sheets; Work in progress --- eeschema/dialog_libedit_dimensions.cpp | 10 +- eeschema/dialog_libedit_dimensions_base.cpp | 37 +- eeschema/dialog_libedit_dimensions_base.fbp | 2832 ++++++++++--------- eeschema/dialog_libedit_dimensions_base.h | 16 +- eeschema/operations_on_items_lists.cpp | 7 - eeschema/schematic_undo_redo.cpp | 34 +- eeschema/sheet.cpp | 24 +- eeschema/sheetlab.cpp | 16 +- 8 files changed, 1543 insertions(+), 1433 deletions(-) diff --git a/eeschema/dialog_libedit_dimensions.cpp b/eeschema/dialog_libedit_dimensions.cpp index b8a3be8e04..b87808bf6f 100644 --- a/eeschema/dialog_libedit_dimensions.cpp +++ b/eeschema/dialog_libedit_dimensions.cpp @@ -21,6 +21,8 @@ class DIALOG_LIBEDIT_DIMENSIONS : public DIALOG_LIBEDIT_DIMENSIONS_BASE public: DIALOG_LIBEDIT_DIMENSIONS( WinEDA_LibeditFrame* parent); ~DIALOG_LIBEDIT_DIMENSIONS(); + private: + void initDialog( ); }; @@ -33,10 +35,16 @@ void WinEDA_LibeditFrame::InstallDimensionsDialog( wxCommandEvent& event ) DIALOG_LIBEDIT_DIMENSIONS::DIALOG_LIBEDIT_DIMENSIONS( WinEDA_LibeditFrame* parent ) : DIALOG_LIBEDIT_DIMENSIONS_BASE( parent ) { - this->Centre( wxBOTH ); + GetSizer()->SetSizeHints(this); + Centre( wxBOTH ); } DIALOG_LIBEDIT_DIMENSIONS::~DIALOG_LIBEDIT_DIMENSIONS() { } +void DIALOG_LIBEDIT_DIMENSIONS::initDialog() +{ + SetFocus( ); +} + diff --git a/eeschema/dialog_libedit_dimensions_base.cpp b/eeschema/dialog_libedit_dimensions_base.cpp index 6bd0a19701..2027277843 100644 --- a/eeschema/dialog_libedit_dimensions_base.cpp +++ b/eeschema/dialog_libedit_dimensions_base.cpp @@ -9,15 +9,18 @@ /////////////////////////////////////////////////////////////////////////// +BEGIN_EVENT_TABLE( DIALOG_LIBEDIT_DIMENSIONS_BASE, wxDialog ) + EVT_BUTTON( wxID_ANY, DIALOG_LIBEDIT_DIMENSIONS_BASE::_wxFB_OnSaveSetupClick ) + EVT_BUTTON( wxID_CANCEL, DIALOG_LIBEDIT_DIMENSIONS_BASE::_wxFB_OnCancelClick ) + EVT_BUTTON( wxID_OK, DIALOG_LIBEDIT_DIMENSIONS_BASE::_wxFB_OnOkClick ) +END_EVENT_TABLE() + DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* mainSizer; - mainSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizerMain; - bSizerMain = new wxBoxSizer( wxVERTICAL ); + mainSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 7, 3, 0, 0 ); @@ -31,7 +34,7 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent m_staticText3->Wrap( -1 ); fgSizer1->Add( m_staticText3, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - wxString m_choiceGridSizeChoices[] = { _("100"), _("50"), _("25"), _("10"), _("5"), _("2"), _("1") }; + wxString m_choiceGridSizeChoices[] = { _("50"), _("25"), _("10"), _("5"), _("2"), _("1") }; int m_choiceGridSizeNChoices = sizeof( m_choiceGridSizeChoices ) / sizeof( wxString ); m_choiceGridSize = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceGridSizeNChoices, m_choiceGridSizeChoices, 0 ); m_choiceGridSize->SetSelection( 0 ); @@ -67,7 +70,7 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent m_staticText9->Wrap( -1 ); fgSizer1->Add( m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - wxString m_choiceRepeatHorizontalChoices[] = { _("100"), _("50") }; + wxString m_choiceRepeatHorizontalChoices[] = { _("50"), _("25") }; int m_choiceRepeatHorizontalNChoices = sizeof( m_choiceRepeatHorizontalChoices ) / sizeof( wxString ); m_choiceRepeatHorizontal = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceRepeatHorizontalNChoices, m_choiceRepeatHorizontalChoices, 0 ); m_choiceRepeatHorizontal->SetSelection( 0 ); @@ -81,7 +84,7 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent m_staticText12->Wrap( -1 ); fgSizer1->Add( m_staticText12, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - wxString m_choiceRepeatVerticalChoices[] = { _("100"), _("50") }; + wxString m_choiceRepeatVerticalChoices[] = { _("50"), _("25") }; int m_choiceRepeatVerticalNChoices = sizeof( m_choiceRepeatVerticalChoices ) / sizeof( wxString ); m_choiceRepeatVertical = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceRepeatVerticalNChoices, m_choiceRepeatVerticalChoices, 0 ); m_choiceRepeatVertical->SetSelection( 0 ); @@ -91,7 +94,7 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent m_staticRepeatYUnits->Wrap( -1 ); fgSizer1->Add( m_staticRepeatYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - m_staticText15 = new wxStaticText( this, wxID_ANY, _("Current &pin lenght"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText15 = new wxStaticText( this, wxID_ANY, _("Current &pin lenght:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText15->Wrap( -1 ); fgSizer1->Add( m_staticText15, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -102,7 +105,7 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent m_staticText161->Wrap( -1 ); fgSizer1->Add( m_staticText161, 0, wxALL, 5 ); - m_CurrentPinNameSizeText = new wxStaticText( this, wxID_ANY, _("Current pin name size"), wxDefaultPosition, wxDefaultSize, 0 ); + m_CurrentPinNameSizeText = new wxStaticText( this, wxID_ANY, _("Current pin name size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_CurrentPinNameSizeText->Wrap( -1 ); fgSizer1->Add( m_CurrentPinNameSizeText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -113,7 +116,7 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent m_staticText18->Wrap( -1 ); fgSizer1->Add( m_staticText18, 0, wxALL, 5 ); - m_CurrentPinNumberSizeText = new wxStaticText( this, wxID_ANY, _("Current pin number size"), wxDefaultPosition, wxDefaultSize, 0 ); + m_CurrentPinNumberSizeText = new wxStaticText( this, wxID_ANY, _("Current pin number size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_CurrentPinNumberSizeText->Wrap( -1 ); fgSizer1->Add( m_CurrentPinNumberSizeText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -134,10 +137,16 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); - bSizerMain->Add( fgSizer1, 0, wxALIGN_CENTER|wxEXPAND, 0 ); + mainSizer->Add( fgSizer1, 0, wxALIGN_CENTER|wxEXPAND, 0 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + mainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* bSizerBttons; + bSizerBttons = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonSave = new wxButton( this, wxID_ANY, _("Save as Default"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerBttons->Add( m_buttonSave, 0, wxALL, 5 ); m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); @@ -145,9 +154,9 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE::DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - bSizerMain->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 0 ); + bSizerBttons->Add( m_sdbSizer1, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 0 ); - mainSizer->Add( bSizerMain, 1, wxALL|wxEXPAND, 12 ); + mainSizer->Add( bSizerBttons, 0, wxALIGN_RIGHT, 5 ); this->SetSizer( mainSizer ); this->Layout(); diff --git a/eeschema/dialog_libedit_dimensions_base.fbp b/eeschema/dialog_libedit_dimensions_base.fbp index 1807e42f46..4ce0ae9136 100644 --- a/eeschema/dialog_libedit_dimensions_base.fbp +++ b/eeschema/dialog_libedit_dimensions_base.fbp @@ -32,7 +32,7 @@ DIALOG_LIBEDIT_DIMENSIONS_BASE - 412,358 + 412,349 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Library Editor Options @@ -73,1401 +73,82 @@ mainSizer - wxHORIZONTAL + wxVERTICAL none - 12 - wxALL|wxEXPAND - 1 - + 0 + wxALIGN_CENTER|wxEXPAND + 0 + + 3 + wxHORIZONTAL + 0,1,2 + + 0 - bSizerMain - wxVERTICAL + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED none + 7 + 0 - 0 - wxALIGN_CENTER|wxEXPAND - 0 - - 3 - wxHORIZONTAL - 0,1,2 - - 0 + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + &Grid size: + - fgSizer1 - wxFLEX_GROWMODE_SPECIFIED - none - 7 - 0 - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - - - 1 - - - 0 - wxID_ANY - &Grid size: - - - m_staticText3 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND - 0 - - - "100" "50" "25" "10" "5" "2" "1" - - 1 - - - 0 - wxID_ANY - - - m_choiceGridSize - protected - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticGridUnits - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - - - 1 - - - 0 - wxID_ANY - Current graphic &line width: - - - m_staticText5 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_CurrentGraphicLineThicknessCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticLineWidthUnits - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - - - 1 - - - 0 - wxID_ANY - Current graphic text &size: - - - m_staticText7 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_CurrentGraphicTextSizeCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticTextSizeUnits - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - - - 1 - - - 0 - wxID_ANY - Repeat draw item &horizontal displacement: - - - m_staticText9 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - "100" "50" - - 1 - - - 0 - wxID_ANY - - - m_choiceRepeatHorizontal - protected - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticRepeatXUnits - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - - - 1 - - - 0 - wxID_ANY - Repeat draw item &vertical displacement: - - - m_staticText12 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - "100" "50" - - 1 - - - 0 - wxID_ANY - - - m_choiceRepeatVertical - protected - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticRepeatYUnits - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - Current &pin lenght - - - m_staticText15 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_CurrentPinLenghtCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticText161 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - Current pin name size - - - m_CurrentPinNameSizeText - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_CurrentPinNameSizeCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticText18 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - Current pin number size - - - m_CurrentPinNumberSizeText - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_CurrentPinNumberSizeCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - - - 1 - - - 0 - wxID_ANY - mils - - - m_staticText20 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - - 1 - - - 0 - wxID_ANY - &Repeat pin number increment: - - - m_staticText16 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - 1 - 10 - - 0 - - m_spinRepeatLabel - protected - - - wxSP_ARROW_KEYS|wxSP_WRAP - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 1 - - 0 - protected - 0 - - + m_staticText3 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + - 5 - wxEXPAND | wxALL + 3 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - + + "50" "25" "10" "5" "2" "1" 1 @@ -1476,17 +157,1388 @@ wxID_ANY - m_staticline1 + m_choiceGridSize protected + 0 - wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticGridUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + Current graphic &line width: + + + m_staticText5 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_CurrentGraphicLineThicknessCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticLineWidthUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + Current graphic text &size: + + + m_staticText7 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_CurrentGraphicTextSizeCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticTextSizeUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + Repeat draw item &horizontal displacement: + + + m_staticText9 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + "50" "25" + + 1 + + + 0 + wxID_ANY + + + m_choiceRepeatHorizontal + protected + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticRepeatXUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + Repeat draw item &vertical displacement: + + + m_staticText12 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + "50" "25" + + 1 + + + 0 + wxID_ANY + + + m_choiceRepeatVertical + protected + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticRepeatYUnits + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Current &pin lenght: + + + m_staticText15 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_CurrentPinLenghtCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticText161 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Current pin name size: + + + m_CurrentPinNameSizeText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_CurrentPinNameSizeCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticText18 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Current pin number size: + + + m_CurrentPinNumberSizeText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_CurrentPinNumberSizeCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + mils + + + m_staticText20 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + &Repeat pin number increment: + + + m_staticText16 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + 1 + 10 + + 0 + + m_spinRepeatLabel + protected + + + wxSP_ARROW_KEYS|wxSP_WRAP + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + + 0 + protected + 0 + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline1 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + + bSizerBttons + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Save as Default + + + m_buttonSave + protected + + + + + + + + + OnSaveSetupClick + @@ -1513,7 +1565,7 @@ 0 - wxALL|wxEXPAND + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL 0 0 @@ -1528,11 +1580,11 @@ m_sdbSizer1 protected - + OnCancelClick - + OnOkClick diff --git a/eeschema/dialog_libedit_dimensions_base.h b/eeschema/dialog_libedit_dimensions_base.h index d8acc598a2..32b32c1df3 100644 --- a/eeschema/dialog_libedit_dimensions_base.h +++ b/eeschema/dialog_libedit_dimensions_base.h @@ -31,7 +31,14 @@ /////////////////////////////////////////////////////////////////////////////// class DIALOG_LIBEDIT_DIMENSIONS_BASE : public wxDialog { + DECLARE_EVENT_TABLE() private: + + // Private event handlers + void _wxFB_OnSaveSetupClick( wxCommandEvent& event ){ OnSaveSetupClick( event ); } + void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } + void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); } + protected: wxStaticText* m_staticText3; @@ -62,12 +69,19 @@ class DIALOG_LIBEDIT_DIMENSIONS_BASE : public wxDialog wxSpinCtrl* m_spinRepeatLabel; wxStaticLine* m_staticline1; + wxButton* m_buttonSave; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnSaveSetupClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } + public: - DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 412,358 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_LIBEDIT_DIMENSIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 412,349 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_LIBEDIT_DIMENSIONS_BASE(); }; diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index a925f2a298..48ca40fb75 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -70,13 +70,6 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ) /* this item is depending on a sheet, and is not in global list */ wxMessageBox( wxT( "DeleteItemsInList() err: unexpected \ DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) ); -#if 0 - SCH_SHEET_PIN* pinlabel = (SCH_SHEET_PIN*) item; - frame->DeleteSheetLabel( false, pinlabel->m_Parent ); - itemWrapper.m_PickedItem = pinlabel->m_Parent; - itemWrapper.m_UndoRedoStatus = UR_CHANGED; - itemsList.PushItem( itemWrapper ); -#endif } else { diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index 634097706a..953d8ad950 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -180,6 +180,36 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage ) } +/** function CloneStruct + * must be used only in undo/redo functions + * + * Routine to create a new copy of given schùatic object. + * It does the same job as DuplicateStruct, but + * but clone time stamp and sheet name when cloning a SCH_SHEET objects + * (because time stamp and sheets name must be unique + * DuplicateStruct does not copy these members + */ +static SCH_ITEM* CloneStruct( SCH_ITEM* aDrawStruct ) +{ + SCH_ITEM* item = DuplicateStruct( aDrawStruct ); + if( item == NULL ) + return NULL; + + item->m_TimeStamp = aDrawStruct->m_TimeStamp; + switch( item->Type() ) + { + case DRAW_SHEET_STRUCT_TYPE: + ((SCH_SHEET*)item)->m_SheetName = ((SCH_SHEET*)aDrawStruct)->m_SheetName; + break; + + default: + break; + } + + return item; +} + + /** function SaveCopyInUndoList * Create a copy of the current schematic item, and put it in the undo list. * @@ -230,7 +260,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem, switch( aCommandType ) { case UR_CHANGED: /* Create a copy of item */ - CopyOfItem = DuplicateStruct( aItem ); + CopyOfItem = CloneStruct( aItem ); itemWrapper.m_Link = CopyOfItem; if ( CopyOfItem ) commandToUndo->PushItem( itemWrapper ); @@ -300,7 +330,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, * If this link is not null, the copy is already done */ if( commandToUndo->GetPickedItemLink(ii) == NULL ) - commandToUndo->SetPickedItemLink( DuplicateStruct( item ), ii ); + commandToUndo->SetPickedItemLink( CloneStruct( item ), ii ); wxASSERT( commandToUndo->GetPickedItemLink(ii) ); break; diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 2749e38dc4..b79f6a5f27 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -138,7 +138,7 @@ structures and cannot be undone.\nOk to continue renaming?" ); /* Move selected sheet with the cursor. * Callback function use by ManageCurseur. */ -static void MoveSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase ) +static void MoveOrResizeSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase ) { wxPoint moveVector; SCH_SHEET_PIN* sheetLabel; @@ -185,20 +185,11 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC ) RedrawOneStruct( aPanel, aDC, sheet, g_XorMode ); SAFE_DELETE( sheet ); } - else if( sheet->m_Flags & IS_RESIZED ) - { - /* Resize in progress, cancel move. */ - RedrawOneStruct( aPanel, aDC, sheet, g_XorMode ); - sheet->m_Size.x = s_OldPos.x; - sheet->m_Size.y = s_OldPos.y; - RedrawOneStruct( aPanel, aDC, sheet, GR_DEFAULT_DRAWMODE ); - sheet->m_Flags = 0; - } - else if( sheet->m_Flags & IS_MOVED ) + else if( (sheet->m_Flags & (IS_RESIZED|IS_MOVED)) ) { wxPoint curspos = screen->m_Curseur; aPanel->GetScreen()->m_Curseur = s_OldPos; - MoveSheet( aPanel, aDC, true ); + MoveOrResizeSheet( aPanel, aDC, true ); RedrawOneStruct( aPanel, aDC, sheet, GR_DEFAULT_DRAWMODE ); sheet->m_Flags = 0; screen->m_Curseur = curspos; @@ -237,7 +228,7 @@ SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC ) // a sheet to a screen that already has multiple instances (!) GetScreen()->SetCurItem( sheet ); - DrawPanel->ManageCurseur = MoveSheet; + DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ManageCurseur( DrawPanel, aDC, false ); @@ -263,8 +254,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) OnModify( ); aSheet->m_Flags |= IS_RESIZED; - s_OldPos.x = aSheet->m_Size.x; - s_OldPos.y = aSheet->m_Size.y; + s_OldPos = aSheet->m_Pos + aSheet->m_Size; s_PreviousSheetWidth = SHEET_MIN_WIDTH; s_PreviousSheetHeight = SHEET_MIN_HEIGHT; @@ -280,7 +270,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) sheetLabel = sheetLabel->Next(); } - DrawPanel->ManageCurseur = MoveSheet; + DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ManageCurseur( DrawPanel, aDC, true ); } @@ -297,7 +287,7 @@ void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) s_OldPos = aSheet->m_Pos; aSheet->m_Flags |= IS_MOVED; - DrawPanel->ManageCurseur = MoveSheet; + DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ManageCurseur( DrawPanel, aDC, true ); DrawPanel->CursorOn( aDC ); diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index a1ba069123..12632f8f11 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -19,6 +19,8 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static int s_CurrentTypeLabel = NET_INPUT; static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT ); +static wxPoint s_InitialPosition; // remember here the initial value of the pin label when moving it + /****************************************/ /* class WinEDA_PinSheetPropertiesFrame */ @@ -126,7 +128,9 @@ void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event ) EndModal( wxID_OK ); } - +/* Called when aborting a move pinsheet label + * delete a new pin sheet label, or restire its old position + */ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) { SCH_SHEET_PIN* SheetLabel = @@ -142,6 +146,15 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) } else { + RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode ); + SheetLabel->m_Pos = s_InitialPosition; + // Restore edge position: + SCH_SHEET* sheet = (SCH_SHEET*) SheetLabel->GetParent(); + if( s_InitialPosition.x > ( sheet->m_Pos.x + (sheet->m_Size.x / 2) ) ) + SheetLabel->m_Edge = 1; + else + SheetLabel->m_Edge = 0; + RedrawOneStruct( Panel, DC, SheetLabel, GR_DEFAULT_DRAWMODE ); SheetLabel->m_Flags = 0; } @@ -204,6 +217,7 @@ void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, NetSheetTextSize = SheetLabel->m_Size; s_CurrentTypeLabel = SheetLabel->m_Shape; SheetLabel->m_Flags |= IS_MOVED; + s_InitialPosition = SheetLabel->m_Pos; DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->ForceCloseManageCurseur = ExitPinSheet;