- More color cleanup

- Incraesed WaveOut buffer count
- Fixed command parsing with respect to leading/trailing spaces
This commit is contained in:
casey 2016-07-02 12:46:00 -07:00
parent 8e201f1487
commit 2b1a924165
6 changed files with 36 additions and 32 deletions

View File

@ -35,7 +35,7 @@
#include "WaveOut.h" #include "WaveOut.h"
#define MAX_VOLUME 0xFFFF #define MAX_VOLUME 0xFFFF
#define MAX_BUFFERS_PER_OUTPUT 8 #define MAX_BUFFERS_PER_OUTPUT 16
static void notifyBufferProcessed(WaveOutBuffer *buffer) { static void notifyBufferProcessed(WaveOutBuffer *buffer) {
/* let the provider know the output device is done with the buffer; the /* let the provider know the output device is done with the buffer; the

View File

@ -132,14 +132,14 @@ void ConsoleLayout::OnEnterPressed(TextInput *input) {
std::string command = this->commands->GetText(); std::string command = this->commands->GetText();
this->commands->SetText(""); this->commands->SetText("");
output->WriteLine("> " + command + "\n", COLOR_PAIR(CURSESPP_BLACK_ON_GREY)); output->WriteLine("> " + command + "\n", COLOR_PAIR(CURSESPP_TEXT_DEFAULT));
if (!this->ProcessCommand(command)) { if (!this->ProcessCommand(command)) {
if (command.size()) { if (command.size()) {
output->WriteLine( output->WriteLine(
"illegal command: '" + "illegal command: '" +
command + command +
"'\n", COLOR_PAIR(CURSESPP_RED_ON_GREY)); "'\n", COLOR_PAIR(CURSESPP_TEXT_ERROR));
} }
} }
} }
@ -212,6 +212,18 @@ bool ConsoleLayout::ProcessCommand(const std::string& cmd) {
std::vector<std::string> args; std::vector<std::string> args;
boost::algorithm::split(args, cmd, boost::is_any_of(" ")); boost::algorithm::split(args, cmd, boost::is_any_of(" "));
auto it = args.begin();
while (it != args.end()) {
std::string trimmed = boost::algorithm::trim_copy(*it);
if (trimmed.size()) {
*it = trimmed;
++it;
}
else {
it = args.erase(it);
}
}
std::string name = args.size() > 0 ? args[0] : ""; std::string name = args.size() > 0 ? args[0] : "";
args.erase(args.begin()); args.erase(args.begin());
@ -247,10 +259,10 @@ bool ConsoleLayout::ProcessCommand(const std::string& cmd) {
else if (name == "h" || name == "help") { else if (name == "h" || name == "help") {
this->Help(); this->Help();
} }
else if (cmd == "pa" || cmd == "pause") { else if (name == "pa" || name == "pause") {
this->Pause(); this->Pause();
} }
else if (cmd == "s" || cmd =="stop") { else if (name == "s" || name =="stop") {
this->Stop(); this->Stop();
} }
else if (name == "sk" || name == "seek") { else if (name == "sk" || name == "seek") {
@ -310,6 +322,6 @@ void ConsoleLayout::ListPlugins() const {
"v" + std::string((*it)->Version()) + "\n" "v" + std::string((*it)->Version()) + "\n"
" by " + std::string((*it)->Author()) + "\n"; " by " + std::string((*it)->Author()) + "\n";
this->output->WriteLine(format, CURSESPP_RED_ON_BLUE); this->output->WriteLine(format, COLOR_PAIR(CURSESPP_TEXT_DEFAULT));
} }
} }

View File

@ -82,12 +82,12 @@ void LogWindow::Update() {
switch (entry->level) { switch (entry->level) {
case musik::debug::level_error: { case musik::debug::level_error: {
attrs = COLOR_PAIR(CURSESPP_TEXT_ERROR) | A_BOLD; attrs = COLOR_PAIR(CURSESPP_TEXT_ERROR);
break; break;
} }
case musik::debug::level_warning: { case musik::debug::level_warning: {
attrs = COLOR_PAIR(CURSESPP_TEXT_WARNING) | A_BOLD; attrs = COLOR_PAIR(CURSESPP_TEXT_WARNING);
break; break;
} }
} }

View File

@ -338,7 +338,7 @@ void TransportWindow::Update() {
system_clock::now().time_since_epoch()).count(); system_clock::now().time_since_epoch()).count();
if (now % 2 == 0) { if (now % 2 == 0) {
timerAttrs = COLOR_PAIR(CURSESPP_BLACK_ON_TRANSPARENT); timerAttrs = COLOR_PAIR(CURSESPP_TEXT_HIDDEN);
} }
} }

View File

@ -98,11 +98,6 @@ void Colors::Init() {
grey = initColor(COLOR_CUSTOM_GREY, 128, 128, 128); grey = initColor(COLOR_CUSTOM_GREY, 128, 128, 128);
} }
init_pair(CURSESPP_BLACK_ON_TRANSPARENT, black, background);
init_pair(CURSESPP_RED_ON_BLUE, red, blue);
init_pair(CURSESPP_BLACK_ON_GREY, black, white);
init_pair(CURSESPP_RED_ON_GREY, red, white);
init_pair(CURSESPP_SELECTED_LIST_ITEM, yellow, selected); init_pair(CURSESPP_SELECTED_LIST_ITEM, yellow, selected);
init_pair(CURSESPP_HIGHLIGHTED_LIST_ITEM, black, green); init_pair(CURSESPP_HIGHLIGHTED_LIST_ITEM, black, green);
init_pair(CURSESPP_HIGHLIGHTED_SELECTED_LIST_ITEM, black, yellow); init_pair(CURSESPP_HIGHLIGHTED_SELECTED_LIST_ITEM, black, yellow);
@ -118,4 +113,5 @@ void Colors::Init() {
init_pair(CURSESPP_TEXT_ACTIVE, green, background); init_pair(CURSESPP_TEXT_ACTIVE, green, background);
init_pair(CURSESPP_TEXT_WARNING, yellow, background); init_pair(CURSESPP_TEXT_WARNING, yellow, background);
init_pair(CURSESPP_TEXT_ERROR, red, background); init_pair(CURSESPP_TEXT_ERROR, red, background);
init_pair(CURSESPP_TEXT_HIDDEN, black, background);
} }

View File

@ -36,26 +36,22 @@
#include "curses_config.h" #include "curses_config.h"
#define CURSESPP_BLACK_ON_TRANSPARENT 1 #define CURSESPP_SELECTED_LIST_ITEM 1
#define CURSESPP_RED_ON_BLUE 2 #define CURSESPP_HIGHLIGHTED_LIST_ITEM 2
#define CURSESPP_BLACK_ON_GREY 3 #define CURSESPP_HIGHLIGHTED_SELECTED_LIST_ITEM 3
#define CURSESPP_RED_ON_GREY 4 #define CURSESPP_LIST_ITEM_HEADER 4
#define CURSESPP_SELECTED_LIST_ITEM 5 #define CURSESPP_DEFAULT_CONTENT_COLOR 5
#define CURSESPP_HIGHLIGHTED_LIST_ITEM 6 #define CURSESPP_DEFAULT_FRAME_COLOR 6
#define CURSESPP_HIGHLIGHTED_SELECTED_LIST_ITEM 7 #define CURSESPP_FOCUSED_FRAME_COLOR 7
#define CURSESPP_LIST_ITEM_HEADER 8
#define CURSESPP_DEFAULT_CONTENT_COLOR 9 #define CURSESPP_TEXT_DEFAULT 8
#define CURSESPP_DEFAULT_FRAME_COLOR 10 #define CURSESPP_TEXT_DISABLED 9
#define CURSESPP_FOCUSED_FRAME_COLOR 11 #define CURSESPP_TEXT_FOCUSED 10
#define CURSESPP_TEXT_ACTIVE 11
#define CURSESPP_TEXT_DEFAULT 12 #define CURSESPP_TEXT_WARNING 12
#define CURSESPP_TEXT_DISABLED 13 #define CURSESPP_TEXT_ERROR 13
#define CURSESPP_TEXT_FOCUSED 14 #define CURSESPP_TEXT_HIDDEN 14
#define CURSESPP_TEXT_ACTIVE 15
#define CURSESPP_TEXT_WARNING 16
#define CURSESPP_TEXT_ERROR 17
namespace cursespp { namespace cursespp {
class Colors { class Colors {