Path: blob/main/src/netedit/dialogs/options/GNEOptionsEditor.h
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEOptionsEditor.h14/// @author Pablo Alvarez Lopez15/// @date May 202316///17// A Dialog for setting options (see OptionsCont)18/****************************************************************************/19#pragma once20#include <config.h>2122#include <map>23#include <set>24#include <vector>2526#include "GNEOptionsEditorRow.h"2728// ===========================================================================29// class declaration30// ===========================================================================3132class GNEDialog;33class MFXCheckableButton;34class MFXTextFieldSearch;35class MFXCheckButtonTooltip;36class OptionsCont;3738// ===========================================================================39// class definitions40// ===========================================================================4142class GNEOptionsEditor : public FXVerticalFrame {43/// @brief FOX-declaration44FXDECLARE(GNEOptionsEditor)4546/// @brief declare friend class47friend class GNEOptionsEditorRow;4849public:50/**@brief Constructor51*52* @param[in] dialog GNEDialog in which this editor is shown53* @param[in] titleName The title to show54* @param[in] optionsContainer edited option container55* @param[in] originalOptionsContainer original options container used for restoring56*/57GNEOptionsEditor(GNEDialog* dialog, const std::string& titleName, OptionsCont& optionsContainer,58const OptionsCont& originalOptionsContainer);5960/// @brief Destructor61~GNEOptionsEditor();6263/// @brief run internal test64void runInternalTest(const InternalTestStep::DialogArgument* dialogArgument);6566/// @brief check if option was modified67bool isOptionModified() const;6869/// @brief reset options70void resetAllOptions();7172/// @name FOX-callbacks73/// @{7475/// @brief called when user select a topic in the list76long onCmdSelectTopic(FXObject*, FXSelector, void*);7778/// @brief called when user searches79long onCmdSearch(FXObject*, FXSelector, void*);8081/// @brief enable/disable show toolTip82long onCmdShowToolTipsMenu(FXObject*, FXSelector, void*);8384/// @brief save options85long onCmdSaveOptions(FXObject*, FXSelector, void*);8687/// @brief load options88long onCmdLoadOptions(FXObject*, FXSelector, void*);8990/// @brief reset default91long onCmdResetDefault(FXObject*, FXSelector, void*);9293/// @}9495protected:96/// @brief FOX needs this97GNEOptionsEditor();9899/// @brief reference to dialog100GNEDialog* myDialog = nullptr;101102/// @brief reference to edited Option container103OptionsCont& myOptionsContainer;104105/// @brief copy of edited Option container, used for reset106OptionsCont* myCopyOfOptionsContainer = nullptr;107108/// @brief reference to original Option container, used for restoring109const OptionsCont& myOriginalOptionsContainer;110111/// @brief flag for check if options was modified112bool myOptionsModified = false;113114private:115/// @brief checkable button for show toolTips116MFXCheckableButton* myShowToolTipsMenu = nullptr;117118/// @brief Topics elements tree119FXTreeList* myTopicsTreeList = nullptr;120121/// @brief root item122FXTreeItem* myRootItem = nullptr;123124/// @brief vertical frame for entries125FXVerticalFrame* myEntriesFrame = nullptr;126127/// @brief checkbox for enable/disable search by description128MFXCheckButtonTooltip* myDescriptionSearchCheckButton = nullptr;129130/// @brief search button131MFXTextFieldSearch* mySearchButton = nullptr;132133/// @brief map with topics and their associated FXTreeItem134std::map<FXTreeItem*, std::string> myTreeItemTopics;135136/// @brief Input option entries137std::vector<GNEOptionsEditorRow::OptionRow*> myOptionRowEntries;138139/// @brief ignores topics140const std::set<std::string> myIgnoredTopics = {"Configuration"};141142/// @brief ignores entries143const std::set<std::string> myIgnoredEntries = {"geometry.remove", "edges.join", "geometry.split", "ramps.guess", "ramps.set"};144145/// @brief update visible entries by selected topic146bool updateVisibleEntriesByTopic();147148/// @brief update visible entries by search149void updateVisibleEntriesBySearch(std::string searchText);150151/// @brief load configuration152bool loadConfiguration(const std::string& file);153154/// @brief Invalidated copy constructor.155GNEOptionsEditor(const GNEOptionsEditor&) = delete;156157/// @brief Invalidated assignment operator.158GNEOptionsEditor& operator=(const GNEOptionsEditor&) = delete;159};160161162