diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 6185496927..cabd026ef7 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -55,10 +55,11 @@ private: void OnApplyClick( wxCommandEvent& event ) override; // User functions: - bool GetLevel(); bool GetResetItems(); bool GetLockUnits(); + ANNOTATE_SCOPE_T GetScope(); + ANNOTATE_ORDER_T GetSortOrder(); ANNOTATE_ALGO_T GetAnnotateAlgo(); @@ -172,8 +173,8 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) REPORTER& reporter = m_MessageWindow->Reporter(); m_MessageWindow->SetLazyUpdate( true ); // Don't update after each message - m_Parent->AnnotateSymbols( GetLevel(), GetSortOrder(), GetAnnotateAlgo(), GetStartNumber(), - GetResetItems(), true, GetLockUnits(), reporter ); + m_Parent->AnnotateSymbols( GetScope() == ANNOTATE_ALL, GetSortOrder(), GetAnnotateAlgo(), + GetStartNumber(), GetResetItems(), true, GetLockUnits(), reporter ); m_MessageWindow->Flush( true ); // Now update to show all messages @@ -199,7 +200,7 @@ void DIALOG_ANNOTATE::OnClearAnnotationClick( wxCommandEvent& event ) { bool appendUndo = false; - m_Parent->DeleteAnnotation( !GetLevel(), &appendUndo ); + m_Parent->DeleteAnnotation( GetScope() == ANNOTATE_CURRENT_SHEET, &appendUndo ); m_btnClear->Enable( false ); } @@ -211,12 +212,6 @@ void DIALOG_ANNOTATE::OnOptionChanged( wxCommandEvent& event ) } -bool DIALOG_ANNOTATE::GetLevel() -{ - return m_rbScope->GetSelection() == 0; -} - - bool DIALOG_ANNOTATE::GetResetItems() { return m_rbOptions->GetSelection() >= 1; @@ -229,6 +224,18 @@ bool DIALOG_ANNOTATE::GetLockUnits() } +ANNOTATE_SCOPE_T DIALOG_ANNOTATE::GetScope() +{ + switch( m_rbScope->GetSelection() ) + { + case 0: return ANNOTATE_ALL; + case 1: return ANNOTATE_CURRENT_SHEET; + case 2: return ANNOTATE_SELECTION; + default: return ANNOTATE_ALL; + } +} + + ANNOTATE_ORDER_T DIALOG_ANNOTATE::GetSortOrder() { if( m_rbSortBy_Y_Position->GetValue() ) diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index faa4461f6a..0bb55b4d44 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_base.cpp @@ -36,7 +36,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - wxString m_rbScopeChoices[] = { _("Entire schematic"), _("Current sheet only") }; + wxString m_rbScopeChoices[] = { _("Entire schematic"), _("Current sheet only"), _("Selection only") }; int m_rbScopeNChoices = sizeof( m_rbScopeChoices ) / sizeof( wxString ); m_rbScope = new wxRadioBox( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, m_rbScopeNChoices, m_rbScopeChoices, 1, wxRA_SPECIFY_COLS ); m_rbScope->SetSelection( 1 ); @@ -49,7 +49,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con bSizerXpos = new wxBoxSizer( wxHORIZONTAL ); m_rbSortBy_X_Position = new wxRadioButton( sbSizer1->GetStaticBox(), ID_SORT_BY_X_POSITION, _("Sort components by &X position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxBOTTOM|wxTOP, 3 ); + bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxALIGN_CENTER_VERTICAL, 3 ); bSizerXpos->Add( 0, 0, 1, 0, 5 ); @@ -60,11 +60,14 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con sbSizer1->Add( bSizerXpos, 0, wxEXPAND, 5 ); + + sbSizer1->Add( 0, 5, 0, wxEXPAND, 5 ); + wxBoxSizer* bSizerYpos; bSizerYpos = new wxBoxSizer( wxHORIZONTAL ); m_rbSortBy_Y_Position = new wxRadioButton( sbSizer1->GetStaticBox(), ID_SORT_BY_Y_POSITION, _("Sort components by &Y position"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerYpos->Add( m_rbSortBy_Y_Position, 0, wxBOTTOM|wxTOP, 3 ); + bSizerYpos->Add( m_rbSortBy_Y_Position, 0, wxALIGN_CENTER_VERTICAL, 3 ); bSizerYpos->Add( 0, 0, 1, 0, 5 ); diff --git a/eeschema/dialogs/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp index 0ef87ee6a0..4a4859bf9f 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -162,7 +162,7 @@ 1 0 - "Entire schematic" "Current sheet only" + "Entire schematic" "Current sheet only" "Selection only" 1 1 @@ -234,7 +234,7 @@ none 3 - wxBOTTOM|wxTOP + wxALIGN_CENTER_VERTICAL 0 1 @@ -367,6 +367,16 @@ + + 5 + wxEXPAND + 0 + + 5 + protected + 0 + + 5 wxEXPAND @@ -378,7 +388,7 @@ none 3 - wxBOTTOM|wxTOP + wxALIGN_CENTER_VERTICAL 0 1 diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index b96ff74f79..5e974a6e67 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -79,6 +79,15 @@ enum COMPONENT_ORIENTATION_T }; +/** Schematic annotation scope options. */ +enum ANNOTATE_SCOPE_T +{ + ANNOTATE_ALL, + ANNOTATE_CURRENT_SHEET, + ANNOTATE_SELECTION +}; + + /** Schematic annotation order options. */ enum ANNOTATE_ORDER_T {