Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/dialogs/options/GNEOptionsEditor.h
169684 views
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 GNEOptionsEditor.h
15
/// @author Pablo Alvarez Lopez
16
/// @date May 2023
17
///
18
// A Dialog for setting options (see OptionsCont)
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <map>
24
#include <set>
25
#include <vector>
26
27
#include "GNEOptionsEditorRow.h"
28
29
// ===========================================================================
30
// class declaration
31
// ===========================================================================
32
33
class GNEDialog;
34
class MFXCheckableButton;
35
class MFXTextFieldSearch;
36
class MFXCheckButtonTooltip;
37
class OptionsCont;
38
39
// ===========================================================================
40
// class definitions
41
// ===========================================================================
42
43
class GNEOptionsEditor : public FXVerticalFrame {
44
/// @brief FOX-declaration
45
FXDECLARE(GNEOptionsEditor)
46
47
/// @brief declare friend class
48
friend class GNEOptionsEditorRow;
49
50
public:
51
/**@brief Constructor
52
*
53
* @param[in] dialog GNEDialog in which this editor is shown
54
* @param[in] titleName The title to show
55
* @param[in] optionsContainer edited option container
56
* @param[in] originalOptionsContainer original options container used for restoring
57
*/
58
GNEOptionsEditor(GNEDialog* dialog, const std::string& titleName, OptionsCont& optionsContainer,
59
const OptionsCont& originalOptionsContainer);
60
61
/// @brief Destructor
62
~GNEOptionsEditor();
63
64
/// @brief run internal test
65
void runInternalTest(const InternalTestStep::DialogArgument* dialogArgument);
66
67
/// @brief check if option was modified
68
bool isOptionModified() const;
69
70
/// @brief reset options
71
void resetAllOptions();
72
73
/// @name FOX-callbacks
74
/// @{
75
76
/// @brief called when user select a topic in the list
77
long onCmdSelectTopic(FXObject*, FXSelector, void*);
78
79
/// @brief called when user searches
80
long onCmdSearch(FXObject*, FXSelector, void*);
81
82
/// @brief enable/disable show toolTip
83
long onCmdShowToolTipsMenu(FXObject*, FXSelector, void*);
84
85
/// @brief save options
86
long onCmdSaveOptions(FXObject*, FXSelector, void*);
87
88
/// @brief load options
89
long onCmdLoadOptions(FXObject*, FXSelector, void*);
90
91
/// @brief reset default
92
long onCmdResetDefault(FXObject*, FXSelector, void*);
93
94
/// @}
95
96
protected:
97
/// @brief FOX needs this
98
GNEOptionsEditor();
99
100
/// @brief reference to dialog
101
GNEDialog* myDialog = nullptr;
102
103
/// @brief reference to edited Option container
104
OptionsCont& myOptionsContainer;
105
106
/// @brief copy of edited Option container, used for reset
107
OptionsCont* myCopyOfOptionsContainer = nullptr;
108
109
/// @brief reference to original Option container, used for restoring
110
const OptionsCont& myOriginalOptionsContainer;
111
112
/// @brief flag for check if options was modified
113
bool myOptionsModified = false;
114
115
private:
116
/// @brief checkable button for show toolTips
117
MFXCheckableButton* myShowToolTipsMenu = nullptr;
118
119
/// @brief Topics elements tree
120
FXTreeList* myTopicsTreeList = nullptr;
121
122
/// @brief root item
123
FXTreeItem* myRootItem = nullptr;
124
125
/// @brief vertical frame for entries
126
FXVerticalFrame* myEntriesFrame = nullptr;
127
128
/// @brief checkbox for enable/disable search by description
129
MFXCheckButtonTooltip* myDescriptionSearchCheckButton = nullptr;
130
131
/// @brief search button
132
MFXTextFieldSearch* mySearchButton = nullptr;
133
134
/// @brief map with topics and their associated FXTreeItem
135
std::map<FXTreeItem*, std::string> myTreeItemTopics;
136
137
/// @brief Input option entries
138
std::vector<GNEOptionsEditorRow::OptionRow*> myOptionRowEntries;
139
140
/// @brief ignores topics
141
const std::set<std::string> myIgnoredTopics = {"Configuration"};
142
143
/// @brief ignores entries
144
const std::set<std::string> myIgnoredEntries = {"geometry.remove", "edges.join", "geometry.split", "ramps.guess", "ramps.set"};
145
146
/// @brief update visible entries by selected topic
147
bool updateVisibleEntriesByTopic();
148
149
/// @brief update visible entries by search
150
void updateVisibleEntriesBySearch(std::string searchText);
151
152
/// @brief load configuration
153
bool loadConfiguration(const std::string& file);
154
155
/// @brief Invalidated copy constructor.
156
GNEOptionsEditor(const GNEOptionsEditor&) = delete;
157
158
/// @brief Invalidated assignment operator.
159
GNEOptionsEditor& operator=(const GNEOptionsEditor&) = delete;
160
};
161
162