Symbol Fields Table: scope control for limited view of symbols
This commit is contained in:
parent
6ae8968a5b
commit
fe32492252
|
@ -264,9 +264,8 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
ApplyBomFmtPreset( m_schSettings.m_BomFmtSettings );
|
||||
syncBomFmtPresetSelection();
|
||||
|
||||
m_grid->SelectRow( 0 );
|
||||
m_grid->SetGridCursor( 0, 1 );
|
||||
SetInitialFocus( m_grid );
|
||||
m_grid->ClearSelection();
|
||||
|
||||
SetupStandardButtons();
|
||||
|
||||
|
@ -281,6 +280,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
|
||||
m_nbPages->SetSelection( cfg->m_FieldEditorPanel.page );
|
||||
m_radioSelect->SetSelection( cfg->m_FieldEditorPanel.selection_mode );
|
||||
m_radioScope->SetSelection( cfg->m_FieldEditorPanel.scope );
|
||||
|
||||
m_outputFileName->SetValue( cfg->m_FieldEditorPanel.export_filename );
|
||||
|
||||
|
@ -423,6 +423,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::~DIALOG_SYMBOL_FIELDS_TABLE()
|
|||
cfg->m_FieldEditorPanel.page = m_nbPages->GetSelection();
|
||||
cfg->m_FieldEditorPanel.export_filename = m_outputFileName->GetValue();
|
||||
cfg->m_FieldEditorPanel.selection_mode = m_radioSelect->GetSelection();
|
||||
cfg->m_FieldEditorPanel.scope = m_radioScope->GetSelection();
|
||||
|
||||
|
||||
for( int i = 0; i < m_grid->GetNumberCols(); i++ )
|
||||
|
@ -493,6 +494,8 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow()
|
|||
}
|
||||
}
|
||||
|
||||
UpdateScope();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -961,6 +964,17 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRegroupSymbols( wxCommandEvent& aEvent )
|
|||
m_grid->ForceRefresh();
|
||||
}
|
||||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnScopeChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
UpdateScope();
|
||||
}
|
||||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::UpdateScope()
|
||||
{
|
||||
m_dataModel->SetPath( m_parent->GetCurrentSheet() );
|
||||
m_dataModel->SetScope( (FIELDS_EDITOR_GRID_DATA_MODEL::SCOPE) m_radioScope->GetSelection() );
|
||||
m_dataModel->RebuildRows();
|
||||
}
|
||||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick( wxGridEvent& event )
|
||||
{
|
||||
|
|
|
@ -67,6 +67,8 @@ private:
|
|||
void OnGroupSymbolsToggled( wxCommandEvent& event ) override;
|
||||
void OnExcludeDNPToggled( wxCommandEvent& event ) override;
|
||||
void OnRegroupSymbols( wxCommandEvent& aEvent ) override;
|
||||
void OnScopeChanged( wxCommandEvent& aEvent ) override;
|
||||
void UpdateScope();
|
||||
void OnTableValueChanged( wxGridEvent& event ) override;
|
||||
void OnTableCellClick( wxGridEvent& event ) override;
|
||||
void OnTableItemContextMenu( wxGridEvent& event ) override;
|
||||
|
|
|
@ -128,6 +128,12 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_radioSelect->SetSelection( 0 );
|
||||
bControls1->Add( m_radioSelect, 0, wxALL, 5 );
|
||||
|
||||
wxString m_radioScopeChoices[] = { _("Entire Project"), _("Current sheet only"), _("Recursive") };
|
||||
int m_radioScopeNChoices = sizeof( m_radioScopeChoices ) / sizeof( wxString );
|
||||
m_radioScope = new wxRadioBox( m_rightPanel, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, m_radioScopeNChoices, m_radioScopeChoices, 3, wxRA_SPECIFY_COLS );
|
||||
m_radioScope->SetSelection( 0 );
|
||||
bControls1->Add( m_radioScope, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bRightSizer->Add( bControls1, 0, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
@ -336,6 +342,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_checkExcludeDNP->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExcludeDNPToggled ), NULL, this );
|
||||
m_groupSymbolsBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnGroupSymbolsToggled ), NULL, this );
|
||||
m_bRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnRegroupSymbols ), NULL, this );
|
||||
m_radioScope->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnScopeChanged ), NULL, this );
|
||||
m_grid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableValueChanged ), NULL, this );
|
||||
m_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableCellClick ), NULL, this );
|
||||
m_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableCellClick ), NULL, this );
|
||||
|
@ -370,6 +377,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::~DIALOG_SYMBOL_FIELDS_TABLE_BASE()
|
|||
m_checkExcludeDNP->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExcludeDNPToggled ), NULL, this );
|
||||
m_groupSymbolsBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnGroupSymbolsToggled ), NULL, this );
|
||||
m_bRefresh->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnRegroupSymbols ), NULL, this );
|
||||
m_radioScope->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnScopeChanged ), NULL, this );
|
||||
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableValueChanged ), NULL, this );
|
||||
m_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableCellClick ), NULL, this );
|
||||
m_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableCellClick ), NULL, this );
|
||||
|
|
|
@ -1333,6 +1333,73 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Entire Project" "Current sheet only" "Recursive"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Scope</property>
|
||||
<property name="majorDimension">3</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_radioScope</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnRadioBox">OnScopeChanged</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
|
|
|
@ -70,6 +70,7 @@ class DIALOG_SYMBOL_FIELDS_TABLE_BASE : public DIALOG_SHIM
|
|||
BITMAP_BUTTON* m_separator3;
|
||||
wxBitmapButton* m_bRefresh;
|
||||
wxRadioBox* m_radioSelect;
|
||||
wxRadioBox* m_radioScope;
|
||||
WX_GRID* m_grid;
|
||||
wxPanel* m_panelExport;
|
||||
wxStaticText* m_labelBomExportPresets;
|
||||
|
@ -112,6 +113,7 @@ class DIALOG_SYMBOL_FIELDS_TABLE_BASE : public DIALOG_SHIM
|
|||
virtual void OnExcludeDNPToggled( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnGroupSymbolsToggled( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRegroupSymbols( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnScopeChanged( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTableValueChanged( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void OnTableCellClick( wxGridEvent& event ) { event.Skip(); }
|
||||
virtual void OnTableItemContextMenu( wxGridEvent& event ) { event.Skip(); }
|
||||
|
|
|
@ -462,6 +462,8 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<int>( "field_editor.selection_mode",
|
||||
&m_FieldEditorPanel.selection_mode, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "field_editor.scope", &m_FieldEditorPanel.scope, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "plot.background_color",
|
||||
&m_PlotPanel.background_color, false ) );
|
||||
|
||||
|
|
|
@ -221,6 +221,7 @@ public:
|
|||
int page;
|
||||
wxString export_filename;
|
||||
int selection_mode;
|
||||
int scope;
|
||||
};
|
||||
|
||||
struct PANEL_LIB_VIEW
|
||||
|
|
|
@ -492,6 +492,15 @@ void FIELDS_EDITOR_GRID_DATA_MODEL::RebuildRows()
|
|||
if( !m_includeExcluded && ref.GetSymbol()->GetExcludedFromBOM() )
|
||||
continue;
|
||||
|
||||
// Check if the symbol if on the current sheet or, in the sheet path somewhere
|
||||
// depending on scope
|
||||
if( ( m_scope == SCOPE::SCOPE_SHEET && ref.GetSheetPath() != m_path )
|
||||
|| ( m_scope == SCOPE::SCOPE_SHEET_RECURSIVE
|
||||
&& !ref.GetSheetPath().IsContainedWithin( m_path ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool matchFound = false;
|
||||
|
||||
// Performance optimization for ungrouped case to skip the N^2 for loop
|
||||
|
|
|
@ -51,10 +51,17 @@ struct DATA_MODEL_COL
|
|||
class FIELDS_EDITOR_GRID_DATA_MODEL : public wxGridTableBase
|
||||
{
|
||||
public:
|
||||
enum SCOPE : int
|
||||
{
|
||||
SCOPE_ALL = 0,
|
||||
SCOPE_SHEET = 1,
|
||||
SCOPE_SHEET_RECURSIVE = 2
|
||||
};
|
||||
|
||||
FIELDS_EDITOR_GRID_DATA_MODEL( SCH_REFERENCE_LIST& aSymbolsList ) :
|
||||
m_symbolsList( aSymbolsList ), m_edited( false ), m_sortColumn( 0 ),
|
||||
m_sortAscending( false ), m_groupingEnabled( false ), m_excludeDNP( false ),
|
||||
m_includeExcluded( false ), m_rebuildsEnabled( true )
|
||||
m_sortAscending( false ), m_scope( SCOPE_ALL ), m_groupingEnabled( false ),
|
||||
m_excludeDNP( false ), m_includeExcluded( false ), m_rebuildsEnabled( true )
|
||||
{
|
||||
m_symbolsList.SplitReferences();
|
||||
}
|
||||
|
@ -158,6 +165,12 @@ public:
|
|||
void SetFilter( const wxString& aFilter ) { m_filter = aFilter; }
|
||||
const wxString& GetFilter() { return m_filter; }
|
||||
|
||||
void SetScope( SCOPE aScope ) { m_scope = aScope; }
|
||||
SCOPE GetScope() { return m_scope; }
|
||||
|
||||
void SetPath( const SCH_SHEET_PATH& aPath ) { m_path = aPath; }
|
||||
const SCH_SHEET_PATH& GetPath() { return m_path; }
|
||||
|
||||
void SetGroupingEnabled( bool group ) { m_groupingEnabled = group; }
|
||||
bool GetGroupingEnabled() { return m_groupingEnabled; }
|
||||
|
||||
|
@ -225,6 +238,8 @@ protected:
|
|||
int m_sortColumn;
|
||||
bool m_sortAscending;
|
||||
wxString m_filter;
|
||||
enum SCOPE m_scope;
|
||||
SCH_SHEET_PATH m_path;
|
||||
bool m_groupingEnabled;
|
||||
bool m_excludeDNP;
|
||||
bool m_includeExcluded;
|
||||
|
|
Loading…
Reference in New Issue