Commit bfb03b8f authored by CHARRAS's avatar CHARRAS

pcbnew: onleftclick.cpp added. move onleftclick() and OnLeftDClick() from edit.cpp to it

parent f066aa18
......@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Sep-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew
create new file onleftclick.cpp
move onleftcligk() and onleftDcligk() from edit.cpp to onleftclick.cpp
2007-Sep-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
......
......@@ -92,7 +92,14 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
// Simple localisation des elements si possible
if( BlockActive )
{
AddMenusForBlock( PopMenu, this );
PopMenu->AppendSeparator();
return;
}
// Simple localisation des elements si possible
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = SchematicGeneralLocateAndDisplay( FALSE );
......@@ -121,18 +128,13 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
}
else
{
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive )
if( DrawStruct && DrawStruct->m_Flags )
{
if( BlockActive )
AddMenusForBlock( PopMenu, this );
else
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
PopMenu->AppendSeparator();
}
}
if( BlockActive )
return;
if( DrawStruct == NULL )
{
if( m_CurrentScreen != ScreenSch )
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,6 +11,7 @@ OBJECTS= $(TARGET).o classpcb.o\
modedit_undo_redo.o\
block_module_editor.o\
onrightclick.o\
onleftclick.o\
modedit_onclick.o\
via_edit.o\
wxprint.o \
......
This diff is collapsed.
......@@ -120,11 +120,20 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
BOARD_ITEM* item = GetCurItem();
DrawPanel->CursorOff( &dc );
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
// If command in progress: Put the Cancel command (if needed) and End command
// If command or block in progress: Put the Cancel command (if needed) and the End command
if( BlockActive )
{
createPopUpBlockMenu( aPopMenu );
aPopMenu->AppendSeparator();
return;
}
DrawPanel->CursorOff( &dc );
if( m_ID_current_state )
{
if( item && item->m_Flags )
......@@ -141,24 +150,14 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
else
{
if( (item && item->m_Flags) || BlockActive )
if( item && item->m_Flags )
{
if( BlockActive )
createPopUpBlockMenu( aPopMenu );
else
{
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
}
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
aPopMenu->AppendSeparator();
}
}
if( BlockActive )
{
DrawPanel->CursorOn( &dc );
return;
}
/* Select a proper item */
if( !item || !item->m_Flags )
......@@ -434,9 +433,9 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
/****************************************/
/*********************************************************/
void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
/****************************************/
/*********************************************************/
/* Create Pop sub menu for block commands
*/
......
......@@ -743,7 +743,7 @@ 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;
static bool IgnoreNextLeftButtonRelease = false;
if( event.Leaving() || event.Entering() )
{
......@@ -846,14 +846,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
{
m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
LastClickIsADoubleClick = true;
IgnoreNextLeftButtonRelease = true;
}
else if( event.LeftUp() && screen->BlockLocate.m_State==STATE_NO_BLOCK )
if ( ! LastClickIsADoubleClick )
if ( ! IgnoreNextLeftButtonRelease )
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels );
if( event.LeftUp() ) LastClickIsADoubleClick = false;
if( event.LeftUp() ) IgnoreNextLeftButtonRelease = false;
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{
......@@ -878,7 +878,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
m_CanStartBlock = -1;
// A new command block can start after a release buttons
// Avoid a false start block when a dialog bos is demiss,
// Avoid a false start block when a dialog box is demiss,
// or when changing panels in hierachy navigation
if( !event.LeftIsDown() && !event.MiddleIsDown() )
{
......@@ -900,6 +900,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
{
m_AutoPAN_Request = FALSE;
m_Parent->HandleBlockPlace( &DC );
IgnoreNextLeftButtonRelease = true;
}
}
else if( (m_CanStartBlock >= 0 )
......
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