2
#include <grass/display.h>
3
#include <grass/raster.h>
5
static View *makeview(double bottom, double top, double left, double right)
9
view = (View *) G_malloc(sizeof(View));
12
bottom = 100 - bottom;
14
view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
15
view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
16
view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
17
view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
19
if (view->top < SCREEN_TOP)
20
view->top = SCREEN_TOP;
21
if (view->bottom > SCREEN_BOTTOM)
22
view->bottom = SCREEN_BOTTOM;
23
if (view->left < SCREEN_LEFT)
24
view->left = SCREEN_LEFT;
25
if (view->right > SCREEN_RIGHT)
26
view->right = SCREEN_RIGHT;
28
Outline_box(view->top, view->bottom, view->left, view->right);
35
view->nrows = view->bottom - view->top + 1;
36
view->ncols = view->right - view->left + 1;
37
view->cell.configured = 0;
42
int Init_graphics(void)
47
SCREEN_TOP = R_screen_top();
48
SCREEN_BOTTOM = R_screen_bot();
49
SCREEN_LEFT = R_screen_left();
50
SCREEN_RIGHT = R_screen_rite();
52
R_standard_color(WHITE);
54
VIEW_TITLE1 = makeview(97.5, 100.0, 0.0, 50.0);
55
VIEW_TITLE2 = makeview(97.5, 100.0, 50.0, 100.0);
56
VIEW_MAP1 = makeview(51.0, 97.5, 0.0, 50.0);
57
VIEW_MAP2 = makeview(51.0, 97.5, 50.0, 100.0);
58
VIEW_TITLE1_ZOOM = makeview(47.5, 51.0, 0.0, 50.0);
59
VIEW_TITLE2_ZOOM = makeview(47.5, 51.0, 50.0, 100.0);
60
VIEW_MAP1_ZOOM = makeview(2.5, 47.5, 0.0, 50.0);
61
VIEW_MAP2_ZOOM = makeview(2.5, 47.5, 50.0, 100.0);
62
VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
64
G_init_colors(&VIEW_MAP1->cell.colors);
65
G_init_colors(&VIEW_MAP2->cell.colors);
70
int Outline_box(int top, int bottom, int left, int right)
72
R_move_abs(left, top);
73
R_cont_abs(left, bottom);
74
R_cont_abs(right, bottom);
75
R_cont_abs(right, top);
76
R_cont_abs(left, top);
82
int Text_width(char *text)
84
int top, bottom, left, right;
86
R_get_text_box(text, &top, &bottom, &left, &right);
89
return right - left + 1;
91
return left - right + 1;
94
int Text(char *text, int top, int bottom, int left, int right, int edge)
96
R_set_window(top, bottom, left, right);
97
R_move_abs(left + edge, bottom - edge);
99
R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
104
int Uparrow(int top, int bottom, int left, int right)
106
R_move_abs((left + right) / 2, bottom);
107
R_cont_abs((left + right) / 2, top);
108
R_cont_rel((left - right) / 2, (bottom - top) / 2);
109
R_move_abs((left + right) / 2, top);
110
R_cont_rel((right - left) / 2, (bottom - top) / 2);
115
int Downarrow(int top, int bottom, int left, int right)
117
R_move_abs((left + right) / 2, top);
118
R_cont_abs((left + right) / 2, bottom);
119
R_cont_rel((left - right) / 2, (top - bottom) / 2);
120
R_move_abs((left + right) / 2, bottom);
121
R_cont_rel((right - left) / 2, (top - bottom) / 2);