diff options
Diffstat (limited to 'apps/plugins/lib/printcell_helper.c')
-rw-r--r-- | apps/plugins/lib/printcell_helper.c | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/apps/plugins/lib/printcell_helper.c b/apps/plugins/lib/printcell_helper.c index ce79943c31..328f74e318 100644 --- a/apps/plugins/lib/printcell_helper.c +++ b/apps/plugins/lib/printcell_helper.c | |||
@@ -124,9 +124,9 @@ static void draw_selector(struct screen *display, struct line_desc *linedes, | |||
124 | { | 124 | { |
125 | if (selected_flag == SELECTED_FLAG) | 125 | if (selected_flag == SELECTED_FLAG) |
126 | { | 126 | { |
127 | display->hline(x + 1, w + x, y); | 127 | if (selected_col > 0) |
128 | display->hline(x + 1, w + x, y + h - 1); | 128 | x--; |
129 | return; | 129 | w++; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | /* draw whole rect outline */ | 132 | /* draw whole rect outline */ |
@@ -143,9 +143,10 @@ static inline void set_cell_width(struct viewport *vp, int max_w, int new_w) | |||
143 | vp->width -= COLUMN_ENDLEN; | 143 | vp->width -= COLUMN_ENDLEN; |
144 | } | 144 | } |
145 | 145 | ||
146 | static inline int printcells(struct screen *display, char* buffer, uint16_t *sidx, | 146 | static inline int printcells(struct screen *display, char* buffer, |
147 | struct line_desc *linedes, struct viewport *vp, int vp_w, | 147 | uint16_t *sidx, struct line_desc *linedes, |
148 | int separator, int x, int y, int offw, int selected_flag) | 148 | struct viewport *vp, int vp_w, int separator, |
149 | int x, int y, int offw, int selected_flag, bool scroll) | ||
149 | { | 150 | { |
150 | /* Internal function prints remaining cells */ | 151 | /* Internal function prints remaining cells */ |
151 | int text_offset = offw + offw; | 152 | int text_offset = offw + offw; |
@@ -166,10 +167,15 @@ static inline int printcells(struct screen *display, char* buffer, uint16_t *sid | |||
166 | set_cell_width(vp, vp_w, nx); | 167 | set_cell_width(vp, vp_w, nx); |
167 | 168 | ||
168 | if (i == printcell.selcol) | 169 | if (i == printcell.selcol) |
170 | { | ||
171 | linedes->scroll = (selected_flag > 0); | ||
169 | linedes->separator_height = selsep; | 172 | linedes->separator_height = selsep; |
173 | } | ||
170 | else | 174 | else |
175 | { | ||
176 | linedes->scroll = scroll; | ||
171 | linedes->separator_height = separator; | 177 | linedes->separator_height = separator; |
172 | 178 | } | |
173 | buftext = &buffer[sidx[i]]; | 179 | buftext = &buffer[sidx[i]]; |
174 | display->put_line(x + offw, ny, linedes, "$t", buftext); | 180 | display->put_line(x + offw, ny, linedes, "$t", buftext); |
175 | vp->width += COLUMN_ENDLEN + 1; | 181 | vp->width += COLUMN_ENDLEN + 1; |
@@ -215,6 +221,7 @@ static void printcell_listdraw_fn(struct list_putlineinfo_t *list_info) | |||
215 | static char printcell_buffer[PRINTCELL_MAXLINELEN]; | 221 | static char printcell_buffer[PRINTCELL_MAXLINELEN]; |
216 | static uint16_t sidx[PRINTCELL_MAX_COLUMNS]; /*indexes zero terminated strings in buffer*/ | 222 | static uint16_t sidx[PRINTCELL_MAX_COLUMNS]; /*indexes zero terminated strings in buffer*/ |
217 | 223 | ||
224 | struct gui_synclist *list = list_info->list; | ||
218 | int offset_pos = list_info->list->offset_position[screen]; | 225 | int offset_pos = list_info->list->offset_position[screen]; |
219 | int x = list_info->x - offset_pos; | 226 | int x = list_info->x - offset_pos; |
220 | int y = list_info->y; | 227 | int y = list_info->y; |
@@ -229,11 +236,17 @@ static void printcell_listdraw_fn(struct list_putlineinfo_t *list_info) | |||
229 | struct line_desc *linedes = list_info->linedes; | 236 | struct line_desc *linedes = list_info->linedes; |
230 | char *dsp_text = list_info->dsp_text; | 237 | char *dsp_text = list_info->dsp_text; |
231 | struct viewport *vp = list_info->vp; | 238 | struct viewport *vp = list_info->vp; |
239 | int line = list_info->line; | ||
232 | 240 | ||
233 | int selected_flag = ((is_selected || is_title) ? | 241 | int selected_flag = ((is_selected || is_title) ? |
234 | (is_title ? TITLE_FLAG : SELECTED_FLAG) : 0); | 242 | (is_title ? TITLE_FLAG : SELECTED_FLAG) : 0); |
235 | int vp_w = vp->width;/* save for restore */ | 243 | bool scroll_items = ((selected_flag == TITLE_FLAG) || |
236 | int saved_separator_height = linedes->separator_height;/* save for restore */ | 244 | (printcell.selcol < 0 && selected_flag > 0)); |
245 | |||
246 | /* save for restore */ | ||
247 | int vp_w = vp->width; | ||
248 | int saved_separator_height = linedes->separator_height; | ||
249 | bool saved_scroll = linedes->scroll; | ||
237 | 250 | ||
238 | linedes->separator_height = 0; | 251 | linedes->separator_height = 0; |
239 | int separator = saved_separator_height; | 252 | int separator = saved_separator_height; |
@@ -259,6 +272,7 @@ static void printcell_listdraw_fn(struct list_putlineinfo_t *list_info) | |||
259 | 272 | ||
260 | if (printcell.selcol_offw[screen] == 0 && printcell.selcol > 0) | 273 | if (printcell.selcol_offw[screen] == 0 && printcell.selcol > 0) |
261 | printcell.selcol_offw[screen] = calcvisible(screen, vp_w, text_offset, sbwidth); | 274 | printcell.selcol_offw[screen] = calcvisible(screen, vp_w, text_offset, sbwidth); |
275 | |||
262 | nx -= printcell.selcol_offw[screen]; | 276 | nx -= printcell.selcol_offw[screen]; |
263 | 277 | ||
264 | nw = screencolwidth[0] + printcell.iconw[screen] + text_offset; | 278 | nw = screencolwidth[0] + printcell.iconw[screen] + text_offset; |
@@ -310,8 +324,10 @@ static void printcell_listdraw_fn(struct list_putlineinfo_t *list_info) | |||
310 | if (printcell.selcol == 0 && selected_flag == 0) | 324 | if (printcell.selcol == 0 && selected_flag == 0) |
311 | linedes->separator_height = 0; | 325 | linedes->separator_height = 0; |
312 | else | 326 | else |
327 | { | ||
328 | linedes->scroll = printcell.selcol == 0 || scroll_items; | ||
313 | linedes->separator_height = separator; | 329 | linedes->separator_height = separator; |
314 | 330 | } | |
315 | if (show_cursor && have_icons) | 331 | if (show_cursor && have_icons) |
316 | { | 332 | { |
317 | /* the list can have both, one of or neither of cursor and item icons, | 333 | /* the list can have both, one of or neither of cursor and item icons, |
@@ -341,9 +357,15 @@ static void printcell_listdraw_fn(struct list_putlineinfo_t *list_info) | |||
341 | } | 357 | } |
342 | nx += nw; | 358 | nx += nw; |
343 | /* display remaining cells */ | 359 | /* display remaining cells */ |
344 | printcells(display, printcell_buffer, sidx, linedes, | 360 | printcells(display, printcell_buffer, sidx, linedes, vp, vp_w, separator, |
345 | vp, vp_w, separator, nx, y, col_offset_width, selected_flag); | 361 | nx, y, col_offset_width, selected_flag, scroll_items); |
362 | |||
363 | /* draw a line at the bottom of the list */ | ||
364 | if (separator > 0 && line == list->nb_items - 1) | ||
365 | display->hline(x, LCD_WIDTH, y + linedes->height - 1); | ||
366 | |||
346 | /* restore settings */ | 367 | /* restore settings */ |
368 | linedes->scroll = saved_scroll; | ||
347 | linedes->separator_height = saved_separator_height; | 369 | linedes->separator_height = saved_separator_height; |
348 | display->set_drawmode(DRMODE_FG); | 370 | display->set_drawmode(DRMODE_FG); |
349 | vp->width = vp_w; | 371 | vp->width = vp_w; |