EE -> SCH (no functional changes)

This commit is contained in:
Jeff Young 2025-03-12 14:41:25 +00:00
parent d5f02ba7bc
commit 5996cffabc
95 changed files with 1942 additions and 1981 deletions

View File

@ -359,7 +359,6 @@ set( EESCHEMA_SRCS
cross-probing.cpp
design_block_tree_model_adapter.cpp
design_block_utils.cpp
ee_collectors.cpp
eeschema_config.cpp
eeschema_helpers.cpp
eeschema_jobs_handler.cpp
@ -383,6 +382,7 @@ set( EESCHEMA_SRCS
sch_base_frame.cpp
sch_bitmap.cpp
sch_bus_entry.cpp
sch_collectors.cpp
sch_commit.cpp
sch_connection.cpp
sch_draw_panel.cpp
@ -446,14 +446,9 @@ set( EESCHEMA_SRCS
tools/assign_footprints.cpp
tools/backannotate.cpp
tools/ee_actions.cpp
tools/ee_grid_helper.cpp
tools/ee_inspection_tool.cpp
tools/ee_point_editor.cpp
tools/ee_selection.cpp
tools/ee_selection_tool.cpp
tools/ee_tool_utils.cpp
tools/rule_area_create_helper.cpp
tools/sch_actions.cpp
tools/sch_drawing_tools.cpp
tools/sch_design_block_control.cpp
tools/sch_edit_table_tool.cpp
@ -461,9 +456,14 @@ set( EESCHEMA_SRCS
tools/sch_editor_control.cpp
tools/sch_editor_conditions.cpp
tools/sch_find_replace_tool.cpp
tools/sch_inspection_tool.cpp
tools/sch_line_wire_bus_tool.cpp
tools/sch_move_tool.cpp
tools/sch_navigate_tool.cpp
tools/sch_point_editor.cpp
tools/sch_selection.cpp
tools/sch_selection_tool.cpp
tools/sch_tool_utils.cpp
tools/symbol_editor_control.cpp
tools/symbol_editor_drawing_tools.cpp
tools/symbol_editor_edit_tool.cpp

View File

@ -31,8 +31,8 @@
#include <erc/erc_settings.h>
#include <sch_reference_list.h>
#include <symbol_library.h>
#include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection.h>
#include <tools/sch_selection_tool.h>
#include <tool/tool_manager.h>
#include <dialog_erc.h>
@ -138,9 +138,9 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRe
case ANNOTATE_SELECTION:
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->RequestSelection();
SCH_SHEET_LIST selectedSheets;
SCH_SELECTION_TOOL* selTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->RequestSelection();
SCH_SHEET_LIST selectedSheets;
for( EDA_ITEM* item : selection.Items() )
{
@ -178,7 +178,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRe
}
std::unordered_set<SCH_SYMBOL*> getInferredSymbols( const EE_SELECTION& aSelection )
std::unordered_set<SCH_SYMBOL*> getInferredSymbols( const SCH_SELECTION& aSelection )
{
std::unordered_set<SCH_SYMBOL*> symbols;
@ -214,13 +214,13 @@ void SCH_EDIT_FRAME::AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAn
bool aRecursive, int aStartNumber, bool aResetAnnotation,
bool aRepairTimestamps, REPORTER& aReporter )
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->GetSelection();
SCH_SELECTION_TOOL* selTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->GetSelection();
SCH_REFERENCE_LIST references;
SCH_SCREENS screens( Schematic().Root() );
SCH_SHEET_LIST sheets = Schematic().Hierarchy();
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
SCH_REFERENCE_LIST references;
SCH_SCREENS screens( Schematic().Root() );
SCH_SHEET_LIST sheets = Schematic().Hierarchy();
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
// Store the selected sheets relative to the full hierarchy so we get the correct sheet numbers
@ -498,8 +498,8 @@ int SCH_EDIT_FRAME::CheckAnnotate( ANNOTATION_ERROR_HANDLER aErrorHandler,
break;
case ANNOTATE_SELECTION:
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->RequestSelection();
SCH_SELECTION_TOOL* selTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->RequestSelection();
for( SCH_SYMBOL* symbol : getInferredSymbols( selection ) )
GetCurrentSheet().AppendSymbol( referenceList, symbol, false, true );

View File

@ -53,14 +53,10 @@
#include <boost/range/adaptor/reversed.hpp>
#include <sch_edit_frame.h>
#include <symbol.h>
#include <sch_line.h>
#include <sch_pin.h>
#include <kiface_base.h>
#include <algorithm>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <eeschema_settings.h>
#include <core/arraydim.h>
#define FIELD_PADDING schIUScale.MilsToIU( 15 ) // arbitrarily chosen for aesthetics

View File

@ -29,12 +29,9 @@
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_screen.h>
#include <sch_view.h>
#include <sch_commit.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <trigo.h>
@ -117,7 +114,7 @@ bool SCH_EDIT_FRAME::TrimWire( SCH_COMMIT* aCommit, const VECTOR2I& aStart, cons
void SCH_EDIT_FRAME::SchematicCleanUp( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen )
{
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
std::vector<SCH_LINE*> lines;
std::vector<SCH_JUNCTION*> junctions;
std::vector<SCH_NO_CONNECT*> ncs;
@ -360,9 +357,9 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_COMMIT* aCommit, SCH_SCREEN*
void SCH_EDIT_FRAME::DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aJunction )
{
SCH_SCREEN* screen = GetScreen();
PICKED_ITEMS_LIST undoList;
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SCH_SCREEN* screen = GetScreen();
PICKED_ITEMS_LIST undoList;
SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
aJunction->SetFlags( STRUCT_DELETED );
RemoveFromScreen( aJunction, screen );

View File

@ -38,7 +38,7 @@
#include <project_sch.h>
#include <richio.h>
#include <symbol_lib_table.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <tools/sch_editor_control.h>
#include <advanced_config.h>
#include <widgets/design_block_pane.h>
@ -133,7 +133,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
{
BOX2I bbox = symbol->GetBoundingBox();
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
m_toolMgr->GetTool<SCH_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
}
if( pin )
@ -215,7 +215,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
}
else if( strcmp( idcmd, "$ERC" ) == 0 )
{
GetToolManager()->RunAction( EE_ACTIONS::runERC );
GetToolManager()->RunAction( SCH_ACTIONS::runERC );
return;
}
else if( strcmp( idcmd, "$NET:" ) == 0 )
@ -230,7 +230,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
else
m_highlightedConn = wxEmptyString;
GetToolManager()->RunAction( EE_ACTIONS::updateNetHighlighting );
GetToolManager()->RunAction( SCH_ACTIONS::updateNetHighlighting );
RefreshNetNavigator();
SetStatusText( _( "Selected net:" ) + wxS( " " ) + UnescapeString( netName ) );
@ -927,8 +927,8 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
m_syncingPcbToSchSelection = true; // recursion guard
GetToolManager()->GetTool<EE_SELECTION_TOOL>()->SyncSelection( sheetPath, focusItem,
items );
GetToolManager()->GetTool<SCH_SELECTION_TOOL>()->SyncSelection( sheetPath, focusItem,
items );
m_syncingPcbToSchSelection = false;
}

View File

@ -37,7 +37,7 @@
#include <kidialog.h>
#include <confirm.h>
#include <tool/tool_manager.h>
#include <ee_selection_tool.h>
#include <sch_selection_tool.h>
#include <dialogs/dialog_design_block_properties.h>
#include <nlohmann/json.hpp>
@ -370,7 +370,7 @@ void SCH_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
}
// Get all selected items
EE_SELECTION selection = m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
SCH_SELECTION selection = m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
if( selection.Empty() )
{

View File

@ -34,8 +34,8 @@
#include <wildcards_and_files_ext.h>
#include <sch_marker.h>
#include <connection_graph.h>
#include <tools/ee_actions.h>
#include <tools/ee_inspection_tool.h>
#include <tools/sch_actions.h>
#include <tools/sch_inspection_tool.h>
#include <dialog_erc.h>
#include <erc/erc.h>
#include <erc/erc_report.h>
@ -292,7 +292,7 @@ void DIALOG_ERC::OnDeleteOneClick( wxCommandEvent& aEvent )
if( m_notebook->GetSelection() == 0 )
{
// Clear the selection. It may be the selected ERC marker.
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
m_markerTreeModel->DeleteCurrentItem( true );
@ -570,7 +570,7 @@ void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent )
if( !sheet.empty() && sheet != m_parent->GetCurrentSheet() )
{
m_parent->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
// Store the current zoom level into the current screen before switching
m_parent->GetScreen()->m_LastZoomLevel = m_parent->GetCanvas()->GetView()->GetScale();
@ -604,9 +604,9 @@ void DIALOG_ERC::OnERCItemDClick( wxDataViewEvent& aEvent )
void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
{
TOOL_MANAGER* toolMgr = m_parent->GetToolManager();
EE_INSPECTION_TOOL* inspectionTool = toolMgr->GetTool<EE_INSPECTION_TOOL>();
RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aEvent.GetItem() );
TOOL_MANAGER* toolMgr = m_parent->GetToolManager();
SCH_INSPECTION_TOOL* inspectionTool = toolMgr->GetTool<SCH_INSPECTION_TOOL>();
RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aEvent.GetItem() );
if( !node )
return;
@ -836,7 +836,7 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
// Clear the selection before deleting markers. It may be some selected ERC markers.
// Deleting a selected marker without deselecting it first generates a crash
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
SCH_SCREENS ScreenList( m_parent->Schematic().Root() );
ScreenList.DeleteMarkers( MARKER_BASE::MARKER_ERC, rcItem->GetErrorCode() );
@ -1016,7 +1016,7 @@ void DIALOG_ERC::deleteAllMarkers( bool aIncludeExclusions )
// Freeze to avoid repainting the dialog, which can cause a RePaint()
// of the screen as well
Freeze();
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
m_markerTreeModel->DeleteItems( false, aIncludeExclusions, false );

View File

@ -35,7 +35,7 @@
#include <common.h>
#include <string_utils.h>
#include <sch_edit_frame.h>
#include <ee_collectors.h>
#include <sch_collectors.h>
#include <sch_symbol.h>
#include <template_fieldnames.h>
#include <symbol_library.h>

View File

@ -34,7 +34,7 @@
#include <schematic.h>
#include <sch_commit.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <tools/sch_edit_tool.h>
#include <widgets/unit_binder.h>
#include <widgets/font_choice.h>
@ -69,7 +69,7 @@ static bool g_filterSelected;
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
{
SCH_EDIT_FRAME* m_parent;
EE_SELECTION m_selection;
SCH_SELECTION m_selection;
UNIT_BINDER m_textSize;
UNIT_BINDER m_lineWidth;
@ -162,7 +162,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS()
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
{
EE_SELECTION_TOOL* selectionTool = m_parent->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_parent->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
m_selection = selectionTool->GetSelection();
m_references->SetValue( g_modifyReferences );

View File

@ -542,10 +542,10 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow()
if( !wxDialog::TransferDataFromWindow() )
return false;
TOOL_MANAGER* toolMgr = m_parent->GetToolManager();
EE_SELECTION_TOOL* selectionTool = toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selectionTool->GetSelection();
SCH_SYMBOL* symbol = nullptr;
TOOL_MANAGER* toolMgr = m_parent->GetToolManager();
SCH_SELECTION_TOOL* selectionTool = toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selectionTool->GetSelection();
SCH_SYMBOL* symbol = nullptr;
UpdateScope();
@ -1185,8 +1185,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected( wxGridRangeSelectEvent& a
}
else if( m_radioSelect->GetValue() )
{
EE_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
std::vector<SCH_ITEM*> items( symbols.begin(), symbols.end() );
if( refs.size() > 0 )

View File

@ -37,7 +37,7 @@
#include <widgets/grid_combobox.h>
#include <widgets/std_bitmap_button.h>
#include <settings/settings_manager.h>
#include <ee_collectors.h>
#include <sch_collectors.h>
#include <symbol_library.h>
#include <fields_grid_table.h>
#include <sch_edit_frame.h>

View File

@ -22,7 +22,6 @@
*/
#include <kiplatform/ui.h>
#include <ee_actions.h>
#include <sch_edit_frame.h>
#include <widgets/color_swatch.h>
#include <widgets/grid_color_swatch_helpers.h>

View File

@ -22,7 +22,6 @@
*/
#include <gr_text.h>
#include <ee_actions.h>
#include <sch_edit_frame.h>
#include <widgets/bitmap_button.h>
#include <widgets/color_swatch.h>

View File

@ -27,7 +27,6 @@
#include <wildcards_and_files_ext.h>
#include <schematic.h>
#include <connection_graph.h>
#include <tools/ee_actions.h>
#include <tool/tool_manager.h>
#include <panel_setup_pinmap.h>
#include <erc/erc.h>

View File

@ -46,7 +46,7 @@
#include <zoom_defines.h>
#include <sim/spice_settings.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
/// Helper for all the old plotting/printing code while it still exists
@ -73,7 +73,7 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
selTool->GetFilter() = localSettings.m_SchSelectionFilter;
m_selectionFilterPanel->SetCheckboxesFromFilter( localSettings.m_SchSelectionFilter );
@ -243,7 +243,7 @@ void SCH_EDIT_FRAME::SaveProjectLocalSettings()
m_schematic->RecordERCExclusions();
PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();
EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
localSettings.m_SchSelectionFilter = selTool->GetFilter();
}

View File

@ -71,9 +71,8 @@
#include <wx/log.h>
#include <wx/richmsgdlg.h>
#include <wx/stdpaths.h>
#include <tools/ee_actions.h>
#include <tools/ee_inspection_tool.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_inspection_tool.h>
#include <tools/sch_selection_tool.h>
#include <paths.h>
#include <wx_filename.h> // For ::ResolvePossibleSymlinks
#include <widgets/wx_progress_reporters.h>
@ -149,7 +148,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
ClearUndoRedoList();
ClearRepeatItemsList();
SetScreen( nullptr );
m_toolManager->GetTool<EE_INSPECTION_TOOL>()->Reset( TOOL_BASE::SUPERMODEL_RELOAD );
m_toolManager->GetTool<SCH_INSPECTION_TOOL>()->Reset( TOOL_BASE::SUPERMODEL_RELOAD );
CreateScreens();
}
@ -673,7 +672,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
eeconfig()->m_System.show_import_issues = importOptions.GetShowIssues();
// Don't leave dangling pointers to previously-opened document.
m_toolManager->GetTool<EE_SELECTION_TOOL>()->ClearSelection();
m_toolManager->GetTool<SCH_SELECTION_TOOL>()->ClearSelection();
ClearUndoRedoList();
ClearRepeatItemsList();

View File

@ -31,8 +31,8 @@
#include <tool/action_manager.h>
#include <tool/action_menu.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/ee_actions.h>
#include <tools/sch_selection_tool.h>
#include <tools/sch_actions.h>
#include "eeschema_id.h"
#include "sch_edit_frame.h"
#include <widgets/wx_menubar.h>
@ -41,7 +41,7 @@
void SCH_EDIT_FRAME::doReCreateMenuBar()
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
@ -89,7 +89,7 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
if( Kiface().IsSingle() )
fileMenu->Add( ACTIONS::saveAs );
else
fileMenu->Add( EE_ACTIONS::saveCurrSheetCopyAs );
fileMenu->Add( SCH_ACTIONS::saveCurrSheetCopyAs );
fileMenu->Add( ACTIONS::revert );
@ -105,9 +105,8 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
ID_IMPORT_NON_KICAD_SCH,
BITMAPS::import_document );
submenuImport->Add( EE_ACTIONS::importFPAssignments, ACTION_MENU::NORMAL,
_( "Footprint Assignments..." ) );
submenuImport->Add( EE_ACTIONS::importGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
submenuImport->Add( SCH_ACTIONS::importFPAssignments, ACTION_MENU::NORMAL, _( "Footprint Assignments..." ) );
submenuImport->Add( SCH_ACTIONS::importGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
fileMenu->Add( submenuImport );
@ -116,17 +115,14 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
submenuExport->SetTitle( _( "Export" ) );
submenuExport->SetIcon( BITMAPS::export_file );
submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard, ACTION_MENU::NORMAL,
_( "Drawing to Clipboard" ) );
submenuExport->Add( EE_ACTIONS::exportNetlist, ACTION_MENU::NORMAL, _( "Netlist..." ) );
submenuExport->Add( EE_ACTIONS::exportSymbolsToLibrary, ACTION_MENU::NORMAL,
_( "Symbols to Library..." ) );
submenuExport->Add( EE_ACTIONS::exportSymbolsToNewLibrary, ACTION_MENU::NORMAL,
_( "Symbols to New Library..." ) );
submenuExport->Add( SCH_ACTIONS::drawSheetOnClipboard, ACTION_MENU::NORMAL, _( "Drawing to Clipboard" ) );
submenuExport->Add( SCH_ACTIONS::exportNetlist, ACTION_MENU::NORMAL, _( "Netlist..." ) );
submenuExport->Add( SCH_ACTIONS::exportSymbolsToLibrary, ACTION_MENU::NORMAL, _( "Symbols to Library..." ) );
submenuExport->Add( SCH_ACTIONS::exportSymbolsToNewLibrary, ACTION_MENU::NORMAL, _( "Symbols to New Library..." ) );
fileMenu->Add( submenuExport );
fileMenu->AppendSeparator();
fileMenu->Add( EE_ACTIONS::schematicSetup );
fileMenu->Add( SCH_ACTIONS::schematicSetup );
fileMenu->AppendSeparator();
fileMenu->Add( ACTIONS::pageSettings );
@ -162,17 +158,17 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
editMenu->AppendSeparator();
editMenu->Add( ACTIONS::deleteTool );
editMenu->Add( EE_ACTIONS::editTextAndGraphics );
editMenu->Add( EE_ACTIONS::changeSymbols );
editMenu->Add( EE_ACTIONS::editPageNumber );
editMenu->Add( SCH_ACTIONS::editTextAndGraphics );
editMenu->Add( SCH_ACTIONS::changeSymbols );
editMenu->Add( SCH_ACTIONS::editPageNumber );
ACTION_MENU* submenuAttributes = new ACTION_MENU( false, selTool );
submenuAttributes->SetTitle( _( "Attributes" ) );
submenuAttributes->Add( EE_ACTIONS::setExcludeFromSimulation, ACTION_MENU::CHECK );
submenuAttributes->Add( EE_ACTIONS::setExcludeFromBOM, ACTION_MENU::CHECK );
submenuAttributes->Add( EE_ACTIONS::setExcludeFromBoard, ACTION_MENU::CHECK );
submenuAttributes->Add( EE_ACTIONS::setDNP, ACTION_MENU::CHECK );
submenuAttributes->Add( SCH_ACTIONS::setExcludeFromSimulation, ACTION_MENU::CHECK );
submenuAttributes->Add( SCH_ACTIONS::setExcludeFromBOM, ACTION_MENU::CHECK );
submenuAttributes->Add( SCH_ACTIONS::setExcludeFromBoard, ACTION_MENU::CHECK );
submenuAttributes->Add( SCH_ACTIONS::setDNP, ACTION_MENU::CHECK );
editMenu->Add( submenuAttributes );
@ -186,13 +182,13 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
showHidePanels->Add( ACTIONS::showProperties, ACTION_MENU::CHECK );
showHidePanels->Add( ACTIONS::showSearch, ACTION_MENU::CHECK );
showHidePanels->Add( EE_ACTIONS::showHierarchy, ACTION_MENU::CHECK );
showHidePanels->Add( SCH_ACTIONS::showHierarchy, ACTION_MENU::CHECK );
if( ADVANCED_CFG::GetCfg().m_IncrementalConnectivity )
showHidePanels->Add( EE_ACTIONS::showNetNavigator, ACTION_MENU::CHECK );
showHidePanels->Add( SCH_ACTIONS::showNetNavigator, ACTION_MENU::CHECK );
if( ADVANCED_CFG::GetCfg().m_EnableDesignBlocks )
showHidePanels->Add( EE_ACTIONS::showDesignBlockPanel, ACTION_MENU::CHECK,
showHidePanels->Add( SCH_ACTIONS::showDesignBlockPanel, ACTION_MENU::CHECK,
_( "Design Blocks" ) );
viewMenu->Add( showHidePanels );
@ -209,25 +205,25 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
viewMenu->Add( ACTIONS::zoomRedraw );
viewMenu->AppendSeparator();
viewMenu->Add( EE_ACTIONS::navigateBack );
viewMenu->Add( EE_ACTIONS::navigateUp );
viewMenu->Add( EE_ACTIONS::navigateForward );
viewMenu->Add( EE_ACTIONS::navigatePrevious );
viewMenu->Add( EE_ACTIONS::navigateNext );
viewMenu->Add( SCH_ACTIONS::navigateBack );
viewMenu->Add( SCH_ACTIONS::navigateUp );
viewMenu->Add( SCH_ACTIONS::navigateForward );
viewMenu->Add( SCH_ACTIONS::navigatePrevious );
viewMenu->Add( SCH_ACTIONS::navigateNext );
viewMenu->AppendSeparator();
viewMenu->Add( EE_ACTIONS::toggleHiddenPins, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleHiddenFields, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleDirectiveLabels, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleERCErrors, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleERCWarnings, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleERCExclusions, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::markSimExclusions, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleOPVoltages, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleOPCurrents, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::togglePinAltIcons, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleHiddenPins, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleHiddenFields, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleDirectiveLabels, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleERCErrors, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleERCWarnings, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleERCExclusions, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::markSimExclusions, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleOPVoltages, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleOPCurrents, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::togglePinAltIcons, ACTION_MENU::CHECK );
#ifdef __APPLE__
viewMenu->AppendSeparator();
@ -237,54 +233,54 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
//
ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
placeMenu->Add( EE_ACTIONS::placeSymbol );
placeMenu->Add( EE_ACTIONS::placePower );
placeMenu->Add( EE_ACTIONS::drawWire );
placeMenu->Add( EE_ACTIONS::drawBus );
placeMenu->Add( EE_ACTIONS::placeBusWireEntry );
placeMenu->Add( EE_ACTIONS::placeNoConnect );
placeMenu->Add( EE_ACTIONS::placeJunction );
placeMenu->Add( EE_ACTIONS::placeLabel );
placeMenu->Add( EE_ACTIONS::placeGlobalLabel );
placeMenu->Add( EE_ACTIONS::placeClassLabel );
placeMenu->Add( EE_ACTIONS::drawRuleArea );
placeMenu->Add( SCH_ACTIONS::placeSymbol );
placeMenu->Add( SCH_ACTIONS::placePower );
placeMenu->Add( SCH_ACTIONS::drawWire );
placeMenu->Add( SCH_ACTIONS::drawBus );
placeMenu->Add( SCH_ACTIONS::placeBusWireEntry );
placeMenu->Add( SCH_ACTIONS::placeNoConnect );
placeMenu->Add( SCH_ACTIONS::placeJunction );
placeMenu->Add( SCH_ACTIONS::placeLabel );
placeMenu->Add( SCH_ACTIONS::placeGlobalLabel );
placeMenu->Add( SCH_ACTIONS::placeClassLabel );
placeMenu->Add( SCH_ACTIONS::drawRuleArea );
placeMenu->AppendSeparator();
placeMenu->Add( EE_ACTIONS::placeHierLabel );
placeMenu->Add( EE_ACTIONS::drawSheet );
placeMenu->Add( EE_ACTIONS::placeSheetPin );
placeMenu->Add( EE_ACTIONS::syncAllSheetsPins );
placeMenu->Add( EE_ACTIONS::importSheet );
placeMenu->Add( SCH_ACTIONS::placeHierLabel );
placeMenu->Add( SCH_ACTIONS::drawSheet );
placeMenu->Add( SCH_ACTIONS::placeSheetPin );
placeMenu->Add( SCH_ACTIONS::syncAllSheetsPins );
placeMenu->Add( SCH_ACTIONS::importSheet );
placeMenu->AppendSeparator();
placeMenu->Add( EE_ACTIONS::placeSchematicText );
placeMenu->Add( EE_ACTIONS::drawTextBox );
placeMenu->Add( EE_ACTIONS::drawTable );
placeMenu->Add( EE_ACTIONS::drawRectangle );
placeMenu->Add( EE_ACTIONS::drawCircle );
placeMenu->Add( EE_ACTIONS::drawArc );
placeMenu->Add( EE_ACTIONS::drawBezier );
placeMenu->Add( EE_ACTIONS::drawLines );
placeMenu->Add( EE_ACTIONS::placeImage );
placeMenu->Add( SCH_ACTIONS::placeSchematicText );
placeMenu->Add( SCH_ACTIONS::drawTextBox );
placeMenu->Add( SCH_ACTIONS::drawTable );
placeMenu->Add( SCH_ACTIONS::drawRectangle );
placeMenu->Add( SCH_ACTIONS::drawCircle );
placeMenu->Add( SCH_ACTIONS::drawArc );
placeMenu->Add( SCH_ACTIONS::drawBezier );
placeMenu->Add( SCH_ACTIONS::drawLines );
placeMenu->Add( SCH_ACTIONS::placeImage );
//-- Inspect menu -----------------------------------------------
//
ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
inspectMenu->Add( EE_ACTIONS::showBusSyntaxHelp );
inspectMenu->Add( SCH_ACTIONS::showBusSyntaxHelp );
inspectMenu->AppendSeparator();
inspectMenu->Add( EE_ACTIONS::runERC );
inspectMenu->Add( SCH_ACTIONS::runERC );
inspectMenu->Add( ACTIONS::prevMarker );
inspectMenu->Add( ACTIONS::nextMarker );
inspectMenu->Add( ACTIONS::excludeMarker );
inspectMenu->AppendSeparator();
inspectMenu->Add( EE_ACTIONS::diffSymbol );
inspectMenu->Add( SCH_ACTIONS::diffSymbol );
inspectMenu->AppendSeparator();
inspectMenu->Add( EE_ACTIONS::showSimulator );
inspectMenu->Add( SCH_ACTIONS::showSimulator );
//-- Tools menu -----------------------------------------------
@ -294,34 +290,34 @@ void SCH_EDIT_FRAME::doReCreateMenuBar()
wxMenuItem* update = toolsMenu->Add( ACTIONS::updatePcbFromSchematic );
update->Enable( !Kiface().IsSingle() );
toolsMenu->Add( EE_ACTIONS::showPcbNew );
toolsMenu->Add( SCH_ACTIONS::showPcbNew );
if( !Kiface().IsSingle() )
toolsMenu->Add( ACTIONS::showProjectManager );
toolsMenu->AppendSeparator();
toolsMenu->Add( ACTIONS::showSymbolEditor );
toolsMenu->Add( EE_ACTIONS::updateSymbols );
toolsMenu->Add( SCH_ACTIONS::updateSymbols );
toolsMenu->AppendSeparator();
toolsMenu->Add( EE_ACTIONS::rescueSymbols );
toolsMenu->Add( EE_ACTIONS::remapSymbols );
toolsMenu->Add( SCH_ACTIONS::rescueSymbols );
toolsMenu->Add( SCH_ACTIONS::remapSymbols );
if( ADVANCED_CFG::GetCfg().m_ShowRepairSchematic )
toolsMenu->Add( EE_ACTIONS::repairSchematic );
toolsMenu->Add( SCH_ACTIONS::repairSchematic );
toolsMenu->AppendSeparator();
toolsMenu->Add( EE_ACTIONS::editSymbolFields );
toolsMenu->Add( EE_ACTIONS::editSymbolLibraryLinks );
toolsMenu->Add( SCH_ACTIONS::editSymbolFields );
toolsMenu->Add( SCH_ACTIONS::editSymbolLibraryLinks );
toolsMenu->AppendSeparator();
toolsMenu->Add( EE_ACTIONS::annotate );
toolsMenu->Add( EE_ACTIONS::incrementAnnotations );
toolsMenu->Add( SCH_ACTIONS::annotate );
toolsMenu->Add( SCH_ACTIONS::incrementAnnotations );
toolsMenu->AppendSeparator();
toolsMenu->Add( EE_ACTIONS::assignFootprints );
toolsMenu->Add( EE_ACTIONS::generateBOM );
toolsMenu->Add( EE_ACTIONS::generateBOMLegacy );
toolsMenu->Add( SCH_ACTIONS::assignFootprints );
toolsMenu->Add( SCH_ACTIONS::generateBOM );
toolsMenu->Add( SCH_ACTIONS::generateBOMLegacy );
toolsMenu->AppendSeparator();
update = toolsMenu->Add( ACTIONS::updateSchematicFromPcb );

View File

@ -35,7 +35,7 @@
#include <trace_helpers.h>
#include <connection_graph.h>
#include <widgets/wx_aui_utils.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
static wxString GetNetNavigatorItemText( const SCH_ITEM* aItem,
@ -542,7 +542,7 @@ void SCH_EDIT_FRAME::onNetNavigatorSelection( wxTreeEvent& aEvent )
if( GetCurrentSheet() != itemData->GetSheetPath() )
{
GetToolManager()->RunAction<SCH_SHEET_PATH*>( EE_ACTIONS::changeSheet,
GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet,
&itemData->GetSheetPath() );
}

View File

@ -30,7 +30,7 @@
#include <core/kicad_algo.h>
#include <symbol_library_common.h>
#include <confirm.h>
#include <ee_tool_utils.h>
#include <sch_tool_utils.h>
#include <eeschema_id.h>
#include <general.h>
#include <kidialog.h>
@ -43,7 +43,7 @@
#include <sch_edit_frame.h>
#include <symbol_lib_table.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <project_sch.h>
#include <dialog_symbol_chooser.h>
@ -212,7 +212,7 @@ void SCH_EDIT_FRAME::FlipBodyStyle( SCH_SYMBOL* aSymbol )
// If selected make sure all the now-included pins are selected
if( aSymbol->IsSelected() )
m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, aSymbol );
m_toolManager->RunAction<EDA_ITEM*>( SCH_ACTIONS::addItemToSel, aSymbol );
commit.Push( _( "Change Body Style" ) );
}

View File

@ -20,7 +20,7 @@
#include "sch_printout.h"
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <sch_edit_frame.h>
#include <math/vector2wx.h>
#include <pgm_base.h>
@ -138,10 +138,10 @@ bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting
painter->SetSchematic( &m_parent->Schematic() );
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
EE_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
SCH_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
// Target paper size
wxRect pageSizePix;

View File

@ -47,8 +47,7 @@
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <view/view_controls.h>
#include <wx/choicdlg.h>
#include <wx/fswatcher.h>
@ -111,7 +110,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
// wxWidgets, we can't get modifier-key-up events.
if( m_toolManager )
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
if( selTool )
selTool->OnIdle( aEvent );
@ -434,9 +433,9 @@ void SCH_BASE_FRAME::RefreshZoomDependentItems()
// items.
if( m_toolManager )
{
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SELECTION& selection = selectionTool->GetSelection();
KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
SELECTION& selection = selectionTool->GetSelection();
KIGFX::SCH_VIEW* view = GetCanvas()->GetView();
for( EDA_ITEM* item : selection )
{

View File

@ -25,7 +25,7 @@
#include <macros.h>
#include <trace_helpers.h>
#include <ee_collectors.h>
#include <sch_collectors.h>
#include <sch_bus_entry.h>
#include <sch_symbol.h>
#include <sch_line.h>
@ -35,7 +35,7 @@
#include "sch_reference_list.h"
const std::vector<KICAD_T> EE_COLLECTOR::EditableItems = {
const std::vector<KICAD_T> SCH_COLLECTOR::EditableItems = {
SCH_SHAPE_T,
SCH_TEXT_T,
SCH_TEXTBOX_T,
@ -56,7 +56,7 @@ const std::vector<KICAD_T> EE_COLLECTOR::EditableItems = {
};
const std::vector<KICAD_T> EE_COLLECTOR::MovableItems =
const std::vector<KICAD_T> SCH_COLLECTOR::MovableItems =
{
SCH_MARKER_T,
SCH_JUNCTION_T,
@ -82,21 +82,21 @@ const std::vector<KICAD_T> EE_COLLECTOR::MovableItems =
};
const std::vector<KICAD_T> EE_COLLECTOR::FieldOwners = {
const std::vector<KICAD_T> SCH_COLLECTOR::FieldOwners = {
SCH_SYMBOL_T,
SCH_SHEET_T,
SCH_LABEL_LOCATE_ANY_T
};
INSPECT_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
INSPECT_RESULT SCH_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
{
if( m_Unit || m_BodyStyle )
{
SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( aItem );
// Special selection rules apply to pins of different units when edited in synchronized
// pins mode. Leave it to EE_SELECTION_TOOL::Selectable() to decide what to do with them.
// pins mode. Leave it to SCH_SELECTION_TOOL::Selectable() to decide what to do with them.
if( schItem && schItem->Type() != SCH_PIN_T )
{
@ -120,8 +120,8 @@ INSPECT_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
}
void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const std::vector<KICAD_T>& aFilterList,
const VECTOR2I& aPos, int aUnit, int aConvert )
void SCH_COLLECTOR::Collect( SCH_SCREEN* aScreen, const std::vector<KICAD_T>& aFilterList,
const VECTOR2I& aPos, int aUnit, int aConvert )
{
Empty(); // empty the collection just in case
@ -140,8 +140,8 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const std::vector<KICAD_T>& aFi
}
void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector<KICAD_T>& aFilterList,
const VECTOR2I& aPos, int aUnit, int aConvert )
void SCH_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector<KICAD_T>& aFilterList,
const VECTOR2I& aPos, int aUnit, int aConvert )
{
Empty(); // empty the collection just in case
@ -160,7 +160,7 @@ void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector<KICAD
}
bool EE_COLLECTOR::IsCorner() const
bool SCH_COLLECTOR::IsCorner() const
{
if( GetCount() != 2 )
return false;

View File

@ -23,8 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef EE_COLLECTORS_H
#define EE_COLLECTORS_H
#ifndef SCH_COLLECTORS_H
#define SCH_COLLECTORS_H
#include <lib_symbol.h>
#include <collector.h>
@ -36,14 +36,14 @@ class SCH_SHEET_PATH;
class SCH_SYMBOL;
class EE_COLLECTOR : public COLLECTOR
class SCH_COLLECTOR : public COLLECTOR
{
public:
static const std::vector<KICAD_T> EditableItems;
static const std::vector<KICAD_T> MovableItems;
static const std::vector<KICAD_T> FieldOwners;
EE_COLLECTOR( const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T } ) :
SCH_COLLECTOR( const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T } ) :
m_Unit( 0 ),
m_BodyStyle( 0 ),
m_ShowPinElectricalTypes( false )
@ -111,4 +111,4 @@ public:
void CollectOtherUnits( const wxString& thisRef, int thisUnit, const LIB_ID& aLibId,
SCH_SHEET_PATH& aSheet, std::vector<SCH_SYMBOL*>* otherUnits );
#endif // EE_COLLECTORS_H
#endif // SCH_COLLECTORS_H

View File

@ -23,7 +23,7 @@
#include <macros.h>
#include <tool/tool_manager.h>
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <lib_symbol.h>
@ -47,7 +47,7 @@ SCH_COMMIT::SCH_COMMIT( TOOL_MANAGER* aToolMgr ) :
}
SCH_COMMIT::SCH_COMMIT( EE_TOOL_BASE<SCH_BASE_FRAME>* aTool )
SCH_COMMIT::SCH_COMMIT( SCH_TOOL_BASE<SCH_BASE_FRAME>* aTool )
{
m_toolMgr = aTool->GetManager();
m_isLibEditor = aTool->IsSymbolEditor();
@ -180,7 +180,7 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
KIGFX::VIEW* view = m_toolMgr->GetView();
SCH_EDIT_FRAME* frame = static_cast<SCH_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
bool itemsDeselected = false;
bool selectedModified = false;
bool dirtyConnectivity = false;
@ -488,9 +488,9 @@ void SCH_COMMIT::revertLibEdit()
return;
// Symbol editor just saves copies of the whole symbol, so grab the first and discard the rest
SYMBOL_EDIT_FRAME* frame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
LIB_SYMBOL* copy = dynamic_cast<LIB_SYMBOL*>( m_changes.front().m_copy );
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SYMBOL_EDIT_FRAME* frame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
LIB_SYMBOL* copy = dynamic_cast<LIB_SYMBOL*>( m_changes.front().m_copy );
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
if( frame && copy )
{
@ -510,10 +510,10 @@ void SCH_COMMIT::revertLibEdit()
void SCH_COMMIT::Revert()
{
KIGFX::VIEW* view = m_toolMgr->GetView();
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SHEET_LIST sheets;
KIGFX::VIEW* view = m_toolMgr->GetView();
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SHEET_LIST sheets;
if( m_changes.empty() )
return;

View File

@ -36,7 +36,7 @@ class EDA_DRAW_FRAME;
class TOOL_BASE;
template<class T>
class EE_TOOL_BASE;
class SCH_TOOL_BASE;
#define SKIP_UNDO 0x0001
#define APPEND_UNDO 0x0002
@ -47,7 +47,7 @@ class SCH_COMMIT : public COMMIT
public:
SCH_COMMIT( TOOL_MANAGER* aToolMgr );
SCH_COMMIT( EDA_DRAW_FRAME* aFrame );
SCH_COMMIT( EE_TOOL_BASE<SCH_BASE_FRAME>* aFrame );
SCH_COMMIT( SCH_TOOL_BASE<SCH_BASE_FRAME>* aFrame );
virtual ~SCH_COMMIT();

View File

@ -74,10 +74,10 @@
#include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h>
#include <tool/zoom_tool.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <tools/ee_grid_helper.h>
#include <tools/ee_inspection_tool.h>
#include <tools/ee_point_editor.h>
#include <tools/sch_inspection_tool.h>
#include <tools/sch_point_editor.h>
#include <tools/sch_design_block_control.h>
#include <tools/sch_drawing_tools.h>
#include <tools/sch_edit_tool.h>
@ -423,7 +423,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
// Init for dropping files
m_acceptedExts.emplace( FILEEXT::KiCadSchematicFileExtension, &EE_ACTIONS::ddAppendFile );
m_acceptedExts.emplace( FILEEXT::KiCadSchematicFileExtension, &SCH_ACTIONS::ddAppendFile );
DragAcceptFiles( true );
// Ensure the window is on top
@ -529,32 +529,32 @@ void SCH_EDIT_FRAME::setupTools()
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
GetCanvas()->GetViewControls(), config(), this );
m_actions = new EE_ACTIONS();
m_actions = new SCH_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new EE_SELECTION_TOOL );
m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
m_toolManager->RegisterTool( new PICKER_TOOL );
m_toolManager->RegisterTool( new SCH_DRAWING_TOOLS );
m_toolManager->RegisterTool( new SCH_LINE_WIRE_BUS_TOOL );
m_toolManager->RegisterTool( new SCH_MOVE_TOOL );
m_toolManager->RegisterTool( new SCH_EDIT_TOOL );
m_toolManager->RegisterTool( new SCH_EDIT_TABLE_TOOL );
m_toolManager->RegisterTool( new EE_INSPECTION_TOOL );
m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
m_toolManager->RegisterTool( new SCH_DESIGN_BLOCK_CONTROL );
m_toolManager->RegisterTool( new SCH_EDITOR_CONTROL );
m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
m_toolManager->RegisterTool( new EE_POINT_EDITOR );
m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
m_toolManager->RegisterTool( new SCH_NAVIGATE_TOOL );
m_toolManager->RegisterTool( new PROPERTIES_TOOL );
m_toolManager->RegisterTool( new EMBED_TOOL );
m_toolManager->InitTools();
// Run the selection tool, it is supposed to be always active
m_toolManager->PostAction( EE_ACTIONS::selectionActivate );
m_toolManager->PostAction( SCH_ACTIONS::selectionActivate );
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
}
@ -622,46 +622,39 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
mgr->SetConditions( EE_ACTIONS::showSearch, CHECK( searchPaneCond ) );
mgr->SetConditions( EE_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
mgr->SetConditions( EE_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
mgr->SetConditions( EE_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( SCH_ACTIONS::showSearch, CHECK( searchPaneCond ) );
mgr->SetConditions( SCH_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
mgr->SetConditions( SCH_ACTIONS::showNetNavigator, CHECK( netNavigatorCond ) );
mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
mgr->SetConditions( SCH_ACTIONS::showDesignBlockPanel, CHECK( designBlockCond ) );
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
mgr->SetConditions( ACTIONS::toggleGridOverrides, CHECK( cond.GridOverrides() ) );
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( EE_ACTIONS::lineModeFree,
CHECK( cond.LineMode( LINE_MODE::LINE_MODE_FREE ) ) );
mgr->SetConditions( EE_ACTIONS::lineMode90,
CHECK( cond.LineMode( LINE_MODE::LINE_MODE_90 ) ) );
mgr->SetConditions( EE_ACTIONS::lineMode45,
CHECK( cond.LineMode( LINE_MODE::LINE_MODE_45 ) ) );
mgr->SetConditions( SCH_ACTIONS::lineModeFree, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_FREE ) ) );
mgr->SetConditions( SCH_ACTIONS::lineMode90, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_90 ) ) );
mgr->SetConditions( SCH_ACTIONS::lineMode45, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_45 ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::copyAsText, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::paste,
ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::pasteSpecial,
ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( SELECTION_CONDITIONS::Idle && cond.NoActiveTool() ) );
mgr->SetConditions( ACTIONS::doDelete, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::duplicate, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::selectAll, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::unselectAll, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( hasElements ) );
mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( hasElements ) );
mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( hasElements ) );
mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( hasElements ) );
mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::zoomTool,
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool,
CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
auto showHiddenPinsCond =
[this]( const SELECTION& )
@ -755,65 +748,64 @@ void SCH_EDIT_FRAME::setupUIConditions()
return navigateTool && navigateTool->CanGoUp();
};
mgr->SetConditions( EE_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
mgr->SetConditions( SCH_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
/* Some of these are bound by default to arrow keys which will get a different action if we
* disable the buttons. So always leave them enabled so the action is consistent.
* https://gitlab.com/kicad/code/kicad/-/issues/14783
mgr->SetConditions( EE_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
mgr->SetConditions( EE_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
mgr->SetConditions( EE_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
mgr->SetConditions( SCH_ACTIONS::navigateUp, ENABLE( belowRootSheetCondition ) );
mgr->SetConditions( SCH_ACTIONS::navigateForward, ENABLE( navHistoryHasForward ) );
mgr->SetConditions( SCH_ACTIONS::navigateBack, ENABLE( navHistoryHsBackward ) );
*/
mgr->SetConditions( EE_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
mgr->SetConditions( EE_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
mgr->SetConditions( EE_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
mgr->SetConditions( EE_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
mgr->SetConditions( EE_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
mgr->SetConditions( EE_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
mgr->SetConditions( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) );
mgr->SetConditions( SCH_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
mgr->SetConditions( SCH_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleHiddenFields, CHECK( showHiddenFieldsCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleDirectiveLabels, CHECK( showDirectiveLabelsCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleERCErrors, CHECK( showERCErrorsCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleERCWarnings, CHECK( showERCWarningsCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleERCExclusions, CHECK( showERCExclusionsCond ) );
mgr->SetConditions( SCH_ACTIONS::markSimExclusions, CHECK( markSimExclusionsCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleOPVoltages, CHECK( showOPVoltagesCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleOPCurrents, CHECK( showOPCurrentsCond ) );
mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltModeIconsCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleAnnotateAuto, CHECK( showAnnotateAutomaticallyCond ) );
mgr->SetConditions( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) );
mgr->SetConditions( EE_ACTIONS::saveSheetAsDesignBlock, ENABLE( hasElements ) );
mgr->SetConditions( EE_ACTIONS::saveSelectionAsDesignBlock,
ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
mgr->SetConditions( SCH_ACTIONS::saveSheetAsDesignBlock, ENABLE( hasElements ) );
mgr->SetConditions( SCH_ACTIONS::saveSelectionAsDesignBlock, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
CURRENT_TOOL( ACTIONS::deleteTool );
CURRENT_TOOL( EE_ACTIONS::highlightNetTool );
CURRENT_TOOL( EE_ACTIONS::placeSymbol );
CURRENT_TOOL( EE_ACTIONS::placePower );
CURRENT_TOOL( EE_ACTIONS::placeDesignBlock );
CURRENT_TOOL( EE_ACTIONS::drawWire );
CURRENT_TOOL( EE_ACTIONS::drawBus );
CURRENT_TOOL( EE_ACTIONS::placeBusWireEntry );
CURRENT_TOOL( EE_ACTIONS::placeNoConnect );
CURRENT_TOOL( EE_ACTIONS::placeJunction );
CURRENT_TOOL( EE_ACTIONS::placeLabel );
CURRENT_TOOL( EE_ACTIONS::placeClassLabel );
CURRENT_TOOL( EE_ACTIONS::placeGlobalLabel );
CURRENT_TOOL( EE_ACTIONS::placeHierLabel );
CURRENT_TOOL( EE_ACTIONS::drawRuleArea );
CURRENT_TOOL( EE_ACTIONS::drawSheet );
CURRENT_TOOL( EE_ACTIONS::placeSheetPin );
CURRENT_TOOL( EE_ACTIONS::syncSheetPins );
CURRENT_TOOL( EE_ACTIONS::drawSheetFromFile );
CURRENT_TOOL( EE_ACTIONS::drawSheetFromDesignBlock );
CURRENT_TOOL( EE_ACTIONS::drawRectangle );
CURRENT_TOOL( EE_ACTIONS::drawCircle );
CURRENT_TOOL( EE_ACTIONS::drawArc );
CURRENT_TOOL( EE_ACTIONS::drawBezier );
CURRENT_TOOL( EE_ACTIONS::drawLines );
CURRENT_TOOL( EE_ACTIONS::placeSchematicText );
CURRENT_TOOL( EE_ACTIONS::drawTextBox );
CURRENT_TOOL( EE_ACTIONS::drawTable );
CURRENT_TOOL( EE_ACTIONS::placeImage );
CURRENT_TOOL( SCH_ACTIONS::highlightNetTool );
CURRENT_TOOL( SCH_ACTIONS::placeSymbol );
CURRENT_TOOL( SCH_ACTIONS::placePower );
CURRENT_TOOL( SCH_ACTIONS::placeDesignBlock );
CURRENT_TOOL( SCH_ACTIONS::drawWire );
CURRENT_TOOL( SCH_ACTIONS::drawBus );
CURRENT_TOOL( SCH_ACTIONS::placeBusWireEntry );
CURRENT_TOOL( SCH_ACTIONS::placeNoConnect );
CURRENT_TOOL( SCH_ACTIONS::placeJunction );
CURRENT_TOOL( SCH_ACTIONS::placeLabel );
CURRENT_TOOL( SCH_ACTIONS::placeClassLabel );
CURRENT_TOOL( SCH_ACTIONS::placeGlobalLabel );
CURRENT_TOOL( SCH_ACTIONS::placeHierLabel );
CURRENT_TOOL( SCH_ACTIONS::drawRuleArea );
CURRENT_TOOL( SCH_ACTIONS::drawSheet );
CURRENT_TOOL( SCH_ACTIONS::placeSheetPin );
CURRENT_TOOL( SCH_ACTIONS::syncSheetPins );
CURRENT_TOOL( SCH_ACTIONS::drawSheetFromFile );
CURRENT_TOOL( SCH_ACTIONS::drawSheetFromDesignBlock );
CURRENT_TOOL( SCH_ACTIONS::drawRectangle );
CURRENT_TOOL( SCH_ACTIONS::drawCircle );
CURRENT_TOOL( SCH_ACTIONS::drawArc );
CURRENT_TOOL( SCH_ACTIONS::drawBezier );
CURRENT_TOOL( SCH_ACTIONS::drawLines );
CURRENT_TOOL( SCH_ACTIONS::placeSchematicText );
CURRENT_TOOL( SCH_ACTIONS::drawTextBox );
CURRENT_TOOL( SCH_ACTIONS::drawTable );
CURRENT_TOOL( SCH_ACTIONS::placeImage );
#undef CURRENT_TOOL
#undef CHECK
@ -963,7 +955,7 @@ void SCH_EDIT_FRAME::HardRedraw()
GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
if( EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>() )
if( SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>() )
selectionTool->Reset( TOOL_BASE::REDRAW );
GetCanvas()->ForceRefresh();
@ -973,7 +965,7 @@ void SCH_EDIT_FRAME::HardRedraw()
bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
{
// Exit interactive editing
// Note this this will commit *some* pending changes. For instance, the EE_POINT_EDITOR
// Note this this will commit *some* pending changes. For instance, the SCH_POINT_EDITOR
// will cancel any drag currently in progress, but commit all changes from previous drags.
if( m_toolManager )
m_toolManager->RunAction( ACTIONS::cancelInteractive );
@ -1265,7 +1257,7 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
{
wxString findString;
EE_SELECTION& selection = m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
SCH_SELECTION& selection = m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
if( selection.Size() == 1 )
{
@ -2092,7 +2084,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
if( m_highlightedConnChanged
|| !Schematic().ConnectionGraph()->FindFirstSubgraphByName( highlightedConn ) )
{
GetToolManager()->RunAction( EE_ACTIONS::updateNetHighlighting );
GetToolManager()->RunAction( SCH_ACTIONS::updateNetHighlighting );
RefreshNetNavigator();
m_highlightedConnChanged = false;
}
@ -2239,7 +2231,7 @@ void SCH_EDIT_FRAME::UpdateNetHighlightStatus()
void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
{
if( m_toolManager )
m_toolManager->RunAction( EE_ACTIONS::clearSelection );
m_toolManager->RunAction( SCH_ACTIONS::clearSelection );
SCH_BASE_FRAME::SetScreen( aScreen );
GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
@ -2329,7 +2321,7 @@ wxString SCH_EDIT_FRAME::GetCurrentFileName() const
SELECTION& SCH_EDIT_FRAME::GetCurrentSelection()
{
return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
}
@ -2422,12 +2414,12 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
wxCHECK( m_toolManager, /* void */ );
m_toolManager->RunAction( ACTIONS::cancelInteractive );
m_toolManager->RunAction( EE_ACTIONS::clearSelection );
m_toolManager->RunAction( SCH_ACTIONS::clearSelection );
SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
wxCHECK( screen, /* void */ );
m_toolManager->RunAction( EE_ACTIONS::clearSelection );
m_toolManager->RunAction( SCH_ACTIONS::clearSelection );
SCH_BASE_FRAME::SetScreen( screen );
@ -2443,7 +2435,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
GetCurrentSheet().LastScreen()->TestDanglingEnds();
RefreshOperatingPointDisplay();
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
wxCHECK( selectionTool, /* void */ );

View File

@ -28,7 +28,7 @@
#include <base_units.h>
#include <bitmap_base.h>
#include <build_version.h>
#include <ee_selection.h>
#include <sch_selection.h>
#include <font/fontconfig.h>
#include <io/kicad/kicad_io_utils.h>
#include <locale_io.h>
@ -493,7 +493,7 @@ void SCH_IO_KICAD_SEXPR::Format( SCH_SHEET* aSheet )
}
void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelectionPath,
void SCH_IO_KICAD_SEXPR::Format( SCH_SELECTION* aSelection, SCH_SHEET_PATH* aSelectionPath,
SCHEMATIC& aSchematic, OUTPUTFORMATTER* aFormatter,
bool aForClipboard )
{

View File

@ -51,7 +51,7 @@ class SCH_TABLE;
class SCH_SYMBOL;
class SCH_FIELD;
struct SCH_SYMBOL_INSTANCE;
class EE_SELECTION;
class SCH_SELECTION;
class SCH_IO_KICAD_SEXPR_LIB_CACHE;
class LIB_SYMBOL;
class SYMBOL_LIB;
@ -103,7 +103,7 @@ public:
void Format( SCH_SHEET* aSheet );
void Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelectionPath,
void Format( SCH_SELECTION* aSelection, SCH_SHEET_PATH* aSelectionPath,
SCHEMATIC& aSchematic, OUTPUTFORMATTER* aFormatter, bool aForClipboard );
void EnumerateSymbolLib( wxArrayString& aSymbolNameList,

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <ee_collectors.h>
#include <sch_collectors.h>
#include <sch_commit.h>
#include <sch_edit_frame.h>
#include <widgets/msgpanel.h>

View File

@ -53,10 +53,8 @@ class KIID_PATH;
class SCH_SCREEN;
class LIB_SYMBOL;
class MSG_PANEL_ITEM;
class NETLIST_OBJECT_LIST;
class SYMBOL_LIB;
class SYMBOL_LIBS;
class EE_COLLECTOR;
class SCH_SCREEN;
class SCH_COMMIT;

View File

@ -22,7 +22,7 @@
#include <connection_graph.h>
#include <core/ignore.h>
#include <core/kicad_algo.h>
#include <ee_collectors.h>
#include <sch_collectors.h>
#include <erc/erc_settings.h>
#include <font/outline_font.h>
#include <netlist_exporter_spice.h>

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <ee_actions.h>
#include <sch_actions.h>
#include <sch_edit_frame.h>
#include <tool/tool_manager.h>
#include <schematic.h>
@ -33,7 +33,7 @@
#include <sch_bitmap.h>
#include <sch_sheet_pin.h>
#include <sch_table.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <tool/actions.h>
#include <wx/log.h>
@ -361,7 +361,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
refreshHierarchy = true;
if( static_cast<SCH_SHEET*>( eda_item )->GetScreen() == GetScreen() )
GetToolManager()->PostAction( EE_ACTIONS::leaveSheet );
GetToolManager()->PostAction( SCH_ACTIONS::leaveSheet );
}
RemoveFromScreen( eda_item, screen );
@ -563,7 +563,7 @@ void SCH_EDIT_FRAME::RollbackSchematicFromUndo()
delete undo;
m_toolManager->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
m_toolManager->GetTool<SCH_SELECTION_TOOL>()->RebuildSelection();
}
GetCanvas()->Refresh();

View File

@ -46,7 +46,7 @@
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tools/simulator_control.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <string_utils.h>
#include <pgm_base.h>
#include "ngspice.h"
@ -778,34 +778,34 @@ void SIMULATOR_FRAME::setupUIConditions()
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
// clang-format off
mgr->SetConditions( SCH_ACTIONS::openWorkbook, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( SCH_ACTIONS::saveWorkbook, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( SCH_ACTIONS::saveWorkbookAs, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::openWorkbook, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::saveWorkbook, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::saveWorkbookAs, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( SCH_ACTIONS::exportPlotAsPNG, ENABLE( havePlot ) );
mgr->SetConditions( SCH_ACTIONS::exportPlotAsCSV, ENABLE( havePlot ) );
mgr->SetConditions( SCH_ACTIONS::exportPlotToClipboard, ENABLE( havePlot ) );
mgr->SetConditions( SCH_ACTIONS::exportPlotToSchematic, ENABLE( havePlot ) );
mgr->SetConditions( EE_ACTIONS::exportPlotAsPNG, ENABLE( havePlot ) );
mgr->SetConditions( EE_ACTIONS::exportPlotAsCSV, ENABLE( havePlot ) );
mgr->SetConditions( EE_ACTIONS::exportPlotToClipboard, ENABLE( havePlot ) );
mgr->SetConditions( EE_ACTIONS::exportPlotToSchematic, ENABLE( havePlot ) );
mgr->SetConditions( ACTIONS::toggleSimulationSidePanel, CHECK( isSidePanelShown ) );
mgr->SetConditions( ACTIONS::toggleConsole, CHECK( isConsoleShown ) );
mgr->SetConditions( ACTIONS::toggleSimulationSidePanel, CHECK( isSidePanelShown ) );
mgr->SetConditions( ACTIONS::toggleConsole, CHECK( isConsoleShown ) );
mgr->SetConditions( ACTIONS::zoomUndo, ENABLE( haveZoomUndo ) );
mgr->SetConditions( ACTIONS::zoomRedo, ENABLE( haveZoomRedo ) );
mgr->SetConditions( EE_ACTIONS::toggleGrid, CHECK( showGridCondition ) );
mgr->SetConditions( EE_ACTIONS::toggleLegend, CHECK( showLegendCondition ) );
mgr->SetConditions( EE_ACTIONS::toggleDottedSecondary, CHECK( showDottedCondition ) );
mgr->SetConditions( EE_ACTIONS::toggleDarkModePlots, CHECK( darkModePlotCondition ) );
mgr->SetConditions( EE_ACTIONS::newAnalysisTab, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::simAnalysisProperties, ENABLE( haveSim ) );
mgr->SetConditions( EE_ACTIONS::runSimulation, ENABLE( !simRunning ) );
mgr->SetConditions( EE_ACTIONS::stopSimulation, ENABLE( simRunning ) );
mgr->SetConditions( EE_ACTIONS::simProbe, ENABLE( simFinished ) );
mgr->SetConditions( EE_ACTIONS::simTune, ENABLE( simFinished ) );
mgr->SetConditions( EE_ACTIONS::showNetlist, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( ACTIONS::zoomUndo, ENABLE( haveZoomUndo ) );
mgr->SetConditions( ACTIONS::zoomRedo, ENABLE( haveZoomRedo ) );
mgr->SetConditions( SCH_ACTIONS::toggleGrid, CHECK( showGridCondition ) );
mgr->SetConditions( SCH_ACTIONS::toggleLegend, CHECK( showLegendCondition ) );
mgr->SetConditions( SCH_ACTIONS::toggleDottedSecondary, CHECK( showDottedCondition ) );
mgr->SetConditions( SCH_ACTIONS::toggleDarkModePlots, CHECK( darkModePlotCondition ) );
mgr->SetConditions( SCH_ACTIONS::newAnalysisTab, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( SCH_ACTIONS::simAnalysisProperties, ENABLE( haveSim ) );
mgr->SetConditions( SCH_ACTIONS::runSimulation, ENABLE( !simRunning ) );
mgr->SetConditions( SCH_ACTIONS::stopSimulation, ENABLE( simRunning ) );
mgr->SetConditions( SCH_ACTIONS::simProbe, ENABLE( simFinished ) );
mgr->SetConditions( SCH_ACTIONS::simTune, ENABLE( simFinished ) );
mgr->SetConditions( SCH_ACTIONS::showNetlist, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
// clang-format on
#undef CHECK
#undef ENABLE
}

View File

@ -25,7 +25,7 @@
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <widgets/wx_menubar.h>
@ -42,16 +42,16 @@ std::optional<TOOLBAR_CONFIGURATION> SIMULATOR_TOOLBAR_SETTINGS::DefaultToolbarC
return std::nullopt;
case TOOLBAR_LOC::TOP_MAIN:
config.AppendAction( EE_ACTIONS::openWorkbook )
.AppendAction( EE_ACTIONS::saveWorkbook );
config.AppendAction( SCH_ACTIONS::openWorkbook )
.AppendAction( SCH_ACTIONS::saveWorkbook );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::newAnalysisTab )
.AppendAction( EE_ACTIONS::simAnalysisProperties );
.AppendAction( SCH_ACTIONS::newAnalysisTab )
.AppendAction( SCH_ACTIONS::simAnalysisProperties );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::runSimulation )
.AppendAction( EE_ACTIONS::stopSimulation );
.AppendAction( SCH_ACTIONS::runSimulation )
.AppendAction( SCH_ACTIONS::stopSimulation );
config.AppendSeparator()
.AppendAction( ACTIONS::zoomInCenter )
@ -63,12 +63,12 @@ std::optional<TOOLBAR_CONFIGURATION> SIMULATOR_TOOLBAR_SETTINGS::DefaultToolbarC
.AppendAction( ACTIONS::zoomFitScreen );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::simProbe )
.AppendAction( EE_ACTIONS::simTune );
.AppendAction( SCH_ACTIONS::simProbe )
.AppendAction( SCH_ACTIONS::simTune );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::editUserDefinedSignals )
.AppendAction( EE_ACTIONS::showNetlist );
.AppendAction( SCH_ACTIONS::editUserDefinedSignals )
.AppendAction( SCH_ACTIONS::showNetlist );
break;
}
@ -94,19 +94,19 @@ void SIMULATOR_FRAME::doReCreateMenuBar()
//
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
fileMenu->Add( EE_ACTIONS::newAnalysisTab );
fileMenu->Add( SCH_ACTIONS::newAnalysisTab );
fileMenu->AppendSeparator();
fileMenu->Add( EE_ACTIONS::openWorkbook );
fileMenu->Add( EE_ACTIONS::saveWorkbook );
fileMenu->Add( EE_ACTIONS::saveWorkbookAs );
fileMenu->Add( SCH_ACTIONS::openWorkbook );
fileMenu->Add( SCH_ACTIONS::saveWorkbook );
fileMenu->Add( SCH_ACTIONS::saveWorkbookAs );
fileMenu->AppendSeparator();
fileMenu->Add( EE_ACTIONS::exportPlotAsPNG );
fileMenu->Add( EE_ACTIONS::exportPlotAsCSV );
fileMenu->Add( SCH_ACTIONS::exportPlotAsPNG );
fileMenu->Add( SCH_ACTIONS::exportPlotAsCSV );
fileMenu->AppendSeparator();
fileMenu->Add( EE_ACTIONS::exportPlotToClipboard );
fileMenu->Add( EE_ACTIONS::exportPlotToSchematic );
fileMenu->Add( SCH_ACTIONS::exportPlotToClipboard );
fileMenu->Add( SCH_ACTIONS::exportPlotToSchematic );
fileMenu->AppendSeparator();
fileMenu->AddClose( _( "Simulator" ) );
@ -134,26 +134,26 @@ void SIMULATOR_FRAME::doReCreateMenuBar()
viewMenu->AppendSeparator();
viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleLegend, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleDottedSecondary, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::toggleDarkModePlots, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleLegend, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleDottedSecondary, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::toggleDarkModePlots, ACTION_MENU::CHECK );
//-- Simulation menu -----------------------------------------------------------
//
ACTION_MENU* simulationMenu = new ACTION_MENU( false, tool );
simulationMenu->Add( EE_ACTIONS::newAnalysisTab );
simulationMenu->Add( EE_ACTIONS::simAnalysisProperties );
simulationMenu->Add( EE_ACTIONS::runSimulation );
simulationMenu->Add( SCH_ACTIONS::newAnalysisTab );
simulationMenu->Add( SCH_ACTIONS::simAnalysisProperties );
simulationMenu->Add( SCH_ACTIONS::runSimulation );
simulationMenu->AppendSeparator();
simulationMenu->Add( EE_ACTIONS::simProbe );
simulationMenu->Add( EE_ACTIONS::simTune );
simulationMenu->Add( SCH_ACTIONS::simProbe );
simulationMenu->Add( SCH_ACTIONS::simTune );
simulationMenu->AppendSeparator();
simulationMenu->Add( EE_ACTIONS::editUserDefinedSignals );
simulationMenu->Add( EE_ACTIONS::showNetlist );
simulationMenu->Add( SCH_ACTIONS::editUserDefinedSignals );
simulationMenu->Add( SCH_ACTIONS::showNetlist );
//-- Preferences menu -----------------------------------------------
@ -161,7 +161,7 @@ void SIMULATOR_FRAME::doReCreateMenuBar()
ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
//prefsMenu->Add( ACTIONS::configurePaths );
//prefsMenu->Add( EE_ACTIONS::showSimLibTable );
//prefsMenu->Add( SCH_ACTIONS::showSimLibTable );
prefsMenu->Add( ACTIONS::openPreferences );
prefsMenu->AppendSeparator();

View File

@ -26,8 +26,8 @@
#include <bitmaps.h>
#include <tool/action_menu.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_actions.h>
#include <tools/sch_selection_tool.h>
#include <symbol_library_manager.h>
#include "symbol_edit_frame.h"
#include <widgets/wx_menubar.h>
@ -35,7 +35,7 @@
void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();
@ -47,14 +47,14 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
fileMenu->Add( ACTIONS::newLibrary );
fileMenu->Add( ACTIONS::addLibrary );
fileMenu->Add( EE_ACTIONS::saveLibraryAs );
fileMenu->Add( EE_ACTIONS::newSymbol );
fileMenu->Add( EE_ACTIONS::editLibSymbolWithLibEdit );
fileMenu->Add( SCH_ACTIONS::saveLibraryAs );
fileMenu->Add( SCH_ACTIONS::newSymbol );
fileMenu->Add( SCH_ACTIONS::editLibSymbolWithLibEdit );
fileMenu->AppendSeparator();
fileMenu->Add( ACTIONS::save );
fileMenu->Add( EE_ACTIONS::saveSymbolAs );
fileMenu->Add( EE_ACTIONS::saveSymbolCopyAs );
fileMenu->Add( SCH_ACTIONS::saveSymbolAs );
fileMenu->Add( SCH_ACTIONS::saveSymbolCopyAs );
if( !IsSymbolFromSchematic() )
fileMenu->Add( ACTIONS::saveAll );
@ -67,8 +67,8 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
submenuImport->SetTitle( _( "Import" ) );
submenuImport->SetIcon( BITMAPS::import );
submenuImport->Add( EE_ACTIONS::importSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) );
submenuImport->Add( EE_ACTIONS::importGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
submenuImport->Add( SCH_ACTIONS::importSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) );
submenuImport->Add( SCH_ACTIONS::importGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
fileMenu->Add( submenuImport );
@ -76,13 +76,13 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
submenuExport->SetTitle( _( "Export" ) );
submenuExport->SetIcon( BITMAPS::export_file );
submenuExport->Add( EE_ACTIONS::exportSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) );
submenuExport->Add( EE_ACTIONS::exportSymbolView, ACTION_MENU::NORMAL, _( "View as PNG..." ) );
submenuExport->Add( EE_ACTIONS::exportSymbolAsSVG, ACTION_MENU::NORMAL, _( "Symbol as SVG..." ) );
submenuExport->Add( SCH_ACTIONS::exportSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) );
submenuExport->Add( SCH_ACTIONS::exportSymbolView, ACTION_MENU::NORMAL, _( "View as PNG..." ) );
submenuExport->Add( SCH_ACTIONS::exportSymbolAsSVG, ACTION_MENU::NORMAL, _( "Symbol as SVG..." ) );
fileMenu->Add( submenuExport );
fileMenu->AppendSeparator();
fileMenu->Add( EE_ACTIONS::symbolProperties );
fileMenu->Add( SCH_ACTIONS::symbolProperties );
fileMenu->AppendSeparator();
fileMenu->AddClose( _( "Library Editor" ) );
@ -108,9 +108,9 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
editMenu->Add( ACTIONS::unselectAll );
editMenu->AppendSeparator();
editMenu->Add( EE_ACTIONS::pinTable );
editMenu->Add( EE_ACTIONS::setUnitDisplayName );
editMenu->Add( EE_ACTIONS::updateSymbolFields );
editMenu->Add( SCH_ACTIONS::pinTable );
editMenu->Add( SCH_ACTIONS::setUnitDisplayName );
editMenu->Add( SCH_ACTIONS::updateSymbolFields );
//-- View menu -----------------------------------------------
@ -134,24 +134,24 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
viewMenu->Add( ACTIONS::zoomRedraw );
viewMenu->AppendSeparator();
viewMenu->Add( EE_ACTIONS::showHiddenPins, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::showHiddenFields, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::togglePinAltIcons,ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::showHiddenPins, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::showHiddenFields, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::togglePinAltIcons, ACTION_MENU::CHECK );
//-- Place menu -----------------------------------------------
//
ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
placeMenu->Add( EE_ACTIONS::placeSymbolPin );
placeMenu->Add( EE_ACTIONS::placeSymbolText );
placeMenu->Add( EE_ACTIONS::drawSymbolTextBox );
placeMenu->Add( EE_ACTIONS::drawRectangle );
placeMenu->Add( EE_ACTIONS::drawCircle );
placeMenu->Add( EE_ACTIONS::drawArc );
placeMenu->Add( EE_ACTIONS::drawBezier );
placeMenu->Add( EE_ACTIONS::drawSymbolLines );
placeMenu->Add( EE_ACTIONS::drawSymbolPolygon );
placeMenu->Add( SCH_ACTIONS::placeSymbolPin );
placeMenu->Add( SCH_ACTIONS::placeSymbolText );
placeMenu->Add( SCH_ACTIONS::drawSymbolTextBox );
placeMenu->Add( SCH_ACTIONS::drawRectangle );
placeMenu->Add( SCH_ACTIONS::drawCircle );
placeMenu->Add( SCH_ACTIONS::drawArc );
placeMenu->Add( SCH_ACTIONS::drawBezier );
placeMenu->Add( SCH_ACTIONS::drawSymbolLines );
placeMenu->Add( SCH_ACTIONS::drawSymbolPolygon );
//-- Inspect menu -----------------------------------------------
@ -161,7 +161,7 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
inspectMenu->Add( ACTIONS::showDatasheet );
inspectMenu->AppendSeparator();
inspectMenu->Add( EE_ACTIONS::checkSymbol );
inspectMenu->Add( SCH_ACTIONS::checkSymbol );
//-- Preferences menu -----------------------------------------------

View File

@ -61,11 +61,11 @@
#include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h>
#include <tool/zoom_tool.h>
#include <tools/ee_actions.h>
#include <tools/ee_inspection_tool.h>
#include <tools/ee_point_editor.h>
#include <tools/sch_actions.h>
#include <tools/sch_inspection_tool.h>
#include <tools/sch_point_editor.h>
#include <tools/ee_grid_helper.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <tools/symbol_editor_control.h>
#include <tools/symbol_editor_drawing_tools.h>
#include <tools/symbol_editor_edit_tool.h>
@ -238,7 +238,7 @@ 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>();
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
selTool->GetFilter() = GetSettings()->m_SelectionFilter;
if( m_settings->m_LibWidth > 0 )
@ -348,7 +348,7 @@ void SYMBOL_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
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>();
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
m_settings->m_SelectionFilter = selTool->GetFilter();
}
@ -376,19 +376,19 @@ void SYMBOL_EDIT_FRAME::setupTools()
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
GetCanvas()->GetViewControls(), GetSettings(), this );
m_actions = new EE_ACTIONS();
m_actions = new SCH_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new EE_SELECTION_TOOL );
m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
m_toolManager->RegisterTool( new PICKER_TOOL );
m_toolManager->RegisterTool( new EE_INSPECTION_TOOL );
m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
m_toolManager->RegisterTool( new SYMBOL_EDITOR_PIN_TOOL );
m_toolManager->RegisterTool( new SYMBOL_EDITOR_DRAWING_TOOLS );
m_toolManager->RegisterTool( new EE_POINT_EDITOR );
m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
m_toolManager->RegisterTool( new SYMBOL_EDITOR_MOVE_TOOL );
m_toolManager->RegisterTool( new SYMBOL_EDITOR_EDIT_TOOL );
m_toolManager->RegisterTool( new LIBRARY_EDITOR_CONTROL );
@ -473,12 +473,12 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
// clang-format off
mgr->SetConditions( ACTIONS::saveAll, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
mgr->SetConditions( EE_ACTIONS::saveSymbolAs, ENABLE( saveSymbolAsCondition ) );
mgr->SetConditions( EE_ACTIONS::saveSymbolCopyAs, ENABLE( saveSymbolAsCondition ) );
mgr->SetConditions( EE_ACTIONS::newSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::importSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::editLibSymbolWithLibEdit, ENABLE( isSymbolFromSchematicCond ) );
mgr->SetConditions( SCH_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
mgr->SetConditions( SCH_ACTIONS::saveSymbolAs, ENABLE( saveSymbolAsCondition ) );
mgr->SetConditions( SCH_ACTIONS::saveSymbolCopyAs, ENABLE( saveSymbolAsCondition ) );
mgr->SetConditions( SCH_ACTIONS::newSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( SCH_ACTIONS::importSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( SCH_ACTIONS::editLibSymbolWithLibEdit, ENABLE( isSymbolFromSchematicCond ) );
mgr->SetConditions( ACTIONS::undo, ENABLE( haveSymbolCond && cond.UndoAvailable() ) );
mgr->SetConditions( ACTIONS::redo, ENABLE( haveSymbolCond && cond.RedoAvailable() ) );
@ -502,11 +502,11 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::unselectAll, ENABLE( haveSymbolCond ) );
// These actions in symbol editor when editing alias field rotations are allowed.
mgr->SetConditions( EE_ACTIONS::rotateCW, ENABLE( isEditableInAliasCond ) );
mgr->SetConditions( EE_ACTIONS::rotateCCW, ENABLE( isEditableInAliasCond ) );
mgr->SetConditions( SCH_ACTIONS::rotateCW, ENABLE( isEditableInAliasCond ) );
mgr->SetConditions( SCH_ACTIONS::rotateCCW, ENABLE( isEditableInAliasCond ) );
mgr->SetConditions( EE_ACTIONS::mirrorH, ENABLE( isEditableCond ) );
mgr->SetConditions( EE_ACTIONS::mirrorV, ENABLE( isEditableCond ) );
mgr->SetConditions( SCH_ACTIONS::mirrorH, ENABLE( isEditableCond ) );
mgr->SetConditions( SCH_ACTIONS::mirrorV, ENABLE( isEditableCond ) );
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
@ -548,13 +548,13 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
};
mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( pinTypeCond ) );
mgr->SetConditions( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) );
mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( showLibraryTreeCond ) );
mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
mgr->SetConditions( EE_ACTIONS::showHiddenPins, CHECK( hiddenPinCond ) );
mgr->SetConditions( EE_ACTIONS::showHiddenFields, CHECK( hiddenFieldCond ) );
mgr->SetConditions( EE_ACTIONS::togglePinAltIcons, CHECK( showPinAltIconsCond ) );
mgr->SetConditions( SCH_ACTIONS::showElectricalTypes, CHECK( pinTypeCond ) );
mgr->SetConditions( ACTIONS::toggleBoundingBoxes, CHECK( cond.BoundingBoxes() ) );
mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( showLibraryTreeCond ) );
mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
mgr->SetConditions( SCH_ACTIONS::showHiddenPins, CHECK( hiddenPinCond ) );
mgr->SetConditions( SCH_ACTIONS::showHiddenFields, CHECK( hiddenFieldCond ) );
mgr->SetConditions( SCH_ACTIONS::togglePinAltIcons, CHECK( showPinAltIconsCond ) );
auto demorganCond =
[this]( const SELECTION& )
@ -598,35 +598,31 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
return m_symbol && !m_symbol->GetDatasheetField().GetText().IsEmpty();
};
mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
mgr->SetConditions( EE_ACTIONS::symbolProperties, ENABLE( canEditProperties && haveSymbolCond ) );
mgr->SetConditions( EE_ACTIONS::runERC, ENABLE( haveSymbolCond ) );
mgr->SetConditions( EE_ACTIONS::pinTable, ENABLE( isEditableCond && haveSymbolCond ) );
mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
mgr->SetConditions( SCH_ACTIONS::symbolProperties, ENABLE( canEditProperties && haveSymbolCond ) );
mgr->SetConditions( SCH_ACTIONS::runERC, ENABLE( haveSymbolCond ) );
mgr->SetConditions( SCH_ACTIONS::pinTable, ENABLE( isEditableCond && haveSymbolCond ) );
mgr->SetConditions( EE_ACTIONS::showDeMorganStandard,
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
mgr->SetConditions( EE_ACTIONS::showDeMorganAlternate,
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
mgr->SetConditions( EE_ACTIONS::toggleSyncedPinsMode,
ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
mgr->SetConditions( EE_ACTIONS::setUnitDisplayName,
ACTION_CONDITIONS().Enable( isEditableCond && hasMultipleUnitsCond ) );
mgr->SetConditions( SCH_ACTIONS::showDeMorganStandard, ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
mgr->SetConditions( SCH_ACTIONS::showDeMorganAlternate, ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
mgr->SetConditions( SCH_ACTIONS::toggleSyncedPinsMode, ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
mgr->SetConditions( SCH_ACTIONS::setUnitDisplayName, ACTION_CONDITIONS().Enable( isEditableCond && hasMultipleUnitsCond ) );
// Only enable a tool if the symbol is edtable
#define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) )
mgr->SetConditions( ACTIONS::deleteTool, EDIT_TOOL( ACTIONS::deleteTool ) );
mgr->SetConditions( EE_ACTIONS::placeSymbolPin, EDIT_TOOL( EE_ACTIONS::placeSymbolPin ) );
mgr->SetConditions( EE_ACTIONS::placeSymbolText, EDIT_TOOL( EE_ACTIONS::placeSymbolText ) );
mgr->SetConditions( EE_ACTIONS::drawSymbolTextBox, EDIT_TOOL( EE_ACTIONS::drawSymbolTextBox ) );
mgr->SetConditions( EE_ACTIONS::drawRectangle, EDIT_TOOL( EE_ACTIONS::drawRectangle ) );
mgr->SetConditions( EE_ACTIONS::drawCircle, EDIT_TOOL( EE_ACTIONS::drawCircle ) );
mgr->SetConditions( EE_ACTIONS::drawArc, EDIT_TOOL( EE_ACTIONS::drawArc ) );
mgr->SetConditions( EE_ACTIONS::drawBezier, EDIT_TOOL( EE_ACTIONS::drawBezier ) );
mgr->SetConditions( EE_ACTIONS::drawSymbolLines, EDIT_TOOL( EE_ACTIONS::drawSymbolLines ) );
mgr->SetConditions( EE_ACTIONS::drawSymbolPolygon, EDIT_TOOL( EE_ACTIONS::drawSymbolPolygon ) );
mgr->SetConditions( EE_ACTIONS::placeSymbolAnchor, EDIT_TOOL( EE_ACTIONS::placeSymbolAnchor ) );
mgr->SetConditions( EE_ACTIONS::importGraphics, EDIT_TOOL( EE_ACTIONS::importGraphics ) );
mgr->SetConditions( SCH_ACTIONS::placeSymbolPin, EDIT_TOOL( SCH_ACTIONS::placeSymbolPin ) );
mgr->SetConditions( SCH_ACTIONS::placeSymbolText, EDIT_TOOL( SCH_ACTIONS::placeSymbolText ) );
mgr->SetConditions( SCH_ACTIONS::drawSymbolTextBox, EDIT_TOOL( SCH_ACTIONS::drawSymbolTextBox ) );
mgr->SetConditions( SCH_ACTIONS::drawRectangle, EDIT_TOOL( SCH_ACTIONS::drawRectangle ) );
mgr->SetConditions( SCH_ACTIONS::drawCircle, EDIT_TOOL( SCH_ACTIONS::drawCircle ) );
mgr->SetConditions( SCH_ACTIONS::drawArc, EDIT_TOOL( SCH_ACTIONS::drawArc ) );
mgr->SetConditions( SCH_ACTIONS::drawBezier, EDIT_TOOL( SCH_ACTIONS::drawBezier ) );
mgr->SetConditions( SCH_ACTIONS::drawSymbolLines, EDIT_TOOL( SCH_ACTIONS::drawSymbolLines ) );
mgr->SetConditions( SCH_ACTIONS::drawSymbolPolygon, EDIT_TOOL( SCH_ACTIONS::drawSymbolPolygon ) );
mgr->SetConditions( SCH_ACTIONS::placeSymbolAnchor, EDIT_TOOL( SCH_ACTIONS::placeSymbolAnchor ) );
mgr->SetConditions( SCH_ACTIONS::importGraphics, EDIT_TOOL( SCH_ACTIONS::importGraphics ) );
#undef CHECK
#undef ENABLE
@ -860,7 +856,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
{
wxCHECK( m_toolManager, /* void */ );
m_toolManager->RunAction( EE_ACTIONS::clearSelection );
m_toolManager->RunAction( SCH_ACTIONS::clearSelection );
GetCanvas()->GetView()->Clear();
delete m_symbol;
@ -920,7 +916,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
[this, symbolName, libName]( wxHyperlinkEvent& aEvent )
{
GetToolManager()->RunAction( EE_ACTIONS::editLibSymbolWithLibEdit );
GetToolManager()->RunAction( SCH_ACTIONS::editLibSymbolWithLibEdit );
} ) );
infobar.AddButton( button );
@ -1053,7 +1049,7 @@ void SYMBOL_EDIT_FRAME::SetUnit( int aUnit )
return;
m_toolManager->RunAction( ACTIONS::cancelInteractive );
m_toolManager->RunAction( EE_ACTIONS::clearSelection );
m_toolManager->RunAction( SCH_ACTIONS::clearSelection );
m_unit = aUnit;
@ -1462,8 +1458,8 @@ void SYMBOL_EDIT_FRAME::HardRedraw()
if( m_symbol )
{
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selectionTool->GetSelection();
SCH_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selectionTool->GetSelection();
for( SCH_ITEM& item : m_symbol->GetDrawItems() )
{
@ -1747,7 +1743,7 @@ void SYMBOL_EDIT_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItem
SELECTION& SYMBOL_EDIT_FRAME::GetCurrentSelection()
{
return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
}

View File

@ -30,7 +30,6 @@
#include <sch_base_frame.h>
#include <sch_screen.h>
#include <ee_collectors.h>
#include <symbol_tree_pane.h>
#include <optional>

View File

@ -29,7 +29,6 @@
#include <kidialog.h>
#include <kiway.h>
#include <widgets/wx_infobar.h>
#include <tools/ee_actions.h>
#include <tools/symbol_editor_drawing_tools.h>
#include <symbol_edit_frame.h>
#include <symbol_library.h>

View File

@ -27,8 +27,7 @@
#include <widgets/lib_tree.h>
#include <symbol_tree_pane.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <tools/symbol_editor_drawing_tools.h>

View File

@ -32,8 +32,8 @@
#include <toolbars_symbol_editor.h>
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_actions.h>
#include <tools/sch_selection_tool.h>
#include <widgets/sch_properties_panel.h>
#include <widgets/sch_properties_panel.h>
#include <widgets/wx_aui_utils.h>
@ -64,10 +64,10 @@ std::optional<TOOLBAR_CONFIGURATION> SYMBOL_EDIT_TOOLBAR_SETTINGS::DefaultToolba
.AppendAction( ACTIONS::toggleCursorStyle );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::showElectricalTypes )
.AppendAction( EE_ACTIONS::showHiddenPins )
.AppendAction( EE_ACTIONS::showHiddenFields );
// .AppendAction( EE_ACTIONS::togglePinAltIcons );
.AppendAction( SCH_ACTIONS::showElectricalTypes )
.AppendAction( SCH_ACTIONS::showHiddenPins )
.AppendAction( SCH_ACTIONS::showHiddenFields );
// .AppendAction( SCH_ACTIONS::togglePinAltIcons );
if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
config.AppendAction( ACTIONS::toggleBoundingBoxes );
@ -88,21 +88,21 @@ std::optional<TOOLBAR_CONFIGURATION> SYMBOL_EDIT_TOOLBAR_SETTINGS::DefaultToolba
config.AppendAction( ACTIONS::selectionTool );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::placeSymbolPin )
.AppendAction( EE_ACTIONS::placeSymbolText )
.AppendAction( EE_ACTIONS::drawSymbolTextBox )
.AppendAction( EE_ACTIONS::drawRectangle )
.AppendAction( EE_ACTIONS::drawCircle )
.AppendAction( EE_ACTIONS::drawArc )
.AppendAction( EE_ACTIONS::drawBezier )
.AppendAction( EE_ACTIONS::drawSymbolLines )
.AppendAction( EE_ACTIONS::drawSymbolPolygon )
.AppendAction( EE_ACTIONS::placeSymbolAnchor )
.AppendAction( SCH_ACTIONS::placeSymbolPin )
.AppendAction( SCH_ACTIONS::placeSymbolText )
.AppendAction( SCH_ACTIONS::drawSymbolTextBox )
.AppendAction( SCH_ACTIONS::drawRectangle )
.AppendAction( SCH_ACTIONS::drawCircle )
.AppendAction( SCH_ACTIONS::drawArc )
.AppendAction( SCH_ACTIONS::drawBezier )
.AppendAction( SCH_ACTIONS::drawSymbolLines )
.AppendAction( SCH_ACTIONS::drawSymbolPolygon )
.AppendAction( SCH_ACTIONS::placeSymbolAnchor )
.AppendAction( ACTIONS::deleteTool);
break;
case TOOLBAR_LOC::TOP_MAIN:
config.AppendAction( EE_ACTIONS::newSymbol );
config.AppendAction( SCH_ACTIONS::newSymbol );
/* TODO (ISM): Handle visibility changes
if( !IsSymbolFromSchematic() )
@ -123,31 +123,31 @@ std::optional<TOOLBAR_CONFIGURATION> SYMBOL_EDIT_TOOLBAR_SETTINGS::DefaultToolba
.AppendAction( ACTIONS::zoomTool );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::rotateCCW )
.AppendAction( EE_ACTIONS::rotateCW )
.AppendAction( EE_ACTIONS::mirrorV )
.AppendAction( EE_ACTIONS::mirrorH );
.AppendAction( SCH_ACTIONS::rotateCCW )
.AppendAction( SCH_ACTIONS::rotateCW )
.AppendAction( SCH_ACTIONS::mirrorV )
.AppendAction( SCH_ACTIONS::mirrorH );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::symbolProperties )
.AppendAction( EE_ACTIONS::pinTable );
.AppendAction( SCH_ACTIONS::symbolProperties )
.AppendAction( SCH_ACTIONS::pinTable );
config.AppendSeparator()
.AppendAction( ACTIONS::showDatasheet )
.AppendAction( EE_ACTIONS::checkSymbol );
.AppendAction( SCH_ACTIONS::checkSymbol );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::showDeMorganStandard )
.AppendAction( EE_ACTIONS::showDeMorganAlternate );
.AppendAction( SCH_ACTIONS::showDeMorganStandard )
.AppendAction( SCH_ACTIONS::showDeMorganAlternate );
config.AppendSeparator()
.AppendControl( ACTION_TOOLBAR_CONTROLS::unitSelector );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::toggleSyncedPinsMode );
.AppendAction( SCH_ACTIONS::toggleSyncedPinsMode );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::addSymbolToSchematic );
.AppendAction( SCH_ACTIONS::addSymbolToSchematic );
break;
}

View File

@ -56,9 +56,9 @@
#include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h>
#include <tool/zoom_tool.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <tools/symbol_editor_control.h>
#include <tools/ee_inspection_tool.h>
#include <tools/sch_inspection_tool.h>
#include <view/view_controls.h>
#include <wx/srchctrl.h>
#include <wx/log.h>
@ -324,15 +324,15 @@ void SYMBOL_VIEWER_FRAME::setupTools()
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
GetCanvas()->GetViewControls(), config(), this );
m_actions = new EE_ACTIONS();
m_actions = new SCH_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
// Register tools
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new EE_INSPECTION_TOOL ); // manage show datasheet
m_toolManager->RegisterTool( new EE_SELECTION_TOOL ); // manage context menu
m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL ); // manage show datasheet
m_toolManager->RegisterTool( new SCH_SELECTION_TOOL ); // manage context menu
m_toolManager->RegisterTool( new SYMBOL_EDITOR_CONTROL ); // manage render settings
m_toolManager->InitTools();
@ -397,14 +397,12 @@ void SYMBOL_VIEWER_FRAME::setupUIConditions()
return symbol && !symbol->GetDatasheetField().GetText().IsEmpty();
};
mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( electricalTypesShownCondition ) );
mgr->SetConditions( EE_ACTIONS::showPinNumbers, CHECK( pinNumbersShownCondition ) );
mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
mgr->SetConditions( SCH_ACTIONS::showElectricalTypes, CHECK( electricalTypesShownCondition ) );
mgr->SetConditions( SCH_ACTIONS::showPinNumbers, CHECK( pinNumbersShownCondition ) );
mgr->SetConditions( EE_ACTIONS::showDeMorganStandard,
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
mgr->SetConditions( EE_ACTIONS::showDeMorganAlternate,
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
mgr->SetConditions( SCH_ACTIONS::showDeMorganStandard, ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
mgr->SetConditions( SCH_ACTIONS::showDeMorganAlternate, ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
#undef CHECK
#undef ENABLE
@ -847,7 +845,7 @@ void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName )
void SYMBOL_VIEWER_FRAME::DClickOnSymbolList( wxCommandEvent& event )
{
m_toolManager->RunAction( EE_ACTIONS::addSymbolToSchematic );
m_toolManager->RunAction( SCH_ACTIONS::addSymbolToSchematic );
}
@ -1121,7 +1119,7 @@ void SYMBOL_VIEWER_FRAME::DisplayLibInfos()
SELECTION& SYMBOL_VIEWER_FRAME::GetCurrentSelection()
{
return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
return m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
}

View File

@ -35,8 +35,8 @@
#include <python_scripting.h>
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_actions.h>
#include <tools/sch_selection_tool.h>
#include <widgets/design_block_pane.h>
#include <widgets/hierarchy_pane.h>
#include <widgets/wx_aui_utils.h>
@ -64,18 +64,18 @@ std::optional<TOOLBAR_CONFIGURATION> SCH_EDIT_TOOLBAR_SETTINGS::DefaultToolbarCo
.AppendAction( ACTIONS::toggleCursorStyle );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::toggleHiddenPins );
.AppendAction( SCH_ACTIONS::toggleHiddenPins );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::lineModeFree )
.AppendAction( EE_ACTIONS::lineMode90 )
.AppendAction( EE_ACTIONS::lineMode45 );
.AppendAction( SCH_ACTIONS::lineModeFree )
.AppendAction( SCH_ACTIONS::lineMode90 )
.AppendAction( SCH_ACTIONS::lineMode45 );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::toggleAnnotateAuto );
.AppendAction( SCH_ACTIONS::toggleAnnotateAuto );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::showHierarchy )
.AppendAction( SCH_ACTIONS::showHierarchy )
.AppendAction( ACTIONS::showProperties );
if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
@ -91,35 +91,35 @@ std::optional<TOOLBAR_CONFIGURATION> SCH_EDIT_TOOLBAR_SETTINGS::DefaultToolbarCo
case TOOLBAR_LOC::RIGHT:
config.AppendAction( ACTIONS::selectionTool )
.AppendAction( EE_ACTIONS::highlightNetTool );
.AppendAction( SCH_ACTIONS::highlightNetTool );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::placeSymbol )
.AppendAction( EE_ACTIONS::placePower )
.AppendAction( EE_ACTIONS::drawWire )
.AppendAction( EE_ACTIONS::drawBus )
.AppendAction( EE_ACTIONS::placeBusWireEntry )
.AppendAction( EE_ACTIONS::placeNoConnect )
.AppendAction( EE_ACTIONS::placeJunction )
.AppendAction( EE_ACTIONS::placeLabel )
.AppendAction( EE_ACTIONS::placeClassLabel )
.AppendAction( EE_ACTIONS::drawRuleArea )
.AppendAction( EE_ACTIONS::placeGlobalLabel )
.AppendAction( EE_ACTIONS::placeHierLabel )
.AppendAction( EE_ACTIONS::drawSheet )
.AppendAction( EE_ACTIONS::placeSheetPin )
.AppendAction( EE_ACTIONS::syncAllSheetsPins );
.AppendAction( SCH_ACTIONS::placeSymbol )
.AppendAction( SCH_ACTIONS::placePower )
.AppendAction( SCH_ACTIONS::drawWire )
.AppendAction( SCH_ACTIONS::drawBus )
.AppendAction( SCH_ACTIONS::placeBusWireEntry )
.AppendAction( SCH_ACTIONS::placeNoConnect )
.AppendAction( SCH_ACTIONS::placeJunction )
.AppendAction( SCH_ACTIONS::placeLabel )
.AppendAction( SCH_ACTIONS::placeClassLabel )
.AppendAction( SCH_ACTIONS::drawRuleArea )
.AppendAction( SCH_ACTIONS::placeGlobalLabel )
.AppendAction( SCH_ACTIONS::placeHierLabel )
.AppendAction( SCH_ACTIONS::drawSheet )
.AppendAction( SCH_ACTIONS::placeSheetPin )
.AppendAction( SCH_ACTIONS::syncAllSheetsPins );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::placeSchematicText )
.AppendAction( EE_ACTIONS::drawTextBox )
.AppendAction( EE_ACTIONS::drawTable )
.AppendAction( EE_ACTIONS::drawRectangle )
.AppendAction( EE_ACTIONS::drawCircle )
.AppendAction( EE_ACTIONS::drawArc )
.AppendAction( EE_ACTIONS::drawBezier )
.AppendAction( EE_ACTIONS::drawLines )
.AppendAction( EE_ACTIONS::placeImage )
.AppendAction( SCH_ACTIONS::placeSchematicText )
.AppendAction( SCH_ACTIONS::drawTextBox )
.AppendAction( SCH_ACTIONS::drawTable )
.AppendAction( SCH_ACTIONS::drawRectangle )
.AppendAction( SCH_ACTIONS::drawCircle )
.AppendAction( SCH_ACTIONS::drawArc )
.AppendAction( SCH_ACTIONS::drawBezier )
.AppendAction( SCH_ACTIONS::drawLines )
.AppendAction( SCH_ACTIONS::placeImage )
.AppendAction( ACTIONS::deleteTool );
break;
@ -134,7 +134,7 @@ std::optional<TOOLBAR_CONFIGURATION> SCH_EDIT_TOOLBAR_SETTINGS::DefaultToolbarCo
config.AppendAction( ACTIONS::save );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::schematicSetup );
.AppendAction( SCH_ACTIONS::schematicSetup );
config.AppendSeparator()
.AppendAction( ACTIONS::pageSettings )
@ -161,15 +161,15 @@ std::optional<TOOLBAR_CONFIGURATION> SCH_EDIT_TOOLBAR_SETTINGS::DefaultToolbarCo
.AppendAction( ACTIONS::zoomTool );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::navigateBack )
.AppendAction( EE_ACTIONS::navigateUp )
.AppendAction( EE_ACTIONS::navigateForward );
.AppendAction( SCH_ACTIONS::navigateBack )
.AppendAction( SCH_ACTIONS::navigateUp )
.AppendAction( SCH_ACTIONS::navigateForward );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::rotateCCW )
.AppendAction( EE_ACTIONS::rotateCW )
.AppendAction( EE_ACTIONS::mirrorV )
.AppendAction( EE_ACTIONS::mirrorH );
.AppendAction( SCH_ACTIONS::rotateCCW )
.AppendAction( SCH_ACTIONS::rotateCW )
.AppendAction( SCH_ACTIONS::mirrorV )
.AppendAction( SCH_ACTIONS::mirrorH );
config.AppendSeparator()
.AppendAction( ACTIONS::showSymbolEditor )
@ -177,15 +177,15 @@ std::optional<TOOLBAR_CONFIGURATION> SCH_EDIT_TOOLBAR_SETTINGS::DefaultToolbarCo
.AppendAction( ACTIONS::showFootprintEditor );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::annotate )
.AppendAction( EE_ACTIONS::runERC )
.AppendAction( EE_ACTIONS::showSimulator )
.AppendAction( EE_ACTIONS::assignFootprints )
.AppendAction( EE_ACTIONS::editSymbolFields )
.AppendAction( EE_ACTIONS::generateBOM );
.AppendAction( SCH_ACTIONS::annotate )
.AppendAction( SCH_ACTIONS::runERC )
.AppendAction( SCH_ACTIONS::showSimulator )
.AppendAction( SCH_ACTIONS::assignFootprints )
.AppendAction( SCH_ACTIONS::editSymbolFields )
.AppendAction( SCH_ACTIONS::generateBOM );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::showPcbNew );
.AppendAction( SCH_ACTIONS::showPcbNew );
// Insert all the IPC plugins here on the toolbar
// TODO (ISM): Move this to individual actions for each script

View File

@ -28,7 +28,7 @@
#include <sch_painter.h>
#include <tool/action_menu.h>
#include <tool/action_toolbar.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <tools/symbol_editor_control.h>
#include <widgets/wx_menubar.h>
#include <toolbars_symbol_viewer.h>
@ -63,12 +63,12 @@ std::optional<TOOLBAR_CONFIGURATION> SYMBOL_VIEWER_TOOLBAR_SETTINGS::DefaultTool
.AppendAction( ACTIONS::zoomFitScreen );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::showElectricalTypes )
.AppendAction( EE_ACTIONS::showPinNumbers );
.AppendAction( SCH_ACTIONS::showElectricalTypes )
.AppendAction( SCH_ACTIONS::showPinNumbers );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::showDeMorganStandard )
.AppendAction( EE_ACTIONS::showDeMorganAlternate );
.AppendAction( SCH_ACTIONS::showDeMorganStandard )
.AppendAction( SCH_ACTIONS::showDeMorganAlternate );
config.AppendSeparator()
.AppendControl( ACTION_TOOLBAR_CONTROLS::unitSelector );
@ -77,7 +77,7 @@ std::optional<TOOLBAR_CONFIGURATION> SYMBOL_VIEWER_TOOLBAR_SETTINGS::DefaultTool
.AppendAction( ACTIONS::showDatasheet );
config.AppendSeparator()
.AppendAction( EE_ACTIONS::addSymbolToSchematic );
.AppendAction( SCH_ACTIONS::addSymbolToSchematic );
break;
}
@ -134,8 +134,8 @@ void SYMBOL_VIEWER_FRAME::doReCreateMenuBar()
viewMenu->AppendSeparator();
viewMenu->AppendSeparator();
viewMenu->Add( EE_ACTIONS::showElectricalTypes, ACTION_MENU::CHECK );
viewMenu->Add( EE_ACTIONS::showPinNumbers, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::showElectricalTypes, ACTION_MENU::CHECK );
viewMenu->Add( SCH_ACTIONS::showPinNumbers, ACTION_MENU::CHECK );
//-- Menubar -------------------------------------------------------------

View File

@ -68,7 +68,7 @@ EE_GRID_HELPER::~EE_GRID_HELPER()
VECTOR2I EE_GRID_HELPER::BestDragOrigin( const VECTOR2I& aMousePos, GRID_HELPER_GRIDS aGrid,
const EE_SELECTION& aItems )
const SCH_SELECTION& aItems )
{
clearAnchors();
@ -130,7 +130,7 @@ VECTOR2I EE_GRID_HELPER::BestDragOrigin( const VECTOR2I& aMousePos, GRID_HELPER_
VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, GRID_HELPER_GRIDS aGrid,
SCH_ITEM* aSkip )
{
EE_SELECTION skipItems;
SCH_SELECTION skipItems;
skipItems.Add( aSkip );
return BestSnapAnchor( aOrigin, aGrid, skipItems );
@ -138,7 +138,7 @@ VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, GRID_HELPER_GR
VECTOR2I EE_GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, GRID_HELPER_GRIDS aGrid,
const EE_SELECTION& aSkip )
const SCH_SELECTION& aSkip )
{
constexpr int snapRange = SNAP_RANGE * schIUScale.IU_PER_MILS;
@ -321,7 +321,7 @@ SCH_ITEM* EE_GRID_HELPER::GetSnapped() const
std::set<SCH_ITEM*> EE_GRID_HELPER::queryVisible( const BOX2I& aArea,
const EE_SELECTION& aSkipList ) const
const SCH_SELECTION& aSkipList ) const
{
std::set<SCH_ITEM*> items;
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;

View File

@ -29,7 +29,7 @@
#include <math/vector2d.h>
#include <origin_viewitem.h>
#include <tool/grid_helper.h>
#include <ee_selection.h>
#include <sch_selection.h>
class SCH_ITEM;
@ -57,14 +57,14 @@ public:
GRID_HELPER_GRIDS GetItemGrid( const EDA_ITEM* aItem ) const override;
VECTOR2I BestDragOrigin( const VECTOR2I& aMousePos, GRID_HELPER_GRIDS aGrid,
const EE_SELECTION& aItems );
const SCH_SELECTION& aItems );
VECTOR2I BestSnapAnchor( const VECTOR2I& aOrigin, GRID_HELPER_GRIDS aGrid, SCH_ITEM* aSkip );
VECTOR2I BestSnapAnchor( const VECTOR2I& aOrigin, GRID_HELPER_GRIDS aGrid,
const EE_SELECTION& aSkip = {} );
const SCH_SELECTION& aSkip = {} );
private:
std::set<SCH_ITEM*> queryVisible( const BOX2I& aArea, const EE_SELECTION& aSkipList ) const;
std::set<SCH_ITEM*> queryVisible( const BOX2I& aArea, const SCH_SELECTION& aSkipList ) const;
ANCHOR* nearestAnchor( const VECTOR2I& aPos, int aFlags, GRID_HELPER_GRIDS aGrid );

View File

@ -28,7 +28,7 @@
#include <sch_edit_frame.h>
#include <sch_rule_area.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <tools/rule_area_create_helper.h>
@ -68,7 +68,7 @@ void RULE_AREA_CREATE_HELPER::commitRuleArea( std::unique_ptr<SCH_RULE_AREA> aRu
commit.Add( ruleArea, m_frame->GetScreen() );
commit.Push( _( "Draw Rule Area" ) );
m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, ruleArea );
m_toolManager->RunAction<EDA_ITEM*>( SCH_ACTIONS::addItemToSel, ruleArea );
m_parentView.ClearPreview();
}
@ -80,7 +80,7 @@ bool RULE_AREA_CREATE_HELPER::OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr )
if( m_rule_area )
{
m_toolManager->RunAction( EE_ACTIONS::clearSelection );
m_toolManager->RunAction( SCH_ACTIONS::clearSelection );
SCH_RENDER_SETTINGS renderSettings;
COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();

View File

@ -35,7 +35,7 @@ class TOOL_MANAGER;
* Gather all the actions that are shared by tools. The instance of SCH_ACTIONS is created
* inside of ACTION_MANAGER object that registers the actions.
*/
class EE_ACTIONS : public ACTIONS
class SCH_ACTIONS : public ACTIONS
{
public:
// Menu bar save curr sheet as command

View File

@ -25,13 +25,13 @@
#include <design_block_pane.h>
#include <panel_design_block_chooser.h>
#include <dialog_design_block_properties.h>
#include <ee_actions.h>
#include <sch_actions.h>
bool SCH_DESIGN_BLOCK_CONTROL::Init()
{
m_editFrame = getEditFrame<SCH_EDIT_FRAME>();
m_frame = m_editFrame;
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
auto pinnedLib =
[this]( const SELECTION& aSel )
@ -67,21 +67,21 @@ bool SCH_DESIGN_BLOCK_CONTROL::Init()
CONDITIONAL_MENU& ctxMenu = m_menu->GetMenu();
ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLib, 1 );
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLib, 1 );
ctxMenu.AddItem( ACTIONS::newLibrary, !isDesignBlock, 1 );
ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLib, 1 );
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLib, 1 );
ctxMenu.AddItem( ACTIONS::newLibrary, !isDesignBlock, 1 );
ctxMenu.AddSeparator( 1 );
ctxMenu.AddItem( EE_ACTIONS::placeDesignBlock, isDesignBlock, 50 );
ctxMenu.AddItem( SCH_ACTIONS::placeDesignBlock, isDesignBlock, 50 );
ctxMenu.AddSeparator( 50 );
ctxMenu.AddItem( EE_ACTIONS::editDesignBlockProperties, isDesignBlock, 100 );
ctxMenu.AddItem( EE_ACTIONS::saveSheetAsDesignBlock, isInLibrary, 100 );
ctxMenu.AddItem( EE_ACTIONS::saveSelectionAsDesignBlock, isInLibrary, 100 );
ctxMenu.AddItem( EE_ACTIONS::deleteDesignBlock, isDesignBlock, 100 );
ctxMenu.AddItem( SCH_ACTIONS::editDesignBlockProperties, isDesignBlock, 100 );
ctxMenu.AddItem( SCH_ACTIONS::saveSheetAsDesignBlock, isInLibrary, 100 );
ctxMenu.AddItem( SCH_ACTIONS::saveSelectionAsDesignBlock, isInLibrary, 100 );
ctxMenu.AddItem( SCH_ACTIONS::deleteDesignBlock, isDesignBlock, 100 );
ctxMenu.AddSeparator( 100 );
ctxMenu.AddItem( ACTIONS::hideLibraryTree, SELECTION_CONDITIONS::ShowAlways, 400 );
ctxMenu.AddItem( ACTIONS::hideLibraryTree, SELECTION_CONDITIONS::ShowAlways, 400 );
return true;
}
@ -194,10 +194,10 @@ void SCH_DESIGN_BLOCK_CONTROL::setTransitions()
Go( &SCH_DESIGN_BLOCK_CONTROL::NewLibrary, ACTIONS::newLibrary.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::SaveSheetAsDesignBlock, EE_ACTIONS::saveSheetAsDesignBlock.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock, EE_ACTIONS::saveSelectionAsDesignBlock.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::DeleteDesignBlock, EE_ACTIONS::deleteDesignBlock.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::EditDesignBlockProperties, EE_ACTIONS::editDesignBlockProperties.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::SaveSheetAsDesignBlock, SCH_ACTIONS::saveSheetAsDesignBlock.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock, SCH_ACTIONS::saveSelectionAsDesignBlock.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::DeleteDesignBlock, SCH_ACTIONS::deleteDesignBlock.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::EditDesignBlockProperties, SCH_ACTIONS::editDesignBlockProperties.MakeEvent() );
Go( &SCH_DESIGN_BLOCK_CONTROL::HideLibraryTree, ACTIONS::hideLibraryTree.MakeEvent() );
}

View File

@ -26,15 +26,17 @@
#define SCH_DESIGN_BLOCK_CONTROL_H
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
/**
* Handle schematic design block actions in the schematic editor.
*/
class SCH_DESIGN_BLOCK_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<SCH_BASE_FRAME>
class SCH_DESIGN_BLOCK_CONTROL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_BASE_FRAME>
{
public:
SCH_DESIGN_BLOCK_CONTROL() : EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.SchDesignBlockControl" ) {}
SCH_DESIGN_BLOCK_CONTROL() :
SCH_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.SchDesignBlockControl" )
{}
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;

View File

@ -30,13 +30,13 @@
#include <project_sch.h>
#include <tools/sch_drawing_tools.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <tools/ee_grid_helper.h>
#include <tools/rule_area_create_helper.h>
#include <gal/graphics_abstraction_layer.h>
#include <design_block_lib_table.h>
#include <ee_actions.h>
#include <ee_tool_utils.h>
#include <sch_actions.h>
#include <sch_tool_utils.h>
#include <sch_edit_frame.h>
#include <pgm_base.h>
#include <design_block.h>
@ -77,7 +77,7 @@
#include <wx/msgdlg.h>
SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" ),
SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" ),
m_lastSheetPinType( LABEL_FLAG_SHAPE::L_INPUT ),
m_lastGlobalLabelShape( LABEL_FLAG_SHAPE::L_INPUT ),
m_lastNetClassFlagShape( LABEL_FLAG_SHAPE::F_ROUND ),
@ -106,7 +106,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
bool SCH_DRAWING_TOOLS::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
auto belowRootSheetCondition =
[&]( const SELECTION& aSel )
@ -121,9 +121,9 @@ bool SCH_DRAWING_TOOLS::Init()
};
CONDITIONAL_MENU& ctxMenu = m_menu->GetMenu();
ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 150 );
ctxMenu.AddItem( EE_ACTIONS::closeOutline, inDrawingRuleArea, 200 );
ctxMenu.AddItem( EE_ACTIONS::deleteLastPoint, inDrawingRuleArea, 200 );
ctxMenu.AddItem( SCH_ACTIONS::leaveSheet, belowRootSheetCondition, 150 );
ctxMenu.AddItem( SCH_ACTIONS::closeOutline, inDrawingRuleArea, 200 );
ctxMenu.AddItem( SCH_ACTIONS::deleteLastPoint, inDrawingRuleArea, 200 );
return true;
}
@ -131,8 +131,8 @@ bool SCH_DRAWING_TOOLS::Init()
int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
{
const EE_ACTIONS::PLACE_SYMBOL_PARAMS& toolParams =
aEvent.Parameter<EE_ACTIONS::PLACE_SYMBOL_PARAMS>();
const SCH_ACTIONS::PLACE_SYMBOL_PARAMS& toolParams =
aEvent.Parameter<SCH_ACTIONS::PLACE_SYMBOL_PARAMS>();
SCH_SYMBOL* symbol = toolParams.m_Symbol;
// If we get an parameterised symbol, we probably just want to place
@ -168,11 +168,11 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
hierarchy.GetSymbols( existingRefs );
existingRefs.SortByReferenceOnly();
if( aEvent.IsAction( &EE_ACTIONS::placeSymbol ) )
if( aEvent.IsAction( &SCH_ACTIONS::placeSymbol ) )
{
historyList = &m_symbolHistoryList;
}
else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
else if (aEvent.IsAction( &SCH_ACTIONS::placePower ) )
{
historyList = &m_powerHistoryList;
filter.FilterPowerSymbols( true );
@ -187,7 +187,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
auto addSymbol =
[this]( SCH_SYMBOL* aSymbol )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_selectionTool->AddItemToSel( aSymbol );
aSymbol->SetFlags( IS_NEW | IS_MOVING );
@ -210,7 +210,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
auto cleanup =
[&]()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete symbol;
symbol = nullptr;
@ -337,7 +337,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
{
if( !symbol )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
SYMBOL_LIB_TABLE* libs = PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() );
SYMBOL_LIB* cache = PROJECT_SCH::SchLibs( &m_frame->Prj() )->GetCacheLibrary();
@ -542,7 +542,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
}
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
{
if( symbol )
{
@ -597,7 +597,7 @@ int SCH_DRAWING_TOOLS::PlaceNextSymbolUnit( const TOOL_EVENT& aEvent )
if( !symbol )
{
static const std::vector<KICAD_T> symbolTypes = { SCH_SYMBOL_T };
EE_SELECTION& selection = m_selectionTool->RequestSelection( symbolTypes );
SCH_SELECTION& selection = m_selectionTool->RequestSelection( symbolTypes );
if( selection.Size() != 1 )
{
@ -637,15 +637,15 @@ int SCH_DRAWING_TOOLS::PlaceNextSymbolUnit( const TOOL_EVENT& aEvent )
newSymbol->SetRefProp( symbol->GetRef( &sheetPath, false ) );
// Post the new symbol - don't reannotate it - we set the reference ourselves
m_toolMgr->PostAction( EE_ACTIONS::placeSymbol,
EE_ACTIONS::PLACE_SYMBOL_PARAMS{ newSymbol.release(), false } );
m_toolMgr->PostAction( SCH_ACTIONS::placeSymbol,
SCH_ACTIONS::PLACE_SYMBOL_PARAMS{ newSymbol.release(), false } );
return 0;
}
int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
{
bool placingDesignBlock = aEvent.IsAction( &EE_ACTIONS::placeDesignBlock );
bool placingDesignBlock = aEvent.IsAction( &SCH_ACTIONS::placeDesignBlock );
DESIGN_BLOCK* designBlock = nullptr;
wxString sheetFileName = wxEmptyString;
@ -697,10 +697,11 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
auto placeSheetContents =
[&]()
{
SCH_COMMIT commit( m_toolMgr );
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EDA_ITEMS newItems;
bool keepAnnotations = cfg->m_DesignBlockChooserPanel.keep_annotations;
SCH_COMMIT commit( m_toolMgr );
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
EDA_ITEMS newItems;
bool keepAnnotations = cfg->m_DesignBlockChooserPanel.keep_annotations;
selectionTool->ClearSelection();
@ -775,7 +776,7 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
}
// Start moving selection, cancel undoes the insertion
bool placed = m_toolMgr->RunSynchronousAction( EE_ACTIONS::move, &commit );
bool placed = m_toolMgr->RunSynchronousAction( SCH_ACTIONS::move, &commit );
// Update our cursor position to the new location in case we're placing repeated copies
cursorPos = grid.Align( controls->GetMousePosition(), GRID_HELPER_GRIDS::GRID_CONNECTABLE );
@ -839,7 +840,7 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
while( placeSheetContents() && cfg->m_DesignBlockChooserPanel.repeated_placement )
;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete designBlock;
designBlock = nullptr;
@ -886,11 +887,13 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) || isSyntheticClick )
{
if( placingDesignBlock )
m_toolMgr->PostAction( EE_ACTIONS::drawSheetFromDesignBlock, designBlock );
{
m_toolMgr->PostAction( SCH_ACTIONS::drawSheetFromDesignBlock, designBlock );
}
else
{
// drawSheet must delete
m_toolMgr->PostAction( EE_ACTIONS::drawSheetFromFile,
m_toolMgr->PostAction( SCH_ACTIONS::drawSheetFromFile,
new wxString( sheetFileName ) );
}
@ -905,7 +908,7 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent )
m_menu->ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
{
wxBell();
}
@ -938,7 +941,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
KIGFX::VIEW_CONTROLS* controls = getViewControls();
VECTOR2I cursorPos;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
// Add all the drawable symbols to preview
if( image )
@ -962,7 +965,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
auto cleanup =
[&] ()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
m_view->RecacheAllItems();
delete image;
@ -1057,7 +1060,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
{
if( !image )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
wxFileDialog dlg( m_frame, _( "Choose Image" ), m_mruPath, wxEmptyString,
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
@ -1134,7 +1137,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
m_menu->ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
{
if( image )
{
@ -1211,7 +1214,7 @@ int SCH_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent )
KIGFX::VIEW_CONTROLS* controls = getViewControls();
std::vector<SCH_ITEM*> newItems; // all new items, including group
std::vector<SCH_ITEM*> selectedItems; // the group, or newItems if no group
EE_SELECTION preview;
SCH_SELECTION preview;
SCH_COMMIT commit( m_toolMgr );
for( std::unique_ptr<EDA_ITEM>& ptr : list )
@ -1239,10 +1242,10 @@ int SCH_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent )
m_view->Add( &preview );
// Clear the current selection then select the drawings so that edit tools work on them
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &selItems );
m_toolMgr->RunAction<EDA_ITEMS*>( SCH_ACTIONS::addItemsToSel, &selItems );
m_frame->PushTool( aEvent );
@ -1286,7 +1289,7 @@ int SCH_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() || evt->IsActivate() )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
for( SCH_ITEM* item : newItems )
delete item;
@ -1354,8 +1357,8 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
if( type == SCH_JUNCTION_T && aEvent.HasPosition() )
{
EE_SELECTION& selection = m_selectionTool->GetSelection();
SCH_LINE* wire = dynamic_cast<SCH_LINE*>( selection.Front() );
SCH_SELECTION& selection = m_selectionTool->GetSelection();
SCH_LINE* wire = dynamic_cast<SCH_LINE*>( selection.Front() );
if( wire )
{
@ -1393,7 +1396,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
return 0;
}
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
cursorPos = aEvent.HasPosition() ? aEvent.Position() : controls->GetMousePosition();
@ -1506,26 +1509,26 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
}
else if( evt->Category() == TC_COMMAND )
{
if( ( type == SCH_BUS_WIRE_ENTRY_T ) && ( evt->IsAction( &EE_ACTIONS::rotateCW )
|| evt->IsAction( &EE_ACTIONS::rotateCCW )
|| evt->IsAction( &EE_ACTIONS::mirrorV )
|| evt->IsAction( &EE_ACTIONS::mirrorH ) ) )
if( ( type == SCH_BUS_WIRE_ENTRY_T ) && ( evt->IsAction( &SCH_ACTIONS::rotateCW )
|| evt->IsAction( &SCH_ACTIONS::rotateCCW )
|| evt->IsAction( &SCH_ACTIONS::mirrorV )
|| evt->IsAction( &SCH_ACTIONS::mirrorH ) ) )
{
SCH_BUS_ENTRY_BASE* busItem = static_cast<SCH_BUS_ENTRY_BASE*>( previewItem );
if( evt->IsAction( &EE_ACTIONS::rotateCW ) )
if( evt->IsAction( &SCH_ACTIONS::rotateCW ) )
{
busItem->Rotate( busItem->GetPosition(), false );
}
else if( evt->IsAction( &EE_ACTIONS::rotateCCW ) )
else if( evt->IsAction( &SCH_ACTIONS::rotateCCW ) )
{
busItem->Rotate( busItem->GetPosition(), true );
}
else if( evt->IsAction( &EE_ACTIONS::mirrorV ) )
else if( evt->IsAction( &SCH_ACTIONS::mirrorV ) )
{
busItem->MirrorVertically( busItem->GetPosition().y );
}
else if( evt->IsAction( &EE_ACTIONS::mirrorH ) )
else if( evt->IsAction( &SCH_ACTIONS::mirrorH ) )
{
busItem->MirrorHorizontally( busItem->GetPosition().x );
}
@ -1533,7 +1536,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
m_view->ClearPreview();
m_view->AddToPreview( previewItem->Clone() );
}
else if( evt->IsAction( &EE_ACTIONS::properties ) )
else if( evt->IsAction( &SCH_ACTIONS::properties ) )
{
switch( type )
{
@ -1805,12 +1808,12 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
REENTRANCY_GUARD guard( &m_inDrawingTool );
bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText );
bool isGlobalLabel = aEvent.IsAction( &EE_ACTIONS::placeGlobalLabel );
bool isHierLabel = aEvent.IsAction( &EE_ACTIONS::placeHierLabel );
bool isClassLabel = aEvent.IsAction( &EE_ACTIONS::placeClassLabel );
bool isNetLabel = aEvent.IsAction( &EE_ACTIONS::placeLabel );
bool isSheetPin = aEvent.IsAction( &EE_ACTIONS::placeSheetPin );
bool isText = aEvent.IsAction( &SCH_ACTIONS::placeSchematicText );
bool isGlobalLabel = aEvent.IsAction( &SCH_ACTIONS::placeGlobalLabel );
bool isHierLabel = aEvent.IsAction( &SCH_ACTIONS::placeHierLabel );
bool isClassLabel = aEvent.IsAction( &SCH_ACTIONS::placeClassLabel );
bool isNetLabel = aEvent.IsAction( &SCH_ACTIONS::placeLabel );
bool isSheetPin = aEvent.IsAction( &SCH_ACTIONS::placeSheetPin );
GRID_HELPER_GRIDS snapGrid = isText ? GRID_TEXT : GRID_CONNECTABLE;
@ -1818,7 +1821,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( isSheetPin )
sheet = dynamic_cast<SCH_SHEET*>( m_selectionTool->GetSelection().Front() );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->PushTool( aEvent );
@ -1856,7 +1859,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
auto cleanup =
[&]()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete item;
item = nullptr;
@ -1969,7 +1972,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
// First click creates...
if( !item )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
if( isText )
{
@ -2133,7 +2136,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
}
m_frame->PopTool( aEvent );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_dialogSyncSheetPin->Show( true );
break;
}
@ -2178,7 +2181,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
else if( item && evt->IsSelectionEvent() )
{
// This happens if our text was replaced out from under us by ConvertTextType()
EE_SELECTION& selection = m_selectionTool->GetSelection();
SCH_SELECTION& selection = m_selectionTool->GetSelection();
if( selection.GetSize() == 1 )
{
@ -2196,7 +2199,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
evt->Parameter<ACTIONS::INCREMENT>() );
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
{
if( item )
{
@ -2257,7 +2260,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
SCHEMATIC* schematic = getModel<SCHEMATIC>();
SCHEMATIC_SETTINGS& sch_settings = schematic->Settings();
SCH_SHAPE* item = nullptr;
bool isTextBox = aEvent.IsAction( &EE_ACTIONS::drawTextBox );
bool isTextBox = aEvent.IsAction( &SCH_ACTIONS::drawTextBox );
SHAPE_T type = aEvent.Parameter<SHAPE_T>();
wxString description;
@ -2274,7 +2277,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
// gets whacked.
m_toolMgr->DeactivateTool();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->PushTool( aEvent );
@ -2287,7 +2290,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
auto cleanup =
[&] ()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete item;
item = nullptr;
@ -2359,7 +2362,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_LEFT ) && !item )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
if( isTextBox )
{
@ -2454,7 +2457,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
{
if( item )
{
@ -2477,7 +2480,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
else if( evt->IsDblClick( BUT_LEFT ) && !item )
{
m_toolMgr->RunAction( EE_ACTIONS::properties );
m_toolMgr->RunAction( SCH_ACTIONS::properties );
}
else if( evt->IsClick( BUT_RIGHT ) )
{
@ -2528,7 +2531,7 @@ int SCH_DRAWING_TOOLS::DrawRuleArea( const TOOL_EVENT& aEvent )
// gets whacked.
m_toolMgr->DeactivateTool();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->PushTool( aEvent );
@ -2544,7 +2547,7 @@ int SCH_DRAWING_TOOLS::DrawRuleArea( const TOOL_EVENT& aEvent )
started = false;
getViewControls()->SetAutoPan( false );
getViewControls()->CaptureCursor( false );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
};
Activate();
@ -2618,11 +2621,11 @@ int SCH_DRAWING_TOOLS::DrawRuleArea( const TOOL_EVENT& aEvent )
}
// events that lock in nodes
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT )
|| evt->IsAction( &EE_ACTIONS::closeOutline ) )
|| evt->IsAction( &SCH_ACTIONS::closeOutline ) )
{
// Check if it is double click / closing line (so we have to finish the zone)
const bool endPolygon = evt->IsDblClick( BUT_LEFT )
|| evt->IsAction( &EE_ACTIONS::closeOutline )
|| evt->IsAction( &SCH_ACTIONS::closeOutline )
|| polyGeomMgr.NewPointClosesOutline( cursorPos );
if( endPolygon )
@ -2647,7 +2650,7 @@ int SCH_DRAWING_TOOLS::DrawRuleArea( const TOOL_EVENT& aEvent )
}
}
else if( started
&& ( evt->IsAction( &EE_ACTIONS::deleteLastPoint )
&& ( evt->IsAction( &SCH_ACTIONS::deleteLastPoint )
|| evt->IsAction( &ACTIONS::doDelete )
|| evt->IsAction( &ACTIONS::undo ) ) )
{
@ -2699,7 +2702,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
// gets whacked.
m_toolMgr->DeactivateTool();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->PushTool( aEvent );
@ -2712,7 +2715,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
auto cleanup =
[&] ()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete table;
table = nullptr;
@ -2786,7 +2789,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_LEFT ) && !table )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
table = new SCH_TABLE( 0 );
table->SetColCount( 1 );
@ -2807,7 +2810,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
else if( table && ( evt->IsClick( BUT_LEFT )
|| evt->IsDblClick( BUT_LEFT )
|| isSyntheticClick
|| evt->IsAction( &EE_ACTIONS::finishInteractive ) ) )
|| evt->IsAction( &SCH_ACTIONS::finishInteractive ) ) )
{
table->ClearEditFlags();
table->SetFlags( IS_NEW );
@ -2877,7 +2880,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
}
else if( evt->IsDblClick( BUT_LEFT ) && !table )
{
m_toolMgr->RunAction( EE_ACTIONS::properties );
m_toolMgr->RunAction( SCH_ACTIONS::properties );
}
else if( evt->IsClick( BUT_RIGHT ) )
{
@ -2910,8 +2913,8 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent )
int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
{
bool isDrawSheetCopy = aEvent.IsAction( &EE_ACTIONS::drawSheetFromFile );
bool isDrawSheetFromDesignBlock = aEvent.IsAction( &EE_ACTIONS::drawSheetFromDesignBlock );
bool isDrawSheetCopy = aEvent.IsAction( &SCH_ACTIONS::drawSheetFromFile );
bool isDrawSheetFromDesignBlock = aEvent.IsAction( &SCH_ACTIONS::drawSheetFromDesignBlock );
DESIGN_BLOCK* designBlock = nullptr;
SCH_SHEET* sheet = nullptr;
@ -2950,7 +2953,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
EE_GRID_HELPER grid( m_toolMgr );
VECTOR2I cursorPos;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->PushTool( aEvent );
@ -2963,7 +2966,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
auto cleanup =
[&] ()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete sheet;
sheet = nullptr;
@ -3041,7 +3044,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
}
else if( !sheet && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) ) )
{
EE_SELECTION& selection = m_selectionTool->GetSelection();
SCH_SELECTION& selection = m_selectionTool->GetSelection();
if( selection.Size() == 1
&& selection.Front()->Type() == SCH_SHEET_T
@ -3054,13 +3057,13 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
}
else if( evt->IsDblClick( BUT_LEFT ) )
{
m_toolMgr->PostAction( EE_ACTIONS::enterSheet );
m_toolMgr->PostAction( SCH_ACTIONS::enterSheet );
m_frame->PopTool( aEvent );
break;
}
}
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), cursorPos );
sheet->SetScreen( nullptr );
@ -3170,7 +3173,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
sheet = nullptr;
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
|| evt->IsAction( &SCH_ACTIONS::repeatDrawItem ) )
{
if( sheet )
{
@ -3268,8 +3271,8 @@ int SCH_DRAWING_TOOLS::doSyncSheetsPins( std::list<SCH_SHEET_PATH> sheetPaths )
[&]( EDA_ITEM* aItem, SCH_SHEET_PATH aPath )
{
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>(
EE_ACTIONS::changeSheet, &aPath );
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_ACTIONS::changeSheet, &aPath );
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
selectionTool->UnbrightenItem( aItem );
selectionTool->AddItemToSel( aItem, true );
m_toolMgr->RunAction( ACTIONS::doDelete );
@ -3288,8 +3291,8 @@ int SCH_DRAWING_TOOLS::doSyncSheetsPins( std::list<SCH_SHEET_PATH> sheetPaths )
sheet, DIALOG_SYNC_SHEET_PINS::PlaceItemKind::HIERLABEL,
aTemplates );
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>(
EE_ACTIONS::changeSheet, &aPath );
m_toolMgr->RunAction( EE_ACTIONS::placeHierLabel );
SCH_ACTIONS::changeSheet, &aPath );
m_toolMgr->RunAction( SCH_ACTIONS::placeHierLabel );
break;
}
case SHEET_SYNCHRONIZATION_AGENT::PLACE_SHEET_PIN:
@ -3300,10 +3303,10 @@ int SCH_DRAWING_TOOLS::doSyncSheetsPins( std::list<SCH_SHEET_PATH> sheetPaths )
sheet, DIALOG_SYNC_SHEET_PINS::PlaceItemKind::SHEET_PIN,
aTemplates );
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>(
EE_ACTIONS::changeSheet, &aPath );
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->SyncSelection( {}, nullptr,
{ sheet } );
m_toolMgr->RunAction( EE_ACTIONS::placeSheetPin );
SCH_ACTIONS::changeSheet, &aPath );
m_toolMgr->GetTool<SCH_SELECTION_TOOL>()->SyncSelection( {}, nullptr,
{ sheet } );
m_toolMgr->RunAction( SCH_ACTIONS::placeSheetPin );
break;
}
}
@ -3357,12 +3360,12 @@ int SCH_DRAWING_TOOLS::AutoPlaceAllSheetPins( const TOOL_EVENT& aEvent )
m_statusPopup->Move( KIPLATFORM::UI::GetMousePosition() + wxPoint( 20, 20 ) );
m_statusPopup->PopupFor( 2000 );
m_frame->PopTool( aEvent );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
return 0;
}
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
SCH_COMMIT commit( m_toolMgr );
BOX2I boundingBox = sheet->GetBoundingBox();
@ -3535,34 +3538,34 @@ std::vector<SCH_HIERLABEL*> SCH_DRAWING_TOOLS::importHierLabels( SCH_SHEET* aShe
void SCH_DRAWING_TOOLS::setTransitions()
{
// clang-format off
Go( &SCH_DRAWING_TOOLS::PlaceSymbol, EE_ACTIONS::placeSymbol.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::PlaceSymbol, EE_ACTIONS::placePower.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::PlaceNextSymbolUnit, EE_ACTIONS::placeNextSymbolUnit.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SingleClickPlace, EE_ACTIONS::placeNoConnect.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SingleClickPlace, EE_ACTIONS::placeJunction.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SingleClickPlace, EE_ACTIONS::placeBusWireEntry.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeClassLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeHierLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeGlobalLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawSheet, EE_ACTIONS::drawSheet.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawSheet, EE_ACTIONS::drawSheetFromFile.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawSheet, EE_ACTIONS::drawSheetFromDesignBlock.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeSheetPin.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::ImportSheet, EE_ACTIONS::placeDesignBlock.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::ImportSheet, EE_ACTIONS::importSheet.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeSchematicText.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawRectangle.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawCircle.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawArc.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawBezier.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawTextBox.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawRuleArea, EE_ACTIONS::drawRuleArea.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawTable, EE_ACTIONS::drawTable.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::PlaceImage, EE_ACTIONS::placeImage.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::ImportGraphics, EE_ACTIONS::importGraphics.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SyncSheetsPins, EE_ACTIONS::syncSheetPins.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SyncAllSheetsPins, EE_ACTIONS::syncAllSheetsPins.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::AutoPlaceAllSheetPins, EE_ACTIONS::autoplaceAllSheetPins.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::PlaceSymbol, SCH_ACTIONS::placeSymbol.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::PlaceSymbol, SCH_ACTIONS::placePower.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::PlaceNextSymbolUnit, SCH_ACTIONS::placeNextSymbolUnit.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SingleClickPlace, SCH_ACTIONS::placeNoConnect.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SingleClickPlace, SCH_ACTIONS::placeJunction.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SingleClickPlace, SCH_ACTIONS::placeBusWireEntry.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeClassLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeHierLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeGlobalLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawSheet, SCH_ACTIONS::drawSheet.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawSheet, SCH_ACTIONS::drawSheetFromFile.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawSheet, SCH_ACTIONS::drawSheetFromDesignBlock.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeSheetPin.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::ImportSheet, SCH_ACTIONS::placeDesignBlock.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::ImportSheet, SCH_ACTIONS::importSheet.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeSchematicText.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawRectangle.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawCircle.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawArc.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawBezier.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawTextBox.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawRuleArea, SCH_ACTIONS::drawRuleArea.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::DrawTable, SCH_ACTIONS::drawTable.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::PlaceImage, SCH_ACTIONS::placeImage.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::ImportGraphics, SCH_ACTIONS::importGraphics.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SyncSheetsPins, SCH_ACTIONS::syncSheetPins.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::SyncAllSheetsPins, SCH_ACTIONS::syncAllSheetsPins.MakeEvent() );
Go( &SCH_DRAWING_TOOLS::AutoPlaceAllSheetPins, SCH_ACTIONS::autoplaceAllSheetPins.MakeEvent() );
// clang-format on
}

View File

@ -26,7 +26,7 @@
#define SCH_DRAWING_TOOLS_H
#include "sch_sheet_path.h"
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <sch_base_frame.h>
#include <sch_label.h>
#include <status_popup.h>
@ -35,7 +35,7 @@
class SCH_SYMBOL;
class SCH_BUS_WIRE_ENTRY;
class SCH_EDIT_FRAME;
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
class DIALOG_SYNC_SHEET_PINS;
@ -43,7 +43,7 @@ class DIALOG_SYNC_SHEET_PINS;
* Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.).
*/
class SCH_DRAWING_TOOLS : public EE_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_DRAWING_TOOLS : public SCH_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_DRAWING_TOOLS();

View File

@ -21,20 +21,20 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <ee_actions.h>
#include <sch_actions.h>
#include <tools/sch_edit_table_tool.h>
#include <dialogs/dialog_table_properties.h>
SCH_EDIT_TABLE_TOOL::SCH_EDIT_TABLE_TOOL() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.TableEditor" )
SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.TableEditor" )
{
}
bool SCH_EDIT_TABLE_TOOL::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
addMenus( m_selectionTool->GetToolMenu().GetMenu() );
@ -44,9 +44,9 @@ bool SCH_EDIT_TABLE_TOOL::Init()
int SCH_EDIT_TABLE_TOOL::EditTable( const TOOL_EVENT& aEvent )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::EditableItems );
bool clearSelection = selection.IsHover();
SCH_TABLE* parentTable = nullptr;
SCH_SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::EditableItems );
bool clearSelection = selection.IsHover();
SCH_TABLE* parentTable = nullptr;
for( EDA_ITEM* item : selection.Items() )
{
@ -75,7 +75,7 @@ int SCH_EDIT_TABLE_TOOL::EditTable( const TOOL_EVENT& aEvent )
}
if( clearSelection )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
return 0;
}

View File

@ -24,7 +24,7 @@
#ifndef SCH_EDIT_TABLE_TOOL_H
#define SCH_EDIT_TABLE_TOOL_H
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <tool/edit_table_tool_base.h>
#include <sch_table.h>
#include <sch_tablecell.h>
@ -34,7 +34,7 @@
class SCH_EDIT_FRAME;
class SCH_EDIT_TABLE_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>,
class SCH_EDIT_TABLE_TOOL : public SCH_TOOL_BASE<SCH_EDIT_FRAME>,
public EDIT_TABLE_TOOL_BASE<SCH_TABLE, SCH_TABLECELL, SCH_COMMIT>
{
public:
@ -65,7 +65,7 @@ private:
BASE_SCREEN* getScreen() override { return m_frame->GetScreen(); }
const SELECTION& getTableCellSelection() override;
void clearSelection() override { m_toolMgr->RunAction( EE_ACTIONS::clearSelection ); };
void clearSelection() override { m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); };
SCH_TABLECELL* copyCell( SCH_TABLECELL* aSource ) override;
};

File diff suppressed because it is too large Load Diff

View File

@ -25,15 +25,15 @@
#ifndef KICAD_SCH_EDIT_TOOL_H
#define KICAD_SCH_EDIT_TOOL_H
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <sch_base_frame.h>
class SCH_EDIT_FRAME;
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
class SCH_EDIT_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_EDIT_TOOL : public SCH_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_EDIT_TOOL();
@ -97,7 +97,7 @@ public:
private:
void editFieldText( SCH_FIELD* aField );
void collectUnits( const EE_SELECTION& aSelection,
void collectUnits( const SCH_SELECTION& aSelection,
std::set<std::pair<SCH_SYMBOL*, SCH_SCREEN*>>& aCollectedUnits );
///< Set up handlers for various events.

View File

@ -64,10 +64,10 @@
#include <symbol_viewer_frame.h>
#include <tool/picker_tool.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h>
#include <tools/ee_tool_utils.h>
#include <tools/sch_actions.h>
#include <tools/sch_selection.h>
#include <tools/sch_selection_tool.h>
#include <tools/sch_tool_utils.h>
#include <tools/sch_edit_table_tool.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <eda_list_dialog.h>
@ -149,7 +149,7 @@ int SCH_EDITOR_CONTROL::Revert( const TOOL_EVENT& aEvent )
if( m_frame->GetCurrentSheet().Last() != &root )
{
m_toolMgr->RunAction( ACTIONS::cancelInteractive );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
// Store the current zoom level into the current screen before switching
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();
@ -345,9 +345,8 @@ void SCH_EDITOR_CONTROL::doCrossProbeSchToPcb( const TOOL_EVENT& aEvent, bool aF
if( m_probingPcbToSch || m_frame->IsSyncingSelection() )
return;
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = aForce ? selTool->RequestSelection() : selTool->GetSelection();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = aForce ? selTool->RequestSelection() : selTool->GetSelection();
m_frame->SendSelectItemsToPcb( selection.GetItemsSortedBySelectionOrder(), aForce );
}
@ -358,7 +357,7 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
bool savePowerSymbols = IsOK( m_frame,
_( "Include power symbols in schematic to the library?" ) );
bool createNew = aEvent.IsAction( &EE_ACTIONS::exportSymbolsToNewLibrary );
bool createNew = aEvent.IsAction( &SCH_ACTIONS::exportSymbolsToNewLibrary );
SCH_SHEET_LIST sheets = m_frame->Schematic().BuildSheetListSortedByPageNumbers();
SCH_REFERENCE_LIST symbols;
@ -567,7 +566,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
picker->SetClickHandler(
[this, simFrame]( const VECTOR2D& aPosition )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
// We do not really want to keep an item selected in schematic,
// so clear the current selection
@ -640,13 +639,13 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
picker->SetMotionHandler(
[this, picker]( const VECTOR2D& aPos )
{
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
collector.Collect( m_frame->GetScreen(), { SCH_ITEM_LOCATE_WIRE_T,
SCH_PIN_T,
SCH_SHEET_PIN_T }, aPos );
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
selectionTool->GuessSelectionCandidates( collector, aPos );
EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
@ -691,7 +690,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
[this]( const int& aFinalState )
{
if( m_pickerItem )
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
m_toolMgr->GetTool<SCH_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
if( !m_frame->GetHighlightedConnection().IsEmpty() )
{
@ -704,9 +703,9 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
// Wake the selection tool after exiting to ensure the cursor gets updated
// and deselect previous selection from simulator to avoid any issue
// ( avoid crash in some cases when the SimProbe tool is deselected )
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
selectionTool->ClearSelection();
m_toolMgr->PostAction( EE_ACTIONS::selectionActivate );
m_toolMgr->PostAction( SCH_ACTIONS::selectionActivate );
} );
m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
@ -728,8 +727,8 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
picker->SetClickHandler(
[this]( const VECTOR2D& aPosition )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EDA_ITEM* item = nullptr;
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
EDA_ITEM* item = nullptr;
selTool->SelectPoint( aPosition, { SCH_SYMBOL_T, SCH_FIELD_T }, &item );
if( !item )
@ -764,11 +763,11 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
picker->SetMotionHandler(
[this]( const VECTOR2D& aPos )
{
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
collector.Collect( m_frame->GetScreen(), { SCH_SYMBOL_T, SCH_FIELD_T }, aPos );
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
selectionTool->GuessSelectionCandidates( collector, aPos );
EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
@ -792,14 +791,14 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
[this]( const int& aFinalState )
{
if( m_pickerItem )
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
m_toolMgr->GetTool<SCH_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
// Wake the selection tool after exiting to ensure the cursor gets updated
// and deselect previous selection from simulator to avoid any issue
// ( avoid crash in some cases when the SimTune tool is deselected )
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
selectionTool->ClearSelection();
m_toolMgr->PostAction( EE_ACTIONS::selectionActivate );
m_toolMgr->PostAction( SCH_ACTIONS::selectionActivate );
} );
m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
@ -815,7 +814,7 @@ static VECTOR2D CLEAR;
static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
{
SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( aToolMgr->GetToolHolder() );
EE_SELECTION_TOOL* selTool = aToolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = aToolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_EDITOR_CONTROL* editorControl = aToolMgr->GetTool<SCH_EDITOR_CONTROL>();
SCH_CONNECTION* conn = nullptr;
SCH_ITEM* item = nullptr;
@ -916,9 +915,9 @@ int SCH_EDITOR_CONTROL::ClearHighlight( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCHEMATIC& schematic = m_frame->Schematic();
SCH_SCREEN* screen = m_frame->GetCurrentSheet().LastScreen();
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCHEMATIC& schematic = m_frame->Schematic();
SCH_SCREEN* screen = m_frame->GetCurrentSheet().LastScreen();
const SCH_CONNECTION* conn = nullptr;
VECTOR2D connPos;
@ -1290,7 +1289,7 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
undo_list->ReversePickersListOrder();
m_frame->PushCommandToRedoList( undo_list );
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
m_toolMgr->GetTool<SCH_SELECTION_TOOL>()->RebuildSelection();
m_frame->GetCanvas()->Refresh();
m_frame->OnModify();
@ -1321,7 +1320,7 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
list->ReversePickersListOrder();
m_frame->PushCommandToUndoList( list );
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
m_toolMgr->GetTool<SCH_SELECTION_TOOL>()->RebuildSelection();
m_frame->GetCanvas()->Refresh();
m_frame->OnModify();
@ -1332,9 +1331,9 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
bool SCH_EDITOR_CONTROL::doCopy( bool aUseDuplicateClipboard )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->RequestSelection();
SCHEMATIC& schematic = m_frame->Schematic();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->RequestSelection();
SCHEMATIC& schematic = m_frame->Schematic();
if( selection.Empty() )
return false;
@ -1375,7 +1374,7 @@ bool SCH_EDITOR_CONTROL::doCopy( bool aUseDuplicateClipboard )
KICAD_FORMAT::Prettify( prettyData, true );
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
if( aUseDuplicateClipboard )
{
@ -1444,8 +1443,8 @@ int SCH_EDITOR_CONTROL::Copy( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::CopyAsText( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->RequestSelection();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->RequestSelection();
if( selection.Empty() )
return false;
@ -1453,7 +1452,7 @@ int SCH_EDITOR_CONTROL::CopyAsText( const TOOL_EVENT& aEvent )
wxString itemsAsText = GetSelectedItemsAsText( selection );
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
return SaveClipboard( itemsAsText.ToStdString() );
}
@ -1653,9 +1652,9 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
return 0;
}
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
std::string content;
VECTOR2I eventPos;
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
std::string content;
VECTOR2I eventPos;
SCH_SHEET tempSheet;
SCH_SCREEN* tempScreen = new SCH_SCREEN( &m_frame->Schematic() );
@ -2175,10 +2174,10 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
allScreens.PruneOrphanedSheetInstances( m_frame->Prj().GetProjectName(), sheets );
// Now clear the previous selection, select the pasted items, and fire up the "move" tool.
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &loadedItems );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_toolMgr->RunAction<EDA_ITEMS*>( SCH_ACTIONS::addItemsToSel, &loadedItems );
EE_SELECTION& selection = selTool->GetSelection();
SCH_SELECTION& selection = selTool->GetSelection();
if( !selection.Empty() )
{
@ -2279,7 +2278,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
selection.SetReferencePoint( item->GetPosition() );
}
if( m_toolMgr->RunSynchronousAction( EE_ACTIONS::move, &commit ) )
if( m_toolMgr->RunSynchronousAction( SCH_ACTIONS::move, &commit ) )
{
// Pushing the commit will update the connectivity.
commit.Push( _( "Paste" ) );
@ -2302,16 +2301,16 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->RequestSelection( { SCH_SYMBOL_T } );
SCH_SYMBOL* symbol = nullptr;
SYMBOL_EDIT_FRAME* symbolEditor;
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->RequestSelection( { SCH_SYMBOL_T } );
SCH_SYMBOL* symbol = nullptr;
SYMBOL_EDIT_FRAME* symbolEditor;
if( selection.GetSize() >= 1 )
symbol = (SCH_SYMBOL*) selection.Front();
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
if( !symbol )
{
@ -2341,11 +2340,11 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
if( wxWindow* blocking_win = symbolEditor->Kiway().GetBlockingDialog() )
blocking_win->Close( true );
if( aEvent.IsAction( &EE_ACTIONS::editWithLibEdit ) )
if( aEvent.IsAction( &SCH_ACTIONS::editWithLibEdit ) )
{
symbolEditor->LoadSymbolFromSchematic( symbol );
}
else if( aEvent.IsAction( &EE_ACTIONS::editLibSymbolWithLibEdit ) )
else if( aEvent.IsAction( &SCH_ACTIONS::editLibSymbolWithLibEdit ) )
{
symbolEditor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(),
symbol->GetBodyStyle() );
@ -2891,33 +2890,33 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::SaveCurrSheetCopyAs, EE_ACTIONS::saveCurrSheetCopyAs.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::SaveCurrSheetCopyAs, SCH_ACTIONS::saveCurrSheetCopyAs.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Revert, ACTIONS::revert.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSchematicSetup, EE_ACTIONS::schematicSetup.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSchematicSetup, SCH_ACTIONS::schematicSetup.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::PageSetup, ACTIONS::pageSettings.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Print, ACTIONS::print.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::RescueSymbols, EE_ACTIONS::rescueSymbols.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::RemapSymbols, EE_ACTIONS::remapSymbols.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::RescueSymbols, SCH_ACTIONS::rescueSymbols.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::RemapSymbols, SCH_ACTIONS::remapSymbols.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::PointSelectedEvent );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::SelectedEvent );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::UnselectedEvent );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::ClearedEvent );
Go( &SCH_EDITOR_CONTROL::ExplicitCrossProbeToPcb, EE_ACTIONS::selectOnPCB.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::PointSelectedEvent );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::SelectedEvent );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::UnselectedEvent );
Go( &SCH_EDITOR_CONTROL::CrossProbeToPcb, EVENTS::ClearedEvent );
Go( &SCH_EDITOR_CONTROL::ExplicitCrossProbeToPcb, SCH_ACTIONS::selectOnPCB.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::SimProbe, EE_ACTIONS::simProbe.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::SimTune, EE_ACTIONS::simTune.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::SimProbe, SCH_ACTIONS::simProbe.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::SimTune, SCH_ACTIONS::simTune.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::HighlightNet, EE_ACTIONS::highlightNet.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ClearHighlight, EE_ACTIONS::clearHighlight.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::HighlightNetCursor, EE_ACTIONS::highlightNetTool.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::HighlightNet, SCH_ACTIONS::highlightNet.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ClearHighlight, SCH_ACTIONS::clearHighlight.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::HighlightNetCursor, SCH_ACTIONS::highlightNetTool.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EVENTS::SelectedItemsModified );
Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EE_ACTIONS::updateNetHighlighting.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, SCH_ACTIONS::updateNetHighlighting.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::AssignNetclass, EE_ACTIONS::assignNetclass.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::AssignNetclass, SCH_ACTIONS::assignNetclass.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
@ -2930,53 +2929,49 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::GridFeedback, EVENTS::GridChangedByKeyEvent );
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editWithLibEdit.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor,
EE_ACTIONS::editLibSymbolWithLibEdit.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowCvpcb, EE_ACTIONS::assignFootprints.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ImportFPAssignments, EE_ACTIONS::importFPAssignments.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Annotate, EE_ACTIONS::annotate.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::IncrementAnnotations, EE_ACTIONS::incrementAnnotations.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditSymbolFields, EE_ACTIONS::editSymbolFields.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditSymbolLibraryLinks,
EE_ACTIONS::editSymbolLibraryLinks.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowPcbNew, EE_ACTIONS::showPcbNew.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdatePCB, ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdateFromPCB, ACTIONS::updateSchematicFromPcb.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportNetlist, EE_ACTIONS::exportNetlist.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::GenerateBOM, EE_ACTIONS::generateBOM.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::GenerateBOMLegacy, EE_ACTIONS::generateBOMLegacy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::DrawSheetOnClipboard, EE_ACTIONS::drawSheetOnClipboard.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, SCH_ACTIONS::editWithLibEdit.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, SCH_ACTIONS::editLibSymbolWithLibEdit.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowCvpcb, SCH_ACTIONS::assignFootprints.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ImportFPAssignments, SCH_ACTIONS::importFPAssignments.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Annotate, SCH_ACTIONS::annotate.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::IncrementAnnotations, SCH_ACTIONS::incrementAnnotations.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditSymbolFields, SCH_ACTIONS::editSymbolFields.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditSymbolLibraryLinks, SCH_ACTIONS::editSymbolLibraryLinks.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowPcbNew, SCH_ACTIONS::showPcbNew.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdatePCB, ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdateFromPCB, ACTIONS::updateSchematicFromPcb.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportNetlist, SCH_ACTIONS::exportNetlist.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::GenerateBOM, SCH_ACTIONS::generateBOM.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::GenerateBOMLegacy, SCH_ACTIONS::generateBOMLegacy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::DrawSheetOnClipboard, SCH_ACTIONS::drawSheetOnClipboard.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSearch, EE_ACTIONS::showSearch.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowHierarchy, EE_ACTIONS::showHierarchy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowNetNavigator, EE_ACTIONS::showNetNavigator.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleProperties, ACTIONS::showProperties.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleLibraryTree, EE_ACTIONS::showDesignBlockPanel.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleLibraryTree, EE_ACTIONS::showDesignBlockPanel.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSearch, SCH_ACTIONS::showSearch.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowHierarchy, SCH_ACTIONS::showHierarchy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowNetNavigator, SCH_ACTIONS::showNetNavigator.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleProperties, ACTIONS::showProperties.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleLibraryTree, SCH_ACTIONS::showDesignBlockPanel.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleLibraryTree, SCH_ACTIONS::showDesignBlockPanel.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleHiddenPins, EE_ACTIONS::toggleHiddenPins.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleHiddenFields, EE_ACTIONS::toggleHiddenFields.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleDirectiveLabels, EE_ACTIONS::toggleDirectiveLabels.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCWarnings, EE_ACTIONS::toggleERCWarnings.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCErrors, EE_ACTIONS::toggleERCErrors.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCExclusions, EE_ACTIONS::toggleERCExclusions.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::MarkSimExclusions, EE_ACTIONS::markSimExclusions.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleOPVoltages, EE_ACTIONS::toggleOPVoltages.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleOPCurrents, EE_ACTIONS::toggleOPCurrents.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::TogglePinAltIcons, EE_ACTIONS::togglePinAltIcons.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineModeFree.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineMode90.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineMode45.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::NextLineMode, EE_ACTIONS::lineModeNext.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleAnnotateAuto, EE_ACTIONS::toggleAnnotateAuto.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleHiddenPins, SCH_ACTIONS::toggleHiddenPins.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleHiddenFields, SCH_ACTIONS::toggleHiddenFields.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleDirectiveLabels, SCH_ACTIONS::toggleDirectiveLabels.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCWarnings, SCH_ACTIONS::toggleERCWarnings.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCErrors, SCH_ACTIONS::toggleERCErrors.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleERCExclusions, SCH_ACTIONS::toggleERCExclusions.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::MarkSimExclusions, SCH_ACTIONS::markSimExclusions.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleOPVoltages, SCH_ACTIONS::toggleOPVoltages.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleOPCurrents, SCH_ACTIONS::toggleOPCurrents.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::TogglePinAltIcons, SCH_ACTIONS::togglePinAltIcons.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, SCH_ACTIONS::lineModeFree.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, SCH_ACTIONS::lineMode90.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, SCH_ACTIONS::lineMode45.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::NextLineMode, SCH_ACTIONS::lineModeNext.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleAnnotateAuto, SCH_ACTIONS::toggleAnnotateAuto.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ReloadPlugins, ACTIONS::pluginsReload.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ReloadPlugins, ACTIONS::pluginsReload.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::RepairSchematic, EE_ACTIONS::repairSchematic.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::RepairSchematic, SCH_ACTIONS::repairSchematic.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary,
EE_ACTIONS::exportSymbolsToLibrary.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary,
EE_ACTIONS::exportSymbolsToNewLibrary.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary, SCH_ACTIONS::exportSymbolsToLibrary.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ExportSymbolsToLibrary, SCH_ACTIONS::exportSymbolsToNewLibrary.MakeEvent() );
}

View File

@ -27,7 +27,7 @@
#define SCH_EDITOR_CONTROL_H
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <status_popup.h>
class SCH_EDIT_FRAME;
@ -35,11 +35,11 @@ class SCH_EDIT_FRAME;
/**
* Handle actions specific to the schematic editor.
*/
class SCH_EDITOR_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_EDITOR_CONTROL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_EDITOR_CONTROL() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.EditorControl" ),
SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.EditorControl" ),
m_probingPcbToSch( false ),
m_pickerItem( nullptr ),
m_duplicateIsHoverSelection( false ),

View File

@ -25,7 +25,6 @@
#include <sch_commit.h>
#include <sch_sheet_pin.h>
#include <schematic.h>
#include <tools/ee_actions.h>
#include <tools/sch_find_replace_tool.h>
#include <sch_sheet_path.h>

View File

@ -27,18 +27,18 @@
#define SCH_FIND_REPLACE_TOOL_H
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
class SCH_EDIT_FRAME;
/**
* Handle actions specific to the schematic editor.
*/
class SCH_FIND_REPLACE_TOOL : public wxEvtHandler, public EE_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_FIND_REPLACE_TOOL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_FIND_REPLACE_TOOL() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.FindReplace" ),
SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.FindReplace" ),
m_foundItemHighlighted( false )
{ }

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "tools/ee_inspection_tool.h"
#include "tools/sch_inspection_tool.h"
#include <sch_symbol.h>
#include <id.h>
@ -33,9 +33,9 @@
#include <gal/graphics_abstraction_layer.h>
#include <tool/conditional_menu.h>
#include <tool/selection_conditions.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/ee_selection.h>
#include <tools/sch_actions.h>
#include <tools/sch_selection_tool.h>
#include <tools/sch_selection.h>
#include <sim/simulator_frame.h>
#include <sch_edit_frame.h>
#include <symbol_edit_frame.h>
@ -53,32 +53,32 @@
#include <math/util.h> // for KiROUND
EE_INSPECTION_TOOL::EE_INSPECTION_TOOL() :
EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.InspectionTool" ), m_busSyntaxHelp( nullptr )
SCH_INSPECTION_TOOL::SCH_INSPECTION_TOOL() :
SCH_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.InspectionTool" ), m_busSyntaxHelp( nullptr )
{
}
bool EE_INSPECTION_TOOL::Init()
bool SCH_INSPECTION_TOOL::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
// Add inspection actions to the selection tool menu
//
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddItem( EE_ACTIONS::excludeMarker, EE_CONDITIONS::SingleNonExcludedMarker, 100 );
selToolMenu.AddItem( SCH_ACTIONS::excludeMarker, SCH_CONDITIONS::SingleNonExcludedMarker, 100 );
selToolMenu.AddItem( ACTIONS::showDatasheet,
EE_CONDITIONS::SingleSymbol && EE_CONDITIONS::Idle, 220 );
SCH_CONDITIONS::SingleSymbol && SCH_CONDITIONS::Idle, 220 );
return true;
}
void EE_INSPECTION_TOOL::Reset( RESET_REASON aReason )
void SCH_INSPECTION_TOOL::Reset( RESET_REASON aReason )
{
EE_TOOL_BASE::Reset( aReason );
SCH_TOOL_BASE::Reset( aReason );
if( aReason == SUPERMODEL_RELOAD || aReason == RESET_REASON::SHUTDOWN )
{
@ -89,14 +89,14 @@ void EE_INSPECTION_TOOL::Reset( RESET_REASON aReason )
}
int EE_INSPECTION_TOOL::RunERC( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::RunERC( const TOOL_EVENT& aEvent )
{
ShowERCDialog();
return 0;
}
void EE_INSPECTION_TOOL::ShowERCDialog()
void SCH_INSPECTION_TOOL::ShowERCDialog()
{
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -120,7 +120,7 @@ void EE_INSPECTION_TOOL::ShowERCDialog()
}
int EE_INSPECTION_TOOL::PrevMarker( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::PrevMarker( const TOOL_EVENT& aEvent )
{
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -139,7 +139,7 @@ int EE_INSPECTION_TOOL::PrevMarker( const TOOL_EVENT& aEvent )
}
int EE_INSPECTION_TOOL::NextMarker( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::NextMarker( const TOOL_EVENT& aEvent )
{
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -157,13 +157,13 @@ int EE_INSPECTION_TOOL::NextMarker( const TOOL_EVENT& aEvent )
}
int EE_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
wxCHECK( selectionTool, 0 );
EE_SELECTION& selection = selectionTool->GetSelection();
SCH_SELECTION& selection = selectionTool->GetSelection();
if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
{
@ -181,7 +181,7 @@ int EE_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent )
}
void EE_INSPECTION_TOOL::CrossProbe( const SCH_MARKER* aMarker )
void SCH_INSPECTION_TOOL::CrossProbe( const SCH_MARKER* aMarker )
{
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -202,7 +202,7 @@ void EE_INSPECTION_TOOL::CrossProbe( const SCH_MARKER* aMarker )
}
wxString EE_INSPECTION_TOOL::InspectERCErrorMenuText( const std::shared_ptr<RC_ITEM>& aERCItem )
wxString SCH_INSPECTION_TOOL::InspectERCErrorMenuText( const std::shared_ptr<RC_ITEM>& aERCItem )
{
auto menuDescription =
[&]( const TOOL_ACTION& aAction )
@ -233,18 +233,18 @@ wxString EE_INSPECTION_TOOL::InspectERCErrorMenuText( const std::shared_ptr<RC_I
if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
{
return menuDescription( EE_ACTIONS::showBusSyntaxHelp );
return menuDescription( SCH_ACTIONS::showBusSyntaxHelp );
}
else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
{
return menuDescription( EE_ACTIONS::diffSymbol );
return menuDescription( SCH_ACTIONS::diffSymbol );
}
return wxEmptyString;
}
void EE_INSPECTION_TOOL::InspectERCError( const std::shared_ptr<RC_ITEM>& aERCItem )
void SCH_INSPECTION_TOOL::InspectERCError( const std::shared_ptr<RC_ITEM>& aERCItem )
{
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -254,7 +254,7 @@ void EE_INSPECTION_TOOL::InspectERCError( const std::shared_ptr<RC_ITEM>& aERCIt
if( aERCItem->GetErrorCode() == ERCE_BUS_TO_NET_CONFLICT )
{
m_toolMgr->RunAction( EE_ACTIONS::showBusSyntaxHelp );
m_toolMgr->RunAction( SCH_ACTIONS::showBusSyntaxHelp );
}
else if( aERCItem->GetErrorCode() == ERCE_LIB_SYMBOL_MISMATCH )
{
@ -264,11 +264,11 @@ void EE_INSPECTION_TOOL::InspectERCError( const std::shared_ptr<RC_ITEM>& aERCIt
}
int EE_INSPECTION_TOOL::ExcludeMarker( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::ExcludeMarker( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->GetSelection();
SCH_MARKER* marker = nullptr;
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->GetSelection();
SCH_MARKER* marker = nullptr;
if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
marker = static_cast<SCH_MARKER*>( selection.Front() );
@ -301,7 +301,7 @@ int EE_INSPECTION_TOOL::ExcludeMarker( const TOOL_EVENT& aEvent )
extern void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
int aGridForPins, UNITS_PROVIDER* aUnitsProvider );
int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
{
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
@ -331,7 +331,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
}
int EE_INSPECTION_TOOL::ShowBusSyntaxHelp( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::ShowBusSyntaxHelp( const TOOL_EVENT& aEvent )
{
if( m_busSyntaxHelp )
{
@ -345,13 +345,13 @@ int EE_INSPECTION_TOOL::ShowBusSyntaxHelp( const TOOL_EVENT& aEvent )
}
int EE_INSPECTION_TOOL::DiffSymbol( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::DiffSymbol( const TOOL_EVENT& aEvent )
{
SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
wxCHECK( schEditorFrame, 0 );
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
SCH_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
if( selection.Empty() )
{
@ -364,7 +364,7 @@ int EE_INSPECTION_TOOL::DiffSymbol( const TOOL_EVENT& aEvent )
}
void EE_INSPECTION_TOOL::DiffSymbol( SCH_SYMBOL* symbol )
void SCH_INSPECTION_TOOL::DiffSymbol( SCH_SYMBOL* symbol )
{
SCH_EDIT_FRAME* schEditorFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -462,7 +462,7 @@ void EE_INSPECTION_TOOL::DiffSymbol( SCH_SYMBOL* symbol )
}
SYMBOL_DIFF_WIDGET* EE_INSPECTION_TOOL::constructDiffPanel( wxPanel* aParentPanel )
SYMBOL_DIFF_WIDGET* SCH_INSPECTION_TOOL::constructDiffPanel( wxPanel* aParentPanel )
{
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
@ -477,7 +477,7 @@ SYMBOL_DIFF_WIDGET* EE_INSPECTION_TOOL::constructDiffPanel( wxPanel* aParentPane
}
int EE_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent )
{
SIMULATOR_FRAME* simFrame = (SIMULATOR_FRAME*) m_frame->Kiway().Player( FRAME_SIMULATOR, true );
@ -499,7 +499,7 @@ int EE_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent )
}
int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
{
wxString datasheet;
EMBEDDED_FILES* files = nullptr;
@ -526,7 +526,7 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
}
else if( m_frame->IsType( FRAME_SCH ) )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
SCH_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
if( selection.Empty() )
return 0;
@ -554,12 +554,12 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
}
int EE_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
int SCH_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
{
SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
SCH_EDIT_FRAME* schEditFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->GetSelection();
SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
SCH_EDIT_FRAME* schEditFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->GetSelection();
// Note: the symbol viewer manages its own message panel
@ -592,29 +592,29 @@ int EE_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
}
void EE_INSPECTION_TOOL::setTransitions()
void SCH_INSPECTION_TOOL::setTransitions()
{
Go( &EE_INSPECTION_TOOL::RunERC, EE_ACTIONS::runERC.MakeEvent() );
Go( &EE_INSPECTION_TOOL::PrevMarker, EE_ACTIONS::prevMarker.MakeEvent() );
Go( &EE_INSPECTION_TOOL::NextMarker, EE_ACTIONS::nextMarker.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::RunERC, SCH_ACTIONS::runERC.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::PrevMarker, SCH_ACTIONS::prevMarker.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::NextMarker, SCH_ACTIONS::nextMarker.MakeEvent() );
// See note 1:
Go( &EE_INSPECTION_TOOL::CrossProbe, EVENTS::PointSelectedEvent );
Go( &EE_INSPECTION_TOOL::CrossProbe, EVENTS::SelectedEvent );
Go( &EE_INSPECTION_TOOL::ExcludeMarker, EE_ACTIONS::excludeMarker.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::CrossProbe, EVENTS::PointSelectedEvent );
Go( &SCH_INSPECTION_TOOL::CrossProbe, EVENTS::SelectedEvent );
Go( &SCH_INSPECTION_TOOL::ExcludeMarker, SCH_ACTIONS::excludeMarker.MakeEvent() );
Go( &EE_INSPECTION_TOOL::CheckSymbol, EE_ACTIONS::checkSymbol.MakeEvent() );
Go( &EE_INSPECTION_TOOL::DiffSymbol, EE_ACTIONS::diffSymbol.MakeEvent() );
Go( &EE_INSPECTION_TOOL::RunSimulation, EE_ACTIONS::showSimulator.MakeEvent() );
Go( &EE_INSPECTION_TOOL::ShowBusSyntaxHelp, EE_ACTIONS::showBusSyntaxHelp.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::CheckSymbol, SCH_ACTIONS::checkSymbol.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::DiffSymbol, SCH_ACTIONS::diffSymbol.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::RunSimulation, SCH_ACTIONS::showSimulator.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::ShowBusSyntaxHelp, SCH_ACTIONS::showBusSyntaxHelp.MakeEvent() );
Go( &EE_INSPECTION_TOOL::ShowDatasheet, ACTIONS::showDatasheet.MakeEvent() );
Go( &SCH_INSPECTION_TOOL::ShowDatasheet, ACTIONS::showDatasheet.MakeEvent() );
// Note 1: tUpdateMessagePanel is called by CrossProbe. So uncomment this line if
// call to CrossProbe is modifiied
// Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::SelectedEvent );
Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::UnselectedEvent );
Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::ClearedEvent );
Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::SelectedItemsModified );
// Go( &SCH_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::SelectedEvent );
Go( &SCH_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::UnselectedEvent );
Go( &SCH_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::ClearedEvent );
Go( &SCH_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::SelectedItemsModified );
}

View File

@ -22,25 +22,25 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef EE_INSPECTION_TOOL_H
#define EE_INSPECTION_TOOL_H
#ifndef SCH_INSPECTION_TOOL_H
#define SCH_INSPECTION_TOOL_H
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <dialogs/dialog_book_reporter.h>
#include <sch_base_frame.h>
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
class SCH_BASE_FRAME;
class DIALOG_ERC;
class SYMBOL_DIFF_WIDGET;
class EE_INSPECTION_TOOL : public wxEvtHandler, public EE_TOOL_BASE<SCH_BASE_FRAME>
class SCH_INSPECTION_TOOL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_BASE_FRAME>
{
public:
EE_INSPECTION_TOOL();
~EE_INSPECTION_TOOL() {}
SCH_INSPECTION_TOOL();
~SCH_INSPECTION_TOOL() {}
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;
@ -86,4 +86,4 @@ private:
HTML_MESSAGE_BOX* m_busSyntaxHelp;
};
#endif /* EE_INSPECTION_TOOL_H */
#endif /* SCH_INSPECTION_TOOL_H */

View File

@ -56,10 +56,10 @@
#include <sch_sheet_pin.h>
#include <schematic.h>
#include <sch_commit.h>
#include <ee_actions.h>
#include <sch_actions.h>
#include <ee_grid_helper.h>
#include <ee_selection.h>
#include <ee_selection_tool.h>
#include <sch_selection.h>
#include <sch_selection_tool.h>
using BUS_GETTER = std::function<SCH_LINE*()>;
@ -169,8 +169,8 @@ static BUS_UNFOLD_PERSISTENT_SETTINGS busUnfoldPersistentSettings = {
SCH_LINE_WIRE_BUS_TOOL::SCH_LINE_WIRE_BUS_TOOL() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawingLineWireBus" ),
m_inDrawingTool( false )
SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawingLineWireBus" ),
m_inDrawingTool( false )
{
m_busUnfold = {};
m_wires.reserve( 16 );
@ -184,7 +184,7 @@ SCH_LINE_WIRE_BUS_TOOL::~SCH_LINE_WIRE_BUS_TOOL()
bool SCH_LINE_WIRE_BUS_TOOL::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
const auto busGetter = [this]()
{
@ -203,14 +203,14 @@ bool SCH_LINE_WIRE_BUS_TOOL::Init()
auto wireOrBusTool =
[this]( const SELECTION& aSel )
{
return ( m_frame->IsCurrentTool( EE_ACTIONS::drawWire )
|| m_frame->IsCurrentTool( EE_ACTIONS::drawBus ) );
return ( m_frame->IsCurrentTool( SCH_ACTIONS::drawWire )
|| m_frame->IsCurrentTool( SCH_ACTIONS::drawBus ) );
};
auto lineTool =
[this]( const SELECTION& aSel )
{
return m_frame->IsCurrentTool( EE_ACTIONS::drawLines );
return m_frame->IsCurrentTool( SCH_ACTIONS::drawLines );
};
auto belowRootSheetCondition =
@ -219,8 +219,8 @@ bool SCH_LINE_WIRE_BUS_TOOL::Init()
return m_frame->GetCurrentSheet().Last() != &m_frame->Schematic().Root();
};
auto busSelection = EE_CONDITIONS::MoreThan( 0 )
&& EE_CONDITIONS::OnlyTypes( { SCH_ITEM_LOCATE_BUS_T } );
auto busSelection = SCH_CONDITIONS::MoreThan( 0 )
&& SCH_CONDITIONS::OnlyTypes( { SCH_ITEM_LOCATE_BUS_T } );
auto haveHighlight =
[&]( const SELECTION& sel )
@ -234,40 +234,40 @@ bool SCH_LINE_WIRE_BUS_TOOL::Init()
// Build the tool menu
//
ctxMenu.AddItem( EE_ACTIONS::clearHighlight, haveHighlight && EE_CONDITIONS::Idle, 1 );
ctxMenu.AddSeparator( haveHighlight && EE_CONDITIONS::Idle, 1 );
ctxMenu.AddItem( SCH_ACTIONS::clearHighlight, haveHighlight && SCH_CONDITIONS::Idle, 1 );
ctxMenu.AddSeparator( haveHighlight && SCH_CONDITIONS::Idle, 1 );
ctxMenu.AddSeparator( 10 );
ctxMenu.AddItem( EE_ACTIONS::drawWire, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
ctxMenu.AddItem( EE_ACTIONS::drawBus, wireOrBusTool && EE_CONDITIONS::Idle, 10 );
ctxMenu.AddItem( EE_ACTIONS::drawLines, lineTool && EE_CONDITIONS::Idle, 10 );
ctxMenu.AddItem( SCH_ACTIONS::drawWire, wireOrBusTool && SCH_CONDITIONS::Idle, 10 );
ctxMenu.AddItem( SCH_ACTIONS::drawBus, wireOrBusTool && SCH_CONDITIONS::Idle, 10 );
ctxMenu.AddItem( SCH_ACTIONS::drawLines, lineTool && SCH_CONDITIONS::Idle, 10 );
ctxMenu.AddItem( EE_ACTIONS::undoLastSegment, EE_CONDITIONS::ShowAlways, 10 );
ctxMenu.AddItem( EE_ACTIONS::switchSegmentPosture, EE_CONDITIONS::ShowAlways, 10 );
ctxMenu.AddItem( ACTIONS::finishInteractive, IsDrawingLineWireOrBus, 10 );
ctxMenu.AddItem( SCH_ACTIONS::undoLastSegment, SCH_CONDITIONS::ShowAlways, 10 );
ctxMenu.AddItem( SCH_ACTIONS::switchSegmentPosture, SCH_CONDITIONS::ShowAlways, 10 );
ctxMenu.AddItem( ACTIONS::finishInteractive, IsDrawingLineWireOrBus, 10 );
ctxMenu.AddMenu( busUnfoldMenu.get(), EE_CONDITIONS::Idle, 10 );
ctxMenu.AddMenu( busUnfoldMenu.get(), SCH_CONDITIONS::Idle, 10 );
ctxMenu.AddSeparator( 100 );
ctxMenu.AddItem( EE_ACTIONS::placeJunction, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::placeLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::placeClassLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::breakWire, wireOrBusTool && EE_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::slice, ( wireOrBusTool || lineTool )
&& EE_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 150 );
ctxMenu.AddItem( SCH_ACTIONS::placeJunction, wireOrBusTool && SCH_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( SCH_ACTIONS::placeLabel, wireOrBusTool && SCH_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( SCH_ACTIONS::placeClassLabel, wireOrBusTool && SCH_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( SCH_ACTIONS::placeGlobalLabel, wireOrBusTool && SCH_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( SCH_ACTIONS::placeHierLabel, wireOrBusTool && SCH_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( SCH_ACTIONS::breakWire, wireOrBusTool && SCH_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( SCH_ACTIONS::slice, ( wireOrBusTool || lineTool )
&& SCH_CONDITIONS::Idle, 100 );
ctxMenu.AddItem( SCH_ACTIONS::leaveSheet, belowRootSheetCondition, 150 );
ctxMenu.AddSeparator( 200 );
ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
ctxMenu.AddItem( SCH_ACTIONS::selectNode, wireOrBusTool && SCH_CONDITIONS::Idle, 200 );
ctxMenu.AddItem( SCH_ACTIONS::selectConnection, wireOrBusTool && SCH_CONDITIONS::Idle, 200 );
// Add bus unfolding to the selection tool
//
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddMenu( selBusUnfoldMenu.get(), busSelection && EE_CONDITIONS::Idle, 100 );
selToolMenu.AddMenu( selBusUnfoldMenu.get(), busSelection && SCH_CONDITIONS::Idle, 100 );
return true;
}
@ -292,7 +292,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
const DRAW_SEGMENT_EVENT_PARAMS* params = aEvent.Parameter<const DRAW_SEGMENT_EVENT_PARAMS*>();
m_frame->PushTool( aEvent );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
if( aEvent.HasPosition() )
{
@ -382,7 +382,7 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::getBusForUnfolding()
{
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_ITEM_LOCATE_BUS_T } );
SCH_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_ITEM_LOCATE_BUS_T } );
return static_cast<SCH_LINE*>( selection.Front() );
}
@ -411,7 +411,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aN
// it might not be, but it won't be a broken connection (and the user asked for it!)
pos = bus->GetSeg().NearestPoint( pos );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos );
m_busUnfold.entry->SetParent( screen );
@ -626,7 +626,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
auto cleanup =
[&] ()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
for( SCH_LINE* wire : m_wires )
delete wire;
@ -931,7 +931,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
m_view->AddToPreview( wire->Clone() );
}
}
else if( evt->IsAction( &EE_ACTIONS::undoLastSegment )
else if( evt->IsAction( &SCH_ACTIONS::undoLastSegment )
|| evt->IsAction( &ACTIONS::doDelete )
|| evt->IsAction( &ACTIONS::undo ) )
{
@ -975,7 +975,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
wxBell();
}
}
else if( evt->IsAction( &EE_ACTIONS::switchSegmentPosture ) && m_wires.size() >= 2 )
else if( evt->IsAction( &SCH_ACTIONS::switchSegmentPosture ) && m_wires.size() >= 2 )
{
posture = !posture;
@ -1036,11 +1036,11 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
//------------------------------------------------------------------------
// Handle TOOL_ACTION special cases
//
else if( evt->IsAction( &EE_ACTIONS::rotateCW ) || evt->IsAction( &EE_ACTIONS::rotateCCW ) )
else if( evt->IsAction( &SCH_ACTIONS::rotateCW ) || evt->IsAction( &SCH_ACTIONS::rotateCCW ) )
{
if( m_busUnfold.in_progress )
{
m_busUnfold.label->Rotate90( evt->IsAction( &EE_ACTIONS::rotateCW ) );
m_busUnfold.label->Rotate90( evt->IsAction( &SCH_ACTIONS::rotateCW ) );
busUnfoldPersistentSettings.label_spin_style = m_busUnfold.label->GetSpinStyle();
m_toolMgr->PostAction( ACTIONS::refreshPreview );
@ -1169,7 +1169,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
// Clear selection when done so that a new wire can be started.
// NOTE: this must be done before simplifyWireList is called or we might end up with
// freed selected items.
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
SCH_SCREEN* screen = m_frame->GetScreen();
SCH_COMMIT commit( m_toolMgr );
@ -1275,7 +1275,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
}
int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( SCH_COMMIT* aCommit, EE_SELECTION* aSelection )
int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( SCH_COMMIT* aCommit, SCH_SELECTION* aSelection )
{
SCHEMATIC* sch = getModel<SCHEMATIC>();
SCH_SCREEN* screen = sch->CurrentSheet().LastScreen();
@ -1319,7 +1319,7 @@ int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( SCH_COMMIT* aCommit, EE_SELECT
}
int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( SCH_COMMIT* aCommit, EE_SELECTION* aSelection )
int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( SCH_COMMIT* aCommit, SCH_SELECTION* aSelection )
{
SCH_SCREEN* screen = m_frame->GetScreen();
@ -1332,9 +1332,9 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( SCH_COMMIT* aCommit, EE_SELECT
void SCH_LINE_WIRE_BUS_TOOL::setTransitions()
{
Go( &SCH_LINE_WIRE_BUS_TOOL::DrawSegments, EE_ACTIONS::drawWire.MakeEvent() );
Go( &SCH_LINE_WIRE_BUS_TOOL::DrawSegments, EE_ACTIONS::drawBus.MakeEvent() );
Go( &SCH_LINE_WIRE_BUS_TOOL::DrawSegments, EE_ACTIONS::drawLines.MakeEvent() );
Go( &SCH_LINE_WIRE_BUS_TOOL::DrawSegments, SCH_ACTIONS::drawWire.MakeEvent() );
Go( &SCH_LINE_WIRE_BUS_TOOL::DrawSegments, SCH_ACTIONS::drawBus.MakeEvent() );
Go( &SCH_LINE_WIRE_BUS_TOOL::DrawSegments, SCH_ACTIONS::drawLines.MakeEvent() );
Go( &SCH_LINE_WIRE_BUS_TOOL::UnfoldBus, EE_ACTIONS::unfoldBus.MakeEvent() );
Go( &SCH_LINE_WIRE_BUS_TOOL::UnfoldBus, SCH_ACTIONS::unfoldBus.MakeEvent() );
}

View File

@ -33,14 +33,14 @@
#include <sch_edit_frame.h>
#include <sch_line.h>
#include <ee_tool_base.h>
#include <sch_tool_base.h>
class TOOL_EVENT;
class SCH_BUS_WIRE_ENTRY;
class SCH_LABEL;
class SCH_EDIT_FRAME;
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
/// Collection of data related to the bus unfolding tool
@ -70,7 +70,7 @@ struct DRAW_SEGMENT_EVENT_PARAMS
* Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.)
*/
class SCH_LINE_WIRE_BUS_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_LINE_WIRE_BUS_TOOL : public SCH_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_LINE_WIRE_BUS_TOOL();
@ -88,12 +88,12 @@ public:
/**
* Handle the addition of junctions to a selection of objects
*/
int AddJunctionsIfNeeded( SCH_COMMIT* aCommit, EE_SELECTION* aSelection );
int AddJunctionsIfNeeded( SCH_COMMIT* aCommit, SCH_SELECTION* aSelection );
/**
* Logic to remove wires when overlapping correct items
*/
int TrimOverLappingWires( SCH_COMMIT* aCommit, EE_SELECTION* aSelection );
int TrimOverLappingWires( SCH_COMMIT* aCommit, SCH_SELECTION* aSelection );
private:
int doDrawSegments( const TOOL_EVENT& aTool, int aType, bool aQuitOnDraw );

View File

@ -28,9 +28,9 @@
#include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h>
#include <tools/ee_grid_helper.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <ee_actions.h>
#include <sch_actions.h>
#include <sch_commit.h>
#include <eda_item.h>
#include <sch_item.h>
@ -52,7 +52,7 @@
SCH_MOVE_TOOL::SCH_MOVE_TOOL() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveMove" ),
SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveMove" ),
m_inMoveTool( false ),
m_moveInProgress( false ),
m_isDrag( false ),
@ -63,7 +63,7 @@ SCH_MOVE_TOOL::SCH_MOVE_TOOL() :
bool SCH_MOVE_TOOL::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
auto moveCondition =
[]( const SELECTION& aSel )
@ -81,9 +81,9 @@ bool SCH_MOVE_TOOL::Init()
//
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddItem( EE_ACTIONS::move, moveCondition, 150 );
selToolMenu.AddItem( EE_ACTIONS::drag, moveCondition, 150 );
selToolMenu.AddItem( EE_ACTIONS::alignToGrid, moveCondition, 150 );
selToolMenu.AddItem( SCH_ACTIONS::move, moveCondition, 150 );
selToolMenu.AddItem( SCH_ACTIONS::drag, moveCondition, 150 );
selToolMenu.AddItem( SCH_ACTIONS::alignToGrid, moveCondition, 150 );
return true;
}
@ -371,7 +371,7 @@ void SCH_MOVE_TOOL::orthoLineDrag( SCH_COMMIT* aCommit, SCH_LINE* line, const VE
int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
{
m_isDrag = aEvent.IsAction( &EE_ACTIONS::drag );
m_isDrag = aEvent.IsAction( &SCH_ACTIONS::drag );
if( SCH_COMMIT* commit = dynamic_cast<SCH_COMMIT*>( aEvent.Commit() ) )
{
@ -431,7 +431,7 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
// And give it a kick so it doesn't have to wait for the first mouse movement
// to refresh.
m_toolMgr->PostAction( EE_ACTIONS::restartMove );
m_toolMgr->PostAction( SCH_ACTIONS::restartMove );
}
}
else
@ -448,7 +448,7 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
REENTRANCY_GUARD guard( &m_inMoveTool );
EE_SELECTION& userSelection = m_selectionTool->GetSelection();
SCH_SELECTION& userSelection = m_selectionTool->GetSelection();
// If a single pin is selected, promote the move selection to its parent symbol
if( userSelection.GetSize() == 1 )
@ -469,9 +469,9 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
// Be sure that there is at least one item that we can move. If there's no selection try
// looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::MovableItems,
true );
bool unselect = selection.IsHover();
SCH_SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::MovableItems,
true );
bool unselect = selection.IsHover();
// Keep an original copy of the starting points for cleanup after the move
std::vector<DANGLING_END_ITEM> internalPoints;
@ -506,9 +506,9 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
if( evt->IsAction( &EE_ACTIONS::restartMove )
|| evt->IsAction( &EE_ACTIONS::move )
|| evt->IsAction( &EE_ACTIONS::drag )
if( evt->IsAction( &SCH_ACTIONS::restartMove )
|| evt->IsAction( &SCH_ACTIONS::move )
|| evt->IsAction( &SCH_ACTIONS::drag )
|| evt->IsMotion()
|| evt->IsDrag( BUT_LEFT )
|| evt->IsAction( &ACTIONS::refreshPreview ) )
@ -649,7 +649,7 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
//
m_cursor = controls->GetCursorPosition();
if( evt->IsAction( &EE_ACTIONS::restartMove ) )
if( evt->IsAction( &SCH_ACTIONS::restartMove ) )
{
wxASSERT_MSG( m_anchorPos, "Should be already set from previous cmd" );
}
@ -858,13 +858,13 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
{
wxBell();
}
else if( evt->IsAction( &EE_ACTIONS::rotateCW ) )
else if( evt->IsAction( &SCH_ACTIONS::rotateCW ) )
{
m_toolMgr->RunSynchronousAction( EE_ACTIONS::rotateCW, aCommit );
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::rotateCW, aCommit );
}
else if( evt->IsAction( &EE_ACTIONS::rotateCCW ) )
else if( evt->IsAction( &SCH_ACTIONS::rotateCCW ) )
{
m_toolMgr->RunSynchronousAction( EE_ACTIONS::rotateCCW, aCommit );
m_toolMgr->RunSynchronousAction( SCH_ACTIONS::rotateCCW, aCommit );
}
else if( evt->IsAction( &ACTIONS::increment ) )
{
@ -898,8 +898,8 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
}
}
}
else if( evt->IsAction( &EE_ACTIONS::highlightNet )
|| evt->IsAction( &EE_ACTIONS::selectOnPCB ) )
else if( evt->IsAction( &SCH_ACTIONS::highlightNet )
|| evt->IsAction( &SCH_ACTIONS::selectOnPCB ) )
{
// These don't make any sense during a move. Eat them.
}
@ -931,7 +931,7 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
// Create a selection of original selection, drag selected/changed items, and new
// bend lines for later before we clear them in the aCommit. We'll need these
// to check for new junctions needed, etc.
EE_SELECTION selectionCopy( selection );
SCH_SELECTION selectionCopy( selection );
for( SCH_LINE* line : m_newDragLines )
selectionCopy.Add( line );
@ -1014,7 +1014,7 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm
item->ClearEditFlags();
if( unselect )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
else
m_selectionTool->RebuildSelection(); // Schematic cleanup might have merged lines, etc.
@ -1651,7 +1651,7 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta )
int SCH_MOVE_TOOL::AlignToGrid( const TOOL_EVENT& aEvent )
{
EE_GRID_HELPER grid( m_toolMgr);
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::MovableItems );
SCH_SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::MovableItems );
GRID_HELPER_GRIDS selectionGrid = grid.GetSelectionGrid( selection );
SCH_COMMIT commit( m_toolMgr );
@ -1840,9 +1840,9 @@ void SCH_MOVE_TOOL::clearNewDragLines()
void SCH_MOVE_TOOL::setTransitions()
{
Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::move.MakeEvent() );
Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::drag.MakeEvent() );
Go( &SCH_MOVE_TOOL::AlignToGrid, EE_ACTIONS::alignToGrid.MakeEvent() );
Go( &SCH_MOVE_TOOL::Main, SCH_ACTIONS::move.MakeEvent() );
Go( &SCH_MOVE_TOOL::Main, SCH_ACTIONS::drag.MakeEvent() );
Go( &SCH_MOVE_TOOL::AlignToGrid, SCH_ACTIONS::alignToGrid.MakeEvent() );
}

View File

@ -25,12 +25,12 @@
#ifndef KICAD_SCH_MOVE_TOOL_H
#define KICAD_SCH_MOVE_TOOL_H
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <sch_base_frame.h>
class SCH_EDIT_FRAME;
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
struct SPECIAL_CASE_LABEL_INFO
@ -40,7 +40,7 @@ struct SPECIAL_CASE_LABEL_INFO
};
class SCH_MOVE_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_MOVE_TOOL : public SCH_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_MOVE_TOOL();

View File

@ -24,7 +24,7 @@
#include <schematic.h>
#include <eeschema_id.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <tools/sch_navigate_tool.h>
#include "eda_doc.h"
@ -123,7 +123,7 @@ int SCH_NAVIGATE_TOOL::Forward( const TOOL_EVENT& aEvent )
m_navIndex++;
m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
m_frame->SetCurrentSheet( *m_navIndex );
m_frame->DisplayCurrentSheet();
@ -144,7 +144,7 @@ int SCH_NAVIGATE_TOOL::Back( const TOOL_EVENT& aEvent )
m_navIndex--;
m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
m_frame->SetCurrentSheet( *m_navIndex );
m_frame->DisplayCurrentSheet();
@ -234,8 +234,8 @@ int SCH_NAVIGATE_TOOL::ChangeSheet( const TOOL_EVENT& aEvent )
int SCH_NAVIGATE_TOOL::EnterSheet( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
const EE_SELECTION& selection = selTool->RequestSelection( { SCH_SHEET_T } );
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
const SCH_SELECTION& selection = selTool->RequestSelection( { SCH_SHEET_T } );
if( selection.GetSize() == 1 )
{
@ -269,16 +269,16 @@ int SCH_NAVIGATE_TOOL::LeaveSheet( const TOOL_EVENT& aEvent )
void SCH_NAVIGATE_TOOL::setTransitions()
{
Go( &SCH_NAVIGATE_TOOL::ChangeSheet, EE_ACTIONS::changeSheet.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::EnterSheet, EE_ACTIONS::enterSheet.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::LeaveSheet, EE_ACTIONS::leaveSheet.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::ChangeSheet, SCH_ACTIONS::changeSheet.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::EnterSheet, SCH_ACTIONS::enterSheet.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::LeaveSheet, SCH_ACTIONS::leaveSheet.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Up, EE_ACTIONS::navigateUp.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Forward, EE_ACTIONS::navigateForward.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Back, EE_ACTIONS::navigateBack.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Up, SCH_ACTIONS::navigateUp.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Forward, SCH_ACTIONS::navigateForward.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Back, SCH_ACTIONS::navigateBack.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Previous, EE_ACTIONS::navigatePrevious.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Next, EE_ACTIONS::navigateNext.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Previous, SCH_ACTIONS::navigatePrevious.MakeEvent() );
Go( &SCH_NAVIGATE_TOOL::Next, SCH_ACTIONS::navigateNext.MakeEvent() );
}
@ -297,7 +297,7 @@ void SCH_NAVIGATE_TOOL::pushToHistory( SCH_SHEET_PATH aPath )
void SCH_NAVIGATE_TOOL::changeSheet( SCH_SHEET_PATH aPath )
{
m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
// Store the current zoom level into the current screen before switching
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();

View File

@ -27,7 +27,7 @@
#define SCH_NAVIGATE_TOOL_H
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <status_popup.h>
class SCH_EDIT_FRAME;
@ -35,10 +35,10 @@ class SCH_EDIT_FRAME;
/**
* Handle actions specific to the schematic editor.
*/
class SCH_NAVIGATE_TOOL : public wxEvtHandler, public EE_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_NAVIGATE_TOOL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_NAVIGATE_TOOL() : EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.NavigateTool" ) {}
SCH_NAVIGATE_TOOL() : SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.NavigateTool" ) {}
~SCH_NAVIGATE_TOOL() { }

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ee_point_editor.h"
#include "sch_point_editor.h"
#include <functional>
using namespace std::placeholders;
@ -35,8 +35,8 @@ using namespace std::placeholders;
#include <geometry/seg.h>
#include <geometry/shape_utils.h>
#include <tool/point_editor_behavior.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_actions.h>
#include <tools/sch_selection_tool.h>
#include <sch_edit_frame.h>
#include <sch_line.h>
#include <sch_bitmap.h>
@ -95,7 +95,8 @@ class LINE_POINT_EDIT_BEHAVIOR : public POINT_EDIT_BEHAVIOR
{
public:
LINE_POINT_EDIT_BEHAVIOR( SCH_LINE& aLine, SCH_SCREEN& aScreen ) :
m_line( aLine ), m_screen( aScreen )
m_line( aLine ),
m_screen( aScreen )
{
}
@ -237,7 +238,9 @@ private:
class BITMAP_POINT_EDIT_BEHAVIOR : public POINT_EDIT_BEHAVIOR
{
public:
BITMAP_POINT_EDIT_BEHAVIOR( SCH_BITMAP& aBitmap ) : m_bitmap( aBitmap ) {}
BITMAP_POINT_EDIT_BEHAVIOR( SCH_BITMAP& aBitmap ) :
m_bitmap( aBitmap )
{}
void MakePoints( EDIT_POINTS& aPoints ) override
{
@ -434,7 +437,8 @@ class RECTANGLE_POINT_EDIT_BEHAVIOR : public POINT_EDIT_BEHAVIOR
{
public:
RECTANGLE_POINT_EDIT_BEHAVIOR( SCH_SHAPE& aRect, EDA_DRAW_FRAME& aFrame ) :
m_rect( aRect ), m_frame( aFrame )
m_rect( aRect ),
m_frame( aFrame )
{
}
@ -744,7 +748,9 @@ private:
class TEXTBOX_POINT_EDIT_BEHAVIOR : public POINT_EDIT_BEHAVIOR
{
public:
TEXTBOX_POINT_EDIT_BEHAVIOR( SCH_TEXTBOX& aTextbox ) : m_textbox( aTextbox ) {}
TEXTBOX_POINT_EDIT_BEHAVIOR( SCH_TEXTBOX& aTextbox ) :
m_textbox( aTextbox )
{}
void MakePoints( EDIT_POINTS& aPoints ) override
{
@ -776,7 +782,9 @@ private:
class SHEET_POINT_EDIT_BEHAVIOR : public POINT_EDIT_BEHAVIOR
{
public:
SHEET_POINT_EDIT_BEHAVIOR( SCH_SHEET& aSheet ) : m_sheet( aSheet ) {}
SHEET_POINT_EDIT_BEHAVIOR( SCH_SHEET& aSheet ) :
m_sheet( aSheet )
{}
void MakePoints( EDIT_POINTS& aPoints ) override
{
@ -880,7 +888,7 @@ private:
};
void EE_POINT_EDITOR::makePointsAndBehavior( EDA_ITEM* aItem )
void SCH_POINT_EDITOR::makePointsAndBehavior( EDA_ITEM* aItem )
{
m_editBehavior = nullptr;
m_editPoints = std::make_shared<EDIT_POINTS>( aItem );
@ -971,38 +979,38 @@ void EE_POINT_EDITOR::makePointsAndBehavior( EDA_ITEM* aItem )
}
EE_POINT_EDITOR::EE_POINT_EDITOR() :
EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.PointEditor" ),
m_editedPoint( nullptr ),
m_inPointEditor( false )
SCH_POINT_EDITOR::SCH_POINT_EDITOR() :
SCH_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.PointEditor" ),
m_editedPoint( nullptr ),
m_inPointEditor( false )
{
}
void EE_POINT_EDITOR::Reset( RESET_REASON aReason )
void SCH_POINT_EDITOR::Reset( RESET_REASON aReason )
{
EE_TOOL_BASE::Reset( aReason );
SCH_TOOL_BASE::Reset( aReason );
m_editPoints.reset();
m_editedPoint = nullptr;
}
bool EE_POINT_EDITOR::Init()
bool SCH_POINT_EDITOR::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
auto& menu = m_selectionTool->GetToolMenu().GetMenu();
menu.AddItem( EE_ACTIONS::pointEditorAddCorner,
std::bind( &EE_POINT_EDITOR::addCornerCondition, this, _1 ) );
menu.AddItem( EE_ACTIONS::pointEditorRemoveCorner,
std::bind( &EE_POINT_EDITOR::removeCornerCondition, this, _1 ) );
menu.AddItem( SCH_ACTIONS::pointEditorAddCorner,
std::bind( &SCH_POINT_EDITOR::addCornerCondition, this, _1 ) );
menu.AddItem( SCH_ACTIONS::pointEditorRemoveCorner,
std::bind( &SCH_POINT_EDITOR::removeCornerCondition, this, _1 ) );
return true;
}
int EE_POINT_EDITOR::clearEditedPoints( const TOOL_EVENT& aEvent )
int SCH_POINT_EDITOR::clearEditedPoints( const TOOL_EVENT& aEvent )
{
setEditedPoint( nullptr );
@ -1010,7 +1018,7 @@ int EE_POINT_EDITOR::clearEditedPoints( const TOOL_EVENT& aEvent )
}
void EE_POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
void SCH_POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
{
EDIT_POINT* point = m_editedPoint;
@ -1036,7 +1044,7 @@ void EE_POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
}
int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
int SCH_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
{
if( !m_selectionTool )
return 0;
@ -1054,12 +1062,10 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
return 0;
}
const EE_SELECTION& selection = m_selectionTool->GetSelection();
const SCH_SELECTION& selection = m_selectionTool->GetSelection();
if( selection.Size() != 1 || !selection.Front()->IsType( pointEditorTypes ) )
{
return 0;
}
// Wait till drawing tool is done
if( selection.Front()->IsNew() )
@ -1185,7 +1191,7 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
}
void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid, SCH_COMMIT& aCommit ) const
void SCH_POINT_EDITOR::updateParentItem( bool aSnapToGrid, SCH_COMMIT& aCommit ) const
{
EDA_ITEM* item = m_editPoints->GetParent();
@ -1205,7 +1211,7 @@ void EE_POINT_EDITOR::updateParentItem( bool aSnapToGrid, SCH_COMMIT& aCommit )
}
void EE_POINT_EDITOR::updatePoints()
void SCH_POINT_EDITOR::updatePoints()
{
if( !m_editPoints || !m_editBehavior )
return;
@ -1215,7 +1221,7 @@ void EE_POINT_EDITOR::updatePoints()
}
void EE_POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
void SCH_POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
{
KIGFX::VIEW_CONTROLS* controls = getViewControls();
@ -1237,7 +1243,7 @@ void EE_POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
}
bool EE_POINT_EDITOR::removeCornerCondition( const SELECTION& )
bool SCH_POINT_EDITOR::removeCornerCondition( const SELECTION& )
{
bool isRuleArea = false;
@ -1272,7 +1278,7 @@ bool EE_POINT_EDITOR::removeCornerCondition( const SELECTION& )
}
bool EE_POINT_EDITOR::addCornerCondition( const SELECTION& )
bool SCH_POINT_EDITOR::addCornerCondition( const SELECTION& )
{
if( !m_editPoints
|| !( m_editPoints->GetParent()->Type() == SCH_SHAPE_T
@ -1293,12 +1299,14 @@ bool EE_POINT_EDITOR::addCornerCondition( const SELECTION& )
}
int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
int SCH_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
{
if( !m_editPoints
|| !( m_editPoints->GetParent()->Type() == SCH_SHAPE_T
|| m_editPoints->GetParent()->Type() == SCH_RULE_AREA_T ) )
{
return 0;
}
SCH_SHAPE* shape = static_cast<SCH_SHAPE*>( m_editPoints->GetParent() );
SHAPE_LINE_CHAIN& poly = shape->GetPolyShape().Outline( 0 );
@ -1336,7 +1344,7 @@ int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
}
int EE_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
int SCH_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
{
if( !m_editPoints || !m_editedPoint
|| !m_editPoints->GetParent()->IsType( { SCH_SHAPE_T, SCH_RULE_AREA_T } ) )
@ -1380,22 +1388,22 @@ int EE_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
}
int EE_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent )
int SCH_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent )
{
updatePoints();
return 0;
}
void EE_POINT_EDITOR::setTransitions()
void SCH_POINT_EDITOR::setTransitions()
{
Go( &EE_POINT_EDITOR::Main, EVENTS::PointSelectedEvent );
Go( &EE_POINT_EDITOR::Main, EVENTS::SelectedEvent );
Go( &EE_POINT_EDITOR::Main, ACTIONS::activatePointEditor.MakeEvent() );
Go( &EE_POINT_EDITOR::addCorner, EE_ACTIONS::pointEditorAddCorner.MakeEvent() );
Go( &EE_POINT_EDITOR::removeCorner, EE_ACTIONS::pointEditorRemoveCorner.MakeEvent() );
Go( &EE_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified );
Go( &EE_POINT_EDITOR::clearEditedPoints, EVENTS::ClearedEvent );
Go( &SCH_POINT_EDITOR::Main, EVENTS::PointSelectedEvent );
Go( &SCH_POINT_EDITOR::Main, EVENTS::SelectedEvent );
Go( &SCH_POINT_EDITOR::Main, ACTIONS::activatePointEditor.MakeEvent() );
Go( &SCH_POINT_EDITOR::addCorner, SCH_ACTIONS::pointEditorAddCorner.MakeEvent() );
Go( &SCH_POINT_EDITOR::removeCorner, SCH_ACTIONS::pointEditorRemoveCorner.MakeEvent() );
Go( &SCH_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified );
Go( &SCH_POINT_EDITOR::clearEditedPoints, EVENTS::ClearedEvent );
}

View File

@ -22,14 +22,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef EE_POINT_EDITOR_H
#define EE_POINT_EDITOR_H
#ifndef SCH_POINT_EDITOR_H
#define SCH_POINT_EDITOR_H
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <tool/edit_points.h>
#include <tool/selection.h>
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
class POINT_EDIT_BEHAVIOR;
class SCH_BASE_FRAME;
class SCH_COMMIT;
@ -37,10 +37,10 @@ class SCH_COMMIT;
/**
* Tool that displays edit points allowing to modify items by dragging the points.
*/
class EE_POINT_EDITOR : public EE_TOOL_BASE<SCH_BASE_FRAME>
class SCH_POINT_EDITOR : public SCH_TOOL_BASE<SCH_BASE_FRAME>
{
public:
EE_POINT_EDITOR();
SCH_POINT_EDITOR();
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;
@ -123,4 +123,4 @@ private:
std::unique_ptr<POINT_EDIT_BEHAVIOR> m_editBehavior;
};
#endif // EE_POINT_EDITOR_H
#endif // SCH_POINT_EDITOR_H

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <tools/ee_selection.h>
#include <tools/sch_selection.h>
#include <sch_item.h>
#include <sch_reference_list.h>
#include <sch_sheet_path.h>
@ -30,14 +30,14 @@
#include <sch_sheet.h>
EE_SELECTION::EE_SELECTION( SCH_SCREEN* aScreen ) :
SELECTION()
SCH_SELECTION::SCH_SELECTION( SCH_SCREEN* aScreen ) :
SELECTION()
{
m_screen = aScreen;
}
EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
EDA_ITEM* SCH_SELECTION::GetTopLeftItem( bool onlyModules ) const
{
EDA_ITEM* topLeftConnectedItem = nullptr;
VECTOR2I topLeftConnectedPos;
@ -82,7 +82,7 @@ EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
}
BOX2I EE_SELECTION::GetBoundingBox() const
BOX2I SCH_SELECTION::GetBoundingBox() const
{
BOX2I bbox;
@ -115,7 +115,7 @@ BOX2I EE_SELECTION::GetBoundingBox() const
}
const std::vector<KIGFX::VIEW_ITEM*> EE_SELECTION::updateDrawList() const
const std::vector<KIGFX::VIEW_ITEM*> SCH_SELECTION::updateDrawList() const
{
std::vector<VIEW_ITEM*> items;

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef EE_SELECTION_H
#define EE_SELECTION_H
#ifndef SCH_SELECTION_H
#define SCH_SELECTION_H
class SCH_REFERENCE_LIST;
class SCH_SCREEN;
@ -34,7 +34,7 @@ class SCH_SHEET_PATH;
#include <sch_sheet_path.h> // SCH_MULTI_UNIT_REFERENCE_MAP
class EE_SELECTION : public SELECTION
class SCH_SELECTION : public SELECTION
{
/**
* Screen of selected objects. Used to fetch library symbols for copy.
@ -42,7 +42,7 @@ class EE_SELECTION : public SELECTION
SCH_SCREEN* m_screen;
public:
EE_SELECTION( SCH_SCREEN* aScreen = nullptr );
SCH_SELECTION( SCH_SCREEN* aScreen = nullptr );
EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const override;
@ -54,4 +54,4 @@ public:
const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
};
#endif // EE_SELECTION_H
#endif // SCH_SELECTION_H

View File

@ -27,9 +27,9 @@
#include <core/kicad_algo.h>
#include <gal/graphics_abstraction_layer.h>
#include <geometry/shape_compound.h>
#include <ee_actions.h>
#include <ee_collectors.h>
#include <ee_selection_tool.h>
#include <sch_actions.h>
#include <sch_collectors.h>
#include <sch_selection_tool.h>
#include <eeschema_id.h>
#include <symbol_edit_frame.h>
#include <symbol_viewer_frame.h>
@ -37,26 +37,18 @@
#include <geometry/shape_rect.h>
#include <sch_painter.h>
#include <preview_items/selection_area.h>
#include <sch_base_frame.h>
#include <sch_commit.h>
#include <sch_symbol.h>
#include <sch_field.h>
#include <sch_edit_frame.h>
#include <sch_item.h>
#include <sch_line.h>
#include <sch_bus_entry.h>
#include <sch_marker.h>
#include <sch_no_connect.h>
#include <sch_render_settings.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <sch_table.h>
#include <sch_tablecell.h>
#include <schematic.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <tools/ee_grid_helper.h>
#include <tools/ee_point_editor.h>
#include <tools/sch_point_editor.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <tools/sch_editor_control.h>
#include <trigo.h>
@ -67,7 +59,7 @@
#include "symb_transforms_utils.h"
SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
@ -81,13 +73,13 @@ SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
};
SELECTION_CONDITION EE_CONDITIONS::SingleSymbolOrPower = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::SingleSymbolOrPower = []( const SELECTION& aSel )
{
return aSel.GetSize() == 1 && aSel.Front()->Type() == SCH_SYMBOL_T;
};
SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::SingleDeMorganSymbol = []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
@ -101,7 +93,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = []( const SELECTION& a
};
SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::SingleMultiUnitSymbol = []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
@ -115,7 +107,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol = []( const SELECTION&
};
SELECTION_CONDITION EE_CONDITIONS::SingleMultiFunctionPin = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::SingleMultiFunctionPin = []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
@ -129,7 +121,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleMultiFunctionPin = []( const SELECTION&
};
SELECTION_CONDITION EE_CONDITIONS::SingleNonExcludedMarker = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::SingleNonExcludedMarker = []( const SELECTION& aSel )
{
if( aSel.CountType( SCH_MARKER_T ) != 1 )
return false;
@ -138,19 +130,19 @@ SELECTION_CONDITION EE_CONDITIONS::SingleNonExcludedMarker = []( const SELECTION
};
SELECTION_CONDITION EE_CONDITIONS::MultipleSymbolsOrPower = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::MultipleSymbolsOrPower = []( const SELECTION& aSel )
{
return aSel.GetSize() > 1 && aSel.OnlyContains( { SCH_SYMBOL_T } );
};
SELECTION_CONDITION EE_CONDITIONS::AllPins = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::AllPins = []( const SELECTION& aSel )
{
return aSel.GetSize() >= 1 && aSel.OnlyContains( { SCH_PIN_T } );
};
SELECTION_CONDITION EE_CONDITIONS::AllPinsOrSheetPins = []( const SELECTION& aSel )
SELECTION_CONDITION SCH_CONDITIONS::AllPinsOrSheetPins = []( const SELECTION& aSel )
{
return aSel.GetSize() >= 1 && aSel.OnlyContains( { SCH_PIN_T, SCH_SHEET_PIN_T } );
};
@ -159,7 +151,7 @@ SELECTION_CONDITION EE_CONDITIONS::AllPinsOrSheetPins = []( const SELECTION& aSe
#define HITTEST_THRESHOLD_PIXELS 5
EE_SELECTION_TOOL::EE_SELECTION_TOOL() :
SCH_SELECTION_TOOL::SCH_SELECTION_TOOL() :
SELECTION_TOOL( "eeschema.InteractiveSelection" ),
m_frame( nullptr ),
m_nonModifiedCursor( KICURSOR::ARROW ),
@ -173,15 +165,12 @@ EE_SELECTION_TOOL::EE_SELECTION_TOOL() :
}
EE_SELECTION_TOOL::~EE_SELECTION_TOOL()
SCH_SELECTION_TOOL::~SCH_SELECTION_TOOL()
{
getView()->Remove( &m_selection );
}
using E_C = EE_CONDITIONS;
static std::vector<KICAD_T> connectedTypes =
{
SCH_SYMBOL_LOCATE_POWER_T,
@ -215,7 +204,7 @@ static std::vector<KICAD_T> lineTypes = { SCH_LINE_T };
static std::vector<KICAD_T> sheetTypes = { SCH_SHEET_T };
static std::vector<KICAD_T> tableCellTypes = { SCH_TABLECELL_T };
bool EE_SELECTION_TOOL::Init()
bool SCH_SELECTION_TOOL::Init()
{
m_frame = getEditFrame<SCH_BASE_FRAME>();
@ -233,12 +222,14 @@ bool EE_SELECTION_TOOL::Init()
m_isSymbolViewer = symbolViewerFrame != nullptr;
}
auto linesSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( lineTypes );
auto wireOrBusSelection = E_C::Count( 1 ) && E_C::OnlyTypes( connectedLineTypes );
auto connectedSelection = E_C::Count( 1 ) && E_C::OnlyTypes( connectedTypes );
auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyTypes( sheetTypes );
auto crossProbingSelection = E_C::MoreThan( 0 ) && E_C::HasTypes( crossProbingTypes );
auto tableCellSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( tableCellTypes );
// clang-format off
auto linesSelection = SCH_CONDITIONS::MoreThan( 0 ) && SCH_CONDITIONS::OnlyTypes( lineTypes );
auto wireOrBusSelection = SCH_CONDITIONS::Count( 1 ) && SCH_CONDITIONS::OnlyTypes( connectedLineTypes );
auto connectedSelection = SCH_CONDITIONS::Count( 1 ) && SCH_CONDITIONS::OnlyTypes( connectedTypes );
auto sheetSelection = SCH_CONDITIONS::Count( 1 ) && SCH_CONDITIONS::OnlyTypes( sheetTypes );
auto crossProbingSelection = SCH_CONDITIONS::MoreThan( 0 ) && SCH_CONDITIONS::HasTypes( crossProbingTypes );
auto tableCellSelection = SCH_CONDITIONS::MoreThan( 0 ) && SCH_CONDITIONS::OnlyTypes( tableCellTypes );
// clang-format on
auto schEditSheetPageNumberCondition =
[&] ( const SELECTION& aSel )
@ -246,7 +237,8 @@ bool EE_SELECTION_TOOL::Init()
if( m_isSymbolEditor || m_isSymbolViewer )
return false;
return E_C::LessThan( 2 )( aSel ) && E_C::OnlyTypes( sheetTypes )( aSel );
return SCH_CONDITIONS::LessThan( 2 )( aSel )
&& SCH_CONDITIONS::OnlyTypes( sheetTypes )( aSel );
};
auto schEditCondition =
@ -296,58 +288,57 @@ bool EE_SELECTION_TOOL::Init()
auto& menu = m_menu->GetMenu();
menu.AddItem( EE_ACTIONS::clearHighlight, haveHighlight && EE_CONDITIONS::Idle, 1 );
menu.AddSeparator( haveHighlight && EE_CONDITIONS::Idle, 1 );
// clang-format off
menu.AddItem( SCH_ACTIONS::clearHighlight, haveHighlight && SCH_CONDITIONS::Idle, 1 );
menu.AddSeparator( haveHighlight && SCH_CONDITIONS::Idle, 1 );
menu.AddItem( ACTIONS::selectColumns, tableCellSelection && EE_CONDITIONS::Idle, 2 );
menu.AddItem( ACTIONS::selectRows, tableCellSelection && EE_CONDITIONS::Idle, 2 );
menu.AddItem( ACTIONS::selectTable, tableCellSelection && EE_CONDITIONS::Idle, 2 );
menu.AddItem( ACTIONS::selectColumns, tableCellSelection && SCH_CONDITIONS::Idle, 2 );
menu.AddItem( ACTIONS::selectRows, tableCellSelection && SCH_CONDITIONS::Idle, 2 );
menu.AddItem( ACTIONS::selectTable, tableCellSelection && SCH_CONDITIONS::Idle, 2 );
menu.AddSeparator( 100 );
menu.AddItem( EE_ACTIONS::drawWire, schEditCondition && EE_CONDITIONS::Empty, 100 );
menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
menu.AddItem( SCH_ACTIONS::drawWire, schEditCondition && SCH_CONDITIONS::Empty, 100 );
menu.AddItem( SCH_ACTIONS::drawBus, schEditCondition && SCH_CONDITIONS::Empty, 100 );
menu.AddSeparator( 100 );
menu.AddItem( ACTIONS::finishInteractive,
SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus, 100 );
menu.AddItem( ACTIONS::finishInteractive, SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus, 100 );
menu.AddItem( EE_ACTIONS::enterSheet, sheetSelection && EE_CONDITIONS::Idle, 150 );
menu.AddItem( EE_ACTIONS::selectOnPCB,
crossProbingSelection && schEditCondition && EE_CONDITIONS::Idle, 150 );
menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 150 );
menu.AddItem( SCH_ACTIONS::enterSheet, sheetSelection && SCH_CONDITIONS::Idle, 150 );
menu.AddItem( SCH_ACTIONS::selectOnPCB, crossProbingSelection && schEditCondition && SCH_CONDITIONS::Idle, 150 );
menu.AddItem( SCH_ACTIONS::leaveSheet, belowRootSheetCondition, 150 );
menu.AddSeparator( 200 );
menu.AddItem( EE_ACTIONS::placeJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::placeLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::placeClassLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::breakWire, linesSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::slice, linesSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::placeSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::autoplaceAllSheetPins, sheetSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::syncSheetPins, sheetSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::assignNetclass, connectedSelection && EE_CONDITIONS::Idle, 250 );
menu.AddItem( EE_ACTIONS::editPageNumber, schEditSheetPageNumberCondition, 250 );
menu.AddItem( SCH_ACTIONS::placeJunction, wireOrBusSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::placeLabel, wireOrBusSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::placeClassLabel, wireOrBusSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::placeGlobalLabel, wireOrBusSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::placeHierLabel, wireOrBusSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::breakWire, linesSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::slice, linesSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::placeSheetPin, sheetSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::autoplaceAllSheetPins, sheetSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::syncSheetPins, sheetSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::assignNetclass, connectedSelection && SCH_CONDITIONS::Idle, 250 );
menu.AddItem( SCH_ACTIONS::editPageNumber, schEditSheetPageNumberCondition, 250 );
menu.AddSeparator( 400 );
menu.AddItem( EE_ACTIONS::symbolProperties, haveSymbol && EE_CONDITIONS::Empty, 400 );
menu.AddItem( EE_ACTIONS::pinTable, haveSymbol && EE_CONDITIONS::Empty, 400 );
menu.AddItem( EE_ACTIONS::setUnitDisplayName,
haveSymbol && symbolDisplayNameIsEditable && EE_CONDITIONS::Empty, 400 );
menu.AddItem( SCH_ACTIONS::symbolProperties, haveSymbol && SCH_CONDITIONS::Empty, 400 );
menu.AddItem( SCH_ACTIONS::pinTable, haveSymbol && SCH_CONDITIONS::Empty, 400 );
menu.AddItem( SCH_ACTIONS::setUnitDisplayName, haveSymbol && symbolDisplayNameIsEditable && SCH_CONDITIONS::Empty, 400 );
menu.AddSeparator( 1000 );
m_frame->AddStandardSubMenus( *m_menu.get() );
// clang-format on
m_disambiguateTimer.SetOwner( this );
Connect( wxEVT_TIMER, wxTimerEventHandler( EE_SELECTION_TOOL::onDisambiguationExpire ),
Connect( wxEVT_TIMER, wxTimerEventHandler( SCH_SELECTION_TOOL::onDisambiguationExpire ),
nullptr, this );
return true;
}
void EE_SELECTION_TOOL::Reset( RESET_REASON aReason )
void SCH_SELECTION_TOOL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<SCH_BASE_FRAME>();
@ -386,7 +377,7 @@ void EE_SELECTION_TOOL::Reset( RESET_REASON aReason )
}
int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
@ -450,8 +441,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
// Avoid triggering when running under other tools
}
else if( m_toolMgr->GetTool<EE_POINT_EDITOR>()
&& m_toolMgr->GetTool<EE_POINT_EDITOR>()->HasPoint() )
else if( m_toolMgr->GetTool<SCH_POINT_EDITOR>()
&& m_toolMgr->GetTool<SCH_POINT_EDITOR>()->HasPoint() )
{
// Distinguish point editor from selection modification by checking modifiers
if( hasModifier() )
@ -483,7 +474,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
schframe->FocusOnItem( nullptr );
// Collect items at the clicked location (doesn't select them yet)
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
CollectHits( collector, evt->Position() );
narrowSelection( collector, evt->Position(), false );
@ -547,7 +538,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
else if( !m_selection.GetBoundingBox().Inflate( grid.GetGrid().x, grid.GetGrid().y )
.Contains( evt->Position() ) )
{
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
if( CollectHits( collector, evt->Position(), { SCH_LOCATE_ANY_T } ) )
{
@ -575,9 +566,9 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
EDA_ITEM* item = m_selection.Front();
if( item && item->Type() == SCH_SHEET_T )
m_toolMgr->PostAction( EE_ACTIONS::enterSheet );
m_toolMgr->PostAction( SCH_ACTIONS::enterSheet );
else
m_toolMgr->PostAction( EE_ACTIONS::properties );
m_toolMgr->PostAction( SCH_ACTIONS::properties );
}
else if( evt->IsDblClick( BUT_MIDDLE ) )
{
@ -605,11 +596,11 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
schframe->FocusOnItem( nullptr );
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
if( m_selection.GetSize() == 1 && dynamic_cast<SCH_TABLE*>( m_selection.GetItem( 0 ) ) )
{
m_toolMgr->RunAction( EE_ACTIONS::move );
m_toolMgr->RunAction( SCH_ACTIONS::move );
}
else if( CollectHits( collector, evt->DragOrigin(), { SCH_TABLECELL_T } ) )
{
@ -642,7 +633,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
else
{
m_selection = RequestSelection( EE_COLLECTOR::MovableItems );
m_selection = RequestSelection( SCH_COLLECTOR::MovableItems );
}
// Check if dragging has started within any of selected items bounding box
@ -651,9 +642,9 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// drag_is_move option exists only in schematic editor, not in symbol editor
// (m_frame->eeconfig() returns nullptr in Symbol Editor)
if( m_isSymbolEditor || m_frame->eeconfig()->m_Input.drag_is_move )
m_toolMgr->RunAction( EE_ACTIONS::move );
m_toolMgr->RunAction( SCH_ACTIONS::move );
else
m_toolMgr->RunAction( EE_ACTIONS::drag );
m_toolMgr->RunAction( SCH_ACTIONS::drag );
}
else
{
@ -664,11 +655,11 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
else if( evt->IsMouseDown( BUT_AUX1 ) )
{
m_toolMgr->RunAction( EE_ACTIONS::navigateBack );
m_toolMgr->RunAction( SCH_ACTIONS::navigateBack );
}
else if( evt->IsMouseDown( BUT_AUX2 ) )
{
m_toolMgr->RunAction( EE_ACTIONS::navigateForward );
m_toolMgr->RunAction( SCH_ACTIONS::navigateForward );
}
else if( evt->Action() == TA_MOUSE_WHEEL )
{
@ -807,7 +798,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
vc->WarpMouseCursor( vc->GetCursorPosition(), true );
// Start the drag tool, canceling will remove the wires
if( m_toolMgr->RunSynchronousAction( EE_ACTIONS::drag, &commit, false ) )
if( m_toolMgr->RunSynchronousAction( SCH_ACTIONS::drag, &commit, false ) )
commit.Push( wxS( "Wire Pins" ) );
else
commit.Revert();
@ -936,7 +927,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
&& *evt->GetCommandId() <= ID_POPUP_SCH_UNFOLD_BUS_END )
{
wxString* net = new wxString( *evt->Parameter<wxString*>() );
m_toolMgr->RunAction<wxString*>( EE_ACTIONS::unfoldBus, net );
m_toolMgr->RunAction<wxString*>( SCH_ACTIONS::unfoldBus, net );
}
}
else if( evt->IsCancelInteractive() )
@ -972,7 +963,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
// Update cursor and rollover item
rolloverItem = niluuid;
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
getViewControls()->ForceCursorPosition( false );
@ -986,11 +977,11 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( autostartEvt )
{
if( autostartEvt->Matches( EE_ACTIONS::drawBus.MakeEvent() ) )
if( autostartEvt->Matches( SCH_ACTIONS::drawBus.MakeEvent() ) )
displayBusCursor = true;
else if( autostartEvt->Matches( EE_ACTIONS::drawWire.MakeEvent() ) )
else if( autostartEvt->Matches( SCH_ACTIONS::drawWire.MakeEvent() ) )
displayWireCursor = true;
else if( autostartEvt->Matches( EE_ACTIONS::drawLines.MakeEvent() ) )
else if( autostartEvt->Matches( SCH_ACTIONS::drawLines.MakeEvent() ) )
displayLineCursor = true;
}
else if( collector[0]->IsHypertext() && !collector[0]->IsSelected() )
@ -1078,36 +1069,36 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
OPT_TOOL_EVENT EE_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HELPER& aGrid,
SCH_ITEM* aItem )
OPT_TOOL_EVENT SCH_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HELPER& aGrid,
SCH_ITEM* aItem )
{
VECTOR2I pos = aGrid.BestSnapAnchor( aEvent->Position(), aGrid.GetItemGrid( aItem ) );
if( m_frame->eeconfig()->m_Drawing.auto_start_wires
&& !m_toolMgr->GetTool<EE_POINT_EDITOR>()->HasPoint()
&& !m_toolMgr->GetTool<SCH_POINT_EDITOR>()->HasPoint()
&& aItem->IsPointClickableAnchor( pos ) )
{
OPT_TOOL_EVENT newEvt = EE_ACTIONS::drawWire.MakeEvent();
OPT_TOOL_EVENT newEvt = SCH_ACTIONS::drawWire.MakeEvent();
if( aItem->Type() == SCH_BUS_BUS_ENTRY_T )
{
newEvt = EE_ACTIONS::drawBus.MakeEvent();
newEvt = SCH_ACTIONS::drawBus.MakeEvent();
}
else if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
{
SCH_BUS_WIRE_ENTRY* busEntry = static_cast<SCH_BUS_WIRE_ENTRY*>( aItem );
if( !busEntry->m_connected_bus_item )
newEvt = EE_ACTIONS::drawBus.MakeEvent();
newEvt = SCH_ACTIONS::drawBus.MakeEvent();
}
else if( aItem->Type() == SCH_LINE_T )
{
SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
if( line->IsBus() )
newEvt = EE_ACTIONS::drawBus.MakeEvent();
newEvt = SCH_ACTIONS::drawBus.MakeEvent();
else if( line->IsGraphicLine() )
newEvt = EE_ACTIONS::drawLines.MakeEvent();
newEvt = SCH_ACTIONS::drawLines.MakeEvent();
}
else if( aItem->Type() == SCH_LABEL_T || aItem->Type() == SCH_HIER_LABEL_T
|| aItem->Type() == SCH_SHEET_PIN_T || aItem->Type() == SCH_GLOBAL_LABEL_T )
@ -1117,7 +1108,7 @@ OPT_TOOL_EVENT EE_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HE
possibleConnection.ConfigureFromLabel( label->GetShownText( false ) );
if( possibleConnection.IsBus() )
newEvt = EE_ACTIONS::drawBus.MakeEvent();
newEvt = SCH_ACTIONS::drawBus.MakeEvent();
}
else if( aItem->Type() == SCH_SYMBOL_T )
{
@ -1148,7 +1139,7 @@ OPT_TOOL_EVENT EE_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HE
}
int EE_SELECTION_TOOL::disambiguateCursor( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::disambiguateCursor( const TOOL_EVENT& aEvent )
{
wxMouseState keyboardState = wxGetMouseState();
@ -1164,7 +1155,7 @@ int EE_SELECTION_TOOL::disambiguateCursor( const TOOL_EVENT& aEvent )
}
void EE_SELECTION_TOOL::OnIdle( wxIdleEvent& aEvent )
void SCH_SELECTION_TOOL::OnIdle( wxIdleEvent& aEvent )
{
if( m_frame->ToolStackIsEmpty() && !m_multiple )
{
@ -1185,14 +1176,14 @@ void EE_SELECTION_TOOL::OnIdle( wxIdleEvent& aEvent )
}
EE_SELECTION& EE_SELECTION_TOOL::GetSelection()
SCH_SELECTION& SCH_SELECTION_TOOL::GetSelection()
{
return m_selection;
}
bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
const std::vector<KICAD_T>& aScanTypes )
bool SCH_SELECTION_TOOL::CollectHits( SCH_COLLECTOR& aCollector, const VECTOR2I& aWhere,
const std::vector<KICAD_T>& aScanTypes )
{
int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() / 2 );
@ -1235,8 +1226,8 @@ bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& a
}
void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere,
bool aCheckLocked, bool aSelectedOnly )
void SCH_SELECTION_TOOL::narrowSelection( SCH_COLLECTOR& collector, const VECTOR2I& aWhere,
bool aCheckLocked, bool aSelectedOnly )
{
SYMBOL_EDIT_FRAME* symbolEditorFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
@ -1298,9 +1289,9 @@ void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I
}
bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
EDA_ITEM** aItem, bool* aSelectionCancelledFlag, bool aAdd,
bool aSubtract, bool aExclusiveOr )
bool SCH_SELECTION_TOOL::selectPoint( SCH_COLLECTOR& aCollector, const VECTOR2I& aWhere,
EDA_ITEM** aItem, bool* aSelectionCancelledFlag, bool aAdd,
bool aSubtract, bool aExclusiveOr )
{
m_selection.ClearReferencePoint();
@ -1310,7 +1301,7 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a
// Try to call selectionMenu via RunAction() to avoid event-loop contention
// But it we cannot handle the event, then we don't have an active tool loop, so
// handle it directly.
if( !m_toolMgr->RunAction<COLLECTOR*>( EE_ACTIONS::selectionMenu, &aCollector ) )
if( !m_toolMgr->RunAction<COLLECTOR*>( SCH_ACTIONS::selectionMenu, &aCollector ) )
{
if( !doSelectionMenu( &aCollector ) )
aCollector.m_MenuCancelled = true;
@ -1402,13 +1393,13 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a
}
bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere,
const std::vector<KICAD_T>& aScanTypes,
EDA_ITEM** aItem, bool* aSelectionCancelledFlag,
bool aCheckLocked, bool aAdd, bool aSubtract,
bool aExclusiveOr )
bool SCH_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere,
const std::vector<KICAD_T>& aScanTypes,
EDA_ITEM** aItem, bool* aSelectionCancelledFlag,
bool aCheckLocked, bool aAdd, bool aSubtract,
bool aExclusiveOr )
{
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
if( !CollectHits( collector, aWhere, aScanTypes ) )
return false;
@ -1420,7 +1411,7 @@ bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere,
}
int EE_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
{
m_multiple = true; // Multiple selection mode is active
KIGFX::VIEW* view = getView();
@ -1472,7 +1463,7 @@ int EE_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
return 0;
}
int EE_SELECTION_TOOL::UnselectAll( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::UnselectAll( const TOOL_EVENT& aEvent )
{
m_multiple = true; // Multiple selection mode is active
KIGFX::VIEW* view = getView();
@ -1516,7 +1507,7 @@ int EE_SELECTION_TOOL::UnselectAll( const TOOL_EVENT& aEvent )
}
void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos )
void SCH_SELECTION_TOOL::GuessSelectionCandidates( SCH_COLLECTOR& collector, const VECTOR2I& aPos )
{
// Prefer exact hits to sloppy ones
std::set<EDA_ITEM*> exactHits;
@ -1701,8 +1692,8 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
}
EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const std::vector<KICAD_T>& aScanTypes,
bool aPromoteCellSelections )
SCH_SELECTION& SCH_SELECTION_TOOL::RequestSelection( const std::vector<KICAD_T>& aScanTypes,
bool aPromoteCellSelections )
{
bool anyUnselected = false;
bool anySelected = false;
@ -1772,7 +1763,7 @@ EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const std::vector<KICAD_T>& a
}
bool EE_SELECTION_TOOL::itemPassesFilter( EDA_ITEM* aItem )
bool SCH_SELECTION_TOOL::itemPassesFilter( EDA_ITEM* aItem )
{
if( !aItem )
return false;
@ -1862,7 +1853,7 @@ bool EE_SELECTION_TOOL::itemPassesFilter( EDA_ITEM* aItem )
}
void EE_SELECTION_TOOL::updateReferencePoint()
void SCH_SELECTION_TOOL::updateReferencePoint()
{
VECTOR2I refP( 0, 0 );
@ -1886,7 +1877,7 @@ const TOOL_ACTION* allowedActions[] = { &ACTIONS::panUp, &ACTIONS::panD
&ACTIONS::zoomFitObjects, nullptr };
bool EE_SELECTION_TOOL::selectMultiple()
bool SCH_SELECTION_TOOL::selectMultiple()
{
// Block selection not allowed in symbol viewer frame: no actual code to handle
// a selection, so return to avoid to draw a selection rectangle, and to avoid crashes.
@ -2129,7 +2120,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
}
bool EE_SELECTION_TOOL::selectTableCells( SCH_TABLE* aTable )
bool SCH_SELECTION_TOOL::selectTableCells( SCH_TABLE* aTable )
{
bool cancelled = false; // Was the tool canceled while it was running?
m_multiple = true; // Multiple selection mode is active
@ -2235,9 +2226,9 @@ bool EE_SELECTION_TOOL::selectTableCells( SCH_TABLE* aTable )
}
EDA_ITEM* EE_SELECTION_TOOL::GetNode( const VECTOR2I& aPosition )
EDA_ITEM* SCH_SELECTION_TOOL::GetNode( const VECTOR2I& aPosition )
{
EE_COLLECTOR collector;
SCH_COLLECTOR collector;
//TODO(snh): Reimplement after exposing KNN interface
int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
@ -2257,7 +2248,7 @@ EDA_ITEM* EE_SELECTION_TOOL::GetNode( const VECTOR2I& aPosition )
}
int EE_SELECTION_TOOL::SelectNode( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectNode( const TOOL_EVENT& aEvent )
{
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( false );
@ -2266,7 +2257,7 @@ int EE_SELECTION_TOOL::SelectNode( const TOOL_EVENT& aEvent )
}
int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
{
RequestSelection( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T,
SCH_ITEM_LOCATE_GRAPHIC_LINE_T } );
@ -2314,7 +2305,7 @@ int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
}
int EE_SELECTION_TOOL::SelectColumns( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectColumns( const TOOL_EVENT& aEvent )
{
std::set<std::pair<SCH_TABLE*, int>> columns;
bool added = false;
@ -2349,7 +2340,7 @@ int EE_SELECTION_TOOL::SelectColumns( const TOOL_EVENT& aEvent )
}
int EE_SELECTION_TOOL::SelectRows( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectRows( const TOOL_EVENT& aEvent )
{
std::set<std::pair<SCH_TABLE*, int>> rows;
bool added = false;
@ -2384,7 +2375,7 @@ int EE_SELECTION_TOOL::SelectRows( const TOOL_EVENT& aEvent )
}
int EE_SELECTION_TOOL::SelectTable( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectTable( const TOOL_EVENT& aEvent )
{
std::set<SCH_TABLE*> tables;
bool added = false;
@ -2413,14 +2404,14 @@ int EE_SELECTION_TOOL::SelectTable( const TOOL_EVENT& aEvent )
}
int EE_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
{
ClearSelection();
return 0;
}
void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
void SCH_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
{
if( aBBox.GetWidth() == 0 )
return;
@ -2522,8 +2513,8 @@ void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
}
void EE_SELECTION_TOOL::SyncSelection( const std::optional<SCH_SHEET_PATH>& targetSheetPath,
SCH_ITEM* focusItem, const std::vector<SCH_ITEM*>& items )
void SCH_SELECTION_TOOL::SyncSelection( const std::optional<SCH_SHEET_PATH>& targetSheetPath,
SCH_ITEM* focusItem, const std::vector<SCH_ITEM*>& items )
{
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -2572,7 +2563,7 @@ void EE_SELECTION_TOOL::SyncSelection( const std::optional<SCH_SHEET_PATH>& targ
}
void EE_SELECTION_TOOL::RebuildSelection()
void SCH_SELECTION_TOOL::RebuildSelection()
{
m_selection.Clear();
@ -2614,8 +2605,8 @@ void EE_SELECTION_TOOL::RebuildSelection()
}
bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
bool checkVisibilityOnly ) const
bool SCH_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
bool checkVisibilityOnly ) const
{
// NOTE: in the future this is where Eeschema layer/itemtype visibility will be handled
@ -2721,7 +2712,7 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
}
void EE_SELECTION_TOOL::ClearSelection( bool aQuietMode )
void SCH_SELECTION_TOOL::ClearSelection( bool aQuietMode )
{
if( m_selection.Empty() )
return;
@ -2740,19 +2731,19 @@ void EE_SELECTION_TOOL::ClearSelection( bool aQuietMode )
}
void EE_SELECTION_TOOL::select( EDA_ITEM* aItem )
void SCH_SELECTION_TOOL::select( EDA_ITEM* aItem )
{
highlight( aItem, SELECTED, &m_selection );
}
void EE_SELECTION_TOOL::unselect( EDA_ITEM* aItem )
void SCH_SELECTION_TOOL::unselect( EDA_ITEM* aItem )
{
unhighlight( aItem, SELECTED, &m_selection );
}
void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
void SCH_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
{
if( aMode == SELECTED )
aItem->SetSelected();
@ -2791,7 +2782,7 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup
}
void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
void SCH_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
{
if( aMode == SELECTED )
{
@ -2840,7 +2831,7 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGro
}
bool EE_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
bool SCH_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
{
const unsigned GRIP_MARGIN = 20;
int margin = KiROUND( getView()->ToWorld( GRIP_MARGIN ) );
@ -2859,7 +2850,7 @@ bool EE_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
}
int EE_SELECTION_TOOL::SelectNext( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectNext( const TOOL_EVENT& aEvent )
{
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -2881,7 +2872,7 @@ int EE_SELECTION_TOOL::SelectNext( const TOOL_EVENT& aEvent )
}
int EE_SELECTION_TOOL::SelectPrevious( const TOOL_EVENT& aEvent )
int SCH_SELECTION_TOOL::SelectPrevious( const TOOL_EVENT& aEvent )
{
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
@ -2903,32 +2894,32 @@ int EE_SELECTION_TOOL::SelectPrevious( const TOOL_EVENT& aEvent )
}
void EE_SELECTION_TOOL::setTransitions()
void SCH_SELECTION_TOOL::setTransitions()
{
Go( &EE_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &SCH_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &EE_SELECTION_TOOL::Main, EE_ACTIONS::selectionActivate.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectNode, EE_ACTIONS::selectNode.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectConnection, EE_ACTIONS::selectConnection.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectColumns, ACTIONS::selectColumns.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectRows, ACTIONS::selectRows.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectTable, ACTIONS::selectTable.MakeEvent() );
Go( &SCH_SELECTION_TOOL::Main, SCH_ACTIONS::selectionActivate.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectNode, SCH_ACTIONS::selectNode.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectConnection, SCH_ACTIONS::selectConnection.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectColumns, ACTIONS::selectColumns.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectRows, ACTIONS::selectRows.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectTable, ACTIONS::selectTable.MakeEvent() );
Go( &EE_SELECTION_TOOL::ClearSelection, EE_ACTIONS::clearSelection.MakeEvent() );
Go( &SCH_SELECTION_TOOL::ClearSelection, SCH_ACTIONS::clearSelection.MakeEvent() );
Go( &EE_SELECTION_TOOL::AddItemToSel, EE_ACTIONS::addItemToSel.MakeEvent() );
Go( &EE_SELECTION_TOOL::AddItemsToSel, EE_ACTIONS::addItemsToSel.MakeEvent() );
Go( &EE_SELECTION_TOOL::RemoveItemFromSel, EE_ACTIONS::removeItemFromSel.MakeEvent() );
Go( &EE_SELECTION_TOOL::RemoveItemsFromSel, EE_ACTIONS::removeItemsFromSel.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectionMenu, EE_ACTIONS::selectionMenu.MakeEvent() );
Go( &SCH_SELECTION_TOOL::AddItemToSel, SCH_ACTIONS::addItemToSel.MakeEvent() );
Go( &SCH_SELECTION_TOOL::AddItemsToSel, SCH_ACTIONS::addItemsToSel.MakeEvent() );
Go( &SCH_SELECTION_TOOL::RemoveItemFromSel, SCH_ACTIONS::removeItemFromSel.MakeEvent() );
Go( &SCH_SELECTION_TOOL::RemoveItemsFromSel, SCH_ACTIONS::removeItemsFromSel.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectionMenu, SCH_ACTIONS::selectionMenu.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectAll, EE_ACTIONS::selectAll.MakeEvent() );
Go( &EE_SELECTION_TOOL::UnselectAll, EE_ACTIONS::unselectAll.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectAll, SCH_ACTIONS::selectAll.MakeEvent() );
Go( &SCH_SELECTION_TOOL::UnselectAll, SCH_ACTIONS::unselectAll.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectNext, EE_ACTIONS::nextNetItem.MakeEvent() );
Go( &EE_SELECTION_TOOL::SelectPrevious, EE_ACTIONS::previousNetItem.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectNext, SCH_ACTIONS::nextNetItem.MakeEvent() );
Go( &SCH_SELECTION_TOOL::SelectPrevious, SCH_ACTIONS::previousNetItem.MakeEvent() );
Go( &EE_SELECTION_TOOL::disambiguateCursor, EVENTS::DisambiguatePoint );
Go( &SCH_SELECTION_TOOL::disambiguateCursor, EVENTS::DisambiguatePoint );
}

View File

@ -22,15 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef KICAD_SCH_SELECTION_TOOL_H
#define KICAD_SCH_SELECTION_TOOL_H
#ifndef SCH_SELECTION_TOOL_H
#define 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>
#include <tools/ee_selection.h>
#include <ee_collectors.h>
#include <tools/sch_selection.h>
#include <sch_collectors.h>
#include <sch_symbol.h>
#include <gal/cursors.h>
@ -45,7 +45,7 @@ namespace KIGFX
}
class EE_CONDITIONS : public SELECTION_CONDITIONS
class SCH_CONDITIONS : public SELECTION_CONDITIONS
{
public:
static SELECTION_CONDITION SingleSymbol;
@ -60,11 +60,11 @@ public:
};
class EE_SELECTION_TOOL : public SELECTION_TOOL
class SCH_SELECTION_TOOL : public SELECTION_TOOL
{
public:
EE_SELECTION_TOOL();
~EE_SELECTION_TOOL();
SCH_SELECTION_TOOL();
~SCH_SELECTION_TOOL();
/// @copydoc TOOL_BASE::Init()
bool Init() override;
@ -85,7 +85,7 @@ public:
/**
* @return the set of currently selected items.
*/
EE_SELECTION& GetSelection();
SCH_SELECTION& GetSelection();
/**
* Return either an existing selection (filtered), or the selection at the current cursor
@ -94,8 +94,8 @@ public:
* @param aScanTypes [optional] List of item types that are acceptable for selection.
* @return either the current selection or, if empty, the selection at the cursor.
*/
EE_SELECTION& RequestSelection( const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T },
bool aPromoteCellSelections = false );
SCH_SELECTION& RequestSelection( const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T },
bool aPromoteCellSelections = false );
/**
* Perform a click-type selection at a point (usually the cursor position).
@ -172,7 +172,7 @@ public:
* Apply heuristics to try and determine a single object when multiple are found under the
* cursor.
*/
void GuessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos );
void GuessSelectionCandidates( SCH_COLLECTOR& collector, const VECTOR2I& aPos );
/**
* Rebuild the selection from the EDA_ITEMs' selection flags.
@ -190,7 +190,7 @@ public:
* @param aWhere Point from which the collection should be made.
* @param aScanTypes [optional] A list of item types that are acceptable for collection.
*/
bool CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
bool CollectHits( SCH_COLLECTOR& aCollector, const VECTOR2I& aWhere,
const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T } );
///< Set selection to items passed by parameter.
@ -215,7 +215,7 @@ private:
* @param aCheckLocked If false, remove locked elements from #collector
* @param aSelectedOnly If true, remove non-selected items from #collector
*/
void narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere, bool aCheckLocked,
void narrowSelection( SCH_COLLECTOR& collector, const VECTOR2I& aWhere, bool aCheckLocked,
bool aSelectedOnly = false );
/**
@ -233,7 +233,7 @@ private:
* @param aExclusiveOr Indicates if found item(s) should be toggle in the selection.
* @return true if the selection was modified.
*/
bool selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere, EDA_ITEM** aItem = nullptr,
bool selectPoint( SCH_COLLECTOR& aCollector, const VECTOR2I& aWhere, EDA_ITEM** aItem = nullptr,
bool* aSelectionCancelledFlag = nullptr, bool aAdd = false,
bool aSubtract = false, bool aExclusiveOr = false );
@ -309,7 +309,7 @@ private:
private:
SCH_BASE_FRAME* m_frame; // Pointer to the parent frame
EE_SELECTION m_selection; // Current state of selection
SCH_SELECTION m_selection; // Current state of selection
KICURSOR m_nonModifiedCursor; // Cursor in the absence of shift/ctrl/alt
@ -321,4 +321,4 @@ private:
SCH_SELECTION_FILTER_OPTIONS m_filter;
};
#endif //KICAD_SCH_SELECTION_TOOL_H
#endif //SCH_SELECTION_TOOL_H

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef EE_TOOL_BASE_H
#define EE_TOOL_BASE_H
#ifndef SCH_TOOL_BASE_H
#define SCH_TOOL_BASE_H
#include <math/vector2d.h>
#include <tool/tool_event.h>
@ -31,12 +31,12 @@
#include <tool/tool_manager.h>
#include <tool/tool_menu.h>
#include <tool/actions.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <sch_edit_frame.h>
#include <sch_view.h>
#include <symbol_edit_frame.h>
class EE_SELECTION;
class SCH_SELECTION;
/**
* A foundation class for a tool operating on a schematic or symbol.
@ -44,13 +44,13 @@ class EE_SELECTION;
template <class T>
class EE_TOOL_BASE : public TOOL_INTERACTIVE
class SCH_TOOL_BASE : public TOOL_INTERACTIVE
{
public:
/**
* Create a tool with given name. The name must be unique.
*/
EE_TOOL_BASE( const std::string& aName ) :
SCH_TOOL_BASE( const std::string& aName ) :
TOOL_INTERACTIVE ( aName ),
m_frame( nullptr ),
m_view( nullptr ),
@ -58,13 +58,13 @@ public:
m_isSymbolEditor( false )
{};
~EE_TOOL_BASE() override {};
~SCH_TOOL_BASE() override {};
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override
{
m_frame = getEditFrame<T>();
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
m_isSymbolEditor = m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR );
// A basic context menu. Many (but not all) tools will choose to override this.
@ -195,10 +195,10 @@ protected:
}
protected:
T* m_frame;
KIGFX::SCH_VIEW* m_view;
EE_SELECTION_TOOL* m_selectionTool;
bool m_isSymbolEditor;
T* m_frame;
KIGFX::SCH_VIEW* m_view;
SCH_SELECTION_TOOL* m_selectionTool;
bool m_isSymbolEditor;
};

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ee_tool_utils.h"
#include "sch_tool_utils.h"
#include <sch_text.h>
#include <sch_field.h>

View File

@ -40,7 +40,7 @@
#include <sim/simulator_frame.h>
#include <sim/sim_plot_tab.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <scintilla_tricks.h>
#include <sim/spice_circuit_model.h>
#include <dialogs/dialog_user_defined_signals.h>
@ -153,7 +153,7 @@ int SIMULATOR_CONTROL::SaveWorkbook( const TOOL_EVENT& aEvent )
{
wxString filename;
if( aEvent.IsAction( &EE_ACTIONS::saveWorkbook ) )
if( aEvent.IsAction( &SCH_ACTIONS::saveWorkbook ) )
filename = m_simulator->Settings()->GetWorkbookFilename();
if( filename.IsEmpty() )
@ -497,7 +497,7 @@ int SIMULATOR_CONTROL::Probe( const TOOL_EVENT& aEvent )
if( blocking_dialog )
blocking_dialog->Close( true );
m_schematicFrame->GetToolManager()->PostAction( EE_ACTIONS::simProbe );
m_schematicFrame->GetToolManager()->PostAction( SCH_ACTIONS::simProbe );
m_schematicFrame->Raise();
return 0;
@ -514,7 +514,7 @@ int SIMULATOR_CONTROL::Tune( const TOOL_EVENT& aEvent )
if( blocking_dialog )
blocking_dialog->Close( true );
m_schematicFrame->GetToolManager()->PostAction( EE_ACTIONS::simTune );
m_schematicFrame->GetToolManager()->PostAction( SCH_ACTIONS::simTune );
m_schematicFrame->Raise();
return 0;
@ -641,14 +641,14 @@ int SIMULATOR_CONTROL::ShowNetlist( const TOOL_EVENT& aEvent )
void SIMULATOR_CONTROL::setTransitions()
{
Go( &SIMULATOR_CONTROL::NewAnalysisTab, EE_ACTIONS::newAnalysisTab.MakeEvent() );
Go( &SIMULATOR_CONTROL::OpenWorkbook, EE_ACTIONS::openWorkbook.MakeEvent() );
Go( &SIMULATOR_CONTROL::SaveWorkbook, EE_ACTIONS::saveWorkbook.MakeEvent() );
Go( &SIMULATOR_CONTROL::SaveWorkbook, EE_ACTIONS::saveWorkbookAs.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotAsPNG, EE_ACTIONS::exportPlotAsPNG.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotAsCSV, EE_ACTIONS::exportPlotAsCSV.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotToClipboard, EE_ACTIONS::exportPlotToClipboard.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotToSchematic, EE_ACTIONS::exportPlotToSchematic.MakeEvent() );
Go( &SIMULATOR_CONTROL::NewAnalysisTab, SCH_ACTIONS::newAnalysisTab.MakeEvent() );
Go( &SIMULATOR_CONTROL::OpenWorkbook, SCH_ACTIONS::openWorkbook.MakeEvent() );
Go( &SIMULATOR_CONTROL::SaveWorkbook, SCH_ACTIONS::saveWorkbook.MakeEvent() );
Go( &SIMULATOR_CONTROL::SaveWorkbook, SCH_ACTIONS::saveWorkbookAs.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotAsPNG, SCH_ACTIONS::exportPlotAsPNG.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotAsCSV, SCH_ACTIONS::exportPlotAsCSV.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotToClipboard, SCH_ACTIONS::exportPlotToClipboard.MakeEvent() );
Go( &SIMULATOR_CONTROL::ExportPlotToSchematic, SCH_ACTIONS::exportPlotToSchematic.MakeEvent() );
Go( &SIMULATOR_CONTROL::Close, ACTIONS::quit.MakeEvent() );
@ -666,16 +666,16 @@ void SIMULATOR_CONTROL::setTransitions()
Go( &SIMULATOR_CONTROL::UndoZoom, ACTIONS::zoomUndo.MakeEvent() );
Go( &SIMULATOR_CONTROL::RedoZoom, ACTIONS::zoomRedo.MakeEvent() );
Go( &SIMULATOR_CONTROL::ToggleGrid, ACTIONS::toggleGrid.MakeEvent() );
Go( &SIMULATOR_CONTROL::ToggleLegend, EE_ACTIONS::toggleLegend.MakeEvent() );
Go( &SIMULATOR_CONTROL::ToggleDottedSecondary, EE_ACTIONS::toggleDottedSecondary.MakeEvent() );
Go( &SIMULATOR_CONTROL::ToggleDarkModePlots, EE_ACTIONS::toggleDarkModePlots.MakeEvent() );
Go( &SIMULATOR_CONTROL::ToggleLegend, SCH_ACTIONS::toggleLegend.MakeEvent() );
Go( &SIMULATOR_CONTROL::ToggleDottedSecondary, SCH_ACTIONS::toggleDottedSecondary.MakeEvent() );
Go( &SIMULATOR_CONTROL::ToggleDarkModePlots, SCH_ACTIONS::toggleDarkModePlots.MakeEvent() );
Go( &SIMULATOR_CONTROL::EditAnalysisTab, EE_ACTIONS::simAnalysisProperties.MakeEvent() );
Go( &SIMULATOR_CONTROL::RunSimulation, EE_ACTIONS::runSimulation.MakeEvent() );
Go( &SIMULATOR_CONTROL::RunSimulation, EE_ACTIONS::stopSimulation.MakeEvent() );
Go( &SIMULATOR_CONTROL::Probe, EE_ACTIONS::simProbe.MakeEvent() );
Go( &SIMULATOR_CONTROL::Tune, EE_ACTIONS::simTune.MakeEvent() );
Go( &SIMULATOR_CONTROL::EditAnalysisTab, SCH_ACTIONS::simAnalysisProperties.MakeEvent() );
Go( &SIMULATOR_CONTROL::RunSimulation, SCH_ACTIONS::runSimulation.MakeEvent() );
Go( &SIMULATOR_CONTROL::RunSimulation, SCH_ACTIONS::stopSimulation.MakeEvent() );
Go( &SIMULATOR_CONTROL::Probe, SCH_ACTIONS::simProbe.MakeEvent() );
Go( &SIMULATOR_CONTROL::Tune, SCH_ACTIONS::simTune.MakeEvent() );
Go( &SIMULATOR_CONTROL::EditUserDefinedSignals, EE_ACTIONS::editUserDefinedSignals.MakeEvent() );
Go( &SIMULATOR_CONTROL::ShowNetlist, EE_ACTIONS::showNetlist.MakeEvent() );
Go( &SIMULATOR_CONTROL::EditUserDefinedSignals, SCH_ACTIONS::editUserDefinedSignals.MakeEvent() );
Go( &SIMULATOR_CONTROL::ShowNetlist, SCH_ACTIONS::showNetlist.MakeEvent() );
}

View File

@ -30,7 +30,7 @@
#include <sch_painter.h>
#include <tool/tool_manager.h>
#include <tool/library_editor_control.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <lib_symbol_library_manager.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <symbol_viewer_frame.h>
@ -48,7 +48,7 @@
bool SYMBOL_EDITOR_CONTROL::Init()
{
m_frame = getEditFrame<SCH_BASE_FRAME>();
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
m_isSymbolEditor = m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR );
if( m_isSymbolEditor )
@ -131,27 +131,27 @@ bool SYMBOL_EDITOR_CONTROL::Init()
};
// clang-format off
ctxMenu.AddItem( EE_ACTIONS::newSymbol, libInferredCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::deriveFromExistingSymbol, symbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::newSymbol, libInferredCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::deriveFromExistingSymbol, symbolSelectedCondition, 10 );
ctxMenu.AddSeparator( 10 );
ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition || libInferredCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::saveLibraryAs, libSelectedCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::saveSymbolAs, symbolSelectedCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::saveSymbolCopyAs, symbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::saveLibraryAs, libSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::saveSymbolAs, symbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::saveSymbolCopyAs, symbolSelectedCondition, 10 );
ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition || libInferredCondition, 10 );
ctxMenu.AddSeparator( 10 );
ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition || multiSymbolSelectedCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition || multiSymbolSelectedCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, libInferredCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::renameSymbol, symbolSelectedCondition, 10 );
ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition || multiSymbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::cutSymbol, symbolSelectedCondition || multiSymbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::copySymbol, symbolSelectedCondition || multiSymbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::pasteSymbol, libInferredCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::duplicateSymbol, symbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::renameSymbol, symbolSelectedCondition, 10 );
ctxMenu.AddItem( SCH_ACTIONS::deleteSymbol, symbolSelectedCondition || multiSymbolSelectedCondition, 10 );
ctxMenu.AddSeparator( 100 );
ctxMenu.AddItem( EE_ACTIONS::importSymbol, libInferredCondition, 100 );
ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
ctxMenu.AddItem( SCH_ACTIONS::importSymbol, libInferredCondition, 100 );
ctxMenu.AddItem( SCH_ACTIONS::exportSymbol, symbolSelectedCondition );
if( ADVANCED_CFG::GetCfg().m_EnableLibWithText )
{
@ -265,11 +265,11 @@ int SYMBOL_EDITOR_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
return 0;
}
if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
if( aEvent.IsAction( &SCH_ACTIONS::newSymbol ) )
editFrame->CreateNewSymbol();
else if( aEvent.IsAction( &EE_ACTIONS::deriveFromExistingSymbol ) )
else if( aEvent.IsAction( &SCH_ACTIONS::deriveFromExistingSymbol ) )
editFrame->CreateNewSymbol( target.GetLibItemName() );
else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
else if( aEvent.IsAction( &SCH_ACTIONS::importSymbol ) )
editFrame->ImportSymbol();
return 0;
@ -283,15 +283,15 @@ int SYMBOL_EDITOR_CONTROL::Save( const TOOL_EVENT& aEvt )
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
if( aEvt.IsAction( &EE_ACTIONS::save ) )
if( aEvt.IsAction( &SCH_ACTIONS::save ) )
editFrame->Save();
else if( aEvt.IsAction( &EE_ACTIONS::saveLibraryAs ) )
else if( aEvt.IsAction( &SCH_ACTIONS::saveLibraryAs ) )
editFrame->SaveLibraryAs();
else if( aEvt.IsAction( &EE_ACTIONS::saveSymbolAs ) )
else if( aEvt.IsAction( &SCH_ACTIONS::saveSymbolAs ) )
editFrame->SaveSymbolCopyAs( true );
else if( aEvt.IsAction( &EE_ACTIONS::saveSymbolCopyAs ) )
else if( aEvt.IsAction( &SCH_ACTIONS::saveSymbolCopyAs ) )
editFrame->SaveSymbolCopyAs( false );
else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) )
else if( aEvt.IsAction( &SCH_ACTIONS::saveAll ) )
editFrame->SaveAll();
return 0;
@ -390,10 +390,10 @@ int SYMBOL_EDITOR_CONTROL::CutCopyDelete( const TOOL_EVENT& aEvt )
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::copySymbol ) )
if( aEvt.IsAction( &SCH_ACTIONS::cutSymbol ) || aEvt.IsAction( &SCH_ACTIONS::copySymbol ) )
editFrame->CopySymbolToClipboard();
if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::deleteSymbol ) )
if( aEvt.IsAction( &SCH_ACTIONS::cutSymbol ) || aEvt.IsAction( &SCH_ACTIONS::deleteSymbol ) )
{
bool hasWritableLibs = false;
wxString msg;
@ -430,7 +430,7 @@ int SYMBOL_EDITOR_CONTROL::DuplicateSymbol( const TOOL_EVENT& aEvent )
LIB_ID sel = editFrame->GetTargetLibId();
// DuplicateSymbol() is called to duplicate a symbol, or to paste a previously
// saved symbol in clipboard
bool isPasteAction = aEvent.IsAction( &EE_ACTIONS::pasteSymbol );
bool isPasteAction = aEvent.IsAction( &SCH_ACTIONS::pasteSymbol );
wxString msg;
if( !sel.IsValid() && !isPasteAction )
@ -567,13 +567,13 @@ int SYMBOL_EDITOR_CONTROL::RenameSymbol( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent )
{
int bodyStyle = aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard ) ? BODY_STYLE::BASE
: BODY_STYLE::DEMORGAN;
int bodyStyle = aEvent.IsAction( &SCH_ACTIONS::showDeMorganStandard ) ? BODY_STYLE::BASE
: BODY_STYLE::DEMORGAN;
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
{
m_toolMgr->RunAction( ACTIONS::cancelInteractive );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
symbolEditor->SetBodyStyle( bodyStyle );
@ -848,8 +848,8 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
}
schframe->Raise();
schframe->GetToolManager()->PostAction( EE_ACTIONS::placeSymbol,
EE_ACTIONS::PLACE_SYMBOL_PARAMS{ symbol, true } );
schframe->GetToolManager()->PostAction( SCH_ACTIONS::placeSymbol,
SCH_ACTIONS::PLACE_SYMBOL_PARAMS{ symbol, true } );
}
return 0;
@ -878,49 +878,49 @@ void SYMBOL_EDITOR_CONTROL::setTransitions()
// clang-format off
Go( &SYMBOL_EDITOR_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddLibrary, ACTIONS::addLibrary.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbol, EE_ACTIONS::newSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbol, EE_ACTIONS::deriveFromExistingSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbol, EE_ACTIONS::importSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::EditSymbol, EE_ACTIONS::editSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::EditLibrarySymbol, EE_ACTIONS::editLibSymbolWithLibEdit.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbol, SCH_ACTIONS::newSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbol, SCH_ACTIONS::deriveFromExistingSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbol, SCH_ACTIONS::importSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::EditSymbol, SCH_ACTIONS::editSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::EditLibrarySymbol, SCH_ACTIONS::editLibSymbolWithLibEdit.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::DdAddLibrary, ACTIONS::ddAddLibrary.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveLibraryAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveSymbolAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveSymbolCopyAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, SCH_ACTIONS::saveLibraryAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, SCH_ACTIONS::saveSymbolAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, SCH_ACTIONS::saveSymbolCopyAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, ACTIONS::saveAll.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Revert, ACTIONS::revert.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::DuplicateSymbol, EE_ACTIONS::duplicateSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::RenameSymbol, EE_ACTIONS::renameSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::CutCopyDelete, EE_ACTIONS::deleteSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::CutCopyDelete, EE_ACTIONS::cutSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::CutCopyDelete, EE_ACTIONS::copySymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::DuplicateSymbol, EE_ACTIONS::pasteSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ExportSymbol, EE_ACTIONS::exportSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::DuplicateSymbol, SCH_ACTIONS::duplicateSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::RenameSymbol, SCH_ACTIONS::renameSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::CutCopyDelete, SCH_ACTIONS::deleteSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::CutCopyDelete, SCH_ACTIONS::cutSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::CutCopyDelete, SCH_ACTIONS::copySymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::DuplicateSymbol, SCH_ACTIONS::pasteSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ExportSymbol, SCH_ACTIONS::exportSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::OpenWithTextEditor, ACTIONS::openWithTextEditor.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::OpenDirectory, ACTIONS::openDirectory.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ExportView, EE_ACTIONS::exportSymbolView.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG, EE_ACTIONS::exportSymbolAsSVG.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic, EE_ACTIONS::addSymbolToSchematic.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ExportView, SCH_ACTIONS::exportSymbolView.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG, SCH_ACTIONS::exportSymbolAsSVG.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic, SCH_ACTIONS::addSymbolToSchematic.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::OnDeMorgan, EE_ACTIONS::showDeMorganStandard.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::OnDeMorgan, EE_ACTIONS::showDeMorganAlternate.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::OnDeMorgan, SCH_ACTIONS::showDeMorganStandard.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::OnDeMorgan, SCH_ACTIONS::showDeMorganAlternate.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ShowElectricalTypes, EE_ACTIONS::showElectricalTypes.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ShowPinNumbers, EE_ACTIONS::showPinNumbers.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleSyncedPinsMode, EE_ACTIONS::toggleSyncedPinsMode.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ShowElectricalTypes, SCH_ACTIONS::showElectricalTypes.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ShowPinNumbers, SCH_ACTIONS::showPinNumbers.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleSyncedPinsMode, SCH_ACTIONS::toggleSyncedPinsMode.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleProperties, ACTIONS::showProperties.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleHiddenPins, EE_ACTIONS::showHiddenPins.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleHiddenFields, EE_ACTIONS::showHiddenFields.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::TogglePinAltIcons, EE_ACTIONS::togglePinAltIcons.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleHiddenPins, SCH_ACTIONS::showHiddenPins.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleHiddenFields, SCH_ACTIONS::showHiddenFields.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::TogglePinAltIcons, SCH_ACTIONS::togglePinAltIcons.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ChangeUnit, EE_ACTIONS::previousUnit.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ChangeUnit, EE_ACTIONS::nextUnit.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ChangeUnit, SCH_ACTIONS::previousUnit.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ChangeUnit, SCH_ACTIONS::nextUnit.MakeEvent() );
// clang-format on
}

View File

@ -27,18 +27,18 @@
#define SYMBOL_EDITOR_CONTROL_H
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
class SYMBOL_EDIT_FRAME;
/**
* Handle actions for the various symbol editor and viewers.
*/
class SYMBOL_EDITOR_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<SCH_BASE_FRAME>
class SYMBOL_EDITOR_CONTROL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_BASE_FRAME>
{
public:
SYMBOL_EDITOR_CONTROL() :
EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.SymbolLibraryControl" )
SCH_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.SymbolLibraryControl" )
{ }
/// @copydoc TOOL_INTERACTIVE::Init()

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <ee_actions.h>
#include <sch_actions.h>
#include <optional>
#include <symbol_edit_frame.h>
#include <sch_commit.h>
@ -46,7 +46,7 @@ KIID SYMBOL_EDITOR_DRAWING_TOOLS::g_lastPin;
SYMBOL_EDITOR_DRAWING_TOOLS::SYMBOL_EDITOR_DRAWING_TOOLS() :
EE_TOOL_BASE<SYMBOL_EDIT_FRAME>( "eeschema.SymbolDrawing" ),
SCH_TOOL_BASE<SYMBOL_EDIT_FRAME>( "eeschema.SymbolDrawing" ),
m_lastTextBold( false ),
m_lastTextItalic( false ),
m_lastTextAngle( ANGLE_HORIZONTAL ),
@ -64,7 +64,7 @@ SYMBOL_EDITOR_DRAWING_TOOLS::SYMBOL_EDITOR_DRAWING_TOOLS() :
bool SYMBOL_EDITOR_DRAWING_TOOLS::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
auto isDrawingCondition =
[] ( const SELECTION& aSel )
@ -98,10 +98,10 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
VECTOR2I cursorPos;
bool ignorePrimePosition = false;
SCH_ITEM* item = nullptr;
bool isText = aEvent.IsAction( &EE_ACTIONS::placeSymbolText );
bool isText = aEvent.IsAction( &SCH_ACTIONS::placeSymbolText );
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->PushTool( aEvent );
@ -119,7 +119,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
auto cleanup =
[&] ()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete item;
item = nullptr;
@ -211,7 +211,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
// First click creates...
if( !item )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
switch( type )
{
@ -385,7 +385,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
// gets whacked.
m_toolMgr->DeactivateTool();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->PushTool( aEvent );
@ -398,7 +398,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
auto cleanup =
[&] ()
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_view->ClearPreview();
delete item;
item = nullptr;
@ -467,7 +467,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
if( !symbol )
continue;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
int lineWidth = schIUScale.MilsToIU( cfg->m_Defaults.line_width );
@ -579,7 +579,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
}
else if( evt->IsDblClick( BUT_LEFT ) && !item )
{
m_toolMgr->RunAction( EE_ACTIONS::properties );
m_toolMgr->RunAction( SCH_ACTIONS::properties );
}
else if( evt->IsClick( BUT_RIGHT ) )
{
@ -697,7 +697,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent )
KIGFX::VIEW_CONTROLS* controls = getViewControls();
std::vector<SCH_ITEM*> newItems; // all new items, including group
std::vector<SCH_ITEM*> selectedItems; // the group, or newItems if no group
EE_SELECTION preview;
SCH_SELECTION preview;
SCH_COMMIT commit( m_toolMgr );
for( std::unique_ptr<EDA_ITEM>& ptr : list )
@ -732,10 +732,10 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent )
m_view->Add( &preview );
// Clear the current selection then select the drawings so that edit tools work on them
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &selItems );
m_toolMgr->RunAction<EDA_ITEMS*>( SCH_ACTIONS::addItemsToSel, &selItems );
m_frame->PushTool( aEvent );
@ -779,7 +779,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() || evt->IsActivate() )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
for( SCH_ITEM* item : newItems )
delete item;
@ -860,10 +860,10 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent )
if( pin )
g_lastPin = pin->m_Uuid;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
if( pin )
m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, pin );
m_toolMgr->RunAction<EDA_ITEM*>( SCH_ACTIONS::addItemToSel, pin );
}
return 0;
@ -873,17 +873,17 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent )
void SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions()
{
// clang-format off
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeSymbolPin.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace, EE_ACTIONS::placeSymbolText.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawRectangle.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawCircle.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawArc.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawBezier.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawSymbolLines.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawSymbolPolygon.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawSymbolTextBox, EE_ACTIONS::drawSymbolTextBox.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor, EE_ACTIONS::placeSymbolAnchor.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics, EE_ACTIONS::importGraphics.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem, EE_ACTIONS::repeatDrawItem.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeSymbolPin.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace, SCH_ACTIONS::placeSymbolText.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawRectangle.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawCircle.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawArc.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawBezier.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawSymbolLines.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, SCH_ACTIONS::drawSymbolPolygon.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawSymbolTextBox, SCH_ACTIONS::drawSymbolTextBox.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor, SCH_ACTIONS::placeSymbolAnchor.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics, SCH_ACTIONS::importGraphics.MakeEvent() );
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem, SCH_ACTIONS::repeatDrawItem.MakeEvent() );
// clang-format on
}

View File

@ -27,7 +27,7 @@
#include <optional>
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
class SYMBOL_EDIT_FRAME;
@ -39,7 +39,7 @@ class SYMBOL_EDIT_FRAME;
* Tool responsible for drawing/placing items (body outlines, pins, etc.)
*/
class SYMBOL_EDITOR_DRAWING_TOOLS : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
class SYMBOL_EDITOR_DRAWING_TOOLS : public SCH_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
SYMBOL_EDITOR_DRAWING_TOOLS();

View File

@ -25,13 +25,13 @@
#include "symbol_editor_edit_tool.h"
#include <tool/picker_tool.h>
#include <tools/ee_selection_tool.h>
#include <tools/ee_tool_utils.h>
#include <tools/sch_selection_tool.h>
#include <tools/sch_tool_utils.h>
#include <tools/symbol_editor_pin_tool.h>
#include <tools/symbol_editor_drawing_tools.h>
#include <tools/symbol_editor_move_tool.h>
#include <clipboard.h>
#include <ee_actions.h>
#include <sch_actions.h>
#include <increment.h>
#include <pin_layout_cache.h>
#include <string_utils.h>
@ -52,7 +52,7 @@
#include <io/kicad/kicad_io_utils.h>
SYMBOL_EDITOR_EDIT_TOOL::SYMBOL_EDITOR_EDIT_TOOL() :
EE_TOOL_BASE( "eeschema.SymbolEditTool" ),
SCH_TOOL_BASE( "eeschema.SymbolEditTool" ),
m_pickerItem( nullptr )
{
}
@ -60,7 +60,7 @@ SYMBOL_EDITOR_EDIT_TOOL::SYMBOL_EDITOR_EDIT_TOOL() :
bool SYMBOL_EDITOR_EDIT_TOOL::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
SYMBOL_EDITOR_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
SYMBOL_EDITOR_MOVE_TOOL* moveTool = m_toolMgr->GetTool<SYMBOL_EDITOR_MOVE_TOOL>();
@ -91,7 +91,7 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
return true;
};
const auto canCopyText = EE_CONDITIONS::OnlyTypes( {
const auto canCopyText = SCH_CONDITIONS::OnlyTypes( {
SCH_TEXT_T,
SCH_TEXTBOX_T,
SCH_FIELD_T,
@ -100,26 +100,27 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
SCH_TABLECELL_T,
} );
// clang-format off
// Add edit actions to the move tool menu
if( moveTool )
{
CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
moveMenu.AddSeparator( 200 );
moveMenu.AddItem( EE_ACTIONS::rotateCCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( EE_ACTIONS::mirrorV, canEdit && EE_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( EE_ACTIONS::mirrorH, canEdit && EE_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( SCH_ACTIONS::rotateCCW, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( SCH_ACTIONS::rotateCW, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( SCH_ACTIONS::mirrorV, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( SCH_ACTIONS::mirrorH, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( EE_ACTIONS::swap, canEdit && SELECTION_CONDITIONS::MoreThan( 1 ), 200);
moveMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
moveMenu.AddItem( SCH_ACTIONS::swap, canEdit && SELECTION_CONDITIONS::MoreThan( 1 ), 200);
moveMenu.AddItem( SCH_ACTIONS::properties, canEdit && SCH_CONDITIONS::Count( 1 ), 200 );
moveMenu.AddSeparator( 300 );
moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::copyAsText, canCopyText && EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::duplicate, canEdit && EE_CONDITIONS::NotEmpty, 300 );
moveMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 200 );
moveMenu.AddItem( ACTIONS::cut, SCH_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::copy, SCH_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::copyAsText, canCopyText && SCH_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::duplicate, canEdit && SCH_CONDITIONS::NotEmpty, 300 );
moveMenu.AddItem( ACTIONS::doDelete, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
moveMenu.AddSeparator( 400 );
moveMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
@ -130,35 +131,36 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
drawMenu.AddSeparator( 200 );
drawMenu.AddItem( EE_ACTIONS::rotateCCW, canEdit && EE_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( EE_ACTIONS::mirrorV, canEdit && EE_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( EE_ACTIONS::mirrorH, canEdit && EE_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( SCH_ACTIONS::rotateCCW, canEdit && SCH_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( SCH_ACTIONS::rotateCW, canEdit && SCH_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( SCH_ACTIONS::mirrorV, canEdit && SCH_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( SCH_ACTIONS::mirrorH, canEdit && SCH_CONDITIONS::IdleSelection, 200 );
drawMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
drawMenu.AddItem( SCH_ACTIONS::properties, canEdit && SCH_CONDITIONS::Count( 1 ), 200 );
// Add editing actions to the selection tool menu
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddItem( EE_ACTIONS::rotateCCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( EE_ACTIONS::mirrorV, canEdit && EE_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( EE_ACTIONS::mirrorH, canEdit && EE_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::rotateCCW, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::rotateCW, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::mirrorV, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::mirrorH, canEdit && SCH_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( EE_ACTIONS::swap, canEdit && SELECTION_CONDITIONS::MoreThan( 1 ), 200 );
selToolMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
selToolMenu.AddItem( SCH_ACTIONS::swap, canEdit && SELECTION_CONDITIONS::MoreThan( 1 ), 200 );
selToolMenu.AddItem( SCH_ACTIONS::properties, canEdit && SCH_CONDITIONS::Count( 1 ), 200 );
selToolMenu.AddSeparator( 300 );
selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::copyAsText, canCopyText && EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::paste, canEdit && EE_CONDITIONS::Idle, 300 );
selToolMenu.AddItem( ACTIONS::duplicate, canEdit && EE_CONDITIONS::NotEmpty, 300 );
selToolMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 300 );
selToolMenu.AddItem( ACTIONS::cut, SCH_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::copy, SCH_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::copyAsText, canCopyText && SCH_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::paste, canEdit && SCH_CONDITIONS::Idle, 300 );
selToolMenu.AddItem( ACTIONS::duplicate, canEdit && SCH_CONDITIONS::NotEmpty, 300 );
selToolMenu.AddItem( ACTIONS::doDelete, canEdit && SCH_CONDITIONS::NotEmpty, 300 );
selToolMenu.AddSeparator( 400 );
selToolMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
selToolMenu.AddItem( ACTIONS::unselectAll, haveSymbolCondition, 400 );
// clang-format on
return true;
}
@ -166,13 +168,13 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection();
SCH_SELECTION& selection = m_selectionTool->RequestSelection();
if( selection.GetSize() == 0 )
return 0;
VECTOR2I rotPoint;
bool ccw = ( aEvent.Matches( EE_ACTIONS::rotateCCW.MakeEvent() ) );
bool ccw = ( aEvent.Matches( SCH_ACTIONS::rotateCCW.MakeEvent() ) );
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
SCH_COMMIT localCommit( m_toolMgr );
SCH_COMMIT* commit = dynamic_cast<SCH_COMMIT*>( aEvent.Commit() );
@ -202,7 +204,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
else
{
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
if( !localCommit.Empty() )
localCommit.Push( _( "Rotate" ) );
@ -214,13 +216,13 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection();
SCH_SELECTION& selection = m_selectionTool->RequestSelection();
if( selection.GetSize() == 0 )
return 0;
VECTOR2I mirrorPoint;
bool xAxis = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) );
bool xAxis = ( aEvent.Matches( SCH_ACTIONS::mirrorV.MakeEvent() ) );
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
if( !item->IsMoving() )
@ -280,7 +282,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
else
{
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->OnModify();
}
@ -301,7 +303,7 @@ const std::vector<KICAD_T> swappableItems = {
int SYMBOL_EDITOR_EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection( swappableItems );
SCH_SELECTION& selection = m_selectionTool->RequestSelection( swappableItems );
std::vector<EDA_ITEM*> sorted = selection.GetItemsSortedBySelectionOrder();
if( selection.Size() < 2 )
@ -362,7 +364,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
else
{
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_frame->OnModify();
}
@ -391,7 +393,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
return 0;
// Don't leave a freed pointer in the selection
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
commit.Modify( symbol, m_frame->GetScreen() );
@ -488,7 +490,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent )
{
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_pickerItem = nullptr;
// Deactivate other tools; particularly important if another PICKER is currently running
@ -501,7 +503,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent )
{
if( m_pickerItem )
{
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
selectionTool->UnbrightenItem( m_pickerItem );
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
m_toolMgr->RunAction( ACTIONS::doDelete );
@ -514,8 +516,8 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent )
picker->SetMotionHandler(
[this]( const VECTOR2D& aPos )
{
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_COLLECTOR collector;
SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_COLLECTOR collector;
selectionTool->CollectHits( collector, aPos, nonFields );
@ -547,10 +549,10 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent )
[this]( const int& aFinalState )
{
if( m_pickerItem )
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
m_toolMgr->GetTool<SCH_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
// Wake the selection tool after exiting to ensure the cursor gets updated
m_toolMgr->PostAction( EE_ACTIONS::selectionActivate );
m_toolMgr->PostAction( SCH_ACTIONS::selectionActivate );
} );
m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
@ -561,9 +563,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection();
SCH_SELECTION& selection = m_selectionTool->RequestSelection();
if( selection.Empty() || aEvent.IsAction( &EE_ACTIONS::symbolProperties ) )
if( selection.Empty() || aEvent.IsAction( &SCH_ACTIONS::symbolProperties ) )
{
if( m_frame->GetCurSymbol() )
editSymbolProperties();
@ -620,7 +622,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
}
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
return 0;
}
@ -719,7 +721,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties()
bool partLocked = symbol->UnitsLocked();
m_toolMgr->RunAction( ACTIONS::cancelInteractive );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
DIALOG_LIB_SYMBOL_PROPERTIES dlg( m_frame, symbol );
@ -770,7 +772,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
commit.Modify( symbol );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, symbol );
@ -850,7 +852,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
// Nuke the selection for later rebuilding. This does *not* clear the flags on any items;
// it just clears the SELECTION's reference to them.
@ -866,7 +868,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
// Nuke the selection for later rebuilding. This does *not* clear the flags on any items;
// it just clears the SELECTION's reference to them.
@ -893,8 +895,8 @@ int SYMBOL_EDITOR_EDIT_TOOL::Cut( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
{
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
SCH_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
if( !symbol || !selection.GetSize() )
return 0;
@ -932,8 +934,8 @@ int SYMBOL_EDITOR_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::CopyAsText( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->RequestSelection();
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
SCH_SELECTION& selection = selTool->RequestSelection();
if( selection.Empty() )
return 0;
@ -941,7 +943,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::CopyAsText( const TOOL_EVENT& aEvent )
wxString itemsAsText = GetSelectedItemsAsText( selection );
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
return SaveClipboard( itemsAsText.ToStdString() );
}
@ -1010,13 +1012,13 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
m_selectionTool->RebuildSelection();
EE_SELECTION& selection = m_selectionTool->GetSelection();
SCH_SELECTION& selection = m_selectionTool->GetSelection();
if( !selection.Empty() )
{
selection.SetReferencePoint( getViewControls()->GetCursorPosition( true ) );
if( m_toolMgr->RunSynchronousAction( EE_ACTIONS::move, &commit ) )
if( m_toolMgr->RunSynchronousAction( SCH_ACTIONS::move, &commit ) )
commit.Push( _( "Paste" ) );
else
commit.Revert();
@ -1028,9 +1030,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
{
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
SCH_COMMIT commit( m_toolMgr );
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
SCH_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
SCH_COMMIT commit( m_toolMgr );
if( selection.GetSize() == 0 )
return 0;
@ -1092,12 +1094,12 @@ int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
getView()->Add( newItem );
}
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &newItems );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_toolMgr->RunAction<EDA_ITEMS*>( SCH_ACTIONS::addItemsToSel, &newItems );
selection.SetReferencePoint( getViewControls()->GetCursorPosition( true ) );
if( m_toolMgr->RunSynchronousAction( EE_ACTIONS::move, &commit ) )
if( m_toolMgr->RunSynchronousAction( SCH_ACTIONS::move, &commit ) )
commit.Push( _( "Duplicate" ) );
else
commit.Revert();
@ -1109,7 +1111,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_EDIT_TOOL::Increment( const TOOL_EVENT& aEvent )
{
const ACTIONS::INCREMENT incParam = aEvent.Parameter<ACTIONS::INCREMENT>();
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_PIN_T, SCH_TEXT_T } );
SCH_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_PIN_T, SCH_TEXT_T } );
if( selection.Empty() )
return 0;
@ -1228,11 +1230,11 @@ void SYMBOL_EDITOR_EDIT_TOOL::setTransitions()
Go( &SYMBOL_EDITOR_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Duplicate, ACTIONS::duplicate.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Rotate, EE_ACTIONS::rotateCW.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Rotate, EE_ACTIONS::rotateCCW.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorV.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorH.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Swap, EE_ACTIONS::swap.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Rotate, SCH_ACTIONS::rotateCW.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Rotate, SCH_ACTIONS::rotateCCW.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Mirror, SCH_ACTIONS::mirrorV.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Mirror, SCH_ACTIONS::mirrorH.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Swap, SCH_ACTIONS::swap.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::DoDelete, ACTIONS::doDelete.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete, ACTIONS::deleteTool.MakeEvent() );
@ -1242,10 +1244,10 @@ void SYMBOL_EDITOR_EDIT_TOOL::setTransitions()
Go( &SYMBOL_EDITOR_EDIT_TOOL::Increment, ACTIONS::incrementSecondary.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Increment, ACTIONS::decrementSecondary.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Properties, EE_ACTIONS::symbolProperties.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::PinTable, EE_ACTIONS::pinTable.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::UpdateSymbolFields, EE_ACTIONS::updateSymbolFields.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName, EE_ACTIONS::setUnitDisplayName.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Properties, SCH_ACTIONS::properties.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Properties, SCH_ACTIONS::symbolProperties.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::PinTable, SCH_ACTIONS::pinTable.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::UpdateSymbolFields, SCH_ACTIONS::updateSymbolFields.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::SetUnitDisplayName, SCH_ACTIONS::setUnitDisplayName.MakeEvent() );
// clang-format on
}

View File

@ -24,7 +24,7 @@
#pragma once
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
class SCH_PIN;
@ -32,7 +32,7 @@ class SCH_SHAPE;
class SYMBOL_EDIT_FRAME;
class SYMBOL_EDITOR_EDIT_TOOL : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
class SYMBOL_EDITOR_EDIT_TOOL : public SCH_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
SYMBOL_EDITOR_EDIT_TOOL();

View File

@ -23,8 +23,8 @@
*/
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <ee_actions.h>
#include <tools/sch_selection_tool.h>
#include <sch_actions.h>
#include <ee_grid_helper.h>
#include <eda_item.h>
#include <gal/graphics_abstraction_layer.h>
@ -37,7 +37,7 @@
SYMBOL_EDITOR_MOVE_TOOL::SYMBOL_EDITOR_MOVE_TOOL() :
EE_TOOL_BASE( "eeschema.SymbolMoveTool" ),
SCH_TOOL_BASE( "eeschema.SymbolMoveTool" ),
m_moveInProgress( false )
{
}
@ -45,7 +45,7 @@ SYMBOL_EDITOR_MOVE_TOOL::SYMBOL_EDITOR_MOVE_TOOL() :
bool SYMBOL_EDITOR_MOVE_TOOL::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
//
// Add move actions to the selection tool menu
@ -73,8 +73,8 @@ bool SYMBOL_EDITOR_MOVE_TOOL::Init()
return true;
};
selToolMenu.AddItem( EE_ACTIONS::move, canMove && EE_CONDITIONS::IdleSelection, 150 );
selToolMenu.AddItem( EE_ACTIONS::alignToGrid, canMove && EE_CONDITIONS::IdleSelection, 150 );
selToolMenu.AddItem( SCH_ACTIONS::move, canMove && SCH_CONDITIONS::IdleSelection, 150 );
selToolMenu.AddItem( SCH_ACTIONS::alignToGrid, canMove && SCH_CONDITIONS::IdleSelection, 150 );
return true;
}
@ -82,7 +82,7 @@ bool SYMBOL_EDITOR_MOVE_TOOL::Init()
void SYMBOL_EDITOR_MOVE_TOOL::Reset( RESET_REASON aReason )
{
EE_TOOL_BASE::Reset( aReason );
SCH_TOOL_BASE::Reset( aReason );
if( aReason == MODEL_RELOAD )
m_moveInProgress = false;
@ -124,7 +124,7 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
// Be sure that there is at least one item that we can move. If there's no selection try
// looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection).
EE_SELECTION& selection = m_frame->IsSymbolAlias()
SCH_SELECTION& selection = m_frame->IsSymbolAlias()
? m_selectionTool->RequestSelection( { SCH_FIELD_T } )
: m_selectionTool->RequestSelection();
bool unselect = selection.IsHover();
@ -164,7 +164,7 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
if( evt->IsAction( &EE_ACTIONS::move )
if( evt->IsAction( &SCH_ACTIONS::move )
|| evt->IsMotion()
|| evt->IsDrag( BUT_LEFT )
|| evt->IsAction( &ACTIONS::refreshPreview ) )
@ -368,7 +368,7 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
item->ClearEditFlags();
if( unselect )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection );
m_moveInProgress = false;
m_frame->PopTool( aEvent );
@ -379,9 +379,9 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
int SYMBOL_EDITOR_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
{
EE_GRID_HELPER grid( m_toolMgr);
EE_SELECTION& selection = m_selectionTool->RequestSelection();
SCH_COMMIT commit( m_toolMgr );
EE_GRID_HELPER grid( m_toolMgr);
SCH_SELECTION& selection = m_selectionTool->RequestSelection();
SCH_COMMIT commit( m_toolMgr );
auto doMoveItem =
[&]( EDA_ITEM* item, const VECTOR2I& delta )
@ -437,6 +437,6 @@ void SYMBOL_EDITOR_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta
void SYMBOL_EDITOR_MOVE_TOOL::setTransitions()
{
Go( &SYMBOL_EDITOR_MOVE_TOOL::Main, EE_ACTIONS::move.MakeEvent() );
Go( &SYMBOL_EDITOR_MOVE_TOOL::AlignElements, EE_ACTIONS::alignToGrid.MakeEvent() );
Go( &SYMBOL_EDITOR_MOVE_TOOL::Main, SCH_ACTIONS::move.MakeEvent() );
Go( &SYMBOL_EDITOR_MOVE_TOOL::AlignElements, SCH_ACTIONS::alignToGrid.MakeEvent() );
}

View File

@ -25,14 +25,14 @@
#ifndef SYMBOL_EDITOR_MOVE_TOOL_H
#define SYMBOL_EDITOR_MOVE_TOOL_H
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <symbol_edit_frame.h>
class SYMBOL_EDIT_FRAME;
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
class SYMBOL_EDITOR_MOVE_TOOL : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
class SYMBOL_EDITOR_MOVE_TOOL : public SCH_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
SYMBOL_EDITOR_MOVE_TOOL();

View File

@ -24,11 +24,11 @@
#include "symbol_editor_pin_tool.h"
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <symbol_edit_frame.h>
#include <sch_commit.h>
#include <kidialog.h>
#include <ee_actions.h>
#include <sch_actions.h>
#include <dialogs/dialog_pin_properties.h>
#include <increment.h>
#include <settings/settings_manager.h>
@ -90,14 +90,14 @@ static int GetLastPinNumSize()
SYMBOL_EDITOR_PIN_TOOL::SYMBOL_EDITOR_PIN_TOOL() :
EE_TOOL_BASE<SYMBOL_EDIT_FRAME>( "eeschema.PinEditing" )
SCH_TOOL_BASE<SYMBOL_EDIT_FRAME>( "eeschema.PinEditing" )
{
}
bool SYMBOL_EDITOR_PIN_TOOL::Init()
{
EE_TOOL_BASE::Init();
SCH_TOOL_BASE::Init();
auto canEdit =
[&]( const SELECTION& sel )
@ -110,14 +110,14 @@ bool SYMBOL_EDITOR_PIN_TOOL::Init()
static const std::vector<KICAD_T> pinTypes = { SCH_PIN_T };
auto singlePinCondition = EE_CONDITIONS::Count( 1 ) && EE_CONDITIONS::OnlyTypes( pinTypes );
auto singlePinCondition = SCH_CONDITIONS::Count( 1 ) && SCH_CONDITIONS::OnlyTypes( pinTypes );
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddSeparator( 250 );
selToolMenu.AddItem( EE_ACTIONS::pushPinLength, canEdit && singlePinCondition, 250 );
selToolMenu.AddItem( EE_ACTIONS::pushPinNameSize, canEdit && singlePinCondition, 250 );
selToolMenu.AddItem( EE_ACTIONS::pushPinNumSize, canEdit && singlePinCondition, 250 );
selToolMenu.AddItem( SCH_ACTIONS::pushPinLength, canEdit && singlePinCondition, 250 );
selToolMenu.AddItem( SCH_ACTIONS::pushPinNameSize, canEdit && singlePinCondition, 250 );
selToolMenu.AddItem( SCH_ACTIONS::pushPinNumSize, canEdit && singlePinCondition, 250 );
return true;
}
@ -379,9 +379,9 @@ void SYMBOL_EDITOR_PIN_TOOL::CreateImagePins( SCH_PIN* aPin )
int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
{
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
EE_SELECTION& selection = m_selectionTool->GetSelection();
SCH_PIN* sourcePin = dynamic_cast<SCH_PIN*>( selection.Front() );
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
SCH_SELECTION& selection = m_selectionTool->GetSelection();
SCH_PIN* sourcePin = dynamic_cast<SCH_PIN*>( selection.Front() );
if( !sourcePin )
return 0;
@ -393,16 +393,16 @@ int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
if( pin == sourcePin )
continue;
if( aEvent.IsAction( &EE_ACTIONS::pushPinLength ) )
if( aEvent.IsAction( &SCH_ACTIONS::pushPinLength ) )
{
if( !pin->GetBodyStyle() || pin->GetBodyStyle() == m_frame->GetBodyStyle() )
pin->ChangeLength( sourcePin->GetLength() );
}
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNameSize ) )
else if( aEvent.IsAction( &SCH_ACTIONS::pushPinNameSize ) )
{
pin->SetNameTextSize( sourcePin->GetNameTextSize() );
}
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNumSize ) )
else if( aEvent.IsAction( &SCH_ACTIONS::pushPinNumSize ) )
{
pin->SetNumberTextSize( sourcePin->GetNumberTextSize() );
}
@ -435,10 +435,10 @@ SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const SCH_PIN* aSourcePin )
switch( pin->GetOrientation() )
{
default:
case PIN_ORIENTATION::PIN_RIGHT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_UP: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_DOWN: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step) ; break;
case PIN_ORIENTATION::PIN_LEFT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_RIGHT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_UP: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
case PIN_ORIENTATION::PIN_DOWN: step.x = schIUScale.MilsToIU( cfg->m_Repeat.pin_step) ; break;
case PIN_ORIENTATION::PIN_LEFT: step.y = schIUScale.MilsToIU( cfg->m_Repeat.pin_step ); break;
}
pin->Move( step );
@ -466,7 +466,7 @@ SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const SCH_PIN* aSourcePin )
void SYMBOL_EDITOR_PIN_TOOL::setTransitions()
{
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, EE_ACTIONS::pushPinLength.MakeEvent() );
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, EE_ACTIONS::pushPinNameSize.MakeEvent() );
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, EE_ACTIONS::pushPinNumSize.MakeEvent() );
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, SCH_ACTIONS::pushPinLength.MakeEvent() );
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, SCH_ACTIONS::pushPinNameSize.MakeEvent() );
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, SCH_ACTIONS::pushPinNumSize.MakeEvent() );
}

View File

@ -25,14 +25,14 @@
#ifndef SYMBOL_EDITOR_PIN_TOOL_H
#define SYMBOL_EDITOR_PIN_TOOL_H
#include <tools/ee_tool_base.h>
#include <tools/sch_tool_base.h>
#include <sch_base_frame.h>
class SYMBOL_EDIT_FRAME;
class SYMBOL_EDITOR_PIN_TOOL : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
class SYMBOL_EDITOR_PIN_TOOL : public SCH_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
SYMBOL_EDITOR_PIN_TOOL();

View File

@ -31,7 +31,7 @@
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <ee_actions.h>
#include <sch_actions.h>
#include <tool/tool_manager.h>
@ -51,7 +51,7 @@ DESIGN_BLOCK_PANE::DESIGN_BLOCK_PANE( SCH_EDIT_FRAME* aParent, const LIB_ID* aPr
// Accept handler
[this]()
{
m_frame->GetToolManager()->RunAction( EE_ACTIONS::placeDesignBlock );
m_frame->GetToolManager()->RunAction( SCH_ACTIONS::placeDesignBlock );
} );
sizer->Add( m_chooserPanel, 1, wxEXPAND, 5 );

View File

@ -30,7 +30,7 @@
#include <sch_commit.h>
#include <schematic.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
#include <hierarchy_pane.h>
#include <kiface_base.h>
@ -321,7 +321,7 @@ void HIERARCHY_PANE::onSelectSheetPath( wxTreeEvent& aEvent )
return;
SetCursor( wxCURSOR_ARROWWAIT );
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( EE_ACTIONS::changeSheet,
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet,
&itemData->m_SheetPath );
SetCursor( wxCURSOR_ARROW );
}

View File

@ -21,7 +21,7 @@
#include <project/sch_project_settings.h>
#include <sch_base_frame.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
#include <widgets/panel_sch_selection_filter.h>
@ -45,7 +45,7 @@ PANEL_SCH_SELECTION_FILTER::PANEL_SCH_SELECTION_FILTER( wxWindow* aParent ) :
SetBorders( true, false, false, false );
wxASSERT( m_frame );
m_tool = m_frame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
m_tool = m_frame->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
wxASSERT( m_tool );
SCH_SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();

View File

@ -24,7 +24,7 @@
#include <widgets/panel_sch_selection_filter_base.h>
class SCH_BASE_FRAME;
class EE_SELECTION_TOOL;
class SCH_SELECTION_TOOL;
struct SCH_SELECTION_FILTER_OPTIONS;
@ -49,9 +49,9 @@ private:
void onPopupSelection( wxCommandEvent& aEvent );
private:
SCH_BASE_FRAME* m_frame;
EE_SELECTION_TOOL* m_tool;
wxCheckBox* m_onlyCheckbox;
SCH_BASE_FRAME* m_frame;
SCH_SELECTION_TOOL* m_tool;
wxCheckBox* m_onlyCheckbox;
};
#endif //KICAD_PANEL_SCH_SELECTION_FILTER_H

View File

@ -36,7 +36,7 @@
#include <settings/color_settings.h>
#include <string_utils.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_selection_tool.h>
SCH_PROPERTIES_PANEL::SCH_PROPERTIES_PANEL( wxWindow* aParent, SCH_BASE_FRAME* aFrame ) :
@ -103,8 +103,8 @@ SCH_PROPERTIES_PANEL::~SCH_PROPERTIES_PANEL()
void SCH_PROPERTIES_PANEL::UpdateData()
{
EE_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
SCH_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
// Will actually just be updatePropertyValues() if selection hasn't changed
rebuildProperties( selection );
@ -113,8 +113,8 @@ void SCH_PROPERTIES_PANEL::UpdateData()
void SCH_PROPERTIES_PANEL::AfterCommit()
{
EE_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
SCH_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
rebuildProperties( selection );
}
@ -136,9 +136,9 @@ wxPGProperty* SCH_PROPERTIES_PANEL::createPGProperty( const PROPERTY_BASE* aProp
PROPERTY_BASE* SCH_PROPERTIES_PANEL::getPropertyFromEvent( const wxPropertyGridEvent& aEvent ) const
{
EE_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
SCH_ITEM* firstItem = static_cast<SCH_ITEM*>( selection.Front() );
SCH_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
SCH_ITEM* firstItem = static_cast<SCH_ITEM*>( selection.Front() );
wxCHECK_MSG( firstItem, nullptr,
wxT( "getPropertyFromEvent for a property with nothing selected!") );
@ -154,9 +154,9 @@ PROPERTY_BASE* SCH_PROPERTIES_PANEL::getPropertyFromEvent( const wxPropertyGridE
void SCH_PROPERTIES_PANEL::valueChanging( wxPropertyGridEvent& aEvent )
{
EE_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
EDA_ITEM* item = selection.Front();
SCH_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
EDA_ITEM* item = selection.Front();
PROPERTY_BASE* property = getPropertyFromEvent( aEvent );
wxCHECK( property, /* void */ );
@ -179,14 +179,13 @@ void SCH_PROPERTIES_PANEL::valueChanging( wxPropertyGridEvent& aEvent )
void SCH_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
{
EE_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
PROPERTY_BASE* property = getPropertyFromEvent( aEvent );
SCH_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
const SELECTION& selection = selectionTool->GetSelection();
PROPERTY_BASE* property = getPropertyFromEvent( aEvent );
wxCHECK( property, /* void */ );
wxVariant newValue = aEvent.GetPropertyValue();
SCH_COMMIT changes( m_frame );
wxVariant newValue = aEvent.GetPropertyValue();
SCH_COMMIT changes( m_frame );
SCH_SCREEN* screen = m_frame->GetScreen();
PROPERTY_COMMIT_HANDLER handler( &changes );

View File

@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ee_actions.h>
#include <sch_actions.h>
#include <sch_edit_frame.h>
#include <sch_painter.h>
#include <sch_symbol.h>
@ -35,7 +35,7 @@ void SCH_SEARCH_HANDLER::ActivateItem( long aItemRow )
std::vector<long> item = { aItemRow };
SelectItems( item );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::properties, true );
m_frame->GetToolManager()->RunAction( SCH_ACTIONS::properties, true );
}
@ -104,7 +104,7 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
EDA_ITEMS selectedItems;
std::vector<SCH_SEARCH_HIT> selectedHits;
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection );
for( long row : aItemRows )
{
@ -135,7 +135,7 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
}
if( selectedItems.size() )
m_frame->GetToolManager()->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &selectedItems );
m_frame->GetToolManager()->RunAction<EDA_ITEMS*>( SCH_ACTIONS::addItemsToSel, &selectedItems );
switch( settings.selection_zoom )
{

View File

@ -29,7 +29,7 @@
#include <symbol_edit_frame.h>
#include <symbol_lib_table.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/sch_actions.h>
SYMBOL_TREE_PANE::SYMBOL_TREE_PANE( SYMBOL_EDIT_FRAME* aParent,
LIB_SYMBOL_LIBRARY_MANAGER* aLibMgr )
@ -84,7 +84,7 @@ void SYMBOL_TREE_PANE::onMenuClose( wxMenuEvent& aEvent )
void SYMBOL_TREE_PANE::onSymbolSelected( wxCommandEvent& aEvent )
{
m_symbolEditFrame->GetToolManager()->RunAction( EE_ACTIONS::editSymbol );
m_symbolEditFrame->GetToolManager()->RunAction( SCH_ACTIONS::editSymbol );
// Make sure current-part highlighting doesn't get lost in selection highlighting
m_tree->Unselect();