56 #ifdef CHECK_MEMORY_LEAKS
58 #endif // CHECK_MEMORY_LEAKS
64 #define INVALID_VALUE -1
65 #define INVALID_VALUE_STR "-1"
87 :
FXMainWindow(parent->getApp(), "Breakpoints Editor", NULL, NULL, DECOR_ALL, 20, 20, 300, 300),
88 myParent(parent), myBreakpoints(&breakpoints), myBreakpointLock(&breakpointLock) {
93 myTable->setVisibleRows(20);
94 myTable->setVisibleColumns(1);
95 myTable->setTableSize(20, 1);
96 myTable->setBackColor(FXRGB(255, 255, 255));
97 myTable->setCellType(0,
CT_REAL);
103 myTable->setNumberCellParams(0, begin / 1000, end / 1000, 1, 10, 100,
"%.2f");
104 myTable->getRowHeader()->setWidth(0);
105 myBreakpointLock->lock();
107 myBreakpointLock->unlock();
109 FXVerticalFrame* layout =
new FXVerticalFrame(hbox, LAYOUT_TOP, 0, 0, 0, 0, 4, 4, 4, 4);
111 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);
113 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);
114 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
116 new FXButton(layout,
"Clear\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);
117 new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X);
119 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);
122 myParent->addChild(
this);
137 myTable->setColumnText(0,
"Time");
138 FXHeader* header =
myTable->getColumnHeader();
139 header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent());
141 for (k = 0; k < 1; k++) {
142 header->setItemJustify(k, JUSTIFY_CENTER_X);
146 std::vector<int>::iterator j;
152 for (k = 0; k < 1; k++) {
153 myTable->setItemText(row, k,
" ");
160 FXFileDialog opendialog(
this,
"Load Breakpoints");
162 opendialog.setSelectMode(SELECTFILE_ANY);
163 opendialog.setPatternList(
"*.txt");
167 if (opendialog.execute()) {
169 std::string file = opendialog.getFilename().text();
172 myBreakpoints->assign(newBreakpoints.begin(), newBreakpoints.end());
192 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
201 std::ostringstream strm;
235 std::string value = i->
item->getText().text();
237 if (value.find_first_not_of(
" ") == std::string::npos) {
251 std::string msg =
"The value must be an int, is:" + value;
252 FXMessageBox::error(
this, MBOX_OK,
"Number format error",
"%s", msg.c_str());
#define INVALID_VALUE_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.
MFXAddEditTypedTable * myTable
The list that holds the ids.
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
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[]
static OptionsCont & getOptions()
Retrieves the options.
Editor for simulation breakpoints.
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user presses the Close-button.
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.
MFXMutex * myBreakpointLock
Lock for modifying the list of breakpoints.
~GUIDialog_Breakpoints()
Destructor.
void unlock()
release mutex lock
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.
Static storage of an output device and its base (abstract) implementation.
static FXIcon * getIcon(GUIIcon which)