diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-12-16 21:46:11 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2020-12-20 17:01:50 +0100 |
commit | e3862aa67e37ecef0eb8f82ba1f4a710ffac9c02 (patch) | |
tree | aa906dac3ffca307c01b9dc78ed75082aecf238c /InfoScreen.c | |
parent | 7e7a53c415b82cceee6173922987b772b1d51c10 (diff) |
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
Diffstat (limited to 'InfoScreen.c')
-rw-r--r-- | InfoScreen.c | 15 |
1 files changed, 8 insertions, 7 deletions
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); |