-
Notifications
You must be signed in to change notification settings - Fork 1
/
timestamps.c
76 lines (53 loc) · 1.66 KB
/
timestamps.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
-------------------------------------------------------------------------
OBJECT NAME: timestamps.c
FULL NAME: Time Stamps for XY & XYZ plots
ENTRY POINTS: PlotTimeStamps()
ToggleTimeStamps()
STATIC FNS: none
DESCRIPTION:
COPYRIGHT: University Corporation for Atmospheric Research, 1997-2022
-------------------------------------------------------------------------
*/
#include "define.h"
#include "ps.h"
#include <Xm/TextF.h>
/* -------------------------------------------------------------------- */
void ToggleTimeStamps(Widget w, XtPointer client, XtPointer call)
{
char *p = XmTextFieldGetString(w);
nTimeStamps = atoi(p);
XtFree(p);
if (nTimeStamps > 0)
--nTimeStamps;
DrawMainWindow();
} /* END TOGGLETIMESTAMPS */
/* -------------------------------------------------------------------- */
void PlotTimeStamps(PLOT_INFO *plot, int x, int y, int cnt, FILE *fp)
{
if (nTimeStamps <= 0)
return;
MakeTimeTicLabel(buffer, cnt, nTimeStamps);
if (fp) /* PostScript */
{
fprintf(fp, "gsave\n");
if (printerSetup.color)
fprintf(fp, "stroke 0 0 0 setrgbcolor\n");
else
fprintf(fp, "stroke [] 0 setdash\n");
fprintf(fp, moveto, x, y);
fprintf(fp, lineto, x+20, y);
fprintf(fp, moveto, x+25, y-10);
fprintf(fp, show, buffer);
fprintf(fp, "stroke grestore\n");
}
else
{
XSetForeground(plot->dpy, plot->gc, GetColor(0));
XDrawLine(plot->dpy, plot->win, plot->gc, x, y, x+8, y);
XDrawString(plot->dpy, plot->win, plot->gc, x+10, y+4,
buffer, strlen(buffer));
XSetForeground(plot->dpy, plot->gc, CurrentColor());
}
} /* END PLOTTIMESTAMPS */
/* END TIMESTAMPS.C */