main.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_BG);
  31. eraseframe = G_define_flag();
  32. eraseframe->key = 'f';
  33. eraseframe->description = _("Remove all frames and erase the screen");
  34. if (G_parser(argc, argv))
  35. exit(EXIT_FAILURE);
  36. if (D_open_driver() != 0)
  37. G_fatal_error(_("No graphics device selected. "
  38. "Use d.mon to select graphics device."));
  39. D_setup_unity(0);
  40. D_erase(color->answer);
  41. if (eraseframe->answer)
  42. D__erase();
  43. D_save_command(NULL);
  44. D_close_driver();
  45. exit(EXIT_SUCCESS);
  46. }