Commit dc929873 authored by Maciej Suminski's avatar Maciej Suminski

Added PCBNEW_CONTROLS for handling miscellaneous hot keys (trying to be...

Added PCBNEW_CONTROLS for handling miscellaneous hot keys (trying to be compatible with the default hot key settings). Currently there are a lot of stubs to be filled out (in pcbnew_controls.cpp).
Handled actions:
- switching layers
- switching grids
- changing track width & via size
parent 3a43f052
......@@ -260,6 +260,7 @@ set( PCBNEW_CLASS_SRCS
tools/point_editor.cpp
tools/drawing_tool.cpp
tools/edit_tool.cpp
tools/pcbnew_control.cpp
tools/pcb_tools.cpp
tools/common_actions.cpp
)
......
......@@ -92,17 +92,160 @@ TOOL_ACTION COMMON_ACTIONS::placeTarget( "pcbnew.InteractiveDrawing.placeTarget"
"Add layer alignment target", "Add layer alignment target" );
TOOL_ACTION COMMON_ACTIONS::placeModule( "pcbnew.InteractiveDrawing.placeModule",
AS_GLOBAL, 0,
AS_GLOBAL, 'O',
"Add modules", "Add modules" );
TOOL_ACTION COMMON_ACTIONS::routerActivate( "pcbnew.InteractiveRouter",
AS_GLOBAL, 0,
AS_GLOBAL, 'X',
"Run push & shove router", "Run push & shove router" );
TOOL_ACTION COMMON_ACTIONS::pointEditorUpdate( "pcbnew.PointEditor.update",
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
// View Controls
TOOL_ACTION COMMON_ACTIONS::zoomIn( "pcbnew.zoomIn",
AS_GLOBAL, WXK_F1,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoomOut( "pcbnew.zoomOut",
AS_GLOBAL, WXK_F2,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoomCenter( "pcbnew.zoomCenter",
AS_GLOBAL, WXK_F4,
"", "" );
TOOL_ACTION COMMON_ACTIONS::zoomFitScreen( "pcbnew.zoomFitScreen",
AS_GLOBAL, WXK_HOME,
"", "" );
// Display modes
TOOL_ACTION COMMON_ACTIONS::trackDisplayMode( "pcbnew.trackDisplayMode",
AS_GLOBAL, 'K',
"", "" );
TOOL_ACTION COMMON_ACTIONS::padDisplayMode( "pcbnew.padDisplayMode",
AS_GLOBAL, 'J', // TODO temporarily, find a better hot key
"", "" );
TOOL_ACTION COMMON_ACTIONS::viaDisplayMode( "pcbnew.viaDisplayMode",
AS_GLOBAL, 'L', // TODO temporarily, find a better hot key
"", "" );
TOOL_ACTION COMMON_ACTIONS::highContrastMode( "pcbnew.highContrastMode",
AS_GLOBAL, 'H',
"", "" );
TOOL_ACTION COMMON_ACTIONS::highContrastInc( "pcbnew.highContrastInc",
AS_GLOBAL, MD_SHIFT + '.', // shift+. == >
"", "" );
TOOL_ACTION COMMON_ACTIONS::highContrastDec( "pcbnew.highContrastDec",
AS_GLOBAL, MD_SHIFT + 60, // shift+, == <
"", "" );
// Layer control
TOOL_ACTION COMMON_ACTIONS::layerTop( "pcbnew.layerTop",
AS_GLOBAL, WXK_PAGEUP,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerInner1( "pcbnew.layerInner1",
AS_GLOBAL, WXK_F5,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerInner2( "pcbnew.layerInner2",
AS_GLOBAL, WXK_F6,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerInner3( "pcbnew.layerInner3",
AS_GLOBAL, WXK_F7,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerInner4( "pcbnew.layerInner4",
AS_GLOBAL, WXK_F8,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerInner5( "pcbnew.layerInner5",
AS_GLOBAL, WXK_F9,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerInner6( "pcbnew.layerInner6",
AS_GLOBAL, WXK_F10,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerBottom( "pcbnew.layerBottom",
AS_GLOBAL, WXK_PAGEDOWN,
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerNext( "pcbnew.layerNext",
AS_GLOBAL, '=',
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerPrev( "pcbnew.layerPrev",
AS_GLOBAL, '-',
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerAlphaInc( "pcbnew.layerAlphaInc",
AS_GLOBAL, MD_SHIFT + '[', // shift+[ == {
"", "" );
TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.layerAlphaDec",
AS_GLOBAL, MD_SHIFT + ']', // shift+] == }
"", "" );
// Grid control
TOOL_ACTION COMMON_ACTIONS::gridFast1( "pcbnew.gridFast1",
AS_GLOBAL, MD_ALT + '1',
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridFast2( "pcbnew.gridFast2",
AS_GLOBAL, MD_ALT + '2',
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridNext( "pcbnew.gridNext",
AS_GLOBAL, '`',
"", "" );
TOOL_ACTION COMMON_ACTIONS::gridPrev( "pcbnew.gridPrev",
AS_GLOBAL, MD_CTRL + '`',
"", "" );
// Track & via size control
TOOL_ACTION COMMON_ACTIONS::trackWidthInc( "pcbnew.trackWidthInc",
AS_GLOBAL, '[',
"", "" );
TOOL_ACTION COMMON_ACTIONS::trackWidthDec( "pcbnew.trackWidthDec",
AS_GLOBAL, ']',
"", "" );
TOOL_ACTION COMMON_ACTIONS::viaSizeInc( "pcbnew.viaSizeInc",
AS_GLOBAL, '\'',
"", "" );
TOOL_ACTION COMMON_ACTIONS::viaSizeDec( "pcbnew.viaSizeDec",
AS_GLOBAL, '\\',
"", "" );
// Miscellaneous
TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.resetCoords",
AS_GLOBAL, ' ',
"", "" );
TOOL_ACTION COMMON_ACTIONS::switchUnits( "pcbnew.switchUnits",
AS_GLOBAL, MD_CTRL + 'U',
"", "" );
TOOL_ACTION COMMON_ACTIONS::showHelp( "pcbnew.showHelp",
AS_GLOBAL, MD_SHIFT + '/', // shift+/ == ?
"", "" );
std::string COMMON_ACTIONS::TranslateLegacyId( int aId )
{
switch( aId )
......
......@@ -33,6 +33,7 @@
class COMMON_ACTIONS
{
public:
// Selection Tool
/// Activation of the selection tool
static TOOL_ACTION selectionActivate;
......@@ -42,6 +43,7 @@ public:
/// Clears the current selection
static TOOL_ACTION selectionClear;
// Edit Tool
/// Activation of the edit tool
static TOOL_ACTION editActivate;
......@@ -57,6 +59,7 @@ public:
/// Deleting a BOARD_ITEM
static TOOL_ACTION remove;
// Drawing Tool
/// Activation of the drawing tool (line)
static TOOL_ACTION drawLine;
......@@ -84,12 +87,59 @@ public:
/// Activation of the drawing tool (placing a MODULE)
static TOOL_ACTION placeModule;
// Push and Shove Router Tool
/// Activation of the Push and Shove router
static TOOL_ACTION routerActivate;
// Point Editor
/// Update edit points
static TOOL_ACTION pointEditorUpdate;
// View controls
static TOOL_ACTION zoomIn;
static TOOL_ACTION zoomOut;
static TOOL_ACTION zoomCenter;
static TOOL_ACTION zoomFitScreen;
// Display modes
static TOOL_ACTION trackDisplayMode;
static TOOL_ACTION padDisplayMode;
static TOOL_ACTION viaDisplayMode;
static TOOL_ACTION highContrastMode;
static TOOL_ACTION highContrastInc;
static TOOL_ACTION highContrastDec;
// Layer control
static TOOL_ACTION layerTop;
static TOOL_ACTION layerInner1;
static TOOL_ACTION layerInner2;
static TOOL_ACTION layerInner3;
static TOOL_ACTION layerInner4;
static TOOL_ACTION layerInner5;
static TOOL_ACTION layerInner6;
static TOOL_ACTION layerBottom;
static TOOL_ACTION layerNext;
static TOOL_ACTION layerPrev;
static TOOL_ACTION layerAlphaInc;
static TOOL_ACTION layerAlphaDec;
// Grid control
static TOOL_ACTION gridFast1;
static TOOL_ACTION gridFast2;
static TOOL_ACTION gridNext;
static TOOL_ACTION gridPrev;
// Track & via size control
static TOOL_ACTION trackWidthInc;
static TOOL_ACTION trackWidthDec;
static TOOL_ACTION viaSizeInc;
static TOOL_ACTION viaSizeDec;
// Miscellaneous
static TOOL_ACTION resetCoords;
static TOOL_ACTION switchUnits;
static TOOL_ACTION showHelp;
/**
* Function TranslateLegacyId()
* Translates legacy tool ids to the corresponding TOOL_ACTION name.
......
......@@ -38,7 +38,7 @@
#include "edit_tool.h"
#include "drawing_tool.h"
#include "point_editor.h"
#include "settings_tool.h"
#include "pcbnew_control.h"
#include "common_actions.h"
#include <router/router_tool.h>
......@@ -55,7 +55,7 @@ void PCB_EDIT_FRAME::setupTools()
m_toolManager.RegisterTool( new EDIT_TOOL );
m_toolManager.RegisterTool( new DRAWING_TOOL );
m_toolManager.RegisterTool( new POINT_EDITOR );
m_toolManager.RegisterTool( new SETTINGS_TOOL );
m_toolManager.RegisterTool( new PCBNEW_CONTROL );
m_toolManager.SetEnvironment( NULL, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
......
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* @author Maciej Suminski <maciej.suminski@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 PCBNEW_CONTROL_H
#define PCBNEW_CONTROL_H
#include <tool/tool_interactive.h>
/**
* Class PCBNEW_CONTROL
*
* TODO
*/
class PCBNEW_CONTROL : public TOOL_INTERACTIVE
{
public:
PCBNEW_CONTROL();
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) {};
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init();
// View controls
int ZoomIn( TOOL_EVENT& aEvent );
int ZoomOut( TOOL_EVENT& aEvent );
int ZoomCenter( TOOL_EVENT& aEvent );
int ZoomFitScreen( TOOL_EVENT& aEvent );
// Display modes
int TrackDisplayMode( TOOL_EVENT& aEvent );
int PadDisplayMode( TOOL_EVENT& aEvent );
int ViaDisplayMode( TOOL_EVENT& aEvent );
int HighContrastMode( TOOL_EVENT& aEvent );
int HighContrastInc( TOOL_EVENT& aEvent );
int HighContrastDec( TOOL_EVENT& aEvent );
// Layer control
int LayerTop( TOOL_EVENT& aEvent );
int LayerInner1( TOOL_EVENT& aEvent );
int LayerInner2( TOOL_EVENT& aEvent );
int LayerInner3( TOOL_EVENT& aEvent );
int LayerInner4( TOOL_EVENT& aEvent );
int LayerInner5( TOOL_EVENT& aEvent );
int LayerInner6( TOOL_EVENT& aEvent );
int LayerBottom( TOOL_EVENT& aEvent );
int LayerNext( TOOL_EVENT& aEvent );
int LayerPrev( TOOL_EVENT& aEvent );
int LayerAlphaInc( TOOL_EVENT& aEvent );
int LayerAlphaDec( TOOL_EVENT& aEvent );
// Grid control
int GridFast1( TOOL_EVENT& aEvent );
int GridFast2( TOOL_EVENT& aEvent );
int GridNext( TOOL_EVENT& aEvent );
int GridPrev( TOOL_EVENT& aEvent );
// Track & via size control
int TrackWidthInc( TOOL_EVENT& aEvent );
int TrackWidthDec( TOOL_EVENT& aEvent );
int ViaSizeInc( TOOL_EVENT& aEvent );
int ViaSizeDec( TOOL_EVENT& aEvent );
// Miscellaneous
int ResetCoords( TOOL_EVENT& aEvent );
int SwitchUnits( TOOL_EVENT& aEvent );
int ShowHelp( TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
void setTransitions();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment