52FXIMPLEMENT_ABSTRACT(
GUIMessageWindow, FXText, GUIMessageWindowMap, ARRAYNUMBER(GUIMessageWindowMap))
58 FXText(parent,
nullptr, 0, 0, 0, 0, 0, 50),
59 myMainWindow(mainWindow),
60 myErrorRetriever(
nullptr),
61 myMessageRetriever(
nullptr),
62 myWarningRetriever(
nullptr) {
68 setHiliteStyles(myStyles);
69 myTimeText =
TL(
" time");
96 const FXint idS =
MAX2(text.rfind(
" '", pos), text.rfind(
"='", pos));
97 const FXint idE = text.find(
"'", pos);
98 if (idS >= 0 && idE >= 0 && idS >= lineS && idE <= lineE) {
99 FXint typeS = text.rfind(
" ", idS - 1);
101 if (text.at(typeS + 1) ==
'(') {
104 std::string type(text.mid(typeS + 1, idS - typeS - 1).lower().text());
109 const std::string id(text.mid(idS + 2, idE - idS - 2).text());
110 const std::string typedID = type +
":" + id;
121 const FXint end = text.find_first_of(
" ,", pos + 1);
124 time = text.mid(pos, end - pos).text();
126 time = text.mid(pos, text.length() - pos).text();
130 if (time.back() ==
'\n') {
136 if (time.back() ==
'.') {
143 if (time.front() ==
' ') {
144 time = time.substr(1);
158 FXText::setCursorPos(pos, notify);
161 if (viewIDs.empty()) {
165 const FXString text = getText();
167 if (glObj !=
nullptr) {
170 if (getApp()->getKeyState(KEY_Control_L)) {
174 const int lookback =
MIN2(pos, 20);
175 const int start =
MAX2(lineStart(pos), pos - lookback);
176 const FXString candidate = text.mid(start, lineEnd(pos) - start);
177 FXint timePos = candidate.find(
myTimeText.c_str());
180 if (pos >= 0 && pos > start + timePos) {
223 FXString text(msg.c_str());
225 FXint pos = text.find(
"'");
228 if (glObj !=
nullptr) {
230 FXString insText = text.left(pos + 1);
231 FXText::appendStyledText(insText, style + 1);
232 text.erase(0, pos + 1);
233 pos = text.find(
"'");
234 insText = text.left(pos);
235 FXText::appendStyledText(insText, style + 4);
238 pos = text.find(
"'", pos + 1);
242 const int timeTerm = (int)
myTimeText.size() + 1;
248 FXString insText = text.left(pos + timeTerm);
249 FXText::appendStyledText(insText, style + 1);
250 text.erase(0, pos + timeTerm);
251 pos = text.find(
" ");
253 pos = text.rfind(
".");
255 insText = text.left(pos);
256 FXText::appendStyledText(insText, style + 4);
261 FXText::appendStyledText(text, style + 1,
true);
262 FXText::setCursorPos(getLength() - 1);
263 FXText::setBottomLine(getLength() - 1);
273 std::string msg = std::string(100,
'-') +
"\n";
274 FXText::appendStyledText(msg.c_str(), (FXint) msg.length(), 1,
true);
275 FXText::setCursorPos(getLength() - 1);
276 FXText::setBottomLine(getLength() - 1);
286 if (getLength() == 0) {
289 FXText::removeText(0, getLength() - 1,
true);
327 FXEvent* e = (FXEvent*) ptr;
329 if (e->state & CONTROLMASK) {
330 return FXText::onKeyPress(o, sel, ptr);
344 const FXColor white = FXRGB(0xff, 0xff, 0xff);
345 const FXColor blue = FXRGB(0x00, 0x00, 0x88);
346 const FXColor green = FXRGB(0x00, 0x88, 0x00);
347 const FXColor red = FXRGB(0x88, 0x00, 0x00);
348 const FXColor yellow = FXRGB(0xe6, 0x98, 0x00);
349 const FXColor fuchsia = FXRGB(0x88, 0x00, 0x88);
352 myStyles[0].normalBackColor = white;
353 myStyles[0].selectForeColor = white;
356 myStyles[0].hiliteBackColor = white;
357 myStyles[0].activeBackColor = white;
361 myStyles[1].normalForeColor = green;
362 myStyles[1].selectBackColor = green;
363 myStyles[1].hiliteForeColor = green;
365 myStyles[4].style = STYLE_UNDERLINE;
372 myStyles[5].style = STYLE_UNDERLINE;
375 myStyles[3].normalForeColor = yellow;
376 myStyles[3].selectBackColor = yellow;
377 myStyles[3].hiliteForeColor = yellow;
379 myStyles[6].style = STYLE_UNDERLINE;
382 myStyles[7].normalForeColor = fuchsia;
383 myStyles[7].selectBackColor = fuchsia;
384 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
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 void addBreakpoint(SUMOTime)
add breakpoint to the application
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
std::vector< std::string > getViewIDs() const
get view IDs
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
static std::string myTimeText
The time text to look for.
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
SUMOTime getTimeString(const FXString &text, const FXint pos) const
get time string object
static std::map< std::string, std::string > myTypeStrings
The translated type strings text to look for.
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.
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.