summaryrefslogtreecommitdiff
path: root/Source/Kernel/DeviceManager
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/DeviceManager')
-rw-r--r--Source/Kernel/DeviceManager/Disp.ns.cpp39
-rw-r--r--Source/Kernel/DeviceManager/Disp.ns.h1
2 files changed, 40 insertions, 0 deletions
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 <DeviceManager/Dev.ns.h>
#include <VTManager/VT.ns.h>
+#include <VTManager/ScrollableVT.class.h>
+#include <Core/SB.ns.h>
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
}