← Back to team overview

kicad-developers team mailing list archive

[PATCH] Default menu behavior fix.

 

I was looking at this bug report:

https://bugs.launchpad.net/bugs/1035151

and noticed that when the hot key is not handled the event is not passed
up to the parent frame by calling Skip() from the event handler.  The
attached patch against r5092 should fix the problem for all of the frame
windows that it effects.  I've done some testing and it looks like it
solves the problem but I would like some more testing to shake out any
corner cases that I may have missed before I commit the patch since it
has a potential for serious breakage.  I really would like if someone
with OSX can test it because that is the one platform that I cannot test
on.  Please let me know if can find any issues with it.

Thanks,

Wayne

=== modified file 'common/draw_frame.cpp'
--- common/draw_frame.cpp	2014-08-13 20:28:54 +0000
+++ common/draw_frame.cpp	2014-08-23 20:12:47 +0000
@@ -219,24 +219,17 @@
     event.Skip();
 }
 
-/* function SkipNextLeftButtonReleaseEvent
- * after calling this function, if the left mouse button
- * is down, the next left mouse button release event will be ignored.
- * It is is usefull for instance when closing a dialog on a mouse click,
- * to skip the next mouse left button release event
- * by the parent window, because the mouse button
- * clicked on the dialog is often released in the parent frame,
- * and therefore creates a left button released mouse event
- * which can be unwanted in some cases
- */
+
 void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent()
 {
    m_canvas->SetIgnoreLeftButtonReleaseEvent( true );
 }
 
+
 void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
 {
     SetGridVisibility( !IsGridVisible() );
+
     if( IsGalCanvasActive() )
     {
         GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
@@ -322,8 +315,9 @@
 }
 
 
-void EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
+bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
 {
+    return false;
 }
 
 

=== modified file 'common/draw_panel.cpp'
--- common/draw_panel.cpp	2014-07-20 15:23:48 +0000
+++ common/draw_panel.cpp	2014-08-23 17:01:27 +0000
@@ -1389,7 +1389,9 @@
     pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
 
     GetParent()->SetMousePosition( pos );
-    GetParent()->GeneralControl( &DC, pos, localkey );
+
+    if( !GetParent()->GeneralControl( &DC, pos, localkey ) )
+        event.Skip();
 }
 
 

=== modified file 'cvpcb/class_DisplayFootprintsFrame.cpp'
--- cvpcb/class_DisplayFootprintsFrame.cpp	2014-07-05 20:42:59 +0000
+++ cvpcb/class_DisplayFootprintsFrame.cpp	2014-08-23 18:52:20 +0000
@@ -325,13 +325,15 @@
 }
 
 
-void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
@@ -371,12 +373,17 @@
     case ' ':
         GetScreen()->m_O_Curseur = GetCrossHairPosition();
         break;
+
+    default:
+        eventHandled = false;
     }
 
     SetCrossHairPosition( pos );
     RefreshCrossHair( oldpos, aPosition, aDC );
 
     UpdateStatusBar();    /* Display new cursor coordinates */
+
+    return eventHandled;
 }
 
 

=== modified file 'cvpcb/class_DisplayFootprintsFrame.h'
--- cvpcb/class_DisplayFootprintsFrame.h	2014-04-02 13:38:59 +0000
+++ cvpcb/class_DisplayFootprintsFrame.h	2014-08-23 18:19:58 +0000
@@ -92,7 +92,7 @@
     void    OnLeftClick( wxDC* DC, const wxPoint& MousePos );
     void    OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
     bool    OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
-    void    GeneralControl( wxDC* DC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool    GeneralControl( wxDC* DC, const wxPoint& aPosition, int aHotKey = 0 );
     void    InstallOptionsDisplay( wxCommandEvent& event );
     MODULE* Get_Module( const wxString& CmpName );
 

=== modified file 'eeschema/controle.cpp'
--- eeschema/controle.cpp	2014-06-12 16:12:14 +0000
+++ eeschema/controle.cpp	2014-08-23 17:19:05 +0000
@@ -203,19 +203,22 @@
 }
 
 
-void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
     // for next cursor position
     // ( shift or ctrl key down are PAN command with mouse wheel)
     bool snapToGrid = true;
+
     if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
         snapToGrid = false;
 
@@ -236,28 +239,33 @@
         SCH_SCREEN* screen = GetScreen();
 
         if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
-            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
+            eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
         else
-            OnHotKey( aDC, aHotKey, aPosition, NULL );
+            eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
     }
 
     UpdateStatusBar();    /* Display cursor coordinates info */
+
+    return eventHandled;
 }
 
 
-void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
     // for next cursor position
     // ( shift or ctrl key down are PAN command with mouse wheel)
     bool snapToGrid = true;
+
     if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
         snapToGrid = false;
 
@@ -275,20 +283,24 @@
 
     if( aHotKey )
     {
-        OnHotKey( aDC, aHotKey, aPosition, NULL );
+        eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
     }
 
     UpdateStatusBar();
+
+    return eventHandled;
 }
 
 
-void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     wxPoint pos = aPosition;
@@ -304,10 +316,12 @@
         SCH_SCREEN* screen = GetScreen();
 
         if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
-            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
+            eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
         else
-            OnHotKey( aDC, aHotKey, aPosition, NULL );
+            eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
     }
 
-    UpdateStatusBar();    /* Display cursor coordinates info */
+    UpdateStatusBar();    // Display cursor coordinates info.
+
+    return eventHandled;
 }

=== modified file 'eeschema/hotkeys.cpp'
--- eeschema/hotkeys.cpp	2014-04-07 16:00:13 +0000
+++ eeschema/hotkeys.cpp	2014-08-23 17:11:08 +0000
@@ -319,10 +319,10 @@
  * Hot keys. Some commands are relative to the item under the mouse cursor
  * Commands are case insensitive
  */
-void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
+bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
 {
     if( aHotKey == 0 )
-        return;
+        return false;
 
     wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
 
@@ -354,13 +354,13 @@
         hotKey = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List );
 
     if( hotKey == NULL )
-        return;
+        return false;
 
     switch( hotKey->m_Idcommand )
     {
     default:
     case HK_NOT_FOUND:
-        return;
+        return false;
 
     case HK_HELP:       // Display Current hotkey list
         DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
@@ -531,18 +531,16 @@
         }
         break;
     }
+
+    // Hot key handled.
+    return true;
 }
 
 
-/*
- * Hot keys for the component editor. Some commands are relatives to the item
- * under the mouse cursor
- * Commands are case insensitive
- */
-void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
+bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
 {
     if( aHotKey == 0 )
-        return;
+        return false;
 
     wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
 
@@ -561,13 +559,13 @@
         hotKey = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List );
 
     if( hotKey == NULL )
-        return;
+        return false;
 
     switch( hotKey->m_Idcommand )
     {
     default:
     case HK_NOT_FOUND:
-        return;
+        return false;
 
     case HK_HELP:       // Display Current hotkey list
         DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
@@ -702,4 +700,7 @@
         }
         break;
     }
+
+    // Hot key handled.
+    return true;
 }

=== modified file 'eeschema/libeditframe.h'
--- eeschema/libeditframe.h	2014-08-13 20:28:54 +0000
+++ eeschema/libeditframe.h	2014-08-23 17:19:56 +0000
@@ -291,9 +291,9 @@
     double BestZoom();         // Returns the best zoom
     void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
 
-    void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
+    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
 
-    void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     void LoadSettings( wxConfigBase* aCfg );
 

=== modified file 'eeschema/viewlib_frame.h'
--- eeschema/viewlib_frame.h	2014-08-13 20:28:54 +0000
+++ eeschema/viewlib_frame.h	2014-08-23 17:19:39 +0000
@@ -87,7 +87,7 @@
     void ClickOnCmpList( wxCommandEvent& event );
     void OnSetRelativeOffset( wxCommandEvent& event );
 
-    void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     void LoadSettings( wxConfigBase* aCfg );
     void SaveSettings( wxConfigBase* aCfg );

=== modified file 'gerbview/controle.cpp'
--- gerbview/controle.cpp	2014-06-30 05:46:18 +0000
+++ gerbview/controle.cpp	2014-08-23 17:31:35 +0000
@@ -33,13 +33,15 @@
 #include <gerbview_frame.h>
 
 
-void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     wxPoint pos = aPosition;
@@ -51,8 +53,10 @@
 
     if( aHotKey )
     {
-        OnHotKey( aDC, aHotKey, aPosition );
+        eventHandled = OnHotKey( aDC, aHotKey, aPosition );
     }
 
     UpdateStatusBar();
+
+    return eventHandled;
 }

=== modified file 'gerbview/gerbview_frame.h'
--- gerbview/gerbview_frame.h	2014-07-14 18:59:41 +0000
+++ gerbview/gerbview_frame.h	2014-08-23 18:58:03 +0000
@@ -511,7 +511,7 @@
      * @param aPosition The cursor position in logical (drawing) units.
      * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
      */
-    void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
+    bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
 
     GERBER_DRAW_ITEM*   GerberGeneralLocateAndDisplay();
     GERBER_DRAW_ITEM*   Locate( const wxPoint& aPosition, int typeloc );
@@ -621,7 +621,7 @@
     bool                LoadExcellonFiles( const wxString& aFileName );
     bool                Read_EXCELLON_File( const wxString& aFullFileName );
 
-    void                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     /**
      * Set Size Items (Lines, Flashes) from DCodes List

=== modified file 'gerbview/hotkeys.cpp'
--- gerbview/hotkeys.cpp	2014-06-27 17:07:42 +0000
+++ gerbview/hotkeys.cpp	2014-08-23 17:33:20 +0000
@@ -1,3 +1,27 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 1992-2010 <Jean-Pierre Charras>
+ * Copyright (C) 1992-2010 KiCad Developers, see change_log.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
+ * 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
+ */
+
 /**
  * @file gerbview/hotkeys.cpp
  */
@@ -70,16 +94,7 @@
 };
 
 
-/*
- * Function OnHotKey.
- *  ** Commands are case insensitive **
- *  Some commands are relatives to the item under the mouse cursor
- * aDC = current device context
- * aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
- * aPosition The cursor position in logical (drawing) units.
- * aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
- */
-void GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem )
+bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem )
 {
     wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
     cmd.SetEventObject( this );
@@ -92,13 +107,13 @@
     EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Gerbview_Hotkey_List );
 
     if( HK_Descr == NULL )
-        return;
+        return false;
 
     switch( HK_Descr->m_Idcommand )
     {
     default:
     case HK_NOT_FOUND:
-        return;
+        return false;
 
     case HK_HELP:       // Display Current hotkey list
         DisplayHotkeyList( this, s_Gerbview_Hokeys_Descr );
@@ -162,4 +177,6 @@
         }
         break;
     }
+
+    return true;
 }

=== modified file 'include/draw_frame.h'
--- include/draw_frame.h	2014-07-09 08:34:00 +0000
+++ include/draw_frame.h	2014-08-23 20:12:33 +0000
@@ -278,7 +278,8 @@
     void OnMenuOpen( wxMenuEvent& event );
     void  OnMouseEvent( wxMouseEvent& event );
 
-    /** function SkipNextLeftButtonReleaseEvent
+    /**
+     * function SkipNextLeftButtonReleaseEvent
      * after calling this function, if the left mouse button
      * is down, the next left mouse button release event will be ignored.
      * It is is usefull for instance when closing a dialog on a mouse click,
@@ -290,7 +291,7 @@
      */
     void SkipNextLeftButtonReleaseEvent();
 
-    virtual void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
+    virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
                            EDA_ITEM* aItem = NULL );
 
     /**
@@ -433,7 +434,10 @@
      * @param aPosition The current cursor position in logical (drawing) units.
      * @param aHotKey A key event used for application specific control if not zero.
      */
-    virtual void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ) { }
+    virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 )
+    {
+        return false;
+    }
 
     /**
      * Function OnSize

=== modified file 'include/wxEeschemaStruct.h'
--- include/wxEeschemaStruct.h	2014-08-13 20:28:54 +0000
+++ include/wxEeschemaStruct.h	2014-08-23 18:52:29 +0000
@@ -243,7 +243,7 @@
     void Process_Config( wxCommandEvent& event );
     void OnSelectTool( wxCommandEvent& aEvent );
 
-    void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     /**
      * Function GetProjectFileParametersList
@@ -350,7 +350,7 @@
     void ReCreateVToolbar();
     void ReCreateOptToolbar();
     void ReCreateMenuBar();
-    void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
+    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
 
     /**
      * Function OnModify

=== modified file 'include/wxPcbStruct.h'
--- include/wxPcbStruct.h	2014-08-13 20:28:54 +0000
+++ include/wxPcbStruct.h	2014-08-23 18:27:12 +0000
@@ -416,7 +416,7 @@
      * @param aPosition The cursor position in logical (drawing) units.
      * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
      */
-    void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
+    bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
 
     /**
      * Function OnHotkeyDeleteItem
@@ -582,7 +582,7 @@
      */
     void SwitchCanvas( wxCommandEvent& aEvent );
 
-    void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     /**
      * Function ShowDesignRulesEditor

=== modified file 'pagelayout_editor/controle.cpp'
--- pagelayout_editor/controle.cpp	2014-06-12 16:12:14 +0000
+++ pagelayout_editor/controle.cpp	2014-08-23 19:52:35 +0000
@@ -32,14 +32,15 @@
 #include <pl_editor_frame.h>
 
 
-void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
-                                      int aHotKey )
+bool PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     wxPoint pos = aPosition;
@@ -52,8 +53,10 @@
 
     if( aHotKey )
     {
-        OnHotKey( aDC, aHotKey, aPosition );
+        eventHandled = OnHotKey( aDC, aHotKey, aPosition );
     }
 
     UpdateStatusBar();
+
+    return eventHandled;
 }

=== modified file 'pagelayout_editor/hotkeys.cpp'
--- pagelayout_editor/hotkeys.cpp	2014-06-07 16:20:23 +0000
+++ pagelayout_editor/hotkeys.cpp	2014-08-23 19:53:43 +0000
@@ -116,15 +116,7 @@
 };
 
 
-/* OnHotKey.
- *  ** Commands are case insensitive **
- *  Some commands are relative to the item under the mouse cursor
- * aDC = current device context
- * aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
- * aPosition The cursor position in logical (drawing) units.
- * aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
- */
-void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
+bool PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
                                 const wxPoint& aPosition, EDA_ITEM* aItem )
 {
     bool busy = GetScreen()->GetCurItem() != NULL;
@@ -142,14 +134,14 @@
         HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List );
 
     if( HK_Descr == NULL )
-        return;
+        return false;
 
     WORKSHEET_DATAITEM* item;
 
     switch( HK_Descr->m_Idcommand )
     {
     case HK_NOT_FOUND:
-        return;
+        return false;
 
     case HK_LEFT_CLICK:
         OnLeftClick( aDC, aPosition );
@@ -235,7 +227,9 @@
         break;
 
     default:
-        wxMessageBox( wxT("Unknown hotkey") );
-        return;
+        wxMessageBox( wxT( "Unknown hotkey" ) );
+        return false;
     }
+
+    return true;
 }

=== modified file 'pagelayout_editor/pl_editor_frame.h'
--- pagelayout_editor/pl_editor_frame.h	2014-06-30 05:46:18 +0000
+++ pagelayout_editor/pl_editor_frame.h	2014-08-23 19:04:28 +0000
@@ -235,7 +235,7 @@
      * @param aPosition The cursor position in logical (drawing) units.
      * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
      */
-    void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
+    bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
 
     void                Process_Settings( wxCommandEvent& event );
     void                Process_Config( wxCommandEvent& event );
@@ -254,7 +254,7 @@
     void                ToPrinter( wxCommandEvent& event );
 
     void                Files_io( wxCommandEvent& event );
-    void                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     /** Virtual function PrintPage
      * used to print a page

=== modified file 'pcbnew/controle.cpp'
--- pcbnew/controle.cpp	2014-07-09 11:50:27 +0000
+++ pcbnew/controle.cpp	2014-08-23 17:22:50 +0000
@@ -282,19 +282,22 @@
 }
 
 
-void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
     // for next cursor position
     // ( shift or ctrl key down are PAN command with mouse wheel)
     bool snapToGrid = true;
+
     if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
         snapToGrid = false;
 
@@ -343,8 +346,10 @@
 
     if( aHotKey )
     {
-        OnHotKey( aDC, aHotKey, aPosition );
+        eventHandled = OnHotKey( aDC, aHotKey, aPosition );
     }
 
     UpdateStatusBar();    // Display new cursor coordinates
+
+    return eventHandled;
 }

=== modified file 'pcbnew/footprint_wizard_frame.cpp'
--- pcbnew/footprint_wizard_frame.cpp	2014-06-12 16:12:14 +0000
+++ pcbnew/footprint_wizard_frame.cpp	2014-08-23 20:08:14 +0000
@@ -54,43 +54,43 @@
 
 BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
 
-// Window events
-EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
-EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
-EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
-
-// Toolbar events
-EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
-          FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
-
-EVT_TOOL( ID_FOOTPRINT_WIZARD_NEXT,
-          FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
-
-EVT_TOOL( ID_FOOTPRINT_WIZARD_PREVIOUS,
-          FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
-
-EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
-          FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint )
-
-EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
-          FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
-
-// listbox events
-EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
+    // Window events
+    EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
+    EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
+    EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
+
+     // Toolbar events
+    EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
+              FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
+
+    EVT_TOOL( ID_FOOTPRINT_WIZARD_NEXT,
+              FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
+
+    EVT_TOOL( ID_FOOTPRINT_WIZARD_PREVIOUS,
+              FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
+
+    EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
+              FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint )
+
+    EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
+              FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
+
+    // listbox events
+    EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
 
 
 #if wxCHECK_VERSION( 3, 0, 0 )
-EVT_GRID_CMD_CELL_CHANGED( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
-                          FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
+    EVT_GRID_CMD_CELL_CHANGED( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
+                               FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
 #else
-EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
-                          FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
+    EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
+                              FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
 #endif
 
-EVT_GRID_CMD_EDITOR_HIDDEN( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
-                            FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
+    EVT_GRID_CMD_EDITOR_HIDDEN( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
+                                FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
 
-EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset )
+    EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset )
 END_EVENT_TABLE()
 
 
@@ -455,13 +455,15 @@
 }
 
 
-void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     wxCommandEvent  cmd( wxEVT_COMMAND_MENU_SELECTED );
@@ -501,12 +503,17 @@
     case ' ':
         GetScreen()->m_O_Curseur = GetCrossHairPosition();
         break;
+
+    default:
+        eventHandled = false;
     }
 
     SetCrossHairPosition( pos );
     RefreshCrossHair( oldpos, aPosition, aDC );
 
     UpdateStatusBar();    // Display new cursor coordinates
+
+    return eventHandled;
 }
 
 

=== modified file 'pcbnew/footprint_wizard_frame.h'
--- pcbnew/footprint_wizard_frame.h	2014-05-18 15:16:59 +0000
+++ pcbnew/footprint_wizard_frame.h	2014-08-23 17:20:32 +0000
@@ -134,7 +134,7 @@
     void                ClickOnPageList( wxCommandEvent& event );
     void                OnSetRelativeOffset( wxCommandEvent& event );
 
-    void                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool                GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     void                LoadSettings( wxConfigBase* aCfg ); // override virtual
     void                SaveSettings( wxConfigBase* aCfg ); // override virtual

=== modified file 'pcbnew/hotkeys_board_editor.cpp'
--- pcbnew/hotkeys_board_editor.cpp	2014-06-29 13:05:51 +0000
+++ pcbnew/hotkeys_board_editor.cpp	2014-08-23 20:05:46 +0000
@@ -105,11 +105,11 @@
 }
 
 
-void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
+bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
                                EDA_ITEM* aItem )
 {
     if( aHotkeyCode == 0 )
-        return;
+        return false;
 
     bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetFlags();
     MODULE* module = NULL;
@@ -129,7 +129,7 @@
 
 
     if( HK_Descr == NULL )
-        return;
+        return false;
 
     int hk_id = HK_Descr->m_Idcommand;
 
@@ -157,8 +157,7 @@
     {
     default:
     case HK_NOT_FOUND:
-        return;
-        break;
+        return false;
 
     case HK_LEFT_CLICK:
         OnLeftClick( aDC, aPosition );
@@ -350,7 +349,7 @@
         break;
 
     case HK_RESET_GRID_ORIGIN:
-        SetGridOrigin( wxPoint(0,0) );
+        SetGridOrigin( wxPoint( 0,0 ) );
         OnModify();     // because grid origin is saved in board, show as modified
         m_canvas->Refresh();
         break;
@@ -428,16 +427,16 @@
 
     case HK_ADD_MICROVIA: // Place a micro via if a track is in progress
         if( GetToolId() != ID_TRACK_BUTT )
-            return;
+            return true;
 
         if( !itemCurrentlyEdited )                         // no track in progress: nothing to do
             break;
 
         if( GetCurItem()->Type() != PCB_TRACE_T )           // Should not occur
-            return;
+            return true;
 
         if( !GetCurItem()->IsNew() )
-            return;
+            return true;
 
         // place micro via and switch layer
         if( IsMicroViaAcceptable() )
@@ -462,13 +461,13 @@
         }
 
         if( GetToolId() != ID_TRACK_BUTT )
-            return;
+            return true;
 
         if( GetCurItem()->Type() != PCB_TRACE_T )
-            return;
+            return true;
 
         if( !GetCurItem()->IsNew() )
-            return;
+            return true;
 
         evt_type = hk_id == HK_ADD_BLIND_BURIED_VIA ?
             ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA : ID_POPUP_PCB_PLACE_THROUGH_VIA;
@@ -575,6 +574,8 @@
         evt.SetId( evt_type );
         GetEventHandler()->ProcessEvent( evt );
     }
+
+    return true;
 }
 
 

=== modified file 'pcbnew/hotkeys_module_editor.cpp'
--- pcbnew/hotkeys_module_editor.cpp	2014-04-07 16:00:13 +0000
+++ pcbnew/hotkeys_module_editor.cpp	2014-08-23 17:30:08 +0000
@@ -18,11 +18,11 @@
  */
 
 
-void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
+bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
                                      EDA_ITEM* aItem )
 {
     if( aHotKey == 0 )
-        return;
+        return false;
 
     bool           blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
     BOARD_ITEM*    item     = GetCurItem();
@@ -41,14 +41,13 @@
         HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List );
 
     if( HK_Descr == NULL )
-        return;
+        return false;
 
     switch( HK_Descr->m_Idcommand )
     {
     default:
     case HK_NOT_FOUND:
-        return;
-        break;
+        return false;
 
     case HK_HELP:                   // Display Current hotkey list
         DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
@@ -133,6 +132,8 @@
         OnHotkeyRotateItem( HK_ROTATE_ITEM );
         break;
     }
+
+    return true;
 }
 
 

=== modified file 'pcbnew/module_editor_frame.h'
--- pcbnew/module_editor_frame.h	2014-07-09 11:50:27 +0000
+++ pcbnew/module_editor_frame.h	2014-08-23 17:21:00 +0000
@@ -124,7 +124,7 @@
      * case insensitive
      * </p>
      */
-    void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
+    bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
 
     bool OnHotkeyEditItem( int aIdCommand );
     bool OnHotkeyDeleteItem( int aIdCommand );
@@ -137,7 +137,7 @@
      */
     void Show3D_Frame( wxCommandEvent& event );
 
-    void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
     void OnVerticalToolbar( wxCommandEvent& aEvent );
 
     void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );

=== modified file 'pcbnew/moduleframe.cpp'
--- pcbnew/moduleframe.cpp	2014-08-13 20:28:54 +0000
+++ pcbnew/moduleframe.cpp	2014-08-23 17:25:57 +0000
@@ -617,13 +617,15 @@
 }
 
 
-void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
@@ -643,10 +645,12 @@
 
     if( aHotKey )
     {
-        OnHotKey( aDC, aHotKey, aPosition );
+        eventHandled = OnHotKey( aDC, aHotKey, aPosition );
     }
 
     UpdateStatusBar();
+
+    return eventHandled;
 }
 
 

=== modified file 'pcbnew/modview_frame.cpp'
--- pcbnew/modview_frame.cpp	2014-08-13 20:28:54 +0000
+++ pcbnew/modview_frame.cpp	2014-08-23 17:27:02 +0000
@@ -592,13 +592,15 @@
 }
 
 
-void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
+bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
 {
+    bool eventHandled = true;
+
     // Filter out the 'fake' mouse motion after a keyboard movement
     if( !aHotKey && m_movingCursorWithKeyboard )
     {
         m_movingCursorWithKeyboard = false;
-        return;
+        return false;
     }
 
     wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
@@ -638,12 +640,17 @@
     case ' ':
         GetScreen()->m_O_Curseur = GetCrossHairPosition();
         break;
+
+    default:
+        eventHandled = false;
     }
 
     SetCrossHairPosition( pos );
     RefreshCrossHair( oldpos, aPosition, aDC );
 
     UpdateStatusBar();    // Display new cursor coordinates
+
+    return eventHandled;
 }
 
 

=== modified file 'pcbnew/modview_frame.h'
--- pcbnew/modview_frame.h	2014-07-09 13:10:32 +0000
+++ pcbnew/modview_frame.h	2014-08-23 17:20:40 +0000
@@ -112,7 +112,7 @@
     void DClickOnFootprintList( wxCommandEvent& event );
     void OnSetRelativeOffset( wxCommandEvent& event );
 
-    void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
+    bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
 
     void LoadSettings( wxConfigBase* aCfg );    // override virtual
     void SaveSettings( wxConfigBase* aCfg );    // override virtual


Follow ups