From e3862aa67e37ecef0eb8f82ba1f4a710ffac9c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 16 Dec 2020 21:46:11 +0100 Subject: Rework drawing of FunctionBar Draw the FunctionBar within Panel_draw instead of manually throughout the code. Add an optional PanelClass function drawFunctionBar, to allow specific panels to override the default FunctionBar_draw call. Rework the code on color change, to really change all colors (selection markers and panel headers). Closes: #402 --- InfoScreen.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'InfoScreen.c') diff --git a/InfoScreen.c b/InfoScreen.c index 515d64f0..79f123e9 100644 --- a/InfoScreen.c +++ b/InfoScreen.c @@ -44,8 +44,10 @@ void InfoScreen_drawTitled(InfoScreen* this, const char* fmt, ...) { va_list ap; va_start(ap, fmt); - char* title = xMalloc(COLS + 1); - int len = vsnprintf(title, COLS + 1, fmt, ap); + char title[COLS + 1]; + int len = vsnprintf(title, sizeof(title), fmt, ap); + va_end(ap); + if (len > COLS) { memset(&title[COLS - 3], '.', 3); } @@ -54,11 +56,9 @@ void InfoScreen_drawTitled(InfoScreen* this, const char* fmt, ...) { mvhline(0, 0, ' ', COLS); mvwprintw(stdscr, 0, 0, title); attrset(CRT_colors[DEFAULT_COLOR]); - this->display->needsRedraw = true; - Panel_draw(this->display, true, true); + Panel_draw(this->display, true, true, true); + IncSet_drawBar(this->inc); - free(title); - va_end(ap); } void InfoScreen_addLine(InfoScreen* this, const char* line) { @@ -89,7 +89,8 @@ void InfoScreen_run(InfoScreen* this) { bool looping = true; while (looping) { - Panel_draw(panel, true, true); + Panel_draw(panel, false, true, true); + IncSet_drawBar(this->inc); if (this->inc->active) { (void) move(LINES - 1, CRT_cursorX); -- cgit v1.2.3