diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:01:07 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:01:07 +0200 |
commit | ff9409b1737627857eb47f64f536a3f66b6a09a4 (patch) | |
tree | 61b631ba551e68a4f656b8b76ff7bd0d9955fc64 /ColorsPanel.c | |
parent | f75ab6d2c11e8a8e18191b087564aedebbeb96c5 (diff) | |
download | debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.tar.gz debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.tar.bz2 debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.zip |
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'ColorsPanel.c')
-rw-r--r-- | ColorsPanel.c | 19 |
1 files changed, 12 insertions, 7 deletions
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; |