Skip to content

Commit

Permalink
message window no longer intercepts keys. refs #36
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Feb 25, 2022
1 parent 7d59d3e commit 4ab2fac
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/utils/gui/div/GUIMessageWindow.cpp
Expand Up @@ -37,6 +37,15 @@
bool GUIMessageWindow::myLocateLinks = true;
SUMOTime GUIMessageWindow::myBreakPointOffset = TIME2STEPS(-5);

/* -------------------------------------------------------------------------
* GUISUMOAbstractView - FOX callback mapping
* ----------------------------------------------------------------------- */
FXDEFMAP(GUIMessageWindow) GUIMessageWindowMap[] = {
FXMAPFUNC(SEL_KEYPRESS, 0, GUIMessageWindow::onKeyPress),
};


FXIMPLEMENT_ABSTRACT(GUIMessageWindow, FXText, GUIMessageWindowMap, ARRAYNUMBER(GUIMessageWindowMap))

// ===========================================================================
// method definitions
Expand Down Expand Up @@ -344,5 +353,14 @@ GUIMessageWindow::unregisterMsgHandlers() {
MsgHandler::getWarningInstance()->removeRetriever(myWarningRetriever);
}

long
GUIMessageWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
FXEvent* e = (FXEvent*) ptr;
// permit ctrl+a, ctrl+c
if (e->state & CONTROLMASK) {
return FXText::onKeyPress(o, sel, ptr);
}
return 0;
}

/****************************************************************************/
7 changes: 7 additions & 0 deletions src/utils/gui/div/GUIMessageWindow.h
Expand Up @@ -50,6 +50,7 @@ class GUIGlObject;
* Each time a new message is passed, the window is reopened.
*/
class GUIMessageWindow : public FXText {
FXDECLARE(GUIMessageWindow)
public:
/** @brief Constructor
*
Expand Down Expand Up @@ -105,6 +106,12 @@ class GUIMessageWindow : public FXText {
return myBreakPointOffset;
}

/// @brief handle keys
long onKeyPress(FXObject* o, FXSelector sel, void* data);

protected:
FOX_CONSTRUCTOR(GUIMessageWindow)

private:
/// @brief class MsgOutputDevice
class MsgOutputDevice : public OutputDevice {
Expand Down

0 comments on commit 4ab2fac

Please sign in to comment.