Commit ee003180 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

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
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -73,8 +73,6 @@ const wxString AllFilesWildcard( _( "All files (*)|*" ) );
wxString       g_ProductName    = wxT( "KiCad E.D.A.  " );
wxString       g_ProductName    = wxT( "KiCad E.D.A.  " );
bool           g_ShowPageLimits = true;
bool           g_ShowPageLimits = true;
wxString       g_UserLibDirBuffer;
wxString       g_UserLibDirBuffer;
int            g_MouseOldButtons;
int            g_KeyPressed;


wxString       g_Prj_Default_Config_FullFilename;
wxString       g_Prj_Default_Config_FullFilename;
wxString       g_Prj_Config_LocalFilename;
wxString       g_Prj_Config_LocalFilename;
+7 −13
Original line number Original line Diff line number Diff line
@@ -814,7 +814,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
    static bool ignoreNextLeftButtonRelease = false;
    static bool ignoreNextLeftButtonRelease = false;
    static EDA_DRAW_PANEL* LastPanel = NULL;
    static EDA_DRAW_PANEL* LastPanel = NULL;


    int                    localrealbutt = 0, localbutt = 0, localkey = 0;
    int                    localrealbutt = 0, localbutt = 0;
    BASE_SCREEN*           screen = GetScreen();
    BASE_SCREEN*           screen = GetScreen();


    if( !screen )
    if( !screen )
@@ -846,7 +846,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
    else
    else
        return;
        return;


    if( !event.IsButton() && !event.Moving() && !event.Dragging() && !localkey )
    if( !event.IsButton() && !event.Moving() && !event.Dragging() )
    {
    {
        return;
        return;
    }
    }
@@ -888,8 +888,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )


    int kbstat = 0;
    int kbstat = 0;


    g_KeyPressed = localkey;

    if( event.ShiftDown() )
    if( event.ShiftDown() )
        kbstat |= GR_KB_SHIFT;
        kbstat |= GR_KB_SHIFT;


@@ -899,8 +897,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
    if( event.AltDown() )
    if( event.AltDown() )
        kbstat |= GR_KB_ALT;
        kbstat |= GR_KB_ALT;


    g_MouseOldButtons = localrealbutt;

    // Calling Double Click and Click functions :
    // Calling Double Click and Click functions :
    if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
    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) */
    /* 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 : */
    /* Control of block commands : */
@@ -1090,10 +1086,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )


void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
{
{
    long key, localkey;
    int localkey;
    wxPoint pos;
    wxPoint pos;


    key = localkey = event.GetKeyCode();
    localkey = event.GetKeyCode();


    switch( localkey )
    switch( localkey )
    {
    {
@@ -1121,7 +1117,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
        localkey |= GR_KB_CTRL;
        localkey |= GR_KB_CTRL;
    if( event.AltDown() )
    if( event.AltDown() )
        localkey |= GR_KB_ALT;
        localkey |= GR_KB_ALT;
    if( event.ShiftDown() && (key > 256) )
    if( event.ShiftDown() && (event.GetKeyCode() > 256) )
        localkey |= GR_KB_SHIFT;
        localkey |= GR_KB_SHIFT;


    /* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
    /* 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();
    BASE_SCREEN* Screen = GetScreen();


    g_KeyPressed = localkey;

    // Some key commands use the current mouse position: refresh it.
    // Some key commands use the current mouse position: refresh it.
    pos = wxGetMousePosition() - GetScreenPosition();
    pos = wxGetMousePosition() - GetScreenPosition();


@@ -1144,7 +1138,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
    pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
    pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
    Screen->SetMousePosition( pos );
    Screen->SetMousePosition( pos );


    GetParent()->GeneralControle( &DC, pos );
    GetParent()->GeneralControl( &DC, pos, localkey );


#if 0
#if 0
    event.Skip();   // Allow menu shortcut processing
    event.Skip();   // Allow menu shortcut processing
+2 −2
Original line number Original line Diff line number Diff line
@@ -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;
    wxRealPoint gridSize;
    wxPoint     oldpos;
    wxPoint     oldpos;
@@ -325,7 +325,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosit
    oldpos = screen->GetCrossHairPosition();
    oldpos = screen->GetCrossHairPosition();
    gridSize = screen->GetGridSize();
    gridSize = screen->GetGridSize();


    switch( g_KeyPressed )
    switch( aHotKey )
    {
    {
    case WXK_F1:
    case WXK_F1:
        cmd.SetId( ID_POPUP_ZOOM_IN );
        cmd.SetId( ID_POPUP_ZOOM_IN );
+1 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ public:
    void    OnLeftClick( wxDC* DC, const wxPoint& MousePos );
    void    OnLeftClick( wxDC* DC, const wxPoint& MousePos );
    void    OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
    void    OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
    bool    OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
    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 );
    void    InstallOptionsDisplay( wxCommandEvent& event );
    MODULE* Get_Module( const wxString& CmpName );
    MODULE* Get_Module( const wxString& CmpName );


+15 −21
Original line number Original line Diff line number Diff line
@@ -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;
    wxRealPoint gridSize;
    SCH_SCREEN* screen = GetScreen();
    SCH_SCREEN* screen = GetScreen();
    wxPoint     oldpos;
    wxPoint     oldpos;
    int         hotkey = 0;
    wxPoint     pos = aPosition;
    wxPoint     pos = aPosition;


    pos = screen->GetNearestGridPosition( pos );
    pos = screen->GetNearestGridPosition( pos );
    oldpos = screen->GetCrossHairPosition();
    oldpos = screen->GetCrossHairPosition();
    gridSize = screen->GetGridSize();
    gridSize = screen->GetGridSize();


    switch( g_KeyPressed )
    switch( aHotKey )
    {
    {
    case 0:
    case 0:
        break;
        break;
@@ -274,7 +273,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
        break;
        break;


    default:
    default:
        hotkey = g_KeyPressed;
        break;
        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 )
        if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
            OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
        else
        else
            OnHotKey( aDC, hotkey, aPosition, NULL );
            OnHotKey( aDC, aHotKey, aPosition, NULL );
    }
    }


    UpdateStatusBar();    /* Display cursor coordinates info */
    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;
    wxRealPoint gridSize;
    SCH_SCREEN* screen = GetScreen();
    SCH_SCREEN* screen = GetScreen();
    wxPoint     oldpos;
    wxPoint     oldpos;
    int         hotkey = 0;
    wxPoint     pos = aPosition;
    wxPoint     pos = aPosition;


    pos = screen->GetNearestGridPosition( pos );
    pos = screen->GetNearestGridPosition( pos );
    oldpos = screen->GetCrossHairPosition();
    oldpos = screen->GetCrossHairPosition();
    gridSize = screen->GetGridSize();
    gridSize = screen->GetGridSize();


    switch( g_KeyPressed )
    switch( aHotKey )
    {
    {
    case 0:
    case 0:
        break;
        break;
@@ -349,7 +346,6 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
        break;
        break;


    default:
    default:
        hotkey = g_KeyPressed;
        break;
        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 )
        if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
            OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
        else
        else
            OnHotKey( aDC, hotkey, aPosition, NULL );
            OnHotKey( aDC, aHotKey, aPosition, NULL );
    }
    }


    UpdateStatusBar();
    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;
    wxRealPoint gridSize;
    SCH_SCREEN* screen = GetScreen();
    SCH_SCREEN* screen = GetScreen();
    wxPoint     oldpos;
    wxPoint     oldpos;
    int         hotkey = 0;
    wxPoint     pos = aPosition;
    wxPoint     pos = aPosition;


    pos = screen->GetNearestGridPosition( pos );
    pos = screen->GetNearestGridPosition( pos );
    oldpos = screen->GetCrossHairPosition();
    oldpos = screen->GetCrossHairPosition();
    gridSize = screen->GetGridSize();
    gridSize = screen->GetGridSize();


    switch( g_KeyPressed )
    switch( aHotKey )
    {
    {
    case 0:
    case 0:
        break;
        break;
@@ -424,7 +419,6 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
        break;
        break;


    default:
    default:
        hotkey = g_KeyPressed;
        break;
        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 )
        if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
            OnHotKey( aDC, hotkey, aPosition, screen->GetCurItem() );
            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
        else
        else
            OnHotKey( aDC, hotkey, aPosition, NULL );
            OnHotKey( aDC, aHotKey, aPosition, NULL );
    }
    }


    UpdateStatusBar();
    UpdateStatusBar();
Loading