Path: blob/main/src/netedit/dialogs/basic/GNEOverwriteElement.cpp
193871 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 GNEOverwriteElement.cpp14/// @author Pablo Alvarez Lopez15/// @date Jul 201716///17// Dialog used to ask user if overwrite elements during loading18/****************************************************************************/19#include <config.h>2021#include <netedit/GNENet.h>22#include <netedit/GNETagProperties.h>23#include <netedit/GNEViewParent.h>24#include <utils/gui/div/GUIDesigns.h>25#include <utils/handlers/CommonHandler.h>2627#include "GNEOverwriteElement.h"2829// ===========================================================================30// member method definitions31// ===========================================================================3233GNEOverwriteElement::GNEOverwriteElement(CommonHandler* commonHandler, const GNEAttributeCarrier* AC) :34GNEDialog(AC->getNet()->getGNEApplicationWindow(), TLF("Overwrite % '%'", AC->getTagProperty()->getTagStr(), AC->getID()), GUIIcon::QUESTION_SMALL,35DialogType::OVERWRITE, GNEDialog::Buttons::YES_NO_CANCEL, GNEDialog::OpenType::MODAL, ResizeMode::STATIC),36myCommonHandler(commonHandler) {37// create dialog layout (obtained from FXMessageBox)38auto infoFrame = new FXVerticalFrame(myContentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10);39// add information label40new FXLabel(infoFrame, TLF("There is already a % '%'. Overwrite?", AC->getTagProperty()->getTagStr(), AC->getID()).c_str(),41nullptr, JUSTIFY_LEFT | ICON_BEFORE_TEXT | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | LAYOUT_FILL_Y);42// add checkButton43myApplySolutionToAllCheckButon = new FXCheckButton(infoFrame, TL("Apply this solution to all conflicted elements"), nullptr, 0, GUIDesignCheckButton);44// open modal dialog45openDialog();46}474849GNEOverwriteElement::~GNEOverwriteElement() {50}515253void54GNEOverwriteElement::runInternalTest(const InternalTestStep::DialogArgument* dialogArgument) {55if (dialogArgument->getCustomAction() == "applyToAll") {56myApplySolutionToAllCheckButon->setCheck(TRUE);57}58}59606162long63GNEOverwriteElement::onCmdAccept(FXObject*, FXSelector, void*) {64if (myApplySolutionToAllCheckButon->getCheck() == TRUE) {65myCommonHandler->forceOverwriteElements();66}67return closeDialogAccepting();68}697071long72GNEOverwriteElement::onCmdCancel(FXObject*, FXSelector, void*) {73if (myApplySolutionToAllCheckButon->getCheck() == TRUE) {74myCommonHandler->forceRemainElements();75}76return closeDialogCanceling();77}787980long81GNEOverwriteElement::onCmdAbort(FXObject*, FXSelector, void*) {82myCommonHandler->abortLoading();83return closeDialogAborting();84}8586/****************************************************************************/878889