SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // The main window of the SUMO-gui. 00011 /****************************************************************************/ 00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00014 /****************************************************************************/ 00015 // 00016 // This file is part of SUMO. 00017 // SUMO is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation, either version 3 of the License, or 00020 // (at your option) any later version. 00021 // 00022 /****************************************************************************/ 00023 #ifndef GUIApplicationWindow_h 00024 #define GUIApplicationWindow_h 00025 00026 00027 // =========================================================================== 00028 // included modules 00029 // =========================================================================== 00030 #ifdef _MSC_VER 00031 #include <windows_config.h> 00032 #else 00033 #include <config.h> 00034 #endif 00035 00036 #include <string> 00037 #include <vector> 00038 #include <iostream> 00039 #include <fx.h> 00040 #include <utils/foxtools/MFXEventQue.h> 00041 #include <utils/foxtools/FXThreadEvent.h> 00042 #include <utils/foxtools/MFXInterThreadEventClient.h> 00043 #include <utils/foxtools/FXRealSpinDial.h> 00044 #include <utils/foxtools/FXLCDLabel.h> 00045 #include <utils/gui/windows/GUIMainWindow.h> 00046 #include <utils/common/ValueRetriever.h> 00047 #include <utils/common/ValueSource.h> 00048 #include "GUISUMOViewParent.h" 00049 00050 00051 // =========================================================================== 00052 // class declarations 00053 // =========================================================================== 00054 class GUILoadThread; 00055 class GUIRunThread; 00056 class GUIMessageWindow; 00057 class GUIEvent; 00058 class GUIParameterTracker; 00059 class GUIParameterTableWindow; 00060 00061 00062 // =========================================================================== 00063 // class definition 00064 // =========================================================================== 00073 class GUIApplicationWindow : 00074 public GUIMainWindow, public MFXInterThreadEventClient { 00075 // FOX-declarations 00076 FXDECLARE(GUIApplicationWindow) 00077 public: 00078 00083 GUIApplicationWindow(FXApp* a, const std::string& configPattern); 00084 00085 00087 virtual ~GUIApplicationWindow(); 00088 00089 00092 00094 virtual void create(); 00095 00097 virtual void detach(); 00099 00100 void loadOnStartup(); 00101 00102 00103 void dependentBuild(bool game); 00104 00105 void setStatusBarText(const std::string&); 00106 00107 FXGLCanvas* getBuildGLCanvas() const; 00108 SUMOTime getCurrentSimTime() const; 00109 00110 FXCursor* getDefaultCursor(); 00111 00112 00113 00114 00117 00118 virtual void eventOccured(); 00119 void handleEvent_SimulationLoaded(GUIEvent* e); 00120 void handleEvent_SimulationStep(GUIEvent* e); 00121 void handleEvent_Message(GUIEvent* e); 00122 void handleEvent_SimulationEnded(GUIEvent* e); 00124 00125 00126 00129 00131 long onCmdOpenConfiguration(FXObject*, FXSelector, void*); 00132 00134 long onCmdOpenNetwork(FXObject*, FXSelector, void*); 00135 00137 long onCmdReload(FXObject*, FXSelector, void*); 00138 00140 long onCmdOpenRecent(FXObject*, FXSelector, void*); 00141 00143 long onCmdClose(FXObject*, FXSelector, void*); 00144 00148 long onCmdQuit(FXObject*, FXSelector, void*); 00149 00151 long onCmdEditChosen(FXObject*, FXSelector, void*); 00152 00154 long onCmdEditBreakpoints(FXObject*, FXSelector, void*); 00155 00157 long onCmdAppSettings(FXObject*, FXSelector, void*); 00158 00160 long onCmdGaming(FXObject*, FXSelector, void*); 00161 00163 long onCmdListInternal(FXObject*, FXSelector, void*); 00164 00166 long onCmdAbout(FXObject*, FXSelector, void*); 00167 00169 long onCmdStart(FXObject*, FXSelector, void*); 00170 00172 long onCmdStop(FXObject*, FXSelector, void*); 00173 00175 long onCmdStep(FXObject*, FXSelector, void*); 00176 00178 long onCmdNewView(FXObject*, FXSelector, void*); 00179 00180 #ifdef HAVE_OSG 00181 00182 long onCmdNewOSG(FXObject*,FXSelector,void*); 00183 #endif 00184 00186 long onUpdOpen(FXObject*, FXSelector, void*); 00187 00189 long onUpdReload(FXObject*, FXSelector, void*); 00190 00192 long onUpdOpenRecent(FXObject*, FXSelector, void*); 00193 00195 long onUpdAddView(FXObject*, FXSelector, void*); 00196 00198 virtual long onUpdStart(FXObject*, FXSelector, void*); 00199 00201 long onUpdStop(FXObject*, FXSelector, void*); 00202 00204 long onUpdStep(FXObject*, FXSelector, void*); 00205 00207 long onUpdEditChosen(FXObject* sender, FXSelector, void* ptr); 00208 00210 virtual long onUpdEditBreakpoints(FXObject*, FXSelector, void*); 00211 00213 long onCmdClearMsgWindow(FXObject*, FXSelector, void*); 00214 00216 long onLoadThreadEvent(FXObject*, FXSelector, void*); 00217 00219 long onRunThreadEvent(FXObject*, FXSelector, void*); 00220 00222 long onClipboardRequest(FXObject* sender, FXSelector sel, void* ptr); 00224 00225 protected: 00226 virtual void addToWindowsMenu(FXMenuPane*) { } 00227 00228 private: 00230 void load(const std::string& file, bool isNet, bool isReload = false); 00231 00233 void closeAllWindows(); 00234 00235 00237 GUISUMOAbstractView* openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL); 00238 00239 protected: 00241 GUIApplicationWindow() { } 00242 00243 protected: 00245 virtual void fillMenuBar(); 00246 00248 virtual void buildToolBars(); 00249 00250 protected: 00252 std::string myName; 00253 00255 GUILoadThread* myLoadThread; 00256 00258 GUIRunThread* myRunThread; 00259 00261 bool myWasStarted; 00262 00264 size_t myViewNumber; 00265 00267 bool myAmLoading; 00268 00270 FXMenuPane* myFileMenu, *myEditMenu, *mySettingsMenu, 00271 *myWindowsMenu, *myHelpMenu; 00272 00274 GUIMessageWindow* myMessageWindow; 00275 00277 FXSplitter* myMainSplitter; 00278 00280 FXToolBarShell* myToolBarDrag1, *myToolBarDrag2, *myToolBarDrag3, 00281 *myToolBarDrag4, *myToolBarDrag5, 00282 *myMenuBarDrag; 00283 00285 FXRealSpinDial* mySimDelayTarget; 00286 00288 FXdouble mySimDelay; 00289 00291 MFXEventQue myEvents; 00292 00294 FXMDIMenu* myMDIMenu; 00295 00297 FXMenuBar* myMenuBar; 00298 00300 FXToolBar* myToolBar1, *myToolBar2, *myToolBar3, *myToolBar4, *myToolBar5; 00301 00303 FXEX::FXLCDLabel* myLCDLabel; 00304 00306 FXEX::FXThreadEvent myLoadThreadEvent; 00307 00309 FXEX::FXThreadEvent myRunThreadEvent; 00310 00312 FXRecentFiles myRecentConfigs; 00313 00315 FXRecentFiles myRecentNets; 00316 00318 std::string myConfigPattern; 00319 00320 bool hadDependentBuild; 00321 00322 00323 }; 00324 00325 00326 #endif 00327 00328 /****************************************************************************/ 00329