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 ...@@ -4,6 +4,14 @@ 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-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> 2007-Sep-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+ all + all
......
...@@ -92,7 +92,14 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, ...@@ -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 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) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawStruct = SchematicGeneralLocateAndDisplay( FALSE ); DrawStruct = SchematicGeneralLocateAndDisplay( FALSE );
...@@ -121,18 +128,13 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, ...@@ -121,18 +128,13 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
} }
else else
{ {
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive ) if( DrawStruct && DrawStruct->m_Flags )
{ {
if( BlockActive ) ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
AddMenusForBlock( PopMenu, this ); PopMenu->AppendSeparator();
else
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
PopMenu->AppendSeparator();
} }
} }
if( BlockActive )
return;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
if( m_CurrentScreen != ScreenSch ) 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\ ...@@ -11,6 +11,7 @@ OBJECTS= $(TARGET).o classpcb.o\
modedit_undo_redo.o\ modedit_undo_redo.o\
block_module_editor.o\ block_module_editor.o\
onrightclick.o\ onrightclick.o\
onleftclick.o\
modedit_onclick.o\ modedit_onclick.o\
via_edit.o\ via_edit.o\
wxprint.o \ wxprint.o \
......
This diff is collapsed.
...@@ -120,11 +120,20 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -120,11 +120,20 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
DrawPanel->CursorOff( &dc );
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu 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( m_ID_current_state )
{ {
if( item && item->m_Flags ) if( item && item->m_Flags )
...@@ -141,24 +150,14 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -141,24 +150,14 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
} }
else else
{ {
if( (item && item->m_Flags) || BlockActive ) if( item && item->m_Flags )
{ {
if( BlockActive ) ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
createPopUpBlockMenu( aPopMenu ); _( "Cancel" ), cancel_xpm );
else
{
ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm );
}
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
} }
if( BlockActive )
{
DrawPanel->CursorOn( &dc );
return;
}
/* Select a proper item */ /* Select a proper item */
if( !item || !item->m_Flags ) if( !item || !item->m_Flags )
...@@ -434,9 +433,9 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -434,9 +433,9 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
} }
/****************************************/ /*********************************************************/
void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu ) void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu )
/****************************************/ /*********************************************************/
/* Create Pop sub menu for block commands /* Create Pop sub menu for block commands
*/ */
......
...@@ -743,7 +743,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -743,7 +743,7 @@ 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; static bool IgnoreNextLeftButtonRelease = false;
if( event.Leaving() || event.Entering() ) if( event.Leaving() || event.Entering() )
{ {
...@@ -846,14 +846,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -846,14 +846,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
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; IgnoreNextLeftButtonRelease = true;
} }
else if( event.LeftUp() && screen->BlockLocate.m_State==STATE_NO_BLOCK ) else if( event.LeftUp() && screen->BlockLocate.m_State==STATE_NO_BLOCK )
if ( ! LastClickIsADoubleClick ) if ( ! IgnoreNextLeftButtonRelease )
m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels ); 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) ) if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
{ {
...@@ -878,7 +878,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -878,7 +878,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
m_CanStartBlock = -1; m_CanStartBlock = -1;
// A new command block can start after a release buttons // 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 // or when changing panels in hierachy navigation
if( !event.LeftIsDown() && !event.MiddleIsDown() ) if( !event.LeftIsDown() && !event.MiddleIsDown() )
{ {
...@@ -900,6 +900,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -900,6 +900,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
{ {
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = FALSE;
m_Parent->HandleBlockPlace( &DC ); m_Parent->HandleBlockPlace( &DC );
IgnoreNextLeftButtonRelease = true;
} }
} }
else if( (m_CanStartBlock >= 0 ) 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