NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
draw.c File Reference

Paint the Menu. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "gui/lib.h"
#include "lib.h"
#include "color/lib.h"
#include "index/lib.h"
#include "pattern/lib.h"
#include "mutt_thread.h"
#include "mview.h"
+ Include dependency graph for draw.c:

Go to the source code of this file.

Functions

static const struct AttrColorget_color (int index, unsigned char *s)
 Choose a colour for a line of the index.
 
static void print_enriched_string (struct MuttWindow *win, int index, const struct AttrColor *ac_def, struct AttrColor *ac_ind, unsigned char *s, struct ConfigSubset *sub)
 Display a string with embedded colours and graphics.
 
static void menu_pad_string (struct Menu *menu, char *buf, size_t buflen)
 Pad a string with spaces for display in the Menu.
 
void menu_redraw_full (struct Menu *menu)
 Force the redraw of the Menu.
 
void menu_redraw_index (struct Menu *menu)
 Force the redraw of the index.
 
void menu_redraw_motion (struct Menu *menu)
 Force the redraw of the list part of the menu.
 
void menu_redraw_current (struct Menu *menu)
 Redraw the current menu.
 
int menu_redraw (struct Menu *menu)
 Redraw the parts of the screen that have been flagged to be redrawn.
 

Detailed Description

Paint the Menu.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file draw.c.

Function Documentation

◆ get_color()

static const struct AttrColor * get_color ( int  index,
unsigned char *  s 
)
static

Choose a colour for a line of the index.

Parameters
indexIndex number
sString of embedded colour codes
Return values
numColour pair in an integer

Text is coloured by inserting special characters into the string, e.g. MT_COLOR_INDEX_AUTHOR

Definition at line 54 of file draw.c.

55{
56 const int type = *s;
57 struct RegexColorList *rcl = regex_colors_get_list(type);
58 struct Mailbox *m_cur = get_current_mailbox();
59 struct Email *e = mutt_get_virt_email(m_cur, index);
60 if (!rcl || !e)
61 {
62 return simple_color_get(type);
63 }
64
65 struct RegexColor *np = NULL;
66
67 if (type == MT_COLOR_INDEX_TAG)
68 {
69 const struct AttrColor *ac_merge = NULL;
70 STAILQ_FOREACH(np, rcl, entries)
71 {
72 if (mutt_strn_equal((const char *) (s + 1), np->pattern, strlen(np->pattern)))
73 {
74 ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
75 continue;
76 }
77 const char *transform = mutt_hash_find(TagTransforms, np->pattern);
78 if (transform && mutt_strn_equal((const char *) (s + 1), transform, strlen(transform)))
79 {
80 ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
81 }
82 }
83 return ac_merge;
84 }
85
86 const struct AttrColor *ac_merge = NULL;
87 STAILQ_FOREACH(np, rcl, entries)
88 {
90 MUTT_MATCH_FULL_ADDRESS, m_cur, e, NULL))
91 {
92 ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
93 }
94 }
95
96 return ac_merge;
97}
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a colour id.
Definition: regex.c:184
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:81
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:92
bool mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct PatternCache *cache)
Match a pattern against an email header.
Definition: exec.c:1137
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Definition: hash.c:362
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:662
const struct AttrColor * merged_color_overlay(const struct AttrColor *base, const struct AttrColor *over)
Combine two colours.
Definition: merged.c:109
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
Definition: string.c:497
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:419
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
Definition: lib.h:106
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
#define SLIST_FIRST(head)
Definition: queue.h:229
A curses colour and its attributes.
Definition: attr.h:35
The envelope/body of an email.
Definition: email.h:37
int index
The absolute (unsorted) message number.
Definition: email.h:109
A mailbox.
Definition: mailbox.h:79
A regular expression and a color to highlight a line.
Definition: regex4.h:37
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: regex4.h:42
struct AttrColor attr_color
Colour and attributes to apply.
Definition: regex4.h:38
char * pattern
Pattern to match.
Definition: regex4.h:39
struct HashTable * TagTransforms
Hash Table: "inbox" -> "i" - Alternative tag names.
Definition: tags.c:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_enriched_string()

static void print_enriched_string ( struct MuttWindow win,
int  index,
const struct AttrColor ac_def,
struct AttrColor ac_ind,
unsigned char *  s,
struct ConfigSubset sub 
)
static

Display a string with embedded colours and graphics.

Parameters
winWindow
indexIndex number
ac_defDefault colour for the line
ac_indIndicator colour for the line
sString of embedded colour codes
subConfig items

Definition at line 108 of file draw.c.

111{
112 wchar_t wc = 0;
113 size_t k;
114 size_t n = mutt_str_len((char *) s);
115 mbstate_t mbstate = { 0 };
116
117 const bool c_ascii_chars = cs_subset_bool(sub, "ascii_chars");
118 while (*s)
119 {
120 if (*s < MUTT_TREE_MAX)
121 {
122 const struct AttrColor *ac_merge = merged_color_overlay(ac_def, simple_color_get(MT_COLOR_TREE));
123 ac_merge = merged_color_overlay(ac_merge, ac_ind);
124
125 /* Combining tree fg color and another bg color requires having
126 * use_default_colors, because the other bg color may be undefined. */
127 mutt_curses_set_color(ac_merge);
128
129 while (*s && (*s < MUTT_TREE_MAX))
130 {
131 switch (*s)
132 {
134 if (c_ascii_chars)
135 mutt_window_addch(win, '`');
136#ifdef WACS_LLCORNER
137 else
138 add_wch(WACS_LLCORNER);
139#else
140 else if (CharsetIsUtf8)
141 mutt_window_addstr(win, "\342\224\224"); /* WACS_LLCORNER */
142 else
143 mutt_window_addch(win, ACS_LLCORNER);
144#endif
145 break;
147 if (c_ascii_chars)
148 mutt_window_addch(win, ',');
149#ifdef WACS_ULCORNER
150 else
151 add_wch(WACS_ULCORNER);
152#else
153 else if (CharsetIsUtf8)
154 mutt_window_addstr(win, "\342\224\214"); /* WACS_ULCORNER */
155 else
156 mutt_window_addch(win, ACS_ULCORNER);
157#endif
158 break;
159 case MUTT_TREE_LTEE:
160 if (c_ascii_chars)
161 mutt_window_addch(win, '|');
162#ifdef WACS_LTEE
163 else
164 add_wch(WACS_LTEE);
165#else
166 else if (CharsetIsUtf8)
167 mutt_window_addstr(win, "\342\224\234"); /* WACS_LTEE */
168 else
169 mutt_window_addch(win, ACS_LTEE);
170#endif
171 break;
172 case MUTT_TREE_HLINE:
173 if (c_ascii_chars)
174 mutt_window_addch(win, '-');
175#ifdef WACS_HLINE
176 else
177 add_wch(WACS_HLINE);
178#else
179 else if (CharsetIsUtf8)
180 mutt_window_addstr(win, "\342\224\200"); /* WACS_HLINE */
181 else
182 mutt_window_addch(win, ACS_HLINE);
183#endif
184 break;
185 case MUTT_TREE_VLINE:
186 if (c_ascii_chars)
187 mutt_window_addch(win, '|');
188#ifdef WACS_VLINE
189 else
190 add_wch(WACS_VLINE);
191#else
192 else if (CharsetIsUtf8)
193 mutt_window_addstr(win, "\342\224\202"); /* WACS_VLINE */
194 else
195 mutt_window_addch(win, ACS_VLINE);
196#endif
197 break;
198 case MUTT_TREE_TTEE:
199 if (c_ascii_chars)
200 mutt_window_addch(win, '-');
201#ifdef WACS_TTEE
202 else
203 add_wch(WACS_TTEE);
204#else
205 else if (CharsetIsUtf8)
206 mutt_window_addstr(win, "\342\224\254"); /* WACS_TTEE */
207 else
208 mutt_window_addch(win, ACS_TTEE);
209#endif
210 break;
211 case MUTT_TREE_BTEE:
212 if (c_ascii_chars)
213 mutt_window_addch(win, '-');
214#ifdef WACS_BTEE
215 else
216 add_wch(WACS_BTEE);
217#else
218 else if (CharsetIsUtf8)
219 mutt_window_addstr(win, "\342\224\264"); /* WACS_BTEE */
220 else
221 mutt_window_addch(win, ACS_BTEE);
222#endif
223 break;
224 case MUTT_TREE_SPACE:
225 mutt_window_addch(win, ' ');
226 break;
227 case MUTT_TREE_RARROW:
228 mutt_window_addch(win, '>');
229 break;
230 case MUTT_TREE_STAR:
231 mutt_window_addch(win, '*'); /* fake thread indicator */
232 break;
233 case MUTT_TREE_HIDDEN:
234 mutt_window_addch(win, '&');
235 break;
236 case MUTT_TREE_EQUALS:
237 mutt_window_addch(win, '=');
238 break;
240 mutt_window_addch(win, '?');
241 break;
242 }
243 s++;
244 n--;
245 }
246 ac_merge = merged_color_overlay(ac_def, ac_ind);
247 mutt_curses_set_color(ac_merge);
248 }
249 else if (*s == MUTT_SPECIAL_INDEX)
250 {
251 s++;
252 if (*s == MT_COLOR_INDEX)
253 {
254 const struct AttrColor *ac_merge = merged_color_overlay(ac_def, ac_ind);
255 mutt_curses_set_color(ac_merge);
256 }
257 else
258 {
259 const struct AttrColor *color = get_color(index, s);
260 const struct AttrColor *ac_merge = merged_color_overlay(ac_def, color);
261 ac_merge = merged_color_overlay(ac_merge, ac_ind);
262
263 mutt_curses_set_color(ac_merge);
264 }
265 s++;
266 n -= 2;
267 }
268 else if ((k = mbrtowc(&wc, (char *) s, n, &mbstate)) > 0)
269 {
270 mutt_window_addnstr(win, (char *) s, k);
271 s += k;
272 n -= k;
273 }
274 else
275 {
276 break;
277 }
278 }
279}
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:79
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:83
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
static const struct AttrColor * get_color(int index, unsigned char *s)
Choose a colour for a line of the index.
Definition: draw.c:54
bool CharsetIsUtf8
Is the user's current character set utf-8?
Definition: charset.c:63
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:568
void mutt_curses_set_color(const struct AttrColor *ac)
Set the colour and attributes for text.
Definition: mutt_curses.c:40
@ MUTT_TREE_MAX
Definition: mutt_thread.h:69
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition: mutt_thread.h:56
@ MUTT_TREE_RARROW
Right arrow.
Definition: mutt_thread.h:62
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:71
@ MUTT_TREE_ULCORNER
Upper left corner.
Definition: mutt_thread.h:57
@ MUTT_TREE_EQUALS
Equals (for threads)
Definition: mutt_thread.h:65
@ MUTT_TREE_HIDDEN
Ampersand character (for threads)
Definition: mutt_thread.h:64
@ MUTT_TREE_STAR
Star character (for threads)
Definition: mutt_thread.h:63
@ MUTT_TREE_LTEE
Left T-piece.
Definition: mutt_thread.h:58
@ MUTT_TREE_VLINE
Vertical line.
Definition: mutt_thread.h:60
@ MUTT_TREE_MISSING
Question mark.
Definition: mutt_thread.h:68
@ MUTT_TREE_TTEE
Top T-piece.
Definition: mutt_thread.h:66
@ MUTT_TREE_HLINE
Horizontal line.
Definition: mutt_thread.h:59
@ MUTT_TREE_SPACE
Blank space.
Definition: mutt_thread.h:61
@ MUTT_TREE_BTEE
Bottom T-piece.
Definition: mutt_thread.h:67
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
Definition: mutt_window.c:416
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:401
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
Definition: mutt_window.c:388
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_pad_string()

static void menu_pad_string ( struct Menu menu,
char *  buf,
size_t  buflen 
)
static

Pad a string with spaces for display in the Menu.

Parameters
menuCurrent Menu
bufBuffer containing the string
buflenLength of the buffer
Note
The string is padded in-place.

Definition at line 289 of file draw.c.

290{
291 char *scratch = mutt_str_dup(buf);
292 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
293 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
294 const int shift = c_arrow_cursor ? mutt_strwidth(c_arrow_string) + 1 : 0;
295 const int cols = menu->win->state.cols - shift;
296
297 mutt_simple_format(buf, buflen, cols, cols, JUSTIFY_LEFT, ' ', scratch,
298 mutt_str_len(scratch), true);
299 buf[buflen - 1] = '\0';
300 FREE(&scratch);
301}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
void mutt_simple_format(char *buf, size_t buflen, int min_width, int max_width, enum FormatJustify justify, char pad_char, const char *s, size_t n, bool arboreal)
Format a string, like snprintf()
Definition: curs_lib.c:366
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:647
@ JUSTIFY_LEFT
Left justify the text.
Definition: curs_lib.h:40
#define FREE(x)
Definition: memory.h:45
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:251
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:77
struct ConfigSubset * sub
Inherited config items.
Definition: lib.h:78
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw_full()

void menu_redraw_full ( struct Menu menu)

Force the redraw of the Menu.

Parameters
menuCurrent Menu

Definition at line 307 of file draw.c.

308{
310 mutt_window_clear(menu->win);
311
312 menu->page_len = menu->win->state.rows;
313
315}
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:57
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:57
const struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
Definition: mutt_curses.c:81
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
Definition: mutt_window.c:720
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:73
int page_len
Number of entries per screen.
Definition: lib.h:75
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw_index()

void menu_redraw_index ( struct Menu menu)

Force the redraw of the index.

Parameters
menuCurrent Menu

Definition at line 321 of file draw.c.

322{
323 char buf[1024] = { 0 };
324 const struct AttrColor *ac = NULL;
325
326 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
327 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
328 const int arrow_width = mutt_strwidth(c_arrow_string);
330 for (int i = menu->top; i < (menu->top + menu->page_len); i++)
331 {
332 if (i < menu->max)
333 {
334 ac = menu->color(menu, i);
335
336 menu->make_entry(menu, buf, sizeof(buf), i);
337 menu_pad_string(menu, buf, sizeof(buf));
338
340 mutt_window_move(menu->win, 0, i - menu->top);
341
342 if (i == menu->current)
343 mutt_curses_set_color(ac_ind);
344
345 if (c_arrow_cursor)
346 {
347 if (i == menu->current)
348 {
349 mutt_window_addstr(menu->win, c_arrow_string);
351 mutt_window_addch(menu->win, ' ');
352 }
353 else
354 {
355 /* Print space chars to match the screen width of `$arrow_string` */
356 mutt_window_printf(menu->win, "%*s", arrow_width + 1, "");
357 }
358 }
359
360 if ((i == menu->current) && !c_arrow_cursor)
361 print_enriched_string(menu->win, i, ac, ac_ind, (unsigned char *) buf, menu->sub);
362 else
363 print_enriched_string(menu->win, i, ac, NULL, (unsigned char *) buf, menu->sub);
364 }
365 else
366 {
368 mutt_window_clearline(menu->win, i - menu->top);
369 }
370 }
373}
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:52
static void print_enriched_string(struct MuttWindow *win, int index, const struct AttrColor *ac_def, struct AttrColor *ac_ind, unsigned char *s, struct ConfigSubset *sub)
Display a string with embedded colours and graphics.
Definition: draw.c:108
static void menu_pad_string(struct Menu *menu, char *buf, size_t buflen)
Pad a string with spaces for display in the Menu.
Definition: draw.c:289
#define MENU_REDRAW_NO_FLAGS
No flags are set.
Definition: lib.h:56
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:431
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:297
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:232
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Definition: lib.h:96
int current
Current entry.
Definition: lib.h:71
const struct AttrColor *(* color)(struct Menu *menu, int line)
Definition: lib.h:133
int top
Entry that is the top of the current page.
Definition: lib.h:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw_motion()

void menu_redraw_motion ( struct Menu menu)

Force the redraw of the list part of the menu.

Parameters
menuCurrent Menu

Definition at line 379 of file draw.c.

380{
381 char buf[1024] = { 0 };
382
383 /* Note: menu->color() for the index can end up retrieving a message
384 * over imap (if matching against ~h for instance). This can
385 * generate status messages. So we want to call it *before* we
386 * position the cursor for drawing. */
387 const struct AttrColor *old_color = menu->color(menu, menu->old_current);
388 mutt_window_move(menu->win, 0, menu->old_current - menu->top);
389 mutt_curses_set_color(old_color);
390
391 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
393 if (c_arrow_cursor)
394 {
395 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
396 const int arrow_width = mutt_strwidth(c_arrow_string);
397 /* clear the arrow */
398 /* Print space chars to match the screen width of `$arrow_string` */
399 mutt_window_printf(menu->win, "%*s", arrow_width + 1, "");
401
402 menu->make_entry(menu, buf, sizeof(buf), menu->old_current);
403 menu_pad_string(menu, buf, sizeof(buf));
404 mutt_window_move(menu->win, arrow_width + 1, menu->old_current - menu->top);
405 print_enriched_string(menu->win, menu->old_current, old_color, NULL,
406 (unsigned char *) buf, menu->sub);
407
408 /* now draw it in the new location */
409 mutt_curses_set_color(ac_ind);
410 mutt_window_mvaddstr(menu->win, 0, menu->current - menu->top, c_arrow_string);
411 }
412 else
413 {
415 /* erase the current indicator */
416 menu->make_entry(menu, buf, sizeof(buf), menu->old_current);
417 menu_pad_string(menu, buf, sizeof(buf));
418 print_enriched_string(menu->win, menu->old_current, old_color, NULL,
419 (unsigned char *) buf, menu->sub);
420
421 /* now draw the new one to reflect the change */
422 const struct AttrColor *cur_color = menu->color(menu, menu->current);
423 cur_color = merged_color_overlay(cur_color, ac_ind);
424 menu->make_entry(menu, buf, sizeof(buf), menu->current);
425 menu_pad_string(menu, buf, sizeof(buf));
426 mutt_window_move(menu->win, 0, menu->current - menu->top);
427 mutt_curses_set_color(cur_color);
428 print_enriched_string(menu->win, menu->current, cur_color, ac_ind,
429 (unsigned char *) buf, menu->sub);
430 }
432}
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:311
int old_current
For driver use only.
Definition: lib.h:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw_current()

void menu_redraw_current ( struct Menu menu)

Redraw the current menu.

Parameters
menuCurrent Menu

Definition at line 438 of file draw.c.

439{
440 char buf[1024] = { 0 };
441 const struct AttrColor *ac = menu->color(menu, menu->current);
442
443 mutt_window_move(menu->win, 0, menu->current - menu->top);
444 menu->make_entry(menu, buf, sizeof(buf), menu->current);
445 menu_pad_string(menu, buf, sizeof(buf));
446
448 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
449 if (c_arrow_cursor)
450 {
451 mutt_curses_set_color(ac_ind);
452 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
453 mutt_window_addstr(menu->win, c_arrow_string);
455 mutt_window_addch(menu->win, ' ');
456 menu_pad_string(menu, buf, sizeof(buf));
457 print_enriched_string(menu->win, menu->current, ac, NULL,
458 (unsigned char *) buf, menu->sub);
459 }
460 else
461 {
462 print_enriched_string(menu->win, menu->current, ac, ac_ind,
463 (unsigned char *) buf, menu->sub);
464 }
466}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw()

int menu_redraw ( struct Menu menu)

Redraw the parts of the screen that have been flagged to be redrawn.

Parameters
menuMenu to redraw
Return values
OP_NULLMenu was redrawn
OP_REDRAWFull redraw required

Definition at line 474 of file draw.c.

475{
476 /* See if all or part of the screen needs to be updated. */
477 if (menu->redraw & MENU_REDRAW_FULL)
478 menu_redraw_full(menu);
479
480 if (menu->redraw & MENU_REDRAW_INDEX)
481 menu_redraw_index(menu);
482 else if (menu->redraw & MENU_REDRAW_MOTION)
483 menu_redraw_motion(menu);
484 else if (menu->redraw == MENU_REDRAW_CURRENT)
486
487 return OP_NULL;
488}
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition: draw.c:438
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: draw.c:321
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: draw.c:307
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: draw.c:379
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:60
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:59
#define MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition: lib.h:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function: