title.c 889 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include <grass/display.h>
  2. #include "globals.h"
  3. #include "local_proto.h"
  4. int display_title(View * view)
  5. {
  6. View *title;
  7. char left[100], center[100];
  8. int size;
  9. double magnification();
  10. *left = 0;
  11. *center = 0;
  12. if (view->cell.configured) {
  13. sprintf(center, "%s (mag %.1f)",
  14. view->cell.name, magnification(view));
  15. }
  16. if (view == VIEW_MAP1) {
  17. sprintf(left, "%s", G_location());
  18. title = VIEW_TITLE1;
  19. }
  20. else if (view == VIEW_MAP1_ZOOM) {
  21. title = VIEW_TITLE1_ZOOM;
  22. }
  23. Erase_view(title);
  24. R_standard_color(BLACK);
  25. size = title->nrows - 4;
  26. R_text_size(size, size);
  27. Text(left, title->top, title->bottom, title->left, title->right, 2);
  28. if (*center) {
  29. R_standard_color(RED);
  30. Text(center, title->top, title->bottom,
  31. (title->left + title->right - Text_width(center)) / 2,
  32. title->right, 2);
  33. }
  34. return 0;
  35. }