Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4 : // This program and the accompanying materials are made available under the
5 : // terms of the Eclipse Public License 2.0 which is available at
6 : // https://www.eclipse.org/legal/epl-2.0/
7 : // This Source Code may also be made available under the following Secondary
8 : // Licenses when the conditions for such availability set forth in the Eclipse
9 : // Public License 2.0 are satisfied: GNU General Public License, version 2
10 : // or later which is available at
11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 : /****************************************************************************/
14 : /// @file GUIDialog_Breakpoints.h
15 : /// @author Daniel Krajzewicz
16 : /// @author Jakob Erdmann
17 : /// @date Thu, 17 Jun 2004
18 : ///
19 : // Editor for simulation breakpoints
20 : /****************************************************************************/
21 : #pragma once
22 : #include <config.h>
23 :
24 : #include <string>
25 : #include <vector>
26 : #include <memory>
27 : #include <utils/foxtools/fxheader.h>
28 : #include <utils/gui/div/GUIPersistentWindowPos.h>
29 :
30 :
31 : // ===========================================================================
32 : // class definition
33 : // ===========================================================================
34 : /**
35 : * @class GUIDialog_Breakpoints
36 : * @brief Editor for simulation breakpoints
37 : *
38 : * This dialog shows and lets the user edit the list of breakpoints - simulation
39 : * time steps where the simulation halts.
40 : * @todo Use a LineReader instead of >> while reading
41 : */
42 : class GUIDialog_Breakpoints : public FXMainWindow {
43 : // FOX-declarations
44 0 : FXDECLARE(GUIDialog_Breakpoints)
45 :
46 : public:
47 : /** @brief Constructor
48 : * @param[in] parent The parent window
49 : */
50 : GUIDialog_Breakpoints(GUIApplicationWindow* parent, std::vector<SUMOTime>& breakpoints, FXMutex& breakpointLock, const SUMOTime simBegin);
51 :
52 : /// @brief Destructor
53 : ~GUIDialog_Breakpoints();
54 :
55 : /// @brief sets the focus after the window is created
56 : void show();
57 : using FXMainWindow::show; // to silence the warning C4266 about a hidden function
58 :
59 : /// @name FOX-callbacks
60 : /// @{
61 :
62 : /// @brief keyboard functions
63 : //@{
64 : long onKeyPress(FXObject* o, FXSelector sel, void* data);
65 : //@}
66 :
67 : /// @brief Called when the user presses the Load-button
68 : long onCmdLoad(FXObject*, FXSelector, void*);
69 :
70 : /// @brief Called when the user presses the Save-button
71 : long onCmdSave(FXObject*, FXSelector, void*);
72 :
73 : /// @brief Called when the user presses the Clear-button
74 : long onCmdClear(FXObject*, FXSelector, void*);
75 :
76 : /// @brief Called when the user clicks a time link in the message window
77 : long onCmdUpdateBreakpoints(FXObject*, FXSelector, void*);
78 :
79 : /// @brief Called when the user presses the Close-button
80 : long onCmdClose(FXObject*, FXSelector, void*);
81 :
82 : /// @brief Called when the table was changed
83 : long onCmdEditTable(FXObject*, FXSelector, void*);
84 : /// @}
85 :
86 : virtual void layout();
87 :
88 : /// @brief Rebuilds the entire list
89 : void rebuildList();
90 :
91 : protected:
92 : /// @brief FOX need this
93 0 : FOX_CONSTRUCTOR(GUIDialog_Breakpoints)
94 :
95 : private:
96 :
97 : /** @brief Builds a text representation of the items in the list
98 : * @return Breakpoints encoded as a string
99 : */
100 : std::string encode2TXT();
101 :
102 : /// @brief The list that holds the ids
103 : FXTable* myTable;
104 :
105 : /// @brief The parent window
106 : GUIApplicationWindow* myParent;
107 :
108 : /// @brief List of breakpoints
109 : std::vector<SUMOTime>* myBreakpoints;
110 :
111 : /// @brief Lock for modifying the list of breakpoints
112 : FXMutex* myBreakpointLock;
113 :
114 : /// @brief simulation begin
115 : SUMOTime mySimBegin;
116 :
117 : /// @brief persisting the position on close
118 : std::unique_ptr<GUIPersistentWindowPos> myPersistentPos;
119 : };
|