ARB
aw_xfig.hxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : aw_xfig.hxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #ifndef AW_XFIG_HXX
12 #define AW_XFIG_HXX
13 
14 #ifndef AW_BASE_HXX
15 #include "aw_base.hxx"
16 #endif
17 #ifndef ARBDB_BASE_H
18 #include <arbdb_base.h>
19 #endif
20 #ifndef ARBTOOLS_H
21 #include <arbtools.h>
22 #endif
23 
24 
26 const int XFIG_DEFAULT_FONT_HEIGHT = 13;
27 
28 const int MAX_LINE_WIDTH = 20;
29 const int MAX_XFIG_LENGTH = 100000;
30 
31 class AW_device;
32 
33 char *aw_get_font_from_xfig(int fontnr);
34 
35 struct AW_xfig_line {
36  struct AW_xfig_line *next;
37 
38  short x0, y0;
39  short x1, y1;
40  short color;
41  int gc;
42 };
43 
44 struct AW_xfig_text {
45  struct AW_xfig_text *next;
46 
47  short x, y;
48  short pix_len;
49  char *text;
51  short fontsize;
52  int center;
53  short color;
54  int gc;
55 };
56 
57 struct AW_xfig_pos {
58  short x, y;
59  int center;
60 };
61 
62 class AW_xfig : virtual Noncopyable {
63  void calc_scaling(int font_width, int font_height);
64 
65  void init(int font_width, int font_height) {
66  text = NULp;
67  at_pos_hash = NULp;
68 
69  memset(line, 0, sizeof(line));
70 
71  minx = 0; maxx = 0; centerx = 0;
72  miny = 0; maxy = 0; centery = 0;
73 
74  size_x = size_y = 0;
75 
76  calc_scaling(font_width, font_height);
77  }
78 
79 public:
80  struct AW_xfig_text *text;
82 
83  GB_HASH *at_pos_hash; // hash table for named positions
84 
85  int minx, miny;
86  int maxx, maxy;
87  int size_x, size_y;
89 
90  double font_scale;
91  double dpi_scale;
92 
93  AW_xfig(const char *filename, int font_width, int font_height);
94  AW_xfig(int font_width, int font_height); // creates an empty drawing area
95 
96  ~AW_xfig();
97  void print(AW_device *device); // you can scale it
98  void create_gcs(AW_device *device, int screen_depth); // create the gcs
99 
100  void add_line(int x1, int y1, int x2, int y2, int width); // add a line to xfig
101 };
102 
103 
104 /* xfig format ::
105 
106 text::
107 
108 4 0 font(-1== default) fontsize depth color ?? angle justified(4=left) flags width x y text^A
109 
110 lines::
111 
112 2 art depth width color ....
113 x y x y 9999 9999
114 
115 */
116 
117 #else
118 #error aw_xfig.hxx included twice
119 #endif // AW_XFIG_HXX
short x0
Definition: aw_xfig.hxx:38
short color
Definition: aw_xfig.hxx:40
const int MAX_XFIG_LENGTH
Definition: aw_xfig.hxx:29
const int MAX_LINE_WIDTH
Definition: aw_xfig.hxx:28
double dpi_scale
Definition: aw_xfig.hxx:91
short pix_len
Definition: aw_xfig.hxx:48
short y
Definition: aw_xfig.hxx:58
struct AW_xfig_line * line[MAX_LINE_WIDTH]
Definition: aw_xfig.hxx:81
int size_y
Definition: aw_xfig.hxx:87
int maxx
Definition: aw_xfig.hxx:86
AW_xfig(const char *filename, int font_width, int font_height)
Definition: AW_xfig.cxx:83
short fontsize
Definition: aw_xfig.hxx:51
short color
Definition: aw_xfig.hxx:53
double font_scale
Definition: aw_xfig.hxx:90
int miny
Definition: aw_xfig.hxx:85
~AW_xfig()
Definition: AW_xfig.cxx:436
int size_x
Definition: aw_xfig.hxx:87
int centerx
Definition: aw_xfig.hxx:88
char * aw_get_font_from_xfig(int fontnr)
struct AW_xfig_line * next
Definition: aw_xfig.hxx:36
AW_font font
Definition: aw_xfig.hxx:50
int center
Definition: aw_xfig.hxx:59
struct AW_xfig_text * text
Definition: aw_xfig.hxx:80
int centery
Definition: aw_xfig.hxx:88
int maxy
Definition: aw_xfig.hxx:86
const int XFIG_DEFAULT_FONT_WIDTH
Definition: aw_xfig.hxx:25
void create_gcs(AW_device *device, int screen_depth)
Definition: AW_xfig.cxx:504
char * text
Definition: aw_xfig.hxx:49
short x1
Definition: aw_xfig.hxx:39
void add_line(int x1, int y1, int x2, int y2, int width)
Definition: AW_xfig.cxx:533
#define NULp
Definition: cxxforward.h:97
short x
Definition: aw_xfig.hxx:58
short y0
Definition: aw_xfig.hxx:38
void print(AW_device *device)
Definition: AW_xfig.cxx:461
GB_HASH * at_pos_hash
Definition: aw_xfig.hxx:83
int minx
Definition: aw_xfig.hxx:85
struct AW_xfig_text * next
Definition: aw_xfig.hxx:45
short y1
Definition: aw_xfig.hxx:39
const int XFIG_DEFAULT_FONT_HEIGHT
Definition: aw_xfig.hxx:26