aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/stdgraph/stgscur.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/gio/stdgraph/stgscur.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/gio/stdgraph/stgscur.x')
-rw-r--r--sys/gio/stdgraph/stgscur.x36
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/gio/stdgraph/stgscur.x b/sys/gio/stdgraph/stgscur.x
new file mode 100644
index 00000000..e40d4a3d
--- /dev/null
+++ b/sys/gio/stdgraph/stgscur.x
@@ -0,0 +1,36 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include "stdgraph.h"
+
+# STG_SETCURSOR -- Set the position of a cursor.
+
+procedure stg_setcursor (x, y, cursor)
+
+int x, y # new position of cursor
+int cursor # cursor to be set
+int mx, my, cur
+include "stdgraph.com"
+
+begin
+ # If cursor=0, write the cursor last referenced.
+ if (cursor > 0) {
+ SG_CURSOR(g_sg) = cursor
+ cur = cursor
+ } else
+ cur = max (1, SG_CURSOR(g_sg))
+
+ # If the user has locked the logical cursor override runtime selection.
+ if (g_cursor > 0)
+ cur = g_cursor
+
+ # Restore the software cursor position before reading?
+ if (SG_UPDCURSOR(g_sg) == YES) {
+ SG_CURSOR_X(g_sg) = x
+ SG_CURSOR_Y(g_sg) = y
+ }
+
+ mx = max(g_x1, min(g_x2, nint (x * g_dx) + g_x1))
+ my = max(g_y1, min(g_y2, nint (y * g_dy) + g_y1))
+
+ call stg_ctrl3 ("WC", mx, my, cur)
+end