mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Rename ListBox to Panel, matching dit.
This commit is contained in:
@ -18,14 +18,14 @@ in the source distribution for its full text.
|
||||
#include "ProcessList.h"
|
||||
#include "Process.h"
|
||||
#include "ListItem.h"
|
||||
#include "ListBox.h"
|
||||
#include "Panel.h"
|
||||
#include "FunctionBar.h"
|
||||
|
||||
/*{
|
||||
|
||||
typedef struct TraceScreen_ {
|
||||
Process* process;
|
||||
ListBox* display;
|
||||
Panel* display;
|
||||
FunctionBar* bar;
|
||||
bool tracing;
|
||||
} TraceScreen;
|
||||
@ -44,14 +44,14 @@ static int tbEvents[3] = {KEY_F(4), KEY_F(5), 27};
|
||||
TraceScreen* TraceScreen_new(Process* process) {
|
||||
TraceScreen* this = (TraceScreen*) malloc(sizeof(TraceScreen));
|
||||
this->process = process;
|
||||
this->display = ListBox_new(0, 1, COLS, LINES-2, LISTITEM_CLASS, true);
|
||||
this->display = Panel_new(0, 1, COLS, LINES-2, LISTITEM_CLASS, true);
|
||||
this->bar = FunctionBar_new(3, tbFunctions, tbKeys, tbEvents);
|
||||
this->tracing = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
void TraceScreen_delete(TraceScreen* this) {
|
||||
ListBox_delete((Object*)this->display);
|
||||
Panel_delete((Object*)this->display);
|
||||
FunctionBar_delete((Object*)this->bar);
|
||||
free(this);
|
||||
}
|
||||
@ -81,7 +81,7 @@ void TraceScreen_run(TraceScreen* this) {
|
||||
}
|
||||
fcntl(fdpair[0], F_SETFL, O_NONBLOCK);
|
||||
FILE* strace = fdopen(fdpair[0], "r");
|
||||
ListBox* lb = this->display;
|
||||
Panel* lb = this->display;
|
||||
int fd_strace = fileno(strace);
|
||||
TraceScreen_draw(this);
|
||||
CRT_disableDelay();
|
||||
@ -105,23 +105,23 @@ void TraceScreen_run(TraceScreen* this) {
|
||||
if (buffer[i] == '\n') {
|
||||
buffer[i] = '\0';
|
||||
if (contLine) {
|
||||
ListItem_append((ListItem*)ListBox_get(lb,
|
||||
ListBox_getSize(lb)-1), line);
|
||||
ListItem_append((ListItem*)Panel_get(lb,
|
||||
Panel_getSize(lb)-1), line);
|
||||
contLine = false;
|
||||
} else {
|
||||
ListBox_add(lb, (Object*) ListItem_new(line, 0));
|
||||
Panel_add(lb, (Object*) ListItem_new(line, 0));
|
||||
}
|
||||
line = buffer+i+1;
|
||||
}
|
||||
}
|
||||
if (line < buffer+nread) {
|
||||
ListBox_add(lb, (Object*) ListItem_new(line, 0));
|
||||
Panel_add(lb, (Object*) ListItem_new(line, 0));
|
||||
buffer[nread] = '\0';
|
||||
contLine = true;
|
||||
}
|
||||
if (follow)
|
||||
ListBox_setSelected(lb, ListBox_getSize(lb)-1);
|
||||
ListBox_draw(lb, true);
|
||||
Panel_setSelected(lb, Panel_getSize(lb)-1);
|
||||
Panel_draw(lb, true);
|
||||
}
|
||||
int ch = getch();
|
||||
if (ch == KEY_MOUSE) {
|
||||
@ -129,7 +129,7 @@ void TraceScreen_run(TraceScreen* this) {
|
||||
int ok = getmouse(&mevent);
|
||||
if (ok == OK)
|
||||
if (mevent.y >= lb->y && mevent.y < LINES - 1) {
|
||||
ListBox_setSelected(lb, mevent.y - lb->y + lb->scrollV);
|
||||
Panel_setSelected(lb, mevent.y - lb->y + lb->scrollV);
|
||||
follow = false;
|
||||
ch = 0;
|
||||
} if (mevent.y == LINES - 1)
|
||||
@ -147,21 +147,21 @@ void TraceScreen_run(TraceScreen* this) {
|
||||
case KEY_F(4):
|
||||
follow = !follow;
|
||||
if (follow)
|
||||
ListBox_setSelected(lb, ListBox_getSize(lb)-1);
|
||||
Panel_setSelected(lb, Panel_getSize(lb)-1);
|
||||
break;
|
||||
case 'q':
|
||||
case 27:
|
||||
looping = false;
|
||||
break;
|
||||
case KEY_RESIZE:
|
||||
ListBox_resize(lb, COLS, LINES-2);
|
||||
Panel_resize(lb, COLS, LINES-2);
|
||||
TraceScreen_draw(this);
|
||||
break;
|
||||
default:
|
||||
follow = false;
|
||||
ListBox_onKey(lb, ch);
|
||||
Panel_onKey(lb, ch);
|
||||
}
|
||||
ListBox_draw(lb, true);
|
||||
Panel_draw(lb, true);
|
||||
}
|
||||
kill(child, SIGTERM);
|
||||
waitpid(child, NULL, 0);
|
||||
|
Reference in New Issue
Block a user