GUIApplicationWindow.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // The main window of the SUMO-gui.
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef GUIApplicationWindow_h
00020 #define GUIApplicationWindow_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <vector>
00034 #include <iostream>
00035 #include <fx.h>
00036 #include <utils/foxtools/MFXEventQue.h>
00037 #include <utils/foxtools/FXThreadEvent.h>
00038 #include <utils/foxtools/MFXInterThreadEventClient.h>
00039 #include <utils/foxtools/FXRealSpinDial.h>
00040 #include <utils/foxtools/FXLCDLabel.h>
00041 #include <utils/gui/windows/GUIMainWindow.h>
00042 #include <utils/common/ValueRetriever.h>
00043 #include <utils/common/ValueSource.h>
00044 #include "GUISUMOViewParent.h"
00045 
00046 
00047 // ===========================================================================
00048 // class declarations
00049 // ===========================================================================
00050 class GUILoadThread;
00051 class GUIRunThread;
00052 class GUIMessageWindow;
00053 class GUIEvent;
00054 class GUIParameterTracker;
00055 class GUIParameterTableWindow;
00056 
00057 
00058 // ===========================================================================
00059 // class definition
00060 // ===========================================================================
00072 class GUIApplicationWindow :
00073             public GUIMainWindow, public MFXInterThreadEventClient {
00074     // FOX-declarations
00075     FXDECLARE(GUIApplicationWindow)
00076 public:
00077 
00082     GUIApplicationWindow(FXApp* a, const std::string &configPattern);
00083 
00084 
00086     virtual ~GUIApplicationWindow();
00087 
00088 
00090     virtual void create();
00091 
00092 
00094     virtual void detach();
00095 
00096 
00097     void loadOnStartup(const std::string &config, bool run);
00098 
00099 
00100     void dependentBuild(bool game);
00101 
00102     void setStatusBarText(const std::string &);
00103 
00104 
00107 
00108     virtual void eventOccured();
00109     void handleEvent_SimulationLoaded(GUIEvent *e);
00110     void handleEvent_SimulationStep(GUIEvent *e);
00111     void handleEvent_Message(GUIEvent *e);
00112     void handleEvent_SimulationEnded(GUIEvent *e);
00114 
00115 
00116 
00119     long onCmdOpenConfiguration(FXObject*,FXSelector,void*);
00120     long onCmdOpenNetwork(FXObject*,FXSelector,void*);
00121     long onCmdReload(FXObject*,FXSelector,void*);
00122     long onCmdOpenRecent(FXObject*,FXSelector,void*);
00123 
00124     long onCmdClose(FXObject*,FXSelector,void*);
00125 
00128     long onCmdQuit(FXObject*,FXSelector,void*);
00129 
00130     long onCmdEditChosen(FXObject*,FXSelector,void*);
00131     long onCmdEditBreakpoints(FXObject*,FXSelector,void*);
00132 
00134     long onCmdAppSettings(FXObject*,FXSelector,void*);
00136     long onCmdGaming(FXObject*,FXSelector,void*);
00137 
00139     long onCmdAbout(FXObject*,FXSelector,void*);
00140 
00141     long onCmdStart(FXObject*,FXSelector,void*);
00142     long onCmdStop(FXObject*,FXSelector,void*);
00143     long onCmdStep(FXObject*,FXSelector,void*);
00144 
00145     long onCmdNewView(FXObject*,FXSelector,void*);
00146 
00147     long onUpdOpen(FXObject*,FXSelector,void*);
00148     long onUpdReload(FXObject*,FXSelector,void*);
00149     long onUpdOpenRecent(FXObject*,FXSelector,void*);
00150     long onUpdAddMicro(FXObject*,FXSelector,void*);
00151     virtual long onUpdStart(FXObject*,FXSelector,void*);
00152     long onUpdStop(FXObject*,FXSelector,void*);
00153     long onUpdStep(FXObject*,FXSelector,void*);
00154     long onUpdEditChosen(FXObject*sender,FXSelector,void*ptr);
00155     virtual long onUpdEditBreakpoints(FXObject*,FXSelector,void*);
00156     long onCmdClearMsgWindow(FXObject*,FXSelector,void*);
00157 
00158     long onLoadThreadEvent(FXObject*, FXSelector, void*);
00159     long onRunThreadEvent(FXObject*, FXSelector, void*);
00161 
00162     FXGLCanvas *getBuildGLCanvas() const;
00163     SUMOTime getCurrentSimTime() const;
00164 
00165     FXCursor *getDefaultCursor();
00166 
00173     bool loadSelection(const std::string &file, std::string &msg) throw();
00174 
00175 protected:
00176     virtual void addToWindowsMenu(FXMenuPane *) { }
00177 
00178 private:
00180     void load(const std::string &file, bool isNet, bool isReload=false);
00181 
00183     void closeAllWindows();
00184 
00186     GUISUMOAbstractView* openNewView();
00187 
00188 protected:
00190     GUIApplicationWindow() { }
00191 
00192 protected:
00194     virtual void fillMenuBar();
00195 
00197     virtual void buildToolBars();
00198 
00199 protected:
00201     std::string myName;
00202 
00204     GUILoadThread *myLoadThread;
00205 
00207     GUIRunThread *myRunThread;
00208 
00210     bool myWasStarted;
00211 
00213     size_t myViewNumber;
00214 
00216     bool myAmLoading;
00217 
00219     FXMenuPane *myFileMenu, *myEditMenu, *mySettingsMenu,
00220     *myWindowsMenu, *myHelpMenu;
00221 
00223     GUIMessageWindow *myMessageWindow;
00224 
00226     FXSplitter *myMainSplitter;
00227 
00229     FXToolBarShell *myToolBarDrag1, *myToolBarDrag2, *myToolBarDrag3,
00230     *myToolBarDrag4, *myToolBarDrag5,
00231     *myMenuBarDrag;
00232 
00234     FXRealSpinDial *mySimDelayTarget;
00235 
00237     FXdouble mySimDelay;
00238 
00240     MFXEventQue myEvents;
00241 
00243     FXMDIMenu *myMDIMenu;
00244 
00246     FXMenuBar *myMenuBar;
00247 
00249     FXToolBar *myToolBar1, *myToolBar2, *myToolBar3, *myToolBar4, *myToolBar5;
00250 
00252     FXEX::FXLCDLabel *myLCDLabel;
00253 
00255     FXEX::FXThreadEvent myLoadThreadEvent;
00256 
00258     FXEX::FXThreadEvent myRunThreadEvent;
00259 
00261     FXRecentFiles myRecentConfigs;
00262 
00264     FXRecentFiles myRecentNets;
00265 
00267     std::string myConfigPattern;
00268 
00269     bool hadDependentBuild;
00270 
00271 
00272 };
00273 
00274 
00275 #endif
00276 
00277 /****************************************************************************/
00278 

Generated on Wed May 5 00:06:29 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6