Subversion Repositories DIN Is Noise

Rev

Rev 1858 | Rev 2006 | 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
1858 jag 3
* DIN Is Noise is copyright (c) 2006-2022 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
 
32
  int lift;
1528 jag 33
 
1562 jag 34
  text (
35
        const std::string& t,
36
        float xx = 0, float yy = 0,
37
        float rr=0.25, float gg=0.25, float bb=0.25,
38
        int s = text::temporary, int y = text::normal,
2005 jag 39
        float vxx = 0, float vyy = 0, int lft = 0) :
40
        txt(t), type (y) , state (s), r(rr), g(gg), b(bb), wx(xx), wy(yy), vx(vxx), vy(vyy), lift(lft) {}
1528 jag 41
 
42
  bool operator== (const text& t) {return txt == t.txt;}
43
 
44
};
45
 
46
struct basic_editor;
47
struct mondrian;
48
 
49
struct textboard {
50
  std::list<text> texts;
51
  void draw (int shapeform = 0);
52
  void draw_line (int x1, int y1, int x2, int y2);
53
  void add (const text& t) { texts.push_back (t);}
54
  void clear ();
55
  void refresh (basic_editor* b, float dwx = 0, float dwy = 0, float dvx = 0, float dvy = 0);
56
  void refresh (mondrian* m);
57
  void load (std::ifstream& file);
58
  void save (std::ofstream& file);
59
};
60
 
61
#endif