Pcbnew: fix issue when loading a recovery backup board file.
Because now there are 2 formats, board backup files extensions are .brd-bak or .kicad_pcb-bak instead of the old .000 extension, depending on the initial file format.
This commit is contained in:
parent
96f302c958
commit
bde103f5be
|
@ -302,7 +302,6 @@ set( BMAPS_MID
|
|||
insert_module_board
|
||||
invert_module
|
||||
invisible_text
|
||||
jigsaw
|
||||
kicad_icon_small
|
||||
label2glabel
|
||||
label2text
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
/* Do not modify this file, it was automatically generated by the
|
||||
* PNG2cpp CMake script, using a *.png file as input.
|
||||
*/
|
||||
|
||||
#include <bitmaps.h>
|
||||
|
||||
static const unsigned char png[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
|
||||
0xce, 0x00, 0x00, 0x01, 0x5b, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xdd, 0xd5, 0x4d, 0x2b, 0x44,
|
||||
0x51, 0x18, 0xc0, 0xf1, 0xeb, 0xa5, 0x28, 0x4a, 0x64, 0xab, 0x34, 0x1b, 0xb2, 0x99, 0x9d, 0x2c,
|
||||
0x7c, 0x00, 0x9f, 0xc2, 0x27, 0xb8, 0x48, 0x31, 0xa1, 0x30, 0x2b, 0x44, 0x49, 0x29, 0xb3, 0x50,
|
||||
0xf6, 0x92, 0x34, 0x0b, 0x4b, 0x3b, 0x4a, 0x99, 0x2c, 0x94, 0x2c, 0x48, 0xd8, 0x0a, 0x79, 0x0b,
|
||||
0x91, 0xeb, 0xff, 0xd4, 0x99, 0x3a, 0xdd, 0xce, 0x7d, 0x9b, 0x7b, 0x66, 0x16, 0x6e, 0xfd, 0x16,
|
||||
0x77, 0x16, 0xf7, 0x7f, 0xcf, 0xb9, 0x4f, 0x67, 0x1c, 0xcf, 0xf3, 0x9c, 0x5a, 0x70, 0xfe, 0x77,
|
||||
0x88, 0x2b, 0x8b, 0xb6, 0xaa, 0x85, 0xb8, 0xda, 0x71, 0x84, 0x17, 0x34, 0x6a, 0xe1, 0x4e, 0xe4,
|
||||
0xb0, 0x84, 0xee, 0x54, 0x21, 0x59, 0x01, 0x4e, 0x20, 0x77, 0xb7, 0x68, 0x41, 0x0f, 0xd6, 0xf0,
|
||||
0xae, 0x7e, 0xdf, 0x49, 0xbd, 0x22, 0xae, 0x92, 0x7a, 0x58, 0xd9, 0xaf, 0xef, 0x5e, 0x14, 0xd0,
|
||||
0x84, 0x66, 0x64, 0x30, 0x88, 0x7e, 0xd4, 0x25, 0x09, 0x79, 0x29, 0x2c, 0xd7, 0x22, 0xb4, 0x92,
|
||||
0x74, 0xeb, 0x2a, 0x89, 0x3c, 0x60, 0x17, 0x03, 0x71, 0xb7, 0x4f, 0xae, 0x57, 0x1c, 0x63, 0x13,
|
||||
0x13, 0x6a, 0xca, 0xf2, 0xf2, 0xc6, 0xd8, 0xc0, 0x21, 0xbe, 0xb5, 0xc8, 0x17, 0xce, 0xb5, 0xfb,
|
||||
0x27, 0xec, 0x63, 0x4a, 0x06, 0x29, 0x2c, 0x34, 0x02, 0x37, 0xc2, 0x0c, 0x0e, 0xf0, 0xa9, 0x26,
|
||||
0x33, 0x68, 0xa5, 0xf2, 0x52, 0xad, 0x41, 0x21, 0x37, 0x81, 0x49, 0xdc, 0x04, 0x44, 0x86, 0x51,
|
||||
0x1f, 0xb6, 0x22, 0x37, 0xa1, 0x69, 0xdc, 0x1b, 0x42, 0x8b, 0x51, 0xdf, 0xc8, 0xad, 0xc0, 0x3c,
|
||||
0x9e, 0x0d, 0xb1, 0x3d, 0x74, 0xd9, 0x0c, 0x89, 0x05, 0xfc, 0x18, 0x62, 0x6f, 0x18, 0xb5, 0x19,
|
||||
0x12, 0x67, 0x21, 0x83, 0x31, 0x64, 0x33, 0xb4, 0x65, 0x08, 0xc8, 0xb6, 0xf6, 0xa2, 0xcf, 0x66,
|
||||
0x68, 0x5c, 0x8d, 0xbc, 0x1e, 0x9a, 0xb3, 0xfd, 0x8d, 0xca, 0x4e, 0x7d, 0x21, 0x39, 0xf1, 0xb3,
|
||||
0x71, 0x42, 0xeb, 0x6a, 0x7c, 0xe3, 0x86, 0x4a, 0x86, 0xed, 0xbb, 0x46, 0x47, 0x54, 0x68, 0x16,
|
||||
0x45, 0x8c, 0xc5, 0x0c, 0x5d, 0x04, 0x0c, 0xc3, 0xb6, 0xed, 0xad, 0xf3, 0x9f, 0x14, 0x97, 0x58,
|
||||
0xc5, 0x95, 0x7e, 0xe0, 0xda, 0x08, 0x3d, 0xfa, 0x42, 0x79, 0xf5, 0x60, 0xf9, 0xa7, 0x6e, 0xb0,
|
||||
0x15, 0x2a, 0x18, 0xb6, 0xac, 0x58, 0x8d, 0xa9, 0xbb, 0x33, 0x84, 0x3e, 0x4c, 0x27, 0xf8, 0x1f,
|
||||
0x26, 0x39, 0xdf, 0x0d, 0x29, 0x3f, 0x4b, 0xd5, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
|
||||
0xae, 0x42, 0x60, 0x82,
|
||||
};
|
||||
|
||||
const BITMAP_OPAQUE jigsaw_xpm[1] = {{ png, sizeof( png ), "jigsaw_xpm" }};
|
||||
|
||||
//EOF
|
|
@ -1,8 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48" version="1.1">
|
||||
<g transform="matrix(1.2441 .91394 -.95798 1.1869 2.3942 -13.044)">
|
||||
<path fill-rule="evenodd" d="m24.464 11.219c-7.444 0-13.478 5.8672-13.478 13.105 0 7.2389 6.0344 13.105 13.478 13.105 7.4451 0 13.479-5.8661 13.479-13.105 0-6.8031-5.6081-13.093-13.625-13.093l-0.008-4.7662c0.64204 0.010213 0.75035 0.00795 0.85429 0.00795 0 0 0.71386-0.083176 1.1404-0.33384 2.4064-1.4259 4.5596-2.0093 5.5771-1.4072 0 0-1.0038 0.68982-1.4029 1.7564-0.26802 0.71083 0.26452 1.0603 0.92261 1.2931 0 0 0.70043 0.16096 1.1883 0.065577 2.7646-0.53909 4.992-0.3716 5.7368 0.53 0 0-1.1871 0.31709-1.9366 1.1875-0.50189 0.57911-0.12438 1.0836 0.41284 1.5226 0 0 0.59999 0.38125 1.0949 0.45449 2.7851 0.41361 4.8209 1.3141 5.202 2.4087 0 0-1.2263-0.09765-2.2376 0.46896-0.67415 0.37813-0.49751 0.97796-0.14715 1.5679 0 0 0.42977 0.56009 0.86772 0.79287 2.4727 1.3152 4.0706 2.8368 4.0431 3.9933 0 0-1.1176-0.50133-2.2686-0.30403-0.76524 0.13314-0.81196 0.75426-0.69108 1.4262 0 0 0.20876 0.66853 0.53838 1.0336 1.8613 2.057 2.8251 4.0163 2.3938 5.0953 0 0-0.87473-0.84056-2.0242-1.039-0.76641-0.13087-1.0277 0.43689-1.1486 1.1077 0 0-0.04117 0.69976 0.14014 1.1511 1.0254 2.5538 1.2409 4.7149 0.45634 5.5822 0 0-0.52466-1.079-1.5363-1.6456-0.67386-0.37926-1.12 0.0687-1.47 0.6586 0 0-0.28292 0.64327-0.2727 1.1267 0.06744 2.74-0.49138 4.8447-1.5349 5.4005 0 0-0.11532-1.1923-0.86334-2.0604-0.50072-0.58224-1.0768-0.30631-1.6152 0.13058 0 0-0.49138 0.50899-0.65109 0.96831-0.90218 2.5981-2.1658 4.389-3.3416 4.5631 0 0 0.31124-1.1554-0.08672-2.2211-0.26686-0.71197-0.90451-0.64753-1.5626-0.41475 0 0-0.64203 0.3151-0.95327 0.69408-1.7623 2.1382-3.5789 3.4034-4.7456 3.176 0 0 0.70014-0.9825 0.70014-2.1169 0-0.75625-0.62393-0.90813-1.3229-0.90813 0 0-0.71386 0.0809-1.1404 0.33356-2.4067 1.4251-4.5599 2.0096-5.5783 1.4075 0 0 1.0047-0.6921 1.4041-1.7578 0.26686-0.7097-0.26481-1.0589-0.92378-1.2931 0 0-0.69926-0.15954-1.1886-0.06302-2.7635 0.53767-4.9917 0.37131-5.7342-0.53227 0 0 1.1848-0.31624 1.9354-1.1877 0.49955-0.57883 0.12292-1.0824-0.41401-1.5193 0 0-0.59999-0.38579-1.0928-0.4579-2.7871-0.41248-4.823-1.3107-5.204-2.4076 0 0 1.2271 0.09651 2.2376-0.46897 0.67298-0.37699 0.49605-0.97683 0.14715-1.5679 0 0-0.42977-0.56123-0.86772-0.79287-2.4726-1.314-4.0682-2.834-4.0419-3.993 0 0 1.1188 0.50019 2.2683 0.30403 0.76554-0.13087 0.81108-0.75426 0.68787-1.4251 0 0-0.20642-0.66967-0.53488-1.0325-1.8625-2.0581-2.8271-4.0186-2.3938-5.0965 0 0 0.87473 0.8417 2.023 1.0379 0.76524 0.132 1.0277-0.43802 1.1486-1.1077 0 0 0.041167-0.69862-0.14044-1.1489-1.0263-2.5549-1.2429-4.7161-0.45722-5.5864 0 0 0.52583 1.0821 1.5363 1.6499 0.67386 0.37813 1.1211-0.0687 1.4712-0.66087 0 0 0.28379-0.64327 0.27153-1.1267-0.066278-2.74 0.49021-4.8446 1.5349-5.4001 0 0 0.11416 1.1909 0.86334 2.0604 0.49956 0.57872 1.0779 0.30716 1.6128-0.132 0 0 0.49372-0.50786 0.65225-0.96604 0.90218-2.5992 2.1658-4.3902 3.3427-4.5653 0 0-0.31357 1.1577 0.08671 2.2222 0.26569 0.71083 0.90451 0.64668 1.5626 0.41276 0 0 0.64554-0.3151 0.95677-0.69209 1.7608-2.1402 3.5789-3.4031 4.7456-3.1769 0 0-0.69897 0.98335-0.69897 2.118 0 0.48345 0.2543 0.71963 0.61926 0.82609l0.0019 4.8281"/>
|
||||
<path fill-rule="evenodd" d="m25.261 24.314c0 0.2821-0.24292 0.51221-0.54189 0.51221-0.29985 0-0.54276-0.23011-0.54276-0.51221 0-0.28514 0.24292-0.51414 0.54276-0.51414 0.29897 0 0.54189 0.229 0.54189 0.51414"/>
|
||||
<path d="m25.261 24.314c0 0.2821-0.24292 0.51221-0.54189 0.51221-0.29985 0-0.54276-0.23011-0.54276-0.51221 0-0.28514 0.24292-0.51414 0.54276-0.51414 0.29897 0 0.54189 0.229 0.54189 0.51414z" stroke="#000" stroke-width=".78145" fill="none"/>
|
||||
</g>
|
||||
<path opacity=".42188" d="m108.5 43.459a25.214 23.421 0 1 1 -50.427 0 25.214 23.421 0 1 1 50.427 0z" fill-rule="evenodd" transform="translate(-74.565,-3.5849)"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 3.8 KiB |
|
@ -223,7 +223,6 @@ EXTERN_BITMAP( info_xpm )
|
|||
EXTERN_BITMAP( insert_module_board_xpm )
|
||||
EXTERN_BITMAP( invert_module_xpm )
|
||||
EXTERN_BITMAP( invisible_text_xpm )
|
||||
EXTERN_BITMAP( jigsaw_xpm )
|
||||
EXTERN_BITMAP( kicad_icon_small_xpm )
|
||||
EXTERN_BITMAP( label2glabel_xpm )
|
||||
EXTERN_BITMAP( label2text_xpm )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************/
|
||||
/* files-io.cpp */
|
||||
/****************/
|
||||
/**
|
||||
* @file kicad/files-io.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include <appl_wxstruct.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <protos.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <io_mgr.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -51,9 +50,7 @@
|
|||
#include <build_version.h> // LEGACY_BOARD_FILE_VERSION
|
||||
|
||||
|
||||
static const wxString pcbBackupFileExtension( wxT( "000" ) );
|
||||
static wxString saveFileName( wxT( "$savepcb" ) );
|
||||
|
||||
static const wxString backupFileExtensionSuffix( wxT( "-bak" ) );
|
||||
|
||||
void PCB_EDIT_FRAME::OnFileHistory( wxCommandEvent& event )
|
||||
{
|
||||
|
@ -89,29 +86,22 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
|
||||
case ID_MENU_RECOVER_BOARD:
|
||||
{
|
||||
wxFileName fn;
|
||||
|
||||
if( id == ID_MENU_RECOVER_BOARD )
|
||||
{
|
||||
fn = wxFileName( wxEmptyString, saveFileName, PcbFileExtension );
|
||||
}
|
||||
else
|
||||
{
|
||||
fn = GetBoard()->GetFileName();
|
||||
fn.SetExt( pcbBackupFileExtension );
|
||||
}
|
||||
fn = GetBoard()->GetFileName();
|
||||
wxString backup_ext = fn.GetExt()+ backupFileExtensionSuffix;
|
||||
fn.SetExt( backup_ext );
|
||||
|
||||
if( !fn.FileExists() )
|
||||
{
|
||||
msg = _( "Recovery file " ) + fn.GetFullPath() + _( " not found." );
|
||||
msg.Printf( _( "Recovery file <%s> not found." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
DisplayInfoMessage( this, msg );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = _( "OK to load recovery file " ) + fn.GetFullPath();
|
||||
msg.Printf( _( "OK to load recovery file <%s>" ), GetChars(fn.GetFullPath() ) );
|
||||
|
||||
if( !IsOK( this, msg ) )
|
||||
break;
|
||||
|
@ -224,10 +214,14 @@ the changes?" ) ) )
|
|||
int chosenFilter = dlg.GetFilterIndex();
|
||||
pluginType = loaders[chosenFilter].pluginType;
|
||||
}
|
||||
else // if a filename is given, force IO_MGR::KICAD if the file est is kicad_pcb
|
||||
else // if a filename is given, force IO_MGR::KICAD if the file ext is kicad_pcb
|
||||
// for instance if the filename comes from file history
|
||||
// or it is a backup file with ext = kicad_pcb-bak
|
||||
{
|
||||
if( fileName.GetExt() == IO_MGR::GetFileExtension( IO_MGR::KICAD ) )
|
||||
wxString backup_ext = IO_MGR::GetFileExtension( IO_MGR::KICAD ) +
|
||||
backupFileExtensionSuffix;
|
||||
if( fileName.GetExt() == IO_MGR::GetFileExtension( IO_MGR::KICAD ) ||
|
||||
fileName.GetExt() == backup_ext )
|
||||
pluginType = IO_MGR::KICAD;
|
||||
}
|
||||
|
||||
|
@ -239,7 +233,7 @@ the changes?" ) ) )
|
|||
if( !aAppend )
|
||||
Clear_Pcb( false ); // pass false since we prompted above for a modified board
|
||||
|
||||
CheckForAutoSaveFile( fileName, pcbBackupFileExtension );
|
||||
CheckForAutoSaveFile( fileName, fileName.GetExt() );
|
||||
|
||||
GetBoard()->SetFileName( fileName.GetFullPath() );
|
||||
|
||||
|
@ -282,9 +276,9 @@ the changes?" ) ) )
|
|||
if( pluginType == IO_MGR::LEGACY &&
|
||||
loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION )
|
||||
{
|
||||
DisplayInfoMessage( this, _( "This file was created by an older \
|
||||
version of Pcbnew. It will be stored in the new file format when you save \
|
||||
this file again." ) );
|
||||
DisplayInfoMessage( this,
|
||||
_( "This file was created by an older version of Pcbnew.\
|
||||
\nIt will be stored in the new file format when you save this file again." ) );
|
||||
}
|
||||
|
||||
SetBoard( loadedBoard );
|
||||
|
@ -474,7 +468,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
|
|||
{
|
||||
// Get the backup file name
|
||||
backupFileName = pcbFileName;
|
||||
backupFileName.SetExt( pcbBackupFileExtension );
|
||||
backupFileName.SetExt( pcbFileName.GetExt() + backupFileExtensionSuffix );
|
||||
|
||||
// If an old backup file exists, delete it. If an old board file exists, rename
|
||||
// it to the backup file name.
|
||||
|
|
|
@ -115,15 +115,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
AddMenuItem( filesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
|
||||
_( "Revert" ),
|
||||
_( "Clear board and get previous saved version of board" ),
|
||||
KiBitmap( jigsaw_xpm ) );
|
||||
|
||||
// Rescue
|
||||
AddMenuItem( filesMenu, ID_MENU_RECOVER_BOARD, _( "Rescue" ),
|
||||
_( "Clear old board and get last rescue file" ),
|
||||
KiBitmap( hammer_xpm ) );
|
||||
KiBitmap( help_xpm ) );
|
||||
filesMenu->AppendSeparator();
|
||||
|
||||
|
||||
/* Fabrication Outputs submenu */
|
||||
wxMenu* fabricationOutputsMenu = new wxMenu;
|
||||
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_POS_MODULES_FILE,
|
||||
|
|
|
@ -78,7 +78,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
|
||||
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_RECOVER_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_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
|
|
|
@ -231,7 +231,6 @@ enum pcbnew_ids
|
|||
|
||||
ID_POPUP_PCB_REORIENT_ALL_MODULES,
|
||||
|
||||
ID_MENU_RECOVER_BOARD,
|
||||
ID_MENU_READ_LAST_SAVED_VERSION_BOARD,
|
||||
ID_MENU_ARCHIVE_MODULES,
|
||||
ID_MENU_ARCHIVE_NEW_MODULES,
|
||||
|
|
Loading…
Reference in New Issue