Fix default menu alt key accelerator bug. (fixes lp:1035151)
* Add hot key handled return indicator to DRAW_FRAME::GeneralControl() and DRAW_FRAME::OnHotKey() and all classed derived from DRAW_FRAME. * Add code to all GeneralControl() and OnHotKey() functions to return true if hot key was handled. * Call event skip in DRAW_PANEL::OnKeyEvent() when key event is not handled to allow default menu event handler to function properly.
This commit is contained in:
parent
020a0ae477
commit
ec9cd765bc
|
@ -219,24 +219,17 @@ void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
|
|||
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::ReCreateMenuBar()
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1389,7 +1389,9 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
|||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -327,13 +327,15 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
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 );
|
||||
|
@ -373,12 +375,17 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
|
|||
case ' ':
|
||||
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||
break;
|
||||
|
||||
default:
|
||||
eventHandled = false;
|
||||
}
|
||||
|
||||
SetCrossHairPosition( pos );
|
||||
RefreshCrossHair( oldpos, aPosition, aDC );
|
||||
|
||||
UpdateStatusBar(); /* Display new cursor coordinates */
|
||||
|
||||
return eventHandled;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 );
|
||||
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 );
|
||||
|
||||
|
|
|
@ -203,19 +203,22 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
|
|||
}
|
||||
|
||||
|
||||
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 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
|||
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 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
|||
|
||||
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 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -319,10 +319,10 @@ struct EDA_HOTKEY_CONFIG s_Viewlib_Hokeys_Descr[] =
|
|||
* 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 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
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 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
}
|
||||
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 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
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 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Hot key handled.
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -318,9 +318,9 @@ public:
|
|||
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 );
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
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 );
|
||||
|
|
|
@ -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 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
|||
|
||||
if( aHotKey )
|
||||
{
|
||||
OnHotKey( aDC, aHotKey, aPosition );
|
||||
eventHandled = OnHotKey( aDC, aHotKey, aPosition );
|
||||
}
|
||||
|
||||
UpdateStatusBar();
|
||||
|
||||
return eventHandled;
|
||||
}
|
||||
|
|
|
@ -511,7 +511,7 @@ public:
|
|||
* @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 @@ public:
|
|||
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
|
||||
|
|
|
@ -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 @@ struct EDA_HOTKEY_CONFIG s_Gerbview_Hokeys_Descr[] =
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* 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 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
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 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -278,7 +278,8 @@ public:
|
|||
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 @@ public:
|
|||
*/
|
||||
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 @@ 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 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
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
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 @@ public:
|
|||
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
|
||||
|
|
|
@ -416,7 +416,7 @@ public:
|
|||
* @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 @@ public:
|
|||
*/
|
||||
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
|
||||
|
|
|
@ -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 @@ void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
|||
|
||||
if( aHotKey )
|
||||
{
|
||||
OnHotKey( aDC, aHotKey, aPosition );
|
||||
eventHandled = OnHotKey( aDC, aHotKey, aPosition );
|
||||
}
|
||||
|
||||
UpdateStatusBar();
|
||||
|
||||
return eventHandled;
|
||||
}
|
||||
|
|
|
@ -116,15 +116,7 @@ struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[] =
|
|||
};
|
||||
|
||||
|
||||
/* 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 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
|
|||
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 );
|
||||
|
@ -236,6 +228,8 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
|
|||
|
||||
default:
|
||||
wxMessageBox( wxT( "Unknown hotkey" ) );
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ public:
|
|||
* @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 @@ public:
|
|||
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
|
||||
|
|
|
@ -281,19 +281,22 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
@ -342,8 +345,10 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
|||
|
||||
if( aHotKey )
|
||||
{
|
||||
OnHotKey( aDC, aHotKey, aPosition );
|
||||
eventHandled = OnHotKey( aDC, aHotKey, aPosition );
|
||||
}
|
||||
|
||||
UpdateStatusBar(); // Display new cursor coordinates
|
||||
|
||||
return eventHandled;
|
||||
}
|
||||
|
|
|
@ -454,13 +454,15 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
|
|||
}
|
||||
|
||||
|
||||
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 );
|
||||
|
@ -500,12 +502,17 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
|||
case ' ':
|
||||
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||
break;
|
||||
|
||||
default:
|
||||
eventHandled = false;
|
||||
}
|
||||
|
||||
SetCrossHairPosition( pos );
|
||||
RefreshCrossHair( oldpos, aPosition, aDC );
|
||||
|
||||
UpdateStatusBar(); // Display new cursor coordinates
|
||||
|
||||
return eventHandled;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ private:
|
|||
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
|
||||
|
|
|
@ -104,11 +104,11 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
|
@ -128,7 +128,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
return;
|
||||
return false;
|
||||
|
||||
int hk_id = HK_Descr->m_Idcommand;
|
||||
|
||||
|
@ -156,8 +156,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
{
|
||||
default:
|
||||
case HK_NOT_FOUND:
|
||||
return;
|
||||
break;
|
||||
return false;
|
||||
|
||||
case HK_LEFT_CLICK:
|
||||
OnLeftClick( aDC, aPosition );
|
||||
|
@ -427,16 +426,16 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
|
||||
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() )
|
||||
|
@ -461,13 +460,13 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -574,6 +573,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
evt.SetId( evt_type );
|
||||
GetEventHandler()->ProcessEvent( evt );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
|
|||
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 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
|
|||
OnHotkeyRotateItem( HK_ROTATE_ITEM );
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
* 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 @@ public:
|
|||
*/
|
||||
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 );
|
||||
|
|
|
@ -616,13 +616,15 @@ void FOOTPRINT_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
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
|
||||
|
@ -642,10 +644,12 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
|||
|
||||
if( aHotKey )
|
||||
{
|
||||
OnHotKey( aDC, aHotKey, aPosition );
|
||||
eventHandled = OnHotKey( aDC, aHotKey, aPosition );
|
||||
}
|
||||
|
||||
UpdateStatusBar();
|
||||
|
||||
return eventHandled;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -591,13 +591,15 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
|
|||
}
|
||||
|
||||
|
||||
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 );
|
||||
|
@ -637,12 +639,17 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
|||
case ' ':
|
||||
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||
break;
|
||||
|
||||
default:
|
||||
eventHandled = false;
|
||||
}
|
||||
|
||||
SetCrossHairPosition( pos );
|
||||
RefreshCrossHair( oldpos, aPosition, aDC );
|
||||
|
||||
UpdateStatusBar(); // Display new cursor coordinates
|
||||
|
||||
return eventHandled;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ private:
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue