← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix typing problems with GR_KB_* constants

 

Updated patch attached, tested on Linux 64 and Windows 64, works fine.

On Tue, Jan 19, 2016 at 11:06:18AM -0500, Chris Pavlina wrote:
> I made a few silly mistakes in the patch, I'm testing an updated one on multiple platforms currently.
> 
> 1. I switched to uint32_t as well. uint64_t shouldn't be a _problem_, 
>    I've just been yelled at for wasting precious, precious memory ;)
> 
> 2. The real problem is that I used cstdint, which I forgot is a C++11 
>    thing. Fixed to use boost/cstdint.hpp, which is available on all
>    C++ versions. (Note: don't use stdint.h from C, that's not going to
>    work properly on all platforms even if it does work on most.)
> 
> 3. Couple more tidy-ups of things I made a bit more complex than they 
>    should be.
> 
> I'm testing on Linux 64-bit and Windows 64-bit, that's all that's 
> available to me.
> 
> 
> On Tue, Jan 19, 2016 at 05:03:34PM +0100, jp charras wrote:
> > Le 19/01/2016 15:02, Chris Pavlina a écrit :
> > > Just ignore this patch.
> > > On Jan 14, 2016 18:56, "Chris Pavlina" <pavlina.chris@xxxxxxxxx> wrote:
> > > 
> > >> 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
> > 
> > << .. >>
> > 
> > Using am uint32 for typedef EDA_KEY works for me, and should fix the
> > issue 1445606
> > 
> > 
> > -- 
> > Jean-Pierre CHARRAS
> > 
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
>From 2f4a1c26ad0343ed59cb0ff074fec3153544e1a5 Mon Sep 17 00:00:00 2001
From: Chris Pavlina <pavlina.chris@xxxxxxxxx>
Date: Tue, 19 Jan 2016 10:56:20 -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             | 13 ++++++++++---
 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                       | 29 +++++++++++++++++------------
 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         | 11 +++++++++--
 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, 70 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..865d4e6 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,18 @@ int LIB_EDIT_FRAME::BlockCommand( int key )
         cmd = key & 0xFF;
         break;
 
-    case -1:
+    case EDA_KEY_C( 0xffffffff ):   // -1
+        // Historically, -1 has been used as a key, which can cause bit flag
+        // clashes with unaware code. On debug builds, catch any old code that
+        // might still be doing this. TODO: remove if sure all this old code is gone.
+        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 9832de0..362b1fc 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 7b9cad0..06c4169 100644
--- a/eeschema/libeditframe.h
+++ b/eeschema/libeditframe.h
@@ -332,7 +332,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 );
 
@@ -606,7 +606,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 45b820f..f057a4f 100644
--- a/eeschema/schframe.h
+++ b/eeschema/schframe.h
@@ -269,7 +269,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
@@ -1228,7 +1228,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..4ddd157 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 <boost/cstdint.hpp>
 
 #include <wx/wx.h>
 #include <wx/confbase.h>
@@ -49,17 +50,21 @@ 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
-                                                     */
+// This type could be extended to 64 bits to add room for more flags.
+// For compatibility with old code, keep flag bits out of the least
+// significant nibble (0xF).
+typedef uint32_t EDA_KEY;
+#define EDA_KEY_C UINT32_C
+
+static const EDA_KEY GR_KB_RIGHTSHIFT = EDA_KEY_C( 0x01000000 );
+static const EDA_KEY GR_KB_LEFTSHIFT  = EDA_KEY_C( 0x02000000 );
+static const EDA_KEY GR_KB_CTRL       = EDA_KEY_C( 0x04000000 );
+static const EDA_KEY GR_KB_ALT        = EDA_KEY_C( 0x08000000 );
+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( 0x10000000 );
+static const EDA_KEY GR_KEY_INVALID   = EDA_KEY_C( 0x80000000 );
+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..c156cc7 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,14 @@ int FOOTPRINT_EDIT_FRAME::BlockCommand( int key )
         cmd = key & 0xFF;
         break;
 
-    case - 1:
+    case EDA_KEY_C( 0xffffffff ):   // -1
+        // Historically, -1 has been used as a key, which can cause bit flag
+        // clashes with unaware code. On debug builds, catch any old code that
+        // might still be doing this. TODO: remove if sure all this old code is gone.
+        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

References