Skip to content

Commit f45701f

Browse files
committed
Fixed #17000
1 parent d9548d5 commit f45701f

File tree

7 files changed

+34
-70
lines changed

7 files changed

+34
-70
lines changed

src/netedit/GNEApplicationWindow.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,7 @@ GNEApplicationWindow::GNEApplicationWindow(FXApp* app, const GNETagPropertiesDat
517517
GUITextureSubSys::initTextures(app);
518518
// init cursors
519519
GUICursorSubSys::initCursors(app);
520-
// create undoList dialog (after initCursors)
521-
myUndoListDialog = new GNEUndoListDialog(this);
520+
// set tooltip options
522521
app->setTooltipTime(1000000000);
523522
app->setTooltipPause(1000000000);
524523
// set SUMO Options descriptions
@@ -694,7 +693,6 @@ GNEApplicationWindow::~GNEApplicationWindow() {
694693
}
695694
// delete undoList and dialog
696695
delete myUndoList;
697-
delete myUndoListDialog;
698696
}
699697

700698

@@ -1573,12 +1571,6 @@ GNEApplicationWindow::getUndoList() {
15731571
}
15741572

15751573

1576-
GNEUndoListDialog*
1577-
GNEApplicationWindow::getUndoListDialog() {
1578-
return myUndoListDialog;
1579-
}
1580-
1581-
15821574
GNEViewNet*
15831575
GNEApplicationWindow::getViewNet() {
15841576
return myViewNet;
@@ -2629,12 +2621,8 @@ GNEApplicationWindow::onCmdRedo(FXObject* sender, FXSelector, void*) {
26292621

26302622
long
26312623
GNEApplicationWindow::onCmdOpenUndoListDialog(FXObject*, FXSelector, void*) {
2632-
// avoid open two dialogs
2633-
if (myUndoListDialog->shown()) {
2634-
myUndoListDialog->setFocus();
2635-
} else {
2636-
myUndoListDialog->show();
2637-
}
2624+
// open UndoList Dialog
2625+
GNEUndoListDialog(this);
26382626
return 1;
26392627
}
26402628

@@ -2646,9 +2634,6 @@ GNEApplicationWindow::onUpdOpenUndoListDialog(FXObject* sender, FXSelector, void
26462634
sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), nullptr);
26472635
} else {
26482636
sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), nullptr);
2649-
if (myUndoListDialog->shown()) {
2650-
myUndoListDialog->hide();
2651-
}
26522637
}
26532638
return 1;
26542639
}

src/netedit/GNEApplicationWindow.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,6 @@ class GNEApplicationWindow : public GUIMainWindow, public MFXInterThreadEventCli
579579
/// @brief get pointer to undoList
580580
GNEUndoList* getUndoList();
581581

582-
/// @brief get pointer to undoList dialog
583-
GNEUndoListDialog* getUndoListDialog();
584-
585582
/// @brief get pointer to viewNet
586583
GNEViewNet* getViewNet();
587584

@@ -752,9 +749,6 @@ class GNEApplicationWindow : public GUIMainWindow, public MFXInterThreadEventCli
752749
/// @brief the one and only undo list
753750
GNEUndoList* myUndoList = nullptr;
754751

755-
/// @brief undoList dialog
756-
GNEUndoListDialog* myUndoListDialog = nullptr;
757-
758752
/// @brief Input file pattern
759753
std::string myConfigPattern;
760754

src/netedit/dialogs/GNEUndoListDialog.cpp

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,36 @@ FXDEFMAP(GNEUndoListDialog) GNEUndoListDialogMap[] = {
3434
};
3535

3636
// Object implementation
37-
FXIMPLEMENT(GNEUndoListDialog, FXTopWindow, GNEUndoListDialogMap, ARRAYNUMBER(GNEUndoListDialogMap))
37+
FXIMPLEMENT(GNEUndoListDialog, GNEDialog, GNEUndoListDialogMap, ARRAYNUMBER(GNEUndoListDialogMap))
3838

3939
// ===========================================================================
4040
// member method definitions
4141
// ===========================================================================
4242

4343
GNEUndoListDialog::GNEUndoListDialog(GNEApplicationWindow* applicationWindow) :
4444
GNEDialog(applicationWindow, TL("Undo/Redo history"), GUIIcon::UNDOLIST,
45-
Buttons::OK, OpenType::MODAL, ResizeMode::STATIC, 560, 400) {
45+
Buttons::OK, OpenType::MODAL, ResizeMode::STATIC) {
4646
// create scroll windows for rows
47-
auto* scrollWindowsContents = new FXScrollWindow(myContentFrame, GUIDesignContentsScrollUndoList);
47+
auto* scrollWindowsContents = new FXScrollWindow(myContentFrame, GUIDesignScrollWindowFixed(560, 400));
4848
myRowFrame = new FXVerticalFrame(scrollWindowsContents, GUIDesignAuxiliarFrame);
49+
// set background clor
50+
myRowFrame->setBackColor(FXRGB(255, 255, 255));
51+
// declare redo iterator over undoList and fill rows
52+
GNEUndoList::RedoIterator itRedo(myApplicationWindow->getUndoList());
53+
while (!itRedo.end()) {
54+
myGUIRows.push_back(new GUIRow(this, myRowFrame, myApplicationWindow->getStaticTooltipView()));
55+
itRedo++;
56+
}
57+
// declare undo iterator over undoList and fill rows
58+
GNEUndoList::UndoIterator itUndo(myApplicationWindow->getUndoList());
59+
while (!itUndo.end()) {
60+
myGUIRows.push_back(new GUIRow(this, myRowFrame, myApplicationWindow->getStaticTooltipView()));
61+
itUndo++;
62+
}
63+
// update list
64+
updateList();
65+
// open dialog
66+
openDialog();
4967
}
5068

5169

@@ -125,31 +143,6 @@ GNEUndoListDialog::updateList() {
125143
}
126144

127145

128-
void
129-
GNEUndoListDialog::recalcList() {
130-
// first clear rows
131-
for (auto& GUIRow : myGUIRows) {
132-
delete GUIRow;
133-
}
134-
myGUIRows.clear();
135-
// declare redo iterator over undoList and fill rows
136-
GNEUndoList::RedoIterator itRedo(myApplicationWindow->getUndoList());
137-
while (!itRedo.end()) {
138-
myGUIRows.push_back(new GUIRow(this, myRowFrame, myApplicationWindow->getStaticTooltipView()));
139-
itRedo++;
140-
}
141-
// declare undo iterator over undoList and fill rows
142-
GNEUndoList::UndoIterator itUndo(myApplicationWindow->getUndoList());
143-
while (!itUndo.end()) {
144-
myGUIRows.push_back(new GUIRow(this, myRowFrame, myApplicationWindow->getStaticTooltipView()));
145-
itUndo++;
146-
}
147-
// recalc frame and update list
148-
myRowFrame->recalc();
149-
updateList();
150-
}
151-
152-
153146
GNEUndoListDialog::UndoListRow::UndoListRow(const int index_, FXIcon* icon_, const std::string description_, const std::string timestamp_) :
154147
index(index_),
155148
icon(icon_),
@@ -169,11 +162,6 @@ GNEUndoListDialog::GUIRow::GUIRow(GNEUndoListDialog* undoListDialog, FXVerticalF
169162
// build text label
170163
myTextFieldTimeStamp = new FXTextField(horizontalFrame, GUIDesignTextFieldNCol, undoListDialog, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(70));
171164
myTextFieldTimeStamp->setEditable(false);
172-
// create elements
173-
horizontalFrame->create();
174-
myIcon->create();
175-
myTextFieldDescription->create();
176-
myTextFieldTimeStamp->create();
177165
}
178166

179167

src/netedit/dialogs/GNEUndoListDialog.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,6 @@ class GNEUndoListDialog : public GNEDialog {
5555
/// @}
5656

5757
protected:
58-
/// @brief FOX needs this
59-
FOX_CONSTRUCTOR(GNEUndoListDialog)
60-
61-
/// @brief update list destroying and creating rows
62-
void updateList();
63-
64-
/// @brief recalc list destroying and creating rows
65-
void recalcList();
66-
6758
/// @struct class for keep every row value
6859
struct UndoListRow {
6960
/// @brief constructor
@@ -127,6 +118,12 @@ class GNEUndoListDialog : public GNEDialog {
127118
FXTextField* myTextFieldTimeStamp = nullptr;
128119
};
129120

121+
/// @brief FOX needs this
122+
FOX_CONSTRUCTOR(GNEUndoListDialog)
123+
124+
/// @brief update list destroying and creating rows
125+
void updateList();
126+
130127
/// @brief frame for rows
131128
FXVerticalFrame* myRowFrame = nullptr;
132129

src/netedit/dialogs/elements/lists/GNEElementTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ GNEElementTable::GNEElementTable(GNEElementList* elementList, const GNETagProper
300300
// create column header
301301
myColumnHeader = new ColumnHeader(this, tagProperties);
302302
// create scroll windows for rows
303-
myScrollWindow = new FXScrollWindow(this, GUIDesignScrollWindowFixed(400));
303+
myScrollWindow = new FXScrollWindow(this, GUIDesignScrollWindowFixedWidth(400));
304304
// create vertical frame for rows and set back
305305
myRowsFrame = new FXVerticalFrame(myScrollWindow, GUIDesignAuxiliarFrame);
306306
myRowsFrame->setBackColor(TEXTCOLOR_BACKGROUND_WHITE);

src/netedit/frames/GNEFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ GNEFrame::GNEFrame(GNEViewParent* viewParent, GNEViewNet* viewNet, const std::st
8585
new FXHorizontalSeparator(this, GUIDesignHorizontalSeparator);
8686

8787
// Create scroll windows with fixed width for contents
88-
myScrollWindowsContents = new FXScrollWindow(this, GUIDesignScrollWindowFixed(10));
88+
myScrollWindowsContents = new FXScrollWindow(this, GUIDesignScrollWindowFixedWidth(10));
8989

9090
// Create frame for contents (in which GroupBox will be placed)
9191
myContentFrame = new FXVerticalFrame(myScrollWindowsContents, GUIDesignAuxiliarFrameFixedWidth(0));

src/utils/gui/div/GUIDesigns.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,10 @@ class MFXMenuCheckIcon;
373373
#define GUIDesignScrollWindow (LAYOUT_FILL_X | LAYOUT_FILL_Y | HSCROLLER_NEVER | VSCROLLER_ALWAYS), 0, 0, 0, 0
374374

375375
/// @brief design for scroll windows extended over Y and fix width
376-
#define GUIDesignScrollWindowFixed(customWidth) (LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | HSCROLLER_NEVER | VSCROLLER_ALWAYS), 0, 0, customWidth, 0
376+
#define GUIDesignScrollWindowFixedWidth(customWidth) (LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | HSCROLLER_NEVER | VSCROLLER_ALWAYS), 0, 0, customWidth, 0
377377

378378
/// @brief design for the content scroll of UndoList
379-
#define GUIDesignContentsScrollUndoList (LAYOUT_FILL_X | LAYOUT_FILL_Y | HSCROLLER_NEVER), 0, 0, 0, 0
379+
#define GUIDesignScrollWindowFixed(width, height) (LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | HSCROLLER_NEVER | VSCROLLER_ALWAYS), 0, 0, width, height
380380

381381
/// @brief design for the main content frame of every frame/dialog
382382
#define GUIDesignChildWindowContentFrame (FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y)

0 commit comments

Comments
 (0)