test case for OnLeftClick() handling enhancements

This commit is contained in:
CHARRAS 2007-09-27 07:41:34 +00:00
parent e64d8e523c
commit 10c442911c
5 changed files with 53 additions and 23 deletions

View File

@ -4,6 +4,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================

View File

@ -17,7 +17,7 @@ KICAD_BIN = /f/kicad/winexe
#Define the wxWidget path (if not found in environment variables):
ifndef WXWIN
WXWIN=f:/wxMSW-2.8.5
WXWIN=f:/wxMSW-2.8.6
endif
LIBVERSION = 2.8

View File

@ -124,7 +124,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break;
case TYPETRACK:
text << _( "Track" ) << wxT( " " ) << ( (TRACK*) item )->m_NetCode;
text << _( "Track" ) << wxT( " " );
net = aPcb->FindNet( ( (TRACK*) item )->m_NetCode );
if( net )
{
@ -134,7 +134,18 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break;
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;
case TYPEVIA:
@ -151,7 +162,7 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break;
case TYPECOTATION:
text << _( "Dimension" ) << wxT(" \"") << ((COTATION*) item)->GetText() << wxT("\"");
text << _( "Dimension" ) << wxT( " \"" ) << ( (COTATION*) item )->GetText() << wxT( "\"" );
break;
case TYPEMIRE:

View File

@ -27,15 +27,16 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
*/
{
BOARD_ITEM* DrawStruct = GetCurItem();
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->CursorOff( DC );
bool exit = false;
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{
DrawPanel->m_IgnoreMouseEvents = TRUE;
DrawPanel->CursorOff( DC );
switch( DrawStruct->Type() )
{
case TYPETRACK:
@ -43,40 +44,40 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct->m_Flags & IS_DRAGGED )
{
PlaceDraggedTrackSegment( (TRACK*) DrawStruct, DC );
goto out;
exit = true;
}
break;
case TYPETEXTE:
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, DC );
goto out;
exit = true;
break;
case TYPETEXTEMODULE:
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
goto out;
exit = true;
break;
case TYPEPAD:
PlacePad( (D_PAD*) DrawStruct, DC );
goto out;
exit = true;
break;
case TYPEMODULE:
Place_Module( (MODULE*) DrawStruct, DC );
goto out;
exit = true;
break;
case TYPEMIRE:
Place_Mire( (MIREPCB*) DrawStruct, DC );
goto out;
exit = true;
break;
case TYPEDRAWSEGMENT:
if( m_ID_current_state == 0 )
{
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, DC );
goto out;
exit = true;
}
break;
@ -85,13 +86,18 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
DisplayError( this,
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) &&
!wxGetKeyState(WXK_CONTROL) && !wxGetKeyState(WXK_TAB) )
!wxGetKeyState(WXK_CONTROL) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct )
@ -310,10 +316,6 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
}
out:
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->CursorOn( DC );
}

View File

@ -743,7 +743,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
int localrealbutt = 0, localbutt = 0, localkey = 0;
BASE_SCREEN* screen = GetScreen();
static WinEDA_DrawPanel* LastPanel;
static bool LastClickIsADoubleClick = false;
if( event.Leaving() || event.Entering() )
{
m_CanStartBlock = -1;
@ -843,10 +844,16 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
// Appel des fonctions liées au Double Click ou au Click
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
{
m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
LastClickIsADoubleClick = true;
}
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) )
{
@ -856,6 +863,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
/* Appel de la fonction generale de gestion des mouvements souris
* et commandes clavier */
m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels );