Fix issue in auto panning while moving in EDA_DRAW_PANEL::OnMouseLeaving()

This commit is contained in:
jean-pierre charras 2013-06-10 15:23:58 +02:00
parent 00adc67d2a
commit 39993e27e4
3 changed files with 20 additions and 10 deletions

View File

@ -15,7 +15,7 @@ Contribute to KiCad (under Linux)
cd ~/ cd ~/
bzr branch lp:kicad kicad_john bzr branch lp:kicad kicad_john
4) Read coding_style_policy.pdt, in <kicad_sources>/Documentation, 4) Read coding_style_policy.pdf, in <kicad_sources>/Documentation,
and other docs. and other docs.
5) Modify/add source code. 5) Modify/add source code.

View File

@ -830,16 +830,26 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents ) if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents )
return; return;
// Auto pan if mouse has left the client window // Auto pan when mouse has left the client window
// Ensure the cross_hair position is updated,
// because it will be used to center the screen.
// We use a position inside the client window
wxSize size = GetClientSize(); wxSize size = GetClientSize();
wxPoint cross_hair_pos = event.GetPosition();
cross_hair_pos.x = std::min( cross_hair_pos.x, size.x );
cross_hair_pos.y = std::min( cross_hair_pos.y, size.x );
cross_hair_pos.x = std::max( cross_hair_pos.x, 0 );
cross_hair_pos.y = std::max( cross_hair_pos.y, 0 );
if( size.x <= event.GetX() || event.GetX() < 0 || INSTALL_UNBUFFERED_DC( dc, this );
size.y <= event.GetY() || event.GetY() < 0 ) cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
{ cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this ); GetScreen()->SetCrossHairPosition( cross_hair_pos );
GetEventHandler()->ProcessEvent( cmd );
} wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
event.Skip(); event.Skip();
} }

View File

@ -579,7 +579,7 @@ void WORKSHEET_LAYOUT::SetLayout()
if( fullFileName.IsEmpty() || !wxFileExists( fullFileName ) ) if( fullFileName.IsEmpty() || !wxFileExists( fullFileName ) )
{ {
#if 0 #if 0
if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) ) if( !fullFileName.IsEmpty() )
{ {
wxLogMessage( wxT("Page layout file <%s> not found"), wxLogMessage( wxT("Page layout file <%s> not found"),
fullFileName.GetData() ); fullFileName.GetData() );