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 --- DisplayOptionsPanel.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'DisplayOptionsPanel.c') diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c index 6153313..0a32c44 100644 --- a/DisplayOptionsPanel.c +++ b/DisplayOptionsPanel.c @@ -8,6 +8,7 @@ in the source distribution for its full text. #include "DisplayOptionsPanel.h" #include "CheckItem.h" +#include "CRT.h" #include #include @@ -27,6 +28,8 @@ typedef struct DisplayOptionsPanel_ { }*/ +static const char* DisplayOptionsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; + static void DisplayOptionsPanel_delete(Object* object) { Panel* super = (Panel*) object; DisplayOptionsPanel* this = (DisplayOptionsPanel*) object; @@ -45,6 +48,7 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) { case 0x0d: case KEY_ENTER: case KEY_MOUSE: + case KEY_RECLICK: case ' ': CheckItem_set(selected, ! (CheckItem_get(selected)) ); result = HANDLED; @@ -52,9 +56,9 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) { if (result == HANDLED) { this->settings->changed = true; - Header* header = this->settings->header; - Header_calculateHeight(header); - Header_reinit(header); + const Header* header = this->scr->header; + Header_calculateHeight((Header*) header); + Header_reinit((Header*) header); Header_draw(header); ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2); } @@ -72,24 +76,26 @@ PanelClass DisplayOptionsPanel_class = { DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager* scr) { DisplayOptionsPanel* this = AllocThis(DisplayOptionsPanel); Panel* super = (Panel*) this; - Panel_init(super, 1, 1, 1, 1, Class(CheckItem), true); + FunctionBar* fuBar = FunctionBar_new(DisplayOptionsFunctions, NULL, NULL); + Panel_init(super, 1, 1, 1, 1, Class(CheckItem), true, fuBar); this->settings = settings; this->scr = scr; Panel_setHeader(super, "Display options"); - Panel_add(super, (Object*) CheckItem_new(strdup("Tree view"), &(settings->pl->treeView), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Shadow other users' processes"), &(settings->pl->shadowOtherUsers), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Hide kernel threads"), &(settings->pl->hideKernelThreads), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Hide userland threads"), &(settings->pl->hideUserlandThreads), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Display threads in a different color"), &(settings->pl->highlightThreads), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Show custom thread names"), &(settings->pl->showThreadNames), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Highlight program \"basename\""), &(settings->pl->highlightBaseName), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Highlight large numbers in memory counters"), &(settings->pl->highlightMegabytes), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Leave a margin around header"), &(settings->header->margin), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest)"), &(settings->pl->detailedCPUTime), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Count CPUs from 0 instead of 1"), &(settings->pl->countCPUsFromZero), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Update process names on every refresh"), &(settings->pl->updateProcessNames), false)); - Panel_add(super, (Object*) CheckItem_new(strdup("Add guest time in CPU meter percentage"), &(settings->pl->accountGuestInCPUMeter), false)); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Tree view"), &(settings->treeView))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Shadow other users' processes"), &(settings->shadowOtherUsers))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Hide kernel threads"), &(settings->hideKernelThreads))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Hide userland process threads"), &(settings->hideUserlandThreads))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Display threads in a different color"), &(settings->highlightThreads))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Show custom thread names"), &(settings->showThreadNames))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Show program path"), &(settings->showProgramPath))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Highlight program \"basename\""), &(settings->highlightBaseName))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Highlight large numbers in memory counters"), &(settings->highlightMegabytes))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Leave a margin around header"), &(settings->headerMargin))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest)"), &(settings->detailedCPUTime))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Count CPUs from 0 instead of 1"), &(settings->countCPUsFromZero))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Update process names on every refresh"), &(settings->updateProcessNames))); + Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Add guest time in CPU meter percentage"), &(settings->accountGuestInCPUMeter))); return this; } -- cgit v1.2.3