SUMO - Simulation of Urban MObility

GUIApplicationWindow.h

Go to the documentation of this file.
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 // ===========================================================================
00076 class GUIApplicationWindow :
00077     public GUIMainWindow, public MFXInterThreadEventClient {
00078     // FOX-declarations
00079     FXDECLARE(GUIApplicationWindow)
00080 public:
00081 
00086     GUIApplicationWindow(FXApp* a, const std::string& configPattern);
00087 
00088 
00090     virtual ~GUIApplicationWindow();
00091 
00092 
00094     virtual void create();
00095 
00096 
00098     virtual void detach();
00099 
00100 
00101     void loadOnStartup(bool run);
00102 
00103 
00104     void dependentBuild(bool game);
00105 
00106     void setStatusBarText(const std::string&);
00107 
00108 
00111 
00112     virtual void eventOccured();
00113     void handleEvent_SimulationLoaded(GUIEvent* e);
00114     void handleEvent_SimulationStep(GUIEvent* e);
00115     void handleEvent_Message(GUIEvent* e);
00116     void handleEvent_SimulationEnded(GUIEvent* e);
00118 
00119 
00120 
00123     long onCmdOpenConfiguration(FXObject*, FXSelector, void*);
00124     long onCmdOpenNetwork(FXObject*, FXSelector, void*);
00125     long onCmdReload(FXObject*, FXSelector, void*);
00126     long onCmdOpenRecent(FXObject*, FXSelector, void*);
00127 
00128     long onCmdClose(FXObject*, FXSelector, void*);
00129 
00132     long onCmdQuit(FXObject*, FXSelector, void*);
00133 
00134     long onCmdEditChosen(FXObject*, FXSelector, void*);
00135     long onCmdEditBreakpoints(FXObject*, FXSelector, void*);
00136 
00138     long onCmdAppSettings(FXObject*, FXSelector, void*);
00140     long onCmdGaming(FXObject*, FXSelector, void*);
00142     long onCmdListInternal(FXObject*, FXSelector, void*);
00143 
00145     long onCmdAbout(FXObject*, FXSelector, void*);
00146 
00147     long onCmdStart(FXObject*, FXSelector, void*);
00148     long onCmdStop(FXObject*, FXSelector, void*);
00149     long onCmdStep(FXObject*, FXSelector, void*);
00150 
00151     long onCmdNewView(FXObject*, FXSelector, void*);
00152 
00153     long onUpdOpen(FXObject*, FXSelector, void*);
00154     long onUpdReload(FXObject*, FXSelector, void*);
00155     long onUpdOpenRecent(FXObject*, FXSelector, void*);
00156     long onUpdAddMicro(FXObject*, FXSelector, void*);
00157     virtual long onUpdStart(FXObject*, FXSelector, void*);
00158     long onUpdStop(FXObject*, FXSelector, void*);
00159     long onUpdStep(FXObject*, FXSelector, void*);
00160     long onUpdEditChosen(FXObject* sender, FXSelector, void* ptr);
00161     virtual long onUpdEditBreakpoints(FXObject*, FXSelector, void*);
00162     long onCmdClearMsgWindow(FXObject*, FXSelector, void*);
00163 
00164     long onLoadThreadEvent(FXObject*, FXSelector, void*);
00165     long onRunThreadEvent(FXObject*, FXSelector, void*);
00167     long onClipboardRequest(FXObject* sender, FXSelector sel, void* ptr);
00169 
00170     FXGLCanvas* getBuildGLCanvas() const;
00171     SUMOTime getCurrentSimTime() const;
00172 
00173     FXCursor* getDefaultCursor();
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 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines