main.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. ****************************************************************************
  3. *
  4. * MODULE: d.erase
  5. * AUTHOR(S): James Westervelt - USA CERL
  6. * PURPOSE: Erase the current display frame with user defined color.
  7. * COPYRIGHT: (C) 2000, 2011 by the GRASS Development Team
  8. *
  9. * This program is free software under the GNU General Public
  10. * License (>=v2). Read the file COPYING that comes with GRASS
  11. * for details.
  12. *
  13. *****************************************************************************/
  14. #include <stdlib.h>
  15. #include <grass/gis.h>
  16. #include <grass/display.h>
  17. #include <grass/glocale.h>
  18. int main(int argc, char *argv[])
  19. {
  20. struct Option *color;
  21. struct Flag *eraseframe;
  22. struct GModule *module;
  23. G_gisinit(argv[0]);
  24. module = G_define_module();
  25. G_add_keyword(_("display"));
  26. G_add_keyword(_("graphics"));
  27. G_add_keyword(_("monitors"));
  28. module->description =
  29. _("Erases the contents of the active graphics display frame with user defined color.");
  30. color = G_define_standard_option(G_OPT_C);
  31. color->key = "bgcolor";
  32. color->label = _("Background color");
  33. color->answer = DEFAULT_BG_COLOR;
  34. eraseframe = G_define_flag();
  35. eraseframe->key = 'f';
  36. eraseframe->description = _("Remove all frames and erase the screen");
  37. if (G_parser(argc, argv))
  38. exit(EXIT_FAILURE);
  39. D_open_driver();
  40. D_setup_unity(0);
  41. D_erase(color->answer);
  42. if (eraseframe->answer)
  43. D__erase();
  44. D_save_command(NULL);
  45. D_close_driver();
  46. exit(EXIT_SUCCESS);
  47. }