Commit 10c44291 authored by CHARRAS's avatar CHARRAS

test case for OnLeftClick() handling enhancements

parent e64d8e52
...@@ -4,6 +4,15 @@ Started 2007-June-11 ...@@ -4,6 +4,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Sep-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
test case for OnLeftClick() handling enhancements.
TAB key removed, because is not needed for block selection and double click.
(SHIHT ou CTRL or ALT key is sufficient to suppress the popup menu
if needed for a double click )
Some work is still needed, of course
2007-Sep-26 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Sep-26 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
...@@ -17,7 +17,7 @@ KICAD_BIN = /f/kicad/winexe ...@@ -17,7 +17,7 @@ KICAD_BIN = /f/kicad/winexe
#Define the wxWidget path (if not found in environment variables): #Define the wxWidget path (if not found in environment variables):
ifndef WXWIN ifndef WXWIN
WXWIN=f:/wxMSW-2.8.5 WXWIN=f:/wxMSW-2.8.6
endif endif
LIBVERSION = 2.8 LIBVERSION = 2.8
......
...@@ -124,7 +124,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -124,7 +124,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPETRACK: case TYPETRACK:
text << _( "Track" ) << wxT( " " ) << ( (TRACK*) item )->m_NetCode; text << _( "Track" ) << wxT( " " );
net = aPcb->FindNet( ( (TRACK*) item )->m_NetCode ); net = aPcb->FindNet( ( (TRACK*) item )->m_NetCode );
if( net ) if( net )
{ {
...@@ -134,7 +134,18 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -134,7 +134,18 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPEZONE: case TYPEZONE:
text << _( "Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ); text << _( "Zone" ) << wxT( " " );
{
wxString TimeStampText;
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
text << TimeStampText;
}
net = aPcb->FindNet( ( (SEGZONE*) item )->m_NetCode );
if( net )
{
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
}
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() );
break; break;
case TYPEVIA: case TYPEVIA:
...@@ -151,7 +162,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -151,7 +162,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPECOTATION: case TYPECOTATION:
text << _( "Dimension" ) << wxT(" \"") << ((COTATION*) item)->GetText() << wxT("\""); text << _( "Dimension" ) << wxT( " \"" ) << ( (COTATION*) item )->GetText() << wxT( "\"" );
break; break;
case TYPEMIRE: case TYPEMIRE:
......
...@@ -27,15 +27,16 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -27,15 +27,16 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
*/ */
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
bool exit = false;
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->CursorOff( DC );
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) ) if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{ {
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{ {
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->CursorOff( DC );
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPETRACK: case TYPETRACK:
...@@ -43,40 +44,40 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -43,40 +44,40 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct->m_Flags & IS_DRAGGED ) if( DrawStruct->m_Flags & IS_DRAGGED )
{ {
PlaceDraggedTrackSegment( (TRACK*) DrawStruct, DC ); PlaceDraggedTrackSegment( (TRACK*) DrawStruct, DC );
goto out; exit = true;
} }
break; break;
case TYPETEXTE: case TYPETEXTE:
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC ); Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
goto out; exit = true;
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC ); PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
goto out; exit = true;
break; break;
case TYPEPAD: case TYPEPAD:
PlacePad( (D_PAD*) DrawStruct, DC ); PlacePad( (D_PAD*) DrawStruct, DC );
goto out; exit = true;
break; break;
case TYPEMODULE: case TYPEMODULE:
Place_Module( (MODULE*) DrawStruct, DC ); Place_Module( (MODULE*) DrawStruct, DC );
goto out; exit = true;
break; break;
case TYPEMIRE: case TYPEMIRE:
Place_Mire( (MIREPCB*) DrawStruct, DC ); Place_Mire( (MIREPCB*) DrawStruct, DC );
goto out; exit = true;
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
{ {
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC ); Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC );
goto out; exit = true;
} }
break; break;
...@@ -85,13 +86,18 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -85,13 +86,18 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DisplayError( this, DisplayError( this,
wxT( "WinEDA_PcbFrame::OnLeftClick() err: m_Flags != 0" ) ); wxT( "WinEDA_PcbFrame::OnLeftClick() err: m_Flags != 0" ) );
goto out; exit = true;
} }
break;
} }
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->CursorOn( DC );
if ( exit ) return;
} }
else if( !wxGetKeyState(WXK_SHIFT) && !wxGetKeyState(WXK_ALT) && else if( !wxGetKeyState(WXK_SHIFT) && !wxGetKeyState(WXK_ALT) &&
!wxGetKeyState(WXK_CONTROL) && !wxGetKeyState(WXK_TAB) ) !wxGetKeyState(WXK_CONTROL) )
{ {
DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct ) if( DrawStruct )
...@@ -310,10 +316,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -310,10 +316,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
out:
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->CursorOn( DC );
} }
......
...@@ -743,7 +743,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -743,7 +743,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
int localrealbutt = 0, localbutt = 0, localkey = 0; int localrealbutt = 0, localbutt = 0, localkey = 0;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
static WinEDA_DrawPanel* LastPanel; static WinEDA_DrawPanel* LastPanel;
static bool LastClickIsADoubleClick = false;
if( event.Leaving() || event.Entering() ) if( event.Leaving() || event.Entering() )
{ {
m_CanStartBlock = -1; m_CanStartBlock = -1;
...@@ -843,10 +844,16 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -843,10 +844,16 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
// Appel des fonctions lies au Double Click ou au Click // Appel des fonctions lies au Double Click ou au Click
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
{
m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels ); m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
LastClickIsADoubleClick = true;
}
else if( event.LeftUp() && screen->BlockLocate.m_State==STATE_NO_BLOCK ) else if( event.LeftUp() && screen->BlockLocate.m_State==STATE_NO_BLOCK )
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels ); if ( ! LastClickIsADoubleClick )
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
if( event.LeftUp() ) LastClickIsADoubleClick = false;
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{ {
...@@ -856,6 +863,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -856,6 +863,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
} }
/* Appel de la fonction generale de gestion des mouvements souris /* Appel de la fonction generale de gestion des mouvements souris
* et commandes clavier */ * et commandes clavier */
m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels ); m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels );
......
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