Commit ec400bf7 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema, Pcbnew: fix minor issues about mouse cursor position, when loading...

Eeschema, Pcbnew: fix minor issues about mouse cursor position, when loading files or entering sheets.
parent cdffc3d1
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -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 );
}
}




+6 −6
Original line number Original line Diff line number Diff line
@@ -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;
+12 −2
Original line number Original line Diff line number Diff line
@@ -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();
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -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:
+3 −2
Original line number Original line Diff line number Diff line
@@ -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();


Loading