Commit a9771817 authored by charras's avatar charras

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
......@@ -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:
......
......@@ -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 )
......@@ -289,8 +299,8 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
void WinEDA_DrawPanel::PostDirtyRect( EDA_Rect aRect )
{
D(printf("1) PostDirtyRect( x=%d, y=%d, width=%d, height=%d)\n",
aRect.m_Pos.x, aRect.m_Pos.y, aRect.m_Size.x, aRect.m_Size.y );)
D( printf( "1) PostDirtyRect( x=%d, y=%d, width=%d, height=%d)\n",
aRect.m_Pos.x, aRect.m_Pos.y, aRect.m_Size.x, aRect.m_Size.y ); )
// Convert the rect coordinates and size to pixels (make a draw clip box):
ConvertPcbUnitsToPixelsUnits( &aRect );
......@@ -302,8 +312,8 @@ void WinEDA_DrawPanel::PostDirtyRect( EDA_Rect aRect )
aRect.m_Size.x += 2; // += 1 is not enough!
aRect.m_Size.y += 2;
D(printf("2) PostDirtyRect( x=%d, y=%d, width=%d, height=%d)\n",
aRect.m_Pos.x, aRect.m_Pos.y, aRect.m_Size.x, aRect.m_Size.y );)
D( printf( "2) PostDirtyRect( x=%d, y=%d, width=%d, height=%d)\n",
aRect.m_Pos.x, aRect.m_Pos.y, aRect.m_Size.x, aRect.m_Size.y ); )
// pass wxRect() via EDA_Rect::operator wxRect() overload
RefreshRect( aRect, TRUE );
......@@ -621,7 +631,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#endif
#if 0 && defined(DEBUG)
#if 0 && defined (DEBUG)
printf( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n",
PaintClipBox.x,
PaintClipBox.y,
......@@ -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();
*/
}
......
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