Frame.hh

Go to the documentation of this file.
00001 /*
00002  * Super Metroid SRAM Editor
00003  * Copyright (C) 2005 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: Frame.hh,v 1.45 2005/10/17 09:54:45 technoplaza Exp $
00024 
00025 #ifndef _SMSE_FRAME_HH_
00026 #define _SMSE_FRAME_HH_
00027 
00028 #include <wx/spinbutt.h>
00029 
00030 /// idenfitier for the status bar clear timer
00031 #define ID_SBTIMER wxID_HIGHEST + 1
00032 
00033 namespace smse {
00034     class SRAMFile;
00035 
00036     /// The main application frame
00037     class Frame : public wxFrame {
00038         DECLARE_CLASS(Frame)
00039         DECLARE_EVENT_TABLE()
00040         
00041         friend class SRAMFileTarget;
00042         
00043     private:
00044         /// time (ms) to wait before clearing the status bar
00045         static const int CLEAR_DELAY = 4000;
00046         
00047         /// number of save points in Crateria
00048         static const int C_SAVEPOINTS = 2;
00049         
00050         /// number of save points in Brinstar
00051         static const int BS_SAVEPOINTS = 5;
00052         
00053         /// number of save points in Norfair
00054         static const int NF_SAVEPOINTS = 6;
00055         
00056         /// number of save points in the Wrecked Ship
00057         static const int WS_SAVEPOINTS = 1;
00058         
00059         /// number of save points in Maridia
00060         static const int M_SAVEPOINTS = 4;
00061         
00062         /// number of save points in Tourian
00063         static const int T_SAVEPOINTS = 2;
00064         
00065         /// number of missile packs in the game
00066         static const int MISSILE_PACKS = 46;
00067         
00068         /// number of super missile packs in the game
00069         static const int SMISSILE_PACKS = 10;
00070         
00071         /// number of power bomb packs in the game
00072         static const int PBOMB_PACKS = 10;
00073         
00074         /// number of energy tanks in the game
00075         static const int ETANKS = 14;
00076         
00077         /// number of reserve tanks in the game
00078         static const int RTANKS = 4;
00079         
00080         /// number of red doors in the game
00081         static const int REDDOORS = 30;
00082         
00083         /// number of green doors in the game
00084         static const int GREENDOORS = 23;
00085         
00086         /// number of yellow doors in the game
00087         static const int YELLOWDOORS = 13;
00088         
00089         /// number of metal doors in the game
00090         static const int METALDOORS = 40;
00091         
00092         /// number of eye doors in the game
00093         static const int EYEDOORS = 5;
00094 
00095         wxTimer timer;
00096         SRAMFile *sram;
00097         int game;
00098         bool ignoreTextEvents;
00099     
00100         /**
00101          * Creates the controls for this Frame.
00102          */
00103         void CreateControls();
00104         
00105         /**
00106          * Closes the current SRAMFile.
00107          *
00108          * @param save true to save before closing; false otherwise.
00109          *
00110          * @return true if the file was closed; false otherwise.
00111          */
00112         bool close(bool save = false);
00113         
00114         /**
00115          * Enables or disables the menus according to the SRAMFile status.
00116          */
00117         void enableMenus();
00118         
00119         /**
00120          * Loads save game data into the Frame controls.
00121          *
00122          * @param game The game to load.
00123          */
00124         void load(int game = 0);
00125         
00126         /**
00127          * Loads boss data into the controls.
00128          */
00129         void loadBosses();
00130         
00131         /**
00132          * Loads the game data into the controls on the Color Doors tab.
00133          */
00134         void loadColorDoorsTab();
00135         
00136         /**
00137          * Loads the controller configuration into the controls.
00138          */
00139         void loadControllerConfig();
00140         
00141         /**
00142          * Loads Samus' energy data into the controls.
00143          */
00144         void loadEnergy();
00145         
00146         /**
00147          * Loads energy tank data into the controls.
00148          */
00149         void loadEnergyTanks();
00150         
00151         /**
00152          * Loads eye door data into the controls.
00153          */
00154         void loadEyeDoors();
00155         
00156         /**
00157          * Loads the misc game configuration into the controls.
00158          */
00159         void loadGameConfig();
00160         
00161         /**
00162          * Loads the misc game status into the controls.
00163          */
00164         void loadGameStatus();
00165         
00166         /**
00167          * Loads the game data into the controls on the Game tab.
00168          */
00169         void loadGameTab();
00170         
00171         /**
00172          * Loads the game time into the controls.
00173          */
00174         void loadGameTime();
00175         
00176         /**
00177          * Loads green door data into the controls.
00178          */
00179         void loadGreenDoors();
00180         
00181         /**
00182          * Loads Samus' inventory data into the controls.
00183          */
00184         void loadInventory();
00185         
00186         /**
00187          * Loads Samus' item data into the controls.
00188          */
00189         void loadItems();
00190         
00191         /**
00192          * Loads the game data into the controls on the Items tab.
00193          */
00194         void loadItemsTab();
00195         
00196         /**
00197          * Loads area map data into the controls.
00198          */
00199         void loadMaps();
00200         
00201         /**
00202          * Loads metal door data into the controls.
00203          */
00204         void loadMetalDoors();
00205         
00206         /**
00207          * Loads the metroid room data into the controls.
00208          */
00209         void loadMetroidRooms();
00210         
00211         /**
00212          * Loads the miniboss data into the controls.
00213          */
00214         void loadMiniBosses();
00215         
00216         /**
00217          * Loads the game data into the controls on the Misc tab.
00218          */
00219         void loadMiscTab();
00220         
00221         /**
00222          * Loads missile pack data into the controls.
00223          */
00224         void loadMissilePacks();
00225         
00226         /**
00227          * Loads power bomb pack data into the contols.
00228          */
00229         void loadPowerBombPacks();
00230         
00231         /**
00232          * Loads red door data into the controls.
00233          */
00234         void loadRedDoors();
00235         
00236         /**
00237          * Loads reserve tank data into the controls.
00238          */
00239         void loadReserveTanks();
00240         
00241         /**
00242          * Loads the save point data into the controls.
00243          */
00244         void loadSavePoint();
00245         
00246         /**
00247          * Loads the game data into the controls on the Special Doors tab.
00248          */
00249         void loadSpecialDoorsTab();
00250         
00251         /**
00252          * Loads super missile pack data into the controls.
00253          */
00254         void loadSuperMissilePacks();
00255         
00256         /**
00257          * Loads yellow door data into the controls.
00258          */
00259         void loadYellowDoors();
00260         
00261         /**
00262          * Loads zebetite data into the controls.
00263          */
00264         void loadZebetites();
00265         
00266         /**
00267          * Saves the SRAMFile to disk.
00268          *
00269          * @param filename The filename to save as.
00270          *
00271          * @return true if the SRAMFile was saved; false otherwise.
00272          */
00273         bool save(const wxString &filename = wxEmptyString);
00274         
00275         /**
00276          * Called when a boss control is changed.
00277          *
00278          * @param event The triggering wxCommandEvent.
00279          */
00280         void onBossChange(wxCommandEvent &event);
00281         
00282         /**
00283          * Called when one of the controller configuration controls is changed.
00284          *
00285          * @param event The triggering wxCommandEvent.
00286          */
00287         void onControllerChange(wxCommandEvent &event);
00288         
00289         /**
00290          * Called when an energy control is changed.
00291          *
00292          * @param event The triggering wxCommandEvent.
00293          */
00294         void onEnergyChange(wxCommandEvent &event);
00295         
00296         /**
00297          * Called when an energy tank control is changed.
00298          *
00299          * @param event The triggering wxCommandEvent.
00300          */
00301         void onEnergyTankChange(wxCommandEvent &event);
00302         
00303         /**
00304          * Called when an eye door control is changed.
00305          *
00306          * @param event The triggering wxCommandEvent.
00307          */
00308         void onEyeDoorChange(wxCommandEvent &event);
00309         
00310         /**
00311          * Called when close from the file menu is selected.
00312          *
00313          * @param event The triggering wxCommandEvent (unused).
00314          */
00315         void onFileClose(wxCommandEvent &event);
00316         
00317         /**
00318          * Called in idle time to update the close file menu item.
00319          *
00320          * @param event The triggering wxUpdateUIEvent.
00321          */
00322         void onFileCloseUpdate(wxUpdateUIEvent &event);
00323         
00324         /**
00325          * Called when exit from the file menu is selected.
00326          *
00327          * @param event The triggering wxCommandEvent (unused).
00328          */
00329         void onFileExit(wxCommandEvent &event);
00330         
00331         /**
00332          * Called when open from the file menu is selected.
00333          *
00334          * @param event The triggering wxCommandEvent (unused).
00335          */
00336         void onFileOpen(wxCommandEvent &event);
00337         
00338         /**
00339          * Called when save from the file menu is selected.
00340          *
00341          * @param event The triggering wxCommandEvent (unused).
00342          */
00343         void onFileSave(wxCommandEvent &event);
00344         
00345         /**
00346          * Called when save as from the file menu is selected.
00347          *
00348          * @param event The triggering wxCommandEvent (unused).
00349          */
00350         void onFileSaveAs(wxCommandEvent &event);
00351         
00352         /**
00353          * Called in idle time to update the save and save as file menu items.
00354          *
00355          * @param event The triggering wxUpdateUIEvent (unused).
00356          */
00357         void onFileSaveUpdate(wxUpdateUIEvent &event);
00358         
00359         /**
00360          * Called when a game is selected from the game menu.
00361          *
00362          * @param event The triggering wxCommandEvent.
00363          */
00364         void onGame(wxCommandEvent &event);
00365         
00366         /**
00367          * Called when one of the clear submenu items is selected.
00368          *
00369          * @param event The triggering wxCommandEvent.
00370          */
00371         void onGameClear(wxCommandEvent &event);
00372         
00373         /**
00374          * Called in idle time to update the clear submenu.
00375          *
00376          * @param event The triggering wxUpdateUIEvent.
00377          */
00378         void onGameClearUpdate(wxUpdateUIEvent &event);
00379         
00380         /**
00381          * Called when one of the copy submenu items is selected.
00382          *
00383          * @param event The triggering wxCommandEvent.
00384          */
00385         void onGameCopy(wxCommandEvent &event);
00386         
00387         /**
00388          * Called in idle time to update the copy submenu.
00389          *
00390          * @param event The triggering wxUpdateUIEvent.
00391          */
00392         void onGameCopyUpdate(wxUpdateUIEvent &event);
00393         
00394         /**
00395          * Called when an ending from the game menu is selected.
00396          *
00397          * @param event The triggering wxCommandEvent.
00398          */
00399         void onGameEnding(wxCommandEvent &event);
00400         
00401         /**
00402          * Called in idle time to update the ending submenu.
00403          *
00404          * @param event The triggering wxUpdateUIEvent.
00405          */
00406         void onGameEndingUpdate(wxUpdateUIEvent &event);
00407         
00408         /**
00409          * Called when bosses is selected from the give submenu.
00410          *
00411          * @param event The triggering wxCommandEvent (unused).
00412          */
00413         void onGameGiveBosses(wxCommandEvent &event);
00414         
00415         /**
00416          * Called when energy is selected from the give submenu.
00417          *
00418          * @param event The triggering wxCommandEvent (unused).
00419          */
00420         void onGameGiveEnergy(wxCommandEvent &event);
00421         
00422         /**
00423          * Called when energy tanks is selected from the give submenu.
00424          *
00425          * @param event The triggering wxCommandEvent (unused).
00426          */
00427         void onGameGiveEnergyTanks(wxCommandEvent &event);
00428         
00429         /**
00430          * Called when everything is selected from the give submenu.
00431          *
00432          * @param event The triggering wxCommandEvent (unused).
00433          */
00434         void onGameGiveEverything(wxCommandEvent &event);
00435         
00436         /**
00437          * Called when eye doors is selected from the give submenu.
00438          *
00439          * @param event The triggering wxCommandEvent (unused).
00440          */
00441         void onGameGiveEyeDoors(wxCommandEvent &event);
00442         
00443         /**
00444          * Called when green doors is selected from the give submenu.
00445          *
00446          * @param event The triggering wxCommandEvent (unused).
00447          */
00448         void onGameGiveGreenDoors(wxCommandEvent &event);
00449         
00450         /**
00451          * Called when inventory is selected from the give submenu.
00452          *
00453          * @param event The triggering wxCommandEvent (unused).
00454          */
00455         void onGameGiveInventory(wxCommandEvent &event);
00456         
00457         /**
00458          * Called when items is selected from the give submenu.
00459          *
00460          * @param event The triggering wxCommandEvent (unused).
00461          */
00462         void onGameGiveItems(wxCommandEvent &event);
00463         
00464         /**
00465          * Called when maps is selected from the give submenu.
00466          *
00467          * @param event The triggering wxCommandEvent (unused).
00468          */
00469         void onGameGiveMaps(wxCommandEvent &event);
00470         
00471         /**
00472          * Called when metal doors is selected from the give submenu.
00473          *
00474          * @param event The triggering wxCommandEvent (unused).
00475          */
00476         void onGameGiveMetalDoors(wxCommandEvent &event);
00477         
00478         /**
00479          * Called when metroid rooms is selected from the give submenu.
00480          *
00481          * @param event The triggering wxCommandEvent (unused).
00482          */
00483         void onGameGiveMetroidRooms(wxCommandEvent &event);
00484         
00485         /**
00486          * Called when mini-bosses is selected from the give submenu.
00487          *
00488          * @param event The triggering wxCommandEvent (unused).
00489          */
00490         void onGameGiveMiniBosses(wxCommandEvent &event);
00491         
00492         /**
00493          * Called when missile packs is selected from the give submenu.
00494          *
00495          * @param event The triggering wxCommandEvent (unused).
00496          */
00497         void onGameGiveMissilePacks(wxCommandEvent &event);
00498         
00499         /**
00500          * Called when power bombs is selected from the give submenu.
00501          *
00502          * @param event The triggering wxCommandEvent (unused).
00503          */
00504         void onGameGivePowerBombPacks(wxCommandEvent &event);
00505         
00506         /**
00507          * Called when red doors is selected from the give submenu.
00508          *
00509          * @param event The triggering wxCommandEvent (unused).
00510          */
00511         void onGameGiveRedDoors(wxCommandEvent &event);
00512         
00513         /**
00514          * Called when reserve tanks is selected from the give submenu.
00515          *
00516          * @param event The triggering wxCommandEvent (unused).
00517          */
00518         void onGameGiveReserveTanks(wxCommandEvent &event);
00519         
00520         /**
00521          * Called when super missile packs is selected from the give submenu.
00522          *
00523          * @param event The triggering wxCommandEvent (unused).
00524          */
00525         void onGameGiveSuperMissilePacks(wxCommandEvent &event);
00526         
00527         /**
00528          * Called in idle time to update the give submenu.
00529          *
00530          * @param event The triggering wxUpdateUIEvent.
00531          */
00532         void onGameGiveUpdate(wxUpdateUIEvent &event);
00533         
00534         /**
00535          * Called when yellow doors is selected from the give submenu.
00536          *
00537          * @param event The triggering wxCommandEvent (unused).
00538          */
00539         void onGameGiveYellowDoors(wxCommandEvent &event);
00540         
00541         /**
00542          * Called when zebetites is selected rom the give submenu.
00543          *
00544          * @param event The triggering wxCommandEvent (unused).
00545          */
00546         void onGameGiveZebetites(wxCommandEvent &event);
00547         
00548         /**
00549          * Called when the game time control is changed.
00550          *
00551          * @param event The triggering wxCommandEvent.
00552          */
00553         void onGameTimeChange(wxCommandEvent &event);
00554         
00555         /**
00556          * Called in idle time to update the game menu items.
00557          *
00558          * @param event The triggering wxUpdateUIEvent.
00559          */
00560         void onGameUpdate(wxUpdateUIEvent &event);
00561         
00562         /**
00563          * Called when a green door control is changed.
00564          *
00565          * @param event The triggering wxCommandEvent.
00566          */
00567         void onGreenDoorChange(wxCommandEvent &event);
00568         
00569         /**
00570          * Called when help from the about menu is selected.
00571          *
00572          * @param event The triggering wxCommandEvent (unused).
00573          */
00574         void onHelpAbout(wxCommandEvent &event);
00575         
00576         /**
00577          * Called when an item control is changed.
00578          *
00579          * @param event The triggering wxCommandEvent.
00580          */
00581         void onItemChange(wxCommandEvent &event);
00582         
00583         /**
00584          * Called when an item equipped control is changed.
00585          *
00586          * @param event The triggering wxCommandEvent.
00587          */
00588         void onItemEquippedChange(wxCommandEvent &event);
00589         
00590         /**
00591          * Called in idle time to update the equipped item controls.
00592          *
00593          * @param event The triggering wxUpdateUIEvent.
00594          */
00595         void onItemEquippedUpdate(wxUpdateUIEvent &event);
00596         
00597         /**
00598          * Called when a map control is changed.
00599          *
00600          * @param event The triggering wxCommandEvent.
00601          */
00602         void onMapChange(wxCommandEvent &event);
00603         
00604         /**
00605          * Called when a metal door control is changed.
00606          *
00607          * @param event The triggering wxCommandEvent.
00608          */
00609         void onMetalDoorChange(wxCommandEvent &event);
00610         
00611         /**
00612          * Called when a metroid room control is changed.
00613          *
00614          * @param event The triggering wxCommandEvent.
00615          */
00616         void onMetroidRoomChange(wxCommandEvent &event);
00617         
00618         /**
00619          * Called when a mini boss control is changed.
00620          */
00621         void onMiniBossChange(wxCommandEvent &event);
00622         
00623         /**
00624          * Called when one of the misc game config controls is changed.
00625          *
00626          * @param event The triggering wxCommandEvent.
00627          */
00628         void onMiscConfigChange(wxCommandEvent &event);
00629         
00630         /**
00631          * Called when one of the misc game status controls is changed.
00632          *
00633          * @param event The triggering wxCommandEvent.
00634          */
00635         void onMiscStatChange(wxCommandEvent &event);
00636         
00637         /**
00638          * Called when a missile pack control is changed.
00639          *
00640          * @param event The triggering wxCommandEvent.
00641          */
00642         void onMissilePackChange(wxCommandEvent &event);
00643         
00644         /**
00645          * Called when the missiles spin button control is changed.
00646          *
00647          * @param event The triggering wxSpinEvent.
00648          */
00649         void onMissilesSpinner(wxSpinEvent &event);
00650         
00651         /**
00652          * Called when the missiles text control is changed.
00653          *
00654          * @param event The triggering wxCommandEvent.
00655          */
00656         void onMissilesChange(wxCommandEvent &event);
00657         
00658         /**
00659          * Called in idle time to update the notebook control.
00660          *
00661          * @param event The triggering wxUpdateUIEvent.
00662          */
00663         void onNotebookUpdate(wxUpdateUIEvent &event);
00664         
00665         /**
00666          * Called when a power bomb pack control is changed.
00667          *
00668          * @param event The triggerging wxCommandEvent.
00669          */
00670         void onPowerBombPackChange(wxCommandEvent &event);
00671         
00672         /**
00673          * Called when the power bombs spin button control is changed.
00674          *
00675          * @param event The triggering wxSpinEvent.
00676          */
00677         void onPowerBombsSpinner(wxSpinEvent &event);
00678         
00679         /**
00680          * Called when the power bombs text control is changed.
00681          *
00682          * @param event The triggering wxCommandEvent.
00683          */
00684         void onPowerBombsChange(wxCommandEvent &event);
00685         
00686         /**
00687          * Called when a red door control is changed.
00688          *
00689          * @param event The triggering wxCommandEvent.
00690          */
00691         void onRedDoorChange(wxCommandEvent &event);
00692         
00693         /**
00694          * Called when a reserve tank control is changed.
00695          *
00696          * @param event The triggering wxCommandEvent.
00697          */
00698         void onReserveTankChange(wxCommandEvent &event);
00699         
00700         /**
00701          * Called when the save area control is changed.
00702          *
00703          * @param event The triggering wxCommandEvent.
00704          */
00705         void onSaveAreaChange(wxCommandEvent &event);
00706         
00707         /**
00708          * Called when a save point control is changed.
00709          *
00710          * @param event The triggering wxCommandEvent.
00711          */
00712         void onSavePointChange(wxCommandEvent &event);
00713         
00714         /**
00715          * Called in idle time to update the save point controls.
00716          *
00717          * @param event The triggering wxUpdateUIEvent.
00718          */
00719         void onSavePointUpdate(wxUpdateUIEvent &event);
00720         
00721         /**
00722          * Called when a statue control is changed.
00723          *
00724          * @param event The triggering wxCommandEvent.
00725          */
00726         void onStatueChange(wxCommandEvent &event);
00727         
00728         /**
00729          * Called in idle time to update the statue controls.
00730          *
00731          * @param event The triggering wxUpdateUIEvent.
00732          */
00733         void onStatueUpdate(wxUpdateUIEvent &event);
00734         
00735         /**
00736          * Called when the status bar timer goes off.
00737          *
00738          * @param event The triggering wxTimerEvent (unused).
00739          */
00740         void onStatusBarTimer(wxTimerEvent &event);
00741         
00742         /**
00743          * Called when a super missile pack control is changed.
00744          *
00745          * @param event The triggering wxCommandEvent.
00746          */
00747         void onSuperMissilePackChange(wxCommandEvent &event);
00748         
00749         /**
00750          * Called when the super missiles spin button control is changed.
00751          *
00752          * @param event The triggering wxSpinEvent.
00753          */
00754         void onSuperMissilesSpinner(wxSpinEvent &event);
00755         
00756         /**
00757          * Called when the super missiles text control is changed.
00758          *
00759          * @param event The triggering wxCommandEvent.
00760          */
00761         void onSuperMissilesChange(wxCommandEvent &event);
00762         
00763         /**
00764          * Called when this Frame is being closed.
00765          *
00766          * @param event The triggering wxCloseEvent.
00767          */
00768         void onWindowClosing(wxCloseEvent &event);
00769         
00770         /**
00771          * Called when a yellow door control is changed.
00772          *
00773          * @param event The triggering wxCommandEvent.
00774          */
00775         void onYellowDoorChange(wxCommandEvent &event);
00776         
00777         /**
00778          * Called when the zebetites control is changed.
00779          */
00780         void onZebetitesChange(wxCommandEvent &event);
00781         
00782     public:
00783         /**
00784          * Creates a new Frame.
00785          */
00786         Frame();
00787         
00788         /**
00789          * Opens an SRAM file.
00790          *
00791          * @param filename The filename to open.
00792          */
00793         void open(const wxString &filename);
00794     };
00795     
00796     inline void Frame::onFileCloseUpdate(wxUpdateUIEvent &event)
00797         { event.Enable(sram); }
00798         
00799     inline void Frame::onFileExit(wxCommandEvent &) { Close(); }
00800     
00801     inline void Frame::onGameEndingUpdate(wxUpdateUIEvent &event)
00802         { event.Enable(sram); }
00803         
00804     inline void Frame::onGameGiveUpdate(wxUpdateUIEvent &event)
00805         { event.Enable(sram); }
00806 }
00807 
00808 #endif
00809 

Generated on Thu Feb 22 21:33:27 2007 for Super Metroid SRAM Editor by  doxygen 1.5.1-p1