Main Page | Namespace List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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

Generated on Thu Oct 13 02:25:02 2005 for Super Metroid SRAM Editor by  doxygen 1.4.2