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 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
*/
#include "pcbnew_control.h"
#include "common_actions.h"
#include <pcbnew_id.h>
#include <wxPcbStruct.h>
#include <class_board.h>
#include <class_drawpanel_gal.h>
#include <class_pcb_screen.h>
#include <gal/graphics_abstraction_layer.h>
using namespace KIGFX;
using boost::optional;
PCBNEW_CONTROL::PCBNEW_CONTROL() :
TOOL_INTERACTIVE( "pcbnew.Settings" )
{
}
bool PCBNEW_CONTROL::Init()
{
setTransitions();
return true;
}
int PCBNEW_CONTROL::ZoomIn( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::ZoomOut( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::ZoomCenter( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::TrackDisplayMode( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
{
wxCommandEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnTogglePadDrawMode( dummy );
setTransitions();
return 0;
}
int PCBNEW_CONTROL::ViaDisplayMode( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::HighContrastMode( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::HighContrastInc( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
// Layer control
int PCBNEW_CONTROL::LayerTop( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, LAYER_N_FRONT );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerInner1( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, LAYER_N_2 );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerInner2( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, LAYER_N_3 );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerInner3( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, LAYER_N_4 );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerInner4( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, LAYER_N_5 );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerInner5( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, LAYER_N_6 );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerInner6( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SwitchLayer( NULL, LAYER_N_7 );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerBottom( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SetActiveLayer( LAYER_N_BACK, true );
getEditFrame<PCB_EDIT_FRAME>()->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
LAYER_NUM layer = editFrame->GetActiveLayer();
layer = ( layer + 1 ) % ( LAST_COPPER_LAYER + 1 );
assert( IsCopperLayer( layer ) );
editFrame->SwitchLayer( NULL, layer );
editFrame->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
{
PCB_EDIT_FRAME* editFrame = getEditFrame<PCB_EDIT_FRAME>();
LAYER_NUM layer = editFrame->GetActiveLayer();
if( --layer < 0 )
layer = LAST_COPPER_LAYER;
assert( IsCopperLayer( layer ) );
editFrame->SwitchLayer( NULL, layer );
editFrame->GetGalCanvas()->SetFocus();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerAlphaInc( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::LayerAlphaDec( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
// Grid control
int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SetFastGrid1();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SetFastGrid2();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SetNextGrid();
setTransitions();
return 0;
}
int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
{
getEditFrame<PCB_EDIT_FRAME>()->SetPrevGrid();
setTransitions();
return 0;
}
// Track & via size control
int PCBNEW_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>( PCB_T );
int widthIndex = board->GetTrackWidthIndex() + 1;
if( widthIndex >= (int) board->m_TrackWidthList.size() )
widthIndex = board->m_TrackWidthList.size() - 1;
board->SetTrackWidthIndex( widthIndex );
wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy );
setTransitions();
return 0;
}
int PCBNEW_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>( PCB_T );
int widthIndex = board->GetTrackWidthIndex() - 1;
if( widthIndex < 0 )
widthIndex = 0;
board->SetTrackWidthIndex( widthIndex );
wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy );
setTransitions();
return 0;
}
int PCBNEW_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>( PCB_T );
int sizeIndex = board->GetViaSizeIndex() + 1;
if( sizeIndex >= (int) board->m_ViasDimensionsList.size() )
sizeIndex = board->m_ViasDimensionsList.size() - 1;
board->SetViaSizeIndex( sizeIndex );
wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy );
setTransitions();
return 0;
}
int PCBNEW_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>( PCB_T );
int sizeIndex = board->GetViaSizeIndex() - 1;
if( sizeIndex < 0 )
sizeIndex = 0;
board->SetViaSizeIndex( sizeIndex );
wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy );
setTransitions();
return 0;
}
// Miscellaneous
int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::SwitchUnits( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
int PCBNEW_CONTROL::ShowHelp( TOOL_EVENT& aEvent )
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
setTransitions();
return 0;
}
void PCBNEW_CONTROL::setTransitions()
{
// View controls
Go( &PCBNEW_CONTROL::ZoomIn, COMMON_ACTIONS::zoomIn.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoomOut, COMMON_ACTIONS::zoomOut.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoomCenter, COMMON_ACTIONS::zoomCenter.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoomFitScreen, COMMON_ACTIONS::zoomFitScreen.MakeEvent() );
// Display modes
Go( &PCBNEW_CONTROL::TrackDisplayMode, COMMON_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::PadDisplayMode, COMMON_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, COMMON_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastMode, COMMON_ACTIONS::highContrastMode.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastInc, COMMON_ACTIONS::highContrastInc.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastDec, COMMON_ACTIONS::highContrastDec.MakeEvent() );
// Layer control
Go( &PCBNEW_CONTROL::LayerTop, COMMON_ACTIONS::layerTop.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerInner1, COMMON_ACTIONS::layerInner1.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerInner2, COMMON_ACTIONS::layerInner2.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerInner3, COMMON_ACTIONS::layerInner3.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerInner4, COMMON_ACTIONS::layerInner4.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerInner5, COMMON_ACTIONS::layerInner5.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerInner6, COMMON_ACTIONS::layerInner6.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerBottom, COMMON_ACTIONS::layerBottom.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerNext, COMMON_ACTIONS::layerNext.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerPrev, COMMON_ACTIONS::layerPrev.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaInc, COMMON_ACTIONS::layerAlphaInc.MakeEvent() );
Go( &PCBNEW_CONTROL::LayerAlphaDec , COMMON_ACTIONS::layerAlphaDec.MakeEvent() );
// Grid control
Go( &PCBNEW_CONTROL::GridFast1, COMMON_ACTIONS::gridFast1.MakeEvent() );
Go( &PCBNEW_CONTROL::GridFast2, COMMON_ACTIONS::gridFast2.MakeEvent() );
Go( &PCBNEW_CONTROL::GridNext, COMMON_ACTIONS::gridNext.MakeEvent() );
Go( &PCBNEW_CONTROL::GridPrev, COMMON_ACTIONS::gridPrev.MakeEvent() );
// Track & via size control
Go( &PCBNEW_CONTROL::TrackWidthInc, COMMON_ACTIONS::trackWidthInc.MakeEvent() );
Go( &PCBNEW_CONTROL::TrackWidthDec, COMMON_ACTIONS::trackWidthDec.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaSizeInc, COMMON_ACTIONS::viaSizeInc.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaSizeDec, COMMON_ACTIONS::viaSizeDec.MakeEvent() );
// Miscellaneous
Go( &PCBNEW_CONTROL::ResetCoords, COMMON_ACTIONS::resetCoords.MakeEvent() );
Go( &PCBNEW_CONTROL::SwitchUnits, COMMON_ACTIONS::switchUnits.MakeEvent() );
Go( &PCBNEW_CONTROL::ShowHelp, COMMON_ACTIONS::showHelp.MakeEvent() );
}
/*
* 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