source: branches/fscctrl_safety_limits/src/Console.h@ 19929

Last change on this file since 19929 was 16869, checked in by tbretz, 11 years ago
When we output something ourselves before the event hook is called in readline, we have to signal readline that we have started a new row, so that readline can properly update the prompt. I hope this finally solves the flickering issue on my laptop and/or the problematic display in the fadctrl.
File size: 1.5 KB
Line 
1#ifndef FACT_Console
2#define FACT_Console
3
4#include "Readline.h"
5#include "WindowLog.h"
6
7class ConsoleStream : public Readline
8{
9private:
10 WindowLog fLogO;
11
12 void PrintReadlineError(const std::string &str);
13
14public:
15 ConsoleStream(const char *name);
16 ~ConsoleStream();
17
18 void SetNullOutput(bool null) { fLogO.SetNullOutput(null); }
19
20 // I/O
21 WindowLog &GetStreamOut() { return fLogO; }
22 WindowLog &GetStreamIn() { return fLogO; }
23
24 const WindowLog &GetStreamOut() const { return fLogO; }
25 const WindowLog &GetStreamIn() const { return fLogO; }
26
27 void Lock() { }
28 void Run(const char * = 0);
29 void Unlock() { }
30};
31
32
33
34class Console : public Readline
35{
36private:
37 WindowLog fLogO;
38 WindowLog fLogI;
39
40 bool fContinous;
41
42 void PrintReadlineError(const std::string &str);
43
44public:
45 Console(const char *name);
46 ~Console();
47
48 // Console
49 void SetContinous(bool cont) { fContinous = cont; }
50 bool IsContinous() const { return fContinous; }
51
52 // I/O
53 WindowLog &GetStreamOut() { return fLogO; }
54 WindowLog &GetStreamIn() { return fLogI; }
55
56 const WindowLog &GetStreamOut() const { return fLogO; }
57 const WindowLog &GetStreamIn() const { return fLogI; }
58
59 // Readline
60 bool PrintGeneralHelp();
61 bool PrintCommands();
62 bool PrintKeyBindings();
63
64 void Lock();
65 bool Process(const std::string &str);
66 void Unlock();
67
68 std::string GetLinePrompt() const;
69
70 void Startup();
71 void EventHook(bool);
72 void Run(const char * = 0);
73};
74
75#endif
Note: See TracBrowser for help on using the repository browser.