diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2006-05-30 13:47:28 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2006-05-30 13:47:28 +0000 |
commit | c2cdcd0c1d2950291243b3a8645b5f061a0cdb2a (patch) | |
tree | 390297160c9caa342217d481406c68343785b5f9 | |
parent | a853faaa2d2d0321da0ff6f51be656fc40cf8663 (diff) |
Rename ListBox to Panel, matching dit.
-rw-r--r-- | AvailableColumnsListBox.c | 52 | ||||
-rw-r--r-- | AvailableColumnsListBox.h | 20 | ||||
-rw-r--r-- | AvailableMetersListBox.c | 58 | ||||
-rw-r--r-- | AvailableMetersListBox.h | 22 | ||||
-rw-r--r-- | CategoriesListBox.c | 92 | ||||
-rw-r--r-- | CategoriesListBox.h | 32 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | ColorsListBox.c | 44 | ||||
-rw-r--r-- | ColorsListBox.h | 18 | ||||
-rw-r--r-- | ColumnsListBox.c | 56 | ||||
-rw-r--r-- | ColumnsListBox.h | 20 | ||||
-rw-r--r-- | DisplayOptionsListBox.c | 52 | ||||
-rw-r--r-- | DisplayOptionsListBox.h | 18 | ||||
-rw-r--r-- | ListBox.h | 101 | ||||
-rw-r--r-- | Makefile.am | 24 | ||||
-rw-r--r-- | MetersListBox.c | 48 | ||||
-rw-r--r-- | MetersListBox.h | 18 | ||||
-rw-r--r-- | Panel.c (renamed from ListBox.c) | 78 | ||||
-rw-r--r-- | Panel.h | 101 | ||||
-rw-r--r-- | ScreenManager.c | 52 | ||||
-rw-r--r-- | ScreenManager.h | 8 | ||||
-rw-r--r-- | SignalsListBox.c | 52 | ||||
-rw-r--r-- | SignalsListBox.h | 20 | ||||
-rw-r--r-- | TraceScreen.c | 32 | ||||
-rw-r--r-- | TraceScreen.h | 4 | ||||
-rw-r--r-- | htop.c | 128 | ||||
-rw-r--r-- | htop.h | 6 |
27 files changed, 579 insertions, 579 deletions
diff --git a/AvailableColumnsListBox.c b/AvailableColumnsListBox.c index f4f91372..237be694 100644 --- a/AvailableColumnsListBox.c +++ b/AvailableColumnsListBox.c @@ -1,57 +1,57 @@ -#include "AvailableColumnsListBox.h" +#include "AvailableColumnsPanel.h" #include "Settings.h" #include "Header.h" #include "ScreenManager.h" -#include "ColumnsListBox.h" +#include "ColumnsPanel.h" -#include "ListBox.h" +#include "Panel.h" #include "debug.h" #include <assert.h> /*{ -typedef struct AvailableColumnsListBox_ { - ListBox super; - ListBox* columns; +typedef struct AvailableColumnsPanel_ { + Panel super; + Panel* columns; Settings* settings; ScreenManager* scr; -} AvailableColumnsListBox; +} AvailableColumnsPanel; }*/ -AvailableColumnsListBox* AvailableColumnsListBox_new(Settings* settings, ListBox* columns, ScreenManager* scr) { - AvailableColumnsListBox* this = (AvailableColumnsListBox*) malloc(sizeof(AvailableColumnsListBox)); - ListBox* super = (ListBox*) this; - ListBox_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); - ((Object*)this)->delete = AvailableColumnsListBox_delete; +AvailableColumnsPanel* AvailableColumnsPanel_new(Settings* settings, Panel* columns, ScreenManager* scr) { + AvailableColumnsPanel* this = (AvailableColumnsPanel*) malloc(sizeof(AvailableColumnsPanel)); + Panel* super = (Panel*) this; + Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); + ((Object*)this)->delete = AvailableColumnsPanel_delete; this->settings = settings; this->scr = scr; - super->eventHandler = AvailableColumnsListBox_eventHandler; + super->eventHandler = AvailableColumnsPanel_eventHandler; - ListBox_setHeader(super, "Available Columns"); + Panel_setHeader(super, "Available Columns"); for (int i = 1; i < LAST_PROCESSFIELD; i++) { if (i != COMM) - ListBox_add(super, (Object*) ListItem_new(Process_fieldNames[i], 0)); + Panel_add(super, (Object*) ListItem_new(Process_fieldNames[i], 0)); } this->columns = columns; return this; } -void AvailableColumnsListBox_delete(Object* object) { - ListBox* super = (ListBox*) object; - AvailableColumnsListBox* this = (AvailableColumnsListBox*) object; - ListBox_done(super); +void AvailableColumnsPanel_delete(Object* object) { + Panel* super = (Panel*) object; + AvailableColumnsPanel* this = (AvailableColumnsPanel*) object; + Panel_done(super); free(this); } -HandlerResult AvailableColumnsListBox_eventHandler(ListBox* super, int ch) { - AvailableColumnsListBox* this = (AvailableColumnsListBox*) super; - char* text = ((ListItem*) ListBox_getSelected(super))->value; +HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch) { + AvailableColumnsPanel* this = (AvailableColumnsPanel*) super; + char* text = ((ListItem*) Panel_getSelected(super))->value; HandlerResult result = IGNORED; switch(ch) { @@ -59,11 +59,11 @@ HandlerResult AvailableColumnsListBox_eventHandler(ListBox* super, int ch) { case KEY_ENTER: case KEY_F(5): { - int at = ListBox_getSelectedIndex(this->columns) + 1; - if (at == ListBox_getSize(this->columns)) + int at = Panel_getSelectedIndex(this->columns) + 1; + if (at == Panel_getSize(this->columns)) at--; - ListBox_insert(this->columns, at, (Object*) ListItem_new(text, 0)); - ColumnsListBox_update(this->columns); + Panel_insert(this->columns, at, (Object*) ListItem_new(text, 0)); + ColumnsPanel_update(this->columns); result = HANDLED; break; } diff --git a/AvailableColumnsListBox.h b/AvailableColumnsListBox.h index d771e201..4c03fa1d 100644 --- a/AvailableColumnsListBox.h +++ b/AvailableColumnsListBox.h @@ -1,31 +1,31 @@ /* Do not edit this file. It was automatically genarated. */ -#ifndef HEADER_AvailableColumnsListBox -#define HEADER_AvailableColumnsListBox +#ifndef HEADER_AvailableColumnsPanel +#define HEADER_AvailableColumnsPanel #include "Settings.h" #include "Header.h" #include "ScreenManager.h" -#include "ListBox.h" +#include "Panel.h" #include "debug.h" #include <assert.h> -typedef struct AvailableColumnsListBox_ { - ListBox super; +typedef struct AvailableColumnsPanel_ { + Panel super; Settings* settings; ScreenManager* scr; - ListBox* columns; -} AvailableColumnsListBox; + Panel* columns; +} AvailableColumnsPanel; -AvailableColumnsListBox* AvailableColumnsListBox_new(Settings* settings, ListBox* columns, ScreenManager* scr); +AvailableColumnsPanel* AvailableColumnsPanel_new(Settings* settings, Panel* columns, ScreenManager* scr); -void AvailableColumnsListBox_delete(Object* object); +void AvailableColumnsPanel_delete(Object* object); -HandlerResult AvailableColumnsListBox_eventHandler(ListBox* super, int ch); +HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch); #endif diff --git a/AvailableMetersListBox.c b/AvailableMetersListBox.c index 88011bab..0642ccaa 100644 --- a/AvailableMetersListBox.c +++ b/AvailableMetersListBox.c @@ -1,79 +1,79 @@ -#include "AvailableMetersListBox.h" +#include "AvailableMetersPanel.h" #include "Settings.h" #include "Header.h" #include "ScreenManager.h" -#include "ListBox.h" +#include "Panel.h" #include "debug.h" #include <assert.h> /*{ -typedef struct AvailableMetersListBox_ { - ListBox super; +typedef struct AvailableMetersPanel_ { + Panel super; Settings* settings; - ListBox* leftBox; - ListBox* rightBox; + Panel* leftBox; + Panel* rightBox; ScreenManager* scr; -} AvailableMetersListBox; +} AvailableMetersPanel; }*/ -AvailableMetersListBox* AvailableMetersListBox_new(Settings* settings, ListBox* leftMeters, ListBox* rightMeters, ScreenManager* scr) { - AvailableMetersListBox* this = (AvailableMetersListBox*) malloc(sizeof(AvailableMetersListBox)); - ListBox* super = (ListBox*) this; - ListBox_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); - ((Object*)this)->delete = AvailableMetersListBox_delete; +AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Panel* leftMeters, Panel* rightMeters, ScreenManager* scr) { + AvailableMetersPanel* this = (AvailableMetersPanel*) malloc(sizeof(AvailableMetersPanel)); + Panel* super = (Panel*) this; + Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); + ((Object*)this)->delete = AvailableMetersPanel_delete; this->settings = settings; this->leftBox = leftMeters; this->rightBox = rightMeters; this->scr = scr; - super->eventHandler = AvailableMetersListBox_EventHandler; + super->eventHandler = AvailableMetersPanel_EventHandler; - ListBox_setHeader(super, "Available meters"); + Panel_setHeader(super, "Available meters"); for (int i = 1; Meter_types[i]; i++) { MeterType* type = Meter_types[i]; if (type != &CPUMeter) { - ListBox_add(super, (Object*) ListItem_new(type->uiName, i << 16)); + Panel_add(super, (Object*) ListItem_new(type->uiName, i << 16)); } } MeterType* type = &CPUMeter; int processors = settings->pl->processorCount; if (processors > 1) { - ListBox_add(super, (Object*) ListItem_new("CPU average", 0)); + Panel_add(super, (Object*) ListItem_new("CPU average", 0)); for (int i = 1; i <= processors; i++) { char buffer[50]; sprintf(buffer, "%s %d", type->uiName, i); - ListBox_add(super, (Object*) ListItem_new(buffer, i)); + Panel_add(super, (Object*) ListItem_new(buffer, i)); } } else { - ListBox_add(super, (Object*) ListItem_new("CPU", 1)); + Panel_add(super, (Object*) ListItem_new("CPU", 1)); } return this; } -void AvailableMetersListBox_delete(Object* object) { - ListBox* super = (ListBox*) object; - AvailableMetersListBox* this = (AvailableMetersListBox*) object; - ListBox_done(super); +void AvailableMetersPanel_delete(Object* object) { + Panel* super = (Panel*) object; + AvailableMetersPanel* this = (AvailableMetersPanel*) object; + Panel_done(super); free(this); } /* private */ -inline void AvailableMetersListBox_addHeader(Header* header, ListBox* lb, MeterType* type, int param, HeaderSide side) { +inline void AvailableMetersPanel_addHeader(Header* header, Panel* lb, MeterType* type, int param, HeaderSide side) { Meter* meter = (Meter*) Header_addMeter(header, type, param, side); - ListBox_add(lb, (Object*) Meter_toListItem(meter)); + Panel_add(lb, (Object*) Meter_toListItem(meter)); } -HandlerResult AvailableMetersListBox_EventHandler(ListBox* super, int ch) { - AvailableMetersListBox* this = (AvailableMetersListBox*) super; +HandlerResult AvailableMetersPanel_EventHandler(Panel* super, int ch) { + AvailableMetersPanel* this = (AvailableMetersPanel*) super; Header* header = this->settings->header; - ListItem* selected = (ListItem*) ListBox_getSelected(super); + ListItem* selected = (ListItem*) Panel_getSelected(super); int param = selected->key & 0xff; int type = selected->key >> 16; HandlerResult result = IGNORED; @@ -83,7 +83,7 @@ HandlerResult AvailableMetersListBox_EventHandler(ListBox* super, int ch) { case 'l': case 'L': { - AvailableMetersListBox_addHeader(header, this->leftBox, Meter_types[type], param, LEFT_HEADER); + AvailableMetersPanel_addHeader(header, this->leftBox, Meter_types[type], param, LEFT_HEADER); result = HANDLED; break; } @@ -91,7 +91,7 @@ HandlerResult AvailableMetersListBox_EventHandler(ListBox* super, int ch) { case 'r': case 'R': { - AvailableMetersListBox_addHeader(header, this->rightBox, Meter_types[type], param, RIGHT_HEADER); + AvailableMetersPanel_addHeader(header, this->rightBox, Meter_types[type], param, RIGHT_HEADER); result = HANDLED; break; } diff --git a/AvailableMetersListBox.h b/AvailableMetersListBox.h index be6da95b..69116d87 100644 --- a/AvailableMetersListBox.h +++ b/AvailableMetersListBox.h @@ -1,33 +1,33 @@ /* Do not edit this file. It was automatically genarated. */ -#ifndef HEADER_AvailableMetersListBox -#define HEADER_AvailableMetersListBox +#ifndef HEADER_AvailableMetersPanel +#define HEADER_AvailableMetersPanel #include "Settings.h" #include "Header.h" #include "ScreenManager.h" -#include "ListBox.h" +#include "Panel.h" #include "debug.h" #include <assert.h> -typedef struct AvailableMetersListBox_ { - ListBox super; +typedef struct AvailableMetersPanel_ { + Panel super; Settings* settings; - ListBox* leftBox; - ListBox* rightBox; + Panel* leftBox; + Panel* rightBox; ScreenManager* scr; -} AvailableMetersListBox; +} AvailableMetersPanel; -AvailableMetersListBox* AvailableMetersListBox_new(Settings* settings, ListBox* leftMeters, ListBox* rightMeters, ScreenManager* scr); +AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Panel* leftMeters, Panel* rightMeters, ScreenManager* scr); -void AvailableMetersListBox_delete(Object* object); +void AvailableMetersPanel_delete(Object* object); -HandlerResult AvailableMetersListBox_EventHandler(ListBox* super, int ch); +HandlerResult AvailableMetersPanel_EventHandler(Panel* super, int ch); #endif diff --git a/CategoriesListBox.c b/CategoriesListBox.c index e846a572..2fc807f3 100644 --- a/CategoriesListBox.c +++ b/CategoriesListBox.c @@ -1,25 +1,25 @@ -#include "CategoriesListBox.h" -#include "AvailableMetersListBox.h" -#include "MetersListBox.h" -#include "DisplayOptionsListBox.h" -#include "ColumnsListBox.h" -#include "ColorsListBox.h" -#include "AvailableColumnsListBox.h" +#include "CategoriesPanel.h" +#include "AvailableMetersPanel.h" +#include "MetersPanel.h" +#include "DisplayOptionsPanel.h" +#include "ColumnsPanel.h" +#include "ColorsPanel.h" +#include "AvailableColumnsPanel.h" -#include "ListBox.h" +#include "Panel.h" #include "debug.h" #include <assert.h> /*{ -typedef struct CategoriesListBox_ { - ListBox super; +typedef struct CategoriesPanel_ { + Panel super; Settings* settings; ScreenManager* scr; -} CategoriesListBox; +} CategoriesPanel; }*/ @@ -41,36 +41,36 @@ char* ColorsFunctions[10] = {" ", " ", " ", " ", " ", " /* private property */ char* AvailableColumnsFunctions[10] = {" ", " ", " ", " ", "Add ", " ", " ", " ", " ", "Done "}; -CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr) { - CategoriesListBox* this = (CategoriesListBox*) malloc(sizeof(CategoriesListBox)); - ListBox* super = (ListBox*) this; - ListBox_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); - ((Object*)this)->delete = CategoriesListBox_delete; +CategoriesPanel* CategoriesPanel_new(Settings* settings, ScreenManager* scr) { + CategoriesPanel* this = (CategoriesPanel*) malloc(sizeof(CategoriesPanel)); + Panel* super = (Panel*) this; + Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); + ((Object*)this)->delete = CategoriesPanel_delete; this->settings = settings; this->scr = scr; - super->eventHandler = CategoriesListBox_eventHandler; - ListBox_setHeader(super, "Setup"); - ListBox_add(super, (Object*) ListItem_new("Meters", 0)); - ListBox_add(super, (Object*) ListItem_new("Display options", 0)); - ListBox_add(super, (Object*) ListItem_new("Colors", 0)); - ListBox_add(super, (Object*) ListItem_new("Columns", 0)); + super->eventHandler = CategoriesPanel_eventHandler; + Panel_setHeader(super, "Setup"); + Panel_add(super, (Object*) ListItem_new("Meters", 0)); + Panel_add(super, (Object*) ListItem_new("Display options", 0)); + Panel_add(super, (Object*) ListItem_new("Colors", 0)); + Panel_add(super, (Object*) ListItem_new("Columns", 0)); return this; } -void CategoriesListBox_delete(Object* object) { - ListBox* super = (ListBox*) object; - CategoriesListBox* this = (CategoriesListBox*) object; - ListBox_done(super); +void CategoriesPanel_delete(Object* object) { + Panel* super = (Panel*) object; + CategoriesPanel* this = (CategoriesPanel*) object; + Panel_done(super); free(this); } -HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) { - CategoriesListBox* this = (CategoriesListBox*) super; +HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) { + CategoriesPanel* this = (CategoriesPanel*) super; HandlerResult result = IGNORED; - int previous = ListBox_getSelectedIndex(super); + int previous = Panel_getSelectedIndex(super); switch (ch) { case KEY_UP: @@ -79,24 +79,24 @@ HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) { case KEY_PPAGE: case KEY_HOME: case KEY_END: { - ListBox_onKey(super, ch); - int selected = ListBox_getSelectedIndex(super); + Panel_onKey(super, ch); + int selected = Panel_getSelectedIndex(super); if (previous != selected) { int size = ScreenManager_size(this->scr); for (int i = 1; i < size; i++) ScreenManager_remove(this->scr, 1); switch (selected) { case 0: - CategoriesListBox_makeMetersPage(this); + CategoriesPanel_makeMetersPage(this); break; case 1: - CategoriesListBox_makeDisplayOptionsPage(this); + CategoriesPanel_makeDisplayOptionsPage(this); break; case 2: - CategoriesListBox_makeColorsPage(this); + CategoriesPanel_makeColorsPage(this); break; case 3: - CategoriesListBox_makeColumnsPage(this); + CategoriesPanel_makeColumnsPage(this); break; } } @@ -107,28 +107,28 @@ HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) { return result; } -void CategoriesListBox_makeMetersPage(CategoriesListBox* this) { - ListBox* lbLeftMeters = (ListBox*) MetersListBox_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr); - ListBox* lbRightMeters = (ListBox*) MetersListBox_new(this->settings, "Right column", this->settings->header->rightMeters, this->scr); - ListBox* lbAvailableMeters = (ListBox*) AvailableMetersListBox_new(this->settings, lbLeftMeters, lbRightMeters, this->scr); +void CategoriesPanel_makeMetersPage(CategoriesPanel* this) { + Panel* lbLeftMeters = (Panel*) MetersPanel_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr); + Panel* lbRightMeters = (Panel*) MetersPanel_new(this->settings, "Right column", this->settings->header->rightMeters, this->scr); + Panel* lbAvailableMeters = (Panel*) AvailableMetersPanel_new(this->settings, lbLeftMeters, lbRightMeters, this->scr); ScreenManager_add(this->scr, lbLeftMeters, FunctionBar_new(10, MetersFunctions, NULL, NULL), 20); ScreenManager_add(this->scr, lbRightMeters, FunctionBar_new(10, MetersFunctions, NULL, NULL), 20); ScreenManager_add(this->scr, lbAvailableMeters, FunctionBar_new(10, AvailableMetersFunctions, NULL, NULL), -1); } -void CategoriesListBox_makeDisplayOptionsPage(CategoriesListBox* this) { - ListBox* lbDisplayOptions = (ListBox*) DisplayOptionsListBox_new(this->settings, this->scr); +void CategoriesPanel_makeDisplayOptionsPage(CategoriesPanel* this) { + Panel* lbDisplayOptions = (Panel*) DisplayOptionsPanel_new(this->settings, this->scr); ScreenManager_add(this->scr, lbDisplayOptions, FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL), -1); } -void CategoriesListBox_makeColorsPage(CategoriesListBox* this) { - ListBox* lbColors = (ListBox*) ColorsListBox_new(this->settings, this->scr); +void CategoriesPanel_makeColorsPage(CategoriesPanel* this) { + Panel* lbColors = (Panel*) ColorsPanel_new(this->settings, this->scr); ScreenManager_add(this->scr, lbColors, FunctionBar_new(10, ColorsFunctions, NULL, NULL), -1); } -void CategoriesListBox_makeColumnsPage(CategoriesListBox* this) { - ListBox* lbColumns = (ListBox*) ColumnsListBox_new(this->settings, this->scr); - ListBox* lbAvailableColumns = (ListBox*) AvailableColumnsListBox_new(this->settings, lbColumns, this->scr); +void CategoriesPanel_makeColumnsPage(CategoriesPanel* this) { + Panel* lbColumns = (Panel*) ColumnsPanel_new(this->settings, this->scr); + Panel* lbAvailableColumns = (Panel*) AvailableColumnsPanel_new(this->settings, lbColumns, this->scr); ScreenManager_add(this->scr, lbColumns, FunctionBar_new(10, ColumnsFunctions, NULL, NULL), 20); ScreenManager_add(this->scr, lbAvailableColumns, FunctionBar_new(10, AvailableColumnsFunctions, NULL, NULL), -1); } diff --git a/CategoriesListBox.h b/CategoriesListBox.h index 60b13b44..5a4fbf18 100644 --- a/CategoriesListBox.h +++ b/CategoriesListBox.h @@ -1,40 +1,40 @@ /* Do not edit this file. It was automatically genarated. */ -#ifndef HEADER_CategoriesListBox -#define HEADER_CategoriesListBox +#ifndef HEADER_CategoriesPanel +#define HEADER_CategoriesPanel -#include "AvailableMetersListBox.h" -#include "MetersListBox.h" -#include "DisplayOptionsListBox.h" +#include "AvailableMetersPanel.h" +#include "MetersPanel.h" +#include "DisplayOptionsPanel.h" -#include "ListBox.h" +#include "Panel.h" #include "debug.h" #include <assert.h> -typedef struct CategoriesListBox_ { - ListBox super; +typedef struct CategoriesPanel_ { + Panel super; Settings* settings; ScreenManager* scr; -} CategoriesListBox; +} CategoriesPanel; -CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr); +CategoriesPanel* CategoriesPanel_new(Settings* settings, ScreenManager* scr); -void CategoriesListBox_delete(Object* object); +void CategoriesPanel_delete(Object* object); -HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch); +HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch); -void CategoriesListBox_makeMetersPage(CategoriesListBox* this); +void CategoriesPanel_makeMetersPage(CategoriesPanel* this); -void CategoriesListBox_makeDisplayOptionsPage(CategoriesListBox* this); +void CategoriesPanel_makeDisplayOptionsPage(CategoriesPanel* this); -void CategoriesListBox_makeColorsPage(CategoriesListBox* this); +void CategoriesPanel_makeColorsPage(CategoriesPanel* this); -void CategoriesListBox_makeColumnsPage(CategoriesListBox* this); +void CategoriesPanel_makeColumnsPage(CategoriesPanel* this); #endif @@ -137,7 +137,7 @@ What's new in version 0.4 * Clock and load average meters (thanks to Marc Calahan) * BUGFIX: numeric swap indicator was printing bogus value -* BUGFIX: internal fixes on ListBox widget +* BUGFIX: internal fixes on Panel widget * Clear the bottom line when exiting * Press "F3" during search to walk through the results * Improved navigation on column configuration screen diff --git a/ColorsListBox.c b/ColorsListBox.c index adeee7a2..664c04bc 100644 --- a/ColorsListBox.c +++ b/ColorsListBox.c @@ -1,8 +1,8 @@ #include "CRT.h" -#include "ColorsListBox.h" +#include "ColorsPanel.h" -#include "ListBox.h" +#include "Panel.h" #include "CheckItem.h" #include "Settings.h" #include "ScreenManager.h" @@ -11,20 +11,20 @@ #include <assert.h> // TO ADD A NEW SCHEME: -// * Increment the size of bool check in ColorsListBox.h +// * Increment the size of bool check in ColorsPanel.h // * Add the entry in the ColorSchemes array below in the file // * Add a define in CRT.h that matches the order of the array // * Add the colors in CRT_setColors /*{ -typedef struct ColorsListBox_ { - ListBox super; +typedef struct ColorsPanel_ { + Panel super; Settings* settings; ScreenManager* scr; bool check[5]; -} ColorsListBox; +} ColorsPanel; }*/ @@ -39,37 +39,37 @@ static char* ColorSchemes[] = { NULL }; -ColorsListBox* ColorsListBox_new(Settings* settings, ScreenManager* scr) { - ColorsListBox* this = (ColorsListBox*) malloc(sizeof(ColorsListBox)); - ListBox* super = (ListBox*) this; - ListBox_init(super, 1, 1, 1, 1, CHECKITEM_CLASS, true); - ((Object*)this)->delete = ColorsListBox_delete; +ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr) { + ColorsPanel* this = (ColorsPanel*) malloc(sizeof(ColorsPanel)); + Panel* super = (Panel*) this; + Panel_init(super, 1, 1, 1, 1, CHECKITEM_CLASS, true); + ((Object*)this)->delete = ColorsPanel_delete; this->settings = settings; this->scr = scr; - super->eventHandler = ColorsListBox_EventHandler; + super->eventHandler = ColorsPanel_EventHandler; - ListBox_setHeader(super, "Colors"); + Panel_setHeader(super, "Colors"); for (int i = 0; ColorSchemes[i] != NULL; i++) { - ListBox_add(super, (Object*) CheckItem_new(String_copy(ColorSchemes[i]), &(this->check[i]))); + Panel_add(super, (Object*) CheckItem_new(String_copy(ColorSchemes[i]), &(this->check[i]))); this->check[i] = false; } this->check[settings->colorScheme] = true; return this; } -void ColorsListBox_delete(Object* object) { - ListBox* super = (ListBox*) object; - ColorsListBox* this = (ColorsListBox*) object; - ListBox_done(super); +void ColorsPanel_delete(Object* object) { + Panel* super = (Panel*) object; + ColorsPanel* this = (ColorsPanel*) object; + Panel_done(super); free(this); } -HandlerResult ColorsListBox_EventHandler(ListBox* super, int ch) { - ColorsListBox* this = (ColorsListBox*) super; +HandlerResult ColorsPanel_EventHandler(Panel* super, int ch) { + ColorsPanel* this = (ColorsPanel*) super; HandlerResult result = IGNORED; - int mark = ListBox_getSelectedIndex(super); + int mark = Panel_getSelectedIndex(super); switch(ch) { case 0x0a: @@ -88,7 +88,7 @@ HandlerResult ColorsListBox_EventHandler(ListBox* super, int ch) { this->settings->changed = true; Header* header = this->settings->header; CRT_setColors(mark); - ListBox* lbMenu = (ListBox*) Vector_get(this->scr->items, 0); + Panel* lbMenu = (Panel*) Vector_get(this->scr->items, 0); Header_draw(header); RichString_setAttr(&(super->header), CRT_colors[PANEL_HEADER_FOCUS]); RichString_setAttr(&(lbMenu->header), CRT_colors[PANEL_HEADER_UNFOCUS]); diff --git a/ColorsListBox.h b/ColorsListBox.h index 25b56534..e8adcb5b 100644 --- a/ColorsListBox.h +++ b/ColorsListBox.h @@ -1,10 +1,10 @@ /* Do not edit this file. It was automatically genarated. */ -#ifndef HEADER_ColorsListBox -#define HEADER_ColorsListBox +#ifndef HEADER_ColorsPanel +#define HEADER_ColorsPanel -#include "ListBox.h" +#include "Panel.h" #include "CheckItem.h" #include "Settings.h" #include "ScreenManager.h" @@ -13,20 +13,20 @@ #include <assert.h> -typedef struct ColorsListBox_ { - ListBox super; +typedef struct ColorsPanel_ { + Panel super; Settings* settings; ScreenManager* scr; bool check[5]; -} ColorsListBox; +} ColorsPanel; -ColorsListBox* ColorsListBox_new(Settings* settings, ScreenManager* scr); +ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr); -void ColorsListBox_delete(Object* object); +void ColorsPanel_delete(Object* object); -HandlerResult ColorsListBox_EventHandler(ListBox* super, int ch); +HandlerResult ColorsPanel_EventHandler(Panel* super, int ch); #endif diff --git a/ColumnsListBox.c b/ColumnsListBox.c index d3d02eed..8d3dd458 100644 --- a/ColumnsListBox.c +++ b/ColumnsListBox.c @@ -1,7 +1,7 @@ -#include "ColumnsListBox.h" +#include "ColumnsPanel.h" -#include "ListBox.h" +#include "Panel.h" #include "Settings.h" #include "ScreenManager.h" @@ -10,49 +10,49 @@ /*{ -typedef struct ColumnsListBox_ { - ListBox super; +typedef struct ColumnsPanel_ { + Panel super; Settings* settings; ScreenManager* scr; -} ColumnsListBox; +} ColumnsPanel; }*/ -ColumnsListBox* ColumnsListBox_new(Settings* settings, ScreenManager* scr) { - ColumnsListBox* this = (ColumnsListBox*) malloc(sizeof(ColumnsListBox)); - ListBox* super = (ListBox*) this; - ListBox_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); - ((Object*)this)->delete = ColumnsListBox_delete; +ColumnsPanel* ColumnsPanel_new(Settings* settings, ScreenManager* scr) { + ColumnsPanel* this = (ColumnsPanel*) malloc(sizeof(ColumnsPanel)); + Panel* super = (Panel*) this; + Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); + ((Object*)this)->delete = ColumnsPanel_delete; this->settings = settings; this->scr = scr; - super->eventHandler = ColumnsListBox_eventHandler; - ListBox_setHeader(super, "Active Columns"); + super->eventHandler = ColumnsPanel_eventHandler; + Panel_setHeader(super, "Active Columns"); ProcessField* fields = this->settings->pl->fields; for (; *fields; fields++) { - ListBox_add(super, (Object*) ListItem_new(Process_fieldNames[*fields], 0)); + Panel_add(super, (Object*) ListItem_new(Process_fieldNames[*fields], 0)); } return this; } -void ColumnsListBox_delete(Object* object) { - ListBox* super = (ListBox*) object; - ColumnsListBox* this = (ColumnsListBox*) object; - ListBox_done(super); +void ColumnsPanel_delete(Object* object) { + Panel* super = (Panel*) object; + ColumnsPanel* this = (ColumnsPanel*) object; + Panel_done(super); free(this); } -void ColumnsListBox_update(ListBox* super) { - ColumnsListBox* this = (ColumnsListBox*) super; - int size = ListBox_getSize(super); +void ColumnsPanel_update(Panel* super) { + ColumnsPanel* this = (ColumnsPanel*) super; + int size = Panel_getSize(super); this->settings->changed = true; // FIXME: this is crappily inefficient free(this->settings->pl->fields); this->settings->pl->fields = (ProcessField*) malloc(sizeof(ProcessField) * (size+1)); for (int i = 0; i < size; i++) { - char* text = ((ListItem*) ListBox_get(super, i))->value; + char* text = ((ListItem*) Panel_get(super, i))->value; for (int j = 1; j <= LAST_PROCESSFIELD; j++) { if (String_eq(text, Process_fieldNames[j])) { this->settings->pl->fields[i] = j; @@ -63,11 +63,11 @@ void ColumnsListBox_update(ListBox* super) { this->settings->pl->fields[size] = 0; } -HandlerResult ColumnsListBox_eventHandler(ListBox* super, int ch) { +HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { - int selected = ListBox_getSelectedIndex(super); + int selected = Panel_getSelectedIndex(super); HandlerResult result = IGNORED; - int size = ListBox_getSize(super); + int size = Panel_getSize(super); switch(ch) { case KEY_F(7): @@ -75,7 +7 |