Eeschema, Pcbnew: fix minor issues about mouse cursor position, when loading files or entering sheets.

This commit is contained in:
jean-pierre charras 2011-03-01 19:45:21 +01:00
parent cdffc3d15f
commit ec400bf7c7
11 changed files with 35 additions and 21 deletions

View File

@ -48,8 +48,11 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
*/
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
{
GetScreen()->SetZoom( BestZoom() ); // Set the best zoom and get center point.
RedrawScreen( GetScreen()->GetScrollCenterPosition(), aWarpPointer );
BASE_SCREEN * screen = GetScreen();
screen->SetZoom( BestZoom() ); // Set the best zoom and get center point.
if( screen->m_FirstRedraw )
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
RedrawScreen( screen->GetScrollCenterPosition(), aWarpPointer );
}

View File

@ -21,7 +21,7 @@
/*****************************************************************************
* Routine to save an EESchema file. *
* FileSave controls how the file is to be saved - under what name. *
* Returns TRUE if the file has been saved. *
* Returns true if the file has been saved. *
*****************************************************************************/
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* screen, int FileSave )
{
@ -212,8 +212,8 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
screen->m_Commentaire2.Empty();
screen->m_Commentaire3.Empty();
screen->m_Commentaire4.Empty();
LoadProjectFile( wxEmptyString, TRUE );
Zoom_Automatique( TRUE );
LoadProjectFile( wxEmptyString, true );
Zoom_Automatique( false );
SetSheetNumberAndCount();
DrawPanel->Refresh();
return true;
@ -223,7 +223,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg );
LoadProjectFile( wxEmptyString, FALSE );
LoadProjectFile( wxEmptyString, false );
// Clear (if needed) the current active library in libedit because it could be
// removed from memory
@ -292,7 +292,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
if( !wxFileExists( g_RootSheet->GetScreen()->GetFileName() ) && !LibCacheExist )
{
Zoom_Automatique( FALSE );
Zoom_Automatique( false );
msg.Printf( _( "File <%s> not found." ),
GetChars( g_RootSheet->GetScreen()->GetFileName() ) );
DisplayInfoMessage( this, msg, 0 );
@ -306,7 +306,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
/* Redraw base screen (ROOT) if necessary. */
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
Zoom_Automatique( FALSE );
Zoom_Automatique( false );
SetSheetNumberAndCount();
DrawPanel->Refresh( true );
return diag;

View File

@ -263,12 +263,22 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
if( screen->m_FirstRedraw )
{
Zoom_Automatique( false );
screen->m_FirstRedraw = false;
Zoom_Automatique( true );
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
DrawPanel->MoveCursorToCrossHair();
}
else
{
DrawPanel->MoveCursorToCrossHair();
RedrawScreen( screen->GetScrollCenterPosition(), true );
}
// Now refresh DrawPanel. Should be not necessary, but because screen has changed
// the previous refresh has set all new draw parameters (scroll position ..)
// but most of time there were some inconsitencies about cursor parameters
// ( previous position of cursor ...) and artefacts can happen
// mainly when sheet size has changed
// This second refresh clears artefacts because at this point,
// all parameters are now updated
DrawPanel->Refresh();
}

View File

@ -175,7 +175,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
}
}
Zoom_Automatique( true );
Zoom_Automatique( false );
g_SaveTime = time( NULL );
// Synchronize layers tools with actual active layer:

View File

@ -122,8 +122,9 @@ bool WinEDA_App::OnInit()
// meaning here
SetTopWindow( frame ); // Set GerbView mainframe on top
frame->Show( TRUE ); // Show GerbView mainframe
frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
frame->Show( true ); // Show GerbView mainframe
frame->Zoom_Automatique( true ); // Zoom fit in frame
frame->GetScreen()->m_FirstRedraw = false;
Read_Config();

View File

@ -164,7 +164,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
m_ModuleEditFrame->Show( true );
m_ModuleEditFrame->Zoom_Automatique( true );
m_ModuleEditFrame->Zoom_Automatique( false );
}
else
m_ModuleEditFrame->Iconize( false );

View File

@ -30,7 +30,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn );
DrawPanel->MoveCursorToCrossHair();
}
}

View File

@ -66,7 +66,7 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
ReFillLayerWidget();
Zoom_Automatique( true );
Zoom_Automatique( false );
return true;
}
@ -109,7 +109,7 @@ bool WinEDA_ModuleEditFrame::Clear_Pcb( bool aQuery )
GetScreen()->Init();
GetScreen()->SetGrid( gridsize );
Zoom_Automatique( true );
Zoom_Automatique( false );
return true;
}

View File

@ -73,7 +73,7 @@ bool WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
Rotate_Module( NULL, Module, 0, false );
GetScreen()->ClrModify();
Zoom_Automatique( TRUE );
Zoom_Automatique( false );
return true;
}

View File

@ -254,7 +254,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0;
Zoom_Automatique( true );
Zoom_Automatique( false );
}
break;
}
@ -360,7 +360,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0;
GetScreen()->ClrModify();
Zoom_Automatique( true );
Zoom_Automatique( false );
if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
break;
@ -416,7 +416,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
}
}
GetScreen()->ClrModify();
Zoom_Automatique( true );
Zoom_Automatique( false );
if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
break;

View File

@ -150,6 +150,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
}
frame->Zoom_Automatique( true );
frame->GetScreen()->m_FirstRedraw = false;
/* Load file specified in the command line. */
if( fn.IsOk() )