From ff9409b1737627857eb47f64f536a3f66b6a09a4 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:01:07 +0200 Subject: Imported Upstream version 2.0.0 --- ColorsPanel.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'ColorsPanel.c') diff --git a/ColorsPanel.c b/ColorsPanel.c index 4e28d01..96199c1 100644 --- a/ColorsPanel.c +++ b/ColorsPanel.c @@ -16,7 +16,7 @@ in the source distribution for its full text. // TO ADD A NEW SCHEME: // * Increment the size of bool check in ColorsPanel.h -// * Add the entry in the ColorSchemes array below in the file +// * Add the entry in the ColorSchemeNames array below in the file // * Add a define in CRT.h that matches the order of the array // * Add the colors in CRT_setColors @@ -34,13 +34,16 @@ typedef struct ColorsPanel_ { }*/ -static const char* ColorSchemes[] = { +static const char* ColorsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; + +static const char* ColorSchemeNames[] = { "Default", "Monochromatic", "Black on White", "Light Terminal", "MC", "Black Night", + "Broken Gray", NULL }; @@ -62,8 +65,9 @@ static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) { case 0x0d: case KEY_ENTER: case KEY_MOUSE: + case KEY_RECLICK: case ' ': - for (int i = 0; ColorSchemes[i] != NULL; i++) + for (int i = 0; ColorSchemeNames[i] != NULL; i++) CheckItem_set((CheckItem*)Panel_get(super, i), false); CheckItem_set((CheckItem*)Panel_get(super, mark), true); this->settings->colorScheme = mark; @@ -72,7 +76,7 @@ static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) { if (result == HANDLED) { this->settings->changed = true; - Header* header = this->settings->header; + const Header* header = this->scr->header; CRT_setColors(mark); Panel* menu = (Panel*) Vector_get(this->scr->panels, 0); Header_draw(header); @@ -94,14 +98,15 @@ PanelClass ColorsPanel_class = { ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr) { ColorsPanel* this = AllocThis(ColorsPanel); Panel* super = (Panel*) this; - Panel_init(super, 1, 1, 1, 1, Class(CheckItem), true); + FunctionBar* fuBar = FunctionBar_new(ColorsFunctions, NULL, NULL); + Panel_init(super, 1, 1, 1, 1, Class(CheckItem), true, fuBar); this->settings = settings; this->scr = scr; Panel_setHeader(super, "Colors"); - for (int i = 0; ColorSchemes[i] != NULL; i++) { - Panel_add(super, (Object*) CheckItem_new(strdup(ColorSchemes[i]), NULL, false)); + for (int i = 0; ColorSchemeNames[i] != NULL; i++) { + Panel_add(super, (Object*) CheckItem_newByVal(xStrdup(ColorSchemeNames[i]), false)); } CheckItem_set((CheckItem*)Panel_get(super, settings->colorScheme), true); return this; -- cgit v1.2.3