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

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

parent 115cb2d6
Loading
Loading
Loading
Loading
+19 −1
Original line number Original line Diff line number Diff line
@@ -849,10 +849,28 @@ public:


    /**
    /**
     * Function Files_io
     * 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 );
    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)
     * Function OpenProjectFiles    (was LoadOnePcbFile)
     * loads a KiCad board (.kicad_pcb) from \a aFileName.
     * loads a KiCad board (.kicad_pcb) from \a aFileName.
+10 −5
Original line number Original line Diff line number Diff line
/*
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 * 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) 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
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * 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 )
void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
{
{
    int        id = event.GetId();
    int        id = event.GetId();
    Files_io_from_id( id );
}

void PCB_EDIT_FRAME::Files_io_from_id( int id )
{
    wxString   msg;
    wxString   msg;


    // If an edition is in progress, stop it.
    // If an edition is in progress, stop it.
+3 −1
Original line number Original line Diff line number Diff line
@@ -595,7 +595,9 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
            break;
            break;


        case wxID_YES:
        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;
            break;
        }
        }
    }
    }