The Pedigree Project  0.1
LocalIO.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef LOCALIO_H
21 #define LOCALIO_H
22 
26 #include "pedigree/kernel/debugger/DebuggerIO.h"
27 #include "pedigree/kernel/processor/types.h"
28 
29 class Keyboard;
30 class Vga;
31 
32 #ifdef PPC_COMMON
33 #define MAX_CONSOLE_WIDTH 128
34 #define MAX_CONSOLE_HEIGHT 48
35 #else
36 #define MAX_CONSOLE_WIDTH 90
37 #define MAX_CONSOLE_HEIGHT 30
38 #endif
39 #define CONSOLE_DEFAULT_MODE 2
40 
45 class LocalIO : public DebuggerIO
46 {
47  public:
51  LocalIO(Vga *pVga, Keyboard *pKeyboard);
52  ~LocalIO();
53 
54  void initialise();
55  void destroy();
56 
62  void setCliUpperLimit(size_t nlines);
63  void setCliLowerLimit(size_t nlines);
64 
70  void enableCli();
71  void disableCli();
72 
73  void cls();
74 
75  virtual char getCharNonBlock();
76 
82  void drawHorizontalLine(
83  char c, size_t row, size_t colStart, size_t colEnd,
84  DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
85  void drawVerticalLine(
86  char c, size_t col, size_t rowStart, size_t rowEnd,
87  DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
88 
93  void drawString(
94  const char *str, size_t row, size_t col, DebuggerIO::Colour foreColour,
95  DebuggerIO::Colour backColour);
96 
100  size_t getWidth()
101  {
102  return m_nWidth;
103  }
104  size_t getHeight()
105  {
106  return m_nHeight;
107  }
108 
113  void enableRefreshes();
114  void disableRefreshes();
115  void forceRefresh();
116 
121  char getChar();
122 
123  void readDimensions()
124  {
125  }
126 
127  protected:
131  void scroll();
132 
136  void moveCursor();
137 
138  void putChar(
139  char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
140 
141  void setMode(int nMode);
142  int getMode();
143 
147  uint16_t m_pFramebuffer[MAX_CONSOLE_WIDTH * MAX_CONSOLE_HEIGHT];
148 
152  uint16_t m_pOldFramebuffer[MAX_CONSOLE_WIDTH * MAX_CONSOLE_HEIGHT];
153 
154  size_t m_nWidth;
155  size_t m_nHeight;
156 
161  size_t m_LowerCliLimit;
163 
168  size_t m_CursorX, m_CursorY;
169 
174 
179 
180  private:
181  LocalIO(const LocalIO &);
182  LocalIO &operator=(const LocalIO &);
183 };
184 
187 #endif
LocalIO(Vga *pVga, Keyboard *pKeyboard)
Definition: LocalIO.cc:24
void moveCursor()
Definition: LocalIO.cc:284
void scroll()
Definition: LocalIO.cc:264
void setCliUpperLimit(size_t nlines)
Definition: LocalIO.cc:76
size_t m_CursorX
Definition: LocalIO.h:168
void drawString(const char *str, size_t row, size_t col, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
Definition: LocalIO.cc:208
void enableRefreshes()
Definition: LocalIO.cc:246
size_t getWidth()
Definition: LocalIO.h:100
size_t m_LowerCliLimit
Definition: LocalIO.h:162
char getChar()
Definition: LocalIO.cc:141
void enableCli()
Definition: LocalIO.cc:98
void drawHorizontalLine(char c, size_t row, size_t colStart, size_t colEnd, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
Definition: LocalIO.cc:146
size_t m_UpperCliLimit
Definition: LocalIO.h:160
uint16_t m_pFramebuffer[MAX_CONSOLE_WIDTH *MAX_CONSOLE_HEIGHT]
Definition: LocalIO.h:147
Keyboard * m_pKeyboard
Definition: LocalIO.h:178
uint16_t m_pOldFramebuffer[MAX_CONSOLE_WIDTH *MAX_CONSOLE_HEIGHT]
Definition: LocalIO.h:152
Vga * m_pVga
Definition: LocalIO.h:173