55 #ifdef CHECK_MEMORY_LEAKS 57 #endif // CHECK_MEMORY_LEAKS 72 FXIMPLEMENT(
GUIDialog_Breakpoints, FXMainWindow, GUIDialog_BreakpointsMap, ARRAYNUMBER(GUIDialog_BreakpointsMap))
79 : FXMainWindow(parent->getApp(), "Breakpoints Editor", NULL, NULL, DECOR_ALL, 20, 20, 170, 300),
80 myParent(parent), myBreakpoints(&breakpoints), myBreakpointLock(&breakpointLock) {
81 FXHorizontalFrame* hbox =
new FXHorizontalFrame(
this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
84 myTable =
new FXTable(hbox,
this,
MID_TABLE, LAYOUT_FILL_X | LAYOUT_FILL_Y);
85 myTable->setVisibleRows(20);
86 myTable->setVisibleColumns(1);
87 myTable->setTableSize(20, 1);
88 myTable->setBackColor(FXRGB(255, 255, 255));
89 myTable->getRowHeader()->setWidth(0);
90 myBreakpointLock->lock();
92 myBreakpointLock->unlock();
94 FXVerticalFrame* layout =
new FXVerticalFrame(hbox, LAYOUT_TOP, 0, 0, 0, 0, 4, 4, 4, 4);
98 new FXButton(layout,
"&Load\t\t", 0,
this,
MID_CHOOSEN_LOAD, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3);
100 new FXButton(layout,
"&Save\t\t", 0,
this,
MID_CHOOSEN_SAVE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3);
101 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
103 new FXButton(layout,
"Clea&r\t\t", 0,
this,
MID_CHOOSEN_CLEAR, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3);
104 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
106 new FXButton(layout,
"&Close\t\t", 0,
this,
MID_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3);
110 myParent->addChild(
this);
121 FXMainWindow::show();
132 myTable->setColumnText(0,
"Time");
133 FXHeader* header =
myTable->getColumnHeader();
134 header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());
135 header->setItemJustify(0, JUSTIFY_CENTER_X);
147 FXFileDialog opendialog(
this,
"Load Breakpoints");
149 opendialog.setSelectMode(SELECTFILE_ANY);
150 opendialog.setPatternList(
"*.txt");
154 if (opendialog.execute()) {
156 std::string file = opendialog.getFilename().text();
159 myBreakpoints->assign(newBreakpoints.begin(), newBreakpoints.end());
178 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
187 std::ostringstream strm;
216 const FXTablePos*
const i = (FXTablePos*) data;
217 const std::string value =
myTable->getItemText(i->row, i->col).text();
219 const bool empty = value.find_first_not_of(
" ") == std::string::npos;
233 std::string msg =
"The value must be a number, is:" + value;
234 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
void close()
Closes the device and removes it from the dictionary.
std::vector< SUMOTime > * myBreakpoints
List of breakpoints.
std::string time2string(SUMOTime t)
GUIMainWindow * myParent
The parent window.
FXString gCurrentFolder
The folder used as last.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
static std::vector< SUMOTime > loadBreakpoints(const std::string &file)
loads breakpoints from the specified file
void show()
sets the focus after the window is created
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
FXDEFMAP(GUIDialog_Breakpoints) GUIDialog_BreakpointsMap[]
Editor for simulation breakpoints.
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user presses the Close-button.
FXMutex * myBreakpointLock
Lock for modifying the list of breakpoints.
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
SUMOTime string2time(const std::string &r)
void removeChild(FXMDIChild *child)
removes the given child window from the list
long onCmdEditTable(FXObject *, FXSelector, void *)
Called when the table was changed.
~GUIDialog_Breakpoints()
Destructor.
void rebuildList()
Rebuilds the entire list.
std::string encode2TXT()
Builds a text representation of the items in the list.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
FXTable * myTable
The list that holds the ids.
Static storage of an output device and its base (abstract) implementation.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon