50FXIMPLEMENT_ABSTRACT(
GUIMessageWindow, FXText, GUIMessageWindowMap, ARRAYNUMBER(GUIMessageWindowMap))
56 FXText(parent,
nullptr, 0, 0, 0, 0, 0, 50),
57 myMainWindow(mainWindow),
58 myErrorRetriever(
nullptr),
59 myMessageRetriever(
nullptr),
60 myWarningRetriever(
nullptr) {
66 setHiliteStyles(myStyles);
80 const FXint idS =
MAX2(text.rfind(
" '", pos), text.rfind(
"='", pos));
81 const FXint idE = text.find(
"'", pos);
82 if (idS >= 0 && idE >= 0 && idS >= lineS && idE <= lineE) {
83 FXint typeS = text.rfind(
" ", idS - 1);
85 if (text.at(typeS + 1) ==
'(') {
88 std::string type(text.mid(typeS + 1, idS - typeS - 1).lower().text());
89 if (type ==
"tllogic") {
91 }
else if (type ==
"busstop" || type ==
"trainstop") {
93 }
else if (type ==
"containerstop") {
94 type =
"containerStop";
95 }
else if (type ==
"chargingstation") {
96 type =
"chargingStation";
97 }
else if (type ==
"overheadwiresegment") {
98 type =
"overheadWireSegment";
99 }
else if (type ==
"parkingarea") {
100 type =
"parkingArea";
102 const std::string id(text.mid(idS + 2, idE - idS - 2).text());
103 const std::string typedID = type +
":" + id;
114 const FXint end = text.find(
" ", pos + 1);
117 time = text.mid(pos, end - pos).text();
119 time = text.mid(pos, text.length() - pos).text();
123 if (time.back() ==
'\n') {
129 if (time.back() ==
'.') {
136 if (time.front() ==
' ') {
137 time = time.substr(1);
151 FXText::setCursorPos(pos, notify);
154 std::vector<std::string> viewIDs =
main->getViewIDs();
155 if (viewIDs.empty()) {
159 const FXString text = getText();
161 if (glObj !=
nullptr) {
164 if (getApp()->getKeyState(KEY_Control_L)) {
168 const int lookback =
MIN2(pos, 20);
169 const int start =
MAX2(lineStart(pos), pos - lookback);
170 const FXString candidate = text.mid(start, lineEnd(pos) - start);
171 FXint timePos = candidate.find(
" time") + 6;
173 if (pos >= 0 && pos > start + timePos) {
174 t =
getTimeString(candidate, timePos, 0, candidate.length());
178 if (std::find(breakpoints.begin(), breakpoints.end(), t) == breakpoints.end()) {
179 breakpoints.push_back(t);
180 std::sort(breakpoints.begin(), breakpoints.end());
222 FXString text(msg.c_str());
224 FXint pos = text.find(
"'");
227 if (glObj !=
nullptr) {
229 FXString insText = text.left(pos + 1);
230 FXText::appendStyledText(insText, style + 1);
231 text.erase(0, pos + 1);
232 pos = text.find(
"'");
233 insText = text.left(pos);
234 FXText::appendStyledText(insText, style + 4);
237 pos = text.find(
"'", pos + 1);
240 pos = text.find(
" time");
246 FXString insText = text.left(pos + 6);
247 FXText::appendStyledText(insText, style + 1);
248 text.erase(0, pos + 6);
249 pos = text.find(
" ");
251 pos = text.rfind(
".");
253 insText = text.left(pos);
254 FXText::appendStyledText(insText, style + 4);
259 FXText::appendStyledText(text, style + 1,
true);
260 FXText::setCursorPos(getLength() - 1);
261 FXText::setBottomLine(getLength() - 1);
271 std::string msg =
"----------------------------------------------------------------------------------------\n";
272 FXText::appendStyledText(msg.c_str(), (FXint) msg.length(), 1,
true);
273 FXText::setCursorPos(getLength() - 1);
274 FXText::setBottomLine(getLength() - 1);
284 if (getLength() == 0) {
287 FXText::removeText(0, getLength() - 1,
true);
325 FXEvent* e = (FXEvent*) ptr;
327 if (e->state & CONTROLMASK) {
328 return FXText::onKeyPress(o, sel, ptr);
342 const FXColor white = FXRGB(0xff, 0xff, 0xff);
343 const FXColor blue = FXRGB(0x00, 0x00, 0x88);
344 const FXColor green = FXRGB(0x00, 0x88, 0x00);
345 const FXColor red = FXRGB(0x88, 0x00, 0x00);
346 const FXColor yellow = FXRGB(0xe6, 0x98, 0x00);
347 const FXColor fuchsia = FXRGB(0x88, 0x00, 0x88);
350 myStyles[0].normalBackColor = white;
351 myStyles[0].selectForeColor = white;
354 myStyles[0].hiliteBackColor = white;
355 myStyles[0].activeBackColor = white;
359 myStyles[1].normalForeColor = green;
360 myStyles[1].selectBackColor = green;
361 myStyles[1].hiliteForeColor = green;
363 myStyles[4].style = STYLE_UNDERLINE;
370 myStyles[5].style = STYLE_UNDERLINE;
373 myStyles[3].normalForeColor = yellow;
374 myStyles[3].selectBackColor = yellow;
375 myStyles[3].hiliteForeColor = yellow;
377 myStyles[6].style = STYLE_UNDERLINE;
380 myStyles[7].normalForeColor = fuchsia;
381 myStyles[7].selectBackColor = fuchsia;
382 myStyles[7].hiliteForeColor = fuchsia;
@ MESSAGE_OCCURRED
send when a message occured
@ GLDEBUG_OCCURRED
send when a gldebug occured
@ ERROR_OCCURRED
send when a error occured
@ DEBUG_OCCURRED
send when a debug occured
@ WARNING_OCCURRED
send when a warning occured
GUISelectedStorage gSelected
A global holder of selected objects.
FXDEFMAP(GUIMessageWindow) GUIMessageWindowMap[]
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
int main(int argc, char *argv[])
void setView(GUIGlID id)
Centers the view onto the given artifact.
GUIGlID getGlID() const
Returns the numerical id of the object.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
GUIGlObject * getObjectBlocking(GUIGlID id) const
Returns the object from the container locking it.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
virtual void setStatusBarText(const std::string &)
get status bar text (can be implemented in children)
static GUIMainWindow * getInstance()
get instance
A logging window for the gui.
GUIMainWindow * myMainWindow
main window
OutputDevice * myGLDebugRetriever
void addSeparator()
Adds a a separator to this log window.
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations.
void unregisterMsgHandlers()
unregister message handlers
static SUMOTime myBreakPointOffset
Offset when creating breakpoint by clicking on time links.
void clear()
Clears the window.
void fillStyles()
fill styles
SUMOTime getTimeString(const FXString &text, const FXint pos, const FXint lineS, const FXint lineE) const
get time string object
static FXHiliteStyle * myStyles
The text colors used.
static bool myLocateLinks
whether messages are linked to the GUI elements
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
static FXHiliteStyle * getStyles()
The text colors used.
virtual void setCursorPos(FXint pos, FXbool notify=FALSE)
set cursor position over a certain line
OutputDevice * myWarningRetriever
OutputDevice * myMessageRetriever
OutputDevice * myDebugRetriever
~GUIMessageWindow()
Destructor.
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
const GUIGlObject * getActiveStringObject(const FXString &text, const FXint pos, const FXint lineS, const FXint lineE) const
get active string object
void registerMsgHandlers()
register message handlers
void toggleSelection(GUIGlID id)
Toggles selection of an object.
virtual void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
static MsgHandler * getGLDebugInstance()
Returns the instance to add GLdebug to.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static MsgHandler * getDebugInstance()
Returns the instance to add debug to.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
virtual void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.