Add Annotate Selection in prep for Roberto's fixes.

This commit is contained in:
Jeff Young 2021-04-26 17:27:22 +01:00
parent b65b1f8e9c
commit e06a3cf3b4
4 changed files with 45 additions and 16 deletions

View File

@ -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() )

View File

@ -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 );

View File

@ -162,7 +162,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Entire schematic&quot; &quot;Current sheet only&quot;</property>
<property name="choices">&quot;Entire schematic&quot; &quot;Current sheet only&quot; &quot;Selection only&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -234,7 +234,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -367,6 +367,16 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">5</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@ -378,7 +388,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>

View File

@ -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
{