← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix typing problems with GR_KB_* constants

 

Hi,

We have a few minor typing issues with the GR_KB_* constants in 
include/common.h:

- Type is a signed int32 on most platforms, yet we use 0x80000000 
  (greater than INT_MAX) as a constant.

  This has caused people some trouble before: 
  https://bugs.launchpad.net/kicad/+bug/1445606

- In a few places, we're even using (-1) as a "special" value, which is 
  a /bug/, not just me being picky about types - if one of these were to 
  make it into a section that doesn't know to check for that (and 
  there's nothing preventing this), it would come up as a valid key with 
  all modifier flags, not a special value.

I've made a few minor changes in the attached patch. Hopefully someone 
can review and commit this; I don't think it's particularly 
controversial, but still big enough that it should be seen.

- Change these to 64-bit unsigned integers. Making them 64-bit gives 
  plenty of space for flags, and making them unsigned resolves the 
  bitmasking issue above.

- Use a typedef EDA_KEY to simplify making similar changes in the 
  future.

- Add a positive constant (GR_KEY_INVALID) to represent what (-1) did 
  before.

- Just in case any code I missed is still trying to pass in (-1), 
  continue handling this in release builds. Fail with a helpful message 
  in debug builds.

>From 889732eb4857d889721671c9b622cc9ffcff55c9 Mon Sep 17 00:00:00 2001
From: Chris Pavlina <cpavlin1@xxxxxxxxxxxxxx>
Date: Thu, 14 Jan 2016 17:11:03 -0500
Subject: [PATCH] Fix typing problems with GR_KB_* constants

---
 common/draw_frame.cpp                  |  4 ++--
 cvpcb/class_DisplayFootprintsFrame.cpp |  3 ++-
 cvpcb/class_DisplayFootprintsFrame.h   |  2 +-
 eeschema/block.cpp                     |  2 +-
 eeschema/block_libedit.cpp             | 14 +++++++++++---
 eeschema/controle.cpp                  |  6 +++---
 eeschema/libeditframe.h                |  4 ++--
 eeschema/schframe.h                    |  4 ++--
 eeschema/viewlib_frame.h               |  2 +-
 gerbview/block.cpp                     |  2 +-
 gerbview/controle.cpp                  |  2 +-
 gerbview/gerbview_frame.h              |  4 ++--
 include/common.h                       | 26 ++++++++++++++------------
 include/draw_frame.h                   |  6 +++---
 include/wxPcbStruct.h                  |  4 ++--
 pagelayout_editor/controle.cpp         |  2 +-
 pagelayout_editor/pl_editor_frame.h    |  2 +-
 pcbnew/block.cpp                       |  2 +-
 pcbnew/block_module_editor.cpp         | 12 ++++++++++--
 pcbnew/controle.cpp                    |  2 +-
 pcbnew/footprint_wizard_frame.cpp      |  2 +-
 pcbnew/footprint_wizard_frame.h        |  2 +-
 pcbnew/module_editor_frame.h           |  4 ++--
 pcbnew/moduleframe.cpp                 |  2 +-
 pcbnew/modview_frame.cpp               |  2 +-
 pcbnew/modview_frame.h                 |  2 +-
 26 files changed, 69 insertions(+), 50 deletions(-)

diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index 42936ef..63c7974 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -594,7 +594,7 @@ void EDA_DRAW_FRAME::SetPresetGrid( int aIndex )
 }
 
 
-int EDA_DRAW_FRAME::BlockCommand( int key )
+int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key )
 {
     return 0;
 }
@@ -767,7 +767,7 @@ wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMil
 }
 
 
-bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition )
+bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition )
 {
     BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
 
diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp
index dff95ae..073844b 100644
--- a/cvpcb/class_DisplayFootprintsFrame.cpp
+++ b/cvpcb/class_DisplayFootprintsFrame.cpp
@@ -315,7 +315,8 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
 }
 
 
-bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
+        EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h
index 6f4b0e9..f4cbf7c 100644
--- a/cvpcb/class_DisplayFootprintsFrame.h
+++ b/cvpcb/class_DisplayFootprintsFrame.h
@@ -92,7 +92,7 @@ public:
     void    OnLeftClick( wxDC* DC, const wxPoint& MousePos );
     void    OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
     bool    OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
-    bool    GeneralControl( wxDC* DC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool    GeneralControl( wxDC* DC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
     void    InstallOptionsDisplay( wxCommandEvent& event );
     MODULE* Get_Module( const wxString& CmpName );
 
diff --git a/eeschema/block.cpp b/eeschema/block.cpp
index e4b38e9..9edd9d4 100644
--- a/eeschema/block.cpp
+++ b/eeschema/block.cpp
@@ -62,7 +62,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
                                      const wxPoint& aPosition, bool aErase );
 
 
-int SCH_EDIT_FRAME::BlockCommand( int key )
+int SCH_EDIT_FRAME::BlockCommand( EDA_KEY key )
 {
     int cmd = BLOCK_IDLE;
 
diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp
index 5dc235f..6b75446 100644
--- a/eeschema/block_libedit.cpp
+++ b/eeschema/block_libedit.cpp
@@ -41,7 +41,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
                                      bool aErase );
 
 
-int LIB_EDIT_FRAME::BlockCommand( int key )
+int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key )
 {
     int cmd = BLOCK_IDLE;
 
@@ -51,11 +51,19 @@ int LIB_EDIT_FRAME::BlockCommand( int key )
         cmd = key & 0xFF;
         break;
 
-    case -1:
+    case EDA_KEY_C( 0xffffffffffffffff ):   // -1L sign-extended to EDA_KEY
+    case EDA_KEY_C( 0x00000000ffffffff ):   // -1L zero-extended to EDA_KEY
+        // TODO: this case can be removed if a more exhaustive search for
+        // possible negative key values has been performed and came up
+        // empty.
+        wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" );
+        // fall through on release builds
+
+    case GR_KEY_INVALID:
         cmd = BLOCK_PRESELECT_MOVE;
         break;
 
-    case 0:
+    case GR_KEY_NONE:
         cmd = BLOCK_MOVE;
         break;
 
diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp
index 99bd9ee..aa5d57a 100644
--- a/eeschema/controle.cpp
+++ b/eeschema/controle.cpp
@@ -202,7 +202,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
 }
 
 
-bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
@@ -249,7 +249,7 @@ bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
 }
 
 
-bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
@@ -291,7 +291,7 @@ bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
 }
 
 
-bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h
index 6ae14ce..32261c4 100644
--- a/eeschema/libeditframe.h
+++ b/eeschema/libeditframe.h
@@ -333,7 +333,7 @@ public:
 
     bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     void LoadSettings( wxConfigBase* aCfg );
 
@@ -607,7 +607,7 @@ public:
      * returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
      * the \a aKey (ALT, SHIFT ALT ..)
      */
-    virtual int BlockCommand( int aKey );
+    virtual int BlockCommand( EDA_KEY aKey );
 
     /**
      * Function HandleBlockPlace
diff --git a/eeschema/schframe.h b/eeschema/schframe.h
index f7309bc..bce919c 100644
--- a/eeschema/schframe.h
+++ b/eeschema/schframe.h
@@ -270,7 +270,7 @@ public:
     void Process_Config( wxCommandEvent& event );
     void OnSelectTool( wxCommandEvent& aEvent );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     /**
      * Function GetProjectFileParametersList
@@ -1229,7 +1229,7 @@ public:
      * @param aKey = the key modifiers (Alt, Shift ...)
      * @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
      */
-    virtual int BlockCommand( int aKey );
+    virtual int BlockCommand( EDA_KEY aKey );
 
     /**
      * Function HandleBlockPlace
diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h
index ab7ecb2..4aed862 100644
--- a/eeschema/viewlib_frame.h
+++ b/eeschema/viewlib_frame.h
@@ -87,7 +87,7 @@ public:
     void ClickOnCmpList( wxCommandEvent& event );
     void OnSetRelativeOffset( wxCommandEvent& event );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
diff --git a/gerbview/block.cpp b/gerbview/block.cpp
index 1218322..8494f75 100644
--- a/gerbview/block.cpp
+++ b/gerbview/block.cpp
@@ -47,7 +47,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
                                      bool erase );
 
 
-int GERBVIEW_FRAME::BlockCommand( int key )
+int GERBVIEW_FRAME::BlockCommand( EDA_KEY key )
 {
     int cmd = 0;
 
diff --git a/gerbview/controle.cpp b/gerbview/controle.cpp
index ace281c..fc98571 100644
--- a/gerbview/controle.cpp
+++ b/gerbview/controle.cpp
@@ -33,7 +33,7 @@
 #include <gerbview_frame.h>
 
 
-bool GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h
index 383ab54..6bac9ff 100644
--- a/gerbview/gerbview_frame.h
+++ b/gerbview/gerbview_frame.h
@@ -546,7 +546,7 @@ public:
      * returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
      * the \a aKey (ALT, SHIFT ALT ..)
      */
-    virtual int         BlockCommand( int key );
+    virtual int         BlockCommand( EDA_KEY key );
 
     /**
      * Function HandleBlockPlace
@@ -631,7 +631,7 @@ public:
     bool                LoadExcellonFiles( const wxString& aFileName );
     bool                Read_EXCELLON_File( const wxString& aFullFileName );
 
-    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     /**
      * Set Size Items (Lines, Flashes) from DCodes List
diff --git a/include/common.h b/include/common.h
index b881444..1f1dc92 100644
--- a/include/common.h
+++ b/include/common.h
@@ -4,7 +4,7 @@
  * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
  * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2016 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
@@ -33,6 +33,7 @@
 #define INCLUDE__COMMON_H_
 
 #include <vector>
+#include <cstdint>
 
 #include <wx/wx.h>
 #include <wx/confbase.h>
@@ -49,17 +50,18 @@ class REPORTER;
 
 
 // Flag for special keys
-#define GR_KB_RIGHTSHIFT 0x10000000                 /* Keybd states: right
-                                                     * shift key depressed */
-#define GR_KB_LEFTSHIFT  0x20000000                 /* left shift key depressed
-                                                     */
-#define GR_KB_CTRL       0x40000000                 // CTRL depressed
-#define GR_KB_ALT        0x80000000                 // ALT depressed
-#define GR_KB_SHIFT      (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
-#define GR_KB_SHIFTCTRL  (GR_KB_SHIFT | GR_KB_CTRL)
-#define MOUSE_MIDDLE     0x08000000                 /* Middle button mouse
-                                                     * flag for block commands
-                                                     */
+typedef uint64_t EDA_KEY;
+#define EDA_KEY_C UINT64_C
+
+static const EDA_KEY GR_KB_RIGHTSHIFT = EDA_KEY_C( 0x010000000 );
+static const EDA_KEY GR_KB_LEFTSHIFT  = EDA_KEY_C( 0x020000000 );
+static const EDA_KEY GR_KB_CTRL       = EDA_KEY_C( 0x040000000 );
+static const EDA_KEY GR_KB_ALT        = EDA_KEY_C( 0x080000000 );
+static const EDA_KEY GR_KB_SHIFT      = GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT;
+static const EDA_KEY GR_KB_SHIFTCTRL  = GR_KB_SHIFT | GR_KB_CTRL;
+static const EDA_KEY MOUSE_MIDDLE     = EDA_KEY_C( 0x008000000 );
+static const EDA_KEY GR_KEY_INVALID   = EDA_KEY_C( 0x100000000 );
+static const EDA_KEY GR_KEY_NONE      = EDA_KEY_C( 0 );
 
 /// default name for nameless projects
 #define NAMELESS_PROJECT wxT( "noname" )
diff --git a/include/draw_frame.h b/include/draw_frame.h
index 791a3ff..7765e97 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -516,7 +516,7 @@ public:
      * @param aPosition The current cursor position in logical (drawing) units.
      * @param aHotKey A key event used for application specific control if not zero.
      */
-    virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 )
+    virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 )
     {
         return false;
     }
@@ -642,7 +642,7 @@ public:
      * initializes the block command including the command type, initial position,
      * and other variables.
      */
-    virtual bool HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition );
+    virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition );
 
     /**
      * Function BlockCommand
@@ -653,7 +653,7 @@ public:
      * @param aKey = the key modifiers (Alt, Shift ...)
      * @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
      */
-    virtual int BlockCommand( int aKey );
+    virtual int BlockCommand( EDA_KEY aKey );
 
     /**
      * Function HandleBlockPlace( )
diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h
index 68f304b..103172c 100644
--- a/include/wxPcbStruct.h
+++ b/include/wxPcbStruct.h
@@ -620,7 +620,7 @@ public:
     ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
     void UseGalCanvas( bool aEnable );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     /**
      * Function ShowDesignRulesEditor
@@ -716,7 +716,7 @@ public:
      * @param aKey = the key modifiers (Alt, Shift ...)
      * @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
      */
-    virtual int BlockCommand( int aKey );
+    virtual int BlockCommand( EDA_KEY aKey );
 
     /**
      * Function HandleBlockPlace()
diff --git a/pagelayout_editor/controle.cpp b/pagelayout_editor/controle.cpp
index e14c18d..8405efc 100644
--- a/pagelayout_editor/controle.cpp
+++ b/pagelayout_editor/controle.cpp
@@ -32,7 +32,7 @@
 #include <pl_editor_frame.h>
 
 
-bool PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h
index ba3b7ae..67a5a29 100644
--- a/pagelayout_editor/pl_editor_frame.h
+++ b/pagelayout_editor/pl_editor_frame.h
@@ -267,7 +267,7 @@ public:
     void                ToPrinter( wxCommandEvent& event );
 
     void                Files_io( wxCommandEvent& event );
-    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     /** Virtual function PrintPage
      * used to print a page
diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp
index ae09495..fdbf2d8 100644
--- a/pcbnew/block.cpp
+++ b/pcbnew/block.cpp
@@ -178,7 +178,7 @@ void DIALOG_BLOCK_OPTIONS::ExecuteCommand( wxCommandEvent& event )
 }
 
 
-int PCB_EDIT_FRAME::BlockCommand( int aKey )
+int PCB_EDIT_FRAME::BlockCommand( EDA_KEY aKey )
 {
     int cmd = 0;
 
diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp
index 47a5dc5..386acfb 100644
--- a/pcbnew/block_module_editor.cpp
+++ b/pcbnew/block_module_editor.cpp
@@ -78,7 +78,7 @@ static void MoveMarkedItems( MODULE* module, wxPoint offset );
 static void DeleteMarkedItems( MODULE* module );
 
 
-int FOOTPRINT_EDIT_FRAME::BlockCommand( int key )
+int FOOTPRINT_EDIT_FRAME::BlockCommand( EDA_KEY key )
 {
     int cmd;
 
@@ -88,7 +88,15 @@ int FOOTPRINT_EDIT_FRAME::BlockCommand( int key )
         cmd = key & 0xFF;
         break;
 
-    case - 1:
+    case EDA_KEY_C( 0xffffffffffffffff ):   // -1L sign-extended to EDA_KEY
+    case EDA_KEY_C( 0x00000000ffffffff ):   // -1L zero-extended to EDA_KEY
+        // TODO: this case can be removed if a more exhaustive search for
+        // possible negative key values has been performed and came up
+        // empty.
+        wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" );
+        // fall through on release builds
+
+    case GR_KEY_INVALID:
         cmd = BLOCK_PRESELECT_MOVE;
         break;
 
diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp
index d9475f2..c7b231b 100644
--- a/pcbnew/controle.cpp
+++ b/pcbnew/controle.cpp
@@ -282,7 +282,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
 }
 
 
-bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp
index 11b4397..47bb737 100644
--- a/pcbnew/footprint_wizard_frame.cpp
+++ b/pcbnew/footprint_wizard_frame.cpp
@@ -452,7 +452,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
 }
 
 
-bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/pcbnew/footprint_wizard_frame.h b/pcbnew/footprint_wizard_frame.h
index a8ca4cb..65e6d0d 100644
--- a/pcbnew/footprint_wizard_frame.h
+++ b/pcbnew/footprint_wizard_frame.h
@@ -151,7 +151,7 @@ private:
     void                ClickOnPageList( wxCommandEvent& event );
     void                OnSetRelativeOffset( wxCommandEvent& event );
 
-    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     void                LoadSettings( wxConfigBase* aCfg ); // override virtual
     void                SaveSettings( wxConfigBase* aCfg ); // override virtual
diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h
index ce32a2e..9d81f48 100644
--- a/pcbnew/module_editor_frame.h
+++ b/pcbnew/module_editor_frame.h
@@ -167,7 +167,7 @@ public:
      */
     void Show3D_Frame( wxCommandEvent& event );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
     void OnVerticalToolbar( wxCommandEvent& aEvent );
 
     void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
@@ -242,7 +242,7 @@ public:
     bool Clear_Pcb( bool aQuery );
 
     /* handlers for block commands */
-    virtual int BlockCommand( int key );
+    virtual int BlockCommand( EDA_KEY key );
 
     /**
      * Function HandleBlockPlace
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index 5eb232c..4e3f822 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -696,7 +696,7 @@ void FOOTPRINT_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
 }
 
 
-bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp
index 6a39ae9..ef2a97e 100644
--- a/pcbnew/modview_frame.cpp
+++ b/pcbnew/modview_frame.cpp
@@ -591,7 +591,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
 }
 
 
-bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
 {
     bool eventHandled = true;
 
diff --git a/pcbnew/modview_frame.h b/pcbnew/modview_frame.h
index f0cf28d..2e1909b 100644
--- a/pcbnew/modview_frame.h
+++ b/pcbnew/modview_frame.h
@@ -104,7 +104,7 @@ private:
     void DClickOnFootprintList( wxCommandEvent& event );
     void OnSetRelativeOffset( wxCommandEvent& event );
 
-    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
 
     ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
     EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
-- 
2.7.0


Follow ups