GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
display/list.c
Go to the documentation of this file.
1 /* Routines to manage the graphics window contents list
2  *
3  * D_clear_window()
4  * Removes all information about current window
5  *
6  * D_add_to_list(string)
7  * Adds string to growing list of screen contents.
8  * "string" is, by convention, a command string.
9  *
10  * D_get_list(list,count)
11  * returns the list of the commands for the maps currently displayed
12  *
13  * D_set_cell_name(name)
14  * sets the name of the cell file currently displayed
15  *
16  * D_get_cell_name(name)
17  * returns the name of the cell file currently displayed
18  *
19  * D_set_dig_name(name)
20  * sets the name of the dig file currently displayed
21  *
22  * D_get_dig_name(name)
23  * returns the name of the dig file currently displayed
24  *
25  * D_set_site_name(name)
26  * sets the name of the site_lists file currently displayed
27  *
28  * D_get_site_name(name)
29  * returns the name of the site_lists file currently displayed
30  *
31  * D_add_to_cell_list(name)
32  * adds the name of the cell file currently displayed to cell_list
33  *
34  * D_get_cell_list(list,count)
35  * returns the list of the cell_list currently displayed
36  *
37  * D_add_to_dig_list(name)
38  * adds the name of the dig file currently displayed to dig_list
39  *
40  * D_get_dig_list(list,count)
41  * returns the list of the dig_list currently displayed
42  *
43  * D_add_to_site_list(name)
44  * adds the name of the site_lists file currently displayed to site_list
45  *
46  * D_get_site_list(list,count)
47  * returns the list of the site_list currently displayed
48  *
49  * D_set_erase_color(color)
50  * sets the color name of the current erase color for the window
51  *
52  * D_get_erase_color(color)
53  * returns the current erase color name for window
54  *
55  */
56 
57 #include <string.h>
58 #include <stdio.h>
59 #include <grass/display.h>
60 #include <grass/raster.h>
61 
62 
76 int D_set_cell_name(const char *name)
77 {
78  R_pad_delete_item("cell");
79 
80  return (R_pad_set_item("cell", name));
81 }
82 
83 
94 {
95  int stat;
96  char **list;
97  int count;
98 
99  if ((stat = R_pad_get_item("cell", &list, &count)))
100  return (-1);
101 
102  strcpy(name, list[0]);
103 
104  R_pad_freelist(list, count);
105  return (0);
106 }
107 
108 
119 int D_set_dig_name(const char *name)
120 {
121  R_pad_delete_item("dig");
122 
123  return (R_pad_set_item("dig", name));
124 }
125 
126 
137 {
138  int stat;
139  char **list;
140  int count;
141 
142  if ((stat = R_pad_get_item("dig", &list, &count)))
143  return (-1);
144 
145  strcpy(name, list[0]);
146 
147  R_pad_freelist(list, count);
148  return (0);
149 }
150 
151 
152 int D_add_to_cell_list(const char *name)
153 {
154  return (R_pad_append_item("cell_list", name, 1));
155 }
156 
157 int D_get_cell_list(char ***list, int *count)
158 {
159  int stat;
160 
161  if ((stat = R_pad_get_item("cell_list", list, count)))
162  return (-1);
163 
164  return (0);
165 }
166 
167 int D_add_to_dig_list(const char *name)
168 {
169  return (R_pad_append_item("dig_list", name, 1));
170 }
171 
172 int D_get_dig_list(char ***list, int *count)
173 {
174  int stat;
175 
176  if ((stat = R_pad_get_item("dig_list", list, count)))
177  return (-1);
178 
179  return (0);
180 }
181 
182 
197 int D_add_to_list(const char *string)
198 {
199  return (R_pad_append_item("list", string, 0));
200 }
201 
202 int D_get_list(char ***list, int *count)
203 {
204  int stat;
205 
206  if ((stat = R_pad_get_item("list", list, count)))
207  return (-1);
208 
209  return (0);
210 }
211 
212 
233 int D_clear_window(void)
234 {
235  R_pad_delete_item("list");
236  R_pad_delete_item("cell");
237  R_pad_delete_item("dig");
238  R_pad_delete_item("site");
239  R_pad_delete_item("cell_list");
240  R_pad_delete_item("dig_list");
241  R_pad_delete_item("site_list");
242  R_pad_delete_item("m_win");
243  R_pad_delete_item("erase");
244  return 0;
245 }
246 
247 int D_set_erase_color(const char *colorname)
248 {
249  R_pad_delete_item("erase");
250 
251  return (R_pad_set_item("erase", colorname));
252 }
253 
254 
255 int D_get_erase_color(char *colorname)
256 {
257  int stat;
258  char **list;
259  int count;
260 
261  if ((stat = R_pad_get_item("erase", &list, &count)))
262  return (-1);
263 
264  strcpy(colorname, list[0]);
265 
266  R_pad_freelist(list, count);
267  return (0);
268 }
int D_get_cell_name(char *name)
retrieve raster map name
Definition: display/list.c:93
string name
Definition: render.py:1314
int D_get_cell_list(char ***list, int *count)
Definition: display/list.c:157
int D_get_erase_color(char *colorname)
Definition: display/list.c:255
int count
int R_pad_set_item(const char *name, const char *value)
Definition: com_pad.c:69
int D_clear_window(void)
clears information about current frame
Definition: display/list.c:233
int stat
Definition: g3dcolor.c:369
int D_set_erase_color(const char *colorname)
Definition: display/list.c:247
int D_add_to_dig_list(const char *name)
Definition: display/list.c:167
int R_pad_delete_item(const char *name)
Definition: com_pad.c:54
int D_get_list(char ***list, int *count)
Definition: display/list.c:202
int D_get_dig_name(char *name)
retrieve vector map name
Definition: display/list.c:136
int D_add_to_list(const char *string)
add command to frame display list
Definition: display/list.c:197
void R_pad_freelist(char **list, int count)
Definition: common.c:56
int D_add_to_cell_list(const char *name)
Definition: display/list.c:152
int D_get_dig_list(char ***list, int *count)
Definition: display/list.c:172
int R_pad_append_item(const char *item, const char *value, int replace)
Definition: com_pad.c:49
int D_set_dig_name(const char *name)
add vector map name to display list
Definition: display/list.c:119
int D_set_cell_name(const char *name)
add raster map name to display list
Definition: display/list.c:76
int R_pad_get_item(const char *name, char ***list, int *count)
Definition: com_pad.c:59