GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
loc_io.c
Go to the documentation of this file.
1 
2 #include <grass/config.h>
3 
4 #include <errno.h>
5 #include <signal.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 
11 #include <grass/gis.h>
12 #include <grass/glocale.h>
13 #include <grass/raster.h>
14 #include <grass/graphics.h>
15 
16 #include "driver.h"
17 #include "transport.h"
18 #include "open.h"
19 #include "pad.h"
20 
21 extern const struct driver *PNG_Driver(void);
22 extern const struct driver *PS_Driver(void);
23 
24 static void LOC_init(void)
25 {
26  const char *name = "full_screen";
27  const char *fenc = getenv("GRASS_ENCODING");
28  const char *font = getenv("GRASS_FONT");
29  int t = R_screen_top();
30  int b = R_screen_bot();
31  int l = R_screen_left();
32  int r = R_screen_rite();
33  char buff[256];
34 
35  R_font(font ? font : "romans");
36 
37  if (fenc)
38  R_charset(fenc);
39 
40  R_pad_select("");
41  R_pad_set_item("time", "1");
42  R_pad_set_item("cur_w", name);
43 
44  R_pad_create(name);
45  R_pad_select(name);
46  R_pad_set_item("time", "1");
47 
48  sprintf(buff, "%d %d %d %d", t, b, l, r);
49  R_pad_set_item("d_win", buff);
50 
51  R_set_window(t, b, l, r);
52 }
53 
54 int LOC_open_driver(void)
55 {
56  const char *p = getenv("GRASS_RENDER_IMMEDIATE");
57  const struct driver *drv = (p && G_strcasecmp(p, "PS") == 0)
58  ? PS_Driver()
59  : PNG_Driver();
60 
61  LIB_init(drv, 0, NULL);
62 
63  LOC_init();
64 
66 
67  return OK;
68 }
69 
70 int LOC__open_quiet(void)
71 {
72  return 0;
73 }
74 
75 void LOC_stabilize(void)
76 {
77  COM_Respond();
78 }
79 
80 void LOC_kill_driver(void)
81 {
83 }
84 
85 void LOC_close_driver(void)
86 {
87  LOC_stabilize();
90 }
91 
93 {
94  LOC_stabilize();
96 }
int LOC_open_driver(void)
Definition: loc_io.c:54
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower)
Definition: strings.c:192
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void LOC_stabilize(void)
Definition: loc_io.c:75
int LIB_init(const struct driver *drv, int argc, char **argv)
Definition: driver/init.c:46
int l
Definition: dataquad.c:292
float b
Definition: named_colr.c:8
int R_screen_bot(void)
bottom of screen
Definition: com_proto.c:52
void COM_Client_Open(void)
Definition: driver/Client.c:4
string name
Definition: render.py:1314
void COM_Graph_close(void)
Definition: driver/Graph.c:11
void COM_Client_Close(void)
Definition: driver/Client.c:10
float r
Definition: named_colr.c:8
void LOC_release_driver(void)
Definition: loc_io.c:92
int R_pad_set_item(const char *name, const char *value)
Definition: com_pad.c:69
int R_screen_rite(void)
screen right edge
Definition: com_proto.c:38
char * getenv()
struct driver * PS_Driver(void)
char buff[1024]
Definition: g3dcats.c:89
void R_charset(const char *name)
Definition: com_proto.c:485
struct driver * PNG_Driver(void)
int R_screen_left(void)
screen left edge
Definition: com_proto.c:24
int R_screen_top(void)
top of screen
Definition: com_proto.c:67
void R_font(const char *name)
choose font
Definition: com_proto.c:480
#define OK
Definition: plot.c:384
int R_pad_select(const char *pad)
Definition: com_pad.c:44
void COM_Respond(void)
Definition: driver/Respond.c:5
return NULL
Definition: dbfopen.c:1394
Definition: driver.h:25
void LOC_kill_driver(void)
Definition: loc_io.c:80
void R_set_window(int t, int b, int l, int r)
set text clipping frame
Definition: com_proto.c:406
int R_pad_create(const char *pad)
Definition: com_pad.c:19
int LOC__open_quiet(void)
Definition: loc_io.c:70
void LOC_close_driver(void)
Definition: loc_io.c:85