diff options
author | Alexis211 <alexis211@gmail.com> | 2009-12-23 19:19:55 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-12-23 19:19:55 +0100 |
commit | e2d5d79bbc90d73f709953f04b2b0d1faac4d43e (patch) | |
tree | bde6f928e3a45ef66f4056cbc932bc21fe44cb31 /Source/Kernel/VTManager/SimpleVT.class.cpp | |
parent | 7ede286ebcb845fe4bfdfb948c6073573b01c3cb (diff) | |
download | Melon-e2d5d79bbc90d73f709953f04b2b0d1faac4d43e.tar.gz Melon-e2d5d79bbc90d73f709953f04b2b0d1faac4d43e.zip |
Changed the way virtual terminal commands are handled
These commands include those for moving the cursor, showing/hiding it,
changing the color, ...
Diffstat (limited to 'Source/Kernel/VTManager/SimpleVT.class.cpp')
-rw-r--r-- | Source/Kernel/VTManager/SimpleVT.class.cpp | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/Source/Kernel/VTManager/SimpleVT.class.cpp b/Source/Kernel/VTManager/SimpleVT.class.cpp index 28f9f98..a3e9600 100644 --- a/Source/Kernel/VTManager/SimpleVT.class.cpp +++ b/Source/Kernel/VTManager/SimpleVT.class.cpp @@ -10,7 +10,7 @@ SimpleVT::SimpleVT(u32int rows, u32int cols, u8int fgcolor, u8int bgcolor) : Vir m_cols = cols; m_mapped = false; m_hideCursor = false; - setColor(fgcolor, bgcolor); + m_color = ((bgcolor & 0x0F) << 4) | (fgcolor & 0x0F); clear(); m_csrcol = 0; @@ -22,14 +22,6 @@ SimpleVT::~SimpleVT() { delete [] m_buff; } -void SimpleVT::setColor(u8int fgcolor, u8int bgcolor) { - if (bgcolor == 0xFF) { - m_color = (m_color & 0xF0) | fgcolor; - } else { - m_color = (bgcolor << 4) | fgcolor; - } -} - void SimpleVT::putChar(u32int row, u32int col, WChar c) { if (row >= m_rows or col >= m_cols) return; vtchr* ch = &BUFCHR(row, col); @@ -92,23 +84,45 @@ void SimpleVT::updateCursor() { Disp::moveCursor(m_csrlin + m_maprow, m_csrcol + m_mapcol); } -void SimpleVT::moveCursor(u32int row, u32int col) { - m_csrlin = row; - m_csrcol = col; - updateCursor(); -} - -void SimpleVT::setCursorLine(u32int line) { - m_csrlin = line; - updateCursor(); -} - -void SimpleVT::setCursorCol(u32int col) { - m_csrcol = col; - updateCursor(); +//Command handling +void SimpleVT::handleEscape(mvt_esc_cmd_t cmd) { + switch (cmd.cmd) { + case MVTCMD_CLEAR: + clear(); + break; + case MVTCMD_SCROLL: + scroll(); + break; + case MVTCMD_SETFGCOLOR: + m_color = (m_color & 0xF0) | (cmd.a & 0x0F); + break; + case MVTCMD_SETBGCOLOR: + m_color = (m_color & 0x0F) | ((cmd.a & 0x0F) << 4); + break; + case MVTCMD_SETCOLOR: + m_color = ((cmd.b & 0x0F) << 4) | (cmd.a & 0x0F); + break; + case MVTCMD_MOVECSR: + m_csrlin = cmd.a; m_csrcol = cmd.b; + updateCursor(); + break; + case MVTCMD_SETCSRLIN: + m_csrlin = cmd.a; + updateCursor(); + break; + case MVTCMD_SETCSRCOL: + m_csrcol = cmd.a; + updateCursor(); + break; + case MVTCMD_HIDECSR: + m_hideCursor = true; + break; + case MVTCMD_SHOWCSR: + m_hideCursor = false; + break; + } } - // Display functionn void SimpleVT::put(WChar c, bool updatecsr) { if (c.value == '\b') { |