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 * 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;
122 b =
Y_BORDER + t + (dots_per_line * n_options) + 1;
123 r = 2 *
X_BORDER + l + (text_size * 0.8) * max_len;
147 fprintf(stderr,
"ERROR:\n");
148 fprintf(stderr,
"popup window too big horizontally\n");
149 fprintf(stderr,
"to fit into the graphics window.\n");
150 fprintf(stderr,
"Widen the graphics window.");
151 fprintf(stderr,
"\nExiting...\n");
178 for (opt = 1; opt <= n_options; opt++) {
179 if (opt != n_options) {
186 t +
Y_BORDER + opt * dots_per_line - text_raise);
200 || y < t + Y_BORDER + dots_per_line || y > b -
Y_BORDER)
204 if (n % dots_per_line == 0)
211 return (n / dots_per_line);
void R_flush(void)
flush graphics
void R_panel_save(const char *name, int t, int b, int l, int r)
void R_panel_restore(const char *name)
int R_screen_bot(void)
bottom of screen
void R_box_abs(int x1, int y1, int x2, int y2)
fill a box
void R_standard_color(int index)
select standard color
char * G_tempfile(void)
Returns a temporary file name.
void R_panel_delete(const char *name)
int R_screen_rite(void)
screen right edge
void R_text(const char *text)
write text
void R_cont_abs(int x, int y)
draw line
int R_screen_left(void)
screen left edge
void R_move_abs(int x, int y)
move current location
int R_screen_top(void)
top of screen
void R_text_size(int width, int height)
set text size
void R_get_location_with_pointer(int *wx, int *wy, int *button)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
void R_set_window(int t, int b, int l, int r)
set text clipping frame
void R_cont_rel(int x, int y)
draw line