aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/gtools/gtswind.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/xtools/gtools/gtswind.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/xtools/gtools/gtswind.x')
-rw-r--r--pkg/xtools/gtools/gtswind.x65
1 files changed, 65 insertions, 0 deletions
diff --git a/pkg/xtools/gtools/gtswind.x b/pkg/xtools/gtools/gtswind.x
new file mode 100644
index 00000000..02766326
--- /dev/null
+++ b/pkg/xtools/gtools/gtswind.x
@@ -0,0 +1,65 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <gset.h>
+include <mach.h>
+include "gtools.h"
+
+# GT_SWIND -- Set graphics window.
+
+procedure gt_swind (gp, gt)
+
+pointer gp # GIO pointer
+pointer gt # GTOOLS pointer
+
+real xmin, xmax, dx, ymin, ymax, dy
+
+begin
+ if (gt != NULL) {
+ if (GT_TRANSPOSE(gt) == NO) {
+ call gseti (gp, G_XTRAN, GT_XTRAN(gt))
+ call gseti (gp, G_YTRAN, GT_YTRAN(gt))
+ } else {
+ call gseti (gp, G_YTRAN, GT_XTRAN(gt))
+ call gseti (gp, G_XTRAN, GT_YTRAN(gt))
+ }
+ call ggwind (gp, xmin, xmax, ymin, ymax)
+ dx = xmax - xmin
+ dy = ymax - ymin
+
+ if (IS_INDEF (GT_XMIN(gt)))
+ xmin = xmin - GT_XBUF(gt) * dx
+ else
+ xmin = GT_XMIN(gt)
+
+ if (IS_INDEF (GT_XMAX(gt)))
+ xmax = xmax + GT_XBUF(gt) * dx
+ else
+ xmax = GT_XMAX(gt)
+
+ if (IS_INDEF (GT_YMIN(gt)))
+ ymin = ymin - GT_YBUF(gt) * dy
+ else
+ ymin = GT_YMIN(gt)
+
+ if (IS_INDEF (GT_YMAX(gt)))
+ ymax = ymax + GT_YBUF(gt) * dy
+ else
+ ymax = GT_YMAX(gt)
+
+ if (GT_XFLIP(gt) == YES) {
+ dx = xmin
+ xmin = xmax
+ xmax = dx
+ }
+ if (GT_YFLIP(gt) == YES) {
+ dy = ymin
+ ymin = ymax
+ ymax = dy
+ }
+
+ if (GT_TRANSPOSE(gt) == NO)
+ call gswind (gp, xmin, xmax, ymin, ymax)
+ else
+ call gswind (gp, ymin, ymax, xmin, xmax)
+ }
+end