ARB
PH_display.hxx
Go to the documentation of this file.
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
45 
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 
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:
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();
92 
93 #else
94 #error PH_display.hxx included twice
95 #endif // PH_DISPLAY_HXX
const char * filter_text[]
Definition: PH_main.cxx:29
virtual void clear(AW_bitset filteri)
Definition: AW_device.cxx:313
const char * GB_ERROR
Definition: arb_core.h:25
static PH_display * ph_display
Definition: PH_display.hxx:44
void set_cursor(AW_pos x, AW_pos y)
Definition: PH_display.hxx:73
PH_display_status(AW_device *)
Definition: PH_display.cxx:289
static char * y[maxsp+1]
void writePadded(const char *, size_t len)
Definition: PH_display.cxx:315
display_type
Definition: phylo.hxx:72
void monitor_horizontal_scroll_cb(AW_window *)
Definition: PH_display.cxx:262
void set_offset(const AW::Vector &off)
Definition: aw_device.hxx:130
void move_x(AW_pos d)
Definition: PH_display.hxx:75
double AW_pos
Definition: aw_base.hxx:29
void initialize_display(display_type)
Definition: PH_display.cxx:69
void clear_window()
Definition: PH_display.hxx:50
GB_ERROR ph_check_initialized()
Definition: PH_display.cxx:39
display_type displayed()
Definition: PH_display.hxx:48
void display()
Definition: PH_display.cxx:150
void write(const char *)
Definition: PH_display.cxx:310
AW_pos get_size(char c)
Definition: PH_display.hxx:72
void resized()
Definition: PH_display.cxx:98
void reset()
Definition: AW_device.cxx:280
void ph_calc_filter_cb()
Definition: PH_display.cxx:44
void ph_view_species_cb()
Definition: PH_display.cxx:27
void set_cursor_x(AW_pos x)
Definition: PH_display.hxx:76
void monitor_vertical_scroll_cb(AW_window *)
Definition: PH_display.cxx:233