Make distinction between PCBNew-wide tools and Board-specific tools.

The old names were really hard to keep straight (even for me, who named
many of them).
This commit is contained in:
Jeff Young 2020-12-16 13:31:32 +00:00
parent 651e7f664d
commit acfbcb4beb
79 changed files with 838 additions and 842 deletions

View File

@ -443,7 +443,7 @@ Below you will find the contents of useless_tool.cpp:
{
// we will call actions on the selection tool to get the current
// selection. The selection tools will handle item disambiguation
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
assert( selectionTool );
// call the actions

View File

@ -27,7 +27,7 @@ class EDA_DRAW_PANEL_GAL;
class GERBVIEW_FRAME;
/**
* PCBNEW_CONTROL
* GERBVIEW_CONTROL
*
* Handles actions that are shared between different frames in pcbnew.
*/

View File

@ -30,7 +30,7 @@
#include <list>
#include <wx/wx.h>
class SELECTION_TOOL;
class PCB_SELECTION_TOOL;
class TOOL_ACTION;
class TOOL_INTERACTIVE;

View File

@ -323,6 +323,9 @@ set( PCBNEW_CLASS_SRCS
ratsnest/ratsnest.cpp
tools/board_editor_control.cpp
tools/board_inspection_tool.cpp
tools/board_reannotate_tool.cpp
tools/convert_tool.cpp
tools/drawing_tool.cpp
tools/drc_tool.cpp
@ -332,18 +335,15 @@ set( PCBNEW_CLASS_SRCS
tools/footprint_editor_tools.cpp
tools/pad_tool.cpp
tools/pcb_bright_box.cpp
tools/pcb_editor_control.cpp
tools/pcb_inspection_tool.cpp
tools/pcb_reannotate_tool.cpp
tools/pcb_control.cpp
tools/pcb_picker_tool.cpp
tools/pcb_selection.cpp
tools/pcb_selection_conditions.cpp
tools/pcb_selection_tool.cpp
tools/pcb_tool_base.cpp
tools/pcbnew_control.cpp
tools/pcbnew_picker_tool.cpp
tools/pcbnew_selection.cpp
tools/placement_tool.cpp
tools/point_editor.cpp
tools/position_relative_tool.cpp
tools/selection_tool.cpp
tools/tool_event_utils.cpp
tools/zone_create_helper.cpp
tools/zone_filler_tool.cpp

View File

@ -30,7 +30,7 @@
#include <board.h>
#include <footprint.h>
#include <board_item.h>
#include <tools/pcbnew_selection.h>
#include <tools/pcb_selection.h>
/*!
* Class that performs array creation by producing a dialog to gather parameters and then
@ -40,7 +40,7 @@ class ARRAY_CREATOR
{
public:
ARRAY_CREATOR( PCB_BASE_FRAME& aParent, bool aIsFootprintEditor,
const PCBNEW_SELECTION& aSelection ) :
const PCB_SELECTION& aSelection ) :
m_parent( aParent ),
m_isFootprintEditor( aIsFootprintEditor ),
m_selection( aSelection )
@ -54,9 +54,9 @@ public:
void Invoke();
private:
PCB_BASE_FRAME& m_parent;
bool m_isFootprintEditor;
const PCBNEW_SELECTION& m_selection;
PCB_BASE_FRAME& m_parent;
bool m_isFootprintEditor;
const PCB_SELECTION& m_selection;
};
#endif /* ARRAY_CREATOR_H_ */

View File

@ -2085,7 +2085,7 @@ wxString BOARD::GroupsSanityCheckInternal( bool repair )
}
BOARD::GroupLegalOpsField BOARD::GroupLegalOps( const PCBNEW_SELECTION& selection ) const
BOARD::GroupLegalOpsField BOARD::GroupLegalOps( const PCB_SELECTION& selection ) const
{
GroupLegalOpsField legalOps = { false, false, false, false, false, false };

View File

@ -34,7 +34,7 @@
#include <netinfo.h>
#include <pcb_plot_params.h>
#include <title_block.h>
#include <tools/pcbnew_selection.h>
#include <tools/pcb_selection.h>
class BOARD_COMMIT;
class PCB_BASE_FRAME;
@ -1163,6 +1163,6 @@ public:
* Check which selection tool group operations are legal given the selection.
* @return bit field of legal ops.
*/
GroupLegalOpsField GroupLegalOps( const PCBNEW_SELECTION& selection ) const;
GroupLegalOpsField GroupLegalOps( const PCB_SELECTION& selection ) const;
};
#endif // CLASS_BOARD_H_

View File

@ -26,7 +26,7 @@
#include <footprint.h>
#include <pcb_edit_frame.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <view/view.h>
#include <board_commit.h>
#include <tools/pcb_tool_base.h>
@ -93,7 +93,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) m_toolMgr->GetToolHolder();
auto connectivity = board->GetConnectivity();
std::set<EDA_ITEM*> savedModules;
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
bool itemsDeselected = false;
std::vector<BOARD_ITEM*> bulkAddedItems;
@ -489,7 +489,7 @@ void BOARD_COMMIT::Revert()
if ( !m_isFootprintEditor )
connectivity->RecalculateRatsnest();
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
selTool->RebuildSelection();
clear();

View File

@ -46,7 +46,7 @@
#include <render_settings.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <netlist_reader/netlist_reader.h>
/* Execute a remote command send by Eeschema via a socket,

View File

@ -137,7 +137,7 @@ DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
m_sortButtons[m_sortCode]->SetValue( true );
m_selection = m_frame->GetToolManager()->GetTool<SELECTION_TOOL>()->GetSelection();
m_selection = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( !m_selection.Empty() )
m_annotationChoice = AnnotationChoice::AnnotateSelected;

View File

@ -40,7 +40,7 @@
#include <frame_type.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#define SORTXFIRST 0b000 //Sort on X
#define SORTYFIRST 0b100 //Sort on Y
@ -107,7 +107,7 @@ private:
PCB_EDIT_FRAME* m_frame;
FOOTPRINTS m_footprints;
PCB_SCREEN* m_screen;
PCBNEW_SELECTION m_selection;
PCB_SELECTION m_selection;
std::vector<RefDesChange> m_changeArray;
std::vector<RefDesInfo> m_frontFootprints;

View File

@ -45,7 +45,7 @@
#include "3d_cache/dialogs/3d_cache_dialogs.h"
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <fp_lib_table.h>
@ -635,7 +635,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
}
// Remove text items:
SELECTION_TOOL* selTool = m_frame->GetToolManager()->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
for( FP_TEXT* item: items_to_remove )
{

View File

@ -30,7 +30,7 @@
#include <gendrill_Excellon_writer.h>
#include <gendrill_gerber_writer.h>
#include <bitmaps.h>
#include <tools/pcb_editor_control.h>
#include <tools/board_editor_control.h>
#include <board.h>
#include <track.h>
#include <footprint.h>
@ -50,7 +50,7 @@ static DRILL_PRECISION precisionListForMetric( 3, 3 );
/* This function displays the dialog frame for drill tools
*/
int PCB_EDITOR_CONTROL::GenerateDrillFiles( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::GenerateDrillFiles( const TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
DIALOG_GENDRILL dlg( editFrame, editFrame );

View File

@ -28,7 +28,7 @@
#include <connectivity/connectivity_data.h>
#include <pcb_layer_box_selector.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/global_edit_tool.h>
#include "dialog_global_edit_tracks_and_vias_base.h"
@ -220,8 +220,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid()
bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
{
PCBNEW_SELECTION& selection = m_parent->GetToolManager()->GetTool<SELECTION_TOOL>()->GetSelection();
auto item = dynamic_cast<BOARD_CONNECTED_ITEM*>( selection.Front() );
PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
PCB_SELECTION& selection = selTool->GetSelection();
BOARD_CONNECTED_ITEM* item = dynamic_cast<BOARD_CONNECTED_ITEM*>( selection.Front() );
m_tracks->SetValue( g_modifyTracks );
m_vias->SetValue( g_modifyVias );

View File

@ -24,7 +24,7 @@
*/
#include <kicad_string.h>
#include <tools/pcb_inspection_tool.h>
#include <tools/board_inspection_tool.h>
#include <board.h>
#include <track.h>
#include <dialog_net_inspector.h>

View File

@ -33,7 +33,7 @@
#include <board.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/pcbnew_control.h>
#include <tools/pcb_control.h>
#include <dialog_print_generic.h>
#include <pcbnew_printout.h>
@ -435,7 +435,7 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
}
int PCBNEW_CONTROL::Print( const TOOL_EVENT& aEvent )
int PCB_CONTROL::Print( const TOOL_EVENT& aEvent )
{
// Selection affects the origin item visibility
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );

View File

@ -25,7 +25,7 @@
#include <dialogs/dialog_track_via_properties.h>
#include <pcb_layer_box_selector.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <track.h>
#include <pcb_edit_frame.h>
#include <confirm.h>
@ -34,7 +34,7 @@
#include <macros.h>
DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent,
const PCBNEW_SELECTION& aItems,
const PCB_SELECTION& aItems,
COMMIT& aCommit ) :
DIALOG_TRACK_VIA_PROPERTIES_BASE( aParent ),
m_frame( aParent ),

View File

@ -27,7 +27,7 @@
#include <core/optional.h>
#include <layers_id_colors_and_visibility.h>
class PCBNEW_SELECTION;
class PCB_SELECTION;
class COMMIT;
class PCB_BASE_FRAME;
class PAD;
@ -35,7 +35,7 @@ class PAD;
class DIALOG_TRACK_VIA_PROPERTIES : public DIALOG_TRACK_VIA_PROPERTIES_BASE
{
public:
DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const PCBNEW_SELECTION& aItems,
DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const PCB_SELECTION& aItems,
COMMIT& aCommit );
bool TransferDataFromWindow() override;
@ -50,17 +50,17 @@ private:
bool confirmPadChange( const std::vector<PAD*>& connectedPads );
PCB_BASE_FRAME* m_frame;
const PCBNEW_SELECTION& m_items; // List of items to be modified.
COMMIT& m_commit; // An undo record to add any changes to.
PCB_BASE_FRAME* m_frame;
const PCB_SELECTION& m_items; // List of items to be modified.
COMMIT& m_commit; // An undo record to add any changes to.
UNIT_BINDER m_trackStartX, m_trackStartY;
UNIT_BINDER m_trackEndX, m_trackEndY;
UNIT_BINDER m_trackWidth;
UNIT_BINDER m_trackStartX, m_trackStartY;
UNIT_BINDER m_trackEndX, m_trackEndY;
UNIT_BINDER m_trackWidth;
UNIT_BINDER m_viaX, m_viaY;
UNIT_BINDER m_viaDiameter, m_viaDrill;
UNIT_BINDER m_viaX, m_viaY;
UNIT_BINDER m_viaDiameter, m_viaDrill;
bool m_tracks; // True if dialog displays any track properties.
bool m_vias; // True if dialog displays any via properties.
bool m_tracks; // True if dialog displays any track properties.
bool m_vias; // True if dialog displays any via properties.
};

View File

@ -29,7 +29,7 @@
#include <track.h>
#include <pad.h>
#include <pcb_edit_frame.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
enum SCOPE : int
{
@ -46,7 +46,7 @@ enum PAD_ACTION : int
DIALOG_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS( PCB_BASE_FRAME* aParent,
const PCBNEW_SELECTION& aItems,
const PCB_SELECTION& aItems,
COMMIT& aCommit )
: DIALOG_UNUSED_PAD_LAYERS_BASE( aParent ),
m_frame( aParent ),

View File

@ -30,14 +30,13 @@
class COMMIT;
class PCB_BASE_FRAME;
class PCBNEW_SELECTION;
class PCB_SELECTION;
class DIALOG_UNUSED_PAD_LAYERS : public DIALOG_UNUSED_PAD_LAYERS_BASE
{
public:
DIALOG_UNUSED_PAD_LAYERS( PCB_BASE_FRAME* aParent,
const PCBNEW_SELECTION& aItems,
COMMIT& aCommit );
DIALOG_UNUSED_PAD_LAYERS( PCB_BASE_FRAME* aParent, const PCB_SELECTION& aItems,
COMMIT& aCommit );
private:
bool TransferDataFromWindow() override;
@ -47,9 +46,9 @@ private:
void syncImages( wxCommandEvent& aEvent ) override;
void onScopeChange( wxCommandEvent& aEvent ) override;
PCB_BASE_FRAME* m_frame;
const PCBNEW_SELECTION& m_items; // List of items to be modified.
COMMIT& m_commit; // An undo record to add any changes to.
PCB_BASE_FRAME* m_frame;
const PCB_SELECTION& m_items; // List of items to be modified.
COMMIT& m_commit; // An undo record to add any changes to.
};
#endif // __dialog_remove_unused_pads__

View File

@ -30,7 +30,6 @@
#include <netlist_reader/board_netlist_updater.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <kiface_i.h>
#include <kiplatform/ui.h>

View File

@ -34,7 +34,7 @@
#include <pgm_base.h>
#include <bitmaps.h>
#include <reporter.h>
#include <tools/pcb_editor_control.h>
#include <tools/board_editor_control.h>
#include <board.h>
#include <footprint.h>
#include <wildcards_and_files_ext.h>
@ -452,7 +452,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
}
int PCB_EDITOR_CONTROL::GeneratePosFile( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::GeneratePosFile( const TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
DIALOG_GEN_FOOTPRINT_POSITION dlg( editFrame );

View File

@ -26,11 +26,11 @@
#include "tools/footprint_editor_tools.h"
#include "tools/pad_tool.h"
#include "tools/pcb_actions.h"
#include "tools/pcbnew_control.h"
#include "tools/pcbnew_picker_tool.h"
#include "tools/pcb_control.h"
#include "tools/pcb_picker_tool.h"
#include "tools/placement_tool.h"
#include "tools/point_editor.h"
#include "tools/selection_tool.h"
#include "tools/pcb_selection_tool.h"
#include <3d_viewer/eda_3d_viewer.h>
#include <bitmaps.h>
#include <board.h>
@ -312,7 +312,7 @@ bool FOOTPRINT_EDIT_FRAME::IsContentModified()
SELECTION& FOOTPRINT_EDIT_FRAME::GetCurrentSelection()
{
return m_toolManager->GetTool<SELECTION_TOOL>()->GetSelection();
return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
}
@ -511,7 +511,7 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
m_displayOptions = cfg->m_Display;
m_defaultLibWidth = cfg->m_LibWidth;
GetToolManager()->GetTool<SELECTION_TOOL>()->GetFilter() = cfg->m_SelectionFilter;
GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->GetFilter() = cfg->m_SelectionFilter;
m_selectionFilterPanel->SetCheckboxesFromFilter( cfg->m_SelectionFilter );
}
@ -526,7 +526,7 @@ void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
cfg->m_DesignSettings = GetDesignSettings();
cfg->m_Display = m_displayOptions;
cfg->m_LibWidth = m_treePane->GetSize().x;
cfg->m_SelectionFilter = GetToolManager()->GetTool<SELECTION_TOOL>()->GetFilter();
cfg->m_SelectionFilter = GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->GetFilter();
cfg->m_LayerPresets = m_appearancePanel->GetUserLayerPresets();
cfg->m_ActiveLayerPreset = m_appearancePanel->GetActiveLayerPreset();
@ -901,28 +901,28 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new SELECTION_TOOL );
m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new EDIT_TOOL );
m_toolManager->RegisterTool( new PAD_TOOL );
m_toolManager->RegisterTool( new DRAWING_TOOL );
m_toolManager->RegisterTool( new POINT_EDITOR );
m_toolManager->RegisterTool( new PCBNEW_CONTROL ); // copy/paste
m_toolManager->RegisterTool( new PCB_CONTROL ); // copy/paste
m_toolManager->RegisterTool( new FOOTPRINT_EDITOR_TOOLS );
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL );
m_toolManager->RegisterTool( new PCB_PICKER_TOOL );
m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
m_toolManager->RegisterTool( new GROUP_TOOL );
m_toolManager->RegisterTool( new CONVERT_TOOL );
m_toolManager->GetTool<SELECTION_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCB_SELECTION_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<EDIT_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PAD_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<DRAWING_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<POINT_EDITOR>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCBNEW_CONTROL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCBNEW_PICKER_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCB_CONTROL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<PCB_PICKER_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<POSITION_RELATIVE_TOOL>()->SetIsFootprintEditor( true );
m_toolManager->GetTool<GROUP_TOOL>()->SetIsFootprintEditor( true );

View File

@ -31,7 +31,6 @@ class FP_LIB_TABLE;
class FOOTPRINT_TREE_PANE;
class SYMBOL_LIBRARY_MANAGER;
class FOOTPRINT_EDITOR_SETTINGS;
class PCBNEW_SELECTION;
namespace PCB { struct IFACE; } // A KIFACE_I coded in pcbnew.c

View File

@ -52,9 +52,9 @@
#include <tools/pcb_viewer_tools.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_editor_conditions.h>
#include <tools/pcbnew_control.h>
#include <tools/pcbnew_picker_tool.h>
#include <tools/selection_tool.h>
#include <tools/pcb_control.h>
#include <tools/pcb_picker_tool.h>
#include <tools/pcb_selection_tool.h>
#include <wildcards_and_files_ext.h>
#include <wx/tokenzr.h>
@ -203,11 +203,11 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
drawPanel->SetEventDispatcher( m_toolDispatcher );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new SELECTION_TOOL );
m_toolManager->RegisterTool( new PCB_CONTROL );
m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
m_toolManager->RegisterTool( new COMMON_TOOLS ); // for std context menus (zoom & grid)
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL ); // for setting grid origin
m_toolManager->RegisterTool( new PCB_PICKER_TOOL ); // for setting grid origin
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
@ -293,7 +293,7 @@ FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
SELECTION& FOOTPRINT_VIEWER_FRAME::GetCurrentSelection()
{
return m_toolManager->GetTool<SELECTION_TOOL>()->GetSelection();
return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
}

View File

@ -48,8 +48,8 @@
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <tool/common_tools.h>
#include "tools/selection_tool.h"
#include "tools/pcbnew_control.h"
#include "tools/pcb_selection_tool.h"
#include "tools/pcb_control.h"
#include "tools/pcb_actions.h"
@ -145,8 +145,8 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
m_toolManager->RegisterTool( new PCB_CONTROL );
m_toolManager->RegisterTool( new PCB_SELECTION_TOOL ); // for std context menus (zoom & grid)
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->InitTools();

View File

@ -58,7 +58,7 @@ void CLIPBOARD_IO::SetBoard( BOARD* aBoard )
}
void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected, bool isFootprintEditor )
void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootprintEditor )
{
VECTOR2I refPoint( 0, 0 );

View File

@ -35,7 +35,7 @@
#include <footprint.h>
#include <plugins/kicad/pcb_parser.h>
#include <memory.h>
#include <tools/pcbnew_selection.h>
#include <tools/pcb_selection.h>
class CLIPBOARD_IO : public PCB_IO
@ -54,7 +54,7 @@ public:
* Writes all the settings of the BOARD* set by setBoard() and then adds all the
* BOARD_ITEMs found in selection formatted by PCB_IO to clipboard as sexpr text
*/
void SaveSelection( const PCBNEW_SELECTION& selected, bool isFootprintEditor );
void SaveSelection( const PCB_SELECTION& selected, bool isFootprintEditor );
BOARD_ITEM* Parse();

View File

@ -32,13 +32,13 @@
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <board.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <widgets/wx_menubar.h>
void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
{
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_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();

View File

@ -38,13 +38,13 @@
#include <tool/selection_conditions.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <widgets/wx_menubar.h>
void PCB_EDIT_FRAME::ReCreateMenuBar()
{
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_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();

View File

@ -33,7 +33,6 @@
#include <preview_items/centreline_rect_item.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <view/view_controls.h>
#include <view/view.h>

View File

@ -44,7 +44,7 @@ using namespace std::placeholders;
#include "board_netlist_updater.h"
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <project/project_file.h> // LAST_PATH_TYPE
@ -120,8 +120,8 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR
// Now fix a reference point to move the footprints.
// We use the first footprint in list as reference point
// The graphic cursor will be on this fp when moving the footprints.
SELECTION_TOOL* selTool = GetToolManager()->GetTool<SELECTION_TOOL>();
PCBNEW_SELECTION& selection = selTool->GetSelection();
PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
PCB_SELECTION& selection = selTool->GetSelection();
selection.SetReferencePoint( newFootprints[0]->GetPosition() );
}

View File

@ -57,8 +57,8 @@
#include <tool/common_tools.h>
#include <tool/selection.h>
#include <tool/zoom_tool.h>
#include <tools/selection_tool.h>
#include <tools/pcbnew_picker_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_picker_tool.h>
#include <tools/point_editor.h>
#include <tools/edit_tool.h>
#include <tools/group_tool.h>
@ -66,12 +66,12 @@
#include <tools/global_edit_tool.h>
#include <tools/convert_tool.h>
#include <tools/drawing_tool.h>
#include <tools/pcbnew_control.h>
#include <tools/pcb_editor_control.h>
#include <tools/pcb_inspection_tool.h>
#include <tools/pcb_control.h>
#include <tools/board_editor_control.h>
#include <tools/board_inspection_tool.h>
#include <tools/pcb_editor_conditions.h>
#include <tools/pcb_viewer_tools.h>
#include <tools/pcb_reannotate_tool.h>
#include <tools/board_reannotate_tool.h>
#include <tools/placement_tool.h>
#include <tools/pad_tool.h>
#include <microwave/microwave_tool.h>
@ -430,7 +430,7 @@ bool PCB_EDIT_FRAME::isAutoSaveRequired() const
SELECTION& PCB_EDIT_FRAME::GetCurrentSelection()
{
return m_toolManager->GetTool<SELECTION_TOOL>()->GetSelection();
return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
}
@ -446,9 +446,9 @@ void PCB_EDIT_FRAME::setupTools()
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new SELECTION_TOOL );
m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL );
m_toolManager->RegisterTool( new PCB_PICKER_TOOL );
m_toolManager->RegisterTool( new ROUTER_TOOL );
m_toolManager->RegisterTool( new LENGTH_TUNER_TOOL );
m_toolManager->RegisterTool( new EDIT_TOOL );
@ -456,10 +456,10 @@ void PCB_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new PAD_TOOL );
m_toolManager->RegisterTool( new DRAWING_TOOL );
m_toolManager->RegisterTool( new POINT_EDITOR );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL );
m_toolManager->RegisterTool( new PCB_INSPECTION_TOOL );
m_toolManager->RegisterTool( new PCB_REANNOTATE_TOOL );
m_toolManager->RegisterTool( new PCB_CONTROL );
m_toolManager->RegisterTool( new BOARD_EDITOR_CONTROL );
m_toolManager->RegisterTool( new BOARD_INSPECTION_TOOL );
m_toolManager->RegisterTool( new BOARD_REANNOTATE_TOOL );
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
m_toolManager->RegisterTool( new MICROWAVE_TOOL );
m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );

View File

@ -32,7 +32,7 @@
#include <panel_pcbnew_action_plugins.h>
#include <panel_pcbnew_display_origin.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <page_layout/ws_data_model.h>
#include <pcbplot.h>
#include <pcb_painter.h>
@ -117,7 +117,8 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
m_appearancePanel->SetUserLayerPresets( project.m_LayerPresets );
SELECTION_FILTER_OPTIONS& filterOpts = GetToolManager()->GetTool<SELECTION_TOOL>()->GetFilter();
PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter();
filterOpts = localSettings.m_SelectionFilter;
m_selectionFilterPanel->SetCheckboxesFromFilter( filterOpts );
@ -213,8 +214,10 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
pair.second->SetPcbColor( netclassColors.at( pair.first ) );
}
SELECTION_FILTER_OPTIONS& filterOpts = GetToolManager()->GetTool<SELECTION_TOOL>()->GetFilter();
localSettings.m_SelectionFilter = filterOpts;
PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter();
localSettings.m_SelectionFilter = filterOpts;
if( !Prj().IsNullProject() )
GetSettingsManager()->SaveProject();

View File

@ -39,7 +39,7 @@ using namespace std::placeholders;
#include <tool/tool_manager.h>
#include <tool/tool_menu.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/grid_helper.h>
#include "router_tool.h"
@ -1437,7 +1437,7 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT
bool ROUTER_TOOL::CanInlineDrag()
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, NeighboringSegmentFilter );
const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( selection.Size() == 1 )
{
@ -1457,7 +1457,7 @@ bool ROUTER_TOOL::CanInlineDrag()
int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
{
const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, NeighboringSegmentFilter );
@ -1652,7 +1652,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
int ROUTER_TOOL::InlineBreakTrack( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
const SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( selection.Size() != 1 )
return 0;

View File

@ -29,7 +29,7 @@
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <pcb_layer_box_selector.h>
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
@ -200,7 +200,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::toggleFootprintTree, ACTION_TOOLBAR::TOGGLE );
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
gridMenu->Add( ACTIONS::gridProperties );
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );

View File

@ -26,7 +26,7 @@
#include <tool/action_toolbar.h>
#include <tool/conditional_menu.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_actions.h>
#include "footprint_viewer_frame.h"
#include "pcbnew_id.h"
@ -143,7 +143,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateVToolbar()
void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar()
{
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_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();

View File

@ -44,7 +44,7 @@
#include <tool/common_tools.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <wx/wupdlock.h>
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
@ -362,7 +362,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
gridMenu->Add( ACTIONS::gridProperties );
m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
@ -452,7 +452,7 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->AddGroup( originGroup, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> routeMenu = std::make_unique<ACTION_MENU>( false, selTool );
routeMenu->Add( PCB_ACTIONS::routerHighlightMode, ACTION_MENU::CHECK );

View File

@ -22,11 +22,11 @@
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "pcb_editor_control.h"
#include "board_editor_control.h"
#include "drawing_tool.h"
#include "pcb_actions.h"
#include "pcbnew_picker_tool.h"
#include "selection_tool.h"
#include "pcb_picker_tool.h"
#include "pcb_selection_tool.h"
#include "edit_tool.h"
#include "tool/tool_event.h"
#include <bitmaps.h>
@ -120,7 +120,7 @@ public:
};
PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
BOARD_EDITOR_CONTROL::BOARD_EDITOR_CONTROL() :
PCB_TOOL_BASE( "pcbnew.EditorControl" ),
m_frame( nullptr )
{
@ -129,12 +129,12 @@ PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
}
PCB_EDITOR_CONTROL::~PCB_EDITOR_CONTROL()
BOARD_EDITOR_CONTROL::~BOARD_EDITOR_CONTROL()
{
}
void PCB_EDITOR_CONTROL::Reset( RESET_REASON aReason )
void BOARD_EDITOR_CONTROL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<PCB_EDIT_FRAME>();
@ -147,7 +147,7 @@ void PCB_EDITOR_CONTROL::Reset( RESET_REASON aReason )
}
bool PCB_EDITOR_CONTROL::Init()
bool BOARD_EDITOR_CONTROL::Init()
{
auto activeToolCondition =
[ this ] ( const SELECTION& aSel )
@ -188,7 +188,7 @@ bool PCB_EDITOR_CONTROL::Init()
// Add the PCB control menus to relevant other tools
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
if( selTool )
{
@ -233,42 +233,42 @@ bool PCB_EDITOR_CONTROL::Init()
}
int PCB_EDITOR_CONTROL::New( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::New( const TOOL_EVENT& aEvent )
{
m_frame->Files_io_from_id( ID_NEW_BOARD );
return 0;
}
int PCB_EDITOR_CONTROL::Open( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::Open( const TOOL_EVENT& aEvent )
{
m_frame->Files_io_from_id( ID_LOAD_FILE );
return 0;
}
int PCB_EDITOR_CONTROL::Save( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::Save( const TOOL_EVENT& aEvent )
{
m_frame->Files_io_from_id( ID_SAVE_BOARD );
return 0;
}
int PCB_EDITOR_CONTROL::SaveAs( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::SaveAs( const TOOL_EVENT& aEvent )
{
m_frame->Files_io_from_id( ID_SAVE_BOARD_AS );
return 0;
}
int PCB_EDITOR_CONTROL::SaveCopyAs( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::SaveCopyAs( const TOOL_EVENT& aEvent )
{
m_frame->Files_io_from_id( ID_COPY_BOARD_AS );
return 0;
}
int PCB_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
{
PICKED_ITEMS_LIST undoCmd;
WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
@ -288,28 +288,28 @@ int PCB_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent )
{
m_frame->ToPlotter( ID_GEN_PLOT );
return 0;
}
int PCB_EDITOR_CONTROL::BoardSetup( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::BoardSetup( const TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->ShowBoardSetupDialog();
return 0;
}
int PCB_EDITOR_CONTROL::ImportNetlist( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ImportNetlist( const TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->InstallNetlistFrame();
return 0;
}
int PCB_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent )
{
wxString fullFileName = frame()->GetBoard()->GetFileName();
wxString path;
@ -329,7 +329,7 @@ int PCB_EDITOR_CONTROL::ImportSpecctraSession( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent )
{
wxString fullFileName = m_frame->GetLastPath( LAST_PATH_SPECCTRADSN );
wxFileName fn;
@ -356,7 +356,7 @@ int PCB_EDITOR_CONTROL::ExportSpecctraDSN( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::GenerateFabFiles( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::GenerateFabFiles( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummy;
@ -375,7 +375,7 @@ int PCB_EDITOR_CONTROL::GenerateFabFiles( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
{
int errors = 0;
wxString details;
@ -492,7 +492,7 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent )
{
NETLIST netlist;
@ -505,7 +505,7 @@ int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent )
return 0;
}
int PCB_EDITOR_CONTROL::UpdateSchematicFromPCB( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB( const TOOL_EVENT& aEvent )
{
if( Kiface().IsSingle() )
{
@ -528,21 +528,21 @@ int PCB_EDITOR_CONTROL::UpdateSchematicFromPCB( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ShowEeschema( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ShowEeschema( const TOOL_EVENT& aEvent )
{
m_frame->RunEeschema();
return 0;
}
int PCB_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->ToggleLayersManager();
return 0;
}
int PCB_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent )
{
#if defined( KICAD_SCRIPTING_WXPYTHON )
m_frame->ScriptingConsoleEnableDisable();
@ -552,11 +552,11 @@ int PCB_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent )
// Track & via size control
int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
{
BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( m_frame->ToolStackIsEmpty() && SELECTION_CONDITIONS::OnlyTypes( types )( selection ) )
{
@ -618,11 +618,11 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
{
BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( m_frame->ToolStackIsEmpty() && SELECTION_CONDITIONS::OnlyTypes( types )( selection ) )
{
@ -686,11 +686,11 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
{
BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( m_frame->ToolStackIsEmpty() && SELECTION_CONDITIONS::OnlyTypes( types )( selection ) )
{
@ -735,11 +735,11 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
{
BOARD_DESIGN_SETTINGS& designSettings = getModel<BOARD>()->GetDesignSettings();
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( m_frame->ToolStackIsEmpty() && SELECTION_CONDITIONS::OnlyTypes( types )( selection ) )
{
@ -792,7 +792,7 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
{
FOOTPRINT* fp = aEvent.Parameter<FOOTPRINT*>();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
@ -956,29 +956,29 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ToggleLockSelected( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ToggleLockSelected( const TOOL_EVENT& aEvent )
{
return modifyLockSelected( TOGGLE );
}
int PCB_EDITOR_CONTROL::LockSelected( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::LockSelected( const TOOL_EVENT& aEvent )
{
return modifyLockSelected( ON );
}
int PCB_EDITOR_CONTROL::UnlockSelected( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::UnlockSelected( const TOOL_EVENT& aEvent )
{
return modifyLockSelected( OFF );
}
int PCB_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode )
int BOARD_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
BOARD_COMMIT commit( m_frame );
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
BOARD_COMMIT commit( m_frame );
if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
@ -1031,7 +1031,7 @@ int PCB_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode )
}
int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = getView();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
@ -1180,11 +1180,11 @@ static bool mergeZones( BOARD_COMMIT& aCommit, std::vector<ZONE*>& aOriginZones,
}
int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
{
const PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
BOARD* board = getModel<BOARD>();
BOARD_COMMIT commit( m_frame );
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
BOARD* board = getModel<BOARD>();
BOARD_COMMIT commit( m_frame );
if( selection.Size() < 2 )
return 0;
@ -1238,10 +1238,10 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
// because this pops up the zone editor, it would be confusing to handle multiple zones,
// so just handle single selections containing exactly one zone
@ -1289,10 +1289,10 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->RequestSelection( EDIT_TOOL::FootprintFilter );
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->RequestSelection( EDIT_TOOL::FootprintFilter );
if( selection.Empty() )
return 0;
@ -1318,8 +1318,8 @@ int PCB_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
}
void PCB_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
void BOARD_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
{
aFrame->GetDesignSettings().m_AuxOrigin = (wxPoint) aPosition;
originViewItem->SetPosition( (wxPoint) aPosition );
@ -1328,10 +1328,10 @@ void PCB_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* a
}
int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
{
std::string tool = aEvent.GetCommandStr().get();
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
std::string tool = aEvent.GetCommandStr().get();
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
// Deactivate other tools; particularly important if another PICKER is currently running
Activate();
@ -1350,7 +1350,7 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::FlipPcbView( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::FlipPcbView( const TOOL_EVENT& aEvent )
{
view()->SetMirror( !view()->IsMirroredX(), false );
view()->RecacheAllItems();
@ -1360,57 +1360,57 @@ int PCB_EDITOR_CONTROL::FlipPcbView( const TOOL_EVENT& aEvent )
}
void PCB_EDITOR_CONTROL::setTransitions()
void BOARD_EDITOR_CONTROL::setTransitions()
{
Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SaveCopyAs, ACTIONS::saveCopyAs.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::PageSettings, ACTIONS::pageSettings.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::SaveCopyAs, ACTIONS::saveCopyAs.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::PageSettings, ACTIONS::pageSettings.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::BoardSetup, PCB_ACTIONS::boardSetup.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ImportNetlist, PCB_ACTIONS::importNetlist.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ImportSpecctraSession, PCB_ACTIONS::importSpecctraSession.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ExportSpecctraDSN, PCB_ACTIONS::exportSpecctraDSN.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::GenerateDrillFiles, PCB_ACTIONS::generateDrillFiles.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateGerbers.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::GeneratePosFile, PCB_ACTIONS::generatePosFile.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateReportFile.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateD356File.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateBOM.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::BoardSetup, PCB_ACTIONS::boardSetup.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ImportNetlist, PCB_ACTIONS::importNetlist.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ImportSpecctraSession, PCB_ACTIONS::importSpecctraSession.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ExportSpecctraDSN, PCB_ACTIONS::exportSpecctraDSN.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateDrillFiles, PCB_ACTIONS::generateDrillFiles.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateGerbers.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GeneratePosFile, PCB_ACTIONS::generatePosFile.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateReportFile.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateD356File.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateBOM.MakeEvent() );
// Track & via size control
Go( &PCB_EDITOR_CONTROL::TrackWidthInc, PCB_ACTIONS::trackWidthInc.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TrackWidthDec, PCB_ACTIONS::trackWidthDec.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ViaSizeInc, PCB_ACTIONS::viaSizeInc.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ViaSizeDec, PCB_ACTIONS::viaSizeDec.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::TrackWidthInc, PCB_ACTIONS::trackWidthInc.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::TrackWidthDec, PCB_ACTIONS::trackWidthDec.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ViaSizeInc, PCB_ACTIONS::viaSizeInc.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ViaSizeDec, PCB_ACTIONS::viaSizeDec.MakeEvent() );
// Zone actions
Go( &PCB_EDITOR_CONTROL::ZoneMerge, PCB_ACTIONS::zoneMerge.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneDuplicate, PCB_ACTIONS::zoneDuplicate.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ZoneMerge, PCB_ACTIONS::zoneMerge.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ZoneDuplicate, PCB_ACTIONS::zoneDuplicate.MakeEvent() );
// Placing tools
Go( &PCB_EDITOR_CONTROL::PlaceTarget, PCB_ACTIONS::placeTarget.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::PlaceModule, PCB_ACTIONS::placeModule.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::PlaceTarget, PCB_ACTIONS::placeTarget.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::PlaceModule, PCB_ACTIONS::placeModule.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::EditFpInFpEditor, PCB_ACTIONS::editFpInFpEditor.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::EditFpInFpEditor, PCB_ACTIONS::editFpInFpEditor.MakeEvent() );
// Other
Go( &PCB_EDITOR_CONTROL::ToggleLockSelected, PCB_ACTIONS::toggleLock.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::LockSelected, PCB_ACTIONS::lock.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UnlockSelected, PCB_ACTIONS::unlock.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ToggleLockSelected, PCB_ACTIONS::toggleLock.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::LockSelected, PCB_ACTIONS::lock.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::UnlockSelected, PCB_ACTIONS::unlock.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdateSchematicFromPCB, ACTIONS::updateSchematicFromPcb.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ShowEeschema, PCB_ACTIONS::showEeschema.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::RepairBoard, PCB_ACTIONS::repairBoard.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB, ACTIONS::updateSchematicFromPcb.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ShowEeschema, PCB_ACTIONS::showEeschema.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::RepairBoard, PCB_ACTIONS::repairBoard.MakeEvent() );
}
const int PCB_EDITOR_CONTROL::WIDTH_STEP = 100000;
const int BOARD_EDITOR_CONTROL::WIDTH_STEP = 100000;

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_EDITOR_CONTROL_H
#define PCB_EDITOR_CONTROL_H
#ifndef BOARD_EDITOR_CONTROL_H
#define BOARD_EDITOR_CONTROL_H
#include <tools/pcb_tool_base.h>
#include <tool/tool_menu.h>
@ -35,15 +35,15 @@ namespace KIGFX {
class PCB_EDIT_FRAME;
/**
* PCB_EDITOR_CONTROL
* BOARD_EDITOR_CONTROL
*
* Handles actions specific to the board editor in pcbnew.
*/
class PCB_EDITOR_CONTROL : public PCB_TOOL_BASE
class BOARD_EDITOR_CONTROL : public PCB_TOOL_BASE
{
public:
PCB_EDITOR_CONTROL();
~PCB_EDITOR_CONTROL();
BOARD_EDITOR_CONTROL();
~BOARD_EDITOR_CONTROL();
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;

View File

@ -24,8 +24,8 @@
#include <bitmaps.h>
#include <pcb_group.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcbnew_picker_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_picker_tool.h>
#include <tools/edit_tool.h>
#include <pcb_painter.h>
#include <connectivity/connectivity_data.h>
@ -35,7 +35,7 @@
#include <dialogs/panel_setup_rules_base.h>
#include <dialogs/dialog_constraints_reporter.h>
#include <kicad_string.h>
#include "pcb_inspection_tool.h"
#include "board_inspection_tool.h"
void DIALOG_INSPECTION_REPORTER::OnErrorLinkClicked( wxHtmlLinkEvent& event )
@ -47,7 +47,7 @@ void DIALOG_INSPECTION_REPORTER::OnErrorLinkClicked( wxHtmlLinkEvent& event )
}
PCB_INSPECTION_TOOL::PCB_INSPECTION_TOOL() :
BOARD_INSPECTION_TOOL::BOARD_INSPECTION_TOOL() :
PCB_TOOL_BASE( "pcbnew.InspectionTool" ),
m_frame( nullptr )
{
@ -78,9 +78,9 @@ private:
};
bool PCB_INSPECTION_TOOL::Init()
bool BOARD_INSPECTION_TOOL::Init()
{
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
auto netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
netSubMenu->SetTool( this );
@ -99,13 +99,13 @@ bool PCB_INSPECTION_TOOL::Init()
}
void PCB_INSPECTION_TOOL::Reset( RESET_REASON aReason )
void BOARD_INSPECTION_TOOL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<PCB_EDIT_FRAME>();
}
int PCB_INSPECTION_TOOL::ShowStatisticsDialog( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::ShowStatisticsDialog( const TOOL_EVENT& aEvent )
{
DIALOG_BOARD_STATISTICS dialog( m_frame );
dialog.ShowModal();
@ -113,7 +113,7 @@ int PCB_INSPECTION_TOOL::ShowStatisticsDialog( const TOOL_EVENT& aEvent )
}
wxString PCB_INSPECTION_TOOL::getItemDescription( BOARD_ITEM* aItem )
wxString BOARD_INSPECTION_TOOL::getItemDescription( BOARD_ITEM* aItem )
{
wxString s = aItem->GetSelectMenuText( m_frame->GetUserUnits() );
@ -128,7 +128,7 @@ wxString PCB_INSPECTION_TOOL::getItemDescription( BOARD_ITEM* aItem )
};
void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE* aZone, PAD* aPad, REPORTER* r )
void BOARD_INSPECTION_TOOL::reportZoneConnection( ZONE* aZone, PAD* aPad, REPORTER* r )
{
ENUM_MAP<ZONE_CONNECTION> connectionEnum = ENUM_MAP<ZONE_CONNECTION>::Instance();
wxString source;
@ -208,9 +208,9 @@ void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE* aZone, PAD* aPad, REPORTER
}
void PCB_INSPECTION_TOOL::reportClearance( DRC_CONSTRAINT_TYPE_T aClearanceType,
PCB_LAYER_ID aLayer, BOARD_ITEM* aA, BOARD_ITEM* aB,
REPORTER* r )
void BOARD_INSPECTION_TOOL::reportClearance( DRC_CONSTRAINT_TYPE_T aClearanceType,
PCB_LAYER_ID aLayer, BOARD_ITEM* aA, BOARD_ITEM* aB,
REPORTER* r )
{
r->Report( "" );
@ -265,11 +265,11 @@ void PCB_INSPECTION_TOOL::reportClearance( DRC_CONSTRAINT_TYPE_T aClearanceType,
}
int PCB_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
PCB_LAYER_ID layer = m_frame->GetActiveLayer();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
PCB_LAYER_ID layer = m_frame->GetActiveLayer();
if( selection.Size() != 2 )
{
@ -283,7 +283,7 @@ int PCB_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
m_inspectClearanceDialog->SetTitle( _( "Clearance Report" ) );
m_inspectClearanceDialog->Connect( wxEVT_CLOSE_WINDOW,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectClearanceDialogClosed ),
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed ),
nullptr, this );
}
@ -420,10 +420,10 @@ int PCB_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
if( selection.Size() != 1 )
{
@ -437,7 +437,7 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
m_inspectConstraintsDialog->SetTitle( _( "Constraints Report" ) );
m_inspectConstraintsDialog->Connect( wxEVT_CLOSE_WINDOW,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed ),
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectConstraintsDialogClosed ),
nullptr, this );
}
@ -654,14 +654,14 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::CrossProbePcbToSch( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::CrossProbePcbToSch( const TOOL_EVENT& aEvent )
{
// Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
if( m_probingSchToPcb )
return 0;
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
if( selection.Size() == 1 )
m_frame->SendMessageToEESCHEMA( static_cast<BOARD_ITEM*>( selection.Front() ) );
@ -674,7 +674,7 @@ int PCB_INSPECTION_TOOL::CrossProbePcbToSch( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
{
BOARD_ITEM* item = aEvent.Parameter<BOARD_ITEM*>();
@ -706,18 +706,18 @@ int PCB_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
* @param aPosition is the point where an item is expected (world coordinates).
* @param aUseSelection is true if we should use the current selection to pick the netcode
*/
bool PCB_INSPECTION_TOOL::highlightNet( const VECTOR2D& aPosition, bool aUseSelection )
bool BOARD_INSPECTION_TOOL::highlightNet( const VECTOR2D& aPosition, bool aUseSelection )
{
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
KIGFX::RENDER_SETTINGS* settings = getView()->GetPainter()->GetSettings();
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
int net = -1;
bool enableHighlight = false;
if( aUseSelection )
{
const PCBNEW_SELECTION& selection = selectionTool->GetSelection();
const PCB_SELECTION& selection = selectionTool->GetSelection();
for( auto item : selection )
{
@ -828,7 +828,7 @@ int PCB_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::HighlightNet( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::HighlightNet( const TOOL_EVENT& aEvent )
{
int netcode = aEvent.Parameter<intptr_t>();
KIGFX::RENDER_SETTINGS* settings = m_toolMgr->GetView()->GetPainter()->GetSettings();
@ -856,7 +856,7 @@ int PCB_INSPECTION_TOOL::HighlightNet( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
{
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
KIGFX::RENDER_SETTINGS* settings = m_toolMgr->GetView()->GetPainter()->GetSettings();
@ -870,10 +870,10 @@ int PCB_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
{
std::string tool = aEvent.GetCommandStr().get();
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
std::string tool = aEvent.GetCommandStr().get();
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
// Deactivate other tools; particularly important if another PICKER is currently running
Activate();
@ -902,12 +902,12 @@ int PCB_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
{
std::string tool = aEvent.GetCommandStr().get();
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
BOARD* board = getModel<BOARD>();
auto& opt = displayOptions();
std::string tool = aEvent.GetCommandStr().get();
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
BOARD* board = getModel<BOARD>();
auto& opt = displayOptions();
// Deactivate other tools; particularly important if another PICKER is currently running
Activate();
@ -915,11 +915,11 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
picker->SetClickHandler(
[this, board, opt]( const VECTOR2D& pt ) -> bool
{
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, EDIT_TOOL::PadFilter );
PCBNEW_SELECTION& selection = selectionTool->GetSelection();
PCB_SELECTION& selection = selectionTool->GetSelection();
if( selection.Empty() )
{
@ -966,7 +966,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
picker->SetFinalizeHandler(
[board, opt] ( int aCondition )
{
if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE )
if( aCondition != PCB_PICKER_TOOL::END_ACTIVATE )
{
for( FOOTPRINT* fp : board->Footprints() )
{
@ -982,7 +982,7 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
{
VECTOR2I delta;
@ -999,7 +999,7 @@ int PCB_INSPECTION_TOOL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
m_dynamicData = nullptr;
}
auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
auto selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
auto& selection = selectionTool->GetSelection();
auto connectivity = getModel<BOARD>()->GetConnectivity();
@ -1018,7 +1018,7 @@ int PCB_INSPECTION_TOOL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
}
int PCB_INSPECTION_TOOL::HideDynamicRatsnest( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::HideDynamicRatsnest( const TOOL_EVENT& aEvent )
{
getModel<BOARD>()->GetConnectivity()->ClearDynamicRatsnest();
delete m_dynamicData;
@ -1028,13 +1028,13 @@ int PCB_INSPECTION_TOOL::HideDynamicRatsnest( const TOOL_EVENT& aEvent )
}
void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
void BOARD_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
{
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
SELECTION& selection = selectionTool->GetSelection();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
SELECTION& selection = selectionTool->GetSelection();
std::shared_ptr<CONNECTIVITY_DATA> connectivity = board()->GetConnectivity();
std::vector<BOARD_ITEM*> items;
std::deque<EDA_ITEM*> queued_items( selection.begin(), selection.end() );
std::deque<EDA_ITEM*> queued_items( selection.begin(), selection.end() );
for( std::size_t i = 0; i < queued_items.size(); ++i )
{
@ -1091,7 +1091,7 @@ void PCB_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
}
int PCB_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
{
if( m_listNetsDialog == nullptr )
{
@ -1099,11 +1099,11 @@ int PCB_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
std::make_unique<DIALOG_NET_INSPECTOR>( m_frame, m_listNetsDialogSettings );
m_listNetsDialog->Connect( wxEVT_CLOSE_WINDOW,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
this );
m_listNetsDialog->Connect( wxEVT_BUTTON,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
this );
}
@ -1113,62 +1113,62 @@ int PCB_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
}
void PCB_INSPECTION_TOOL::onListNetsDialogClosed( wxCommandEvent& event )
void BOARD_INSPECTION_TOOL::onListNetsDialogClosed( wxCommandEvent& event )
{
m_listNetsDialogSettings = m_listNetsDialog->Settings();
m_listNetsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
m_listNetsDialog->Disconnect( wxEVT_BUTTON,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
m_listNetsDialog->Destroy();
m_listNetsDialog.release();
}
void PCB_INSPECTION_TOOL::onInspectClearanceDialogClosed( wxCommandEvent& event )
void BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed( wxCommandEvent& event )
{
m_inspectClearanceDialog->Disconnect( wxEVT_CLOSE_WINDOW,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectClearanceDialogClosed ), nullptr, this );
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed ), nullptr, this );
m_inspectClearanceDialog->Destroy();
m_inspectClearanceDialog.release();
}
void PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed( wxCommandEvent& event )
void BOARD_INSPECTION_TOOL::onInspectConstraintsDialogClosed( wxCommandEvent& event )
{
m_inspectConstraintsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed ), nullptr, this );
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectConstraintsDialogClosed ), nullptr, this );
m_inspectConstraintsDialog->Destroy();
m_inspectConstraintsDialog.release();
}
int PCB_INSPECTION_TOOL::HideNet( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::HideNet( const TOOL_EVENT& aEvent )
{
doHideNet( aEvent.Parameter<intptr_t>(), true );
return 0;
}
int PCB_INSPECTION_TOOL::ShowNet( const TOOL_EVENT& aEvent )
int BOARD_INSPECTION_TOOL::ShowNet( const TOOL_EVENT& aEvent )
{
doHideNet( aEvent.Parameter<intptr_t>(), false );
return 0;
}
void PCB_INSPECTION_TOOL::doHideNet( int aNetCode, bool aHide )
void BOARD_INSPECTION_TOOL::doHideNet( int aNetCode, bool aHide )
{
KIGFX::PCB_RENDER_SETTINGS* rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
m_toolMgr->GetView()->GetPainter()->GetSettings() );
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
SELECTION& selection = selectionTool->GetSelection();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
SELECTION& selection = selectionTool->GetSelection();
if( aNetCode <= 0 && !selection.Empty() )
{
@ -1194,29 +1194,29 @@ void PCB_INSPECTION_TOOL::doHideNet( int aNetCode, bool aHide )
}
void PCB_INSPECTION_TOOL::setTransitions()
void BOARD_INSPECTION_TOOL::setTransitions()
{
Go( &PCB_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::SelectedEvent );
Go( &PCB_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::UnselectedEvent );
Go( &PCB_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::ClearedEvent );
Go( &BOARD_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::SelectedEvent );
Go( &BOARD_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::UnselectedEvent );
Go( &BOARD_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::ClearedEvent );
Go( &PCB_INSPECTION_TOOL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::HideDynamicRatsnest, PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::UpdateSelectionRatsnest,PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HideDynamicRatsnest, PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest,PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::ShowStatisticsDialog, PCB_ACTIONS::boardStatistics.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::InspectClearance, PCB_ACTIONS::inspectClearance.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::InspectConstraints, PCB_ACTIONS::inspectConstraints.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ShowStatisticsDialog, PCB_ACTIONS::boardStatistics.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectClearance, PCB_ACTIONS::inspectClearance.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::InspectConstraints, PCB_ACTIONS::inspectConstraints.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::toggleLastNetHighlight.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::HighlightNetTool, PCB_ACTIONS::highlightNetTool.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::ClearHighlight, ACTIONS::cancelInteractive.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::HighlightItem, PCB_ACTIONS::highlightItem.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::toggleLastNetHighlight.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightNetTool, PCB_ACTIONS::highlightNetTool.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ClearHighlight, ACTIONS::cancelInteractive.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HighlightItem, PCB_ACTIONS::highlightItem.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::HideNet, PCB_ACTIONS::hideNet.MakeEvent() );
Go( &PCB_INSPECTION_TOOL::ShowNet, PCB_ACTIONS::showNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::HideNet, PCB_ACTIONS::hideNet.MakeEvent() );
Go( &BOARD_INSPECTION_TOOL::ShowNet, PCB_ACTIONS::showNet.MakeEvent() );
}

View File

@ -21,8 +21,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __BOARD_STATISTICS_TOOL_H
#define __BOARD_STATISTICS_TOOL_H
#ifndef BOARD_INSPECTION_TOOL_H
#define BOARD_INSPECTION_TOOL_H
#include <dialogs/dialog_board_statistics.h>
#include <dialogs/dialog_net_inspector.h>
@ -51,14 +51,14 @@ protected:
/**
* PCB_INSPECTION_TOOL
* BOARD_INSPECTION_TOOL
*
* Tool for pcb inspection.
*/
class PCB_INSPECTION_TOOL : public wxEvtHandler, public PCB_TOOL_BASE
class BOARD_INSPECTION_TOOL : public wxEvtHandler, public PCB_TOOL_BASE
{
public:
PCB_INSPECTION_TOOL();
BOARD_INSPECTION_TOOL();
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;
@ -152,4 +152,4 @@ private:
std::unique_ptr<DIALOG_CONSTRAINTS_REPORTER> m_inspectConstraintsDialog;
};
#endif //__BOARD_STATISTICS_TOOL_H
#endif //BOARD_INSPECTION_TOOL_H

View File

@ -26,29 +26,29 @@
#include <tool/tool_manager.h>
#include <wx/filedlg.h>
#include <wx/wx.h>
#include <tools/pcb_reannotate_tool.h>
#include <tools/board_reannotate_tool.h>
PCB_REANNOTATE_TOOL::PCB_REANNOTATE_TOOL() :
BOARD_REANNOTATE_TOOL::BOARD_REANNOTATE_TOOL() :
PCB_TOOL_BASE( "pcbnew.ReannotateTool" ),
m_frame( nullptr )
{
}
bool PCB_REANNOTATE_TOOL::Init()
bool BOARD_REANNOTATE_TOOL::Init()
{
return true;
}
void PCB_REANNOTATE_TOOL::Reset( RESET_REASON aReason )
void BOARD_REANNOTATE_TOOL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<PCB_EDIT_FRAME>();
}
int PCB_REANNOTATE_TOOL::ShowReannotateDialog( const TOOL_EVENT& aEvent )
int BOARD_REANNOTATE_TOOL::ShowReannotateDialog( const TOOL_EVENT& aEvent )
{
DIALOG_BOARD_REANNOTATE dialog( m_frame );
dialog.ShowModal();
@ -56,7 +56,7 @@ int PCB_REANNOTATE_TOOL::ShowReannotateDialog( const TOOL_EVENT& aEvent )
}
void PCB_REANNOTATE_TOOL::setTransitions()
void BOARD_REANNOTATE_TOOL::setTransitions()
{
Go( &PCB_REANNOTATE_TOOL::ShowReannotateDialog, PCB_ACTIONS::boardReannotate.MakeEvent() );
Go( &BOARD_REANNOTATE_TOOL::ShowReannotateDialog, PCB_ACTIONS::boardReannotate.MakeEvent() );
}

View File

@ -32,10 +32,10 @@
#include <tools/pcb_tool_base.h>
class PCB_REANNOTATE_TOOL : public wxEvtHandler, public PCB_TOOL_BASE
class BOARD_REANNOTATE_TOOL : public wxEvtHandler, public PCB_TOOL_BASE
{
public:
PCB_REANNOTATE_TOOL();
BOARD_REANNOTATE_TOOL();
bool Init() override;
void Reset( RESET_REASON aReason ) override;

View File

@ -38,7 +38,7 @@
#include <tool/tool_manager.h>
#include <tools/edit_tool.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include "convert_tool.h"
@ -63,7 +63,7 @@ using P_S_C = PCB_SELECTION_CONDITIONS;
bool CONVERT_TOOL::Init()
{
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
m_frame = getEditFrame<PCB_BASE_FRAME>();
// Create a context menu and make it available through selection tool
@ -121,7 +121,7 @@ int CONVERT_TOOL::LinesToPoly( const TOOL_EVENT& aEvent )
FOOTPRINT* parentFootprint = nullptr;
auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
{
@ -362,7 +362,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromRects( const std::deque<EDA_ITEM*>& aI
int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
{
auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
{
@ -557,7 +557,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent )
{
auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
{

View File

@ -29,7 +29,7 @@
#include <tool/tool_interactive.h>
class CONDITIONAL_MENU;
class SELECTION_TOOL;
class PCB_SELECTION_TOOL;
class PCB_BASE_FRAME;
@ -89,9 +89,9 @@ private:
*/
static SHAPE_POLY_SET makePolysFromRects( const std::deque<EDA_ITEM*>& aItems );
SELECTION_TOOL* m_selectionTool;
CONDITIONAL_MENU* m_menu;
PCB_BASE_FRAME* m_frame;
PCB_SELECTION_TOOL* m_selectionTool;
CONDITIONAL_MENU* m_menu;
PCB_BASE_FRAME* m_frame;
};
#endif

View File

@ -31,7 +31,7 @@
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/grid_helper.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/tool_event_utils.h>
#include <tools/zone_create_helper.h>
#include <tools/drawing_tool.h>
@ -648,7 +648,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
const BOARD_DESIGN_SETTINGS& boardSettings = m_board->GetDesignSettings();
// Add a VIEW_GROUP that serves as a preview for the new item
PCBNEW_SELECTION preview;
PCB_SELECTION preview;
m_view->Add( &preview );
@ -1020,7 +1020,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
std::vector<BOARD_ITEM*> newItems; // all new items, including group
std::vector<BOARD_ITEM*> selectedItems; // the group, or newItems if no group
PCBNEW_SELECTION preview;
PCB_SELECTION preview;
BOARD_COMMIT commit( m_frame );
PCB_GROUP* group = nullptr;
@ -1262,7 +1262,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
KIGFX::PREVIEW::TWO_POINT_ASSISTANT twoPointAsst( twoPointManager, userUnits, geomShape );
// Add a VIEW_GROUP that serves as a preview for the new item
PCBNEW_SELECTION preview;
PCB_SELECTION preview;
m_view->Add( &preview );
m_view->Add( &twoPointAsst );
@ -1556,7 +1556,7 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool
KIGFX::PREVIEW::ARC_ASSISTANT arcAsst( arcManager, m_frame->GetUserUnits() );
// Add a VIEW_GROUP that serves as a preview for the new item
PCBNEW_SELECTION preview;
PCB_SELECTION preview;
m_view->Add( &preview );
m_view->Add( &arcAsst );
GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() );
@ -1776,8 +1776,8 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE** aZone )
if( aMode == ZONE_MODE::ADD || aMode == ZONE_MODE::GRAPHIC_POLYGON )
return true;
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
if( selection.Empty() )
{

View File

@ -38,9 +38,9 @@
#include <tool/selection_conditions.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/edit_tool.h>
#include <tools/pcbnew_picker_tool.h>
#include <tools/pcb_picker_tool.h>
#include <tools/tool_event_utils.h>
#include <tools/grid_helper.h>
#include <tools/pad_tool.h>
@ -99,7 +99,7 @@ SPECIAL_TOOLS_CONTEXT_MENU::SPECIAL_TOOLS_CONTEXT_MENU( TOOL_INTERACTIVE* aTool
bool EDIT_TOOL::Init()
{
// Find the selection tool, so they can cooperate
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
auto inFootprintEditor =
[ this ]( const SELECTION& aSelection )
@ -175,8 +175,8 @@ bool EDIT_TOOL::Init()
int EDIT_TOOL::GetAndPlace( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
FOOTPRINT* fp = getEditFrame<PCB_BASE_FRAME>()->GetFootprintFromBoardByReference();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
FOOTPRINT* fp = getEditFrame<PCB_BASE_FRAME>()->GetFootprintFromBoardByReference();
if( fp )
{
@ -242,8 +242,8 @@ int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent )
if( aEvent.IsAction( &PCB_ACTIONS::dragFreeAngle ) )
mode |= PNS::DM_FREE_ANGLE;
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -307,8 +307,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
// Be sure that there is at least one item that we can modify. If nothing was selected before,
// try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -331,7 +331,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
// Now filter out locked and grouped items. We cannot do this in the first RequestSelection()
// as we need the item_layers when a pad is the selection front.
selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -627,8 +627,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent )
{
const auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
const PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -700,8 +700,8 @@ int EDIT_TOOL::FilletTracks( const TOOL_EVENT& aEvent )
// Store last used fillet radius to allow pressing "enter" if repeat fillet is required
static long long filletRadiusIU = 0;
auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -900,9 +900,9 @@ int EDIT_TOOL::FilletTracks( const TOOL_EVENT& aEvent )
int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
const PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
const PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
} );
@ -954,8 +954,8 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
},
!m_dragging /* prompt user regarding locked items */ );
@ -1054,8 +1054,8 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
return 0;
}
auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
},
!m_dragging /* prompt user regarding locked items */ );
@ -1151,8 +1151,8 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
return 0;
}
auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -1240,7 +1240,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
Activate();
// get a copy instead of reference (as we're going to clear the selection before removing items)
PCBNEW_SELECTION selectionCopy;
PCB_SELECTION selectionCopy;
bool isCut = aEvent.Parameter<PCB_ACTIONS::REMOVE_FLAGS>() == PCB_ACTIONS::REMOVE_FLAGS::CUT;
bool isAlt = aEvent.Parameter<PCB_ACTIONS::REMOVE_FLAGS>() == PCB_ACTIONS::REMOVE_FLAGS::ALT;
@ -1254,7 +1254,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
else
{
selectionCopy = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
},
true /* prompt user regarding locked items */ );
@ -1435,8 +1435,8 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
return 0;
}
const auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
const PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -1544,11 +1544,11 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
// Be sure that there is at least one item that we can modify
const auto& selection =
m_isFootprintEditor ? m_selectionTool->RequestSelection(
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
} )
/*is board editor*/ : m_selectionTool->RequestSelection(
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
@ -1649,7 +1649,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
});
}
// Clear the selection flag here, otherwise the SELECTION_TOOL
// Clear the selection flag here, otherwise the PCB_SELECTION_TOOL
// will not properly select it later on
dupe_item->ClearSelected();
@ -1696,11 +1696,11 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
const auto& selection =
m_isFootprintEditor ? m_selectionTool->RequestSelection(
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
} )
/*is board editor*/ : m_selectionTool->RequestSelection(
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
@ -1732,7 +1732,8 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
}
void EDIT_TOOL::PadFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
void EDIT_TOOL::PadFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* sTool )
{
for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
{
@ -1745,7 +1746,7 @@ void EDIT_TOOL::PadFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELEC
void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
SELECTION_TOOL* sTool )
PCB_SELECTION_TOOL* sTool )
{
for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
{
@ -1757,7 +1758,7 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
}
bool EDIT_TOOL::updateModificationPoint( PCBNEW_SELECTION& aSelection )
bool EDIT_TOOL::updateModificationPoint( PCB_SELECTION& aSelection )
{
if( m_dragging && aSelection.HasReferencePoint() )
return false;
@ -1783,9 +1784,9 @@ bool EDIT_TOOL::updateModificationPoint( PCBNEW_SELECTION& aSelection )
bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage,
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint )
{
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
OPT<VECTOR2I> pickedPoint;
bool done = false;
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
OPT<VECTOR2I> pickedPoint;
bool done = false;
m_statusPopup->SetText( aTooltip );
@ -1867,8 +1868,8 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
frame()->PushTool( tool );
Activate();
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
},
aEvent.IsAction( &ACTIONS::cut ) /* prompt user regarding locked items */ );

View File

@ -29,7 +29,7 @@
#include <math/vector2d.h>
#include <tools/pcb_tool_base.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <status_popup.h>
@ -152,13 +152,14 @@ public:
* A selection filter which prunes the selection to contain only items of type PCB_MODULE_T
*/
static void FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
SELECTION_TOOL* sTool );
PCB_SELECTION_TOOL* sTool );
/**
* Function PadFilter()
* A selection filter which prunes the selection to contain only items of type PCB_PAD_T
*/
static void PadFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool );
static void PadFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* sTool );
BOARD_COMMIT* GetCurrentCommit() const { return m_commit.get(); }
@ -182,7 +183,7 @@ private:
///> Returns the right modification point (e.g. for rotation), depending on the number of
///> selected items.
bool updateModificationPoint( PCBNEW_SELECTION& aSelection );
bool updateModificationPoint( PCB_SELECTION& aSelection );
bool invokeInlineRouter( int aDragMode );
bool isInteractiveDragEnabled() const;
@ -194,7 +195,7 @@ private:
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint );
private:
SELECTION_TOOL* m_selectionTool;
PCB_SELECTION_TOOL* m_selectionTool;
std::unique_ptr<BOARD_COMMIT> m_commit;
bool m_dragging; // Indicates objects are currently being dragged
VECTOR2I m_cursor; // Last cursor position (so getModificationPoint()

View File

@ -50,7 +50,7 @@ void GLOBAL_EDIT_TOOL::Reset( RESET_REASON aReason )
bool GLOBAL_EDIT_TOOL::Init()
{
// Find the selection tool, so they can cooperate
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
return true;
}
@ -58,10 +58,10 @@ bool GLOBAL_EDIT_TOOL::Init()
int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
{
PCBNEW_SELECTION& selection = m_selectionTool->GetSelection();
FOOTPRINT* footprint = nullptr;
bool updateMode = false;
bool currentMode = false;
PCB_SELECTION& selection = m_selectionTool->GetSelection();
FOOTPRINT* footprint = nullptr;
bool updateMode = false;
bool currentMode = false;
if( aEvent.HasPosition() )
selection = m_selectionTool->RequestSelection( EDIT_TOOL::FootprintFilter );
@ -199,8 +199,8 @@ int GLOBAL_EDIT_TOOL::CleanupGraphics( const TOOL_EVENT& aEvent )
int GLOBAL_EDIT_TOOL::RemoveUnusedPads( const TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
sTool->FilterCollectorForGroups( aCollector );
} );

View File

@ -26,7 +26,7 @@
#include <math/vector2d.h>
#include <tools/pcb_tool_base.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <status_popup.h>
@ -70,7 +70,7 @@ private:
void setTransitions() override;
private:
SELECTION_TOOL* m_selectionTool;
PCB_SELECTION_TOOL* m_selectionTool;
std::unique_ptr<BOARD_COMMIT> m_commit;
};

View File

@ -23,9 +23,9 @@
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/group_tool.h>
#include <tools/pcbnew_picker_tool.h>
#include <tools/pcb_picker_tool.h>
#include <status_popup.h>
#include <board_commit.h>
#include <bitmaps.h>
@ -188,8 +188,8 @@ public:
private:
void update() override
{
SELECTION_TOOL* selTool = getToolManager()->GetTool<SELECTION_TOOL>();
BOARD* board = selTool->GetBoard();
PCB_SELECTION_TOOL* selTool = getToolManager()->GetTool<PCB_SELECTION_TOOL>();
BOARD* board = selTool->GetBoard();
const auto& selection = selTool->GetSelection();
@ -229,7 +229,7 @@ bool GROUP_TOOL::Init()
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
// Find the selection tool, so they can cooperate
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
auto groupMenu = std::make_shared<GROUP_CONTEXT_MENU>();
groupMenu->SetTool( this );
@ -267,10 +267,10 @@ int GROUP_TOOL::GroupProperties( const TOOL_EVENT& aEvent )
int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
{
std::string tool = "pcbnew.EditGroups.selectNewMember";
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
STATUS_TEXT_POPUP statusPopup( frame() );
bool done = false;
std::string tool = "pcbnew.EditGroups.selectNewMember";
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
STATUS_TEXT_POPUP statusPopup( frame() );
bool done = false;
if( m_propertiesDialog )
m_propertiesDialog->Show( false );
@ -284,8 +284,9 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
const PCBNEW_SELECTION& sel = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
const PCB_SELECTION& sel = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* sTool )
{
} );
@ -344,10 +345,10 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
int GROUP_TOOL::Group( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
BOARD* board = getModel<BOARD>();
PCB_GROUP* group = nullptr;
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
BOARD* board = getModel<BOARD>();
PCB_GROUP* group = nullptr;
if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
@ -394,14 +395,14 @@ int GROUP_TOOL::Group( const TOOL_EVENT& aEvent )
int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
{
const PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
BOARD* board = getModel<BOARD>();
std::vector<BOARD_ITEM*> members;
if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
PCBNEW_SELECTION selCopy = selection;
PCB_SELECTION selCopy = selection;
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
for( EDA_ITEM* item : selCopy )
@ -452,9 +453,9 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
int GROUP_TOOL::RemoveFromGroup( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
BOARD_COMMIT commit( m_frame );
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
BOARD_COMMIT commit( m_frame );
if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
@ -489,8 +490,8 @@ int GROUP_TOOL::RemoveFromGroup( const TOOL_EVENT& aEvent )
int GROUP_TOOL::EnterGroup( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const PCBNEW_SELECTION& selection = selTool->GetSelection();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
if( selection.GetSize() == 1 && selection[0]->Type() == PCB_GROUP_T )
selTool->EnterGroup();
@ -501,7 +502,7 @@ int GROUP_TOOL::EnterGroup( const TOOL_EVENT& aEvent )
int GROUP_TOOL::LeaveGroup( const TOOL_EVENT& aEvent )
{
m_toolMgr->GetTool<SELECTION_TOOL>()->ExitGroup( true /* Select the group */ );
m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->ExitGroup( true /* Select the group */ );
return 0;
}

View File

@ -26,12 +26,12 @@
#include <math/vector2d.h>
#include <tools/pcb_tool_base.h>
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include "dialogs/dialog_group_properties_base.h"
class BOARD_COMMIT;
class BOARD_ITEM;
class SELECTION_TOOL;
class PCB_SELECTION_TOOL;
class DIALOG_GROUP_PROPERTIES;
class GROUP_TOOL : public PCB_TOOL_BASE
@ -75,7 +75,7 @@ private:
private:
PCB_BASE_EDIT_FRAME* m_frame;
DIALOG_GROUP_PROPERTIES* m_propertiesDialog;
SELECTION_TOOL* m_selectionTool;
PCB_SELECTION_TOOL* m_selectionTool;
std::unique_ptr<BOARD_COMMIT> m_commit;
};

View File

@ -34,7 +34,7 @@
#include <board_commit.h>
#include <dialogs/dialog_push_pad_properties.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_selection_conditions.h>
#include <tools/edit_tool.h>
#include <dialogs/dialog_enum_pads.h>
@ -65,7 +65,7 @@ void PAD_TOOL::Reset( RESET_REASON aReason )
bool PAD_TOOL::Init()
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
if( selTool )
{
@ -107,9 +107,9 @@ bool PAD_TOOL::Init()
int PAD_TOOL::pastePadProperties( const TOOL_EVENT& aEvent )
{
auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
const auto& selection = selTool.GetSelection();
const PAD& masterPad = frame()->GetDesignSettings().m_Pad_Master;
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
const PAD& masterPad = frame()->GetDesignSettings().m_Pad_Master;
BOARD_COMMIT commit( frame() );
@ -134,10 +134,9 @@ int PAD_TOOL::pastePadProperties( const TOOL_EVENT& aEvent )
int PAD_TOOL::copyPadSettings( const TOOL_EVENT& aEvent )
{
auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
const auto& selection = selTool.GetSelection();
PAD& masterPad = frame()->GetDesignSettings().m_Pad_Master;
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
PAD& masterPad = frame()->GetDesignSettings().m_Pad_Master;
// can only copy from a single pad
if( selection.Size() == 1 )
@ -209,9 +208,9 @@ static void doPushPadProperties( BOARD& board, const PAD& aSrcPad, BOARD_COMMIT&
int PAD_TOOL::pushPadSettings( const TOOL_EVENT& aEvent )
{
auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
const auto& selection = selTool.GetSelection();
PAD* srcPad;
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
const PCB_SELECTION& selection = selTool->GetSelection();
PAD* srcPad;
if( selection.Size() == 1 && selection[0]->Type() == PCB_PAD_T )
srcPad = static_cast<PAD*>( selection[0] );
@ -510,7 +509,7 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent )
{
PCB_DISPLAY_OPTIONS opts = frame()->GetDisplayOptions();
WX_INFOBAR* infoBar = frame()->GetInfoBar();
PCBNEW_SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
wxString msg;
if( m_editPad != niluuid )

View File

@ -530,7 +530,7 @@ TOOL_ACTION PCB_ACTIONS::defaultPadProperties( "pcbnew.PadTool.defaultPadPropert
options_pad_xpm );
// PCB_EDITOR_CONTROL
// BOARD_EDITOR_CONTROL
//
TOOL_ACTION PCB_ACTIONS::boardSetup( "pcbnew.EditorControl.boardSetup",
AS_GLOBAL, 0, "",
@ -722,7 +722,7 @@ TOOL_ACTION PCB_ACTIONS::showEeschema( "pcbnew.EditorControl.showEeschema",
eeschema_xpm );
// PCBNEW_CONTROL
// PCB_CONTROL
//
TOOL_ACTION PCB_ACTIONS::localRatsnestTool( "pcbnew.Control.localRatsnestTool",
@ -1139,7 +1139,7 @@ TOOL_ACTION PCB_ACTIONS::selectpositionRelativeItem( "pcbnew.PositionRelative.se
AS_GLOBAL );
// SELECTION_TOOL
// PCB_SELECTION_TOOL
//
TOOL_ACTION PCB_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
AS_GLOBAL, 0, "", "", "", nullptr, AF_ACTIVATE ); // No description, not shown anywhere

View File

@ -25,9 +25,9 @@
#include "edit_tool.h"
#include "pcb_actions.h"
#include "pcbnew_control.h"
#include "pcbnew_picker_tool.h"
#include "selection_tool.h"
#include "pcb_control.h"
#include "pcb_picker_tool.h"
#include "pcb_selection_tool.h"
#include <3d_viewer/eda_3d_viewer.h>
#include <bitmaps.h>
#include <board_commit.h>
@ -61,7 +61,7 @@ extern bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileN
extern IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl );
PCBNEW_CONTROL::PCBNEW_CONTROL() :
PCB_CONTROL::PCB_CONTROL() :
PCB_TOOL_BASE( "pcbnew.Control" ),
m_frame( nullptr ),
m_pickerItem( nullptr )
@ -70,12 +70,12 @@ PCBNEW_CONTROL::PCBNEW_CONTROL() :
}
PCBNEW_CONTROL::~PCBNEW_CONTROL()
PCB_CONTROL::~PCB_CONTROL()
{
}
void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
void PCB_CONTROL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<PCB_BASE_FRAME>();
@ -89,7 +89,7 @@ void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
}
int PCBNEW_CONTROL::AddLibrary( const TOOL_EVENT& aEvent )
int PCB_CONTROL::AddLibrary( const TOOL_EVENT& aEvent )
{
if( m_frame->IsType( FRAME_FOOTPRINT_EDITOR ) || m_frame->IsType( FRAME_PCB_EDITOR ) )
{
@ -103,7 +103,7 @@ int PCBNEW_CONTROL::AddLibrary( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::Quit( const TOOL_EVENT& aEvent )
int PCB_CONTROL::Quit( const TOOL_EVENT& aEvent )
{
m_frame->Close( false );
return 0;
@ -116,7 +116,7 @@ template<class T> void Flip( T& aValue )
}
int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
int PCB_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -135,7 +135,7 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
int PCB_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -161,7 +161,7 @@ int PCBNEW_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
int PCB_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -180,7 +180,7 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
int PCB_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -210,7 +210,7 @@ int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
int PCB_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -225,7 +225,7 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::HighContrastModeCycle( const TOOL_EVENT& aEvent )
int PCB_CONTROL::HighContrastModeCycle( const TOOL_EVENT& aEvent )
{
auto opts = displayOptions();
@ -251,7 +251,7 @@ int PCBNEW_CONTROL::HighContrastModeCycle( const TOOL_EVENT& aEvent )
// Layer control
int PCBNEW_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent )
{
m_frame->SwitchLayer( NULL, aEvent.Parameter<PCB_LAYER_ID>() );
@ -259,11 +259,11 @@ int PCBNEW_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
{
PCB_BASE_FRAME* editFrame = m_frame;
PCB_BASE_FRAME* editFrame = m_frame;
BOARD* brd = board();
LAYER_NUM layer = editFrame->GetActiveLayer();
LAYER_NUM layer = editFrame->GetActiveLayer();
LAYER_NUM startLayer = layer;
if( layer < F_Cu || layer > B_Cu )
@ -285,11 +285,11 @@ int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
{
PCB_BASE_FRAME* editFrame = m_frame;
PCB_BASE_FRAME* editFrame = m_frame;
BOARD* brd = board();
LAYER_NUM layer = editFrame->GetActiveLayer();
LAYER_NUM layer = editFrame->GetActiveLayer();
LAYER_NUM startLayer = layer;
if( layer < F_Cu || layer > B_Cu )
@ -313,7 +313,7 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
{
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
PCB_SCREEN* screen = m_frame->GetScreen();
@ -333,7 +333,7 @@ int PCBNEW_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
#define ALPHA_MAX 1.00
#define ALPHA_STEP 0.05
int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
{
auto settings = m_frame->GetColorSettings();
@ -359,7 +359,7 @@ int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
int PCB_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
{
auto settings = m_frame->GetColorSettings();
@ -386,8 +386,8 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
// Grid control
void PCBNEW_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
EDA_ITEM* originViewItem, const VECTOR2D& aPoint )
void PCB_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
EDA_ITEM* originViewItem, const VECTOR2D& aPoint )
{
aFrame->GetDesignSettings().m_GridOrigin = (wxPoint) aPoint;
aView->GetGAL()->SetGridOrigin( aPoint );
@ -397,7 +397,7 @@ void PCBNEW_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame
}
int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
int PCB_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
{
VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
@ -412,8 +412,8 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
if( m_isFootprintEditor && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
return 0;
std::string tool = aEvent.GetCommandStr().get();
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
std::string tool = aEvent.GetCommandStr().get();
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
// Deactivate other tools; particularly important if another PICKER is currently running
Activate();
@ -433,7 +433,7 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
int PCB_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
{
m_frame->SaveCopyInUndoList( m_gridOrigin.get(), UNDO_REDO::GRIDORIGIN );
DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), VECTOR2D( 0, 0 ) );
@ -444,13 +444,13 @@ int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
#define HITTEST_THRESHOLD_PIXELS 5
int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
int PCB_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
{
if( m_isFootprintEditor && !m_frame->GetBoard()->GetFirstFootprint() )
return 0;
std::string tool = aEvent.GetCommandStr().get();
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
std::string tool = aEvent.GetCommandStr().get();
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
m_pickerItem = nullptr;
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
@ -474,7 +474,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
return true;
}
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
selectionTool->UnbrightenItem( m_pickerItem );
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
m_toolMgr->RunAction( ACTIONS::doDelete, true );
@ -487,10 +487,10 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
picker->SetMotionHandler(
[this] ( const VECTOR2D& aPos )
{
BOARD* board = m_frame->GetBoard();
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
BOARD* board = m_frame->GetBoard();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide();
GENERAL_COLLECTOR collector;
GENERAL_COLLECTOR collector;
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
if( m_isFootprintEditor )
@ -527,7 +527,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
[this] ( const int& aFinalState )
{
if( m_pickerItem )
m_toolMgr->GetTool<SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
// Wake the selection tool after exiting to ensure the cursor gets updated
m_toolMgr->RunAction( PCB_ACTIONS::selectionActivate, false );
@ -596,7 +596,7 @@ static void pasteFootprintItemsToFootprintEditor( FOOTPRINT* aClipFootprint, BOA
}
int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
int PCB_CONTROL::Paste( const TOOL_EVENT& aEvent )
{
CLIPBOARD_IO pi;
BOARD_ITEM* clipItem = pi.Parse();
@ -716,7 +716,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent )
int PCB_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent )
{
int open_ctl;
wxString fileName;
@ -737,7 +737,7 @@ int PCBNEW_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent )
}
// Helper function for PCBNEW_CONTROL::placeBoardItems()
// Helper function for PCB_CONTROL::placeBoardItems()
template<typename T>
static void moveUnflaggedItems( std::deque<T>& aList, std::vector<BOARD_ITEM*>& aTarget,
bool aIsNew )
@ -796,7 +796,7 @@ static void moveUnflaggedItems( ZONES& aList, std::vector<BOARD_ITEM*>& aTarget,
int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard, bool aAnchorAtOrigin )
int PCB_CONTROL::placeBoardItems( BOARD* aBoard, bool aAnchorAtOrigin )
{
// items are new if the current board is not the board source
bool isNew = board() != aBoard;
@ -808,8 +808,8 @@ int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard, bool aAnchorAtOrigin )
moveUnflaggedItems( aBoard->Zones(), items, isNew );
// Subtlety: When selecting a group via the mouse,
// SELECTION_TOOL::highlightInternal runs, which does a SetSelected() on all
// descendants. In PCBNEW_CONTROL::placeBoardItems, below, we skip that and
// PCB_SELECTION_TOOL::highlightInternal runs, which does a SetSelected() on all
// descendants. In PCB_CONTROL::placeBoardItems, below, we skip that and
// mark items non-recursively. That works because the saving of the
// selection created aBoard that has the group and all descendents in it.
moveUnflaggedItems( aBoard->Groups(), items, isNew );
@ -818,15 +818,14 @@ int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard, bool aAnchorAtOrigin )
}
int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
bool aAnchorAtOrigin )
int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
bool aAnchorAtOrigin )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
PCBNEW_SELECTION& selection = selectionTool->GetSelection();
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
PCB_SELECTION& selection = selectionTool->GetSelection();
for( BOARD_ITEM* item : aItems )
{
@ -873,7 +872,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsN
else
editTool->GetCurrentCommit()->Added( item );
// Matching the logic of SELECTION_TOOL::select for PCB_GROUP_T, there
// Matching the logic of PCB_SELECTION_TOOL::select for PCB_GROUP_T, there
// is a distinction between which items are SetSelected and which are in
// the selection object. Top-level groups or items not in groups are
// added to the selection object (via selection.Add(), below), but all
@ -909,7 +908,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsN
}
int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
int PCB_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
{
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
@ -999,7 +998,7 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
}
int PCBNEW_CONTROL::Undo( const TOOL_EVENT& aEvent )
int PCB_CONTROL::Undo( const TOOL_EVENT& aEvent )
{
PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
wxCommandEvent dummy;
@ -1011,7 +1010,7 @@ int PCBNEW_CONTROL::Undo( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::Redo( const TOOL_EVENT& aEvent )
int PCB_CONTROL::Redo( const TOOL_EVENT& aEvent )
{
PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
wxCommandEvent dummy;
@ -1023,10 +1022,10 @@ int PCBNEW_CONTROL::Redo( const TOOL_EVENT& aEvent )
}
int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCBNEW_SELECTION& selection = selTool->GetSelection();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
PCB_SELECTION& selection = selTool->GetSelection();
if( selection.GetSize() == 1 )
{
@ -1089,81 +1088,81 @@ int PCBNEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
}
void PCBNEW_CONTROL::setTransitions()
void PCB_CONTROL::setTransitions()
{
Go( &PCBNEW_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() );
Go( &PCBNEW_CONTROL::AddLibrary, ACTIONS::addLibrary.MakeEvent() );
Go( &PCBNEW_CONTROL::Print, ACTIONS::print.MakeEvent() );
Go( &PCBNEW_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
Go( &PCB_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() );
Go( &PCB_CONTROL::AddLibrary, ACTIONS::addLibrary.MakeEvent() );
Go( &PCB_CONTROL::Print, ACTIONS::print.MakeEvent() );
Go( &PCB_CONTROL::Quit, ACTIONS::quit.MakeEvent() );
// Display modes
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayToggle.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastModeCycle, ACTIONS::highContrastModeCycle.MakeEvent() );
Go( &PCB_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCB_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
Go( &PCB_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCB_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayToggle.MakeEvent() );
Go( &PCB_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() );
Go( &PCB_CONTROL::HighContrastModeCycle, ACTIONS::highContrastModeCycle.MakeEvent() );
// Layer control
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner1.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner2.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner3.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner4.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner5.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner6.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner7.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner8.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner9.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner10.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner11.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner12.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner13.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner14.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner15.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner16.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner17.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner18.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner19.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner20.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner21.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner22.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner23.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner24.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner25.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner26.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner27.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner28.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner29.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner30.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerBottom.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerNext, PCB_ACTIONS::layerNext.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerPrev, PCB_ACTIONS::layerPrev.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerToggle, PCB_ACTIONS::layerToggle.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaInc, PCB_ACTIONS::layerAlphaInc.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner1.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner2.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner3.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner4.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner5.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner6.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner7.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner8.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner9.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner10.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner11.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner12.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner13.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner14.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner15.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner16.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner17.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner18.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner19.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner20.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner21.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner22.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner23.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner24.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner25.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner26.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner27.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner28.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner29.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner30.MakeEvent() );
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerBottom.MakeEvent() );
Go( &PCB_CONTROL::LayerNext, PCB_ACTIONS::layerNext.MakeEvent() );
Go( &PCB_CONTROL::LayerPrev, PCB_ACTIONS::layerPrev.MakeEvent() );
Go( &PCB_CONTROL::LayerToggle, PCB_ACTIONS::layerToggle.MakeEvent() );
Go( &PCB_CONTROL::LayerAlphaInc, PCB_ACTIONS::layerAlphaInc.MakeEvent() );
Go( &PCB_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
// Grid control
Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
Go( &PCB_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
Go( &PCB_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
Go( &PCB_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &PCB_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
// Miscellaneous
Go( &PCBNEW_CONTROL::DeleteItemCursor, ACTIONS::deleteTool.MakeEvent() );
Go( &PCB_CONTROL::DeleteItemCursor, ACTIONS::deleteTool.MakeEvent() );
// Append control
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
Go( &PCB_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
Go( &PCBNEW_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
Go( &PCB_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::SelectedEvent );
Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::UnselectedEvent );
Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::ClearedEvent );
Go( &PCBNEW_CONTROL::UpdateMessagePanel, EVENTS::SelectedItemsModified );
Go( &PCB_CONTROL::UpdateMessagePanel, EVENTS::SelectedEvent );
Go( &PCB_CONTROL::UpdateMessagePanel, EVENTS::UnselectedEvent );
Go( &PCB_CONTROL::UpdateMessagePanel, EVENTS::ClearedEvent );
Go( &PCB_CONTROL::UpdateMessagePanel, EVENTS::SelectedItemsModified );
}

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCBNEW_CONTROL_H
#define PCBNEW_CONTROL_H
#ifndef PCB_CONTROL_H
#define PCB_CONTROL_H
#include <io_mgr.h>
#include <memory>
@ -36,16 +36,16 @@ namespace KIGFX {
class PCB_BASE_FRAME;
class BOARD_ITEM;
/**
* PCBNEW_CONTROL
* PCB_CONTROL
*
* Handles actions that are shared between different frames in pcbnew.
*/
class PCBNEW_CONTROL : public PCB_TOOL_BASE
class PCB_CONTROL : public PCB_TOOL_BASE
{
public:
PCBNEW_CONTROL();
~PCBNEW_CONTROL();
PCB_CONTROL();
~PCB_CONTROL();
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;

View File

@ -23,22 +23,22 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "pcbnew_picker_tool.h"
#include "pcb_picker_tool.h"
#include "pcb_actions.h"
#include "grid_helper.h"
#include <view/view_controls.h>
#include <tool/tool_manager.h>
#include "selection_tool.h"
#include "pcb_selection_tool.h"
PCBNEW_PICKER_TOOL::PCBNEW_PICKER_TOOL()
PCB_PICKER_TOOL::PCB_PICKER_TOOL()
: PCB_TOOL_BASE( "pcbnew.InteractivePicker" )
{
reset();
}
int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
int PCB_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW_CONTROLS* controls = getViewControls();
PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
@ -142,7 +142,7 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_RIGHT ) )
{
PCBNEW_SELECTION dummy;
PCB_SELECTION dummy;
m_menu.ShowContextMenu( dummy );
}
@ -171,13 +171,13 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
}
void PCBNEW_PICKER_TOOL::setTransitions()
void PCB_PICKER_TOOL::setTransitions()
{
Go( &PCBNEW_PICKER_TOOL::Main, ACTIONS::pickerTool.MakeEvent() );
Go( &PCB_PICKER_TOOL::Main, ACTIONS::pickerTool.MakeEvent() );
}
void PCBNEW_PICKER_TOOL::reset()
void PCB_PICKER_TOOL::reset()
{
m_layerMask = LSET::AllLayersMask();
m_cursor = KICURSOR::ARROW;
@ -190,7 +190,7 @@ void PCBNEW_PICKER_TOOL::reset()
}
void PCBNEW_PICKER_TOOL::setControls()
void PCB_PICKER_TOOL::setControls()
{
KIGFX::VIEW_CONTROLS* controls = getViewControls();

View File

@ -22,20 +22,20 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PICKER_TOOL_H
#define PICKER_TOOL_H
#ifndef PCB_PICKER_TOOL_H
#define PCB_PICKER_TOOL_H
#include <boost/optional/optional.hpp>
#include <tools/pcb_tool_base.h>
/**
* @brief Generic tool for picking a point.
* @brief Generic tool for picking an item.
*/
class PCBNEW_PICKER_TOOL : public PCB_TOOL_BASE
class PCB_PICKER_TOOL : public PCB_TOOL_BASE
{
public:
PCBNEW_PICKER_TOOL();
~PCBNEW_PICKER_TOOL() override { }
PCB_PICKER_TOOL();
~PCB_PICKER_TOOL() override { }
///> Event handler types.
typedef std::function<bool(const VECTOR2D&)> CLICK_HANDLER;
@ -130,4 +130,4 @@ private:
OPT<VECTOR2D> m_picked;
};
#endif /* PICKER_TOOL_H */
#endif /* PCB_PICKER_TOOL_H */

View File

@ -37,22 +37,20 @@ using namespace std::placeholders;
#include <class_draw_panel_gal.h>
#include <view/view_controls.h>
#include <view/view_group.h>
#include <preview_items/selection_area.h>
#include <painter.h>
#include <bitmaps.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <tools/pcbnew_selection.h>
#include <tools/pcb_selection.h>
#include <connectivity/connectivity_data.h>
#include "selection_tool.h"
#include "pcb_bright_box.h"
#include "pcb_selection_tool.h"
#include "pcb_actions.h"
#include "plugins/kicad/kicad_plugin.h"
EDA_ITEM* PCBNEW_SELECTION::GetTopLeftItem( bool aFootprintsOnly ) const
EDA_ITEM* PCB_SELECTION::GetTopLeftItem( bool aFootprintsOnly ) const
{
EDA_ITEM* topLeftItem = nullptr;
@ -86,7 +84,7 @@ EDA_ITEM* PCBNEW_SELECTION::GetTopLeftItem( bool aFootprintsOnly ) const
}
const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const
const KIGFX::VIEW_GROUP::ITEMS PCB_SELECTION::updateDrawList() const
{
std::vector<VIEW_ITEM*> items;
@ -143,7 +141,7 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const
}
const LSET PCBNEW_SELECTION::GetSelectionLayers()
const LSET PCB_SELECTION::GetSelectionLayers()
{
LSET retval;

View File

@ -21,14 +21,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCBNEW_SELECTION_H
#define PCBNEW_SELECTION_H
#ifndef PCB_SELECTION_H
#define PCB_SELECTION_H
#include <layers_id_colors_and_visibility.h>
#include <tool/selection.h>
class PCBNEW_SELECTION : public SELECTION
class PCB_SELECTION : public SELECTION
{
public:
EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override;
@ -38,4 +38,4 @@ public:
const LSET GetSelectionLayers();
};
#endif // PCBNEW_SELECTION_H
#endif // PCB_SELECTION_H

View File

@ -23,7 +23,7 @@
*/
#include "pcb_selection_conditions.h"
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include <board_connected_item.h>
#include <pcb_shape.h>

View File

@ -37,7 +37,6 @@ using namespace std::placeholders;
#include <pcb_marker.h>
#include <zone.h>
#include <collectors.h>
#include <confirm.h>
#include <dialog_find.h>
#include <dialog_filter_selection.h>
#include <dialog_locked_items_query.h>
@ -53,7 +52,7 @@ using namespace std::placeholders;
#include <footprint_viewer_frame.h>
#include <id.h>
#include "tool_event_utils.h"
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include "pcb_bright_box.h"
#include "pcb_actions.h"
@ -89,14 +88,14 @@ private:
/**
* Private implementation of firewalled private data
*/
class SELECTION_TOOL::PRIV
class PCB_SELECTION_TOOL::PRIV
{
public:
DIALOG_FILTER_SELECTION::OPTIONS m_filterOpts;
};
SELECTION_TOOL::SELECTION_TOOL() :
PCB_SELECTION_TOOL::PCB_SELECTION_TOOL() :
PCB_TOOL_BASE( "pcbnew.InteractiveSelection" ),
m_frame( NULL ),
m_additive( false ),
@ -121,14 +120,14 @@ SELECTION_TOOL::SELECTION_TOOL() :
}
SELECTION_TOOL::~SELECTION_TOOL()
PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL()
{
getView()->Remove( &m_selection );
getView()->Remove( &m_enteredGroupOverlay );
}
bool SELECTION_TOOL::Init()
bool PCB_SELECTION_TOOL::Init()
{
auto frame = getEditFrame<PCB_BASE_FRAME>();
@ -172,7 +171,7 @@ bool SELECTION_TOOL::Init()
}
void SELECTION_TOOL::Reset( RESET_REASON aReason )
void PCB_SELECTION_TOOL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<PCB_BASE_FRAME>();
@ -204,7 +203,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
}
int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
// Main loop: keep receiving events
while( TOOL_EVENT* evt = Wait() )
@ -419,7 +418,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::EnterGroup()
void PCB_SELECTION_TOOL::EnterGroup()
{
wxCHECK_RET( m_selection.GetSize() == 1 && m_selection[0]->Type() == PCB_GROUP_T,
"EnterGroup called when selection is not a single group" );
@ -439,7 +438,7 @@ void SELECTION_TOOL::EnterGroup()
}
void SELECTION_TOOL::ExitGroup( bool aSelectGroup )
void PCB_SELECTION_TOOL::ExitGroup( bool aSelectGroup )
{
// Only continue if there is a group entered
if( m_enteredGroup == nullptr )
@ -455,14 +454,14 @@ void SELECTION_TOOL::ExitGroup( bool aSelectGroup )
}
PCBNEW_SELECTION& SELECTION_TOOL::GetSelection()
PCB_SELECTION& PCB_SELECTION_TOOL::GetSelection()
{
return m_selection;
}
PCBNEW_SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
bool aConfirmLockedItems )
PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
bool aConfirmLockedItems )
{
bool selectionEmpty = m_selection.Empty();
m_selection.SetIsHover( selectionEmpty );
@ -571,7 +570,7 @@ PCBNEW_SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCli
}
const GENERAL_COLLECTORS_GUIDE SELECTION_TOOL::getCollectorsGuide() const
const GENERAL_COLLECTORS_GUIDE PCB_SELECTION_TOOL::getCollectorsGuide() const
{
GENERAL_COLLECTORS_GUIDE guide( board()->GetVisibleLayers(),
(PCB_LAYER_ID) view()->GetTopLayer(), view() );
@ -598,9 +597,9 @@ const GENERAL_COLLECTORS_GUIDE SELECTION_TOOL::getCollectorsGuide() const
}
bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
bool* aSelectionCancelledFlag,
CLIENT_SELECTION_FILTER aClientFilter )
bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
bool* aSelectionCancelledFlag,
CLIENT_SELECTION_FILTER aClientFilter )
{
GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide();
GENERAL_COLLECTOR collector;
@ -700,7 +699,7 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
}
bool SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aClientFilter )
bool PCB_SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aClientFilter )
{
if( aForceSelect || m_selection.Empty() )
{
@ -712,7 +711,7 @@ bool SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aC
}
bool SELECTION_TOOL::selectMultiple()
bool PCB_SELECTION_TOOL::selectMultiple()
{
bool cancelled = false; // Was the tool cancelled while it was running?
m_multiple = true; // Multiple selection mode is active
@ -845,7 +844,7 @@ bool SELECTION_TOOL::selectMultiple()
}
int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
{
CLIENT_SELECTION_FILTER aClientFilter = aEvent.Parameter<CLIENT_SELECTION_FILTER>();
@ -855,7 +854,7 @@ int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
{
ClearSelection();
@ -863,7 +862,7 @@ int SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent )
{
std::vector<BOARD_ITEM*>* items = aEvent.Parameter<std::vector<BOARD_ITEM*>*>();
@ -880,14 +879,14 @@ int SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
{
AddItemToSel( aEvent.Parameter<BOARD_ITEM*>() );
return 0;
}
int SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
{
KIGFX::VIEW* view = getView();
@ -916,7 +915,7 @@ int SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::AddItemToSel( BOARD_ITEM* aItem, bool aQuietMode )
void PCB_SELECTION_TOOL::AddItemToSel( BOARD_ITEM* aItem, bool aQuietMode )
{
if( aItem )
{
@ -929,7 +928,7 @@ void SELECTION_TOOL::AddItemToSel( BOARD_ITEM* aItem, bool aQuietMode )
}
int SELECTION_TOOL::UnselectItems( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::UnselectItems( const TOOL_EVENT& aEvent )
{
std::vector<BOARD_ITEM*>* items = aEvent.Parameter<std::vector<BOARD_ITEM*>*>();
@ -946,14 +945,14 @@ int SELECTION_TOOL::UnselectItems( const TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
{
RemoveItemFromSel( aEvent.Parameter<BOARD_ITEM*>() );
return 0;
}
void SELECTION_TOOL::RemoveItemFromSel( BOARD_ITEM* aItem, bool aQuietMode )
void PCB_SELECTION_TOOL::RemoveItemFromSel( BOARD_ITEM* aItem, bool aQuietMode )
{
if( aItem )
{
@ -965,19 +964,20 @@ void SELECTION_TOOL::RemoveItemFromSel( BOARD_ITEM* aItem, bool aQuietMode )
}
void SELECTION_TOOL::BrightenItem( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::BrightenItem( BOARD_ITEM* aItem )
{
highlight( aItem, BRIGHTENED );
}
void SELECTION_TOOL::UnbrightenItem( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::UnbrightenItem( BOARD_ITEM* aItem )
{
unhighlight( aItem, BRIGHTENED );
}
void connectedItemFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
void connectedItemFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* sTool )
{
// Narrow the collection down to a single BOARD_CONNECTED_ITEM for each represented net.
// All other items types are removed.
@ -996,7 +996,7 @@ void connectedItemFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, SELECT
}
int SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
{
unsigned initialCount = 0;
@ -1038,8 +1038,8 @@ int SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
STOP_CONDITION aStopCondition )
void PCB_SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
STOP_CONDITION aStopCondition )
{
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
@ -1156,7 +1156,7 @@ void SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
}
void SELECTION_TOOL::selectAllItemsOnNet( int aNetCode, bool aSelect )
void PCB_SELECTION_TOOL::selectAllItemsOnNet( int aNetCode, bool aSelect )
{
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, EOT };
auto connectivity = board()->GetConnectivity();
@ -1167,7 +1167,7 @@ void SELECTION_TOOL::selectAllItemsOnNet( int aNetCode, bool aSelect )
}
int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
{
bool select = aEvent.IsAction( &PCB_ACTIONS::selectNet );
@ -1202,7 +1202,7 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
{
std::list<FOOTPRINT*> footprintList;
@ -1295,7 +1295,7 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
}
void SELECTION_TOOL::zoomFitSelection()
void PCB_SELECTION_TOOL::zoomFitSelection()
{
//Should recalculate the view to zoom in on the selection
auto selectionBox = m_selection.GetBoundingBox();
@ -1319,7 +1319,7 @@ void SELECTION_TOOL::zoomFitSelection()
}
int SELECTION_TOOL::selectSheetContents( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::selectSheetContents( const TOOL_EVENT& aEvent )
{
ClearSelection( true /*quiet mode*/ );
wxString sheetPath = *aEvent.Parameter<wxString*>();
@ -1335,7 +1335,7 @@ int SELECTION_TOOL::selectSheetContents( const TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
{
if( !selectCursor( true ) )
return 0;
@ -1373,7 +1373,7 @@ int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
{
bool cleared = false;
@ -1402,10 +1402,10 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
}
int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
{
DIALOG_FIND dlg( m_frame );
dlg.SetCallback( std::bind( &SELECTION_TOOL::findCallback, this, _1 ) );
dlg.SetCallback( std::bind( &PCB_SELECTION_TOOL::findCallback, this, _1 ) );
dlg.ShowModal();
return 0;
@ -1480,7 +1480,7 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
}
int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
{
const BOARD& board = *getModel<BOARD>();
DIALOG_FILTER_SELECTION::OPTIONS& opts = m_priv->m_filterOpts;
@ -1512,7 +1512,7 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::FilterCollectedItems( GENERAL_COLLECTOR& aCollector )
void PCB_SELECTION_TOOL::FilterCollectedItems( GENERAL_COLLECTOR& aCollector )
{
if( aCollector.GetCount() == 0 )
return;
@ -1532,7 +1532,7 @@ void SELECTION_TOOL::FilterCollectedItems( GENERAL_COLLECTOR& aCollector )
}
bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
{
if( aItem->IsLocked() && !m_filter.lockedItems )
return false;
@ -1608,7 +1608,7 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
}
void SELECTION_TOOL::ClearSelection( bool aQuietMode )
void PCB_SELECTION_TOOL::ClearSelection( bool aQuietMode )
{
if( m_selection.Empty() )
return;
@ -1630,7 +1630,7 @@ void SELECTION_TOOL::ClearSelection( bool aQuietMode )
}
void SELECTION_TOOL::RebuildSelection()
void PCB_SELECTION_TOOL::RebuildSelection()
{
m_selection.Clear();
@ -1668,7 +1668,7 @@ void SELECTION_TOOL::RebuildSelection()
}
int SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent )
{
GENERAL_COLLECTOR* collector = aEvent.Parameter<GENERAL_COLLECTOR*>();
@ -1678,12 +1678,12 @@ int SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent )
}
bool SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const wxString& aTitle )
bool PCB_SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const wxString& aTitle )
{
BOARD_ITEM* current = nullptr;
PCBNEW_SELECTION highlightGroup;
bool selectAll = false;
bool expandSelection = false;
BOARD_ITEM* current = nullptr;
PCB_SELECTION highlightGroup;
bool selectAll = false;
bool expandSelection = false;
highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
getView()->Add( &highlightGroup );
@ -1817,7 +1817,7 @@ bool SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const wxStr
}
BOARD_ITEM* SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector )
BOARD_ITEM* PCB_SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector )
{
int count = aCollector->GetPrimaryCount(); // try to use preferred layer
@ -1854,7 +1854,7 @@ BOARD_ITEM* SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector
}
bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOnly ) const
bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOnly ) const
{
const RENDER_SETTINGS* settings = getView()->GetPainter()->GetSettings();
@ -2045,7 +2045,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
}
void SELECTION_TOOL::select( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::select( BOARD_ITEM* aItem )
{
if( aItem->IsSelected() )
{
@ -2064,13 +2064,13 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem )
}
void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
{
unhighlight( aItem, SELECTED, &m_selection );
}
void SELECTION_TOOL::highlight( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION* aGroup )
void PCB_SELECTION_TOOL::highlight( BOARD_ITEM* aItem, int aMode, PCB_SELECTION* aGroup )
{
highlightInternal( aItem, aMode, aGroup, false );
@ -2083,8 +2083,8 @@ void SELECTION_TOOL::highlight( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION*
}
void SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode,
PCBNEW_SELECTION* aSelectionViewGroup, bool isChild )
void PCB_SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode,
PCB_SELECTION* aSelectionViewGroup, bool isChild )
{
if( aMode == SELECTED )
aItem->SetSelected();
@ -2121,7 +2121,7 @@ void SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode,
}
void SELECTION_TOOL::unhighlight( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION* aGroup )
void PCB_SELECTION_TOOL::unhighlight( BOARD_ITEM* aItem, int aMode, PCB_SELECTION* aGroup )
{
unhighlightInternal( aItem, aMode, aGroup, false );
@ -2134,8 +2134,8 @@ void SELECTION_TOOL::unhighlight( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION
}
void SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode,
PCBNEW_SELECTION* aSelectionViewGroup, bool isChild )
void PCB_SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode,
PCB_SELECTION* aSelectionViewGroup, bool isChild )
{
if( aMode == SELECTED )
aItem->ClearSelected();
@ -2176,7 +2176,7 @@ void SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode,
}
bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
{
const unsigned GRIP_MARGIN = 20;
VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
@ -2195,8 +2195,8 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
}
int SELECTION_TOOL::hitTestDistance( const wxPoint& aWhere, BOARD_ITEM* aItem,
int aMaxDistance ) const
int PCB_SELECTION_TOOL::hitTestDistance( const wxPoint& aWhere, BOARD_ITEM* aItem,
int aMaxDistance ) const
{
BOX2D viewportD = getView()->GetViewport();
BOX2I viewport( VECTOR2I( viewportD.GetPosition() ), VECTOR2I( viewportD.GetSize() ) );
@ -2288,8 +2288,8 @@ int SELECTION_TOOL::hitTestDistance( const wxPoint& aWhere, BOARD_ITEM* aItem,
// We currently check for pads and text mostly covering a footprint, but we don't check for
// smaller footprints mostly covering a larger footprint.
//
void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
const VECTOR2I& aWhere ) const
void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
const VECTOR2I& aWhere ) const
{
std::set<BOARD_ITEM*> preferred;
std::set<BOARD_ITEM*> rejected;
@ -2419,7 +2419,7 @@ void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
}
void SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) const
void PCB_SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) const
{
std::unordered_set<BOARD_ITEM*> toAdd;
@ -2456,7 +2456,7 @@ void SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) c
}
int SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
{
getView()->Update( &m_selection );
getView()->Update( &m_enteredGroupOverlay );
@ -2465,7 +2465,7 @@ int SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
{
ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
@ -2480,30 +2480,30 @@ int SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::setTransitions()
void PCB_SELECTION_TOOL::setTransitions()
{
Go( &SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &PCB_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &SELECTION_TOOL::Main, PCB_ACTIONS::selectionActivate.MakeEvent() );
Go( &SELECTION_TOOL::CursorSelection, PCB_ACTIONS::selectionCursor.MakeEvent() );
Go( &SELECTION_TOOL::ClearSelection, PCB_ACTIONS::selectionClear.MakeEvent() );
Go( &PCB_SELECTION_TOOL::Main, PCB_ACTIONS::selectionActivate.MakeEvent() );
Go( &PCB_SELECTION_TOOL::CursorSelection, PCB_ACTIONS::selectionCursor.MakeEvent() );
Go( &PCB_SELECTION_TOOL::ClearSelection, PCB_ACTIONS::selectionClear.MakeEvent() );
Go( &SELECTION_TOOL::SelectItem, PCB_ACTIONS::selectItem.MakeEvent() );
Go( &SELECTION_TOOL::SelectItems, PCB_ACTIONS::selectItems.MakeEvent() );
Go( &SELECTION_TOOL::UnselectItem, PCB_ACTIONS::unselectItem.MakeEvent() );
Go( &SELECTION_TOOL::UnselectItems, PCB_ACTIONS::unselectItems.MakeEvent() );
Go( &SELECTION_TOOL::SelectionMenu, PCB_ACTIONS::selectionMenu.MakeEvent() );
Go( &PCB_SELECTION_TOOL::SelectItem, PCB_ACTIONS::selectItem.MakeEvent() );
Go( &PCB_SELECTION_TOOL::SelectItems, PCB_ACTIONS::selectItems.MakeEvent() );
Go( &PCB_SELECTION_TOOL::UnselectItem, PCB_ACTIONS::unselectItem.MakeEvent() );
Go( &PCB_SELECTION_TOOL::UnselectItems, PCB_ACTIONS::unselectItems.MakeEvent() );
Go( &PCB_SELECTION_TOOL::SelectionMenu, PCB_ACTIONS::selectionMenu.MakeEvent() );
Go( &SELECTION_TOOL::find, ACTIONS::find.MakeEvent() );
Go( &PCB_SELECTION_TOOL::find, ACTIONS::find.MakeEvent() );
Go( &SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() );
Go( &SELECTION_TOOL::expandConnection, PCB_ACTIONS::selectConnection.MakeEvent() );
Go( &SELECTION_TOOL::selectNet, PCB_ACTIONS::selectNet.MakeEvent() );
Go( &SELECTION_TOOL::selectNet, PCB_ACTIONS::deselectNet.MakeEvent() );
Go( &SELECTION_TOOL::selectSameSheet, PCB_ACTIONS::selectSameSheet.MakeEvent() );
Go( &SELECTION_TOOL::selectSheetContents, PCB_ACTIONS::selectOnSheetFromEeschema.MakeEvent() );
Go( &SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsModified );
Go( &SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsMoved );
Go( &PCB_SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() );
Go( &PCB_SELECTION_TOOL::expandConnection, PCB_ACTIONS::selectConnection.MakeEvent() );
Go( &PCB_SELECTION_TOOL::selectNet, PCB_ACTIONS::selectNet.MakeEvent() );
Go( &PCB_SELECTION_TOOL::selectNet, PCB_ACTIONS::deselectNet.MakeEvent() );
Go( &PCB_SELECTION_TOOL::selectSameSheet, PCB_ACTIONS::selectSameSheet.MakeEvent() );
Go( &PCB_SELECTION_TOOL::selectSheetContents, PCB_ACTIONS::selectOnSheetFromEeschema.MakeEvent() );
Go( &PCB_SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsModified );
Go( &PCB_SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsMoved );
Go( &SELECTION_TOOL::SelectAll, ACTIONS::selectAll.MakeEvent() );
Go( &PCB_SELECTION_TOOL::SelectAll, ACTIONS::selectAll.MakeEvent() );
}

View File

@ -24,8 +24,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __SELECTION_TOOL_H
#define __SELECTION_TOOL_H
#ifndef PCB_SELECTION_TOOL_H
#define PCB_SELECTION_TOOL_H
#include <memory>
@ -35,7 +35,7 @@
#include <tool/tool_menu.h>
#include <tools/pcb_selection_conditions.h>
#include <tools/pcb_tool_base.h>
#include <tools/pcbnew_selection.h>
#include <tools/pcb_selection.h>
class PCB_BASE_FRAME;
class BOARD_ITEM;
@ -47,11 +47,11 @@ namespace KIGFX
}
typedef void (*CLIENT_SELECTION_FILTER)( const VECTOR2I&, GENERAL_COLLECTOR&, SELECTION_TOOL* );
typedef void (*CLIENT_SELECTION_FILTER)( const VECTOR2I&, GENERAL_COLLECTOR&, PCB_SELECTION_TOOL* );
/**
* SELECTION_TOOL
* PCB_SELECTION_TOOL
*
* Our sample selection tool: currently supports:
* - pick single objects (click LMB)
@ -61,11 +61,11 @@ typedef void (*CLIENT_SELECTION_FILTER)( const VECTOR2I&, GENERAL_COLLECTOR&, SE
* - takes into account high-contrast & layer visibility settings
* - invokes InteractiveEdit tool when user starts to drag selected items
*/
class SELECTION_TOOL : public PCB_TOOL_BASE
class PCB_SELECTION_TOOL : public PCB_TOOL_BASE
{
public:
SELECTION_TOOL();
~SELECTION_TOOL();
PCB_SELECTION_TOOL();
~PCB_SELECTION_TOOL();
/// @copydoc TOOL_BASE::Init()
bool Init() override;
@ -85,7 +85,7 @@ public:
*
* Returns the set of currently selected items.
*/
PCBNEW_SELECTION& GetSelection();
PCB_SELECTION& GetSelection();
/**
* Function RequestSelection()
@ -96,8 +96,8 @@ public:
* @param aConfirmLockedItems if true the user will be prompted if they want to drop locked
* items from the selection or override the locks
*/
PCBNEW_SELECTION& RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
bool aConfirmLockedItems = false );
PCB_SELECTION& RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
bool aConfirmLockedItems = false );
///> Select a single item under cursor event handler.
int CursorSelection( const TOOL_EVENT& aEvent );
@ -334,7 +334,7 @@ private:
* @param aHighlightMode should be either SELECTED or BRIGHTENED
* @param aGroup is the group to add the item to in the BRIGHTENED mode.
*/
void highlight( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aGroup = nullptr );
void highlight( BOARD_ITEM* aItem, int aHighlightMode, PCB_SELECTION* aGroup = nullptr );
/**
* Function unhighlight()
@ -343,7 +343,7 @@ private:
* @param aHighlightMode should be either SELECTED or BRIGHTENED
* @param aGroup is the group to remove the item from.
*/
void unhighlight( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aGroup = nullptr );
void unhighlight( BOARD_ITEM* aItem, int aHighlightMode, PCB_SELECTION* aGroup = nullptr );
/**
* Function selectionContains()
@ -366,14 +366,14 @@ private:
const GENERAL_COLLECTORS_GUIDE getCollectorsGuide() const;
private:
void highlightInternal( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aSelectionViewGroup,
bool isChild);
void highlightInternal( BOARD_ITEM* aItem, int aHighlightMode,
PCB_SELECTION* aSelectionViewGroup, bool isChild);
void unhighlightInternal( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aSelectionViewGroup,
bool isChild);
void unhighlightInternal( BOARD_ITEM* aItem, int aHighlightMode,
PCB_SELECTION* aSelectionViewGroup, bool isChild);
PCB_BASE_FRAME* m_frame; // Pointer to the parent frame
PCBNEW_SELECTION m_selection; // Current state of selection
PCB_SELECTION m_selection; // Current state of selection
SELECTION_FILTER_OPTIONS m_filter;
@ -393,4 +393,4 @@ private:
std::unique_ptr<PRIV> m_priv;
};
#endif /* __SELECTION_TOOL_H */
#endif /* PCB_SELECTION_TOOL_H */

View File

@ -29,7 +29,7 @@
#include <footprint.h>
#include <pcb_draw_panel_gal.h>
#include <pcbnew_settings.h>
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include "pcb_actions.h"
#include "tool_event_utils.h"
@ -51,7 +51,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
controls()->ShowCursor( true );
// Add a VIEW_GROUP that serves as a preview for the new item
PCBNEW_SELECTION preview;
PCB_SELECTION preview;
view()->Add( &preview );
aPlacer->m_board = board();
@ -292,17 +292,17 @@ PCB_DRAW_PANEL_GAL* PCB_TOOL_BASE::canvas() const
}
const PCBNEW_SELECTION& PCB_TOOL_BASE::selection() const
const PCB_SELECTION& PCB_TOOL_BASE::selection() const
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
return selTool->GetSelection();
}
PCBNEW_SELECTION& PCB_TOOL_BASE::selection()
PCB_SELECTION& PCB_TOOL_BASE::selection()
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
return selTool->GetSelection();
}

View File

@ -48,7 +48,7 @@
class PCB_TOOL_BASE;
class PCB_EDIT_FRAME;
class PCB_DISPLAY_OPTIONS;
class PCBNEW_SELECTION;
class PCB_SELECTION;
struct INTERACTIVE_PLACER_BASE
{
@ -168,9 +168,9 @@ protected:
PCB_DRAW_PANEL_GAL* canvas() const;
const PCBNEW_SELECTION& selection() const;
const PCB_SELECTION& selection() const;
PCBNEW_SELECTION& selection();
PCB_SELECTION& selection();
protected:
bool m_isFootprintEditor;

View File

@ -24,7 +24,7 @@
#include "tool/selection.h"
#include "placement_tool.h"
#include "pcb_actions.h"
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include "edit_tool.h"
#include <ratsnest/ratsnest_data.h>
@ -54,7 +54,7 @@ ALIGN_DISTRIBUTE_TOOL::~ALIGN_DISTRIBUTE_TOOL()
bool ALIGN_DISTRIBUTE_TOOL::Init()
{
// Find the selection tool, so they can cooperate
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
wxASSERT_MSG( m_selectionTool, "pcbnew.InteractiveSelection tool is not available" );
@ -142,8 +142,8 @@ template< typename T >
size_t ALIGN_DISTRIBUTE_TOOL::GetSelections( ALIGNMENT_RECTS& aItems, ALIGNMENT_RECTS& aLocked,
T aCompare )
{
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -166,7 +166,7 @@ size_t ALIGN_DISTRIBUTE_TOOL::GetSelections( ALIGNMENT_RECTS& aItems, ALIGNMENT_
}
selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -466,8 +466,8 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterY( const TOOL_EVENT& aEvent )
int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
{
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -585,8 +585,8 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally( ALIGNMENT_RECTS &it
int ALIGN_DISTRIBUTE_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
{
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )

View File

@ -26,14 +26,14 @@
#define ALIGN_DISTRIBUTE_TOOL_H_
#include <tool/tool_interactive.h>
#include <tools/pcbnew_selection.h>
#include <tools/pcb_selection.h>
#include <board_item.h>
#include <pcb_base_frame.h>
using ALIGNMENT_RECT = std::pair<BOARD_ITEM*, EDA_RECT>;
using ALIGNMENT_RECTS = std::vector<ALIGNMENT_RECT>;
class SELECTION_TOOL;
class PCB_SELECTION_TOOL;
class ALIGN_DISTRIBUTE_TOOL : public TOOL_INTERACTIVE
{
@ -101,7 +101,6 @@ public:
void setTransitions() override;
private:
/**
* Function GetSelections()
* Populates two vectors with the sorted selection and sorted locked items
@ -129,12 +128,6 @@ private:
*/
int doAlignRight();
SELECTION_TOOL* m_selectionTool;
ACTION_MENU* m_placementMenu;
PCB_BASE_FRAME* m_frame;
/**
* Check a selection to ensure locks are valid for alignment.
*
@ -143,7 +136,7 @@ private:
* We also check the lock of a pad's parent as we will not move pads independently of
* the parent footprint
*/
int checkLockedStatus( const PCBNEW_SELECTION &selection ) const;
int checkLockedStatus( const PCB_SELECTION &selection ) const;
/**
* Distributes selected items using an even spacing between the centers of their bounding boxes
@ -180,6 +173,11 @@ private:
void doDistributeGapsVertically( ALIGNMENT_RECTS &itemsToDistribute,
const BOARD_ITEM *lastItem,
int totalGap ) const;
private:
PCB_SELECTION_TOOL* m_selectionTool;
ACTION_MENU* m_placementMenu;
PCB_BASE_FRAME* m_frame;
};
#endif /* ALIGN_DISTRIBUTE_TOOL_H_ */

View File

@ -32,7 +32,7 @@ using namespace std::placeholders;
#include <geometry/seg.h>
#include <confirm.h>
#include "pcb_actions.h"
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include "point_editor.h"
#include "grid_helper.h"
#include <board_commit.h>
@ -338,7 +338,7 @@ void POINT_EDITOR::Reset( RESET_REASON aReason )
bool POINT_EDITOR::Init()
{
// Find the selection tool, so they can cooperate
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
wxASSERT_MSG( m_selectionTool, "pcbnew.InteractiveSelection tool is not available" );
@ -397,7 +397,7 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
if( !m_selectionTool || aEvent.Matches( EVENTS::InhibitSelectionEditing ) )
return 0;
const PCBNEW_SELECTION& selection = m_selectionTool->GetSelection();
const PCB_SELECTION& selection = m_selectionTool->GetSelection();
if( selection.Size() != 1 || selection.Front()->GetEditFlags() )
return 0;

View File

@ -32,7 +32,7 @@
#include <memory>
class SELECTION_TOOL;
class PCB_SELECTION_TOOL;
class SHAPE_POLY_SET;
/**
@ -69,7 +69,7 @@ public:
private:
///> Selection tool used for obtaining selected items
SELECTION_TOOL* m_selectionTool;
PCB_SELECTION_TOOL* m_selectionTool;
///> Currently edited point, NULL if there is none.
EDIT_POINT* m_editedPoint;

View File

@ -27,9 +27,9 @@ using namespace std::placeholders;
#include "position_relative_tool.h"
#include "pcb_actions.h"
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include "edit_tool.h"
#include "pcbnew_picker_tool.h"
#include "pcb_picker_tool.h"
#include <dialogs/dialog_position_relative.h>
#include <status_popup.h>
#include <board_commit.h>
@ -56,7 +56,7 @@ void POSITION_RELATIVE_TOOL::Reset( RESET_REASON aReason )
bool POSITION_RELATIVE_TOOL::Init()
{
// Find the selection tool, so they can cooperate
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
return m_selectionTool != nullptr;
}
@ -67,7 +67,7 @@ int POSITION_RELATIVE_TOOL::PositionRelative( const TOOL_EVENT& aEvent )
PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
const auto& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
@ -136,10 +136,10 @@ int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( wxPoint aPosAnchor, wxPoi
int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent )
{
std::string tool = "pcbnew.PositionRelative.selectReferenceItem";
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
STATUS_TEXT_POPUP statusPopup( frame() );
bool done = false;
std::string tool = "pcbnew.PositionRelative.selectReferenceItem";
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
STATUS_TEXT_POPUP statusPopup( frame() );
bool done = false;
Activate();
@ -149,8 +149,9 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
[&]( const VECTOR2D& aPoint ) -> bool
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
const PCBNEW_SELECTION& sel = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
const PCB_SELECTION& sel = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* sTool )
{
} );

View File

@ -26,13 +26,13 @@
#include <math/vector2d.h>
#include <tools/pcb_tool_base.h>
#include "selection_tool.h"
#include "pcb_selection_tool.h"
#include "dialogs/dialog_position_relative.h"
#include "dialogs/dialog_position_relative_base.h"
class BOARD_COMMIT;
class BOARD_ITEM;
class SELECTION_TOOL;
class PCB_SELECTION_TOOL;
class DIALOG_POSITION_RELATIVE;
/**
@ -87,18 +87,17 @@ public:
void setTransitions() override;
private:
DIALOG_POSITION_RELATIVE* m_dialog;
DIALOG_POSITION_RELATIVE* m_dialog;
///> Selection tool used for obtaining selected items
SELECTION_TOOL* m_selectionTool;
PCBNEW_SELECTION m_selection;
PCB_SELECTION_TOOL* m_selectionTool;
PCB_SELECTION m_selection;
std::unique_ptr<BOARD_COMMIT> m_commit;
EDA_ITEM* m_anchor_item;
wxPoint m_anchor;
EDA_ITEM* m_anchor_item;
wxPoint m_anchor;
wxPoint m_translation;
wxPoint m_translation;
};
#endif

View File

@ -29,7 +29,7 @@
#include <board_commit.h>
#include <pcb_painter.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <zone_filler.h>
ZONE_CREATE_HELPER::ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, PARAMS& aParams ):
@ -65,7 +65,7 @@ std::unique_ptr<ZONE> ZONE_CREATE_HELPER::createNewZone( bool aKeepout )
zoneInfo.m_Zone_45_Only = ( m_params.m_leaderMode == POLYGON_GEOM_MANAGER::LEADER_MODE::DEG45 );
// If we don't have a net from highlighing, maybe we can get one from the selection
SELECTION_TOOL* selectionTool = m_tool.GetManager()->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selectionTool = m_tool.GetManager()->GetTool<PCB_SELECTION_TOOL>();
if( selectionTool && !selectionTool->GetSelection().Empty()
&& zoneInfo.m_NetcodeSelection == -1 )

View File

@ -39,9 +39,9 @@ using namespace std::placeholders;
#include <pcbnew_settings.h>
#include <tool/tool_manager.h>
#include <tool/actions.h>
#include <tools/selection_tool.h>
#include <tools/pcbnew_control.h>
#include <tools/pcb_editor_control.h>
#include <tools/pcb_selection_tool.h>
#include <tools/pcb_control.h>
#include <tools/board_editor_control.h>
#include <page_layout/ws_proxy_undo_item.h>
/* Functions to undo and redo edit commands.
@ -559,9 +559,9 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
image->SetPosition( eda_item->GetPosition() );
if( aList->GetPickedItemStatus( ii ) == UNDO_REDO::DRILLORIGIN )
PCB_EDITOR_CONTROL::DoSetDrillOrigin( view, this, item, origin );
BOARD_EDITOR_CONTROL::DoSetDrillOrigin( view, this, item, origin );
else
PCBNEW_CONTROL::DoSetGridOrigin( view, this, item, origin );
PCB_CONTROL::DoSetGridOrigin( view, this, item, origin );
}
break;
@ -592,7 +592,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
Compile_Ratsnest( false );
}
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
selTool->RebuildSelection();
GetBoard()->SanitizeNetcodes();

View File

@ -314,7 +314,7 @@ private:
std::map<wxString, APPEARANCE_SETTING*> m_netclassSettingsMap;
// TODO(JE) Move preset storage to the PCBNEW_CONTROL tool
// TODO(JE) Move preset storage to the PCB_CONTROL tool
// Storage for all layer presets
std::map<wxString, LAYER_PRESET> m_layerPresets;

View File

@ -20,7 +20,7 @@
#include <pcb_base_edit_frame.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
#include <widgets/panel_selection_filter.h>
@ -30,7 +30,7 @@ PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER( wxWindow* aParent ) :
m_onlyCheckbox( nullptr )
{
wxASSERT( m_frame );
m_tool = m_frame->GetToolManager()->GetTool<SELECTION_TOOL>();
m_tool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
wxASSERT( m_tool );
SELECTION_FILTER_OPTIONS& opts = m_tool->GetFilter();

View File

@ -24,7 +24,7 @@
#include <widgets/panel_selection_filter_base.h>
class SELECTION_TOOL;
class PCB_SELECTION_TOOL;
struct SELECTION_FILTER_OPTIONS;
@ -47,11 +47,10 @@ private:
void onPopupSelection( wxCommandEvent& aEvent );
private:
PCB_BASE_EDIT_FRAME* m_frame;
SELECTION_TOOL* m_tool;
wxCheckBox* m_onlyCheckbox;
PCB_SELECTION_TOOL* m_tool;
wxCheckBox* m_onlyCheckbox;
};

View File

@ -454,20 +454,20 @@ bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser() { return false; }
void EDA_3D_VIEWER::loadCommonSettings() { }
void EDA_3D_VIEWER::Install3DViewOptionDialog( wxCommandEvent& event ) { };
#include <tools/selection_tool.h>
#include <tools/pcb_selection_tool.h>
/**
* Private implementation of firewalled private data
*/
class SELECTION_TOOL::PRIV
class PCB_SELECTION_TOOL::PRIV
{
public:
DIALOG_FILTER_SELECTION::OPTIONS m_filterOpts;
};
SELECTION_TOOL::SELECTION_TOOL() :
PCB_SELECTION_TOOL::PCB_SELECTION_TOOL() :
PCB_TOOL_BASE( "pcbnew.InteractiveSelection" ),
m_frame( NULL ),
m_additive( false ),
@ -482,66 +482,66 @@ SELECTION_TOOL::SELECTION_TOOL() :
}
SELECTION_TOOL::~SELECTION_TOOL()
PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL()
{
}
bool SELECTION_TOOL::Init()
bool PCB_SELECTION_TOOL::Init()
{
return true;
}
void SELECTION_TOOL::Reset( RESET_REASON aReason )
void PCB_SELECTION_TOOL::Reset( RESET_REASON aReason )
{
}
int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
return 0;
}
void SELECTION_TOOL::EnterGroup()
void PCB_SELECTION_TOOL::EnterGroup()
{
}
void SELECTION_TOOL::ExitGroup( bool aSelectGroup )
void PCB_SELECTION_TOOL::ExitGroup( bool aSelectGroup )
{
}
PCBNEW_SELECTION& SELECTION_TOOL::GetSelection()
PCB_SELECTION& PCB_SELECTION_TOOL::GetSelection()
{
return m_selection;
}
PCBNEW_SELECTION& SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
bool aConfirmLockedItems )
PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
bool aConfirmLockedItems )
{
return m_selection;
}
const GENERAL_COLLECTORS_GUIDE SELECTION_TOOL::getCollectorsGuide() const
const GENERAL_COLLECTORS_GUIDE PCB_SELECTION_TOOL::getCollectorsGuide() const
{
return GENERAL_COLLECTORS_GUIDE( LSET(), PCB_LAYER_ID::UNDEFINED_LAYER, nullptr );
}
bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
bool* aSelectionCancelledFlag,
CLIENT_SELECTION_FILTER aClientFilter )
bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
bool* aSelectionCancelledFlag,
CLIENT_SELECTION_FILTER aClientFilter )
{
@ -549,48 +549,48 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
}
bool SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aClientFilter )
bool PCB_SELECTION_TOOL::selectCursor( bool aForceSelect, CLIENT_SELECTION_FILTER aClientFilter )
{
return false;
}
bool SELECTION_TOOL::selectMultiple()
bool PCB_SELECTION_TOOL::selectMultiple()
{
return false;
}
int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
{
return 0;
}
int SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
{
return 0;
}
int SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent )
{
return 0;
}
int SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
{
return 0;
}
int SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
{
@ -598,103 +598,103 @@ int SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
}
void SELECTION_TOOL::AddItemToSel( BOARD_ITEM* aItem, bool aQuietMode )
void PCB_SELECTION_TOOL::AddItemToSel( BOARD_ITEM* aItem, bool aQuietMode )
{
}
int SELECTION_TOOL::UnselectItems( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::UnselectItems( const TOOL_EVENT& aEvent )
{
return 0;
}
int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
{
return 0;
}
void SELECTION_TOOL::RemoveItemFromSel( BOARD_ITEM* aItem, bool aQuietMode )
void PCB_SELECTION_TOOL::RemoveItemFromSel( BOARD_ITEM* aItem, bool aQuietMode )
{
}
void SELECTION_TOOL::BrightenItem( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::BrightenItem( BOARD_ITEM* aItem )
{
}
void SELECTION_TOOL::UnbrightenItem( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::UnbrightenItem( BOARD_ITEM* aItem )
{
}
int SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
{
return 0;
}
void SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
STOP_CONDITION aStopCondition )
void PCB_SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem,
STOP_CONDITION aStopCondition )
{
}
void SELECTION_TOOL::selectAllItemsOnNet( int aNetCode, bool aSelect )
void PCB_SELECTION_TOOL::selectAllItemsOnNet( int aNetCode, bool aSelect )
{
}
int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
{
return 0;
}
void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
{
}
void SELECTION_TOOL::zoomFitSelection()
void PCB_SELECTION_TOOL::zoomFitSelection()
{
}
int SELECTION_TOOL::selectSheetContents( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::selectSheetContents( const TOOL_EVENT& aEvent )
{
return 0;
}
int SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
{
return 0;
}
void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
{
}
int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
{
return 0;
@ -717,20 +717,20 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
}
int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
{
return 0;
}
void SELECTION_TOOL::FilterCollectedItems( GENERAL_COLLECTOR& aCollector )
void PCB_SELECTION_TOOL::FilterCollectedItems( GENERAL_COLLECTOR& aCollector )
{
}
bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
{
@ -738,112 +738,112 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
}
void SELECTION_TOOL::ClearSelection( bool aQuietMode )
void PCB_SELECTION_TOOL::ClearSelection( bool aQuietMode )
{
}
void SELECTION_TOOL::RebuildSelection()
void PCB_SELECTION_TOOL::RebuildSelection()
{
}
int SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::SelectionMenu( const TOOL_EVENT& aEvent )
{
return 0;
}
bool SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const wxString& aTitle )
bool PCB_SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector, const wxString& aTitle )
{
return false;
}
BOARD_ITEM* SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector )
BOARD_ITEM* PCB_SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector )
{
return nullptr;
}
bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOnly ) const
bool PCB_SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOnly ) const
{
return false;
}
void SELECTION_TOOL::select( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::select( BOARD_ITEM* aItem )
{
}
void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
void PCB_SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
{
}
void SELECTION_TOOL::highlight( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION* aGroup )
void PCB_SELECTION_TOOL::highlight( BOARD_ITEM* aItem, int aMode, PCB_SELECTION* aGroup )
{
}
void SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION* aGroup, bool isChild )
void PCB_SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode, PCB_SELECTION* aGroup, bool isChild )
{
}
void SELECTION_TOOL::unhighlight( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION* aGroup )
void PCB_SELECTION_TOOL::unhighlight( BOARD_ITEM* aItem, int aMode, PCB_SELECTION* aGroup )
{
}
void SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode, PCBNEW_SELECTION* aGroup, bool isChild )
void PCB_SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode, PCB_SELECTION* aGroup, bool isChild )
{
}
bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
{
return false;
}
void SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
const VECTOR2I& aWhere ) const
void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector,
const VECTOR2I& aWhere ) const
{
}
void SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) const
void PCB_SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) const
{
}
int SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
{
return 0;
}
int SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
int PCB_SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
{
return 0;
}
void SELECTION_TOOL::setTransitions()
void PCB_SELECTION_TOOL::setTransitions()
{}
void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
@ -882,29 +882,29 @@ PCB_DRAW_PANEL_GAL* PCB_TOOL_BASE::canvas() const
}
const PCBNEW_SELECTION& PCB_TOOL_BASE::selection() const
const PCB_SELECTION& PCB_TOOL_BASE::selection() const
{
static PCBNEW_SELECTION sel;
static PCB_SELECTION sel;
return sel;
}
PCBNEW_SELECTION& PCB_TOOL_BASE::selection()
PCB_SELECTION& PCB_TOOL_BASE::selection()
{
static PCBNEW_SELECTION sel;
static PCB_SELECTION sel;
return sel;
}
EDA_ITEM* PCBNEW_SELECTION::GetTopLeftItem( bool onlyModules ) const
EDA_ITEM* PCB_SELECTION::GetTopLeftItem( bool onlyModules ) const
{
return nullptr;
}
const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const
const KIGFX::VIEW_GROUP::ITEMS PCB_SELECTION::updateDrawList() const
{
std::vector<VIEW_ITEM*> items;
@ -912,7 +912,7 @@ const KIGFX::VIEW_GROUP::ITEMS PCBNEW_SELECTION::updateDrawList() const
}
const LSET PCBNEW_SELECTION::GetSelectionLayers()
const LSET PCB_SELECTION::GetSelectionLayers()
{
return LSET();
}

View File

@ -155,7 +155,7 @@ void PCB_TEST_FRAME_BASE::createView( wxWindow *aParent, PCB_DRAW_PANEL_GAL::GAL
m_pcbActions = std::make_unique<TEST_ACTIONS>( );
m_toolDispatcher = std::make_unique<TOOL_DISPATCHER>( m_toolManager.get(), m_pcbActions.get() );
//m_toolManager->RegisterTool( new SELECTION_TOOL );
//m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
createUserTools();
m_toolManager->InitTools();