1 | // =========================================================== // |
---|
2 | // // |
---|
3 | // File : PH_display.hxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =========================================================== // |
---|
10 | |
---|
11 | #ifndef PH_DISPLAY_HXX |
---|
12 | #define PH_DISPLAY_HXX |
---|
13 | |
---|
14 | #ifndef AW_DEVICE_HXX |
---|
15 | #include <aw_device.hxx> |
---|
16 | #endif |
---|
17 | |
---|
18 | #define SPECIES_NAME_LEN 10 // only for displaying speciesnames |
---|
19 | |
---|
20 | extern const char *filter_text[]; |
---|
21 | |
---|
22 | class PH_display { |
---|
23 | AW_device *device; // device to draw in |
---|
24 | AW_pos screen_width; // dimensions of main screen |
---|
25 | AW_pos screen_height; |
---|
26 | long cell_width; // width and height of one cell |
---|
27 | long cell_height; |
---|
28 | long cell_offset; // don't write on base line of cell |
---|
29 | long horiz_page_start; // number of first element in this page |
---|
30 | long vert_page_start; |
---|
31 | long vert_last_view_start; // last value of scrollbars |
---|
32 | long horiz_last_view_start; |
---|
33 | long total_cells_vert; |
---|
34 | display_type display_what; |
---|
35 | long horiz_page_size; // page size in cells (how many cells per page, |
---|
36 | long vert_page_size; // vertical and horizontal) |
---|
37 | long off_dx; // offset values for devic.shift_dx(y) |
---|
38 | long off_dy; |
---|
39 | |
---|
40 | void set_scrollbar_steps(AW_window *, long, long, long, long); |
---|
41 | |
---|
42 | public: |
---|
43 | PH_display(); // constructor |
---|
44 | static PH_display *ph_display; |
---|
45 | |
---|
46 | void initialize_display(display_type); |
---|
47 | void display(); // display data (according to display_type) |
---|
48 | display_type displayed() { return display_what; }; |
---|
49 | |
---|
50 | void clear_window() { if (device) device->clear(-1); }; |
---|
51 | void resized(); // call after resize main window |
---|
52 | void monitor_vertical_scroll_cb(AW_window *); // vertical and horizontal |
---|
53 | void monitor_horizontal_scroll_cb(AW_window *); // scrollbar movements |
---|
54 | }; |
---|
55 | |
---|
56 | |
---|
57 | class PH_display_status { |
---|
58 | AW_device *device; |
---|
59 | short font_width; |
---|
60 | short font_height; |
---|
61 | AW_pos max_x; // screensize |
---|
62 | AW_pos max_y; |
---|
63 | AW_pos x_pos; // position of cursor |
---|
64 | AW_pos y_pos; |
---|
65 | AW_pos tab_pos; |
---|
66 | |
---|
67 | public: |
---|
68 | PH_display_status(AW_device *); |
---|
69 | |
---|
70 | void set_origin() { device->reset(); device->set_offset(AW::Vector(font_width, font_height)); } |
---|
71 | void newline() { x_pos = 0; y_pos+=(y_pos>=max_y) ? 0.0 : 1.0; } |
---|
72 | AW_pos get_size(char c) { return (c=='x') ? max_x : max_y; } |
---|
73 | void set_cursor(AW_pos x, AW_pos y) { x_pos = (x<=max_x) ? x : x_pos; y_pos=(y<=max_y) ? y : y_pos; } |
---|
74 | |
---|
75 | void move_x(AW_pos d) { x_pos += (x_pos+d<=max_x) ? d : 0; } |
---|
76 | void set_cursor_x(AW_pos x) { x_pos = x; } |
---|
77 | |
---|
78 | void set_tab() { tab_pos = x_pos; } |
---|
79 | AW_pos get_tab() { return tab_pos; } |
---|
80 | |
---|
81 | void write(const char *); // text to write |
---|
82 | void writePadded(const char *, size_t len); // write text padded |
---|
83 | void write(long); // converts long |
---|
84 | |
---|
85 | void clear(); |
---|
86 | }; |
---|
87 | |
---|
88 | |
---|
89 | void ph_view_species_cb(); |
---|
90 | void ph_calc_filter_cb(); |
---|
91 | GB_ERROR ph_check_initialized(); |
---|
92 | |
---|
93 | #else |
---|
94 | #error PH_display.hxx included twice |
---|
95 | #endif // PH_DISPLAY_HXX |
---|