Eeschema, Pcbnew: fix minor issues about mouse cursor position, when loading files or entering sheets.
This commit is contained in:
parent
cdffc3d15f
commit
ec400bf7c7
|
@ -48,8 +48,11 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
|
||||||
*/
|
*/
|
||||||
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
||||||
{
|
{
|
||||||
GetScreen()->SetZoom( BestZoom() ); // Set the best zoom and get center point.
|
BASE_SCREEN * screen = GetScreen();
|
||||||
RedrawScreen( GetScreen()->GetScrollCenterPosition(), aWarpPointer );
|
screen->SetZoom( BestZoom() ); // Set the best zoom and get center point.
|
||||||
|
if( screen->m_FirstRedraw )
|
||||||
|
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
|
||||||
|
RedrawScreen( screen->GetScrollCenterPosition(), aWarpPointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Routine to save an EESchema file. *
|
* Routine to save an EESchema file. *
|
||||||
* FileSave controls how the file is to be saved - under what name. *
|
* 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 )
|
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_Commentaire2.Empty();
|
||||||
screen->m_Commentaire3.Empty();
|
screen->m_Commentaire3.Empty();
|
||||||
screen->m_Commentaire4.Empty();
|
screen->m_Commentaire4.Empty();
|
||||||
LoadProjectFile( wxEmptyString, TRUE );
|
LoadProjectFile( wxEmptyString, true );
|
||||||
Zoom_Automatique( TRUE );
|
Zoom_Automatique( false );
|
||||||
SetSheetNumberAndCount();
|
SetSheetNumberAndCount();
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
return true;
|
return true;
|
||||||
|
@ -223,7 +223,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
|
||||||
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
|
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
|
|
||||||
LoadProjectFile( wxEmptyString, FALSE );
|
LoadProjectFile( wxEmptyString, false );
|
||||||
|
|
||||||
// Clear (if needed) the current active library in libedit because it could be
|
// Clear (if needed) the current active library in libedit because it could be
|
||||||
// removed from memory
|
// removed from memory
|
||||||
|
@ -292,7 +292,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
|
||||||
|
|
||||||
if( !wxFileExists( g_RootSheet->GetScreen()->GetFileName() ) && !LibCacheExist )
|
if( !wxFileExists( g_RootSheet->GetScreen()->GetFileName() ) && !LibCacheExist )
|
||||||
{
|
{
|
||||||
Zoom_Automatique( FALSE );
|
Zoom_Automatique( false );
|
||||||
msg.Printf( _( "File <%s> not found." ),
|
msg.Printf( _( "File <%s> not found." ),
|
||||||
GetChars( g_RootSheet->GetScreen()->GetFileName() ) );
|
GetChars( g_RootSheet->GetScreen()->GetFileName() ) );
|
||||||
DisplayInfoMessage( this, msg, 0 );
|
DisplayInfoMessage( this, msg, 0 );
|
||||||
|
@ -306,7 +306,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
|
||||||
|
|
||||||
/* Redraw base screen (ROOT) if necessary. */
|
/* Redraw base screen (ROOT) if necessary. */
|
||||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||||
Zoom_Automatique( FALSE );
|
Zoom_Automatique( false );
|
||||||
SetSheetNumberAndCount();
|
SetSheetNumberAndCount();
|
||||||
DrawPanel->Refresh( true );
|
DrawPanel->Refresh( true );
|
||||||
return diag;
|
return diag;
|
||||||
|
|
|
@ -263,12 +263,22 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
|
||||||
|
|
||||||
if( screen->m_FirstRedraw )
|
if( screen->m_FirstRedraw )
|
||||||
{
|
{
|
||||||
|
Zoom_Automatique( false );
|
||||||
screen->m_FirstRedraw = false;
|
screen->m_FirstRedraw = false;
|
||||||
Zoom_Automatique( true );
|
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
|
||||||
|
DrawPanel->MoveCursorToCrossHair();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
|
||||||
RedrawScreen( screen->GetScrollCenterPosition(), true );
|
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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Zoom_Automatique( true );
|
Zoom_Automatique( false );
|
||||||
g_SaveTime = time( NULL );
|
g_SaveTime = time( NULL );
|
||||||
|
|
||||||
// Synchronize layers tools with actual active layer:
|
// Synchronize layers tools with actual active layer:
|
||||||
|
|
|
@ -122,8 +122,9 @@ bool WinEDA_App::OnInit()
|
||||||
// meaning here
|
// meaning here
|
||||||
|
|
||||||
SetTopWindow( frame ); // Set GerbView mainframe on top
|
SetTopWindow( frame ); // Set GerbView mainframe on top
|
||||||
frame->Show( TRUE ); // Show GerbView mainframe
|
frame->Show( true ); // Show GerbView mainframe
|
||||||
frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
|
frame->Zoom_Automatique( true ); // Zoom fit in frame
|
||||||
|
frame->GetScreen()->m_FirstRedraw = false;
|
||||||
|
|
||||||
Read_Config();
|
Read_Config();
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxPoint( -1, -1 ),
|
wxPoint( -1, -1 ),
|
||||||
wxSize( 600, 400 ) );
|
wxSize( 600, 400 ) );
|
||||||
m_ModuleEditFrame->Show( true );
|
m_ModuleEditFrame->Show( true );
|
||||||
m_ModuleEditFrame->Zoom_Automatique( true );
|
m_ModuleEditFrame->Zoom_Automatique( false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_ModuleEditFrame->Iconize( false );
|
m_ModuleEditFrame->Iconize( false );
|
||||||
|
|
|
@ -30,7 +30,6 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
|
||||||
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
DrawPanel->EndMouseCapture( ID_NO_TOOL_SELECTED, DrawPanel->GetDefaultCursor() );
|
||||||
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
|
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
|
||||||
LoadOnePcbFile( fn );
|
LoadOnePcbFile( fn );
|
||||||
DrawPanel->MoveCursorToCrossHair();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool WinEDA_PcbFrame::Clear_Pcb( bool aQuery )
|
||||||
|
|
||||||
ReFillLayerWidget();
|
ReFillLayerWidget();
|
||||||
|
|
||||||
Zoom_Automatique( true );
|
Zoom_Automatique( false );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ bool WinEDA_ModuleEditFrame::Clear_Pcb( bool aQuery )
|
||||||
GetScreen()->Init();
|
GetScreen()->Init();
|
||||||
GetScreen()->SetGrid( gridsize );
|
GetScreen()->SetGrid( gridsize );
|
||||||
|
|
||||||
Zoom_Automatique( true );
|
Zoom_Automatique( false );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
|
||||||
|
|
||||||
Rotate_Module( NULL, Module, 0, false );
|
Rotate_Module( NULL, Module, 0, false );
|
||||||
GetScreen()->ClrModify();
|
GetScreen()->ClrModify();
|
||||||
Zoom_Automatique( TRUE );
|
Zoom_Automatique( false );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
module->SetPosition( wxPoint( 0, 0 ) );
|
module->SetPosition( wxPoint( 0, 0 ) );
|
||||||
if( GetBoard()->m_Modules )
|
if( GetBoard()->m_Modules )
|
||||||
GetBoard()->m_Modules->m_Flags = 0;
|
GetBoard()->m_Modules->m_Flags = 0;
|
||||||
Zoom_Automatique( true );
|
Zoom_Automatique( false );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( GetBoard()->m_Modules )
|
if( GetBoard()->m_Modules )
|
||||||
GetBoard()->m_Modules->m_Flags = 0;
|
GetBoard()->m_Modules->m_Flags = 0;
|
||||||
GetScreen()->ClrModify();
|
GetScreen()->ClrModify();
|
||||||
Zoom_Automatique( true );
|
Zoom_Automatique( false );
|
||||||
if( m_Draw3DFrame )
|
if( m_Draw3DFrame )
|
||||||
m_Draw3DFrame->NewDisplay();
|
m_Draw3DFrame->NewDisplay();
|
||||||
break;
|
break;
|
||||||
|
@ -416,7 +416,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetScreen()->ClrModify();
|
GetScreen()->ClrModify();
|
||||||
Zoom_Automatique( true );
|
Zoom_Automatique( false );
|
||||||
if( m_Draw3DFrame )
|
if( m_Draw3DFrame )
|
||||||
m_Draw3DFrame->NewDisplay();
|
m_Draw3DFrame->NewDisplay();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -150,6 +150,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->Zoom_Automatique( true );
|
frame->Zoom_Automatique( true );
|
||||||
|
frame->GetScreen()->m_FirstRedraw = false;
|
||||||
|
|
||||||
/* Load file specified in the command line. */
|
/* Load file specified in the command line. */
|
||||||
if( fn.IsOk() )
|
if( fn.IsOk() )
|
||||||
|
|
Loading…
Reference in New Issue