printcell_helper.c bugfix scrollbar spacing

when the scrollbar was on left and number of items was < nb_lines
the spacing between title and items was off by sb_width

selected item no longer draws separators when no colums are selected

Change-Id: If564261759721eb7bcf3b7b4ba58bf9c130771b0
This commit is contained in:
William Wilgus 2022-01-04 16:51:24 -05:00
parent cbb57fe714
commit bfe3dac3ba

View file

@ -41,6 +41,7 @@ struct printcell_info_t {
int iconw[NB_SCREENS];
int selcol_offw[NB_SCREENS];
int totalcolw[NB_SCREENS];
int firstcolxw[NB_SCREENS];
uint16_t colw[NB_SCREENS][PRINTCELL_MAX_COLUMNS];
int ncols;
int selcol;
@ -119,6 +120,15 @@ static void draw_selector(struct screen *display, struct line_desc *linedes,
return;
}
}
else if (printcell.selcol < 0)
{
if (selected_flag == SELECTED_FLAG)
{
display->hline(x + 1, w + x, y);
display->hline(x + 1, w + x, y + h - 1);
return;
}
}
/* draw whole rect outline */
display->drawrect(x + 1, y, w - 1, h);
}
@ -255,6 +265,8 @@ static void printcell_listdraw_fn(struct list_putlineinfo_t *list_info)
nw += sbwidth;
colxw = nx + nw;
printcell.firstcolxw[screen] = colxw; /* save position of first column for subsequent items */
if (colxw > 0)
{
set_cell_width(vp, vp_w, colxw);
@ -289,8 +301,9 @@ static void printcell_listdraw_fn(struct list_putlineinfo_t *list_info)
display->put_line(x, y, linedes, "$t", "");
}
nw = screencolwidth[0] + printcell.iconw[screen] + text_offset;
colxw = nx + nw;
//nw = screencolwidth[0] + printcell.iconw[screen] + text_offset;
colxw = printcell.firstcolxw[screen] - vp->x; /* match title spacing */
nw = colxw - nx;
if (colxw > 0)
{
set_cell_width(vp, vp_w, colxw);