Skip to content

Commit

Permalink
Due a invalid call to isTestingModeEnabled() during closing of netedi…
Browse files Browse the repository at this point in the history
…t, changed all "isTestingModeEnabled()" calls for "getOptions().getBool("gui-testing")". Refs #3045

git-svn-id: file:///home/behr_mi/git/sumo_synched/trunk@24224 afbd958f-9f77-42d5-a016-97a22340ccf4
  • Loading branch information
palvarezlopez committed May 7, 2017
1 parent 0dfba5e commit da17e10
Show file tree
Hide file tree
Showing 41 changed files with 161 additions and 167 deletions.
2 changes: 1 addition & 1 deletion sumo/src/netedit/GNEAdditionalFrame.cpp
Expand Up @@ -1103,7 +1103,7 @@ GNEAdditionalFrame::AdditionalAttributes::showWarningMessage(std::string extra)
// set message in status bar
myViewNet->setStatusBarText(errorMessage);
// Write Warning in console if we're in testing mode
if (myViewNet->isTestingModeEnabled() == true) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING(errorMessage);
}
}
Expand Down
50 changes: 25 additions & 25 deletions sumo/src/netedit/GNEApplicationWindow.cpp
Expand Up @@ -797,15 +797,15 @@ GNEApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
long
GNEApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening about dialog");
}
// create and open about dialog
GNEDialog_About* about = new GNEDialog_About(this);
about->create();
about->show(PLACEMENT_OWNER);
// write warning if netedit is running in testing mode
if ((myNet != 0) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed about dialog");
}
return 1;
Expand Down Expand Up @@ -1115,17 +1115,17 @@ GNEApplicationWindow::onCmdComputeJunctions(FXObject*, FXSelector, void*) {
long
GNEApplicationWindow::onCmdComputeJunctionsVolatile(FXObject*, FXSelector, void*) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'question'");
}
// open question dialog box
FXuint answer = FXMessageBox::question(myNet->getViewNet()->getApp(), MBOX_YES_NO, "Recompute with volatile options",
"Changes produced in the net due a recomputing with volatile options cannot be undone. Continue?)");
if (answer != 1) { //1:yes, 2:no, 4:esc
// write warning if netedit is running in testing mode
if ((answer == 2) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing") == true == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
} else if ((answer == 4) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
} else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing") == true == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
}
// abort recompute with volatile options
Expand All @@ -1134,7 +1134,7 @@ GNEApplicationWindow::onCmdComputeJunctionsVolatile(FXObject*, FXSelector, void*
myNet->computeEverything(this, true, true);
updateControls();
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'");
}
return 1;
Expand Down Expand Up @@ -1212,13 +1212,13 @@ GNEApplicationWindow::onCmdSaveAsPlainXML(FXObject*, FXSelector, void*) {
myUndoList->mark();
} catch (IOError& e) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'error'");
}
// open message box
FXMessageBox::error(this, MBOX_OK, "Saving plain xml failed!", "%s", e.what());
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
}
}
Expand Down Expand Up @@ -1255,13 +1255,13 @@ GNEApplicationWindow::onCmdSaveJoined(FXObject*, FXSelector, void*) {
myNet->saveJoined(oc);
} catch (IOError& e) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'error'");
}
// opening error message
FXMessageBox::error(this, MBOX_OK, "Saving joined junctions failed!", "%s", e.what());
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
}
}
Expand Down Expand Up @@ -1294,13 +1294,13 @@ GNEApplicationWindow::onCmdSavePois(FXObject*, FXSelector, void*) {
GNEPOI::saveToFile(filename);
} catch (IOError& e) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'error'");
}
// open error dialog box
FXMessageBox::error(this, MBOX_OK, "Saving POIs failed!", "%s", e.what());
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
}
}
Expand Down Expand Up @@ -1338,13 +1338,13 @@ GNEApplicationWindow::onCmdSaveNetwork(FXObject*, FXSelector, void*) {
myUndoList->mark();
} catch (IOError& e) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'error'");
}
// open error message box
FXMessageBox::error(this, MBOX_OK, "Saving Network failed!", "%s", e.what());
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
}
}
Expand Down Expand Up @@ -1378,13 +1378,13 @@ GNEApplicationWindow::onCmdSaveAdditionals(FXObject*, FXSelector, void*) {
myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Additionals saved in " + myAdditionalsFile + ".\n");
} catch (IOError& e) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'error'");
}
// open error message box
FXMessageBox::error(this, MBOX_OK, "Saving additionals failed!", "%s", e.what());
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'");
}
}
Expand Down Expand Up @@ -1440,7 +1440,7 @@ GNEApplicationWindow::continueWithUnsavedChanges() {
FXuint answer = 0;
if (myUndoList->canUndo() && !myUndoList->marked()) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'question'");
}
// open question box
Expand All @@ -1449,7 +1449,7 @@ GNEApplicationWindow::continueWithUnsavedChanges() {
"You have unsaved changes in the network. Do you wish to quit and discard all changes?");
if (answer == MBOX_CLICKED_QUIT) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Quit'");
}
return continueWithUnsavedAdditionalChanges();
Expand All @@ -1462,9 +1462,9 @@ GNEApplicationWindow::continueWithUnsavedChanges() {
return continueWithUnsavedAdditionalChanges();
} else {
// write warning if netedit is running in testing mode
if ((answer == 2) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
} else if ((answer == 4) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
} else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
}
// return false to stop closing/reloading
Expand All @@ -1479,7 +1479,7 @@ bool
GNEApplicationWindow::continueWithUnsavedAdditionalChanges() {
// Check if there are non saved additionals
if ((myNet != NULL) && (myNet->getNumberOfAdditionals() > 0) && (myNet->isAdditionalsSaved() == false)) {
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'question'");
}
// open question box
Expand All @@ -1488,23 +1488,23 @@ GNEApplicationWindow::continueWithUnsavedAdditionalChanges() {
"You have unsaved additionals. Do you wish to quit and discard all changes?");
// if answer was affirmative, but there was an error during saving additional, return false to stop closing/reloading
if (answer == MBOX_CLICKED_QUIT) {
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Quit'");
}
return true;
} else if (answer == MBOX_CLICKED_SAVE) {
// write warning if netedit is running in testing mode
if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'");
}
if (onCmdSaveAdditionals(0, 0, 0) == 0) {
return false;
}
} else {
// write warning if netedit is running in testing mode
if ((answer == 2) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
} else if ((answer == 4) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) {
} else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
}
return false;
Expand Down
10 changes: 5 additions & 5 deletions sumo/src/netedit/GNEBusStop.cpp
Expand Up @@ -332,7 +332,7 @@ GNEBusStop::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList*
case SUMO_ATTR_ENDPOS:
case SUMO_ATTR_LINES:
case GNE_ATTR_BLOCK_MOVEMENT:
undoList->p_add(new GNEChange_Attribute(this, key, value, myViewNet->isTestingModeEnabled()));
undoList->p_add(new GNEChange_Attribute(this, key, value));
updateGeometry();
break;
default:
Expand Down Expand Up @@ -363,7 +363,7 @@ GNEBusStop::isValid(SumoXMLAttr key, const std::string& value) {
// If extension is larger than Lane
if (parse<double>(value) > myLane->getLaneParametricLength()) {
// write warning if netedit is running in testing mode
if (myViewNet->isTestingModeEnabled() == true) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'question'");
}
// Ask user if want to assign the length of lane as endPosition
Expand All @@ -373,15 +373,15 @@ GNEBusStop::isValid(SumoXMLAttr key, const std::string& value) {
". Do you want to assign the length of the " + toString(SUMO_TAG_LANE) + " as " + toString(SUMO_ATTR_ENDPOS) + "?").c_str());
if (answer == 1) { //1:yes, 2:no, 4:esc
// write warning if netedit is running in testing mode
if (myViewNet->isTestingModeEnabled() == true) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'");
}
return true;
} else {
// write warning if netedit is running in testing mode
if ((answer == 2) && (myViewNet->isTestingModeEnabled() == true)) {
if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
} else if ((answer == 4) && (myViewNet->isTestingModeEnabled() == true)) {
} else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion sumo/src/netedit/GNECalibrator.cpp
Expand Up @@ -517,7 +517,7 @@ GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoLi
case SUMO_ATTR_FREQUENCY:
case SUMO_ATTR_OUTPUT:
case SUMO_ATTR_ROUTEPROBE:
undoList->p_add(new GNEChange_Attribute(this, key, value, myViewNet->isTestingModeEnabled()));
undoList->p_add(new GNEChange_Attribute(this, key, value));
updateGeometry();
break;
default:
Expand Down
15 changes: 8 additions & 7 deletions sumo/src/netedit/GNECalibratorDialog.cpp
Expand Up @@ -32,6 +32,7 @@
#include <utils/gui/images/GUIIconSubSys.h>
#include <utils/gui/div/GUIDesigns.h>
#include <utils/common/MsgHandler.h>
#include <utils/options/OptionsCont.h>

#include "GNECalibratorDialog.h"
#include "GNECalibrator.h"
Expand Down Expand Up @@ -198,7 +199,7 @@ GNECalibratorDialog::onCmdClickedRoute(FXObject*, FXSelector, void*) {
// if there are flows that has route to remove as "route" parameter
if (calibratorFlowsToErase.size() > 0) {
// write warning if netedit is running in testing mode
if (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Opening FXMessageBox of type 'question'");
}
// open question dialog box
Expand All @@ -208,16 +209,16 @@ GNECalibratorDialog::onCmdClickedRoute(FXObject*, FXSelector, void*) {
". Continue?").c_str());
if (answer != 1) { //1:yes, 2:no, 4:esc
// write warning if netedit is running in testing mode
if ((answer == 2) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) {
if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
} else if ((answer == 4) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) {
} else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
}
// abort deletion of route
return 0;
} else {
// write warning if netedit is running in testing mode
if (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'");
}
// remove flows with route to delete
Expand Down Expand Up @@ -348,16 +349,16 @@ GNECalibratorDialog::onCmdClickedVehicleType(FXObject*, FXSelector, void*) {
". Continue?").c_str());
if (answer != 1) { //1:yes, 2:no, 4:esc
// write warning if netedit is running in testing mode
if ((answer == 2) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) {
if ((answer == 2) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'");
} else if ((answer == 4) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) {
} else if ((answer == 4) && (OptionsCont::getOptions().getBool("gui-testing") == true)) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'");
}
// abort deletion of vehicle type
return 0;
} else {
// write warning if netedit is running in testing mode
if (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true) {
if (OptionsCont::getOptions().getBool("gui-testing") == true) {
WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'");
}
// remove flows with vehicle type to delete
Expand Down

0 comments on commit da17e10

Please sign in to comment.