Added a PCB_TOOL subclass.
This commit is contained in:
parent
9588a7974c
commit
1924507001
|
@ -954,13 +954,12 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
|
|||
m_toolManager->RegisterTool( new PLACEMENT_TOOL );
|
||||
m_toolManager->RegisterTool( new PICKER_TOOL );
|
||||
|
||||
m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<EDIT_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<DRAWING_TOOL>()->EditModules( true );
|
||||
m_toolManager->GetTool<SELECTION_TOOL>()->SetEditModules( true );
|
||||
m_toolManager->GetTool<EDIT_TOOL>()->SetEditModules( true );
|
||||
m_toolManager->GetTool<DRAWING_TOOL>()->SetEditModules( true );
|
||||
|
||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
#include <class_module.h>
|
||||
|
||||
DRAWING_TOOL::DRAWING_TOOL() :
|
||||
TOOL_INTERACTIVE( "pcbnew.InteractiveDrawing" ), m_view( NULL ),
|
||||
m_controls( NULL ), m_board( NULL ), m_frame( NULL ), m_editModules( false ), m_lineWidth( 1 )
|
||||
PCB_TOOL( "pcbnew.InteractiveDrawing" ), m_view( NULL ),
|
||||
m_controls( NULL ), m_board( NULL ), m_frame( NULL ), m_lineWidth( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef __DRAWING_TOOL_H
|
||||
#define __DRAWING_TOOL_H
|
||||
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace KIGFX
|
||||
|
@ -43,7 +43,7 @@ class DRAWSEGMENT;
|
|||
* Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
|
||||
*/
|
||||
|
||||
class DRAWING_TOOL : public TOOL_INTERACTIVE
|
||||
class DRAWING_TOOL : public PCB_TOOL
|
||||
{
|
||||
public:
|
||||
DRAWING_TOOL();
|
||||
|
|
|
@ -57,7 +57,7 @@ using namespace std::placeholders;
|
|||
#include <dialogs/dialog_track_via_properties.h>
|
||||
|
||||
EDIT_TOOL::EDIT_TOOL() :
|
||||
TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
|
||||
PCB_TOOL( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
|
||||
m_dragging( false ), m_editModules( false ), m_undoInhibit( 0 ),
|
||||
m_updateFlag( KIGFX::VIEW_ITEM::NONE )
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define __EDIT_TOOL_H
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <view/view_group.h>
|
||||
|
||||
class BOARD_ITEM;
|
||||
|
@ -45,7 +45,7 @@ class VIEW_GROUP;
|
|||
* using the pcbnew.InteractiveSelection tool.
|
||||
*/
|
||||
|
||||
class EDIT_TOOL : public TOOL_INTERACTIVE
|
||||
class EDIT_TOOL : public PCB_TOOL
|
||||
{
|
||||
public:
|
||||
EDIT_TOOL();
|
||||
|
@ -114,17 +114,6 @@ public:
|
|||
*/
|
||||
int CreateArray( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Function EditModules()
|
||||
*
|
||||
* Toggles edit module mode. When enabled, one may select parts of modules individually
|
||||
* (graphics, pads, etc.), so they can be modified.
|
||||
* @param aEnabled decides if the mode should be enabled.
|
||||
*/
|
||||
void EditModules( bool aEnabled )
|
||||
{
|
||||
m_editModules = aEnabled;
|
||||
}
|
||||
|
||||
///> Sets up handlers for various events.
|
||||
void SetTransitions();
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* 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 __PCB_TOOL_H
|
||||
#define __PCB_TOOL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <class_board.h>
|
||||
|
||||
/**
|
||||
* Class PCB_TOOL
|
||||
*
|
||||
* A tool operating on a BOARD object
|
||||
**/
|
||||
|
||||
class PCB_TOOL : 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 ) :
|
||||
TOOL_INTERACTIVE ( aId, aName ),
|
||||
m_editModules( false ) {};
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Creates a tool with given name. The name must be unique. */
|
||||
PCB_TOOL( const std::string& aName ) :
|
||||
TOOL_INTERACTIVE ( aName ),
|
||||
m_editModules( false ) {};
|
||||
|
||||
virtual ~PCB_TOOL() {};
|
||||
|
||||
/**
|
||||
* Function SetEditModules()
|
||||
*
|
||||
* Toggles edit module mode. When enabled, one may select parts of modules individually
|
||||
* (graphics, pads, etc.), so they can be modified.
|
||||
* @param aEnabled decides if the mode should be enabled.
|
||||
*/
|
||||
void SetEditModules( bool aEnabled )
|
||||
{
|
||||
m_editModules = aEnabled;
|
||||
}
|
||||
|
||||
bool EditingModules() const
|
||||
{
|
||||
return m_editModules;
|
||||
}
|
||||
|
||||
protected:
|
||||
KIGFX::VIEW* view() const { return getView(); }
|
||||
PCB_EDIT_FRAME* frame() const { return getEditFrame<PCB_EDIT_FRAME>(); }
|
||||
BOARD* board() const { return getModel<BOARD>(); }
|
||||
|
||||
bool m_editModules;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -68,8 +68,8 @@ public:
|
|||
|
||||
|
||||
SELECTION_TOOL::SELECTION_TOOL() :
|
||||
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" ),
|
||||
m_frame( NULL ), m_additive( false ), m_multiple( false ), m_editModules( false ),
|
||||
PCB_TOOL( "pcbnew.InteractiveSelection" ),
|
||||
m_frame( NULL ), m_additive( false ), m_multiple( false ),
|
||||
m_locked( true ), m_menu( this ), m_contextMenu( NULL ), m_selectMenu( NULL ),
|
||||
m_zoomMenu( NULL ), m_gridMenu( NULL )
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define __SELECTION_TOOL_H
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tools/pcb_tool.h>
|
||||
#include <tool/context_menu.h>
|
||||
#include <class_undoredo_container.h>
|
||||
|
||||
|
@ -111,7 +111,7 @@ enum SELECTION_LOCK_FLAGS
|
|||
* - takes into account high-contrast & layer visibility settings
|
||||
* - invokes InteractiveEdit tool when user starts to drag selected items
|
||||
*/
|
||||
class SELECTION_TOOL : public TOOL_INTERACTIVE
|
||||
class SELECTION_TOOL : public PCB_TOOL
|
||||
{
|
||||
public:
|
||||
SELECTION_TOOL();
|
||||
|
|
Loading…
Reference in New Issue