Pcbnew: Rework on recovery files menu

This commit is contained in:
jean-pierre charras 2012-12-21 08:58:51 +01:00
parent bde103f5be
commit 143debdd61
4 changed files with 34 additions and 19 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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 )

View File

@ -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,