1 #if HAVE_CONFIG_H
2 #   include "config.h"
3 #endif
4 
5 /*  This module contains the functions for displaying the access color map
6     that appears on the right side of the display window
7 */
8 
9 #include "xregion.h"
10 
DrawColorMap()11 void DrawColorMap()
12 {
13 /* Actually fill in the colors */
14 int i, black = 1;
15 unsigned width = 20, height = 350 / MAX_COL;
16 int x, y, length,index;
17 XColor color;
18 
19   for (i=0,y=0,x=0;i<MAX_COL;i++)
20   {
21     index = (animation==False && i==0)? MAX_COL : i;
22     XSetForeground(display, gc_map, (unsigned long) cmap[index]);
23     XFillRectangle(display,window_map,gc_map,x,y,width,height);
24     y += height;
25     /* XSetForeground(display, gc_map, (unsigned long) cmap[index]);*/
26   }
27 }
28 
29 
PrintColorMapText()30 void PrintColorMapText()
31 {
32 /* Print Legend numbers */
33 int i;
34 unsigned width = 20, height = 350 / MAX_COL;
35 int x, y, length;
36 char string[9];
37 double factor, intval;
38 int formatE;
39 
40   XSetForeground(display, gc_map, DEFAULT_FG);
41 
42   x = width+4;
43   y = 0;
44   factor  = maxval/(MAX_COL);
45   formatE = (maxval >= 10. || maxval < .001) ? 1 : 0;
46   for (i=0;i<MAX_COL;i++)
47   {
48     y += height;
49     if(animation)
50     {
51       sprintf(string,"%2d",i);
52     }
53     else
54     {
55       intval = factor*i;
56       if(formatE)
57       {
58         sprintf(string,"%5.1e",intval);
59       }
60       else
61       {
62         sprintf(string,"%6.4f",intval);
63       }
64     }
65     length = strlen(string);
66     XDrawString(display,window_map,gc_map,x,y-2,string, length);
67   }
68 }
69 
70