Fix typing problems with GR_KB_* constants

This commit is contained in:
Chris Pavlina 2016-01-20 07:11:17 -05:00
parent cf9a9a09ad
commit c490e7dd06
26 changed files with 70 additions and 50 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 );

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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@softplc.com>
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* 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" )

View File

@ -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( )

View File

@ -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()

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;