Commit eef494d9 authored by unknown's avatar unknown Committed by jean-pierre charras

Pcbnew: Fix an Incorrect save-on-quit in pcbnew with unamed board

parent 115cb2d6
......@@ -849,10 +849,28 @@ public:
/**
* Function Files_io
* is the command event handler for read and write file commands.
* @param event is the command event handler.
* do nothing else than call Files_io_from_id with the
* wxCommandEvent id
*/
void Files_io( wxCommandEvent& event );
/**
* Function Files_io_from_id
* Read and write board files
* @param aId is an event ID ciming from file command events:
* ID_LOAD_FILE
* ID_MENU_READ_BOARD_BACKUP_FILE
* ID_MENU_RECOVER_BOARD_AUTOSAVE
* ID_APPEND_FILE
* ID_NEW_BOARD
* ID_SAVE_BOARD
* ID_COPY_BOARD_AS
* ID_SAVE_BOARD_AS
* Files_io_from_id prepare parameters and calls the specialized function
*/
void Files_io_from_id( int aId );
/**
* Function OpenProjectFiles (was LoadOnePcbFile)
* loads a KiCad board (.kicad_pcb) from \a aFileName.
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -222,6 +222,11 @@ void PCB_EDIT_FRAME::OnFileHistory( wxCommandEvent& event )
void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
{
int id = event.GetId();
Files_io_from_id( id );
}
void PCB_EDIT_FRAME::Files_io_from_id( int id )
{
wxString msg;
// If an edition is in progress, stop it.
......@@ -326,9 +331,9 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
SavePcbFile( Prj().AbsolutePath( GetBoard()->GetFileName() ) );
break;
}
// Fall through
case ID_COPY_BOARD_AS:
case ID_SAVE_BOARD_AS:
// Fall through
case ID_COPY_BOARD_AS:
case ID_SAVE_BOARD_AS:
{
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
wxFileName fn( pro_dir, _( "noname" ), KiCadPcbFileExtension );
......
......@@ -595,7 +595,9 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
break;
case wxID_YES:
SavePcbFile( GetBoard()->GetFileName() );
// save the board. if the board has no name,
// the ID_SAVE_BOARD_AS will actually made
Files_io_from_id( ID_SAVE_BOARD );
break;
}
}
......
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