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

Pcbnew: Rework on recovery files menu

parent bde103f5
...@@ -85,12 +85,21 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -85,12 +85,21 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
LoadOnePcbFile( GetBoard()->GetFileName(), false, true ); LoadOnePcbFile( GetBoard()->GetFileName(), false, true );
break; 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; wxString backup_ext = fn.GetExt()+ backupFileExtensionSuffix;
fn.SetExt( backup_ext ); fn.SetExt( backup_ext );
}
if( !fn.FileExists() ) if( !fn.FileExists() )
{ {
...@@ -99,19 +108,18 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) ...@@ -99,19 +108,18 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
DisplayInfoMessage( this, msg ); DisplayInfoMessage( this, msg );
break; break;
} }
else
{ msg.Printf( _( "OK to load recovery or backup file <%s>" ),
msg.Printf( _( "OK to load recovery file <%s>" ), GetChars(fn.GetFullPath() ) ); GetChars(fn.GetFullPath() ) );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
break; break;
}
GetScreen()->ClrModify(); // do not prompt the user for changes
LoadOnePcbFile( fn.GetFullPath(), false ); LoadOnePcbFile( fn.GetFullPath(), false );
fn.SetExt( PcbFileExtension );
// Re-set the name since extension changed // Re-set the name since name or extension was changed
GetBoard()->SetFileName( fn.GetFullPath() ); GetBoard()->SetFileName( currfn.GetFullPath() );
UpdateTitle(); UpdateTitle();
} }
break; break;
......
...@@ -112,9 +112,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -112,9 +112,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
// Revert // Revert
AddMenuItem( filesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD, AddMenuItem( filesMenu, ID_MENU_READ_BOARD_BACKUP_FILE,
_( "Revert" ), _( "Revert to Last" ),
_( "Clear board and get previous saved version of board" ), _( "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 ) ); KiBitmap( help_xpm ) );
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
......
...@@ -77,7 +77,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -77,7 +77,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_SIZE( PCB_EDIT_FRAME::OnSize ) EVT_SIZE( PCB_EDIT_FRAME::OnSize )
EVT_TOOL( ID_LOAD_FILE, PCB_EDIT_FRAME::Files_io ) 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_NEW_BOARD, PCB_EDIT_FRAME::Files_io )
EVT_TOOL( ID_SAVE_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 ) EVT_TOOL( ID_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions )
......
...@@ -231,7 +231,8 @@ enum pcbnew_ids ...@@ -231,7 +231,8 @@ enum pcbnew_ids
ID_POPUP_PCB_REORIENT_ALL_MODULES, 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_MODULES,
ID_MENU_ARCHIVE_NEW_MODULES, ID_MENU_ARCHIVE_NEW_MODULES,
ID_MENU_ARCHIVE_ALL_MODULES, ID_MENU_ARCHIVE_ALL_MODULES,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment