GRASS Programmer's Manual  6.4.2(2012)
display/list.c
Go to the documentation of this file.
00001 /*  Routines to manage the graphics window contents list
00002  *
00003  * D_clear_window()
00004  *     Removes all information about current window
00005  *
00006  * D_add_to_list(string)
00007  *     Adds string to growing list of screen contents.
00008  *     "string" is, by convention, a command string.
00009  *
00010  * D_get_list(list,count)
00011  *     returns the list of the commands for the maps currently displayed
00012  *
00013  * D_set_cell_name(name)
00014  *     sets the name of the cell file currently displayed
00015  *
00016  * D_get_cell_name(name)
00017  *     returns the name of the cell file currently displayed
00018  *
00019  * D_set_dig_name(name)
00020  *     sets the name of the dig file currently displayed
00021  *
00022  * D_get_dig_name(name)
00023  *     returns the name of the dig file currently displayed
00024  *
00025  * D_set_site_name(name)
00026  *     sets the name of the site_lists file currently displayed
00027  *
00028  * D_get_site_name(name)
00029  *     returns the name of the site_lists file currently displayed
00030  *
00031  * D_add_to_cell_list(name)
00032  *     adds the name of the cell file currently displayed to cell_list
00033  *
00034  * D_get_cell_list(list,count)
00035  *     returns the list of the cell_list currently displayed
00036  *
00037  * D_add_to_dig_list(name)
00038  *     adds the name of the dig file currently displayed to dig_list
00039  *
00040  * D_get_dig_list(list,count)
00041  *     returns the list of the dig_list currently displayed
00042  *
00043  * D_add_to_site_list(name)
00044  *     adds the name of the site_lists file currently displayed to site_list
00045  *
00046  * D_get_site_list(list,count)
00047  *     returns the list of the site_list currently displayed
00048  *
00049  * D_set_erase_color(color)
00050  *     sets the color name of the current erase color for the window
00051  *
00052  * D_get_erase_color(color)
00053  *     returns the current erase color name for window
00054  *
00055  */
00056 
00057 #include <string.h>
00058 #include <stdio.h>
00059 #include <grass/display.h>
00060 #include <grass/raster.h>
00061 
00062 
00076 int D_set_cell_name(const char *name)
00077 {
00078     R_pad_delete_item("cell");
00079 
00080     return (R_pad_set_item("cell", name));
00081 }
00082 
00083 
00093 int D_get_cell_name(char *name)
00094 {
00095     int stat;
00096     char **list;
00097     int count;
00098 
00099     if ((stat = R_pad_get_item("cell", &list, &count)))
00100         return (-1);
00101 
00102     strcpy(name, list[0]);
00103 
00104     R_pad_freelist(list, count);
00105     return (0);
00106 }
00107 
00108 
00119 int D_set_dig_name(const char *name)
00120 {
00121     R_pad_delete_item("dig");
00122 
00123     return (R_pad_set_item("dig", name));
00124 }
00125 
00126 
00136 int D_get_dig_name(char *name)
00137 {
00138     int stat;
00139     char **list;
00140     int count;
00141 
00142     if ((stat = R_pad_get_item("dig", &list, &count)))
00143         return (-1);
00144 
00145     strcpy(name, list[0]);
00146 
00147     R_pad_freelist(list, count);
00148     return (0);
00149 }
00150 
00151 
00152 int D_add_to_cell_list(const char *name)
00153 {
00154     return (R_pad_append_item("cell_list", name, 1));
00155 }
00156 
00157 int D_get_cell_list(char ***list, int *count)
00158 {
00159     int stat;
00160 
00161     if ((stat = R_pad_get_item("cell_list", list, count)))
00162         return (-1);
00163 
00164     return (0);
00165 }
00166 
00167 int D_add_to_dig_list(const char *name)
00168 {
00169     return (R_pad_append_item("dig_list", name, 1));
00170 }
00171 
00172 int D_get_dig_list(char ***list, int *count)
00173 {
00174     int stat;
00175 
00176     if ((stat = R_pad_get_item("dig_list", list, count)))
00177         return (-1);
00178 
00179     return (0);
00180 }
00181 
00182 
00197 int D_add_to_list(const char *string)
00198 {
00199     return (R_pad_append_item("list", string, 0));
00200 }
00201 
00202 int D_get_list(char ***list, int *count)
00203 {
00204     int stat;
00205 
00206     if ((stat = R_pad_get_item("list", list, count)))
00207         return (-1);
00208 
00209     return (0);
00210 }
00211 
00212 
00233 int D_clear_window(void)
00234 {
00235     R_pad_delete_item("list");
00236     R_pad_delete_item("cell");
00237     R_pad_delete_item("dig");
00238     R_pad_delete_item("site");
00239     R_pad_delete_item("cell_list");
00240     R_pad_delete_item("dig_list");
00241     R_pad_delete_item("site_list");
00242     R_pad_delete_item("m_win");
00243     R_pad_delete_item("erase");
00244     return 0;
00245 }
00246 
00247 int D_set_erase_color(const char *colorname)
00248 {
00249     R_pad_delete_item("erase");
00250 
00251     return (R_pad_set_item("erase", colorname));
00252 }
00253 
00254 
00255 int D_get_erase_color(char *colorname)
00256 {
00257     int stat;
00258     char **list;
00259     int count;
00260 
00261     if ((stat = R_pad_get_item("erase", &list, &count)))
00262         return (-1);
00263 
00264     strcpy(colorname, list[0]);
00265 
00266     R_pad_freelist(list, count);
00267     return (0);
00268 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines