1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
#ifndef __FUNCTIONS_H
#define __FUNCTIONS_H
#include "functions.h"
class cFuncFill : public cFunction {
private:
void SetAttributesDefs(void);
public:
cFuncFill(cArea *owner, int numAttributes);
cFuncFill(const cFuncFill &other);
virtual ~cFuncFill(void);
void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
};
class cFuncDrawRectangle : public cFunction {
private:
void SetAttributesDefs(void);
public:
cFuncDrawRectangle(cArea *owner, int numAttributes);
cFuncDrawRectangle(const cFuncDrawRectangle &other);
virtual ~cFuncDrawRectangle(void);
void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
bool Blinking(void) { return GetValue((int)eDrawRectangleAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawRectangleAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawRectangleAttribs::align); };
int Valign(void) { return GetValue((int)eDrawRectangleAttribs::valign); };
};
class cFuncDrawEllipse : public cFunction {
private:
void SetAttributesDefs(void);
public:
cFuncDrawEllipse(cArea *owner, int numAttributes);
cFuncDrawEllipse(const cFuncDrawEllipse &other);
virtual ~cFuncDrawEllipse(void);
void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
bool Blinking(void) { return GetValue((int)eDrawEllipseAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawEllipseAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawEllipseAttribs::align); };
int Valign(void) { return GetValue((int)eDrawEllipseAttribs::valign); };
};
class cFuncDrawSlope : public cFunction {
private:
void SetAttributesDefs(void);
public:
cFuncDrawSlope(cArea *owner, int numAttributes);
cFuncDrawSlope(const cFuncDrawSlope &other);
virtual ~cFuncDrawSlope(void);
void Set(vector<stringpair> &attributes);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
bool Blinking(void) { return GetValue((int)eDrawSlopeAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawSlopeAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawSlopeAttribs::align); };
int Valign(void) { return GetValue((int)eDrawSlopeAttribs::valign); };
};
class cTextDrawer {
private:
static cMutex fontLock;
protected:
const cFont *font;
char *fontName;
int fontSize;
void CacheFont(cGlobals *globals, int size);
void LoadFont(int size);
int TextWidth(const char *text);
int FontHeight(void);
public:
cTextDrawer(void);
virtual ~cTextDrawer(void);
};
class cFuncDrawText : public cFunction, public cTextDrawer {
private:
cTextExpr *text;
void SetAttributesDefs(void);
char *Cut(char *expr, int width);
public:
cFuncDrawText(cArea *owner, int numAttributes);
cFuncDrawText(const cFuncDrawText &other);
virtual ~cFuncDrawText(void);
void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes);
void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncX(void);
int FuncY(void);
int FuncWidth(void);
int FuncHeight(void);
int AvrgFontWidth(void);
const cFont *GetFont(void);
bool Blinking(void) { return GetValue((int)eDrawTextAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawTextAttribs::align); };
int Valign(void) { return GetValue((int)eDrawTextAttribs::valign); };
void Debug(void);
};
class cFuncDrawTextVertical : public cFunction, public cTextDrawer {
private:
cTextExpr *text;
void SetAttributesDefs(void);
public:
cFuncDrawTextVertical(cArea *owner, int numAttributes);
cFuncDrawTextVertical(const cFuncDrawTextVertical &other);
virtual ~cFuncDrawTextVertical(void);
void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes);
void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncWidth(void);
int FuncHeight(void);
bool Blinking(void) { return GetValue((int)eDrawTextAttribsVertical::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawTextAttribsVertical::animfreq); };
int Align(void) { return GetValue((int)eDrawTextAttribsVertical::align); };
int Valign(void) { return GetValue((int)eDrawTextAttribsVertical::valign); };
void Debug(void);
};
class cTextFloater;
class cFuncDrawTextBox : public cFunction, public cTextDrawer {
private:
cTextExpr *text;
cTextFloater *floater;
void SetFloater(void);
void SetAttributesDefs(void);
void SetFloatMode(int id, const char *val);
public:
cFuncDrawTextBox(cArea *owner, int numAttributes);
cFuncDrawTextBox(const cFuncDrawTextBox &other);
virtual ~cFuncDrawTextBox(void);
void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes);
void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncWidth(void);
int FuncHeight(void);
void Debug(void);
};
class cFuncDrawImage : public cFunction {
private:
cTextExpr *path;
void SetAttributesDefs(void);
void SetImageType(int id, const char *val);
void PreCacheImage(void);
public:
cFuncDrawImage(cArea *owner, int numAttributes);
cFuncDrawImage(const cFuncDrawImage &other);
virtual ~cFuncDrawImage(void);
void SetLoopInfo(cLoopInfo *loopInfo);
void SetTokenContainerDeep(skindesignerapi::cTokenContainer *tokenContainer);
void Set(vector<stringpair> &attributes);
void Cache(void);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
bool Blinking(void) { return GetValue((int)eDrawImageAttribs::animtype) == (int)eAnimType::blink; };
int BlinkFreq(void) { return GetValue((int)eDrawImageAttribs::animfreq); };
int Align(void) { return GetValue((int)eDrawImageAttribs::align); };
int Valign(void) { return GetValue((int)eDrawImageAttribs::valign); };
void Debug(void);
};
class cFuncLoop : public cFunction {
private:
cLoopInfo loopInfo;
cList<cFunction> functions;
void SetAttributesDefs(void);
int ColumnWidth(void);
int RowHeight(void);
public:
cFuncLoop(cArea *owner, int numAttributes);
virtual ~cFuncLoop(void);
void Set(vector<stringpair> &attributes);
void SetContainer(int x, int y, int width, int height);
void Cache(void);
void AddFunction(cFunction *f);
cFunction *GetFunction(const char *name);
void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0);
int FuncWidth(void);
int FuncHeight(void);
int Valign(void) { return GetValue((int)eLoopAttribs::valign); };
void Debug(void);
};
class cTextFloater {
private:
char *text;
char *eol;
int lines;
int lastLine;
public:
cTextFloater(void);
cTextFloater(const char *text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0);
~cTextFloater();
void Set(const char *Text, const cFont *font, int width, int height = 0, int floatWidth = 0, int floatHeight = 0, int maxLines = 0);
///< Wraps the Text to make it fit into the area defined by the given Width
///< when displayed with the given Font.
///< Wrapping is done by inserting the necessary number of newline
///< characters into the string.
///< if height is set, new lines are only set till height is reached
///< if floatwidth and floatheight are set, the first lines (depending on
///< size of floatheight) are set to floatwidth
const char *Text(void);
///< Returns the full wrapped text.
int Lines(void) { return lines; }
///< Returns the actual number of lines needed to display the full wrapped text.
const char *GetLine(int line);
///< Returns the given Line. The first line is numbered 0.
};
#endif //__FUNCTIONS_H
|