Added fancy new 'temperature gradients' feature.
[monky] / src / specials.h
1 /* Conky, a system monitor, based on torsmo
2  *
3  * Any original torsmo code is licensed under the BSD license
4  *
5  * All code written since the fork of torsmo is licensed under the GPL
6  *
7  * Please see COPYING for details
8  *
9  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
10  * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
11  *      (see AUTHORS)
12  * All rights reserved.
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  * You should have received a copy of the GNU General Public License
24  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  *
26  */
27 #ifndef _SPECIALS_H
28 #define _SPECIALS_H
29
30 /* special stuff in text_buffer */
31
32 #define SPECIAL_CHAR '\x01'
33
34 /* why 256? cause an array of more then 256 doubles seems excessive,
35  * and who needs that kind of precision anyway? */
36 #define MAX_GRAPH_DEPTH 256
37
38 // don't use spaces in LOGGRAPH or NORMGRAPH if you change them
39 #define LOGGRAPH "log"
40 #define NORMGRAPH "normal"
41 #define TEMPGRAD "-t"
42
43 enum special_types {
44         HORIZONTAL_LINE,
45         STIPPLED_HR,
46         BAR,
47         FG,
48         BG,
49         OUTLINE,
50         ALIGNR,
51         ALIGNC,
52         GAUGE,
53         GRAPH,
54         OFFSET,
55         VOFFSET,
56         FONT,
57         GOTO,
58         TAB,
59 };
60
61 struct special_t {
62         int type;
63         short height;
64         short width;
65         long arg;
66         double *graph;
67         double graph_scale;
68         short show_scale;
69         int graph_width;
70         int scaled;
71         unsigned long first_colour;     // for graph gradient
72         unsigned long last_colour;
73         short font_added;
74         char tempgrad;
75 };
76
77 /* direct access to the registered specials (FIXME: bad encapsulation) */
78 extern struct special_t *specials;
79 extern unsigned int special_count;
80
81 extern int default_bar_width;
82 extern int default_bar_height;
83 #ifdef X11
84 extern int default_graph_width;
85 extern int default_graph_height;
86 extern int default_gauge_width;
87 extern int default_gauge_height;
88 #endif
89
90 /* max number of specials allowed (TODO: use linked list instead) */
91 extern unsigned int max_specials;
92
93 #ifdef X11
94 /* scanning special arguments */
95 const char *scan_gauge(const char *, int *, int *);
96 const char *scan_bar(const char *, int *, int *);
97 char *scan_font(const char *);
98 char *scan_graph(const char *, int *, int *, unsigned int *,
99                  unsigned int *, unsigned int *, char *, char *);
100
101 /* printing specials */
102 void new_gauge(char *, int, int, int);
103 void new_bar(char *, int, int, int);
104 void new_font(char *, char *);
105 void new_graph(char *, int, int, unsigned int,
106                unsigned int, double, int, int, char, char);
107 void new_hr(char *, int);
108 void new_stippled_hr(char *, int, int);
109 #endif
110 void new_fg(char *, long);
111 void new_bg(char *, long);
112 void new_outline(char *, long);
113 void new_offset(char *, long);
114 void new_voffset(char *, long);
115 void new_alignr(char *, long);
116 void new_alignc(char *, long);
117 void new_goto(char *, long);
118 void new_tab(char *, int, int);
119
120 #endif /* _SPECIALS_H */