|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // The main window of the SUMO-gui. 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 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*); 00138 long onCmdListInternal(FXObject*,FXSelector,void*); 00139 00141 long onCmdAbout(FXObject*,FXSelector,void*); 00142 00143 long onCmdStart(FXObject*,FXSelector,void*); 00144 long onCmdStop(FXObject*,FXSelector,void*); 00145 long onCmdStep(FXObject*,FXSelector,void*); 00146 00147 long onCmdNewView(FXObject*,FXSelector,void*); 00148 00149 long onUpdOpen(FXObject*,FXSelector,void*); 00150 long onUpdReload(FXObject*,FXSelector,void*); 00151 long onUpdOpenRecent(FXObject*,FXSelector,void*); 00152 long onUpdAddMicro(FXObject*,FXSelector,void*); 00153 virtual long onUpdStart(FXObject*,FXSelector,void*); 00154 long onUpdStop(FXObject*,FXSelector,void*); 00155 long onUpdStep(FXObject*,FXSelector,void*); 00156 long onUpdEditChosen(FXObject* sender,FXSelector,void* ptr); 00157 virtual long onUpdEditBreakpoints(FXObject*,FXSelector,void*); 00158 long onCmdClearMsgWindow(FXObject*,FXSelector,void*); 00159 00160 long onLoadThreadEvent(FXObject*, FXSelector, void*); 00161 long onRunThreadEvent(FXObject*, FXSelector, void*); 00163 long onClipboardRequest(FXObject* sender,FXSelector sel,void* ptr); 00165 00166 FXGLCanvas* getBuildGLCanvas() const; 00167 SUMOTime getCurrentSimTime() const; 00168 00169 FXCursor* getDefaultCursor(); 00170 00171 protected: 00172 virtual void addToWindowsMenu(FXMenuPane*) { } 00173 00174 private: 00176 void load(const std::string& file, bool isNet, bool isReload=false); 00177 00179 void closeAllWindows(); 00180 00182 GUISUMOAbstractView* openNewView(); 00183 00184 protected: 00186 GUIApplicationWindow() { } 00187 00188 protected: 00190 virtual void fillMenuBar(); 00191 00193 virtual void buildToolBars(); 00194 00195 protected: 00197 std::string myName; 00198 00200 GUILoadThread* myLoadThread; 00201 00203 GUIRunThread* myRunThread; 00204 00206 bool myWasStarted; 00207 00209 size_t myViewNumber; 00210 00212 bool myAmLoading; 00213 00215 FXMenuPane* myFileMenu, *myEditMenu, *mySettingsMenu, 00216 *myWindowsMenu, *myHelpMenu; 00217 00219 GUIMessageWindow* myMessageWindow; 00220 00222 FXSplitter* myMainSplitter; 00223 00225 FXToolBarShell* myToolBarDrag1, *myToolBarDrag2, *myToolBarDrag3, 00226 *myToolBarDrag4, *myToolBarDrag5, 00227 *myMenuBarDrag; 00228 00230 FXRealSpinDial* mySimDelayTarget; 00231 00233 FXdouble mySimDelay; 00234 00236 MFXEventQue myEvents; 00237 00239 FXMDIMenu* myMDIMenu; 00240 00242 FXMenuBar* myMenuBar; 00243 00245 FXToolBar* myToolBar1, *myToolBar2, *myToolBar3, *myToolBar4, *myToolBar5; 00246 00248 FXEX::FXLCDLabel* myLCDLabel; 00249 00251 FXEX::FXThreadEvent myLoadThreadEvent; 00252 00254 FXEX::FXThreadEvent myRunThreadEvent; 00255 00257 FXRecentFiles myRecentConfigs; 00258 00260 FXRecentFiles myRecentNets; 00261 00263 std::string myConfigPattern; 00264 00265 bool hadDependentBuild; 00266 00267 00268 }; 00269 00270 00271 #endif 00272 00273 /****************************************************************************/ 00274