1 | #ifndef FACT_Shell
|
---|
2 | #define FACT_Shell
|
---|
3 |
|
---|
4 | #include "ReadlineWindow.h"
|
---|
5 | #include "ReadlineColor.h"
|
---|
6 | #include "WindowLog.h"
|
---|
7 |
|
---|
8 | class WindowLog;
|
---|
9 |
|
---|
10 | typedef struct panel PANEL;
|
---|
11 |
|
---|
12 | class Shell : public ReadlineWindow
|
---|
13 | {
|
---|
14 | protected:
|
---|
15 | static Shell *This; /// pointer to our glocal object to get the static member functions into scope
|
---|
16 |
|
---|
17 | WindowLog win;//(&fPanelIn); // FIXME: Ref
|
---|
18 | WindowLog wout;//(&fPanelOut); // FIXME: Ref
|
---|
19 |
|
---|
20 | private:
|
---|
21 | PANEL *fPanelIn; /// Pointer to the panel for the input stream
|
---|
22 | PANEL *fPanelFrame; /// Pointer to the panel for the frame around the output
|
---|
23 | PANEL *fPanelOut; /// Pointer to the panel for the output stream
|
---|
24 |
|
---|
25 | int fPanelHeight; /// Space between the bottom of the screen and the output panel
|
---|
26 | int fIsVisible; /// Flag whether the output panel is visible or not (for toggle operations)
|
---|
27 |
|
---|
28 | // Callback function for key presses
|
---|
29 | static int rl_proc_F1(int cnt, int key);
|
---|
30 | static int rl_scroll_top(int cnt, int key);
|
---|
31 | static int rl_scroll_bot(int cnt, int key);
|
---|
32 | static int rl_top_inc(int cnt, int key);
|
---|
33 | static int rl_top_dec(int cnt, int key);
|
---|
34 | static int rl_top_resize(int cnt, int key);
|
---|
35 |
|
---|
36 | /// Static member function used as callback for a signal which is
|
---|
37 | /// emitted by the system if the size of the console window has changed
|
---|
38 | static void HandleResizeImp(int dummy);
|
---|
39 |
|
---|
40 | /// Non static member function called by HandleResize
|
---|
41 | void HandleResize();
|
---|
42 |
|
---|
43 | /// Helper for the constructor and window resizing to create the windows and panels
|
---|
44 | void CreateWindows(WINDOW *w[3], int all=true);
|
---|
45 |
|
---|
46 | // Action after readline finished
|
---|
47 | void Shutdown(const char *);
|
---|
48 |
|
---|
49 | public:
|
---|
50 | Shell(const char *prgname);
|
---|
51 | ~Shell();
|
---|
52 |
|
---|
53 | bool Resize(int h);
|
---|
54 | void ShowHide(int v);
|
---|
55 | void Refresh() { ShowHide(-2); }
|
---|
56 |
|
---|
57 | bool PrintCommands() { return ReadlineColor::PrintCommands(win); }
|
---|
58 | bool PrintGeneralHelp();
|
---|
59 | bool PrintKeyBindings();
|
---|
60 |
|
---|
61 | bool Process(const std::string &str);
|
---|
62 |
|
---|
63 | void Lock() { }
|
---|
64 | void Run(const char * = "")
|
---|
65 | {
|
---|
66 | ReadlineColor::PrintBootMsg(win, GetName());
|
---|
67 | ReadlineWindow::Run();
|
---|
68 | }
|
---|
69 | void Unlock() { }
|
---|
70 |
|
---|
71 | WindowLog &GetStreamOut() { return wout; }
|
---|
72 | WindowLog &GetStreamIn() { return win; }
|
---|
73 | const WindowLog &GetStreamOut() const { return wout; }
|
---|
74 | const WindowLog &GetStreamIn() const { return win; }
|
---|
75 | };
|
---|
76 |
|
---|
77 | #endif
|
---|