GetScreenPosition is available in >= 2.8.0 only.

This commit is contained in:
f3nix 2007-12-08 23:24:14 +00:00
parent 4ce4631da6
commit b29de1ccbe
1 changed files with 14 additions and 9 deletions

View File

@ -186,7 +186,7 @@ wxPoint WinEDA_DrawPanel::CalcAbsolutePosition( const wxPoint& rel_pos )
/*********************************************************************/
/* retourne la position absolue en pixels de la position rel_pos,
* donnée en position relative scrollée (en pixel)
* donn<EFBFBD>e en position relative scroll<EFBFBD>e (en pixel)
*/
{
wxPoint pos;
@ -862,7 +862,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
g_MouseOldButtons = localrealbutt;
// Appel des fonctions liées au Double Click ou au Click
// Appel des fonctions li<EFBFBD>es au Double Click ou au Click
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
{
m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels );
@ -986,7 +986,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
// Arret de block sur un double click ( qui peut provoquer un move block
// si on déplace la souris dans ce double click
// si on d<EFBFBD>place la souris dans ce double click
if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) )
{
if( screen->BlockLocate.m_Command != BLOCK_IDLE )
@ -1066,15 +1066,20 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
}
}
#if wxCHECK_VERSION(2, 8, 0)
/* some key commands use the mouse position: refresh it */
wxPoint mouse_pos = wxGetMousePosition(); // Get the mouse position on screen
wxPoint win_pos = GetScreenPosition(); // get the draw area (panel)position on screen
mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel
/* Compute absolute m_MousePosition in pixel units (i.e. considering the current scrool) : */
Screen->m_MousePositionInPixels = CalcAbsolutePosition( mouse_pos );
mouse_pos -= win_pos; // mouse_pos = is the mouse position relative to the panel
/* Compute absolute m_MousePosition in user units: */
Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels );
/* Compute absolute m_MousePosition in pixel units (i.e. considering the current scrool) : */
Screen->m_MousePositionInPixels = CalcAbsolutePosition( mouse_pos );
/* Compute absolute m_MousePosition in user units: */
Screen->m_MousePosition = CursorRealPosition( Screen->m_MousePositionInPixels );
#else
#endif
m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels );