ADDED: Selection filter for schematic editor

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14988
This commit is contained in:
Jon Evans 2024-02-25 17:39:14 -05:00
parent 11774cc9fe
commit 2f6c9d1f3a
35 changed files with 1645 additions and 57 deletions

View File

@ -41,7 +41,7 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
m_PadOpacity( 1.0 ),
m_ZoneOpacity( 0.6 ),
m_ImageOpacity( 0.6 ),
m_SelectionFilter(),
m_PcbSelectionFilter(),
m_project( aProject )
{
// Keep old files around
@ -99,17 +99,17 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
{
nlohmann::json ret;
ret["lockedItems"] = m_SelectionFilter.lockedItems;
ret["footprints"] = m_SelectionFilter.footprints;
ret["text"] = m_SelectionFilter.text;
ret["tracks"] = m_SelectionFilter.tracks;
ret["vias"] = m_SelectionFilter.vias;
ret["pads"] = m_SelectionFilter.pads;
ret["graphics"] = m_SelectionFilter.graphics;
ret["zones"] = m_SelectionFilter.zones;
ret["keepouts"] = m_SelectionFilter.keepouts;
ret["dimensions"] = m_SelectionFilter.dimensions;
ret["otherItems"] = m_SelectionFilter.otherItems;
ret["lockedItems"] = m_PcbSelectionFilter.lockedItems;
ret["footprints"] = m_PcbSelectionFilter.footprints;
ret["text"] = m_PcbSelectionFilter.text;
ret["tracks"] = m_PcbSelectionFilter.tracks;
ret["vias"] = m_PcbSelectionFilter.vias;
ret["pads"] = m_PcbSelectionFilter.pads;
ret["graphics"] = m_PcbSelectionFilter.graphics;
ret["zones"] = m_PcbSelectionFilter.zones;
ret["keepouts"] = m_PcbSelectionFilter.keepouts;
ret["dimensions"] = m_PcbSelectionFilter.dimensions;
ret["otherItems"] = m_PcbSelectionFilter.otherItems;
return ret;
},
@ -118,17 +118,17 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
if( aVal.empty() || !aVal.is_object() )
return;
SetIfPresent( aVal, "lockedItems", m_SelectionFilter.lockedItems );
SetIfPresent( aVal, "footprints", m_SelectionFilter.footprints );
SetIfPresent( aVal, "text", m_SelectionFilter.text );
SetIfPresent( aVal, "tracks", m_SelectionFilter.tracks );
SetIfPresent( aVal, "vias", m_SelectionFilter.vias );
SetIfPresent( aVal, "pads", m_SelectionFilter.pads );
SetIfPresent( aVal, "graphics", m_SelectionFilter.graphics );
SetIfPresent( aVal, "zones", m_SelectionFilter.zones );
SetIfPresent( aVal, "keepouts", m_SelectionFilter.keepouts );
SetIfPresent( aVal, "dimensions", m_SelectionFilter.dimensions );
SetIfPresent( aVal, "otherItems", m_SelectionFilter.otherItems );
SetIfPresent( aVal, "lockedItems", m_PcbSelectionFilter.lockedItems );
SetIfPresent( aVal, "footprints", m_PcbSelectionFilter.footprints );
SetIfPresent( aVal, "text", m_PcbSelectionFilter.text );
SetIfPresent( aVal, "tracks", m_PcbSelectionFilter.tracks );
SetIfPresent( aVal, "vias", m_PcbSelectionFilter.vias );
SetIfPresent( aVal, "pads", m_PcbSelectionFilter.pads );
SetIfPresent( aVal, "graphics", m_PcbSelectionFilter.graphics );
SetIfPresent( aVal, "zones", m_PcbSelectionFilter.zones );
SetIfPresent( aVal, "keepouts", m_PcbSelectionFilter.keepouts );
SetIfPresent( aVal, "dimensions", m_PcbSelectionFilter.dimensions );
SetIfPresent( aVal, "otherItems", m_PcbSelectionFilter.otherItems );
},
{
{ "lockedItems", false },
@ -251,6 +251,50 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
{
} ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "schematic.selection_filter",
[&]() -> nlohmann::json
{
nlohmann::json ret;
ret["lockedItems"] = m_SchSelectionFilter.lockedItems;
ret["symbols"] = m_SchSelectionFilter.symbols;
ret["text"] = m_SchSelectionFilter.text;
ret["wires"] = m_SchSelectionFilter.wires;
ret["labels"] = m_SchSelectionFilter.labels;
ret["pins"] = m_SchSelectionFilter.pins;
ret["graphics"] = m_SchSelectionFilter.graphics;
ret["images"] = m_SchSelectionFilter.images;
ret["otherItems"] = m_SchSelectionFilter.otherItems;
return ret;
},
[&]( const nlohmann::json& aVal )
{
if( aVal.empty() || !aVal.is_object() )
return;
SetIfPresent( aVal, "lockedItems", m_SchSelectionFilter.lockedItems );
SetIfPresent( aVal, "symbols", m_SchSelectionFilter.symbols );
SetIfPresent( aVal, "text", m_SchSelectionFilter.text );
SetIfPresent( aVal, "wires", m_SchSelectionFilter.wires );
SetIfPresent( aVal, "labels", m_SchSelectionFilter.labels );
SetIfPresent( aVal, "pins", m_SchSelectionFilter.pins );
SetIfPresent( aVal, "graphics", m_SchSelectionFilter.graphics );
SetIfPresent( aVal, "images", m_SchSelectionFilter.images );
SetIfPresent( aVal, "otherItems", m_SchSelectionFilter.otherItems );
},
{
{ "lockedItems", false },
{ "symbols", true },
{ "text", true },
{ "wires", true },
{ "labels", true },
{ "pins", true },
{ "graphics", true },
{ "images", true },
{ "otherItems", true }
} ) );
registerMigration( 1, 2,
[&]()
{

View File

@ -278,6 +278,8 @@ set( EESCHEMA_SIM_SRCS
set( EESCHEMA_WIDGETS
widgets/hierarchy_pane.cpp
widgets/panel_sch_selection_filter_base.cpp
widgets/panel_sch_selection_filter.cpp
widgets/panel_symbol_chooser.cpp
widgets/pin_shape_combobox.cpp
widgets/pin_type_combobox.cpp

View File

@ -28,12 +28,14 @@
#include <dialogs/panel_gal_display_options.h>
#include <pgm_base.h>
#include <project/project_file.h>
#include <project/project_local_settings.h>
#include <project/net_settings.h>
#include <sch_edit_frame.h>
#include <sch_painter.h>
#include <schematic.h>
#include <widgets/hierarchy_pane.h>
#include <widgets/sch_search_pane.h>
#include <widgets/panel_sch_selection_filter.h>
#include <widgets/properties_panel.h>
#include <settings/app_settings.h>
#include <settings/settings_manager.h>
@ -41,6 +43,8 @@
#include <drawing_sheet/ds_data_model.h>
#include <zoom_defines.h>
#include <sim/spice_settings.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
/// Helper for all the old plotting/printing code while it still exists
@ -73,6 +77,12 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
ShowInfoBarError( _( "Error loading drawing sheet." ), true );
PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
selTool->GetFilter() = localSettings.m_SchSelectionFilter;
m_selectionFilterPanel->SetCheckboxesFromFilter( localSettings.m_SchSelectionFilter );
return true;
}
@ -188,6 +198,11 @@ void SCH_EDIT_FRAME::SaveProjectLocalSettings()
{
if( m_schematic )
m_schematic->RecordERCExclusions();
PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
localSettings.m_SchSelectionFilter = selTool->GetFilter();
}

View File

@ -70,7 +70,7 @@ const wxAuiPaneInfo& defaultNetNavigatorPaneInfo()
.Caption( _( "Net Navigator" ) )
.CaptionVisible( true )
.PaneBorder( true )
.Left().Layer( 3 )
.Left().Layer( 3 ).Position( 1 )
.TopDockable( false )
.BottomDockable( false )
.CloseButton( true )
@ -92,7 +92,7 @@ const wxAuiPaneInfo& defaultPropertiesPaneInfo( wxWindow* aWindow )
.Caption( _( "Properties" ) )
.CaptionVisible( true )
.PaneBorder( true )
.Left().Layer( 3 )
.Left().Layer( 3 ).Position( 2 )
.TopDockable( false )
.BottomDockable( false )
.CloseButton( true )
@ -106,6 +106,26 @@ const wxAuiPaneInfo& defaultPropertiesPaneInfo( wxWindow* aWindow )
}
const wxAuiPaneInfo& defaultSchSelectionFilterPaneInfo( wxWindow* aWindow )
{
static wxAuiPaneInfo paneInfo;
paneInfo.Name( wxS( "SelectionFilter" ) )
.Caption( _( "Selection Filter" ) )
.CaptionVisible( true )
.PaneBorder( false )
.Left().Layer( 3 ).Position( 3 )
.TopDockable( false )
.BottomDockable( false )
.CloseButton( false )
.MinSize( aWindow->FromDIP( wxSize( 180, -1 ) ) )
.BestSize( aWindow->FromDIP( wxSize( 180, -1 ) ) )
.Show( true );
return paneInfo;
}
EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
APP_SETTINGS_BASE( "eeschema", eeschemaSchemaVersion ),
m_Appearance(),

View File

@ -34,6 +34,7 @@ using KIGFX::COLOR4D;
extern const wxAuiPaneInfo& defaultNetNavigatorPaneInfo();
extern const wxAuiPaneInfo& defaultPropertiesPaneInfo( wxWindow* aWindow );
extern const wxAuiPaneInfo& defaultSchSelectionFilterPaneInfo( wxWindow* aWindow );

View File

@ -161,7 +161,10 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( differentProject )
{
if( !Prj().IsNullProject() )
{
SaveProjectLocalSettings();
GetSettingsManager()->SaveProject();
}
Schematic().SetProject( nullptr );
GetSettingsManager()->UnloadProject( &Prj(), false );
@ -1257,6 +1260,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
else
{
saveProjectSettings();
SaveProjectLocalSettings();
}
if( !Kiface().IsSingle() )

View File

@ -411,6 +411,7 @@ void SCH_EDIT_FRAME::ToggleNetNavigator()
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
netNavigatorPane.Show( !netNavigatorPane.IsShown() );
updateSelectionFilterVisbility();
cfg->m_AuiPanels.show_net_nav_panel = netNavigatorPane.IsShown();

View File

@ -92,7 +92,9 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
aFrameName, schIUScale ),
m_base_frame_defaults( nullptr, "base_Frame_defaults" ), m_spaceMouse( nullptr )
m_base_frame_defaults( nullptr, "base_Frame_defaults" ),
m_selectionFilterPanel( nullptr ),
m_spaceMouse( nullptr )
{
if( ( aStyle & wxFRAME_NO_TASKBAR ) == 0 )
createCanvas();

View File

@ -61,6 +61,7 @@ class SYMBOL_LIB_TABLE;
class EESCHEMA_SETTINGS;
class SYMBOL_EDITOR_SETTINGS;
class NL_SCHEMATIC_PLUGIN;
class PANEL_SCH_SELECTION_FILTER;
/**
* Load symbol from symbol library table.
@ -273,10 +274,18 @@ protected:
*/
void setSymWatcher( const LIB_ID* aSymbol );
/**
* Selection filter panel doesn't have a dedicated visibility control, so show it if any
* other AUI panel is shown and docked
*/
virtual void updateSelectionFilterVisbility() {}
/// These are only used by symbol_editor. Eeschema should be using the one inside
/// the SCHEMATIC.
SCHEMATIC_SETTINGS m_base_frame_defaults;
PANEL_SCH_SELECTION_FILTER* m_selectionFilterPanel;
private:
/// These are file watchers for the symbol library tables.

View File

@ -93,6 +93,7 @@
#include <wx/app.h>
#include <wx/filedlg.h>
#include <wx/socket.h>
#include <widgets/panel_sch_selection_filter.h>
#include <widgets/wx_aui_utils.h>
#include <drawing_sheet/ds_proxy_view_item.h>
@ -189,6 +190,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_propertiesPanel->SetSplitterProportion( eeconfig()->m_AuiPanels.properties_splitter );
m_selectionFilterPanel = new PANEL_SCH_SELECTION_FILTER( this );
m_auimgr.SetManagedWindow( this );
CreateInfoBar();
@ -214,6 +217,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
.Show( false ) );
m_auimgr.AddPane( m_propertiesPanel, defaultPropertiesPaneInfo( this ) );
m_auimgr.AddPane( m_selectionFilterPanel, defaultSchSelectionFilterPaneInfo( this ) );
m_auimgr.AddPane( createHighlightedNetNavigator(), defaultNetNavigatorPaneInfo() );
@ -249,14 +253,19 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
static_cast<KIGFX::SCH_PAINTER*>( view->GetPainter() )->SetSchematic( m_schematic );
wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
EESCHEMA_SETTINGS* cfg = eeconfig();
hierarchy_pane.Show( cfg->m_AuiPanels.show_schematic_hierarchy );
netNavigatorPane.Show( cfg->m_AuiPanels.show_net_nav_panel );
propertiesPane.Show( cfg->m_AuiPanels.show_properties );
updateSelectionFilterVisbility();
// The selection filter doesn't need to grow in the vertical direction when docked
selectionFilterPane.dock_proportion = 0;
if( cfg->m_AuiPanels.hierarchy_panel_float_width > 0
&& cfg->m_AuiPanels.hierarchy_panel_float_height > 0 )
@ -424,6 +433,7 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
}
delete m_hierarchy;
delete m_selectionFilterPanel;
}
@ -1013,6 +1023,9 @@ void SCH_EDIT_FRAME::doCloseWindow()
m_symbolFieldsTableDialog = nullptr;
}
// Make sure local settings are persisted
SaveProjectLocalSettings();
// Shutdown all running tools
if( m_toolManager )
{
@ -1058,9 +1071,6 @@ void SCH_EDIT_FRAME::doCloseWindow()
if( !Schematic().GetFileName().IsEmpty() && !Schematic().RootScreen()->IsEmpty() )
UpdateFileHistory( fileName );
// Make sure local settings are persisted
SaveProjectLocalSettings();
Schematic().RootScreen()->Clear();
// all sub sheets are deleted, only the main sheet is usable
@ -1954,10 +1964,13 @@ void SCH_EDIT_FRAME::ShowChangedLanguage()
RecreateToolbars();
m_auimgr.GetPane( m_hierarchy ).Caption( _( "Schematic Hierarchy" ) );
m_auimgr.GetPane( m_selectionFilterPanel ).Caption( _( "Selection Filter" ) );
m_auimgr.GetPane( m_propertiesPanel ).Caption( _( "Properties" ) );
m_auimgr.Update();
m_hierarchy->UpdateHierarchyTree();
m_propertiesPanel->LanguageChanged();
m_selectionFilterPanel->OnLanguageChanged();
// status bar
UpdateMsgPanel();
@ -2382,3 +2395,20 @@ void SCH_EDIT_FRAME::unitsChangeRefresh()
UpdateProperties();
}
void SCH_EDIT_FRAME::updateSelectionFilterVisbility()
{
wxAuiPaneInfo& hierarchyPane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
// Don't give the selection filter its own visibility controls; instead show it if
// anything else is visible
bool showFilter = ( hierarchyPane.IsShown() && hierarchyPane.IsDocked() )
|| ( netNavigatorPane.IsShown() && netNavigatorPane.IsDocked() )
|| ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
selectionFilterPane.Show( showFilter );
}

View File

@ -898,6 +898,8 @@ protected:
void unitsChangeRefresh() override;
void updateSelectionFilterVisbility() override;
private:
// Called when resizing the Hierarchy Navigator panel
void OnResizeHierarchyNavigator( wxSizeEvent& aEvent );

View File

@ -71,6 +71,7 @@
#include <widgets/wx_infobar.h>
#include <widgets/lib_tree.h>
#include <widgets/wx_progress_reporters.h>
#include <widgets/panel_sch_selection_filter.h>
#include <widgets/sch_properties_panel.h>
#include <widgets/symbol_tree_pane.h>
#include <widgets/wx_aui_utils.h>
@ -184,6 +185,8 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_propertiesPanel = new SCH_PROPERTIES_PANEL( this, this );
m_propertiesPanel->SetSplitterProportion( m_settings->m_AuiPanels.properties_splitter );
m_selectionFilterPanel = new PANEL_SCH_SELECTION_FILTER( this );
m_auimgr.SetManagedWindow( this );
CreateInfoBar();
@ -205,7 +208,15 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_propertiesPanel, defaultPropertiesPaneInfo( this ) );
// Show or hide m_propertiesPanel depending on current settings:
wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
m_auimgr.AddPane( m_selectionFilterPanel, defaultSchSelectionFilterPaneInfo( this ) );
wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
// The selection filter doesn't need to grow in the vertical direction when docked
selectionFilterPane.dock_proportion = 0;
propertiesPaneInfo.Show( m_settings->m_AuiPanels.show_properties );
updateSelectionFilterVisbility();
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
.Left().Layer( 2 ) );
@ -219,6 +230,10 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
FinishAUIInitialization();
// Can't put this in LoadSettings, because it has to be called before setupTools :/
EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
selTool->GetFilter() = GetSettings()->m_SelectionFilter;
if( m_settings->m_LibWidth > 0 )
SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "SymbolTree" ), m_settings->m_LibWidth, -1 );
@ -333,6 +348,9 @@ void SYMBOL_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
m_settings->m_AuiPanels.properties_splitter = m_propertiesPanel->SplitterProportion();
bool prop_shown = m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
m_settings->m_AuiPanels.show_properties = prop_shown;
EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
m_settings->m_SelectionFilter = selTool->GetFilter();
}
@ -681,6 +699,7 @@ void SYMBOL_EDIT_FRAME::OnToggleSymbolTree( wxCommandEvent& event )
{
wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
treePane.Show( !IsSymbolTreeShown() );
updateSelectionFilterVisbility();
m_auimgr.Update();
}
@ -1845,3 +1864,18 @@ void SYMBOL_EDIT_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aU
eda_text->ClearRenderCache();
}
}
void SYMBOL_EDIT_FRAME::updateSelectionFilterVisbility()
{
wxAuiPaneInfo& treePane = m_auimgr.GetPane( "SymbolTree" );
wxAuiPaneInfo& propertiesPane = m_auimgr.GetPane( PropertiesPaneName() );
wxAuiPaneInfo& selectionFilterPane = m_auimgr.GetPane( wxS( "SelectionFilter" ) );
// Don't give the selection filter its own visibility controls; instead show it if
// anything else is visible
bool showFilter = ( treePane.IsShown() && treePane.IsDocked() )
|| ( propertiesPane.IsShown() && propertiesPane.IsDocked() );
selectionFilterPane.Show( showFilter );
}

View File

@ -420,6 +420,8 @@ protected:
void doReCreateMenuBar() override;
void updateSelectionFilterVisbility() override;
private:
// Set up the tool framework
void setupTools();

View File

@ -21,6 +21,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <nlohmann/json.hpp>
#include <settings/common_settings.h>
#include <settings/parameters.h>
#include <settings/settings_manager.h>
@ -122,6 +124,50 @@ SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "use_eeschema_color_settings",
&m_UseEeschemaColorSettings, true ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "selection_filter",
[&]() -> nlohmann::json
{
nlohmann::json ret;
ret["lockedItems"] = m_SelectionFilter.lockedItems;
ret["symbols"] = m_SelectionFilter.symbols;
ret["text"] = m_SelectionFilter.text;
ret["wires"] = m_SelectionFilter.wires;
ret["labels"] = m_SelectionFilter.labels;
ret["pins"] = m_SelectionFilter.pins;
ret["graphics"] = m_SelectionFilter.graphics;
ret["images"] = m_SelectionFilter.images;
ret["otherItems"] = m_SelectionFilter.otherItems;
return ret;
},
[&]( const nlohmann::json& aVal )
{
if( aVal.empty() || !aVal.is_object() )
return;
SetIfPresent( aVal, "lockedItems", m_SelectionFilter.lockedItems );
SetIfPresent( aVal, "symbols", m_SelectionFilter.symbols );
SetIfPresent( aVal, "text", m_SelectionFilter.text );
SetIfPresent( aVal, "wires", m_SelectionFilter.wires );
SetIfPresent( aVal, "labels", m_SelectionFilter.labels );
SetIfPresent( aVal, "pins", m_SelectionFilter.pins );
SetIfPresent( aVal, "graphics", m_SelectionFilter.graphics );
SetIfPresent( aVal, "images", m_SelectionFilter.images );
SetIfPresent( aVal, "otherItems", m_SelectionFilter.otherItems );
},
{
{ "lockedItems", false },
{ "symbols", true },
{ "text", true },
{ "wires", true },
{ "labels", true },
{ "pins", true },
{ "graphics", true },
{ "images", true },
{ "otherItems", true }
} ) );
registerMigration( 0, 1,
[&]() -> bool
{

View File

@ -25,6 +25,7 @@
#define SYMBOL_EDITOR_SETTINGS_H
#include <settings/app_settings.h>
#include <project/sch_project_settings.h>
class SYMBOL_EDITOR_SETTINGS : public APP_SETTINGS_BASE
@ -93,6 +94,8 @@ public:
bool m_UseEeschemaColorSettings;
SCH_SELECTION_FILTER_OPTIONS m_SelectionFilter;
protected:
virtual std::string getLegacyFrameName() const override { return "LibeditFrame"; }

View File

@ -196,6 +196,7 @@ void SYMBOL_EDIT_FRAME::ToggleProperties()
wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
propertiesPaneInfo.Show( show );
updateSelectionFilterVisbility();
if( show )
{

View File

@ -280,6 +280,8 @@ void SCH_EDIT_FRAME::ToggleProperties()
wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
propertiesPaneInfo.Show( show );
updateSelectionFilterVisbility();
EESCHEMA_SETTINGS* settings = eeconfig();
if( show )
@ -305,6 +307,8 @@ void SCH_EDIT_FRAME::ToggleSchematicHierarchy()
hierarchy_pane.Show( !hierarchy_pane.IsShown() );
updateSelectionFilterVisbility();
if( hierarchy_pane.IsShown() )
{
if( hierarchy_pane.IsFloating() )

View File

@ -162,6 +162,7 @@ EE_SELECTION_TOOL::EE_SELECTION_TOOL() :
m_unit( 0 ),
m_bodyStyle( 0 )
{
m_filter.SetDefaults();
m_selection.Clear();
}
@ -1081,6 +1082,12 @@ void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I
continue;
}
if( !itemPassesFilter( collector[i] ) )
{
collector.Remove( i );
continue;
}
if( aSelectedOnly && !collector[i]->IsSelected() )
{
collector.Remove( i );
@ -1556,6 +1563,101 @@ EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const std::vector<KICAD_T>& a
}
bool EE_SELECTION_TOOL::itemPassesFilter( EDA_ITEM* aItem )
{
if( !aItem )
return false;
// Locking is not yet exposed uniformly in the schematic
#if 0
if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem ) )
{
if( schItem->IsLocked() && !m_filter.lockedItems )
return false;
}
#endif
switch( aItem->Type() )
{
case SCH_SYMBOL_T:
case SCH_SHEET_T:
if( !m_filter.symbols )
return false;
break;
case SCH_PIN_T:
case SCH_SHEET_PIN_T:
case LIB_PIN_T:
if( !m_filter.pins )
return false;
break;
case SCH_LINE_T:
{
switch( static_cast<SCH_LINE*>( aItem )->GetLayer() )
{
case LAYER_WIRE:
case LAYER_BUS:
if( !m_filter.wires )
return false;
break;
default:
if( !m_filter.graphics )
return false;
}
break;
}
case SCH_SHAPE_T:
case LIB_SHAPE_T:
if( !m_filter.graphics )
return false;
break;
case SCH_TEXT_T:
case SCH_TEXTBOX_T:
case SCH_TABLE_T:
case SCH_TABLECELL_T:
case SCH_FIELD_T:
case LIB_TEXT_T:
case LIB_TEXTBOX_T:
case LIB_FIELD_T:
if( !m_filter.text )
return false;
break;
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
if( !m_filter.labels )
return false;
break;
case SCH_BITMAP_T:
if( !m_filter.images )
return false;
break;
default:
if( !m_filter.otherItems )
return false;
break;
}
return true;
}
void EE_SELECTION_TOOL::updateReferencePoint()
{
VECTOR2I refP( 0, 0 );
@ -1722,7 +1824,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
if( m_frame->GetRenderSettings()->m_ShowPinsElectricalType )
item->SetFlags( SHOW_ELEC_TYPE );
if( Selectable( item ) )
if( Selectable( item ) && itemPassesFilter( item ) )
{
if( item->Type() == SCH_LINE_T )
{
@ -1774,6 +1876,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
item->SetFlags( SHOW_ELEC_TYPE );
if( Selectable( item )
&& itemPassesFilter( item )
&& !item->GetParent()->HasFlag( CANDIDATE )
&& item->HitTest( selectionRect, !isGreedy ) )
{

View File

@ -25,6 +25,7 @@
#ifndef KICAD_SCH_SELECTION_TOOL_H
#define KICAD_SCH_SELECTION_TOOL_H
#include <project/sch_project_settings.h>
#include <tool/selection_tool.h>
#include <tool/action_menu.h>
#include <tool/tool_menu.h>
@ -190,6 +191,8 @@ public:
void SyncSelection( const std::optional<SCH_SHEET_PATH>& targetSheetPath, SCH_ITEM* focusItem,
const std::vector<SCH_ITEM*>& items );
SCH_SELECTION_FILTER_OPTIONS& GetFilter() { return m_filter; }
protected:
SELECTION& selection() override { return m_selection; }
@ -288,6 +291,11 @@ private:
*/
bool selectionContains( const VECTOR2I& aPoint ) const;
/**
* Return true if the given item passes the stateful selection filter
*/
bool itemPassesFilter( EDA_ITEM* aItem );
///< Set up handlers for various events.
void setTransitions() override;
@ -302,6 +310,8 @@ private:
bool m_isSymbolViewer; // True when the symbol browser is the parent frame
int m_unit; // Fixed unit filter (for symbol editor)
int m_bodyStyle; // Fixed DeMorgan filter (for symbol editor)
SCH_SELECTION_FILTER_OPTIONS m_filter;
};
#endif //KICAD_SCH_SELECTION_TOOL_H

View File

@ -0,0 +1,204 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <project/sch_project_settings.h>
#include <sch_base_frame.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <widgets/panel_sch_selection_filter.h>
PANEL_SCH_SELECTION_FILTER::PANEL_SCH_SELECTION_FILTER( wxWindow* aParent ) :
PANEL_SCH_SELECTION_FILTER_BASE( aParent ),
m_frame( dynamic_cast<SCH_BASE_FRAME*>( aParent ) ),
m_onlyCheckbox( nullptr )
{
wxFont font = KIUI::GetInfoFont( this );
m_cbLockedItems->SetFont( font );
m_cbSymbols->SetFont( font );
m_cbText->SetFont( font );
m_cbWires->SetFont( font );
m_cbLabels->SetFont( font );
m_cbPins->SetFont( font );
m_cbGraphics->SetFont( font );
m_cbImages->SetFont( font );
m_cbOtherItems->SetFont( font );
m_cbAllItems->SetFont( font );
SetBorders( true, false, false, false );
wxASSERT( m_frame );
m_tool = m_frame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
wxASSERT( m_tool );
SCH_SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();
SetCheckboxesFromFilter( opts );
m_cbSymbols->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
m_cbText->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
m_cbWires->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
m_cbLabels->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
m_cbPins->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
m_cbGraphics->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
m_cbImages->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
m_cbOtherItems->Bind( wxEVT_RIGHT_DOWN, &PANEL_SCH_SELECTION_FILTER::onRightClick, this );
if( m_frame->GetFrameType() == FRAME_SCH_SYMBOL_EDITOR )
{
Freeze();
m_gridSizer->SetItemPosition( m_cbSymbols, wxGBPosition( 5, 0 ) );
m_gridSizer->SetItemPosition( m_cbWires, wxGBPosition( 5, 1 ) );
m_gridSizer->SetItemPosition( m_cbLabels, wxGBPosition( 6, 0 ) );
m_gridSizer->SetItemPosition( m_cbImages, wxGBPosition( 6, 1 ) );
m_cbSymbols->Hide();
m_cbWires->Hide();
m_cbLabels->Hide();
m_cbImages->Hide();
m_gridSizer->SetItemPosition( m_cbPins, wxGBPosition( 1, 0 ) );
m_gridSizer->SetItemPosition( m_cbText, wxGBPosition( 1, 1 ) );
m_gridSizer->SetItemPosition( m_cbGraphics, wxGBPosition( 2, 0 ) );
m_gridSizer->SetItemPosition( m_cbOtherItems, wxGBPosition( 2, 1 ) );
Thaw();
}
}
void PANEL_SCH_SELECTION_FILTER::SetCheckboxesFromFilter( SCH_SELECTION_FILTER_OPTIONS& aOptions )
{
Freeze();
m_cbLockedItems->SetValue( aOptions.lockedItems );
m_cbSymbols->SetValue( aOptions.symbols );
m_cbText->SetValue( aOptions.text );
m_cbWires->SetValue( aOptions.wires );
m_cbLabels->SetValue( aOptions.labels );
m_cbPins->SetValue( aOptions.pins );
m_cbGraphics->SetValue( aOptions.graphics );
m_cbImages->SetValue( aOptions.images );
m_cbOtherItems->SetValue( aOptions.otherItems );
m_cbAllItems->SetValue( aOptions.All() );
Thaw();
}
void PANEL_SCH_SELECTION_FILTER::OnFilterChanged( wxCommandEvent& aEvent )
{
if( aEvent.GetEventObject() == m_cbAllItems )
{
bool newState = m_cbAllItems->GetValue();
m_cbSymbols->SetValue( newState );
m_cbText->SetValue( newState );
m_cbWires->SetValue( newState );
m_cbLabels->SetValue( newState );
m_cbPins->SetValue( newState );
m_cbGraphics->SetValue( newState );
m_cbImages->SetValue( newState );
m_cbOtherItems->SetValue( newState );
}
SCH_SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();
// If any of the other checkboxes turned off, turn off the All Items checkbox
bool allChecked = setFilterFromCheckboxes( opts );
m_cbAllItems->SetValue( allChecked );
}
bool PANEL_SCH_SELECTION_FILTER::setFilterFromCheckboxes( SCH_SELECTION_FILTER_OPTIONS& aOptions )
{
aOptions.lockedItems = m_cbLockedItems->GetValue();
aOptions.symbols = m_cbSymbols->GetValue();
aOptions.text = m_cbText->GetValue();
aOptions.wires = m_cbWires->GetValue();
aOptions.labels = m_cbLabels->GetValue();
aOptions.pins = m_cbPins->GetValue();
aOptions.graphics = m_cbGraphics->GetValue();
aOptions.images = m_cbImages->GetValue();
aOptions.otherItems = m_cbOtherItems->GetValue();
return aOptions.All();
}
void PANEL_SCH_SELECTION_FILTER::onRightClick( wxMouseEvent& aEvent )
{
wxMenu menu;
wxCheckBox* cb = dynamic_cast<wxCheckBox*>( aEvent.GetEventObject() );
if( !cb )
return;
m_onlyCheckbox = cb;
wxString label;
label.Printf( _( "Only %s" ), cb->GetLabel().Lower() );
menu.Append( new wxMenuItem( &menu, wxID_ANY, label, wxEmptyString, wxITEM_NORMAL ) );
menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_SCH_SELECTION_FILTER::onPopupSelection, this );
PopupMenu( &menu );
}
void PANEL_SCH_SELECTION_FILTER::onPopupSelection( wxCommandEvent& aEvent )
{
if( !m_onlyCheckbox )
return;
m_cbAllItems->SetValue( false );
m_cbSymbols->SetValue( false );
m_cbText->SetValue( false );
m_cbWires->SetValue( false );
m_cbLabels->SetValue( false );
m_cbPins->SetValue( false );
m_cbGraphics->SetValue( false );
m_cbImages->SetValue( false );
m_cbOtherItems->SetValue( false );
m_onlyCheckbox->SetValue( true );
m_onlyCheckbox = nullptr;
wxCommandEvent dummy;
OnFilterChanged( dummy );
}
void PANEL_SCH_SELECTION_FILTER::OnLanguageChanged()
{
m_cbAllItems->SetLabel( _( "All items" ) );
m_cbLockedItems->SetLabel( _( "Locked items" ) );
m_cbLockedItems->SetToolTip( _( "Allow selection of locked items" ) );
m_cbSymbols->SetLabel( _( "Symbols" ) );
m_cbText->SetLabel( _( "Text" ) );
m_cbWires->SetLabel( _( "Wires" ) );
m_cbLabels->SetLabel( _( "Labels" ) );
m_cbPins->SetLabel( _( "Pins" ) );
m_cbGraphics->SetLabel( _( "Graphics" ) );
m_cbImages->SetLabel( _( "Images" ) );
m_cbOtherItems->SetLabel( _( "Other items" ) );
m_cbAllItems->GetParent()->Layout();
}

View File

@ -0,0 +1,58 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KICAD_PANEL_SCH_SELECTION_FILTER_H
#define KICAD_PANEL_SCH_SELECTION_FILTER_H
#include <widgets/panel_sch_selection_filter_base.h>
class SCH_BASE_FRAME;
class EE_SELECTION_TOOL;
struct SCH_SELECTION_FILTER_OPTIONS;
class PANEL_SCH_SELECTION_FILTER : public PANEL_SCH_SELECTION_FILTER_BASE
{
public:
PANEL_SCH_SELECTION_FILTER( wxWindow* aParent );
~PANEL_SCH_SELECTION_FILTER() = default;
void SetCheckboxesFromFilter( SCH_SELECTION_FILTER_OPTIONS& aOptions );
void OnLanguageChanged();
protected:
void OnFilterChanged( wxCommandEvent& aEvent ) override;
private:
bool setFilterFromCheckboxes( SCH_SELECTION_FILTER_OPTIONS& aOptions );
void onRightClick( wxMouseEvent& aEvent );
void onPopupSelection( wxCommandEvent& aEvent );
private:
SCH_BASE_FRAME* m_frame;
EE_SELECTION_TOOL* m_tool;
wxCheckBox* m_onlyCheckbox;
};
#endif //KICAD_PANEL_SCH_SELECTION_FILTER_H

View File

@ -0,0 +1,95 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_sch_selection_filter_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_SCH_SELECTION_FILTER_BASE::PANEL_SCH_SELECTION_FILTER_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : WX_PANEL( parent, id, pos, size, style, name )
{
m_gridSizer = new wxGridBagSizer( 0, 0 );
m_gridSizer->SetFlexibleDirection( wxBOTH );
m_gridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_cbAllItems = new wxCheckBox( this, wxID_ANY, _("All items"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbAllItems->SetValue(true);
m_gridSizer->Add( m_cbAllItems, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxLEFT|wxTOP, 5 );
m_cbLockedItems = new wxCheckBox( this, wxID_ANY, _("Locked items"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbLockedItems->SetValue(true);
m_cbLockedItems->Hide();
m_cbLockedItems->SetToolTip( _("Allow selection of locked items") );
m_gridSizer->Add( m_cbLockedItems, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT|wxTOP, 5 );
m_cbSymbols = new wxCheckBox( this, wxID_ANY, _("Symbols"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbSymbols->SetValue(true);
m_gridSizer->Add( m_cbSymbols, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
m_cbPins = new wxCheckBox( this, wxID_ANY, _("Pins"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbPins->SetValue(true);
m_gridSizer->Add( m_cbPins, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
m_cbWires = new wxCheckBox( this, wxID_ANY, _("Wires"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbWires->SetValue(true);
m_gridSizer->Add( m_cbWires, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
m_cbLabels = new wxCheckBox( this, wxID_ANY, _("Labels"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbLabels->SetValue(true);
m_gridSizer->Add( m_cbLabels, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
m_cbGraphics = new wxCheckBox( this, wxID_ANY, _("Graphics"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbGraphics->SetValue(true);
m_cbGraphics->SetToolTip( _("Graphical shapes") );
m_gridSizer->Add( m_cbGraphics, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
m_cbImages = new wxCheckBox( this, wxID_ANY, _("Images"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbImages->SetValue(true);
m_gridSizer->Add( m_cbImages, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
m_cbText = new wxCheckBox( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbText->SetValue(true);
m_gridSizer->Add( m_cbText, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxLEFT|wxRIGHT, 5 );
m_cbOtherItems = new wxCheckBox( this, wxID_ANY, _("Other items"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbOtherItems->SetValue(true);
m_gridSizer->Add( m_cbOtherItems, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxLEFT|wxRIGHT, 5 );
this->SetSizer( m_gridSizer );
this->Layout();
m_gridSizer->Fit( this );
// Connect Events
m_cbAllItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbLockedItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbSymbols->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbPins->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbWires->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbLabels->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbGraphics->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbImages->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbText->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbOtherItems->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
}
PANEL_SCH_SELECTION_FILTER_BASE::~PANEL_SCH_SELECTION_FILTER_BASE()
{
// Disconnect Events
m_cbAllItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbLockedItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbSymbols->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbPins->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbWires->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbLabels->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbGraphics->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbImages->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbText->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
m_cbOtherItems->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_SCH_SELECTION_FILTER_BASE::OnFilterChanged ), NULL, this );
}

View File

@ -0,0 +1,760 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="17"/>
<object class="Project" expanded="true">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">panel_sch_selection_filter_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">Selection Filter</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PANEL_SCH_SELECTION_FILTER_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">WX_PANEL; widgets/wx_panel.h; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxGridBagSizer" expanded="false">
<property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">m_gridSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="vgap">0</property>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxLEFT|wxTOP</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">All items</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_cbAllItems</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">1</property>
<property name="id">wxID_ANY</property>
<property name="label">Locked items</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_cbLockedItems</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="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Allow selection of locked items</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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">Symbols</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_cbSymbols</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">Pins</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_cbPins</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">Wires</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_cbWires</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="true">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="true">
<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="checked">1</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="drag_accept_files">0</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">Labels</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_cbLabels</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">Graphics</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_cbGraphics</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="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Graphical shapes</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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">Images</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_cbImages</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxLEFT|wxRIGHT</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">Text</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_cbText</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
<object class="gbsizeritem" expanded="false">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="false">
<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="checked">1</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="drag_accept_files">0</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">Other items</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_cbOtherItems</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="show">1</property>
<property name="size"></property>
<property name="style"></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="OnCheckBox">OnFilterChanged</event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,57 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "widgets/wx_panel.h"
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/gbsizer.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_SCH_SELECTION_FILTER_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_SCH_SELECTION_FILTER_BASE : public WX_PANEL
{
private:
protected:
wxGridBagSizer* m_gridSizer;
wxCheckBox* m_cbAllItems;
wxCheckBox* m_cbLockedItems;
wxCheckBox* m_cbSymbols;
wxCheckBox* m_cbPins;
wxCheckBox* m_cbWires;
wxCheckBox* m_cbLabels;
wxCheckBox* m_cbGraphics;
wxCheckBox* m_cbImages;
wxCheckBox* m_cbText;
wxCheckBox* m_cbOtherItems;
// Virtual event handlers, override them in your derived class
virtual void OnFilterChanged( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_SCH_SELECTION_FILTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_SCH_SELECTION_FILTER_BASE();
};

View File

@ -84,7 +84,7 @@ public:
wxString m_FootprintTextShownColumns;
SELECTION_FILTER_OPTIONS m_SelectionFilter;
PCB_SELECTION_FILTER_OPTIONS m_SelectionFilter;
std::vector<LAYER_PRESET> m_LayerPresets;

View File

@ -39,7 +39,7 @@
* Selection filtering that applies all the time (not the "filter selection" dialog that modifies
* the current selection)
*/
struct SELECTION_FILTER_OPTIONS
struct PCB_SELECTION_FILTER_OPTIONS
{
bool lockedItems; ///< Allow selecting locked items
bool footprints; ///< Allow selecting entire footprints
@ -53,7 +53,7 @@ struct SELECTION_FILTER_OPTIONS
bool dimensions; ///< Dimension items
bool otherItems; ///< Anything not fitting one of the above categories
SELECTION_FILTER_OPTIONS()
PCB_SELECTION_FILTER_OPTIONS()
{
lockedItems = true;
footprints = true;

View File

@ -24,6 +24,7 @@
#include <layer_ids.h>
#include <project/board_project_settings.h>
#include <project/sch_project_settings.h>
#include <settings/json_settings.h>
#include <wildcards_and_files_ext.h>
#include <settings/app_settings.h>
@ -132,8 +133,9 @@ public:
std::vector<wxString> m_HiddenNets;
std::set<wxString> m_HiddenNetclasses;
/// State of the selection filter widget
SELECTION_FILTER_OPTIONS m_SelectionFilter;
/// State of the selection filter widgets
PCB_SELECTION_FILTER_OPTIONS m_PcbSelectionFilter;
SCH_SELECTION_FILTER_OPTIONS m_SchSelectionFilter;
// Upstream git repo info
wxString m_GitRepoUsername;

View File

@ -0,0 +1,79 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KICAD_SCH_PROJECT_SETTINGS_H
#define KICAD_SCH_PROJECT_SETTINGS_H
struct SCH_SELECTION_FILTER_OPTIONS
{
bool lockedItems; ///< Allow selecting locked items
bool symbols; ///< Allow selecting symbols and sheet symbols
bool text; ///< Text and fields
bool wires; ///< Net and bus wires and junctions
bool labels; ///< Net and bus labels
bool pins; ///< Symbol and sheet pins
bool graphics; ///< Graphic lines, shapes, polygons
bool images; ///< Bitmap/vector images
bool otherItems; ///< Anything not fitting one of the above categories
SCH_SELECTION_FILTER_OPTIONS()
{
lockedItems = true;
symbols = true;
text = true;
wires = true;
labels = true;
pins = true;
graphics = true;
images = true;
otherItems = true;
}
/**
* @return true if any of the item types are enabled (excluding "locked items" which is special)
*/
bool Any()
{
return ( symbols || text || wires || labels || pins || graphics || images || otherItems );
}
/**
* @return true if all the item types are enabled (excluding "locked items" which is special)
*/
bool All()
{
return ( symbols && text && wires && labels && pins && graphics && images && otherItems );
}
void SetDefaults()
{
lockedItems = false;
symbols = true;
text = true;
wires = true;
labels = true;
pins = true;
graphics = true;
images = true;
otherItems = true;
}
};
#endif //KICAD_SCH_PROJECT_SETTINGS_H

View File

@ -99,9 +99,9 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
m_appearancePanel->SetUserViewports( project.m_Viewports );
PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter();
PCB_SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter();
filterOpts = localSettings.m_SelectionFilter;
filterOpts = localSettings.m_PcbSelectionFilter;
m_selectionFilterPanel->SetCheckboxesFromFilter( filterOpts );
PCB_DISPLAY_OPTIONS opts = GetDisplayOptions();
@ -237,7 +237,7 @@ void PCB_EDIT_FRAME::saveProjectSettings()
}
PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter();
PCB_SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter();
localSettings.m_SelectionFilter = filterOpts;
localSettings.m_PcbSelectionFilter = filterOpts;
}

View File

@ -1729,7 +1729,7 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
// Apply the active selection filter, except we want to allow picking locked items for
// highlighting even if the user has disabled them for selection
SELECTION_FILTER_OPTIONS& filter = selectionTool->GetFilter();
PCB_SELECTION_FILTER_OPTIONS& filter = selectionTool->GetFilter();
bool saved = filter.lockedItems;
filter.lockedItems = true;

View File

@ -225,7 +225,7 @@ VECTOR2I PCB_GRID_HELPER::AlignToNearestPad( const VECTOR2I& aMousePos, PADS& aP
VECTOR2I PCB_GRID_HELPER::BestDragOrigin( const VECTOR2I &aMousePos,
std::vector<BOARD_ITEM*>& aItems,
GRID_HELPER_GRIDS aGrid,
const SELECTION_FILTER_OPTIONS* aSelectionFilter )
const PCB_SELECTION_FILTER_OPTIONS* aSelectionFilter )
{
clearAnchors();
@ -541,7 +541,7 @@ std::set<BOARD_ITEM*> PCB_GRID_HELPER::queryVisible( const BOX2I& aArea,
void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bool aFrom,
const SELECTION_FILTER_OPTIONS* aSelectionFilter )
const PCB_SELECTION_FILTER_OPTIONS* aSelectionFilter )
{
KIGFX::VIEW* view = m_toolMgr->GetView();
RENDER_SETTINGS* settings = view->GetPainter()->GetSettings();

View File

@ -32,7 +32,7 @@
class TOOL_MANAGER;
struct MAGNETIC_SETTINGS;
struct SELECTION_FILTER_OPTIONS;
struct PCB_SELECTION_FILTER_OPTIONS;
class PCB_GRID_HELPER : public GRID_HELPER
{
@ -57,7 +57,7 @@ public:
VECTOR2I BestDragOrigin( const VECTOR2I& aMousePos, std::vector<BOARD_ITEM*>& aItem,
GRID_HELPER_GRIDS aGrid = GRID_HELPER_GRIDS::GRID_CURRENT,
const SELECTION_FILTER_OPTIONS* aSelectionFilter = nullptr );
const PCB_SELECTION_FILTER_OPTIONS* aSelectionFilter = nullptr );
VECTOR2I AlignToArc ( const VECTOR2I& aPoint, const SHAPE_ARC& aSeg );
@ -97,7 +97,7 @@ private:
* @param aFrom Is this for an anchor that is designating a source point (aFrom=true) or not
*/
void computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bool aFrom = false,
const SELECTION_FILTER_OPTIONS* aSelectionFilter = nullptr );
const PCB_SELECTION_FILTER_OPTIONS* aSelectionFilter = nullptr );
private:
MAGNETIC_SETTINGS* m_magneticSettings;

View File

@ -160,7 +160,7 @@ public:
*/
void RebuildSelection();
SELECTION_FILTER_OPTIONS& GetFilter()
PCB_SELECTION_FILTER_OPTIONS& GetFilter()
{
return m_filter;
}
@ -452,7 +452,7 @@ private:
PCB_SELECTION m_selection; // Current state of selection
SELECTION_FILTER_OPTIONS m_filter;
PCB_SELECTION_FILTER_OPTIONS m_filter;
KICURSOR m_nonModifiedCursor; // Cursor in the absence of shift/ctrl/alt

View File

@ -49,7 +49,7 @@ PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER( wxWindow* aParent ) :
m_tool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
wxASSERT( m_tool );
SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();
PCB_SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();
SetCheckboxesFromFilter( opts );
m_cbFootprints->Bind( wxEVT_RIGHT_DOWN, &PANEL_SELECTION_FILTER::onRightClick, this );
@ -65,7 +65,7 @@ PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER( wxWindow* aParent ) :
}
void PANEL_SELECTION_FILTER::SetCheckboxesFromFilter( SELECTION_FILTER_OPTIONS& aOptions )
void PANEL_SELECTION_FILTER::SetCheckboxesFromFilter( PCB_SELECTION_FILTER_OPTIONS& aOptions )
{
Freeze();
@ -105,7 +105,7 @@ void PANEL_SELECTION_FILTER::OnFilterChanged( wxCommandEvent& aEvent )
m_cbOtherItems->SetValue( newState );
}
SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();
PCB_SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();
// If any of the other checkboxes turned off, turn off the All Items checkbox
bool allChecked = setFilterFromCheckboxes( opts );
@ -113,7 +113,7 @@ void PANEL_SELECTION_FILTER::OnFilterChanged( wxCommandEvent& aEvent )
}
bool PANEL_SELECTION_FILTER::setFilterFromCheckboxes( SELECTION_FILTER_OPTIONS& aOptions )
bool PANEL_SELECTION_FILTER::setFilterFromCheckboxes( PCB_SELECTION_FILTER_OPTIONS& aOptions )
{
aOptions.lockedItems = m_cbLockedItems->GetValue();
aOptions.footprints = m_cbFootprints->GetValue();

View File

@ -25,7 +25,7 @@
class PCB_SELECTION_TOOL;
struct SELECTION_FILTER_OPTIONS;
struct PCB_SELECTION_FILTER_OPTIONS;
class PANEL_SELECTION_FILTER : public PANEL_SELECTION_FILTER_BASE
@ -35,7 +35,7 @@ public:
~PANEL_SELECTION_FILTER() = default;
void SetCheckboxesFromFilter( SELECTION_FILTER_OPTIONS& aOptions );
void SetCheckboxesFromFilter( PCB_SELECTION_FILTER_OPTIONS& aOptions );
void OnLanguageChanged();
@ -43,7 +43,7 @@ protected:
void OnFilterChanged( wxCommandEvent& aEvent ) override;
private:
bool setFilterFromCheckboxes( SELECTION_FILTER_OPTIONS& aOptions );
bool setFilterFromCheckboxes( PCB_SELECTION_FILTER_OPTIONS& aOptions );
void onRightClick( wxMouseEvent& aEvent );