Permalink
Browse files

Initial import.

  • Loading branch information...
hishamhm committed Mar 4, 2006
0 parents commit d6231bab89d634da5564491196b7c478db038505
Showing with 9,306 additions and 0 deletions.
  1. +1 −0 AUTHORS
  2. +72 −0 AvailableColumnsListBox.c
  3. +31 −0 AvailableColumnsListBox.h
  4. +103 −0 AvailableMetersListBox.c
  5. +33 −0 AvailableMetersListBox.h
  6. +339 −0 COPYING
  7. +86 −0 CPUMeter.c
  8. +41 −0 CPUMeter.h
  9. +513 −0 CRT.c
  10. +112 −0 CRT.h
  11. +134 −0 CategoriesListBox.c
  12. +40 −0 CategoriesListBox.h
  13. +219 −0 ChangeLog
  14. +56 −0 CheckItem.c
  15. +33 −0 CheckItem.h
  16. +54 −0 ClockMeter.c
  17. +37 −0 ClockMeter.h
  18. +98 −0 ColorsListBox.c
  19. +32 −0 ColorsListBox.h
  20. +104 −0 ColumnsListBox.c
  21. +32 −0 ColumnsListBox.h
  22. +187 −0 DebugMemory.c
  23. +62 −0 DebugMemory.h
  24. +75 −0 DisplayOptionsListBox.c
  25. +31 −0 DisplayOptionsListBox.h
  26. +131 −0 FunctionBar.c
  27. +47 −0 FunctionBar.h
  28. +140 −0 Hashtable.c
  29. +55 −0 Hashtable.h
  30. +177 −0 Header.c
  31. +62 −0 Header.h
  32. +229 −0 INSTALL
  33. +353 −0 ListBox.c
  34. +101 −0 ListBox.h
  35. +72 −0 ListItem.c
  36. +39 −0 ListItem.h
  37. +71 −0 LoadAverageMeter.c
  38. +37 −0 LoadAverageMeter.h
  39. +63 −0 LoadMeter.c
  40. +34 −0 LoadMeter.h
  41. +29 −0 Makefile.am
  42. +90 −0 MemoryMeter.c
  43. +42 −0 MemoryMeter.h
  44. +350 −0 Meter.c
  45. +94 −0 Meter.h
  46. +106 −0 MetersListBox.c
  47. +30 −0 MetersListBox.h
  48. +5 −0 NEWS
  49. +60 −0 Object.c
  50. +44 −0 Object.h
  51. +427 −0 Process.c
  52. +140 −0 Process.h
  53. +589 −0 ProcessList.c
  54. +124 −0 ProcessList.h
  55. +48 −0 README
  56. +83 −0 RichString.c
  57. +43 −0 RichString.h
  58. +225 −0 ScreenManager.c
  59. +58 −0 ScreenManager.h
  60. +217 −0 Settings.c
  61. +39 −0 Settings.h
  62. +99 −0 SignalItem.c
  63. +41 −0 SignalItem.h
  64. +77 −0 SignalsListBox.c
  65. +32 −0 SignalsListBox.h
  66. +160 −0 String.c
  67. +52 −0 String.h
  68. +65 −0 SwapMeter.c
  69. +40 −0 SwapMeter.h
  70. +56 −0 TasksMeter.c
  71. +35 −0 TasksMeter.h
  72. +164 −0 TraceScreen.c
  73. +37 −0 TraceScreen.h
  74. +257 −0 TypedVector.c
  75. +69 −0 TypedVector.h
  76. +77 −0 UptimeMeter.c
  77. +39 −0 UptimeMeter.h
  78. +56 −0 UsersTable.c
  79. +41 −0 UsersTable.h
  80. +6 −0 autogen.sh
  81. +54 −0 configure.ac
  82. +22 −0 debug.h
  83. +120 −0 htop.1
  84. +663 −0 htop.c
  85. +12 −0 htop.desktop
  86. +53 −0 htop.h
  87. BIN htop.png
@@ -0,0 +1 @@
Hisham H. Muhammad
@@ -0,0 +1,72 @@
#include "AvailableColumnsListBox.h"
#include "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "ColumnsListBox.h"
#include "ListBox.h"
#include "debug.h"
#include <assert.h>
/*{
typedef struct AvailableColumnsListBox_ {
ListBox super;
ListBox* columns;
Settings* settings;
ScreenManager* scr;
} AvailableColumnsListBox;
}*/
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;
this->settings = settings;
this->scr = scr;
super->eventHandler = AvailableColumnsListBox_eventHandler;
ListBox_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));
}
this->columns = columns;
return this;
}
void AvailableColumnsListBox_delete(Object* object) {
ListBox* super = (ListBox*) object;
AvailableColumnsListBox* this = (AvailableColumnsListBox*) object;
ListBox_done(super);
free(this);
}
HandlerResult AvailableColumnsListBox_eventHandler(ListBox* super, int ch) {
AvailableColumnsListBox* this = (AvailableColumnsListBox*) super;
char* text = ((ListItem*) ListBox_getSelected(super))->value;
HandlerResult result = IGNORED;
switch(ch) {
case 13:
case KEY_ENTER:
case KEY_F(5):
{
int at = ListBox_getSelectedIndex(this->columns) + 1;
if (at == ListBox_getSize(this->columns))
at--;
ListBox_insert(this->columns, at, (Object*) ListItem_new(text, 0));
ColumnsListBox_update(this->columns);
result = HANDLED;
break;
}
}
return result;
}
@@ -0,0 +1,31 @@
/* Do not edit this file. It was automatically genarated. */
#ifndef HEADER_AvailableColumnsListBox
#define HEADER_AvailableColumnsListBox
#include "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "ListBox.h"
#include "debug.h"
#include <assert.h>
typedef struct AvailableColumnsListBox_ {
ListBox super;
Settings* settings;
ScreenManager* scr;
ListBox* columns;
} AvailableColumnsListBox;
AvailableColumnsListBox* AvailableColumnsListBox_new(Settings* settings, ListBox* columns, ScreenManager* scr);
void AvailableColumnsListBox_delete(Object* object);
HandlerResult AvailableColumnsListBox_eventHandler(ListBox* super, int ch);
#endif
@@ -0,0 +1,103 @@
#include "AvailableMetersListBox.h"
#include "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "ListBox.h"
#include "debug.h"
#include <assert.h>
/*{
typedef struct AvailableMetersListBox_ {
ListBox super;
Settings* settings;
ListBox* leftBox;
ListBox* rightBox;
ScreenManager* scr;
} AvailableMetersListBox;
}*/
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;
this->settings = settings;
this->leftBox = leftMeters;
this->rightBox = rightMeters;
this->scr = scr;
super->eventHandler = AvailableMetersListBox_EventHandler;
ListBox_setHeader(super, "Available meters");
ListBox_add(super, (Object*) ListItem_new("Swap", 0));
ListBox_add(super, (Object*) ListItem_new("Memory", 0));
ListBox_add(super, (Object*) ListItem_new("Clock", 0));
ListBox_add(super, (Object*) ListItem_new("Load", 0));
ListBox_add(super, (Object*) ListItem_new("LoadAverage", 0));
ListBox_add(super, (Object*) ListItem_new("Uptime", 0));
ListBox_add(super, (Object*) ListItem_new("Tasks", 0));
if (settings->pl->processorCount > 1)
ListBox_add(super, (Object*) ListItem_new("CPUAverage", 0));
for (int i = 1; i <= settings->pl->processorCount; i++) {
char buffer[50];
sprintf(buffer, "CPU(%d)", i);
ListBox_add(super, (Object*) ListItem_new(buffer, 0));
}
return this;
}
void AvailableMetersListBox_delete(Object* object) {
ListBox* super = (ListBox*) object;
AvailableMetersListBox* this = (AvailableMetersListBox*) object;
ListBox_done(super);
free(this);
}
/* private */
inline void AvailableMetersListBox_addHeader(Header* header, ListBox* lb, char* name, HeaderSide side) {
Header_createMeter(header, name, side);
int i = Header_size(header, side) - 1;
Meter* meter = (Meter*) Header_getMeter(header, i, side);
ListBox_add(lb, (Object*) Meter_toListItem(meter));
}
HandlerResult AvailableMetersListBox_EventHandler(ListBox* super, int ch) {
AvailableMetersListBox* this = (AvailableMetersListBox*) super;
Header* header = this->settings->header;
ListItem* selected = (ListItem*) ListBox_getSelected(super);
char* name = selected->value;
HandlerResult result = IGNORED;
switch(ch) {
case KEY_F(5):
case 'l':
case 'L':
{
AvailableMetersListBox_addHeader(header, this->leftBox, name, LEFT_HEADER);
result = HANDLED;
break;
}
case KEY_F(6):
case 'r':
case 'R':
{
AvailableMetersListBox_addHeader(header, this->rightBox, name, RIGHT_HEADER);
result = HANDLED;
break;
}
}
if (result == HANDLED) {
this->settings->changed = true;
Header_calculateHeight(header);
Header_draw(header);
ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2);
}
return result;
}
@@ -0,0 +1,33 @@
/* Do not edit this file. It was automatically genarated. */
#ifndef HEADER_AvailableMetersListBox
#define HEADER_AvailableMetersListBox
#include "Settings.h"
#include "Header.h"
#include "ScreenManager.h"
#include "ListBox.h"
#include "debug.h"
#include <assert.h>
typedef struct AvailableMetersListBox_ {
ListBox super;
Settings* settings;
ListBox* leftBox;
ListBox* rightBox;
ScreenManager* scr;
} AvailableMetersListBox;
AvailableMetersListBox* AvailableMetersListBox_new(Settings* settings, ListBox* leftMeters, ListBox* rightMeters, ScreenManager* scr);
void AvailableMetersListBox_delete(Object* object);
HandlerResult AvailableMetersListBox_EventHandler(ListBox* super, int ch);
#endif
Oops, something went wrong.

0 comments on commit d6231ba

Please sign in to comment.