Use MainPanel type in State struct

The State struct holds a pointer to the main process panel.
Use the distinct MainPanel type, to improve maintainability regrading
its usage.
This avoids usages of down-casts from Panel to MainPanel, only up-casts
from MainPanel to Panel are now required.
This commit is contained in:
Christian Göttsche
2021-02-05 14:12:49 +01:00
parent fd1ad863dc
commit fd4e6b432b
5 changed files with 48 additions and 46 deletions

View File

@ -123,7 +123,11 @@ static void ScreenManager_drawPanels(ScreenManager* this, int focus, bool force_
const int nPanels = this->panelCount;
for (int i = 0; i < nPanels; i++) {
Panel* panel = (Panel*) Vector_get(this->panels, i);
Panel_draw(panel, force_redraw, i == focus, !((panel == this->state->panel) && this->state->hideProcessSelection), State_hideFunctionBar(this->state));
Panel_draw(panel,
force_redraw,
i == focus,
panel != (Panel*)this->state->mainPanel || !this->state->hideProcessSelection,
State_hideFunctionBar(this->state));
mvvline(panel->y, panel->x + panel->w, ' ', panel->h + (State_hideFunctionBar(this->state) ? 1 : 0));
}
}