source: tags/arb-6.0/PHYLO/PH_display.hxx

Last change on this file was 11231, checked in by westram, 10 years ago
  • removed debug code
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
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
20extern char **filter_text;
21
22class 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_horiz;
34    long total_cells_vert;
35    display_type display_what;
36    long horiz_page_size;                // page size in cells (how many cells per page,
37    long vert_page_size;                 // vertical and horizontal)
38    long off_dx;                         // offset values for devic.shift_dx(y)
39    long off_dy;
40
41    void set_scrollbar_steps(AW_window *, long, long, long, long);
42
43public:
44    PH_display();                   // constructor
45    static PH_display *ph_display;
46    void initialize(display_type);
47    void display();                      // display data (according to display type: matrix ...)
48    display_type displayed() { return display_what; };
49    void clear_window() { if (device) device->clear(-1); };
50    void resized();                      // call after resize main window
51    void monitor_vertical_scroll_cb(AW_window *);    // vertical and horizontal
52    void monitor_horizontal_scroll_cb(AW_window *);  // scrollbar movements
53};
54
55
56class PH_display_status
57{
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
67public:
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    void move_x(AW_pos d) { x_pos += (x_pos+d<=max_x) ? d : 0; }
75    void move_y(AW_pos d) { y_pos+=(y_pos+d<=max_y) ? d : 0; }
76    void set_cursor_x(AW_pos x) { x_pos = x; }
77    void set_cursor_y(AW_pos y) { y_pos = y; }
78    AW_pos get_cursor_pos(char c) { return ((c=='x') ? x_pos : y_pos); }
79    void set_tab() { tab_pos = x_pos; }
80    AW_pos get_tab() { return tab_pos; }
81
82    void write(const char *);   // text to write
83    void writePadded(const char *, size_t len);   // write text padded
84    void write(long);           // converts long
85    void write(double);         // float to text
86    void clear();
87};
88
89
90void ph_view_species_cb();
91void ph_view_filter_cb();
92GB_ERROR ph_check_initialized();
93
94#else
95#error PH_display.hxx included twice
96#endif // PH_DISPLAY_HXX
Note: See TracBrowser for help on using the repository browser.