diff options
Autocommit at 05.05.2022 @ 20:38
3 files changed, 15 insertions, 11 deletions
| -rw-r--r-- | src/ConsoleInterface/Menu.cpp | 19 | ||||
| -rw-r--r-- | src/ConsoleInterface/Toolbox.cpp | 6 | ||||
| -rw-r--r-- | src/ConsoleInterface/Toolbox.hpp | 1 |
diff --git a/src/ConsoleInterface/Menu.cpp b/src/ConsoleInterface/Menu.cpp index 4ecf236..e216d28 100644 --- a/src/ConsoleInterface/Menu.cpp +++ b/src/ConsoleInterface/Menu.cpp @@ -51,25 +51,24 @@ void Menu::navigate() const { while (buffer != 0) { printTitle(title); + switch(msgType) { + case Error: printError(msg.get_cstr()); msgType = NoPrint; break; + case Warning: printWarning(msg.get_cstr()); msgType = NoPrint; break; + case Success: printSuccess(msg.get_cstr()); msgType = NoPrint; break; + case NoPrint: printLine(""); break; + } + printLine(""); resetOrderedList(0); printOrderedListElem("Go Back"); for (unsigned i = 0; i < menuOptions.get_count(); i++) printOrderedListElem(menuOptions[i].get_nameInMenu()); - if (msgType != NoPrint) { - switch(msgType) { - case Error: printError(msg.get_cstr()); break; - case Warning: printWarning(msg.get_cstr()); break; - case Success: printSuccess(msg.get_cstr()); break; - } - msgType = NoPrint; - } - - _printInputBoxLabel("Execute No [0-"); + _printAltInputBoxLabel("Execute No [0-"); print(menuOptions.get_count()); print("]: "); read(buffer); + printLine(""); if (buffer > menuOptions.get_count()) registerError("Invalid menu option!"); diff --git a/src/ConsoleInterface/Toolbox.cpp b/src/ConsoleInterface/Toolbox.cpp index 9cec458..4f04bc0 100644 --- a/src/ConsoleInterface/Toolbox.cpp +++ b/src/ConsoleInterface/Toolbox.cpp @@ -14,6 +14,10 @@ void _printInputBoxLabel(const char* label) { std::cout << "(+) " << label; } +void _printAltInputBoxLabel(const char* label) { + std::cout << ":+: " << label; +} + void inputLineBox(const char* label, char* output, unsigned maxWidth) { _printInputBoxLabel(label); std::cin.ignore(); @@ -21,7 +25,7 @@ void inputLineBox(const char* label, char* output, unsigned maxWidth) { } void printTitle(const char* title) { - std::cout << std::endl << "### " << title << " ###" << std::endl<< std::endl; + std::cout << std::endl << "### " << title << " ###" << std::endl; } void printSuccess(const char* message) { diff --git a/src/ConsoleInterface/Toolbox.hpp b/src/ConsoleInterface/Toolbox.hpp index 9bfba55..9277ff1 100644 --- a/src/ConsoleInterface/Toolbox.hpp +++ b/src/ConsoleInterface/Toolbox.hpp @@ -47,6 +47,7 @@ void printOrderedListElem(const T& elem) { void resetOrderedList(int starter = 1); void _printInputBoxLabel(const char* label); +void _printAltInputBoxLabel(const char* label); template <typename T> void inputBox(const char* label, T* output) { |
