Remove old commented code.

This commit is contained in:
Hisham 2016-02-19 13:39:38 -02:00
parent d4741d5410
commit 565101234a
1 changed files with 0 additions and 193 deletions

193
htop.c
View File

@ -230,194 +230,6 @@ int main(int argc, char** argv) {
ScreenManager_run(scr, NULL, NULL);
/*
FunctionBar_draw(defaultBar, NULL);
int acc = 0;
bool follow = false;
struct timeval tv;
double oldTime = 0.0;
int ch = ERR;
int closeTimeout = 0;
bool drawPanel = true;
bool collapsed = false;
Htop_Action keys[KEY_MAX] = { NULL };
setBindings(keys);
Platform_setBindings(keys);
bool quit = false;
int sortTimeout = 0;
int resetSortTimeout = 5;
bool doRefresh = true;
bool forceRecalculate = false;
while (!quit) {
gettimeofday(&tv, NULL);
double newTime = ((double)tv.tv_sec * 10) + ((double)tv.tv_usec / 100000);
bool timeToRecalculate = (newTime - oldTime > settings->delay);
if (newTime < oldTime) timeToRecalculate = true; // clock was adjusted?
int following = follow ? MainPanel_selectedPid((MainPanel*)panel) : -1;
if (timeToRecalculate) {
Header_draw(header);
oldTime = newTime;
}
if (doRefresh) {
if (timeToRecalculate || forceRecalculate) {
ProcessList_scan(pl);
forceRecalculate = false;
}
if (sortTimeout == 0 || settings->treeView) {
ProcessList_sort(pl);
sortTimeout = 1;
}
ProcessList_rebuildPanel(pl, true, following, IncSet_filter(inc));
drawPanel = true;
}
doRefresh = true;
if (settings->treeView) {
Process* p = (Process*) Panel_getSelected(panel);
if (p) {
if (!p->showChildren && !collapsed) {
FunctionBar_setLabel(defaultBar, KEY_F(6), "Expand");
FunctionBar_draw(defaultBar, NULL);
} else if (p->showChildren && collapsed) {
FunctionBar_setLabel(defaultBar, KEY_F(6), "Collap");
FunctionBar_draw(defaultBar, NULL);
}
collapsed = !p->showChildren;
}
} else {
collapsed = false;
}
if (drawPanel) {
Panel_draw(panel, true);
}
int prev = ch;
if (inc->active)
move(LINES-1, CRT_cursorX);
ch = getch();
if (ch == ERR) {
if (!inc->active)
sortTimeout--;
if (prev == ch && !timeToRecalculate) {
closeTimeout++;
if (closeTimeout == 100) {
break;
}
} else
closeTimeout = 0;
drawPanel = false;
continue;
}
drawPanel = true;
Htop_Reaction reaction = HTOP_OK;
if (ch == KEY_MOUSE) {
MEVENT mevent;
int ok = getmouse(&mevent);
if (ok == OK) {
if (mevent.bstate & BUTTON1_CLICKED) {
if (mevent.y == panel->y) {
int x = panel->scrollH + mevent.x + 1;
ProcessField field = ProcessList_keyAt(pl, x);
if (field == settings->sortKey) {
Settings_invertSortOrder(settings);
settings->treeView = false;
reaction |= HTOP_REDRAW_BAR;
} else {
reaction |= setSortKey(settings, field);
}
sortTimeout = 0;
ch = ERR;
} else if (mevent.y >= panel->y + 1 && mevent.y < LINES - 1) {
Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1);
follow = true;
ch = ERR;
} if (mevent.y == LINES - 1) {
ch = FunctionBar_synthesizeEvent(inc->bar, mevent.x);
}
} else if (mevent.bstate & BUTTON4_CLICKED) {
ch = KEY_UP;
#if NCURSES_MOUSE_VERSION > 1
} else if (mevent.bstate & BUTTON5_CLICKED) {
ch = KEY_DOWN;
#endif
}
}
}
if (inc->active) {
doRefresh = IncSet_handleKey(inc, ch, panel, getMainPanelValue, NULL);
if (!inc->active) {
follow = true;
}
continue;
}
if (ch < 255 && isdigit((char)ch)) {
if (Panel_size(panel) == 0) continue;
pid_t pid = ch-48 + acc;
for (int i = 0; i < ProcessList_size(pl); i++) {
Panel_setSelected(panel, i);
Process* p = (Process*) Panel_getSelected(panel);
if (p && p->pid == pid) {
break;
}
}
acc = pid * 10;
if (acc > 10000000)
acc = 0;
continue;
} else {
acc = 0;
}
if(ch != ERR && keys[ch]) {
reaction |= (keys[ch])(&state);
} else {
doRefresh = false;
sortTimeout = resetSortTimeout;
Panel_onKey(panel, ch);
}
// Reaction handlers:
if (reaction & HTOP_REDRAW_BAR) {
updateTreeFunctions(defaultBar, settings->treeView);
IncSet_drawBar(inc);
}
if (reaction & HTOP_UPDATE_PANELHDR) {
ProcessList_printHeader(pl, Panel_getHeader(panel));
}
if (reaction & HTOP_REFRESH) {
doRefresh = true;
sortTimeout = 0;
}
if (reaction & HTOP_RECALCULATE) {
forceRecalculate = true;
sortTimeout = 0;
}
if (reaction & HTOP_SAVE_SETTINGS) {
settings->changed = true;
}
if (reaction & HTOP_QUIT) {
quit = true;
}
follow = (reaction & HTOP_KEEP_FOLLOWING);
}
*/
attron(CRT_colors[RESET_COLOR]);
mvhline(LINES-1, 0, ' ', COLS);
attroff(CRT_colors[RESET_COLOR]);
@ -429,11 +241,6 @@ int main(int argc, char** argv) {
Header_delete(header);
ProcessList_delete(pl);
/*
FunctionBar_delete((Object*)defaultBar);
Panel_delete((Object*)panel);
*/
ScreenManager_delete(scr);
UsersTable_delete(ut);