Insert EE_TOOL_BASE under SchEdit and LibEdit tools, and fix errant rename scope which clobbered PCBNew's PICKER_TOOL.
This commit is contained in:
parent
5c39521149
commit
f602ccd814
|
@ -224,20 +224,20 @@ set( EESCHEMA_SRCS
|
|||
netlist_exporters/netlist_exporter_orcadpcb2.cpp
|
||||
netlist_exporters/netlist_exporter_pspice.cpp
|
||||
|
||||
tools/ee_actions.cpp
|
||||
tools/ee_inspection_tool.cpp
|
||||
tools/ee_picker_tool.cpp
|
||||
tools/ee_point_editor.cpp
|
||||
tools/ee_selection_tool.cpp
|
||||
tools/lib_drawing_tools.cpp
|
||||
tools/lib_edit_tool.cpp
|
||||
tools/lib_move_tool.cpp
|
||||
tools/lib_pin_tool.cpp
|
||||
tools/ee_point_editor.cpp
|
||||
tools/ee_actions.cpp
|
||||
tools/sch_drawing_tools.cpp
|
||||
tools/sch_edit_tool.cpp
|
||||
tools/sch_editor_control.cpp
|
||||
tools/ee_inspection_tool.cpp
|
||||
tools/sch_wire_bus_tool.cpp
|
||||
tools/sch_move_tool.cpp
|
||||
tools/ee_picker_tool.cpp
|
||||
tools/ee_selection_tool.cpp
|
||||
tools/selection.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -476,7 +476,8 @@ public:
|
|||
* Because a component in library editor does not have a lot of primitives,
|
||||
* the full data is duplicated. It is not worth to try to optimize this save function.
|
||||
*/
|
||||
void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType = UR_LIBEDIT );
|
||||
void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType = UR_LIBEDIT,
|
||||
bool aAppend = false );
|
||||
|
||||
void RollbackPartFromUndo();
|
||||
|
||||
|
|
|
@ -34,8 +34,10 @@
|
|||
#include <tools/ee_actions.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
|
||||
void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType )
|
||||
void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType, bool aAppend )
|
||||
{
|
||||
wxASSERT_MSG( !aAppend, "Append not needed/supported for LibEdit" );
|
||||
|
||||
LIB_PART* CopyItem;
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
|
||||
|
|
|
@ -50,21 +50,14 @@ TOOL_ACTION EE_ACTIONS::showMarkerInfo( "eeschema.InspectionTool.showMarkerInfo"
|
|||
|
||||
|
||||
EE_INSPECTION_TOOL::EE_INSPECTION_TOOL()
|
||||
: TOOL_INTERACTIVE( "eeschema.InspectionTool" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_view( nullptr ),
|
||||
m_controls( nullptr ),
|
||||
m_frame( nullptr )
|
||||
: EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.InspectionTool" )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool EE_INSPECTION_TOOL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
auto singleMarkerCondition = SELECTION_CONDITIONS::OnlyType( SCH_MARKER_T )
|
||||
&& SELECTION_CONDITIONS::Count( 1 );
|
||||
|
@ -80,14 +73,6 @@ bool EE_INSPECTION_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
void EE_INSPECTION_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
|
||||
m_controls = getViewControls();
|
||||
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::ComponentsOnly );
|
||||
|
|
|
@ -21,19 +21,19 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef SCH_INSPECTION_TOOL_H
|
||||
#define SCH_INSPECTION_TOOL_H
|
||||
#ifndef EE_INSPECTION_TOOL_H
|
||||
#define EE_INSPECTION_TOOL_H
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <sch_base_frame.h>
|
||||
|
||||
|
||||
class EE_SELECTION_TOOL;
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_BASE_FRAME;
|
||||
|
||||
|
||||
class EE_INSPECTION_TOOL : public TOOL_INTERACTIVE
|
||||
class EE_INSPECTION_TOOL : public EE_TOOL_BASE<SCH_BASE_FRAME>
|
||||
{
|
||||
public:
|
||||
EE_INSPECTION_TOOL();
|
||||
|
@ -42,9 +42,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
///> @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
int ShowDatasheet( const TOOL_EVENT& aEvent );
|
||||
int ShowMarkerInfo( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -53,12 +50,6 @@ public:
|
|||
private:
|
||||
///> @copydoc TOOL_INTERACTIVE::setTransitions();
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
KIGFX::SCH_VIEW* m_view;
|
||||
KIGFX::VIEW_CONTROLS* m_controls;
|
||||
SCH_BASE_FRAME* m_frame;
|
||||
};
|
||||
|
||||
#endif /* SCH_INSPECTION_TOOL_H */
|
||||
#endif /* EE_INSPECTION_TOOL_H */
|
||||
|
|
|
@ -31,9 +31,9 @@ TOOL_ACTION EE_ACTIONS::pickerTool( "eeschema.Picker", AS_GLOBAL, 0, "", "", NUL
|
|||
|
||||
|
||||
EE_PICKER_TOOL::EE_PICKER_TOOL()
|
||||
: TOOL_INTERACTIVE( "eeschema.Picker" )
|
||||
: EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.Picker" )
|
||||
{
|
||||
reset();
|
||||
resetPicker();
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,7 +122,7 @@ int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
reset();
|
||||
resetPicker();
|
||||
controls->ForceCursorPosition( false );
|
||||
getEditFrame<SCH_BASE_FRAME>()->SetNoToolSelected();
|
||||
|
||||
|
@ -136,7 +136,7 @@ void EE_PICKER_TOOL::setTransitions()
|
|||
}
|
||||
|
||||
|
||||
void EE_PICKER_TOOL::reset()
|
||||
void EE_PICKER_TOOL::resetPicker()
|
||||
{
|
||||
m_cursorCapture = false;
|
||||
m_autoPanning = false;
|
||||
|
|
|
@ -21,15 +21,17 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef SCH_PICKER_TOOL_H
|
||||
#define SCH_PICKER_TOOL_H
|
||||
#ifndef EE_PICKER_TOOL_H
|
||||
#define EE_PICKER_TOOL_H
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
|
||||
|
||||
class EE_PICKER_TOOL : public TOOL_INTERACTIVE
|
||||
class SCH_BASE_FRAME;
|
||||
|
||||
|
||||
class EE_PICKER_TOOL : public EE_TOOL_BASE<SCH_BASE_FRAME>
|
||||
{
|
||||
public:
|
||||
EE_PICKER_TOOL();
|
||||
|
@ -49,9 +51,6 @@ public:
|
|||
EXCEPTION_CANCEL
|
||||
};
|
||||
|
||||
///> @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override {}
|
||||
|
||||
///> Main event loop.
|
||||
int Main( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -98,6 +97,13 @@ public:
|
|||
m_finalizeHandler = aHandler;
|
||||
}
|
||||
|
||||
private:
|
||||
///> Reinitializes tool to its initial state.
|
||||
void resetPicker();
|
||||
|
||||
///> Applies the requested VIEW_CONTROLS settings.
|
||||
void setControls();
|
||||
|
||||
///> @copydoc TOOL_INTERACTIVE::setTransitions();
|
||||
void setTransitions() override;
|
||||
|
||||
|
@ -110,12 +116,6 @@ private:
|
|||
OPT<FINALIZE_HANDLER> m_finalizeHandler;
|
||||
|
||||
OPT<VECTOR2D> m_picked;
|
||||
|
||||
///> Reinitializes tool to its initial state.
|
||||
void reset();
|
||||
|
||||
///> Applies the requested VIEW_CONTROLS settings.
|
||||
void setControls();
|
||||
};
|
||||
|
||||
#endif /* SCH_PICKER_TOOL_H */
|
||||
#endif /* EE_PICKER_TOOL_H */
|
||||
|
|
|
@ -198,9 +198,7 @@ private:
|
|||
|
||||
|
||||
EE_POINT_EDITOR::EE_POINT_EDITOR() :
|
||||
TOOL_INTERACTIVE( "eeschema.PointEditor" ),
|
||||
m_frame( nullptr ),
|
||||
m_selectionTool( nullptr ),
|
||||
EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.PointEditor" ),
|
||||
m_editedPoint( nullptr )
|
||||
{
|
||||
}
|
||||
|
@ -208,20 +206,15 @@ EE_POINT_EDITOR::EE_POINT_EDITOR() :
|
|||
|
||||
void EE_POINT_EDITOR::Reset( RESET_REASON aReason )
|
||||
{
|
||||
EE_TOOL_BASE::Reset( aReason );
|
||||
|
||||
m_editPoints.reset();
|
||||
getViewControls()->SetAutoPan( false );
|
||||
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
||||
m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool EE_POINT_EDITOR::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
||||
m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
auto& menu = m_selectionTool->GetToolMenu().GetMenu();
|
||||
menu.AddItem( EE_ACTIONS::pointEditorAddCorner,
|
||||
|
@ -530,7 +523,7 @@ void EE_POINT_EDITOR::updateItem() const
|
|||
break;
|
||||
}
|
||||
|
||||
getView()->Update( item, KIGFX::GEOMETRY );
|
||||
updateView( item );
|
||||
m_frame->SetMsgPanel( item );
|
||||
}
|
||||
|
||||
|
@ -701,7 +694,7 @@ int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
|
|||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
|
||||
polyLine->AddCorner( mapCoords( cursorPos ) );
|
||||
|
||||
m_frame->RefreshItem( polyLine );
|
||||
updateView( polyLine );
|
||||
updatePoints();
|
||||
|
||||
return 0;
|
||||
|
@ -720,7 +713,7 @@ int EE_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
|
|||
|
||||
polyLine->RemoveCorner( getEditedPointIndex() );
|
||||
|
||||
m_frame->RefreshItem( polyLine );
|
||||
updateView( polyLine );
|
||||
updatePoints();
|
||||
|
||||
return 0;
|
||||
|
@ -738,25 +731,23 @@ void EE_POINT_EDITOR::saveItemsToUndo()
|
|||
{
|
||||
if( m_isLibEdit )
|
||||
{
|
||||
LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
|
||||
editFrame->SaveCopyInUndoList( m_editPoints->GetParent()->GetParent() );
|
||||
saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UR_LIBEDIT );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( m_frame );
|
||||
editFrame->SaveCopyInUndoList( (SCH_ITEM*) m_editPoints->GetParent(), UR_CHANGED );
|
||||
saveCopyInUndoList( (SCH_ITEM*) m_editPoints->GetParent(), UR_CHANGED );
|
||||
|
||||
if( m_editPoints->GetParent()->Type() == SCH_LINE_T )
|
||||
{
|
||||
EDA_ITEM* connection = m_editPoints->Point( LINE_START ).GetConnection();
|
||||
|
||||
if( connection )
|
||||
editFrame->SaveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
|
||||
saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
|
||||
|
||||
connection = m_editPoints->Point( LINE_END ).GetConnection();
|
||||
|
||||
if( connection )
|
||||
editFrame->SaveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
|
||||
saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef SCH_POINT_EDITOR_H
|
||||
#define SCH_POINT_EDITOR_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <tool/edit_points.h>
|
||||
#include <tool/selection.h>
|
||||
|
||||
|
@ -36,7 +36,7 @@ class SCH_BASE_FRAME;
|
|||
*
|
||||
* Tool that displays edit points allowing to modify items by dragging the points.
|
||||
*/
|
||||
class EE_POINT_EDITOR : public TOOL_INTERACTIVE
|
||||
class EE_POINT_EDITOR : public EE_TOOL_BASE<SCH_BASE_FRAME>
|
||||
{
|
||||
public:
|
||||
EE_POINT_EDITOR();
|
||||
|
@ -94,10 +94,6 @@ private:
|
|||
void rollbackFromUndo();
|
||||
|
||||
private:
|
||||
SCH_BASE_FRAME* m_frame;
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
bool m_isLibEdit;
|
||||
|
||||
///> Currently edited point, NULL if there is none.
|
||||
EDIT_POINT* m_editedPoint;
|
||||
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef EE_TOOL_BASE_H
|
||||
#define EE_TOOL_BASE_H
|
||||
|
||||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <tool/actions.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <sch_view.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <lib_edit_frame.h>
|
||||
#include <undo_redo_container.h>
|
||||
|
||||
|
||||
class SELECTION;
|
||||
|
||||
/**
|
||||
* Class EE_TOOL_BASE
|
||||
*
|
||||
* A foundation class for a tool operating on a schematic or symbol
|
||||
**/
|
||||
|
||||
|
||||
template <class T>
|
||||
class EE_TOOL_BASE : public TOOL_INTERACTIVE
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Creates a tool with given name. The name must be unique.
|
||||
*/
|
||||
EE_TOOL_BASE( const std::string& aName ) :
|
||||
TOOL_INTERACTIVE ( aName ),
|
||||
m_frame( nullptr ),
|
||||
m_view( nullptr ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_isLibEdit( false ),
|
||||
m_menu( *this )
|
||||
{};
|
||||
|
||||
virtual ~EE_TOOL_BASE() {};
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override
|
||||
{
|
||||
m_frame = getEditFrame<T>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
|
||||
|
||||
// A basic context manu. Many (but not all) tools will choose to override this.
|
||||
|
||||
auto& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
// cancel current tool goes in main context menu at the top if present
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, SELECTION_CONDITIONS::ShowAlways, 1 );
|
||||
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1 );
|
||||
|
||||
// Finally, add the standard zoom/grid items
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override
|
||||
{
|
||||
if( aReason == MODEL_RELOAD )
|
||||
{
|
||||
// Init variables used by every drawing tool
|
||||
m_frame = getEditFrame<T>();
|
||||
m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
|
||||
}
|
||||
|
||||
m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
|
||||
}
|
||||
|
||||
///> Get the tool's top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
protected:
|
||||
///> Similar to getView()->Update(), but handles items that are redrawn by their parents.
|
||||
void updateView( EDA_ITEM* aItem ) const
|
||||
{
|
||||
KICAD_T itemType = aItem->Type();
|
||||
|
||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||
getView()->Update( aItem->GetParent() );
|
||||
|
||||
getView()->Update( aItem );
|
||||
}
|
||||
|
||||
|
||||
///> Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their
|
||||
///> parents.
|
||||
void saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO_T aType, bool aAppend = false )
|
||||
{
|
||||
KICAD_T itemType = aItem->Type();
|
||||
|
||||
if( m_isLibEdit )
|
||||
{
|
||||
LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
|
||||
editFrame->SaveCopyInUndoList( (LIB_ITEM*) aItem, aType, aAppend );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
|
||||
|
||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem->GetParent(), UR_CHANGED, aAppend );
|
||||
else
|
||||
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem, aType, aAppend );
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
T* m_frame;
|
||||
KIGFX::SCH_VIEW* m_view;
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
bool m_isLibEdit;
|
||||
|
||||
/// Menu model displayed by the tool.
|
||||
TOOL_MENU m_menu;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -21,8 +21,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "lib_drawing_tools.h"
|
||||
#include "lib_pin_tool.h"
|
||||
#include <ee_actions.h>
|
||||
#include <lib_edit_frame.h>
|
||||
#include <sch_view.h>
|
||||
|
@ -36,6 +34,8 @@
|
|||
#include <view/view.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <tools/lib_drawing_tools.h>
|
||||
#include <tools/lib_pin_tool.h>
|
||||
#include <ee_hotkeys.h>
|
||||
#include <class_libentry.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -91,12 +91,7 @@ static void* g_lastPinWeakPtr;
|
|||
|
||||
|
||||
LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS() :
|
||||
TOOL_INTERACTIVE( "libedit.InteractiveDrawing" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_view( nullptr ),
|
||||
m_controls( nullptr ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this )
|
||||
EE_TOOL_BASE<LIB_EDIT_FRAME>( "libedit.InteractiveDrawing" )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -108,38 +103,19 @@ LIB_DRAWING_TOOLS::~LIB_DRAWING_TOOLS()
|
|||
|
||||
bool LIB_DRAWING_TOOLS::Init()
|
||||
{
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
auto isDrawingCondition = [] ( const SELECTION& aSel ) {
|
||||
LIB_ITEM* item = (LIB_ITEM*) aSel.Front();
|
||||
return item && item->IsNew();
|
||||
};
|
||||
|
||||
auto& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
//
|
||||
// Build the drawing tool menu
|
||||
//
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, EE_CONDITIONS::ShowAlways, 1 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::finishDrawing, isDrawingCondition, 2 );
|
||||
|
||||
ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
m_menu.GetMenu().AddItem( EE_ACTIONS::finishDrawing, isDrawingCondition, 2 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void LIB_DRAWING_TOOLS::Reset( RESET_REASON aReason )
|
||||
{
|
||||
// Init variables used by every drawing tool
|
||||
m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
|
||||
m_controls = getViewControls();
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
int LIB_DRAWING_TOOLS::PlacePin( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add pin" ) );
|
||||
|
@ -157,18 +133,18 @@ int LIB_DRAWING_TOOLS::PlaceText( const TOOL_EVENT& aEvent )
|
|||
int LIB_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
|
||||
{
|
||||
LIB_PIN_TOOL* pinTool = aType == LIB_PIN_T ? m_toolMgr->GetTool<LIB_PIN_TOOL>() : nullptr;
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||
VECTOR2I cursorPos;
|
||||
EDA_ITEM* item = nullptr;
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
m_controls->ShowCursor( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
Activate();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
while( OPT_TOOL_EVENT evt = Wait() )
|
||||
{
|
||||
cursorPos = m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
|
||||
{
|
||||
|
@ -240,7 +216,7 @@ int LIB_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
|
|||
m_selectionTool->AddItemToSel( item );
|
||||
}
|
||||
|
||||
m_controls->SetCursorPosition( cursorPos, false );
|
||||
getViewControls()->SetCursorPosition( cursorPos, false );
|
||||
}
|
||||
|
||||
// ... and second click places:
|
||||
|
@ -285,8 +261,8 @@ int LIB_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
|
|||
}
|
||||
|
||||
// Enable autopanning and cursor capture only when there is an item to be placed
|
||||
m_controls->SetAutoPan( !!item );
|
||||
m_controls->CaptureCursor( !!item );
|
||||
getViewControls()->SetAutoPan( !!item );
|
||||
getViewControls()->CaptureCursor( !!item );
|
||||
}
|
||||
|
||||
m_frame->SetNoToolSelected();
|
||||
|
@ -311,7 +287,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_frame->SetToolID( ID_LIBEDIT_BODY_RECT_BUTT, wxCURSOR_PENCIL, _( "Draw Rectangle" ) );
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
m_controls->ShowCursor( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
Activate();
|
||||
|
||||
|
@ -321,7 +297,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
// Main loop: keep receiving events
|
||||
while( auto evt = Wait() )
|
||||
{
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
|
||||
{
|
||||
|
@ -412,8 +388,8 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Enable autopanning and cursor capture only when there is a shape being drawn
|
||||
m_controls->SetAutoPan( !!item );
|
||||
m_controls->CaptureCursor( !!item );
|
||||
getViewControls()->SetAutoPan( !!item );
|
||||
getViewControls()->CaptureCursor( !!item );
|
||||
}
|
||||
|
||||
m_frame->SetNoToolSelected();
|
||||
|
@ -426,8 +402,8 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
m_frame->SetToolID( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxCURSOR_PENCIL, _( "Move symbol anchor" ) );
|
||||
|
||||
m_controls->ShowCursor( true );
|
||||
m_controls->SetSnapping( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
getViewControls()->SetSnapping( true );
|
||||
|
||||
Activate();
|
||||
|
||||
|
@ -445,7 +421,7 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
if( !part )
|
||||
continue;
|
||||
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
wxPoint offset( -cursorPos.x, cursorPos.y );
|
||||
|
||||
part->SetOffset( offset );
|
||||
|
|
|
@ -24,14 +24,10 @@
|
|||
#ifndef LIB_DRAWING_TOOLS_H
|
||||
#define LIB_DRAWING_TOOLS_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <core/optional.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
|
||||
|
||||
class LIB_EDIT_FRAME;
|
||||
class EE_SELECTION_TOOL;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -40,7 +36,7 @@ class EE_SELECTION_TOOL;
|
|||
* Tool responsible for drawing/placing items (body outlines, pins, etc.)
|
||||
*/
|
||||
|
||||
class LIB_DRAWING_TOOLS : public TOOL_INTERACTIVE
|
||||
class LIB_DRAWING_TOOLS : public EE_TOOL_BASE<LIB_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
LIB_DRAWING_TOOLS();
|
||||
|
@ -49,12 +45,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
int PlacePin( const TOOL_EVENT& aEvent );
|
||||
int PlaceText( const TOOL_EVENT& aEvent );
|
||||
int DrawShape( const TOOL_EVENT& aEvent );
|
||||
|
@ -68,14 +58,6 @@ private:
|
|||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
KIGFX::SCH_VIEW* m_view;
|
||||
KIGFX::VIEW_CONTROLS* m_controls;
|
||||
LIB_EDIT_FRAME* m_frame;
|
||||
|
||||
TOOL_MENU m_menu;
|
||||
};
|
||||
|
||||
#endif /* LIB_DRAWING_TOOLS_H */
|
||||
|
|
|
@ -43,11 +43,9 @@
|
|||
#include <sch_legacy_plugin.h>
|
||||
#include "lib_edit_tool.h"
|
||||
|
||||
|
||||
LIB_EDIT_TOOL::LIB_EDIT_TOOL() :
|
||||
TOOL_INTERACTIVE( "libedit.InteractiveEdit" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this )
|
||||
EE_TOOL_BASE( "libedit.InteractiveEdit" )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -59,12 +57,11 @@ LIB_EDIT_TOOL::~LIB_EDIT_TOOL()
|
|||
|
||||
bool LIB_EDIT_TOOL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
LIB_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<LIB_DRAWING_TOOLS>();
|
||||
LIB_MOVE_TOOL* moveTool = m_toolMgr->GetTool<LIB_MOVE_TOOL>();
|
||||
|
||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||
wxASSERT_MSG( drawingTools, "libedit.InteractiveDrawing tool is not available" );
|
||||
|
||||
//
|
||||
|
@ -75,18 +72,18 @@ bool LIB_EDIT_TOOL::Init()
|
|||
CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
|
||||
|
||||
moveMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
|
||||
moveMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::NotEmpty );
|
||||
moveMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::NotEmpty );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::NotEmpty );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorY, EE_CONDITIONS::NotEmpty );
|
||||
moveMenu.AddItem( EE_ACTIONS::duplicate, EE_CONDITIONS::NotEmpty );
|
||||
moveMenu.AddItem( EE_ACTIONS::doDelete, EE_CONDITIONS::NotEmpty );
|
||||
moveMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorY, EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( EE_ACTIONS::duplicate, EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( EE_ACTIONS::doDelete, EE_CONDITIONS::NotEmpty, 200 );
|
||||
|
||||
moveMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ) );
|
||||
moveMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
|
||||
|
||||
moveMenu.AddSeparator( EE_CONDITIONS::IdleSelection );
|
||||
moveMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection );
|
||||
moveMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection );
|
||||
moveMenu.AddSeparator( EE_CONDITIONS::IdleSelection, 300 );
|
||||
moveMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
|
||||
moveMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -116,25 +113,15 @@ bool LIB_EDIT_TOOL::Init()
|
|||
|
||||
selToolMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
|
||||
|
||||
selToolMenu.AddSeparator( EE_CONDITIONS::Idle, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::paste, EE_CONDITIONS::Idle, 200 );
|
||||
selToolMenu.AddSeparator( EE_CONDITIONS::Idle, 300 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::paste, EE_CONDITIONS::Idle, 300 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void LIB_EDIT_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
if( aReason == MODEL_RELOAD )
|
||||
{
|
||||
// Init variables used by every drawing tool
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int LIB_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SELECTION& selection = m_selectionTool->RequestSelection();
|
||||
|
@ -147,7 +134,7 @@ int LIB_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
||||
|
||||
if( !item->IsMoving() )
|
||||
m_frame->SaveCopyInUndoList( m_frame->GetCurPart() );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
rotPoint = item->GetPosition();
|
||||
|
@ -187,7 +174,7 @@ int LIB_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
||||
|
||||
if( !item->IsMoving() )
|
||||
m_frame->SaveCopyInUndoList( m_frame->GetCurPart() );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
mirrorPoint = item->GetPosition();
|
||||
|
@ -249,7 +236,7 @@ int LIB_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
if( !selection.Front()->IsMoving() )
|
||||
m_frame->SaveCopyInUndoList( m_frame->GetCurPart() );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
|
||||
EDA_ITEMS newItems;
|
||||
|
||||
|
@ -283,7 +270,7 @@ int LIB_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
// Don't leave a freed pointer in the selection
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_frame->SaveCopyInUndoList( part );
|
||||
saveCopyInUndoList( part, UR_LIBEDIT );
|
||||
|
||||
for( EDA_ITEM* item : items )
|
||||
{
|
||||
|
@ -375,7 +362,7 @@ int LIB_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Save copy for undo if not in edit (edit command already handle the save copy)
|
||||
if( !item->InEditMode() )
|
||||
m_frame->SaveCopyInUndoList( item->GetParent() );
|
||||
saveCopyInUndoList( item->GetParent(), UR_LIBEDIT );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -430,7 +417,7 @@ void LIB_EDIT_TOOL::editGraphicProperties( LIB_ITEM* aItem )
|
|||
|
||||
aItem->SetWidth( dialog.GetWidth() );
|
||||
|
||||
m_frame->GetCanvas()->GetView()->Update( aItem );
|
||||
updateView( aItem );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify( );
|
||||
|
||||
|
@ -454,7 +441,7 @@ void LIB_EDIT_TOOL::editTextProperties( LIB_ITEM* aItem )
|
|||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
m_frame->GetCanvas()->GetView()->Update( aItem );
|
||||
updateView( aItem );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify( );
|
||||
}
|
||||
|
@ -488,9 +475,9 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
|||
bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
|
||||
|
||||
if( renamed )
|
||||
m_frame->SaveCopyInUndoList( parent, UR_LIB_RENAME );
|
||||
saveCopyInUndoList( parent, UR_LIB_RENAME );
|
||||
else
|
||||
m_frame->SaveCopyInUndoList( parent );
|
||||
saveCopyInUndoList( parent, UR_LIBEDIT );
|
||||
|
||||
dlg.UpdateField( aField );
|
||||
|
||||
|
@ -501,7 +488,7 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->GetCanvas()->GetView()->Update( aField );
|
||||
updateView( aField );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify( );
|
||||
}
|
||||
|
@ -549,7 +536,7 @@ int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_frame->SaveCopyInUndoList( part );
|
||||
saveCopyInUndoList( part, UR_LIBEDIT );
|
||||
|
||||
DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, part );
|
||||
|
||||
|
|
|
@ -24,16 +24,13 @@
|
|||
#ifndef KICAD_LIB_EDIT_TOOL_H
|
||||
#define KICAD_LIB_EDIT_TOOL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
|
||||
|
||||
class LIB_EDIT_FRAME;
|
||||
class EE_SELECTION_TOOL;
|
||||
|
||||
|
||||
class LIB_EDIT_TOOL : public TOOL_INTERACTIVE
|
||||
class LIB_EDIT_TOOL : public EE_TOOL_BASE<LIB_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
LIB_EDIT_TOOL();
|
||||
|
@ -42,12 +39,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
int Rotate( const TOOL_EVENT& aEvent );
|
||||
int Mirror( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -78,13 +69,6 @@ private:
|
|||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
LIB_EDIT_FRAME* m_frame;
|
||||
|
||||
/// Menu model displayed by the tool.
|
||||
TOOL_MENU m_menu;
|
||||
};
|
||||
|
||||
#endif //KICAD_LIB_EDIT_TOOL_H
|
||||
|
|
|
@ -35,11 +35,7 @@
|
|||
|
||||
|
||||
LIB_MOVE_TOOL::LIB_MOVE_TOOL() :
|
||||
TOOL_INTERACTIVE( "libedit.InteractiveMove" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_controls( nullptr ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this ),
|
||||
EE_TOOL_BASE( "libedit.InteractiveMove" ),
|
||||
m_moveInProgress( false ),
|
||||
m_moveOffset( 0, 0 )
|
||||
{
|
||||
|
@ -53,21 +49,6 @@ LIB_MOVE_TOOL::~LIB_MOVE_TOOL()
|
|||
|
||||
bool LIB_MOVE_TOOL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||
|
||||
//
|
||||
// Build the tool menu
|
||||
//
|
||||
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, EE_CONDITIONS::ShowAlways, 1 );
|
||||
|
||||
ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
//
|
||||
// Add move actions to the selection tool menu
|
||||
//
|
||||
|
@ -81,14 +62,12 @@ bool LIB_MOVE_TOOL::Init()
|
|||
|
||||
void LIB_MOVE_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
EE_TOOL_BASE::Reset( aReason );
|
||||
|
||||
if( aReason == MODEL_RELOAD )
|
||||
{
|
||||
m_moveInProgress = false;
|
||||
m_moveOffset = { 0, 0 };
|
||||
|
||||
// Init variables used by every drawing tool
|
||||
m_controls = getViewControls();
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +99,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
VECTOR2I prevPos;
|
||||
|
||||
if( !selection.Front()->IsNew() )
|
||||
m_frame->SaveCopyInUndoList( m_frame->GetCurPart() );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
|
||||
// Main loop: keep receiving events
|
||||
do
|
||||
|
@ -172,7 +151,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
continue;
|
||||
|
||||
moveItem( item, delta );
|
||||
getView()->Update( item );
|
||||
updateView( item );
|
||||
}
|
||||
|
||||
selection.SetReferencePoint( m_cursor );
|
||||
|
@ -209,7 +188,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
for( EDA_ITEM* item : selection )
|
||||
{
|
||||
moveItem( item, delta );
|
||||
getView()->Update( item );
|
||||
updateView( item );
|
||||
}
|
||||
|
||||
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
||||
|
|
|
@ -24,16 +24,14 @@
|
|||
#ifndef KICAD_LIB_MOVE_TOOL_H
|
||||
#define KICAD_LIB_MOVE_TOOL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <sch_base_frame.h>
|
||||
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <lib_edit_frame.h>
|
||||
|
||||
class LIB_EDIT_FRAME;
|
||||
class EE_SELECTION_TOOL;
|
||||
|
||||
|
||||
class LIB_MOVE_TOOL : public TOOL_INTERACTIVE
|
||||
class LIB_MOVE_TOOL : public EE_TOOL_BASE<LIB_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
LIB_MOVE_TOOL();
|
||||
|
@ -45,9 +43,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
/**
|
||||
* Function Main()
|
||||
*
|
||||
|
@ -66,13 +61,6 @@ private:
|
|||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
KIGFX::VIEW_CONTROLS* m_controls;
|
||||
LIB_EDIT_FRAME* m_frame;
|
||||
|
||||
/// Menu model displayed by the tool.
|
||||
TOOL_MENU m_menu;
|
||||
|
||||
///> Flag determining if anything is being dragged right now
|
||||
bool m_moveInProgress;
|
||||
|
||||
|
|
|
@ -87,9 +87,7 @@ extern void IncrementLabelMember( wxString& name, int aIncrement );
|
|||
|
||||
|
||||
LIB_PIN_TOOL::LIB_PIN_TOOL() :
|
||||
TOOL_INTERACTIVE( "eeschema.PinEditing" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_frame( nullptr )
|
||||
EE_TOOL_BASE<LIB_EDIT_FRAME>( "eeschema.PinEditing" )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -101,10 +99,7 @@ LIB_PIN_TOOL::~LIB_PIN_TOOL()
|
|||
|
||||
bool LIB_PIN_TOOL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
auto singlePinCondition = EE_CONDITIONS::Count( 1 ) && EE_CONDITIONS::OnlyType( LIB_PIN_T );
|
||||
|
||||
|
@ -119,16 +114,6 @@ bool LIB_PIN_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
void LIB_PIN_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
if( aReason == MODEL_RELOAD )
|
||||
{
|
||||
// Init variables used by every drawing tool
|
||||
m_frame = getEditFrame<LIB_EDIT_FRAME>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LIB_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||
{
|
||||
aPin->EnableEditMode( true, !m_frame->SynchronizePins() );
|
||||
|
@ -320,7 +305,7 @@ int LIB_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
|
|||
if( !sourcePin )
|
||||
return 0;
|
||||
|
||||
m_frame->SaveCopyInUndoList( part );
|
||||
saveCopyInUndoList( part, UR_LIBEDIT );
|
||||
|
||||
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
||||
{
|
||||
|
|
|
@ -24,16 +24,14 @@
|
|||
#ifndef KICAD_LIB_PIN_TOOL_H
|
||||
#define KICAD_LIB_PIN_TOOL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <sch_base_frame.h>
|
||||
|
||||
|
||||
class LIB_EDIT_FRAME;
|
||||
class EE_SELECTION_TOOL;
|
||||
|
||||
|
||||
class LIB_PIN_TOOL : public TOOL_INTERACTIVE
|
||||
class LIB_PIN_TOOL : public EE_TOOL_BASE<LIB_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
LIB_PIN_TOOL();
|
||||
|
@ -42,9 +40,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
LIB_PIN* CreatePin( const VECTOR2I& aPosition, LIB_PART* aPart );
|
||||
LIB_PIN* RepeatPin( const LIB_PIN* aSourcePin );
|
||||
|
||||
|
@ -57,10 +52,6 @@ public:
|
|||
private:
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
LIB_EDIT_FRAME* m_frame;
|
||||
};
|
||||
|
||||
#endif //KICAD_LIB_PIN_TOOL_H
|
||||
|
|
|
@ -137,12 +137,7 @@ TOOL_ACTION EE_ACTIONS::addHierLabel( "eeschema.InteractiveEditing.addHierLabel"
|
|||
|
||||
|
||||
SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
|
||||
TOOL_INTERACTIVE( "eeschema.InteractiveDrawing" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_view( nullptr ),
|
||||
m_controls( nullptr ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this )
|
||||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -154,37 +149,19 @@ SCH_DRAWING_TOOLS::~SCH_DRAWING_TOOLS()
|
|||
|
||||
bool SCH_DRAWING_TOOLS::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
auto belowRootSheetCondition = [] ( const SELECTION& aSel ) {
|
||||
return g_CurrentSheet->Last() != g_RootSheet;
|
||||
};
|
||||
|
||||
auto& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
//
|
||||
// Build the drawing tool menu
|
||||
//
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, EE_CONDITIONS::ShowAlways, 1 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
|
||||
|
||||
ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SCH_DRAWING_TOOLS::Reset( RESET_REASON aReason )
|
||||
{
|
||||
// Init variables used by every drawing tool
|
||||
m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
|
||||
m_controls = getViewControls();
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
int SCH_DRAWING_TOOLS::AddJunction( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
@ -246,8 +223,8 @@ int SCH_DRAWING_TOOLS::PlacePower( const TOOL_EVENT& aEvent )
|
|||
int SCH_DRAWING_TOOLS::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTER* aFilter,
|
||||
SCH_BASE_FRAME::HISTORY_LIST aHistoryList )
|
||||
{
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||
m_controls->ShowCursor( true );
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
Activate();
|
||||
|
||||
|
@ -266,7 +243,7 @@ int SCH_DRAWING_TOOLS::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTE
|
|||
// Main loop: keep receiving events
|
||||
while( OPT_TOOL_EVENT evt = Wait() )
|
||||
{
|
||||
cursorPos = m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
|
||||
{
|
||||
|
@ -359,8 +336,8 @@ int SCH_DRAWING_TOOLS::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTE
|
|||
}
|
||||
|
||||
// Enable autopanning and cursor capture only when there is a module to be placed
|
||||
m_controls->SetAutoPan( !!aComponent );
|
||||
m_controls->CaptureCursor( !!aComponent );
|
||||
getViewControls()->SetAutoPan( !!aComponent );
|
||||
getViewControls()->CaptureCursor( !!aComponent );
|
||||
}
|
||||
|
||||
m_frame->SetNoToolSelected();
|
||||
|
@ -375,10 +352,10 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_frame->SetToolID( ID_ADD_IMAGE_BUTT, wxCURSOR_PENCIL, _( "Add image" ) );
|
||||
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
m_controls->ShowCursor( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
Activate();
|
||||
|
||||
|
@ -393,7 +370,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
// Main loop: keep receiving events
|
||||
while( OPT_TOOL_EVENT evt = Wait() )
|
||||
{
|
||||
cursorPos = m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
|
||||
{
|
||||
|
@ -452,7 +429,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_selectionTool->AddItemToSel( image );
|
||||
|
||||
m_controls->SetCursorPosition( cursorPos, false );
|
||||
getViewControls()->SetCursorPosition( cursorPos, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -480,8 +457,8 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Enable autopanning and cursor capture only when there is a module to be placed
|
||||
m_controls->SetAutoPan( !!image );
|
||||
m_controls->CaptureCursor( !!image );
|
||||
getViewControls()->SetAutoPan( !!image );
|
||||
getViewControls()->CaptureCursor( !!image );
|
||||
}
|
||||
|
||||
m_frame->SetNoToolSelected();
|
||||
|
@ -520,16 +497,18 @@ int SCH_DRAWING_TOOLS::PlaceBusBusEntry( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_DRAWING_TOOLS::doSingleClickPlace( KICAD_T aType )
|
||||
{
|
||||
wxPoint cursorPos;
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
m_controls->ShowCursor( true );
|
||||
m_controls->SetSnapping( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
getViewControls()->SetSnapping( true );
|
||||
|
||||
Activate();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
while( OPT_TOOL_EVENT evt = Wait() )
|
||||
{
|
||||
wxPoint cursorPos = (wxPoint)m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
|
||||
{
|
||||
|
@ -630,18 +609,18 @@ int SCH_DRAWING_TOOLS::PlaceSchematicText( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
|
||||
{
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||
VECTOR2I cursorPos;
|
||||
EDA_ITEM* item = nullptr;
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
m_controls->ShowCursor( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
Activate();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
while( OPT_TOOL_EVENT evt = Wait() )
|
||||
{
|
||||
cursorPos = m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
|
||||
{
|
||||
|
@ -708,7 +687,7 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
|
|||
m_selectionTool->AddItemToSel( item );
|
||||
}
|
||||
|
||||
m_controls->SetCursorPosition( cursorPos, false );
|
||||
getViewControls()->SetCursorPosition( cursorPos, false );
|
||||
}
|
||||
|
||||
// ... and second click places:
|
||||
|
@ -751,8 +730,8 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
|
|||
}
|
||||
|
||||
// Enable autopanning and cursor capture only when there is a module to be placed
|
||||
m_controls->SetAutoPan( !!item );
|
||||
m_controls->CaptureCursor( !!item );
|
||||
getViewControls()->SetAutoPan( !!item );
|
||||
getViewControls()->CaptureCursor( !!item );
|
||||
}
|
||||
|
||||
m_frame->SetNoToolSelected();
|
||||
|
@ -765,7 +744,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
m_frame->SetToolID( ID_SHEET_SYMBOL_BUTT, wxCURSOR_PENCIL, _( "Add sheet" ) );
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
m_controls->ShowCursor( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
SCH_SHEET* sheet = nullptr;
|
||||
|
||||
|
@ -774,7 +753,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
// Main loop: keep receiving events
|
||||
while( auto evt = Wait() )
|
||||
{
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
if( TOOL_EVT_UTILS::IsCancelInteractive( evt.get() ) )
|
||||
{
|
||||
|
@ -840,8 +819,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Enable autopanning and cursor capture only when there is a sheet to be placed
|
||||
m_controls->SetAutoPan( !!sheet );
|
||||
m_controls->CaptureCursor( !!sheet );
|
||||
getViewControls()->SetAutoPan( !!sheet );
|
||||
getViewControls()->CaptureCursor( !!sheet );
|
||||
}
|
||||
|
||||
m_frame->SetNoToolSelected();
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
#ifndef SCH_DRAWING_TOOLS_H
|
||||
#define SCH_DRAWING_TOOLS_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <core/optional.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <sch_base_frame.h>
|
||||
|
||||
|
||||
|
@ -44,7 +42,7 @@ class EE_SELECTION_TOOL;
|
|||
* Tool responsible for drawing/placing items (symbols, wires, busses, labels, etc.)
|
||||
*/
|
||||
|
||||
class SCH_DRAWING_TOOLS : public TOOL_INTERACTIVE
|
||||
class SCH_DRAWING_TOOLS : public EE_TOOL_BASE<SCH_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
SCH_DRAWING_TOOLS();
|
||||
|
@ -53,12 +51,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
int AddJunction( const TOOL_EVENT& aEvent );
|
||||
int AddLabel( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -90,14 +82,6 @@ private:
|
|||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
KIGFX::SCH_VIEW* m_view;
|
||||
KIGFX::VIEW_CONTROLS* m_controls;
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
|
||||
TOOL_MENU m_menu;
|
||||
};
|
||||
|
||||
#endif /* SCH_DRAWING_TOOLS_H */
|
||||
|
|
|
@ -235,10 +235,7 @@ private:
|
|||
|
||||
|
||||
SCH_EDIT_TOOL::SCH_EDIT_TOOL() :
|
||||
TOOL_INTERACTIVE( "eeschema.InteractiveEdit" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this )
|
||||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveEdit" )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -250,12 +247,11 @@ SCH_EDIT_TOOL::~SCH_EDIT_TOOL()
|
|||
|
||||
bool SCH_EDIT_TOOL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
SCH_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<SCH_DRAWING_TOOLS>();
|
||||
SCH_MOVE_TOOL* moveTool = m_toolMgr->GetTool<SCH_MOVE_TOOL>();
|
||||
|
||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||
wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
|
||||
|
||||
auto sheetTool = [ this ] ( const SELECTION& aSel ) {
|
||||
|
@ -464,16 +460,6 @@ bool SCH_EDIT_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
if( aReason == MODEL_RELOAD )
|
||||
{
|
||||
// Init variables used by every drawing tool
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::RotatableItems );
|
||||
|
@ -1300,28 +1286,6 @@ int SCH_EDIT_TOOL::CleanupSheetPins( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_TOOL::updateView( EDA_ITEM* aItem )
|
||||
{
|
||||
KICAD_T itemType = aItem->Type();
|
||||
|
||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||
getView()->Update( aItem->GetParent() );
|
||||
|
||||
getView()->Update( aItem );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_TOOL::saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO_T aType, bool aAppend )
|
||||
{
|
||||
KICAD_T itemType = aItem->Type();
|
||||
|
||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||
m_frame->SaveCopyInUndoList( (SCH_ITEM*) aItem->GetParent(), UR_CHANGED, aAppend );
|
||||
else
|
||||
m_frame->SaveCopyInUndoList( (SCH_ITEM*) aItem, aType, aAppend );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_TOOL::setTransitions()
|
||||
{
|
||||
Go( &SCH_EDIT_TOOL::Duplicate, EE_ACTIONS::duplicate.MakeEvent() );
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#ifndef KICAD_SCH_EDIT_TOOL_H
|
||||
#define KICAD_SCH_EDIT_TOOL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <sch_base_frame.h>
|
||||
|
||||
|
||||
|
@ -33,7 +32,7 @@ class SCH_EDIT_FRAME;
|
|||
class EE_SELECTION_TOOL;
|
||||
|
||||
|
||||
class SCH_EDIT_TOOL : public TOOL_INTERACTIVE
|
||||
class SCH_EDIT_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
SCH_EDIT_TOOL();
|
||||
|
@ -42,12 +41,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
int Rotate( const TOOL_EVENT& aEvent );
|
||||
int Mirror( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -77,22 +70,8 @@ public:
|
|||
int DeleteItemCursor( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
///> Similar to getView()->Update(), but handles items that are redrawn by their parents.
|
||||
void updateView( EDA_ITEM* );
|
||||
|
||||
///> Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their
|
||||
///> parents.
|
||||
void saveCopyInUndoList( EDA_ITEM*, UNDO_REDO_T aType, bool aAppend = false );
|
||||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
|
||||
/// Menu model displayed by the tool.
|
||||
TOOL_MENU m_menu;
|
||||
};
|
||||
|
||||
#endif //KICAD_SCH_EDIT_TOOL_H
|
||||
|
|
|
@ -108,9 +108,7 @@ TOOL_ACTION EE_ACTIONS::explicitCrossProbe( "eeschema.EditorControl.explicitCros
|
|||
|
||||
|
||||
SCH_EDITOR_CONTROL::SCH_EDITOR_CONTROL() :
|
||||
TOOL_INTERACTIVE( "eeschema.EditorControl" ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this )
|
||||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.EditorControl" )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -120,32 +118,6 @@ SCH_EDITOR_CONTROL::~SCH_EDITOR_CONTROL()
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDITOR_CONTROL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
bool SCH_EDITOR_CONTROL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
|
||||
auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
|
||||
};
|
||||
|
||||
auto& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
// "Cancel" goes at the top of the context menu when a tool is active
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
|
||||
|
||||
ctxMenu.AddSeparator( activeToolCondition, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int SCH_EDITOR_CONTROL::CrossProbeToPcb( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
doCrossProbeSchToPcb( aEvent, false );
|
||||
|
|
|
@ -26,9 +26,7 @@
|
|||
#define SCH_EDITOR_CONTROL_H
|
||||
|
||||
#include <sch_base_frame.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
|
||||
|
@ -37,18 +35,12 @@ class SCH_EDIT_FRAME;
|
|||
*
|
||||
* Handles actions specific to the schematic editor in eeschema.
|
||||
*/
|
||||
class SCH_EDITOR_CONTROL : public wxEvtHandler, public TOOL_INTERACTIVE
|
||||
class SCH_EDITOR_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<SCH_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
SCH_EDITOR_CONTROL();
|
||||
~SCH_EDITOR_CONTROL();
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
int ToggleLockSelected( const TOOL_EVENT& aEvent );
|
||||
int LockSelected( const TOOL_EVENT& aEvent );
|
||||
int UnlockSelected( const TOOL_EVENT& aEvent );
|
||||
|
@ -96,12 +88,8 @@ private:
|
|||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
SCH_EDIT_FRAME* m_frame; ///> Pointer to the currently used edit frame
|
||||
|
||||
private:
|
||||
bool m_probingSchToPcb; ///> Recursion guard when cross-probing to PCBNew
|
||||
|
||||
/// Menu model displayed by the tool.
|
||||
TOOL_MENU m_menu;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -52,11 +52,7 @@ TOOL_ACTION EE_ACTIONS::drag( "eeschema.InteractiveEdit.drag",
|
|||
|
||||
|
||||
SCH_MOVE_TOOL::SCH_MOVE_TOOL() :
|
||||
TOOL_INTERACTIVE( "eeschema.InteractiveMove" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_controls( nullptr ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this ),
|
||||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveMove" ),
|
||||
m_moveInProgress( false ),
|
||||
m_moveOffset( 0, 0 )
|
||||
{
|
||||
|
@ -70,10 +66,7 @@ SCH_MOVE_TOOL::~SCH_MOVE_TOOL()
|
|||
|
||||
bool SCH_MOVE_TOOL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
wxASSERT_MSG( m_selectionTool, "eeshema.InteractiveSelection tool is not available" );
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
auto moveCondition = [] ( const SELECTION& aSel ) {
|
||||
if( aSel.Empty() )
|
||||
|
@ -85,16 +78,6 @@ bool SCH_MOVE_TOOL::Init()
|
|||
return true;
|
||||
};
|
||||
|
||||
//
|
||||
// Build the tool menu
|
||||
//
|
||||
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, EE_CONDITIONS::ShowAlways, 1 );
|
||||
|
||||
ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
//
|
||||
// Add move actions to the selection tool menu
|
||||
//
|
||||
|
@ -107,20 +90,6 @@ bool SCH_MOVE_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
void SCH_MOVE_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
if( aReason == MODEL_RELOAD )
|
||||
{
|
||||
m_moveInProgress = false;
|
||||
m_moveOffset = { 0, 0 };
|
||||
|
||||
// Init variables used by every drawing tool
|
||||
m_controls = getViewControls();
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
const KICAD_T movableItems[] =
|
||||
|
@ -663,28 +632,6 @@ bool SCH_MOVE_TOOL::updateModificationPoint( SELECTION& aSelection )
|
|||
}
|
||||
|
||||
|
||||
void SCH_MOVE_TOOL::updateView( EDA_ITEM* aItem )
|
||||
{
|
||||
KICAD_T itemType = aItem->Type();
|
||||
|
||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||
getView()->Update( aItem->GetParent() );
|
||||
|
||||
getView()->Update( aItem );
|
||||
}
|
||||
|
||||
|
||||
void SCH_MOVE_TOOL::saveCopyInUndoList( SCH_ITEM* aItem, UNDO_REDO_T aType, bool aAppend )
|
||||
{
|
||||
KICAD_T itemType = aItem->Type();
|
||||
|
||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||
m_frame->SaveCopyInUndoList( (SCH_ITEM*)aItem->GetParent(), UR_CHANGED, aAppend );
|
||||
else
|
||||
m_frame->SaveCopyInUndoList( aItem, aType, aAppend );
|
||||
}
|
||||
|
||||
|
||||
void SCH_MOVE_TOOL::setTransitions()
|
||||
{
|
||||
Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::move.MakeEvent() );
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#ifndef KICAD_SCH_MOVE_TOOL_H
|
||||
#define KICAD_SCH_MOVE_TOOL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <sch_base_frame.h>
|
||||
|
||||
|
||||
|
@ -33,7 +32,7 @@ class SCH_EDIT_FRAME;
|
|||
class EE_SELECTION_TOOL;
|
||||
|
||||
|
||||
class SCH_MOVE_TOOL : public TOOL_INTERACTIVE
|
||||
class SCH_MOVE_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
SCH_MOVE_TOOL();
|
||||
|
@ -42,12 +41,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
/**
|
||||
* Function Main()
|
||||
*
|
||||
|
@ -71,24 +64,10 @@ private:
|
|||
///> selected items.
|
||||
bool updateModificationPoint( SELECTION& aSelection );
|
||||
|
||||
///> Similar to getView()->Update(), but handles items that are redrawn by their parents.
|
||||
void updateView( EDA_ITEM* );
|
||||
|
||||
///> Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their
|
||||
///> parents.
|
||||
void saveCopyInUndoList( SCH_ITEM*, UNDO_REDO_T aType, bool aAppend = false );
|
||||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
KIGFX::VIEW_CONTROLS* m_controls;
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
|
||||
/// Menu model displayed by the tool.
|
||||
TOOL_MENU m_menu;
|
||||
|
||||
///> Flag determining if anything is being dragged right now
|
||||
bool m_moveInProgress;
|
||||
|
||||
|
|
|
@ -187,12 +187,7 @@ private:
|
|||
|
||||
|
||||
SCH_WIRE_BUS_TOOL::SCH_WIRE_BUS_TOOL() :
|
||||
TOOL_INTERACTIVE( "eeschema.WireBusDrawing" ),
|
||||
m_selectionTool( nullptr ),
|
||||
m_view( nullptr ),
|
||||
m_controls( nullptr ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this )
|
||||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.WireBusDrawing" )
|
||||
{
|
||||
m_busUnfold = {};
|
||||
}
|
||||
|
@ -205,8 +200,7 @@ SCH_WIRE_BUS_TOOL::~SCH_WIRE_BUS_TOOL()
|
|||
|
||||
bool SCH_WIRE_BUS_TOOL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_TOOL_BASE::Init();
|
||||
|
||||
auto activeTool = [ this ] ( const SELECTION& aSel ) {
|
||||
return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
|
||||
|
@ -232,7 +226,6 @@ bool SCH_WIRE_BUS_TOOL::Init()
|
|||
//
|
||||
// Build the tool menu
|
||||
//
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, EE_CONDITIONS::ShowAlways, 1 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
|
||||
|
||||
ctxMenu.AddSeparator( EE_CONDITIONS::ShowAlways, 10 );
|
||||
|
@ -260,9 +253,6 @@ bool SCH_WIRE_BUS_TOOL::Init()
|
|||
ctxMenu.AddItem( EE_ACTIONS::selectNode, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
|
||||
ctxMenu.AddItem( EE_ACTIONS::selectConnection, wireOrBusTool && EE_CONDITIONS::Idle, 200 );
|
||||
|
||||
ctxMenu.AddSeparator( activeTool, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
//
|
||||
// Add bus unfolding to the selection tool
|
||||
//
|
||||
|
@ -277,15 +267,6 @@ bool SCH_WIRE_BUS_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
void SCH_WIRE_BUS_TOOL::Reset( RESET_REASON aReason )
|
||||
{
|
||||
// Init variables used by every drawing tool
|
||||
m_view = static_cast<KIGFX::SCH_VIEW*>( getView() );
|
||||
m_controls = getViewControls();
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
}
|
||||
|
||||
|
||||
static bool isNewSegment( SCH_ITEM* aItem )
|
||||
{
|
||||
return aItem && aItem->IsNew() && aItem->Type() == SCH_LINE_T;
|
||||
|
@ -593,8 +574,9 @@ int SCH_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
|||
{
|
||||
bool forceHV = m_frame->GetForceHVLines();
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
wxPoint cursorPos;
|
||||
|
||||
m_controls->ShowCursor( true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
if( aSegment == nullptr )
|
||||
Activate();
|
||||
|
@ -602,7 +584,7 @@ int SCH_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
|||
// Main loop: keep receiving events
|
||||
while( OPT_TOOL_EVENT evt = Wait() )
|
||||
{
|
||||
wxPoint cursorPos = (wxPoint)m_controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
cursorPos = (wxPoint)getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Handle cancel:
|
||||
|
@ -802,8 +784,8 @@ int SCH_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
|||
}
|
||||
|
||||
// Enable autopanning and cursor capture only when there is a segment to be placed
|
||||
m_controls->SetAutoPan( !!aSegment );
|
||||
m_controls->CaptureCursor( !!aSegment );
|
||||
getViewControls()->SetAutoPan( !!aSegment );
|
||||
getViewControls()->CaptureCursor( !!aSegment );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -959,8 +941,8 @@ void SCH_WIRE_BUS_TOOL::finishSegments()
|
|||
m_view->ClearPreview();
|
||||
m_view->ShowPreview( false );
|
||||
|
||||
m_controls->CaptureCursor( false );
|
||||
m_controls->SetAutoPan( false );
|
||||
getViewControls()->CaptureCursor( false );
|
||||
getViewControls()->SetAutoPan( false );
|
||||
|
||||
m_frame->SaveCopyInUndoList( itemList, UR_NEW );
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#ifndef SCH_LINE_DRAWING_TOOL_H
|
||||
#define SCH_LINE_DRAWING_TOOL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/tool_menu.h>
|
||||
#include <tools/ee_tool_base.h>
|
||||
#include <core/optional.h>
|
||||
#include <sch_base_frame.h>
|
||||
|
||||
|
@ -57,7 +56,7 @@ struct BUS_UNFOLDING_T
|
|||
* Tool responsible for drawing/placing items (symbols, wires, busses, labels, etc.)
|
||||
*/
|
||||
|
||||
class SCH_WIRE_BUS_TOOL : public TOOL_INTERACTIVE
|
||||
class SCH_WIRE_BUS_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
|
||||
{
|
||||
public:
|
||||
SCH_WIRE_BUS_TOOL();
|
||||
|
@ -66,12 +65,6 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
/// @copydoc TOOL_INTERACTIVE::Reset()
|
||||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_LINE_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
/*
|
||||
* These are the immediate actions. They start drawing at the mouse location. They
|
||||
* do not select the tool.
|
||||
|
@ -97,7 +90,6 @@ public:
|
|||
static bool IsDrawingLineWireOrBus( const SELECTION& aSelection );
|
||||
|
||||
private:
|
||||
|
||||
int doDrawSegments( int aType, SCH_LINE* aSegment );
|
||||
SCH_LINE* startSegments( int aType, const wxPoint& aPos );
|
||||
SCH_LINE* doUnfoldBus( const wxString& aNet );
|
||||
|
@ -107,15 +99,8 @@ private:
|
|||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
EE_SELECTION_TOOL* m_selectionTool;
|
||||
KIGFX::SCH_VIEW* m_view;
|
||||
KIGFX::VIEW_CONTROLS* m_controls;
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
|
||||
/// Data related to bus unfolding tool.
|
||||
BUS_UNFOLDING_T m_busUnfold;
|
||||
|
||||
TOOL_MENU m_menu;
|
||||
};
|
||||
|
||||
#endif /* SCH_LINE_DRAWING_TOOL_H */
|
||||
|
|
|
@ -332,7 +332,7 @@ set( PCBNEW_CLASS_SRCS
|
|||
tools/pcb_bright_box.cpp
|
||||
tools/pcb_editor_control.cpp
|
||||
tools/pcb_selection_conditions.cpp
|
||||
tools/pcb_tool.cpp
|
||||
tools/pcb_tool_base.cpp
|
||||
tools/pcbnew_control.cpp
|
||||
tools/picker_tool.cpp
|
||||
tools/placement_tool.cpp
|
||||
|
|
|
@ -58,7 +58,7 @@ TOOL_ACTION PCB_ACTIONS::autoplaceOffboardComponents( "pcbnew.Autoplacer.autopla
|
|||
AS_GLOBAL, 0, _( "Auto-place off-board components" ),
|
||||
_( "Performs automatic placement of components outside board area" ) );
|
||||
|
||||
AUTOPLACE_TOOL::AUTOPLACE_TOOL() : PCB_TOOL( "pcbnew.Autoplacer" )
|
||||
AUTOPLACE_TOOL::AUTOPLACE_TOOL() : PCB_TOOL_BASE( "pcbnew.Autoplacer" )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef TOOLS_AUTOPLACE_TOOL_H
|
||||
#define TOOLS_AUTOPLACE_TOOL_H
|
||||
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
* Tool responsible for automagic placement of components.
|
||||
*/
|
||||
class AUTOPLACE_TOOL : public PCB_TOOL
|
||||
class AUTOPLACE_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
AUTOPLACE_TOOL();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <tools/selection_tool.h>
|
||||
#include <view/view.h>
|
||||
#include <board_commit.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <connectivity/connectivity_data.h>
|
||||
|
||||
|
@ -38,7 +38,7 @@ using namespace std::placeholders;
|
|||
|
||||
#include "pcb_draw_panel_gal.h"
|
||||
|
||||
BOARD_COMMIT::BOARD_COMMIT( PCB_TOOL* aTool )
|
||||
BOARD_COMMIT::BOARD_COMMIT( PCB_TOOL_BASE* aTool )
|
||||
{
|
||||
m_toolMgr = aTool->GetManager();
|
||||
m_editModules = aTool->EditingModules();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
class BOARD_ITEM;
|
||||
class PICKED_ITEMS_LIST;
|
||||
class PCB_TOOL;
|
||||
class PCB_TOOL_BASE;
|
||||
class TOOL_MANAGER;
|
||||
class EDA_DRAW_FRAME;
|
||||
class TOOL_BASE;
|
||||
|
@ -38,7 +38,7 @@ class BOARD_COMMIT : public COMMIT
|
|||
{
|
||||
public:
|
||||
BOARD_COMMIT( EDA_DRAW_FRAME* aFrame );
|
||||
BOARD_COMMIT( PCB_TOOL *aTool );
|
||||
BOARD_COMMIT( PCB_TOOL_BASE *aTool );
|
||||
|
||||
virtual ~BOARD_COMMIT();
|
||||
|
||||
|
|
|
@ -1026,7 +1026,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
|
|||
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
|
||||
m_toolManager->RegisterTool( new MODULE_EDITOR_TOOLS );
|
||||
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
|
||||
m_toolManager->RegisterTool( new EE_PICKER_TOOL );
|
||||
m_toolManager->RegisterTool( new PICKER_TOOL );
|
||||
m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
|
||||
|
||||
m_toolManager->GetTool<PAD_TOOL>()->SetEditModules( true );
|
||||
|
|
|
@ -572,7 +572,7 @@ void PCB_EDIT_FRAME::setupTools()
|
|||
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
||||
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
||||
m_toolManager->RegisterTool( new EE_PICKER_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 );
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include <geometry/shape_arc.h>
|
||||
#include <geometry/convex_hull.h>
|
||||
|
||||
#include "tools/pcb_tool.h"
|
||||
#include "tools/pcb_tool_base.h"
|
||||
|
||||
#include "pns_kicad_iface.h"
|
||||
|
||||
|
@ -1260,7 +1260,7 @@ void PNS_KICAD_IFACE::SetRouter( PNS::ROUTER* aRouter )
|
|||
}
|
||||
|
||||
|
||||
void PNS_KICAD_IFACE::SetHostTool( PCB_TOOL* aTool )
|
||||
void PNS_KICAD_IFACE::SetHostTool( PCB_TOOL_BASE* aTool )
|
||||
{
|
||||
m_tool = aTool;
|
||||
m_commit.reset( new BOARD_COMMIT( m_tool ) );
|
||||
|
|
|
@ -32,7 +32,7 @@ class PNS_PCBNEW_DEBUG_DECORATOR;
|
|||
class BOARD;
|
||||
class BOARD_COMMIT;
|
||||
class PCB_DISPLAY_OPTIONS;
|
||||
class PCB_TOOL;
|
||||
class PCB_TOOL_BASE;
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
~PNS_KICAD_IFACE();
|
||||
|
||||
void SetRouter( PNS::ROUTER* aRouter ) override;
|
||||
void SetHostTool( PCB_TOOL* aTool );
|
||||
void SetHostTool( PCB_TOOL_BASE* aTool );
|
||||
void SetDisplayOptions( PCB_DISPLAY_OPTIONS* aDispOptions );
|
||||
|
||||
void SetBoard( BOARD* aBoard );
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
|
||||
PNS::ROUTER* m_router;
|
||||
BOARD* m_board;
|
||||
PCB_TOOL* m_tool;
|
||||
PCB_TOOL_BASE* m_tool;
|
||||
std::unique_ptr<BOARD_COMMIT> m_commit;
|
||||
PCB_DISPLAY_OPTIONS* m_dispOptions;
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace PNS {
|
|||
|
||||
|
||||
TOOL_BASE::TOOL_BASE( const std::string& aToolName ) :
|
||||
PCB_TOOL( aToolName )
|
||||
PCB_TOOL_BASE( aToolName )
|
||||
{
|
||||
m_gridHelper = nullptr;
|
||||
m_iface = nullptr;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <import_export.h>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <msgpanel.h>
|
||||
|
@ -41,7 +41,7 @@ class PNS_TUNE_STATUS_POPUP;
|
|||
|
||||
namespace PNS {
|
||||
|
||||
class APIEXPORT TOOL_BASE : public PCB_TOOL
|
||||
class APIEXPORT TOOL_BASE : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
TOOL_BASE( const std::string& aToolName );
|
||||
|
|
|
@ -148,7 +148,7 @@ static TOOL_ACTION closeZoneOutline( "pcbnew.InteractiveDrawing.closeZoneOutline
|
|||
|
||||
|
||||
DRAWING_TOOL::DRAWING_TOOL() :
|
||||
PCB_TOOL( "pcbnew.InteractiveDrawing" ),
|
||||
PCB_TOOL_BASE( "pcbnew.InteractiveDrawing" ),
|
||||
m_view( nullptr ), m_controls( nullptr ),
|
||||
m_board( nullptr ), m_frame( nullptr ), m_mode( MODE::NONE ),
|
||||
m_lineWidth( 1 )
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef __DRAWING_TOOL_H
|
||||
#define __DRAWING_TOOL_H
|
||||
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include <core/optional.h>
|
||||
|
||||
#include <tool/tool_menu.h>
|
||||
|
@ -46,7 +46,7 @@ class POLYGON_GEOM_MANAGER;
|
|||
* Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
|
||||
*/
|
||||
|
||||
class DRAWING_TOOL : public PCB_TOOL
|
||||
class DRAWING_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
DRAWING_TOOL();
|
||||
|
|
|
@ -208,8 +208,10 @@ void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags )
|
|||
|
||||
|
||||
EDIT_TOOL::EDIT_TOOL() :
|
||||
PCB_TOOL( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
|
||||
m_dragging( false ), m_lockedSelected( false )
|
||||
PCB_TOOL_BASE( "pcbnew.InteractiveEdit" ),
|
||||
m_selectionTool( NULL ),
|
||||
m_dragging( false ),
|
||||
m_lockedSelected( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1462,7 +1464,7 @@ int EDIT_TOOL::editFootprintInFpEditor( const TOOL_EVENT& aEvent )
|
|||
bool EDIT_TOOL::pickCopyReferencePoint( VECTOR2I& aP )
|
||||
{
|
||||
STATUS_TEXT_POPUP statusPopup( frame() );
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
bool picking = true;
|
||||
bool retVal = true;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define __EDIT_TOOL_H
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include <tools/selection_tool.h>
|
||||
#include <status_popup.h>
|
||||
|
||||
|
@ -56,7 +56,7 @@ void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags );
|
|||
* using the pcbnew.InteractiveSelection tool.
|
||||
*/
|
||||
|
||||
class EDIT_TOOL : public PCB_TOOL
|
||||
class EDIT_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
EDIT_TOOL();
|
||||
|
|
|
@ -81,7 +81,7 @@ TOOL_ACTION PCB_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
|
|||
|
||||
|
||||
MODULE_EDITOR_TOOLS::MODULE_EDITOR_TOOLS() :
|
||||
PCB_TOOL( "pcbnew.ModuleEditor" )
|
||||
PCB_TOOL_BASE( "pcbnew.ModuleEditor" )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef MODULE_EDITOR_TOOLS_H
|
||||
#define MODULE_EDITOR_TOOLS_H
|
||||
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ class PCB_EDIT_FRAME;
|
|||
*
|
||||
* Module editor specific tools.
|
||||
*/
|
||||
class MODULE_EDITOR_TOOLS : public PCB_TOOL
|
||||
class MODULE_EDITOR_TOOLS : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
MODULE_EDITOR_TOOLS();
|
||||
|
|
|
@ -91,7 +91,7 @@ TOOL_ACTION PCB_ACTIONS::microwaveCreateLine(
|
|||
|
||||
|
||||
MICROWAVE_TOOL::MICROWAVE_TOOL() :
|
||||
PCB_TOOL( "pcbnew.MicrowaveTool" )
|
||||
PCB_TOOL_BASE( "pcbnew.MicrowaveTool" )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef TOOLS_MICROWAVE_TOOL_H
|
||||
#define TOOLS_MICROWAVE_TOOL_H
|
||||
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
||||
#include <tool/tool_menu.h>
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
* Tool responsible for adding microwave features to PCBs
|
||||
*/
|
||||
class MICROWAVE_TOOL : public PCB_TOOL
|
||||
class MICROWAVE_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
MICROWAVE_TOOL();
|
||||
|
|
|
@ -142,7 +142,7 @@ private:
|
|||
|
||||
|
||||
PAD_TOOL::PAD_TOOL() :
|
||||
PCB_TOOL( "pcbnew.PadTool" ),
|
||||
PCB_TOOL_BASE( "pcbnew.PadTool" ),
|
||||
m_padCopied( false )
|
||||
{}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define __PAD_TOOL_H
|
||||
|
||||
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
||||
class CONTEXT_MENU;
|
||||
|
||||
|
@ -34,7 +34,7 @@ class CONTEXT_MENU;
|
|||
*
|
||||
* Tools relating to pads and pad settings
|
||||
*/
|
||||
class PAD_TOOL : public PCB_TOOL
|
||||
class PAD_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
PAD_TOOL();
|
||||
|
|
|
@ -234,7 +234,7 @@ public:
|
|||
|
||||
|
||||
PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
|
||||
PCB_TOOL( "pcbnew.EditorControl" ),
|
||||
PCB_TOOL_BASE( "pcbnew.EditorControl" ),
|
||||
m_frame( nullptr ),
|
||||
m_menu( *this )
|
||||
{
|
||||
|
@ -906,7 +906,7 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
Activate();
|
||||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
assert( picker );
|
||||
|
||||
m_frame->SetToolID( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxCURSOR_HAND, _( "Adjust zero" ) );
|
||||
|
@ -1087,7 +1087,7 @@ int PCB_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
Activate();
|
||||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
assert( picker );
|
||||
|
||||
m_frame->SetToolID( ID_PCB_HIGHLIGHT_BUTT, wxCURSOR_HAND, _( "Highlight net" ) );
|
||||
|
@ -1153,7 +1153,7 @@ int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
Activate();
|
||||
|
||||
auto picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
auto picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
auto board = getModel<BOARD>();
|
||||
wxASSERT( picker );
|
||||
wxASSERT( board );
|
||||
|
@ -1164,7 +1164,7 @@ int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
|
|||
picker->SetFinalizeHandler( [ board ]( int aCondition ){
|
||||
auto vis = board->IsElementVisible( LAYER_RATSNEST );
|
||||
|
||||
if( aCondition != EE_PICKER_TOOL::END_ACTIVATE )
|
||||
if( aCondition != PICKER_TOOL::END_ACTIVATE )
|
||||
{
|
||||
for( auto mod : board->Modules() )
|
||||
for( auto pad : mod->Pads() )
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef PCB_EDITOR_CONTROL_H
|
||||
#define PCB_EDITOR_CONTROL_H
|
||||
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include <tool/tool_menu.h>
|
||||
|
||||
namespace KIGFX {
|
||||
|
@ -39,7 +39,7 @@ class PCB_EDIT_FRAME;
|
|||
*
|
||||
* Handles actions specific to the board editor in pcbnew.
|
||||
*/
|
||||
class PCB_EDITOR_CONTROL : public wxEvtHandler, public PCB_TOOL
|
||||
class PCB_EDITOR_CONTROL : public wxEvtHandler, public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
PCB_EDITOR_CONTROL();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "pcb_tool.h"
|
||||
#include "pcb_tool_base.h"
|
||||
|
||||
#include <view/view_controls.h>
|
||||
#include <view/view.h>
|
||||
|
@ -36,7 +36,7 @@
|
|||
#include "pcb_actions.h"
|
||||
#include "tool_event_utils.h"
|
||||
|
||||
void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
|
||||
void PCB_TOOL_BASE::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
|
||||
const wxString& aCommitMessage,
|
||||
int aOptions )
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
|
|||
view()->Remove( &preview );
|
||||
}
|
||||
|
||||
bool PCB_TOOL::Init()
|
||||
bool PCB_TOOL_BASE::Init()
|
||||
{
|
||||
// A basic context manu. Many (but not all) tools will choose to override this.
|
||||
|
||||
|
@ -228,34 +228,34 @@ bool PCB_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
void PCB_TOOL::Reset( RESET_REASON aReason )
|
||||
void PCB_TOOL_BASE::Reset( RESET_REASON aReason )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PCB_TOOL::setTransitions()
|
||||
void PCB_TOOL_BASE::setTransitions()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PCB_DISPLAY_OPTIONS* PCB_TOOL::displayOptions() const
|
||||
PCB_DISPLAY_OPTIONS* PCB_TOOL_BASE::displayOptions() const
|
||||
{
|
||||
return static_cast<PCB_DISPLAY_OPTIONS*>( frame()->GetDisplayOptions() );
|
||||
}
|
||||
|
||||
PCB_DRAW_PANEL_GAL* PCB_TOOL::canvas() const
|
||||
PCB_DRAW_PANEL_GAL* PCB_TOOL_BASE::canvas() const
|
||||
{
|
||||
return static_cast<PCB_DRAW_PANEL_GAL*>( frame()->GetGalCanvas() );
|
||||
}
|
||||
|
||||
const SELECTION& PCB_TOOL::selection() const
|
||||
const SELECTION& PCB_TOOL_BASE::selection() const
|
||||
{
|
||||
auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||
const auto& selection = selTool->GetSelection();
|
||||
return selection;
|
||||
}
|
||||
|
||||
SELECTION& PCB_TOOL::selection()
|
||||
SELECTION& PCB_TOOL_BASE::selection()
|
||||
{
|
||||
auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||
auto& selection = selTool->GetSelection();
|
|
@ -22,8 +22,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __PCB_TOOL_H
|
||||
#define __PCB_TOOL_H
|
||||
#ifndef PCB_TOOL_BASE_H
|
||||
#define PCB_TOOL_BASE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -39,12 +39,12 @@
|
|||
#include <tool/tool_menu.h>
|
||||
|
||||
/**
|
||||
* Class PCB_TOOL
|
||||
* Class PCB_TOOL_BASE
|
||||
*
|
||||
* A tool operating on a BOARD object
|
||||
**/
|
||||
|
||||
class PCB_TOOL;
|
||||
class PCB_TOOL_BASE;
|
||||
class PCB_EDIT_FRAME;
|
||||
class PCB_DISPLAY_OPTIONS;
|
||||
class SELECTION;
|
||||
|
@ -61,14 +61,14 @@ struct INTERACTIVE_PLACER_BASE
|
|||
};
|
||||
|
||||
|
||||
class PCB_TOOL : public TOOL_INTERACTIVE
|
||||
class PCB_TOOL_BASE : public TOOL_INTERACTIVE
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Creates a tool with given id & name. The name must be unique. */
|
||||
PCB_TOOL( TOOL_ID aId, const std::string& aName ) :
|
||||
PCB_TOOL_BASE( TOOL_ID aId, const std::string& aName ) :
|
||||
TOOL_INTERACTIVE ( aId, aName ),
|
||||
m_menu( *this ),
|
||||
m_editModules( false ) {};
|
||||
|
@ -77,12 +77,12 @@ public:
|
|||
* Constructor
|
||||
*
|
||||
* Creates a tool with given name. The name must be unique. */
|
||||
PCB_TOOL( const std::string& aName ) :
|
||||
PCB_TOOL_BASE( const std::string& aName ) :
|
||||
TOOL_INTERACTIVE ( aName ),
|
||||
m_menu( *this ),
|
||||
m_editModules( false ) {};
|
||||
|
||||
virtual ~PCB_TOOL() {};
|
||||
virtual ~PCB_TOOL_BASE() {};
|
||||
|
||||
virtual bool Init() override;
|
||||
virtual void Reset( RESET_REASON aReason ) override;
|
|
@ -214,7 +214,7 @@ TOOL_ACTION PCB_ACTIONS::pasteFromClipboard( "pcbnew.InteractiveEdit.pasteFromCl
|
|||
|
||||
|
||||
PCBNEW_CONTROL::PCBNEW_CONTROL() :
|
||||
PCB_TOOL( "pcbnew.Control" ), m_frame( NULL )
|
||||
PCB_TOOL_BASE( "pcbnew.Control" ), m_frame( NULL )
|
||||
{
|
||||
m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
Activate();
|
||||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
wxCHECK( picker, 0 );
|
||||
|
||||
// TODO it will not check the toolbar button in module editor, as it uses a different ID..
|
||||
|
@ -693,7 +693,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
Activate();
|
||||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
wxCHECK( picker, 0 );
|
||||
|
||||
m_frame->SetToolID( m_editModules ? ID_MODEDIT_DELETE_TOOL : ID_PCB_DELETE_ITEM_BUTT,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <io_mgr.h>
|
||||
#include <memory>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
||||
namespace KIGFX {
|
||||
class ORIGIN_VIEWITEM;
|
||||
|
@ -41,7 +41,7 @@ class BOARD_ITEM;
|
|||
* Handles actions that are shared between different frames in pcbnew.
|
||||
*/
|
||||
|
||||
class PCBNEW_CONTROL : public PCB_TOOL
|
||||
class PCBNEW_CONTROL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
PCBNEW_CONTROL();
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
TOOL_ACTION PCB_ACTIONS::pickerTool( "pcbnew.Picker", AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE );
|
||||
|
||||
|
||||
EE_PICKER_TOOL::EE_PICKER_TOOL()
|
||||
: PCB_TOOL( "pcbnew.Picker" )
|
||||
PICKER_TOOL::PICKER_TOOL()
|
||||
: PCB_TOOL_BASE( "pcbnew.Picker" )
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||
GRID_HELPER grid( frame() );
|
||||
|
@ -70,7 +70,7 @@ int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cerr << "EE_PICKER_TOOL click handler error: " << e.what() << std::endl;
|
||||
std::cerr << "PICKER_TOOL click handler error: " << e.what() << std::endl;
|
||||
finalize_state = EXCEPTION_CANCEL;
|
||||
break;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cerr << "EE_PICKER_TOOL cancel handler error: " << e.what() << std::endl;
|
||||
std::cerr << "PICKER_TOOL cancel handler error: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cerr << "EE_PICKER_TOOL finalize handler error: " << e.what() << std::endl;
|
||||
std::cerr << "PICKER_TOOL finalize handler error: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,13 +135,13 @@ int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void EE_PICKER_TOOL::setTransitions()
|
||||
void PICKER_TOOL::setTransitions()
|
||||
{
|
||||
Go( &EE_PICKER_TOOL::Main, PCB_ACTIONS::pickerTool.MakeEvent() );
|
||||
Go( &PICKER_TOOL::Main, PCB_ACTIONS::pickerTool.MakeEvent() );
|
||||
}
|
||||
|
||||
|
||||
void EE_PICKER_TOOL::reset()
|
||||
void PICKER_TOOL::reset()
|
||||
{
|
||||
m_cursorCapture = false;
|
||||
m_autoPanning = false;
|
||||
|
@ -154,7 +154,7 @@ void EE_PICKER_TOOL::reset()
|
|||
}
|
||||
|
||||
|
||||
void EE_PICKER_TOOL::setControls()
|
||||
void PICKER_TOOL::setControls()
|
||||
{
|
||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||
|
||||
|
|
|
@ -26,16 +26,16 @@
|
|||
#define PICKER_TOOL_H
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
||||
#include "pcb_tool.h"
|
||||
/**
|
||||
* @brief Generic tool for picking a point.
|
||||
*/
|
||||
class EE_PICKER_TOOL : public PCB_TOOL
|
||||
class PICKER_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
EE_PICKER_TOOL();
|
||||
~EE_PICKER_TOOL() {}
|
||||
PICKER_TOOL();
|
||||
~PICKER_TOOL() {}
|
||||
|
||||
///> Event handler types.
|
||||
typedef std::function<bool(const VECTOR2D&)> CLICK_HANDLER;
|
||||
|
|
|
@ -239,7 +239,7 @@ private:
|
|||
|
||||
|
||||
EE_POINT_EDITOR::EE_POINT_EDITOR() :
|
||||
PCB_TOOL( "pcbnew.PointEditor" ),
|
||||
PCB_TOOL_BASE( "pcbnew.PointEditor" ),
|
||||
m_selectionTool( NULL ),
|
||||
m_editedPoint( NULL ),
|
||||
m_original( VECTOR2I( 0, 0 ) ),
|
||||
|
|
|
@ -40,7 +40,7 @@ class SHAPE_POLY_SET;
|
|||
*
|
||||
* Tool that displays edit points allowing to modify items by dragging the points.
|
||||
*/
|
||||
class EE_POINT_EDITOR : public PCB_TOOL
|
||||
class EE_POINT_EDITOR : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
EE_POINT_EDITOR();
|
||||
|
|
|
@ -53,7 +53,7 @@ TOOL_ACTION PCB_ACTIONS::selectpositionRelativeItem(
|
|||
|
||||
|
||||
POSITION_RELATIVE_TOOL::POSITION_RELATIVE_TOOL() :
|
||||
PCB_TOOL( "pcbnew.PositionRelative" ),
|
||||
PCB_TOOL_BASE( "pcbnew.PositionRelative" ),
|
||||
m_dialog( NULL ),
|
||||
m_selectionTool( NULL ),
|
||||
m_anchor_item( NULL )
|
||||
|
@ -140,7 +140,7 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
|
|||
{
|
||||
Activate();
|
||||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
STATUS_TEXT_POPUP statusPopup( frame() );
|
||||
bool picking = true;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define __POSITION_RELATIVE_TOOL_H
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include "selection_tool.h"
|
||||
#include "dialogs/dialog_position_relative.h"
|
||||
#include "dialogs/dialog_position_relative_base.h"
|
||||
|
@ -42,7 +42,7 @@ class DIALOG_POSITION_RELATIVE;
|
|||
* using the pcbnew.InteractiveSelection tool.
|
||||
*/
|
||||
|
||||
class POSITION_RELATIVE_TOOL : public PCB_TOOL
|
||||
class POSITION_RELATIVE_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
POSITION_RELATIVE_TOOL();
|
||||
|
|
|
@ -193,7 +193,7 @@ public:
|
|||
|
||||
|
||||
SELECTION_TOOL::SELECTION_TOOL() :
|
||||
PCB_TOOL( "pcbnew.InteractiveSelection" ),
|
||||
PCB_TOOL_BASE( "pcbnew.InteractiveSelection" ),
|
||||
m_frame( NULL ),
|
||||
m_additive( false ),
|
||||
m_subtractive( false ),
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include <tool/context_menu.h>
|
||||
#include <tool/selection.h>
|
||||
|
||||
|
@ -61,7 +61,7 @@ typedef void (*CLIENT_SELECTION_FILTER)( const VECTOR2I&, GENERAL_COLLECTOR& );
|
|||
* - takes into account high-contrast & layer visibility settings
|
||||
* - invokes InteractiveEdit tool when user starts to drag selected items
|
||||
*/
|
||||
class SELECTION_TOOL : public PCB_TOOL
|
||||
class SELECTION_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
SELECTION_TOOL();
|
||||
|
|
|
@ -59,7 +59,7 @@ TOOL_ACTION PCB_ACTIONS::zoneUnfillAll( "pcbnew.ZoneFiller.zoneUnfillAll",
|
|||
_( "Unfill All" ), _( "Unfill all zones" ) );
|
||||
|
||||
ZONE_FILLER_TOOL::ZONE_FILLER_TOOL() :
|
||||
PCB_TOOL( "pcbnew.ZoneFiller" )
|
||||
PCB_TOOL_BASE( "pcbnew.ZoneFiller" )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef ZONE_FILLER_TOOL_H
|
||||
#define ZONE_FILLER_TOOL_H
|
||||
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
||||
|
||||
class PCB_EDIT_FRAME;
|
||||
|
@ -35,7 +35,7 @@ class PCB_EDIT_FRAME;
|
|||
*
|
||||
* Handles actions specific to filling copper zones.
|
||||
*/
|
||||
class ZONE_FILLER_TOOL : public PCB_TOOL
|
||||
class ZONE_FILLER_TOOL : public PCB_TOOL_BASE
|
||||
{
|
||||
public:
|
||||
ZONE_FILLER_TOOL();
|
||||
|
|
|
@ -38,7 +38,7 @@ add_executable(test_gal_pixel_alignment WIN32
|
|||
../../qa_utils/pcb_test_frame.cpp
|
||||
../../qa_utils/mocks.cpp
|
||||
../../../common/base_units.cpp
|
||||
../../../pcbnew/tools/pcb_tool.cpp
|
||||
../../../pcbnew/tools/pcb_tool_base.cpp
|
||||
../../../pcbnew/tools/selection.cpp
|
||||
../../../pcbnew/tools/selection_tool.cpp
|
||||
../../../pcbnew/tools/tool_event_utils.cpp
|
||||
|
|
|
@ -38,7 +38,7 @@ add_executable(test_window WIN32
|
|||
../qa_utils/pcb_test_frame.cpp
|
||||
../qa_utils/mocks.cpp
|
||||
../../common/base_units.cpp
|
||||
../../pcbnew/tools/pcb_tool.cpp
|
||||
../../pcbnew/tools/pcb_tool_base.cpp
|
||||
../../pcbnew/tools/selection.cpp
|
||||
../../pcbnew/tools/selection_tool.cpp
|
||||
../../pcbnew/tools/tool_event_utils.cpp
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
#include <tools/pcb_actions.h>
|
||||
#include <router/router_tool.h>
|
||||
|
||||
#include "pcb_tool.h"
|
||||
#include "pcb_tool_base.h"
|
||||
#include <dialog_find.h>
|
||||
#include <dialog_block_options.h>
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include <tool/actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/selection_tool.h>
|
||||
#include <kicad_plugin.h>
|
||||
|
|
Loading…
Reference in New Issue