From 02fcd22d8cde355aa898a8c6bb4773d9434b8e9a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 10 Oct 2008 16:41:38 +0000 Subject: adds KeyPress, DevInfo and Stats widgets --- src/sys/consoleinterface.cc | 9 +++++++-- src/sys/consoleinterface.h | 20 +++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src/sys') diff --git a/src/sys/consoleinterface.cc b/src/sys/consoleinterface.cc index 45508ee..073f34b 100644 --- a/src/sys/consoleinterface.cc +++ b/src/sys/consoleinterface.cc @@ -72,7 +72,6 @@ void ConsoleInterface::flush() char line[MAXCMDSIZE]; while(consoleinterface_buffer.getline(line, MAXCMDSIZE-1)) { - while (consoleinterface_text.size() >= MAXCONLINES) { consoleinterface_text.pop_front(); } @@ -175,7 +174,12 @@ void ConsoleInterface::print_ansi(const char *line) std::cout << "\033[0;39m"; } -void ConsoleInterface::buffer_rcon(bool enable) +void ConsoleInterface::set_ansi(bool enable) +{ + consoleinterface_ansi = enable; +} + +void ConsoleInterface::set_rcon(bool enable) { if (enable) { flush(); @@ -185,3 +189,4 @@ void ConsoleInterface::buffer_rcon(bool enable) } } // namespace sys + diff --git a/src/sys/consoleinterface.h b/src/sys/consoleinterface.h index 33052cf..5411cb6 100644 --- a/src/sys/consoleinterface.h +++ b/src/sys/consoleinterface.h @@ -60,20 +60,22 @@ public: /// resize the console (ncurses stub) virtual void resize(); - /// turn ANSI color codes on or off - inline void set_ansi(bool ansi) { consoleinterface_ansi = ansi; } - - /// a pointer to the current console instance - static ConsoleInterface *instance(); - - /// enable or disable rcon - void buffer_rcon(bool enable = true); - /// return the console inputbuffer inline std::stringstream & buffer() { return consoleinterface_buffer; } inline bool rcon() { return consoleinterface_rcon; } + inline bool ansi() { return consoleinterface_ansi; } + + /// enable or disable ANSI escape sequences + void set_ansi(bool enable = true); + + /// enable or disable rcon + void set_rcon(bool enable = true); + + /// a pointer to the current console instance + static ConsoleInterface *instance(); + protected: std::deque consoleinterface_text; std::stringstream consoleinterface_buffer; -- cgit v1.2.3