From e7a0a24fa88e369eb3d345573200955e99324156 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Mon, 21 Dec 2009 18:56:08 +0100 Subject: More work on the status bar --- Source/Kernel/DeviceManager/Disp.ns.cpp | 39 +++++++++++++++++++++++++++++++++ Source/Kernel/DeviceManager/Disp.ns.h | 1 + 2 files changed, 40 insertions(+) (limited to 'Source/Kernel/DeviceManager') diff --git a/Source/Kernel/DeviceManager/Disp.ns.cpp b/Source/Kernel/DeviceManager/Disp.ns.cpp index 2827869..7ccf254 100644 --- a/Source/Kernel/DeviceManager/Disp.ns.cpp +++ b/Source/Kernel/DeviceManager/Disp.ns.cpp @@ -1,6 +1,8 @@ #include "Disp.ns.h" #include #include +#include +#include namespace Disp { @@ -52,6 +54,43 @@ bool setMode(mode_t& newmode) { return false; } +void selectMode() { + getModes(); + *kvt << "\nPlease select a graphic mode in the list below:\n"; + + for (u32int i = 0; i < Disp::modes.size(); i++) { + Disp::mode_t& m = Disp::modes[i]; + *kvt << (s32int)i << ":\t" << "Text " << m.textRows << "x" << m.textCols; + kvt->setCursorCol(21); + if (m.graphWidth != 0 and m.graphHeight != 0) { + *kvt << "Graphics " << m.graphWidth << "x" << m.graphHeight << "x" << m.graphDepth << "\t"; + } else { + *kvt << "No graphics"; + } + kvt->setCursorCol(45); + *kvt << m.device->getName() << "\n"; + } + + while (1) { + *kvt << "\nYour selection: "; + String answer = kvt->readLine(); + u32int n = answer.toInt(); + kvt->unmap(); + if (n >= 0 and n < Disp::modes.size() and Disp::setMode(Disp::modes[n])) { + delete kvt; + SB::reinit(); + kvt = new ScrollableVT(Disp::mode.textRows - SB::height, Disp::mode.textCols, 100, KVT_FGCOLOR, KVT_BGCOLOR); + kvt->map(SB::height); + Kbd::setFocus(kvt); + return; + } else { + Disp::setMode(Disp::modes[1]); + kvt->map(); + *kvt << "Error while switching video mode, please select another one."; + } + } +} + void setText(VGATextOutput* o) { mode.device = o; o->clear(); diff --git a/Source/Kernel/DeviceManager/Disp.ns.h b/Source/Kernel/DeviceManager/Disp.ns.h index 2a10358..d1fac57 100644 --- a/Source/Kernel/DeviceManager/Disp.ns.h +++ b/Source/Kernel/DeviceManager/Disp.ns.h @@ -25,6 +25,7 @@ namespace Disp { void getModes(); bool setMode(mode_t& mode); + void selectMode(); void setText(VGATextOutput* o); //To use only once : when display is initializing } -- cgit v1.2.3