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

Gerbview: Add drill file history and minor enhancements.

parent a338e0e5
Loading
Loading
Loading
Loading
+2256 −0

File added.

Preview size limit exceeded, changes collapsed.

+19 −10
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
#include <wx/fontdlg.h>
#include <wx/clipbrd.h>
#include <wx/statline.h>
#include <wx/aboutdlg.h>
#include <wx/platinfo.h>

#include "build_version.h"
@@ -196,11 +195,16 @@ void EDA_BASE_FRAME::DisplayActivity( int PerCent, const wxString& Text )


/*
 * Update the list of past projects.
 * Update the list of recent opened files.
 */
void EDA_BASE_FRAME::SetLastProject( const wxString& FullFileName )
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
                                     wxFileHistory * aFileHistory )
{
    wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
    wxFileHistory * fileHistory = aFileHistory;
    if( fileHistory == NULL )
        fileHistory = & wxGetApp().m_fileHistory;

    fileHistory->AddFileToHistory( FullFileName );
    ReCreateMenuBar();
}

@@ -208,25 +212,30 @@ void EDA_BASE_FRAME::SetLastProject( const wxString& FullFileName )
/*
 * Fetch the file name from the file history list.
 */
wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type )
wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
                                             wxFileHistory * aFileHistory )
{
    wxString fn, msg;
    size_t   i;
    int      baseId = wxGetApp().m_fileHistory.GetBaseId();
    wxFileHistory * fileHistory = aFileHistory;
    if( fileHistory == NULL )
        fileHistory = & wxGetApp().m_fileHistory;

    int      baseId = fileHistory->GetBaseId();

    wxASSERT( cmdId >= baseId
              && cmdId < baseId + ( int )wxGetApp().m_fileHistory.GetCount() );
              && cmdId < baseId + ( int )fileHistory->GetCount() );

    i = ( size_t )( cmdId - baseId );

    if( i < wxGetApp().m_fileHistory.GetCount() )
    if( i < fileHistory->GetCount() )
    {
        fn = wxGetApp().m_fileHistory.GetHistoryFile( i );
        fn = fileHistory->GetHistoryFile( i );
        if( !wxFileName::FileExists( fn ) )
        {
            msg = type + _( " file <" ) + fn + _( "> was not found." );
            DisplayError( this, msg );
            wxGetApp().m_fileHistory.RemoveFileFromHistory( i );
            fileHistory->RemoveFileFromHistory( i );
            fn = wxEmptyString;
            ReCreateMenuBar();
        }
+2 −2
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )

    if( m_NetlistFileName.IsOk() )
    {
        SetLastProject( m_NetlistFileName.GetFullPath() );
        UpdateFileHistory( m_NetlistFileName.GetFullPath() );
    }

    m_modified = false;
@@ -461,7 +461,7 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )

    if( ReadNetList() )
    {
        SetLastProject( m_NetlistFileName.GetFullPath() );
        UpdateFileHistory( m_NetlistFileName.GetFullPath() );

        SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
                  wxT( " " ) + m_NetlistFileName.GetFullPath() );
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ void WinEDA_App::MacOpenFile(const wxString &fileName)

    if( frame->ReadNetList() )
    {
        frame->SetLastProject( filename.GetFullPath() );
        frame->UpdateFileHistory( filename.GetFullPath() );

        frame->SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
                  wxT( " " ) + filename.GetFullPath() );
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
            return false;

        if( g_RootSheet->GetScreen()->GetFileName() != m_DefaultSchematicFileName )
            SetLastProject( g_RootSheet->GetScreen()->GetFileName() );
            UpdateFileHistory( g_RootSheet->GetScreen()->GetFileName() );
    }

    FullFileName = FileName;
Loading