source: tags/arb-6.0-rc1/WINDOW/aw_xfig.hxx

Last change on this file was 11021, checked in by westram, 12 years ago
  • remove class init via memset (arb_prm_struct + AW_xfig)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
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
25const int XFIG_DEFAULT_FONT_WIDTH  = 8;
26const int XFIG_DEFAULT_FONT_HEIGHT = 13;
27
28const int MAX_LINE_WIDTH  = 20;
29const int MAX_XFIG_LENGTH = 100000;
30
31class AW_device;
32
33char *aw_get_font_from_xfig(int fontnr);
34
35struct 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
44struct AW_xfig_text {
45    struct AW_xfig_text *next;
46
47    short    x, y;
48    short    pix_len;
49    char    *text;
50    AW_font  font;
51    short    fontsize;
52    int      center;
53    short    color;
54    int      gc;
55};
56
57struct AW_xfig_pos {
58    short x, y;
59    int   center;
60};
61
62class 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        = NULL;
67        at_pos_hash = NULL;
68
69        memset(line, 0, sizeof(line));
70
71        minx = 0; maxx = 0; centerx = 0;
72        miny = 0; maxy = 0; centery = 0;
73
74        calc_scaling(font_width, font_height);
75    }
76
77public:
78    struct AW_xfig_text *text;
79    struct AW_xfig_line *line[MAX_LINE_WIDTH];
80
81    GB_HASH *at_pos_hash;                         // hash table for named positions
82
83    int minx, miny;
84    int maxx, maxy;
85    int size_x, size_y;
86    int centerx, centery;
87
88    double font_scale;
89    double dpi_scale;
90
91    AW_xfig(const char *filename, int font_width, int font_height);
92    AW_xfig(int font_width, int font_height);      // creates an empty drawing area
93
94    ~AW_xfig();
95    void print(AW_device *device); // you can scale it
96    void create_gcs(AW_device *device, int screen_depth); // create the gcs
97
98    void add_line(int x1, int y1, int x2, int y2, int width); // add a line to xfig
99};
100
101
102/* xfig format ::
103
104text::
105
1064 0 font(-1== default) fontsize depth color  ?? angle justified(4=left) flags width x y text^A
107
108lines::
109
1102 art depth width color ....
111x y x y 9999 9999
112
113*/
114
115#else
116#error aw_xfig.hxx included twice
117#endif // AW_XFIG_HXX
Note: See TracBrowser for help on using the repository browser.