2
#include <grass/display.h>
3
#include <grass/raster.h>
6
static View *makeview(double bottom, double top, double left, double right)
10
view = (View *) G_malloc(sizeof(View));
13
bottom = 100 - bottom;
15
view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
16
view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
17
view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
18
view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
20
if (view->top < SCREEN_TOP)
21
view->top = SCREEN_TOP;
22
if (view->bottom > SCREEN_BOTTOM)
23
view->bottom = SCREEN_BOTTOM;
24
if (view->left < SCREEN_LEFT)
25
view->left = SCREEN_LEFT;
26
if (view->right > SCREEN_RIGHT)
27
view->right = SCREEN_RIGHT;
29
Outline_box(view->top, view->bottom, view->left, view->right);
36
view->nrows = view->bottom - view->top + 1;
37
view->ncols = view->right - view->left + 1;
38
view->cell.configured = 0;
43
int Init_graphics(void)
48
SCREEN_TOP = R_screen_top();
49
SCREEN_BOTTOM = R_screen_bot();
50
SCREEN_LEFT = R_screen_left();
51
SCREEN_RIGHT = R_screen_rite();
54
BLACK = D_translate_color("black");
55
BLUE = D_translate_color("blue");
56
BROWN = D_translate_color("brown");
57
GREEN = D_translate_color("green");
58
GREY = D_translate_color("grey");
59
ORANGE = D_translate_color("orange");
60
PURPLE = D_translate_color("purple");
61
RED = D_translate_color("red");
62
WHITE = D_translate_color("white");
63
YELLOW = D_translate_color("yellow");
65
R_standard_color(WHITE);
67
VIEW_TITLE1 = makeview(97.5, 100.0, 0.0, 50.0);
68
VIEW_MAP1 = makeview(51.0, 97.5, 0.0, 50.0);
69
VIEW_TITLE1_ZOOM = makeview(97.5, 100.0, 50.0, 100.0);
70
VIEW_MAP1_ZOOM = makeview(51.0, 97.5, 50.0, 100.0);
71
VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
73
G_init_colors(&VIEW_MAP1->cell.colors);
78
int Outline_box(int top, int bottom, int left, int right)
80
R_move_abs(left, top);
81
R_cont_abs(left, bottom);
82
R_cont_abs(right, bottom);
83
R_cont_abs(right, top);
84
R_cont_abs(left, top);
90
int Text_width(char *text)
92
int top, bottom, left, right;
94
R_get_text_box(text, &top, &bottom, &left, &right);
97
return right - left + 1;
99
return left - right + 1;
102
int Text(char *text, int top, int bottom, int left, int right, int the_border)
104
R_set_window(top, bottom, left, right);
105
R_move_abs(left + the_border, bottom - the_border);
107
R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
112
int Uparrow(int top, int bottom, int left, int right)
114
R_move_abs((left + right) / 2, bottom);
115
R_cont_abs((left + right) / 2, top);
116
R_cont_rel((left - right) / 2, (bottom - top) / 2);
117
R_move_abs((left + right) / 2, top);
118
R_cont_rel((right - left) / 2, (bottom - top) / 2);
123
int Downarrow(int top, int bottom, int left, int right)
125
R_move_abs((left + right) / 2, top);
126
R_cont_abs((left + right) / 2, bottom);
127
R_cont_rel((left - right) / 2, (top - bottom) / 2);
128
R_move_abs((left + right) / 2, bottom);
129
R_cont_rel((right - left) / 2, (top - bottom) / 2);