Rev 2006 | Rev 2097 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1528 | jag | 1 | /* |
2 | * textboard.h |
||
2009 | jag | 3 | * DIN Is Noise is copyright (c) 2006-2023 Jagannathan Sampath |
1528 | jag | 4 | * For more information, please visit http://dinisnoise.org/ |
5 | */ |
||
6 | |||
7 | #ifndef __textboard |
||
8 | #define __textboard |
||
9 | |||
10 | #include <list> |
||
11 | #include <string> |
||
12 | #include <fstream> |
||
13 | |||
14 | #include "ui.h" |
||
15 | |||
16 | struct text { |
||
17 | |||
18 | std::string txt; // actual text |
||
19 | |||
1562 | jag | 20 | // hline - label on horizontal line, vline = label on vertical line |
21 | enum {hline=0, vline=1, normal}; |
||
22 | int type; |
||
1528 | jag | 23 | |
24 | enum {permanent, temporary}; |
||
25 | int state; |
||
26 | |||
1562 | jag | 27 | float r, g, b; // color |
1528 | jag | 28 | |
1562 | jag | 29 | float wx, wy; // window co-ords |
1528 | jag | 30 | int vx, vy; // view co-ords |
2005 | jag | 31 | |
1562 | jag | 32 | text ( |
33 | const std::string& t, |
||
34 | float xx = 0, float yy = 0, |
||
35 | float rr=0.25, float gg=0.25, float bb=0.25, |
||
36 | int s = text::temporary, int y = text::normal, |
||
2006 | jag | 37 | float vxx = 0, float vyy = 0) : |
38 | txt(t), type (y) , state (s), r(rr), g(gg), b(bb), wx(xx), wy(yy), vx(vxx), vy(vyy) {} |
||
1528 | jag | 39 | |
40 | bool operator== (const text& t) {return txt == t.txt;} |
||
41 | |||
42 | }; |
||
43 | |||
44 | struct basic_editor; |
||
45 | struct mondrian; |
||
46 | |||
47 | struct textboard { |
||
48 | std::list<text> texts; |
||
49 | void draw (int shapeform = 0); |
||
50 | void draw_line (int x1, int y1, int x2, int y2); |
||
51 | void add (const text& t) { texts.push_back (t);} |
||
52 | void clear (); |
||
53 | void refresh (basic_editor* b, float dwx = 0, float dwy = 0, float dvx = 0, float dvy = 0); |
||
54 | void refresh (mondrian* m); |
||
55 | void load (std::ifstream& file); |
||
56 | void save (std::ofstream& file); |
||
57 | }; |
||
58 | |||
59 | #endif |