SRAMFileTarget.cc

Go to the documentation of this file.
00001 /*
00002  * Super Metroid SRAM Editor
00003  * Copyright (C) 2005,2007-2008 emuWorks
00004  * http://games.technoplaza.net/
00005  *
00006  * This file is part of Super Metroid SRAM Editor.
00007  *
00008  * Super Metroid SRAM Editor is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * Super Metroid SRAM Editor is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with Super Metroid SRAM Editor; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00021  */
00022  
00023 // $Id: SRAMFileTarget.cc,v 1.2 2008/12/17 04:14:15 jdratlif Exp $
00024 
00025 #ifdef HAVE_CONFIG_H
00026     #include <config.h>
00027 #endif
00028 
00029 #include <wx/wxprec.h>
00030 
00031 #ifndef WX_PRECOMP
00032     #include <wx/wx.h>
00033 #endif
00034 
00035 #include "model/SRAMFile.hh"
00036 #include "view/Frame.hh"
00037 #include "view/SRAMFileTarget.hh"
00038 
00039 using namespace smse;
00040 
00041 bool SRAMFileTarget::OnDropFiles(wxCoord, wxCoord, const wxArrayString &files) {
00042     if (files.GetCount() > 0) {
00043         // save current SRAMFile
00044         if (frame->sram && frame->sram->isModified()) {
00045             int answer = wxMessageBox(wxT("Save current SRAM?"),
00046                 wxT("Warning: Unsaved SRAM file"),
00047                 wxYES_NO | wxCANCEL | wxICON_QUESTION);
00048             
00049             if (answer == wxYES) {
00050                 if (!frame->save()) {
00051                     return false;
00052                 }
00053             } else if (answer == wxCANCEL) {
00054                 return false;
00055             }
00056         }
00057         
00058         // open the first file
00059         frame->open(files[0]);
00060     }
00061     
00062     return true;
00063 }
00064 

Generated on Mon Dec 29 01:15:54 2008 for Super Metroid SRAM Editor by  doxygen 1.5.4