Rev 2116 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1528 | jag | 1 | /* |
2 | * textboard.h |
||
2302 | jag | 3 | * DIN Is Noise is copyright (c) 2006-2025 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 | |||
2116 | jag | 16 | struct text { // for textboard |
1528 | jag | 17 | |
2116 | jag | 18 | std::string txt; |
1528 | jag | 19 | |
2116 | jag | 20 | float r, g, b; // color |
21 | |||
22 | enum {forever, session, once}; |
||
23 | int state; |
||
24 | |||
1562 | jag | 25 | // hline - label on horizontal line, vline = label on vertical line |
2116 | jag | 26 | enum {hline=0, vline=1, floating}; |
1562 | jag | 27 | int type; |
1528 | jag | 28 | |
29 | |||
2116 | jag | 30 | int vx, vy; // view co-ords |
1562 | jag | 31 | float wx, wy; // window co-ords |
2005 | jag | 32 | |
1562 | jag | 33 | text ( |
34 | const std::string& t, |
||
35 | float xx = 0, float yy = 0, |
||
36 | float rr=0.25, float gg=0.25, float bb=0.25, |
||
2116 | jag | 37 | int s = text::once, int y = text::floating, |
2006 | jag | 38 | float vxx = 0, float vyy = 0) : |
2116 | jag | 39 | txt(t), r(rr), g(gg), b(bb), state(s), type (y), vx(vxx), vy(vyy), wx(xx), wy(yy) {} |
1528 | jag | 40 | |
41 | bool operator== (const text& t) {return txt == t.txt;} |
||
42 | |||
43 | }; |
||
44 | |||
45 | struct basic_editor; |
||
46 | struct mondrian; |
||
47 | |||
48 | struct textboard { |
||
2116 | jag | 49 | |
1528 | jag | 50 | std::list<text> texts; |
2116 | jag | 51 | void add (const text& t) { texts.push_back (t);} |
52 | void delallguides (int type); |
||
53 | void delnearestguide (int type, int vx, int vy); |
||
54 | void clear (); |
||
55 | |||
1528 | jag | 56 | void draw (int shapeform = 0); |
57 | void draw_line (int x1, int y1, int x2, int y2); |
||
2116 | jag | 58 | |
1528 | jag | 59 | void refresh (basic_editor* b, float dwx = 0, float dwy = 0, float dvx = 0, float dvy = 0); |
60 | void refresh (mondrian* m); |
||
2116 | jag | 61 | |
1528 | jag | 62 | void load (std::ifstream& file); |
63 | void save (std::ofstream& file); |
||
2116 | jag | 64 | |
1528 | jag | 65 | }; |
66 | |||
67 | #endif |