Commit a9771817 authored by charras's avatar charras
Browse files

subtle bug solved: no response to the first left click command after opening a...

subtle bug solved: no response to the first left click command after opening a dialog box (after an item edition, for instance)
parent 8bfb54bc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5,6 +5,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.


2008-Aug-26 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+all:
    subtle bug solved: no response to the first left click command after opening a dialog box
    (after an item edition, for instance)

2008-Aug-22 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema:
+74 −52
Original line number Diff line number Diff line
@@ -24,6 +24,16 @@
// Local defines
#define CURSOR_SIZE 12           // Cursor size in pixels

// Locad variables

/* Used to inhibit a response to a mouse left button release, after a double click
 * (when releasing the left button at the end of the second click
 * Used in eeschema to inhibit a mouse left release command when switching between
 * hierarchical sheets on a double click
 */
static bool s_IgnoreNextLeftButtonRelease = false;


// Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
@@ -909,7 +919,6 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
    int                      localrealbutt = 0, localbutt = 0, localkey = 0;
    BASE_SCREEN*             screen = GetScreen();
    static WinEDA_DrawPanel* LastPanel;
    static bool              IgnoreNextLeftButtonRelease = false;

    if( !screen )
        return;
@@ -1022,14 +1031,27 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
    if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
    {
        m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
        IgnoreNextLeftButtonRelease = true;

        // inhibit a response to the mouse left button release,
        // because we have a double click, and we do not want a new OnLeftClick command at end of this Double Click
        s_IgnoreNextLeftButtonRelease = true;
    }
    else if( event.LeftUp() )
    {
        if( screen->BlockLocate.m_State==STATE_NO_BLOCK  &&  !IgnoreNextLeftButtonRelease )
        if( screen->BlockLocate.m_State==STATE_NO_BLOCK     // A block command is in progress: a left up is the end of block
            && !s_IgnoreNextLeftButtonRelease )             // This is the end of a double click, already seen
            m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );

        IgnoreNextLeftButtonRelease = false;
        s_IgnoreNextLeftButtonRelease = false;
    }

    if( !event.LeftIsDown() )
    {
        /* be sure there is a response to a left button release command
         * even when a LeftUp event is not seen
         * happens when a double click opens a dialog box, and the release mouse button is made when the dialog box is open
         */
        s_IgnoreNextLeftButtonRelease = false;
    }

    if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
@@ -1087,7 +1109,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
            {
                m_AutoPAN_Request = FALSE;
                m_Parent->HandleBlockPlace( &DC );
                IgnoreNextLeftButtonRelease = true;
                s_IgnoreNextLeftButtonRelease = true;
            }
        }
        else if( (m_CanStartBlock >= 0 )
@@ -1186,8 +1208,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
    LastPanel = this;

    /* @todo: move this to where it is really needed, obviously not here in
        response to every mouse move event:
    m_Parent->SetToolbars();
     * response to every mouse move event:
     * m_Parent->SetToolbars();
     */
}