Skip to content

Commit 94565db

Browse files
committed
Now GNEDialog can have only either the GNEApplicationWindow or another GNEDialog. Refs #17321
1 parent e3b8fb6 commit 94565db

File tree

93 files changed

+718
-393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+718
-393
lines changed

src/netedit/GNEApplicationWindow.cpp

Lines changed: 38 additions & 38 deletions
Large diffs are not rendered by default.

src/netedit/GNEApplicationWindowHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ GNEApplicationWindowHelper::ToolsMenuCommands::showTool(FXObject* menuCommand) {
20972097
if (myPythonToolDialog) {
20982098
delete myPythonToolDialog;
20992099
}
2100-
myPythonToolDialog = new GNEPythonToolDialog(myApplicationWindow, myApplicationWindow, tool);
2100+
myPythonToolDialog = new GNEPythonToolDialog(myApplicationWindow, tool);
21012101
return 1;
21022102
}
21032103
}

src/netedit/GNENet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ GNENet::joinSelectedJunctions(GNEUndoList* undoList) {
16521652
for (const auto& junction : myAttributeCarriers->getJunctions()) {
16531653
if ((junction.second->getPositionInView() == pos) && (cluster.find(junction.second->getNBNode()) == cluster.end())) {
16541654
// open dialog
1655-
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myApplicationWindow, myApplicationWindow, GNEDialog::Buttons::YES_NO,
1655+
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myApplicationWindow, GNEDialog::Buttons::YES_NO,
16561656
TL("Position of joined junction"),
16571657
TL("There is another unselected junction in the same position of joined junction."),
16581658
TL("It will be joined with the other selected junctions. Continue?"));
@@ -1758,13 +1758,13 @@ GNENet::cleanInvalidCrossings(GNEUndoList* undoList) {
17581758
// continue depending of invalid crossings
17591759
if (myInvalidCrossings.empty()) {
17601760
// open a warning dialog informing that there isn't crossing to remove
1761-
GNEWarningBasicDialog(myApplicationWindow, myApplicationWindow,
1761+
GNEWarningBasicDialog(myApplicationWindow,
17621762
TL("Clear crossings"),
17631763
TL("There are no invalid crossings to remove."));
17641764
} else {
17651765
std::string plural = myInvalidCrossings.size() == 1 ? ("") : ("s");
17661766
// Ask confirmation to user
1767-
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myApplicationWindow, myApplicationWindow,
1767+
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myApplicationWindow,
17681768
GNEDialog::Buttons::YES_NO, TL("Clear crossings"),
17691769
TL("Crossings will be cleared. Continue?"));
17701770
// 1:yes, 2:no, 4:esc

src/netedit/GNENetHelper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,7 +3464,7 @@ GNENetHelper::SavingStatus::askSaveNetwork(GNEDialog::Result& commonResult) cons
34643464
return GNEDialog::Result::CANCEL;
34653465
} else {
34663466
// open save dialog
3467-
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, GNEApp, TL("network"));
3467+
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, TL("network"));
34683468
// continue depending of result
34693469
if (saveDialog.getResult() == GNEDialog::Result::ABORT) {
34703470
commonResult = GNEDialog::Result::ABORT;
@@ -3496,7 +3496,7 @@ GNENetHelper::SavingStatus::askSaveAdditionalElements(GNEDialog::Result& commonR
34963496
return GNEDialog::Result::CANCEL;
34973497
} else {
34983498
// open save dialog
3499-
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, GNEApp, TL("additional elements"));
3499+
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, TL("additional elements"));
35003500
// continue depending of result
35013501
if (saveDialog.getResult() == GNEDialog::Result::ABORT) {
35023502
commonResult = GNEDialog::Result::ABORT;
@@ -3528,7 +3528,7 @@ GNENetHelper::SavingStatus::askSaveDemandElements(GNEDialog::Result& commonResul
35283528
return GNEDialog::Result::CANCEL;
35293529
} else {
35303530
// open save dialog
3531-
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, GNEApp, TL("demand elements"));
3531+
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, TL("demand elements"));
35323532
// continue depending of result
35333533
if (saveDialog.getResult() == GNEDialog::Result::ABORT) {
35343534
commonResult = GNEDialog::Result::ABORT;
@@ -3560,7 +3560,7 @@ GNENetHelper::SavingStatus::askSaveDataElements(GNEDialog::Result& commonResult)
35603560
return GNEDialog::Result::CANCEL;
35613561
} else {
35623562
// open save dialog
3563-
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, GNEApp, TL("data elements"));
3563+
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, TL("data elements"));
35643564
// continue depending of result
35653565
if (saveDialog.getResult() == GNEDialog::Result::ABORT) {
35663566
commonResult = GNEDialog::Result::ABORT;
@@ -3592,7 +3592,7 @@ GNENetHelper::SavingStatus::askSaveMeanDataElements(GNEDialog::Result& commonRes
35923592
return GNEDialog::Result::CANCEL;
35933593
} else {
35943594
// open save dialog
3595-
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, GNEApp, TL("meanData elements"));
3595+
const GNESaveDialog saveDialog = GNESaveDialog(GNEApp, TL("meanData elements"));
35963596
// continue depending of result
35973597
if (saveDialog.getResult() == GNEDialog::Result::ABORT) {
35983598
commonResult = GNEDialog::Result::ABORT;

src/netedit/GNEViewNet.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ GNEViewNet::askMergeJunctions(const GNEJunction* movedJunction, const GNEJunctio
942942
targetJunction->getMicrosimID(),
943943
movedJunction->getMicrosimID(),
944944
targetJunction->getMicrosimID());
945-
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myViewParent->getGNEAppWindows(), myViewParent->getGNEAppWindows(),
945+
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myViewParent->getGNEAppWindows(),
946946
GNEDialog::Buttons::YES_NO, header, body);
947947
// continue depending of result
948948
if (questionDialog.getResult() == GNEDialog::Result::ACCEPT) {
@@ -971,8 +971,8 @@ GNEViewNet::aksChangeSupermode(const std::string& operation, Supermode expectedS
971971
throw ProcessError("invalid expected supermode");
972972
}
973973
// open question dialog
974-
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myViewParent->getGNEAppWindows(), myViewParent->getGNEAppWindows(), GNEDialog::Buttons::YES_NO,
975-
TL("Confirm switch mode"), body);
974+
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(myViewParent->getGNEAppWindows(),
975+
GNEDialog::Buttons::YES_NO, TL("Confirm switch mode"), body);
976976
// continue depending of result
977977
if (questionDialog.getResult() == GNEDialog::Result::ACCEPT) {
978978
myEditModes.setSupermode(expectedSupermode, true);
@@ -1030,7 +1030,7 @@ GNEViewNet::restrictLane(GNELane* lane, SUMOVehicleClass vclass) {
10301030
const std::string bodyA = TL("There are selected lanes that belong to the same edge.");
10311031
const std::string bodyB = TLF("Only one lane per edge will be restricted to %.", toString(vclass));
10321032
// Show warning dialog
1033-
GNEWarningBasicDialog(GNEApp, GNEApp, header, bodyA, bodyB);
1033+
GNEWarningBasicDialog(GNEApp, header, bodyA, bodyB);
10341034
}
10351035
// If we handeln a set of lanes
10361036
if (mapOfEdgesAndLanes.size() > 0) {
@@ -1047,14 +1047,14 @@ GNEViewNet::restrictLane(GNELane* lane, SUMOVehicleClass vclass) {
10471047
const std::string header = TLF("Set vclass to % for selected lanes", toString(vclass));
10481048
const std::string body = TLF("All lanes own already another lane in the same edge with a restriction for %", toString(vclass));
10491049
// show information dialog
1050-
GNEInformationBasicDialog(GNEApp, GNEApp, header, body);
1050+
GNEInformationBasicDialog(GNEApp, header, body);
10511051
return 0;
10521052
} else {
10531053
// Ask confirmation to user
10541054
const std::string header = TLF("Set vclass to % for selected lanes", toString(vclass));
10551055
const std::string body = TLF("% lanes will be restricted to %. Continue?", toString(mapOfEdgesAndLanes.size() - counter), toString(vclass));
10561056
// show question dialog
1057-
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(GNEApp, GNEApp, GNEDialog::Buttons::YES_NO, header, body);
1057+
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(GNEApp, GNEDialog::Buttons::YES_NO, header, body);
10581058
// continue depending of result
10591059
if (questionDialog.getResult() != GNEDialog::Result::ACCEPT) { //1:yes, 2:no, 4:esc
10601060
return 0;
@@ -1115,14 +1115,14 @@ GNEViewNet::addRestrictedLane(GNELane* lane, SUMOVehicleClass vclass, const bool
11151115
const std::string header = TLF("Add vclass % to selected lanes", toString(vclass));
11161116
const std::string body = TLF("All lanes own already another lane in the same edge with a restriction to %.", toString(vclass));
11171117
// show information dialog
1118-
GNEInformationBasicDialog(GNEApp, GNEApp, header, body);
1118+
GNEInformationBasicDialog(GNEApp, header, body);
11191119
return 0;
11201120
} else {
11211121
// Ask confirmation to user
11221122
const std::string header = TLF("Add vclass % to selected lanes", toString(vclass));
11231123
const std::string body = TLF("% restrictions to % will be added. Continue?", toString(setOfEdges.size() - counter), toString(vclass));
11241124
// show question dialog
1125-
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(GNEApp, GNEApp, GNEDialog::Buttons::YES_NO, header, body);
1125+
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(GNEApp, GNEDialog::Buttons::YES_NO, header, body);
11261126
// continue depending of result
11271127
if (questionDialog.getResult() != GNEDialog::Result::ACCEPT) { //1:yes, 2:no, 4:esc
11281128
return 0;
@@ -1197,14 +1197,14 @@ GNEViewNet::removeRestrictedLane(GNELane* lane, SUMOVehicleClass vclass) {
11971197
const std::string header = TLF("Remove vclass % from selected lanes", toString(vclass));
11981198
const std::string body = TLF("The selected lanes and edges don't have a restriction to %.", toString(vclass));
11991199
// show information dialog
1200-
GNEInformationBasicDialog(GNEApp, GNEApp, header, body);
1200+
GNEInformationBasicDialog(GNEApp, header, body);
12011201
return 0;
12021202
} else {
12031203
// Ask confirmation to user
12041204
const std::string header = TLF("Remove vclass % from selected lanes", toString(vclass));
12051205
const std::string body = TLF("% restrictions to % will be removed. Continue?", toString(setOfEdges.size() - counter), toString(vclass));
12061206
// show question dialog
1207-
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(GNEApp, GNEApp, GNEDialog::Buttons::YES_NO, header, body);
1207+
const GNEQuestionBasicDialog questionDialog = GNEQuestionBasicDialog(GNEApp, GNEDialog::Buttons::YES_NO, header, body);
12081208
// continue depending of result
12091209
if (questionDialog.getResult() != GNEDialog::Result::ACCEPT) { //1:yes, 2:no, 4:esc
12101210
return 0;

src/netedit/GNEViewParent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
491491
const std::string error = myView->makeSnapshot(file);
492492
if (error.size() > 0) {
493493
// open error message box
494-
GNEErrorBasicDialog(myGNEAppWindows, myGNEAppWindows, TL("Saving failed."), error.c_str());
494+
GNEErrorBasicDialog(myGNEAppWindows, TL("Saving failed."), error.c_str());
495495
} else {
496496
WRITE_MESSAGE(TL("Snapshot successfully saved!"));
497497
}

src/netedit/dialogs/GNEAboutDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// ===========================================================================
3636

3737
GNEAboutDialog::GNEAboutDialog(GNEApplicationWindow* applicationWindow) :
38-
GNEDialog(applicationWindow, applicationWindow, TL("About Eclipse SUMO netedit"), GUIIcon::NETEDIT_MINI,
38+
GNEDialog(applicationWindow, TL("About Eclipse SUMO netedit"), GUIIcon::NETEDIT_MINI,
3939
DialogType::ABOUT, GNEDialog::Buttons::OK, OpenType::MODAL, ResizeMode::STATIC) {
4040
// Netedit icon
4141
new FXLabel(myContentFrame, "", GUIIconSubSys::getIcon(GUIIcon::SUMO_LOGO), GUIDesignLabelIcon);

src/netedit/dialogs/GNEColorDialog.cpp

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,22 @@ FXIMPLEMENT(GNEColorDialog, GNEDialog, GNEColorDialogMap, ARRAYNUMBER(GNEColorDi
3939
// method definitions
4040
// ===========================================================================
4141

42-
GNEColorDialog::GNEColorDialog(GNEApplicationWindow* applicationWindow, FXWindow* restoringFocusWindow, const RGBColor color):
43-
GNEDialog(applicationWindow, restoringFocusWindow, TL("Edit color"), GUIIcon::COLORWHEEL, DialogType::COLOR,
42+
GNEColorDialog::GNEColorDialog(GNEApplicationWindow* applicationWindow, const RGBColor color):
43+
GNEDialog(applicationWindow, TL("Edit color"), GUIIcon::COLORWHEEL, DialogType::COLOR,
4444
Buttons::ACCEPT_CANCEL_RESET, OpenType::MODAL, ResizeMode::STATIC, 600, 300),
4545
myOriginalColor(color) {
46-
myColorbox = new FXColorSelector(getContentFrame(), this, FXColorDialog::ID_COLORSELECTOR, LAYOUT_FILL_X | LAYOUT_FILL_Y);
47-
// set color
48-
myColorbox->setRGBA(MFXUtils::getFXColor(color));
49-
// hide buttons
50-
myColorbox->acceptButton()->disable();
51-
myColorbox->acceptButton()->hide();
52-
myColorbox->cancelButton()->disable();
53-
myColorbox->cancelButton()->hide();
54-
// open dialog
55-
openDialog();
46+
// build dialog
47+
builder(color);
48+
}
49+
50+
51+
GNEColorDialog::GNEColorDialog(GNEApplicationWindow* applicationWindow, GNEDialog* parentDialog,
52+
const RGBColor color):
53+
GNEDialog(applicationWindow, TL("Edit color"), GUIIcon::COLORWHEEL, DialogType::COLOR,
54+
Buttons::ACCEPT_CANCEL_RESET, OpenType::MODAL, ResizeMode::STATIC, 600, 300),
55+
myOriginalColor(color) {
56+
// build dialog
57+
builder(color);
5658
}
5759

5860

@@ -106,3 +108,18 @@ GNEColorDialog::onCmdColor(FXObject*, FXSelector, void* ptr) {
106108
return 0;
107109
}
108110
}
111+
112+
113+
void
114+
GNEColorDialog::builder(const RGBColor color) {
115+
myColorbox = new FXColorSelector(getContentFrame(), this, FXColorDialog::ID_COLORSELECTOR, LAYOUT_FILL_X | LAYOUT_FILL_Y);
116+
// set color
117+
myColorbox->setRGBA(MFXUtils::getFXColor(color));
118+
// hide buttons
119+
myColorbox->acceptButton()->disable();
120+
myColorbox->acceptButton()->hide();
121+
myColorbox->cancelButton()->disable();
122+
myColorbox->cancelButton()->hide();
123+
// open dialog
124+
openDialog();
125+
}

src/netedit/dialogs/GNEColorDialog.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ class GNEColorDialog : public GNEDialog {
3232
FXDECLARE(GNEColorDialog)
3333

3434
public:
35-
/// @brief Construct color dialog
36-
GNEColorDialog(GNEApplicationWindow* applicationWindow, FXWindow* restoringFocusWindow,
35+
/// @brief Constructor
36+
GNEColorDialog(GNEApplicationWindow* applicationWindow, const RGBColor color);
37+
38+
/// @brief Constructor with parent dialog
39+
GNEColorDialog(GNEApplicationWindow* applicationWindow, GNEDialog* parentDialog,
3740
const RGBColor color);
3841

3942
/// @brief Destructor
@@ -70,6 +73,9 @@ class GNEColorDialog : public GNEDialog {
7073
const RGBColor myOriginalColor = RGBColor::BLACK;
7174

7275
private:
76+
/// @brief builder
77+
void builder(const RGBColor color);
78+
7379
/// @brief Invalidated copy constructor.
7480
GNEColorDialog(const GNEColorDialog&) = delete;
7581

src/netedit/dialogs/GNECrashDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ FXIMPLEMENT(GNECrashDialog, GNEDialog, GNECrashDialogMap, ARRAYNUMBER(GNECrashDi
5454
// ===========================================================================
5555

5656
GNECrashDialog::GNECrashDialog(GNEApplicationWindow* applicationWindow, const ProcessError& processError) :
57-
GNEDialog(applicationWindow, applicationWindow, TL("Critical error"), GUIIcon::ERROR_SMALL,
57+
GNEDialog(applicationWindow, TL("Critical error"), GUIIcon::ERROR_SMALL,
5858
DialogType::ABOUT, GNEDialog::Buttons::OK_COPY_REPORT, OpenType::MODAL, ResizeMode::RESIZABLE, 800, 600),
5959
myTraceText(processError.getTrace()) {
6060
// create dialog layout (obtained from FXMessageBox)

0 commit comments

Comments
 (0)