29 #include <grass/gis.h>
30 #include <grass/raster.h>
31 #include <grass/display.h>
80 int D_popup(
int back_colr,
int text_colr,
int div_colr,
81 int top,
int left,
int percent_per_line,
char *options[])
97 for (n_options = 0; options[n_options] !=
NULL; n_options++) {
98 len = strlen(options[n_options]);
106 dots_per_line = height * percent_per_line / 100;
107 dots_per_char = width / (max_len + 2);
114 text_size = (int)(.8 * (
float)dots_per_line);
115 if (text_size > dots_per_char)
116 text_size = dots_per_char;
118 text_raise = (dots_per_line - text_size + 1) / 2;
121 b =
Y_BORDER + t + dots_per_line * n_options;
122 r = 2 *
X_BORDER + l + text_size * max_len;
146 fprintf(stderr,
"ERROR:\n");
147 fprintf(stderr,
"popup window too big horizontally\n");
148 fprintf(stderr,
"to fit into the graphics window.\n");
149 fprintf(stderr,
"Widen the graphics window.");
150 fprintf(stderr,
"\nExiting...\n");
177 for (opt = 1; opt <= n_options; opt++) {
178 if (opt != n_options) {
185 t +
Y_BORDER + opt * dots_per_line - text_raise);
199 || x < l || y < t + Y_BORDER + dots_per_line || y > b -
Y_BORDER)
203 if (n % dots_per_line == 0)
208 return (n / dots_per_line);