Move to direct tool registration.
It was confusing that the primary frames registered their tools differently than the other frames. In addition, since the other frames also added their own tools, foo_actions::RegisterAllTools() didn't really register all tool but rather those used by the principal frame (PCB_EDIT_FRAME, SCH_EDIT_FRAME, etc.)
This commit is contained in:
parent
dd9c426922
commit
ed0e6af66d
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2007-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2007-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -23,10 +23,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file display_footprints_frame.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <gal/graphics_abstraction_layer.h>
|
#include <gal/graphics_abstraction_layer.h>
|
||||||
|
@ -58,7 +54,10 @@
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tool/common_tools.h>
|
#include <tool/common_tools.h>
|
||||||
#include "tools/cvpcb_actions.h"
|
#include <tool/zoom_tool.h>
|
||||||
|
#include <tools/cvpcb_selection_tool.h>
|
||||||
|
#include <tools/cvpcb_actions.h>
|
||||||
|
#include <tools/cvpcb_control.h>
|
||||||
|
|
||||||
// Colors for layers and items
|
// Colors for layers and items
|
||||||
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_CVPCB_DISPLAY );
|
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_CVPCB_DISPLAY );
|
||||||
|
@ -156,7 +155,10 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
||||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||||
gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
|
gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
|
||||||
|
|
||||||
m_actions->RegisterAllTools( m_toolManager );
|
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||||
|
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new CVPCB_SELECTION_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new CVPCB_CONTROL );
|
||||||
m_toolManager->InitTools();
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
// Run the control tool, it is supposed to be always active
|
// Run the control tool, it is supposed to be always active
|
||||||
|
|
|
@ -22,25 +22,10 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tool/tool_manager.h>
|
|
||||||
#include <tool/common_tools.h>
|
|
||||||
#include <tool/zoom_tool.h>
|
|
||||||
|
|
||||||
#include "cvpcb_actions.h"
|
#include "cvpcb_actions.h"
|
||||||
#include "cvpcb_control.h"
|
|
||||||
#include "cvpcb_selection_tool.h"
|
|
||||||
#include <cvpcb_id.h>
|
#include <cvpcb_id.h>
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_ACTIONS::RegisterAllTools( TOOL_MANAGER* aToolManager )
|
|
||||||
{
|
|
||||||
aToolManager->RegisterTool( new COMMON_TOOLS );
|
|
||||||
aToolManager->RegisterTool( new ZOOM_TOOL );
|
|
||||||
aToolManager->RegisterTool( new CVPCB_SELECTION_TOOL );
|
|
||||||
aToolManager->RegisterTool( new CVPCB_CONTROL );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OPT<TOOL_EVENT> CVPCB_ACTIONS::TranslateLegacyId( int aId )
|
OPT<TOOL_EVENT> CVPCB_ACTIONS::TranslateLegacyId( int aId )
|
||||||
{
|
{
|
||||||
switch( aId )
|
switch( aId )
|
||||||
|
|
|
@ -61,9 +61,6 @@ public:
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
||||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::RegisterAllTools()
|
|
||||||
virtual void RegisterAllTools( TOOL_MANAGER* aToolManager ) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,10 +62,16 @@
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
#include <wx/progdlg.h>
|
#include <wx/progdlg.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tool/context_menu.h>
|
#include <tool/context_menu.h>
|
||||||
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/zoom_tool.h>
|
||||||
|
#include <tools/sch_actions.h>
|
||||||
|
#include <tools/sch_selection_tool.h>
|
||||||
|
#include <tools/sch_picker_tool.h>
|
||||||
#include <sch_view.h>
|
#include <sch_view.h>
|
||||||
#include <sch_painter.h>
|
#include <sch_painter.h>
|
||||||
#include <tools/sch_actions.h>
|
|
||||||
|
|
||||||
int LIB_EDIT_FRAME:: m_unit = 1;
|
int LIB_EDIT_FRAME:: m_unit = 1;
|
||||||
int LIB_EDIT_FRAME:: m_convert = 1;
|
int LIB_EDIT_FRAME:: m_convert = 1;
|
||||||
|
@ -316,6 +322,29 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LIB_EDIT_FRAME::setupTools()
|
||||||
|
{
|
||||||
|
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||||
|
m_toolManager = new TOOL_MANAGER;
|
||||||
|
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
|
||||||
|
GetCanvas()->GetViewControls(), this );
|
||||||
|
m_actions = new SCH_ACTIONS();
|
||||||
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||||
|
|
||||||
|
// Register tools
|
||||||
|
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||||
|
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_PICKER_TOOL );
|
||||||
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
|
// Run the selection tool, it is supposed to be always active
|
||||||
|
m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
|
||||||
|
|
||||||
|
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
{
|
{
|
||||||
if( saveAllLibraries( true ) )
|
if( saveAllLibraries( true ) )
|
||||||
|
|
|
@ -444,6 +444,9 @@ public:
|
||||||
bool IsEditingDrawItem() { return GetDrawItem() && GetDrawItem()->InEditMode(); }
|
bool IsEditingDrawItem() { return GetDrawItem() && GetDrawItem()->InEditMode(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Sets up the tool framework
|
||||||
|
void setupTools();
|
||||||
|
|
||||||
void loadPart( const wxString& aLibrary, const wxString& aPart, int Unit );
|
void loadPart( const wxString& aLibrary, const wxString& aPart, int Unit );
|
||||||
|
|
||||||
void savePartAs();
|
void savePartAs();
|
||||||
|
|
|
@ -107,26 +107,6 @@ SCH_BASE_FRAME::~SCH_BASE_FRAME()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_BASE_FRAME::setupTools()
|
|
||||||
{
|
|
||||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
|
||||||
m_toolManager = new TOOL_MANAGER;
|
|
||||||
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
|
|
||||||
GetCanvas()->GetViewControls(), this );
|
|
||||||
m_actions = new SCH_ACTIONS();
|
|
||||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
|
||||||
|
|
||||||
// Register tools
|
|
||||||
m_actions->RegisterAllTools( m_toolManager );
|
|
||||||
m_toolManager->InitTools();
|
|
||||||
|
|
||||||
// Run the selection tool, it is supposed to be always active
|
|
||||||
m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
|
|
||||||
|
|
||||||
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
void SCH_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
wxMenuBar* menuBar = GetMenuBar();
|
wxMenuBar* menuBar = GetMenuBar();
|
||||||
|
|
|
@ -326,10 +326,6 @@ public:
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Sets up the tool framework
|
|
||||||
void setupTools();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the library viewer only to browse library contents.
|
* Open the library viewer only to browse library contents.
|
||||||
* If the viewed is already opened from this, raise the viewer
|
* If the viewed is already opened from this, raise the viewer
|
||||||
|
|
|
@ -49,17 +49,23 @@
|
||||||
#include <hotkeys.h>
|
#include <hotkeys.h>
|
||||||
#include <eeschema_config.h>
|
#include <eeschema_config.h>
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include "sim/sim_plot_frame.h"
|
#include <sim/sim_plot_frame.h>
|
||||||
|
|
||||||
#include <invoke_sch_dialog.h>
|
#include <invoke_sch_dialog.h>
|
||||||
#include <dialogs/dialog_schematic_find.h>
|
#include <dialogs/dialog_schematic_find.h>
|
||||||
#include <dialog_symbol_remap.h>
|
#include <dialog_symbol_remap.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
|
#include <tool/tool_dispatcher.h>
|
||||||
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/zoom_tool.h>
|
||||||
#include <tools/sch_actions.h>
|
#include <tools/sch_actions.h>
|
||||||
#include <tools/sch_selection_tool.h>
|
#include <tools/sch_selection_tool.h>
|
||||||
|
#include <tools/sch_picker_tool.h>
|
||||||
#include <wx/display.h>
|
#include <tools/sch_drawing_tool.h>
|
||||||
|
#include <tools/sch_line_drawing_tool.h>
|
||||||
|
#include <tools/sch_edit_tool.h>
|
||||||
|
#include <tools/sch_inspection_tool.h>
|
||||||
|
#include <tools/sch_editor_control.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <connection_graph.h>
|
#include <connection_graph.h>
|
||||||
|
@ -408,6 +414,34 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_EDIT_FRAME::setupTools()
|
||||||
|
{
|
||||||
|
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||||
|
m_toolManager = new TOOL_MANAGER;
|
||||||
|
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
|
||||||
|
GetCanvas()->GetViewControls(), this );
|
||||||
|
m_actions = new SCH_ACTIONS();
|
||||||
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||||
|
|
||||||
|
// Register tools
|
||||||
|
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||||
|
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_SELECTION_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_PICKER_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_DRAWING_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_LINE_DRAWING_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_EDIT_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_INSPECTION_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new SCH_EDITOR_CONTROL );
|
||||||
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
|
// Run the selection tool, it is supposed to be always active
|
||||||
|
m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
|
||||||
|
|
||||||
|
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::SetRepeatItem( SCH_ITEM* aItem )
|
void SCH_EDIT_FRAME::SetRepeatItem( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
// we cannot store a pointer to an item in the display list here since
|
// we cannot store a pointer to an item in the display list here since
|
||||||
|
|
|
@ -769,6 +769,8 @@ public:
|
||||||
void GetSchematicConnections( std::vector< wxPoint >& aConnections );
|
void GetSchematicConnections( std::vector< wxPoint >& aConnections );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Sets up the tool framework
|
||||||
|
void setupTools();
|
||||||
|
|
||||||
void OnExit( wxCommandEvent& event );
|
void OnExit( wxCommandEvent& event );
|
||||||
void OnAnnotate( wxCommandEvent& event );
|
void OnAnnotate( wxCommandEvent& event );
|
||||||
|
|
|
@ -23,17 +23,7 @@
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <eeschema_id.h>
|
#include <eeschema_id.h>
|
||||||
#include <tool/tool_manager.h>
|
|
||||||
#include <tool/common_tools.h>
|
|
||||||
#include <tools/sch_editor_control.h>
|
|
||||||
#include <tools/sch_picker_tool.h>
|
|
||||||
#include <tools/sch_drawing_tool.h>
|
|
||||||
#include <tools/sch_line_drawing_tool.h>
|
|
||||||
#include <tools/sch_selection_tool.h>
|
|
||||||
#include <tools/sch_actions.h>
|
#include <tools/sch_actions.h>
|
||||||
#include <tools/sch_edit_tool.h>
|
|
||||||
#include <tools/sch_inspection_tool.h>
|
|
||||||
#include <tool/zoom_tool.h>
|
|
||||||
|
|
||||||
|
|
||||||
char g_lastBusEntryShape = '/';
|
char g_lastBusEntryShape = '/';
|
||||||
|
@ -215,17 +205,3 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
|
||||||
|
|
||||||
return OPT<TOOL_EVENT>();
|
return OPT<TOOL_EVENT>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_ACTIONS::RegisterAllTools( TOOL_MANAGER* aToolManager )
|
|
||||||
{
|
|
||||||
aToolManager->RegisterTool( new COMMON_TOOLS );
|
|
||||||
aToolManager->RegisterTool( new ZOOM_TOOL );
|
|
||||||
aToolManager->RegisterTool( new SCH_SELECTION_TOOL );
|
|
||||||
aToolManager->RegisterTool( new SCH_PICKER_TOOL );
|
|
||||||
aToolManager->RegisterTool( new SCH_DRAWING_TOOL );
|
|
||||||
aToolManager->RegisterTool( new SCH_LINE_DRAWING_TOOL );
|
|
||||||
aToolManager->RegisterTool( new SCH_EDIT_TOOL );
|
|
||||||
aToolManager->RegisterTool( new SCH_INSPECTION_TOOL );
|
|
||||||
aToolManager->RegisterTool( new SCH_EDITOR_CONTROL );
|
|
||||||
}
|
|
||||||
|
|
|
@ -166,9 +166,6 @@ public:
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
||||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::RegisterAllTools()
|
|
||||||
virtual void RegisterAllTools( TOOL_MANAGER* aToolManager ) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,7 +61,7 @@ SCH_INSPECTION_TOOL::SCH_INSPECTION_TOOL()
|
||||||
|
|
||||||
bool SCH_INSPECTION_TOOL::Init()
|
bool SCH_INSPECTION_TOOL::Init()
|
||||||
{
|
{
|
||||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
||||||
m_selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
m_selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||||
|
|
||||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||||
|
@ -84,7 +84,7 @@ void SCH_INSPECTION_TOOL::Reset( RESET_REASON aReason )
|
||||||
{
|
{
|
||||||
m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
|
m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
|
||||||
m_controls = getViewControls();
|
m_controls = getViewControls();
|
||||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ private:
|
||||||
SCH_SELECTION_TOOL* m_selectionTool;
|
SCH_SELECTION_TOOL* m_selectionTool;
|
||||||
KIGFX::SCH_VIEW* m_view;
|
KIGFX::SCH_VIEW* m_view;
|
||||||
KIGFX::VIEW_CONTROLS* m_controls;
|
KIGFX::VIEW_CONTROLS* m_controls;
|
||||||
SCH_EDIT_FRAME* m_frame;
|
SCH_BASE_FRAME* m_frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SCH_INSPECTION_TOOL_H */
|
#endif /* SCH_INSPECTION_TOOL_H */
|
||||||
|
|
|
@ -45,7 +45,10 @@
|
||||||
#include <sch_painter.h>
|
#include <sch_painter.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tools/sch_actions.h>
|
#include <tools/sch_actions.h>
|
||||||
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/zoom_tool.h>
|
||||||
|
|
||||||
// Save previous component library viewer state.
|
// Save previous component library viewer state.
|
||||||
wxString LIB_VIEW_FRAME::m_libraryName;
|
wxString LIB_VIEW_FRAME::m_libraryName;
|
||||||
|
@ -218,6 +221,28 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LIB_VIEW_FRAME::setupTools()
|
||||||
|
{
|
||||||
|
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||||
|
m_toolManager = new TOOL_MANAGER;
|
||||||
|
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
|
||||||
|
GetCanvas()->GetViewControls(), this );
|
||||||
|
m_actions = new SCH_ACTIONS();
|
||||||
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||||
|
|
||||||
|
// Register tools
|
||||||
|
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||||
|
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||||
|
|
||||||
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
|
// Run the selection tool, it is supposed to be always active
|
||||||
|
m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
|
||||||
|
|
||||||
|
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_VIEW_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
|
void LIB_VIEW_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
|
||||||
{
|
{
|
||||||
m_unit = aUnit > 0 ? aUnit : 1;
|
m_unit = aUnit > 0 ? aUnit : 1;
|
||||||
|
|
|
@ -48,8 +48,7 @@ public:
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param aKiway
|
* @param aKiway
|
||||||
* @param aParent = the parent frame
|
* @param aParent = the parent frame
|
||||||
* @param aFrameType must be given either FRAME_SCH_LIB_VIEWER or
|
* @param aFrameType must be either FRAME_SCH_LIB_VIEWER or FRAME_SCH_LIB_VIEWER_MODAL
|
||||||
* FRAME_SCH_LIB_VIEWER_MODAL
|
|
||||||
* @param aLibrary = the library to open when starting (default = NULL)
|
* @param aLibrary = the library to open when starting (default = NULL)
|
||||||
*/
|
*/
|
||||||
LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||||
|
@ -83,6 +82,7 @@ public:
|
||||||
* exists)
|
* exists)
|
||||||
*/
|
*/
|
||||||
bool ReCreateListCmp();
|
bool ReCreateListCmp();
|
||||||
|
|
||||||
void DisplayLibInfos();
|
void DisplayLibInfos();
|
||||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
|
@ -157,6 +157,9 @@ public:
|
||||||
const BOX2I GetDocumentExtents() const override;
|
const BOX2I GetDocumentExtents() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Sets up the tool framework
|
||||||
|
void setupTools();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the frame is activated to reload the libraries and component lists
|
* Called when the frame is activated to reload the libraries and component lists
|
||||||
* that can be changed by the schematic editor or the library editor.
|
* that can be changed by the schematic editor or the library editor.
|
||||||
|
|
|
@ -46,7 +46,11 @@
|
||||||
#include <gal/graphics_abstraction_layer.h>
|
#include <gal/graphics_abstraction_layer.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/zoom_tool.h>
|
||||||
#include <tools/gerbview_actions.h>
|
#include <tools/gerbview_actions.h>
|
||||||
|
#include <tools/gerbview_selection_tool.h>
|
||||||
|
#include <tools/gerbview_control.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <gerbview_painter.h>
|
#include <gerbview_painter.h>
|
||||||
|
|
||||||
|
@ -1208,7 +1212,10 @@ void GERBVIEW_FRAME::setupTools()
|
||||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||||
|
|
||||||
// Register tools
|
// Register tools
|
||||||
m_actions->RegisterAllTools( m_toolManager );
|
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||||
|
m_toolManager->RegisterTool( new GERBVIEW_SELECTION_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new GERBVIEW_CONTROL );
|
||||||
|
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||||
m_toolManager->InitTools();
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
// Run the selection tool, it is supposed to be always active
|
// Run the selection tool, it is supposed to be always active
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
|
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
|
||||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -19,23 +19,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/common_tools.h>
|
|
||||||
#include <tool/zoom_tool.h>
|
|
||||||
#include <gerbview_id.h>
|
#include <gerbview_id.h>
|
||||||
|
|
||||||
#include "gerbview_actions.h"
|
#include "gerbview_actions.h"
|
||||||
#include "gerbview_selection_tool.h"
|
|
||||||
#include "gerbview_control.h"
|
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_ACTIONS::RegisterAllTools( TOOL_MANAGER* aToolManager )
|
|
||||||
{
|
|
||||||
aToolManager->RegisterTool( new COMMON_TOOLS );
|
|
||||||
aToolManager->RegisterTool( new GERBVIEW_SELECTION_TOOL );
|
|
||||||
aToolManager->RegisterTool( new GERBVIEW_CONTROL );
|
|
||||||
aToolManager->RegisterTool( new ZOOM_TOOL );
|
|
||||||
}
|
|
||||||
|
|
||||||
OPT<TOOL_EVENT> GERBVIEW_ACTIONS::TranslateLegacyId( int aId )
|
OPT<TOOL_EVENT> GERBVIEW_ACTIONS::TranslateLegacyId( int aId )
|
||||||
{
|
{
|
||||||
switch( aId )
|
switch( aId )
|
||||||
|
|
|
@ -118,9 +118,6 @@ public:
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
||||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::RegisterAllTools()
|
|
||||||
virtual void RegisterAllTools( TOOL_MANAGER* aToolManager ) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GERBVIEW_ACTIONS_H
|
#endif // __GERBVIEW_ACTIONS_H
|
||||||
|
|
|
@ -97,9 +97,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) = 0;
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) = 0;
|
||||||
|
|
||||||
///> Registers all valid tools for an application with the tool manager
|
|
||||||
virtual void RegisterAllTools( TOOL_MANAGER* aToolManager ) = 0;
|
|
||||||
|
|
||||||
///> Cursor control event types
|
///> Cursor control event types
|
||||||
enum CURSOR_EVENT_TYPE { CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT,
|
enum CURSOR_EVENT_TYPE { CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT,
|
||||||
CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_FAST_MOVE = 0x8000 };
|
CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_FAST_MOVE = 0x8000 };
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2013-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2013-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -20,11 +20,6 @@
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file pcb_edit_frame.cpp
|
|
||||||
* @brief PCB editor main frame implementation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
|
@ -70,8 +65,24 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tools/pcb_actions.h>
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/zoom_tool.h>
|
||||||
#include <tools/selection_tool.h>
|
#include <tools/selection_tool.h>
|
||||||
|
#include <tools/picker_tool.h>
|
||||||
|
#include <tools/edit_tool.h>
|
||||||
|
#include <tools/drawing_tool.h>
|
||||||
|
#include <tools/point_editor.h>
|
||||||
|
#include <tools/pcbnew_control.h>
|
||||||
|
#include <tools/pcb_editor_control.h>
|
||||||
|
#include <tools/placement_tool.h>
|
||||||
|
#include <tools/pad_tool.h>
|
||||||
|
#include <tools/microwave_tool.h>
|
||||||
|
#include <tools/position_relative_tool.h>
|
||||||
|
#include <tools/zone_filler_tool.h>
|
||||||
|
#include <tools/pcb_actions.h>
|
||||||
|
#include <router/router_tool.h>
|
||||||
|
#include <router/length_tuner_tool.h>
|
||||||
|
#include <autorouter/autoplacer_tool.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <executable_names.h>
|
#include <executable_names.h>
|
||||||
#include <eda_dockart.h>
|
#include <eda_dockart.h>
|
||||||
|
@ -81,6 +92,8 @@
|
||||||
|
|
||||||
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
|
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
|
||||||
#include <python_scripting.h>
|
#include <python_scripting.h>
|
||||||
|
#include <tool/common_tools.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -556,7 +569,23 @@ void PCB_EDIT_FRAME::setupTools()
|
||||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||||
|
|
||||||
// Register tools
|
// Register tools
|
||||||
m_actions->RegisterAllTools( m_toolManager );
|
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||||
|
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new PICKER_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new ROUTER_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new LENGTH_TUNER_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 );
|
||||||
|
m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL );
|
||||||
|
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new MICROWAVE_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new ZONE_FILLER_TOOL );
|
||||||
|
m_toolManager->RegisterTool( new AUTOPLACE_TOOL );
|
||||||
m_toolManager->InitTools();
|
m_toolManager->InitTools();
|
||||||
|
|
||||||
// Run the selection tool, it is supposed to be always active
|
// Run the selection tool, it is supposed to be always active
|
||||||
|
|
|
@ -26,24 +26,7 @@
|
||||||
#include "pcb_actions.h"
|
#include "pcb_actions.h"
|
||||||
#include <pcbnew_id.h>
|
#include <pcbnew_id.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/common_tools.h>
|
|
||||||
#include <tool/zoom_tool.h>
|
|
||||||
#include <tools/selection_tool.h>
|
|
||||||
#include <tools/picker_tool.h>
|
|
||||||
#include <tools/edit_tool.h>
|
|
||||||
#include <tools/drawing_tool.h>
|
|
||||||
#include <tools/point_editor.h>
|
|
||||||
#include <tools/pcbnew_control.h>
|
|
||||||
#include <tools/pcb_editor_control.h>
|
|
||||||
#include <tools/placement_tool.h>
|
|
||||||
#include <tools/pad_tool.h>
|
|
||||||
#include <tools/microwave_tool.h>
|
|
||||||
#include <tools/position_relative_tool.h>
|
|
||||||
#include <tools/zone_filler_tool.h>
|
|
||||||
#include <tools/pcb_actions.h>
|
#include <tools/pcb_actions.h>
|
||||||
#include <router/router_tool.h>
|
|
||||||
#include <router/length_tuner_tool.h>
|
|
||||||
#include <autorouter/autoplacer_tool.h>
|
|
||||||
|
|
||||||
|
|
||||||
OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
|
OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
|
||||||
|
@ -256,25 +239,3 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
|
||||||
|
|
||||||
return OPT<TOOL_EVENT>();
|
return OPT<TOOL_EVENT>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_ACTIONS::RegisterAllTools( TOOL_MANAGER* aToolManager )
|
|
||||||
{
|
|
||||||
aToolManager->RegisterTool( new COMMON_TOOLS );
|
|
||||||
aToolManager->RegisterTool( new SELECTION_TOOL );
|
|
||||||
aToolManager->RegisterTool( new ZOOM_TOOL );
|
|
||||||
aToolManager->RegisterTool( new PICKER_TOOL );
|
|
||||||
aToolManager->RegisterTool( new ROUTER_TOOL );
|
|
||||||
aToolManager->RegisterTool( new LENGTH_TUNER_TOOL );
|
|
||||||
aToolManager->RegisterTool( new EDIT_TOOL );
|
|
||||||
aToolManager->RegisterTool( new PAD_TOOL );
|
|
||||||
aToolManager->RegisterTool( new DRAWING_TOOL );
|
|
||||||
aToolManager->RegisterTool( new POINT_EDITOR );
|
|
||||||
aToolManager->RegisterTool( new PCBNEW_CONTROL );
|
|
||||||
aToolManager->RegisterTool( new PCB_EDITOR_CONTROL );
|
|
||||||
aToolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
|
|
||||||
aToolManager->RegisterTool( new MICROWAVE_TOOL );
|
|
||||||
aToolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
|
|
||||||
aToolManager->RegisterTool( new ZONE_FILLER_TOOL );
|
|
||||||
aToolManager->RegisterTool( new AUTOPLACE_TOOL );
|
|
||||||
}
|
|
||||||
|
|
|
@ -346,9 +346,6 @@ public:
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
||||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::RegisterAllTools()
|
|
||||||
virtual void RegisterAllTools( TOOL_MANAGER* aToolManager ) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -107,10 +107,6 @@ public:
|
||||||
{
|
{
|
||||||
return NULLOPT;
|
return NULLOPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterAllTools( TOOL_MANAGER* aToolManager ) override
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void PCB_TEST_FRAME::OnMenuFileOpen( wxCommandEvent& WXUNUSED( event ) )
|
void PCB_TEST_FRAME::OnMenuFileOpen( wxCommandEvent& WXUNUSED( event ) )
|
||||||
|
|
Loading…
Reference in New Issue