From 1b805a31720727008b32b1129a167758519fd4db Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 2 May 2022 16:04:21 +0200 Subject: New upstream version 3.2.0 --- MainPanel.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'MainPanel.c') diff --git a/MainPanel.c b/MainPanel.c index 07dc631..44915df 100644 --- a/MainPanel.c +++ b/MainPanel.c @@ -24,9 +24,10 @@ in the source distribution for its full text. static const char* const MainFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL}; static const char* const MainFunctions_ro[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", " ", " ", " ", "Quit ", NULL}; -void MainPanel_updateTreeFunctions(MainPanel* this, bool mode) { +void MainPanel_updateLabels(MainPanel* this, bool list, bool filter) { FunctionBar* bar = MainPanel_getFunctionBar(this); - FunctionBar_setLabel(bar, KEY_F(5), mode ? "List " : "Tree "); + FunctionBar_setLabel(bar, KEY_F(5), list ? "List " : "Tree "); + FunctionBar_setLabel(bar, KEY_F(4), filter ? "FILTER" : "Filter"); } static void MainPanel_pidSearch(MainPanel* this, int ch) { @@ -71,23 +72,29 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { if (needReset) this->state->hideProcessSelection = false; + Settings* settings = this->state->settings; + ScreenSettings* ss = settings->ss; + if (EVENT_IS_HEADER_CLICK(ch)) { int x = EVENT_HEADER_CLICK_GET_X(ch); const ProcessList* pl = this->state->pl; - Settings* settings = this->state->settings; int hx = super->scrollH + x + 1; ProcessField field = ProcessList_keyAt(pl, hx); - if (settings->treeView && settings->treeViewAlwaysByPID) { - settings->treeView = false; - settings->direction = 1; + if (ss->treeView && ss->treeViewAlwaysByPID) { + ss->treeView = false; + ss->direction = 1; reaction |= Action_setSortKey(settings, field); - } else if (field == Settings_getActiveSortKey(settings)) { - Settings_invertSortOrder(settings); + } else if (field == ScreenSettings_getActiveSortKey(ss)) { + ScreenSettings_invertSortOrder(ss); } else { reaction |= Action_setSortKey(settings, field); } reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR | HTOP_SAVE_SETTINGS; result = HANDLED; + } else if (EVENT_IS_SCREEN_TAB_CLICK(ch)) { + int x = EVENT_SCREEN_TAB_GET_X(ch); + reaction |= Action_setScreenTab(settings, x); + result = HANDLED; } else if (ch != ERR && this->inc->active) { bool filterChanged = IncSet_handleKey(this->inc, ch, super, MainPanel_getValue, NULL); if (filterChanged) { @@ -116,7 +123,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { } if (reaction & HTOP_REDRAW_BAR) { - MainPanel_updateTreeFunctions(this, this->state->settings->treeView); + MainPanel_updateLabels(this, settings->ss->treeView, this->state->pl->incFilter); } if (reaction & HTOP_RESIZE) { result |= RESIZE; @@ -182,7 +189,7 @@ static void MainPanel_drawFunctionBar(Panel* super, bool hideFunctionBar) { if (hideFunctionBar && !this->inc->active) return; - IncSet_drawBar(this->inc); + IncSet_drawBar(this->inc, CRT_colors[FUNCTION_BAR]); if (this->state->pauseProcessUpdate) { FunctionBar_append("PAUSED", CRT_colors[PAUSED]); } -- cgit v1.2.3