Commit ee003180 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Global variable removal and minor Doxygen comment fixes.

* Remove global key press variable.  The key press is know passed to
  GeneralControl().
* Removed unused old mouse buttons global variable.
parent c9688dee
......@@ -73,8 +73,6 @@ const wxString AllFilesWildcard( _( "All files (*)|*" ) );
wxString g_ProductName = wxT( "KiCad E.D.A. " );
bool g_ShowPageLimits = true;
wxString g_UserLibDirBuffer;
int g_MouseOldButtons;
int g_KeyPressed;
wxString g_Prj_Default_Config_FullFilename;
wxString g_Prj_Config_LocalFilename;
......
......@@ -814,7 +814,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
static bool ignoreNextLeftButtonRelease = false;
static EDA_DRAW_PANEL* LastPanel = NULL;
int localrealbutt = 0, localbutt = 0, localkey = 0;
int localrealbutt = 0, localbutt = 0;
BASE_SCREEN* screen = GetScreen();
if( !screen )
......@@ -846,7 +846,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
else
return;
if( !event.IsButton() && !event.Moving() && !event.Dragging() && !localkey )
if( !event.IsButton() && !event.Moving() && !event.Dragging() )
{
return;
}
......@@ -888,8 +888,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
int kbstat = 0;
g_KeyPressed = localkey;
if( event.ShiftDown() )
kbstat |= GR_KB_SHIFT;
......@@ -899,8 +897,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
if( event.AltDown() )
kbstat |= GR_KB_ALT;
g_MouseOldButtons = localrealbutt;
// Calling Double Click and Click functions :
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{
......@@ -941,7 +937,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
}
/* Calling the general function on mouse changes (and pseudo key commands) */
GetParent()->GeneralControle( &DC, event.GetLogicalPosition( DC ) );
GetParent()->GeneralControl( &DC, event.GetLogicalPosition( DC ), 0 );
/*******************************/
/* Control of block commands : */
......@@ -1090,10 +1086,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
{
long key, localkey;
int localkey;
wxPoint pos;
key = localkey = event.GetKeyCode();
localkey = event.GetKeyCode();
switch( localkey )
{
......@@ -1121,7 +1117,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
localkey |= GR_KB_CTRL;
if( event.AltDown() )
localkey |= GR_KB_ALT;
if( event.ShiftDown() && (key > 256) )
if( event.ShiftDown() && (event.GetKeyCode() > 256) )
localkey |= GR_KB_SHIFT;
/* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
......@@ -1135,8 +1131,6 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
BASE_SCREEN* Screen = GetScreen();
g_KeyPressed = localkey;
// Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition();
......@@ -1144,7 +1138,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
Screen->SetMousePosition( pos );
GetParent()->GeneralControle( &DC, pos );
GetParent()->GeneralControl( &DC, pos, localkey );
#if 0
event.Skip(); // Allow menu shortcut processing
......
......@@ -311,7 +311,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
}
void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
wxPoint oldpos;
......@@ -325,7 +325,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosit
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
switch( aHotKey )
{
case WXK_F1:
cmd.SetId( ID_POPUP_ZOOM_IN );
......
......@@ -48,7 +48,7 @@ public:
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void GeneralControle( wxDC* DC, const wxPoint& aPosition );
void GeneralControl( wxDC* DC, const wxPoint& aPosition, int aHotKey = 0 );
void InstallOptionsDisplay( wxCommandEvent& event );
MODULE* Get_Module( const wxString& CmpName );
......
......@@ -232,19 +232,18 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
}
void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = aPosition;
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
switch( aHotKey )
{
case 0:
break;
......@@ -274,7 +273,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
break;
default:
hotkey = g_KeyPressed;
break;
}
......@@ -295,31 +293,30 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
}
if( hotkey )
if( aHotKey )
{
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
else
OnHotKey( aDC, hotkey, aPosition, NULL );
OnHotKey( aDC, aHotKey, aPosition, NULL );
}
UpdateStatusBar(); /* Display cursor coordinates info */
}
void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = aPosition;
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
switch( aHotKey )
{
case 0:
break;
......@@ -349,7 +346,6 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
break;
default:
hotkey = g_KeyPressed;
break;
}
......@@ -370,31 +366,30 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
}
if( hotkey )
if( aHotKey )
{
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
else
OnHotKey( aDC, hotkey, aPosition, NULL );
OnHotKey( aDC, aHotKey, aPosition, NULL );
}
UpdateStatusBar();
}
void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
SCH_SCREEN* screen = GetScreen();
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = aPosition;
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
switch( aHotKey )
{
case 0:
break;
......@@ -424,7 +419,6 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
break;
default:
hotkey = g_KeyPressed;
break;
}
......@@ -445,12 +439,12 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
}
if( hotkey )
if( aHotKey )
{
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
else
OnHotKey( aDC, hotkey, aPosition, NULL );
OnHotKey( aDC, aHotKey, aPosition, NULL );
}
UpdateStatusBar();
......
......@@ -105,7 +105,7 @@ public:
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
void LoadSettings();
void SaveSettings();
......
......@@ -69,7 +69,7 @@ public:
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
void LoadSettings();
void SaveSettings();
......
......@@ -8,11 +8,10 @@
#include "gerbview.h"
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
void WinEDA_GerberFrame::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = aPosition;
pos = GetScreen()->GetNearestGridPosition( pos );
......@@ -20,7 +19,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed )
switch( aHotKey )
{
case WXK_NUMPAD8:
case WXK_UP:
......@@ -47,7 +46,6 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
break;
default:
hotkey = g_KeyPressed;
break;
}
......@@ -67,9 +65,9 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
}
if( hotkey )
if( aHotKey )
{
OnHotKey( aDC, hotkey, NULL );
OnHotKey( aDC, aHotKey, NULL );
}
UpdateStatusBar();
......
......@@ -377,8 +377,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
bool Read_GERBER_File( const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Function Read_D_Code_File
......
......@@ -156,9 +156,6 @@ extern wxString g_ProductName;
/* Default user lib path can be left void, if the standard lib path is used */
extern wxString g_UserLibDirBuffer;
extern int g_MouseOldButtons;
extern int g_KeyPressed;
extern bool g_ShowPageLimits; // TRUE to display the page limits
/* File name extension definitions. */
......
......@@ -109,7 +109,7 @@ public:
void Process_Config( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
void SaveProjectFile( wxWindow* displayframe, bool askoverwrite = true );
......
......@@ -387,7 +387,7 @@ public:
void ReFillLayerWidget();
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Function ShowDesignRulesEditor
......@@ -590,7 +590,7 @@ public:
/**
* Function ReadPcbFile
* reads a board file &ltfile&gt.brd
* @param File - The file to read from.
* @param aReader The line reader object to read from.
* @param Append if 0: a previously loaded board is deleted before loading
* the file else all items of the board file are added to the
* existing board
......@@ -750,10 +750,10 @@ public:
/**
* Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param DC = the current device context
* @param aDC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void OnEditItemRequest( wxDC* DC, BOARD_ITEM* aItem );
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );
// Highlight functions:
......
......@@ -390,7 +390,7 @@ public:
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
/**
* Function GeneralControle
* Function GeneralControl
* performs application specific control using \a aDC at \a aPosition in logical units.
* <p>
* Override this function for application specific control. This function gets
......@@ -398,8 +398,9 @@ public:
*</p>
* @param aDC A device context.
* @param aPosition The current cursor position in logical (drawing) units.
* @param aHotKey A key event used for appication specific control if not zero.
*/
virtual void GeneralControle( wxDC* aDC, const wxPoint& aPosition ) { /* dummy */ }
virtual void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ) { }
virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent );
......
......@@ -96,9 +96,7 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
/**
* Function ReadDescr
* Read description from a given line in "*.brd" format.
* @param aLine The current line which contains the first line of description.
* @param aLine The FILE to read next lines (currently not used).
* @param aLineNum a point to the line count (currently not used).
* @param aReader The line reader object which contains the first line of description.
* @return int - > 0 if success reading else 0.
*/
int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
......
......@@ -226,11 +226,10 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
}
void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
void WinEDA_PcbFrame::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
// Save the board after the time out :
......@@ -264,7 +263,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed )
switch( aHotKey )
{
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
......@@ -291,7 +290,6 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
break;
default:
hotkey = g_KeyPressed;
break;
}
......@@ -365,9 +363,9 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
#endif
}
if( hotkey )
if( aHotKey )
{
OnHotKey( aDC, hotkey, aPosition );
OnHotKey( aDC, aHotKey, aPosition );
}
UpdateStatusBar(); /* Display new cursor coordinates */
......
......@@ -46,7 +46,7 @@ public:
bool OnHotkeyMoveItem( int aIdCommand );
bool OnHotkeyRotateItem( int aIdCommand );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* aDC, const wxPoint& aPosition );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
void OnVerticalToolbar( wxCommandEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
......
......@@ -330,18 +330,17 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
}
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
void WinEDA_ModuleEditFrame::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = aPosition;
pos = GetScreen()->GetNearestGridPosition( aPosition );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed )
switch( aHotKey )
{
case WXK_NUMPAD8:
case WXK_UP:
......@@ -368,7 +367,6 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
break;
default:
hotkey = g_KeyPressed;
break;
}
......@@ -388,9 +386,9 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
}
}
if( hotkey )
if( aHotKey )
{
OnHotKey( aDC, hotkey, aPosition );
OnHotKey( aDC, aHotKey, aPosition );
}
UpdateStatusBar();
......
......@@ -489,13 +489,6 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
}
/**
* Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param aDC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void WinEDA_PcbFrame::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
{
switch( aItem->Type() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment