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

Pcbnew: Rework on recovery files menu

parent bde103f5
Loading
Loading
Loading
Loading
+22 −14
Original line number Diff line number Diff line
@@ -85,12 +85,21 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
        LoadOnePcbFile( GetBoard()->GetFileName(), false, true );
        break;

    case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
    case ID_MENU_READ_BOARD_BACKUP_FILE:
    case ID_MENU_RECOVER_BOARD_AUTOSAVE:
        {
            wxFileName currfn = GetBoard()->GetFileName();
            wxFileName fn = currfn;
            if( id == ID_MENU_RECOVER_BOARD_AUTOSAVE )
            {
                wxString rec_name = wxT("$") + fn.GetName();
                fn.SetName( rec_name );
            }
            else
            {
            wxFileName fn;
            fn = GetBoard()->GetFileName();
                wxString backup_ext = fn.GetExt()+ backupFileExtensionSuffix;
                fn.SetExt( backup_ext );
            }

            if( !fn.FileExists() )
            {
@@ -99,19 +108,18 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
                DisplayInfoMessage( this, msg );
                break;
            }
            else
            {
                msg.Printf( _( "OK to load recovery file <%s>" ), GetChars(fn.GetFullPath() ) );

            msg.Printf( _( "OK to load recovery or backup file <%s>" ),
                            GetChars(fn.GetFullPath() ) );

            if( !IsOK( this, msg ) )
                break;
            }

            GetScreen()->ClrModify();    // do not prompt the user for changes
            LoadOnePcbFile( fn.GetFullPath(), false );
            fn.SetExt( PcbFileExtension );

            // Re-set the name since extension changed
            GetBoard()->SetFileName( fn.GetFullPath() );
            // Re-set the name since name or extension was changed
            GetBoard()->SetFileName( currfn.GetFullPath() );
            UpdateTitle();
        }
        break;
+8 −3
Original line number Diff line number Diff line
@@ -112,9 +112,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
    filesMenu->AppendSeparator();

    // Revert
    AddMenuItem( filesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
                 _( "Revert" ),
                 _( "Clear board and get previous saved version of board" ),
    AddMenuItem( filesMenu, ID_MENU_READ_BOARD_BACKUP_FILE,
                 _( "Revert to Last" ),
                 _( "Clear board and get previous backup version of board" ),
                 KiBitmap( help_xpm ) );

    // Rescue
    AddMenuItem( filesMenu, ID_MENU_RECOVER_BOARD_AUTOSAVE, _( "Rescue" ),
                 _( "Clear board and get last rescue file automatically saved by Pcbnew" ),
                 KiBitmap( help_xpm ) );
    filesMenu->AppendSeparator();

+2 −1
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
    EVT_SIZE( PCB_EDIT_FRAME::OnSize )

    EVT_TOOL( ID_LOAD_FILE, PCB_EDIT_FRAME::Files_io )
    EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, PCB_EDIT_FRAME::Files_io )
    EVT_TOOL( ID_MENU_READ_BOARD_BACKUP_FILE, PCB_EDIT_FRAME::Files_io )
    EVT_TOOL( ID_MENU_RECOVER_BOARD_AUTOSAVE, PCB_EDIT_FRAME::Files_io )
    EVT_TOOL( ID_NEW_BOARD, PCB_EDIT_FRAME::Files_io )
    EVT_TOOL( ID_SAVE_BOARD, PCB_EDIT_FRAME::Files_io )
    EVT_TOOL( ID_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions )
+2 −1
Original line number Diff line number Diff line
@@ -231,7 +231,8 @@ enum pcbnew_ids

    ID_POPUP_PCB_REORIENT_ALL_MODULES,

    ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
    ID_MENU_READ_BOARD_BACKUP_FILE,
    ID_MENU_RECOVER_BOARD_AUTOSAVE,
    ID_MENU_ARCHIVE_MODULES,
    ID_MENU_ARCHIVE_NEW_MODULES,
    ID_MENU_ARCHIVE_ALL_MODULES,