NeoMutt  2025-01-09-81-g753ae0
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
quoted.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stddef.h>
31#include "mutt/lib.h"
32#include "quoted.h"
33#include "color.h"
34#include "notify2.h"
35#include "simple2.h"
36
37static int NumQuotedColors = 0;
38
43{
44 if (nc->event_type != NT_COLOR)
45 return 0;
46 if (!nc->event_data)
47 return -1;
48
49 struct EventColor *ev_c = nc->event_data;
50 enum ColorId cid = ev_c->cid;
51
52 if (!COLOR_QUOTED(cid))
53 return 0;
54
55 // Find the highest-numbered quotedN in use
56 for (int i = MT_COLOR_QUOTED9; i >= MT_COLOR_QUOTED0; i--)
57 {
59 {
60 NumQuotedColors = i + 1;
61 break;
62 }
63 }
64
65 return 0;
66}
67
72{
74}
75
80{
82}
83
88{
91}
92
99{
100 if (NumQuotedColors == 0)
101 return NULL;
102
103 // If we have too few colours, cycle around
104 q %= NumQuotedColors;
105
107}
108
114{
115 return NumQuotedColors;
116}
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition: notify.c:71
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
Definition: notify.c:61
bool simple_color_is_set(enum ColorId cid)
Is the object coloured?
Definition: simple.c:116
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:95
Color and attribute parsing.
ColorId
List of all coloured objects.
Definition: color.h:36
@ MT_COLOR_QUOTED0
Pager: quoted text, level 0.
Definition: color.h:59
@ MT_COLOR_QUOTED9
Pager: quoted text, level 9.
Definition: color.h:68
static int quoted_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: quoted.c:42
Convenience wrapper for the library headers.
Colour notifications.
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:41
struct AttrColor * quoted_colors_get(int q)
Return the color of a quote, cycling through the used quotes.
Definition: quoted.c:98
int quoted_colors_num_used(void)
Return the number of used quotes.
Definition: quoted.c:113
static int NumQuotedColors
Number of colours for quoted email text.
Definition: quoted.c:37
void quoted_colors_init(void)
Initialise the Quoted colours.
Definition: quoted.c:71
void quoted_colors_reset(void)
Reset the quoted-email colours.
Definition: quoted.c:79
void quoted_colors_cleanup(void)
Cleanup the quoted-email colours.
Definition: quoted.c:87
Quoted-Email colours.
#define COLOR_QUOTED(cid)
Definition: quoted.h:28
Simple colour.
A curses colour and its attributes.
Definition: attr.h:66
An Event that happened to a Colour.
Definition: notify2.h:55
enum ColorId cid
Colour ID that has changed.
Definition: notify2.h:56
Data passed to a notification function.
Definition: observer.h:34
void * event_data
Data from notify_send()
Definition: observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:36