File: xfancy.h

package info (click to toggle)
yorick 2.2.04%2Bdfsg1-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 10,012 kB
  • sloc: ansic: 86,757; sh: 1,697; cpp: 1,309; lisp: 1,234; makefile: 1,050; fortran: 19
file content (77 lines) | stat: -rw-r--r-- 3,511 bytes parent folder | download | duplicates (7)
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
77
/*
 * $Id: xfancy.h,v 1.4 2007-12-28 20:20:19 thiebaut Exp $
 * Declare the fancy X windows engine for GIST.
 */
/* Copyright (c) 2005, The Regents of the University of California.
 * All rights reserved.
 * This file is part of yorick (http://yorick.sourceforge.net).
 * Read the accompanying LICENSE file for details.
 */

#ifndef XFANCY_H
#define XFANCY_H

#include "xbasic.h"

typedef struct FXEngine FXEngine;
struct FXEngine {
  XEngine xe;

  /* --------------- Specific to FXEngine ------------------- */

  int baseline;    /* y coordinate for text in button and message windows */
  int heightButton, widthButton;  /* shape of button */
  /* height of both button and message windows is xe.topMargin */

  int xmv, ymv;
  int pressed;      /* 0 - none, 1 - in button, 2 - in graphics */
  int buttonState;  /* 0 -  button inactive
                       1 -  pointer in button, button ready
                       2 -  button pressed, button armed  */
  int iSystem;      /* <0 for unlocked, else locked system number */
  char msgText[96]; /* current text displayed in message window */
  int msglen;       /* non-zero if displaying a command as message */
  int zoomState;    /* button number if zoom or pan in progress, else 0 */
  int zoomSystem;   /* system number in xe.drawing */
  int zoomAxis;     /* 1 for x-axis, 2 for y-axis, 3 for both */
  GpReal zoomX, zoomY; /* initial coordinates for zoom/pan operation */
};

/* zoom factor for point-and-click zooming */
PLUG_API GpReal gxZoomFactor;

/* The GxPointClick function initiates an interactive point-and-click
   session with the window -- it will not return until a button has
   been pressed, then released.  It returns non-zero if the operation
   was aborted by pressing a second button before releasing the first.
     engine --   an X engine whose display is to be used
     style --    1 to draw a rubber box, 2 to draw a rubber line,
                 otherwise, no visible indication of operation
     system --   system number to which the world coordinates should
                 be transformed, or -1 to use the system under the
                 pointer -- the release coordinates are always in the
                 same system as the press coordinates
     CallBack -- function to be called twice, first when the button is
                 pressed, next when it is released -- operation will
                 be aborted if CallBack returns non-zero
                 Arguments passed to CallBack:
                   engine  -- in which press/release occurred
                   system  -- system under pointer, if above system -1
                   release -- 0 on press, 1 on release
                   x, y    -- coordinates of pointer relative to system
                   butmod  -- 1 - 5 on press to tell which button
                              mask to tell which modifiers on release:
                              1 shift, 2 lock, 4 control, 8 - 128 mod1-5
                   xn, yn  -- NDC coordinates of pointer
 */
PLUG_API int GxPointClick(Engine *engine, int style, int system,
                          int (*CallBack)(Engine *engine, int system,
                                          int release, GpReal x, GpReal y,
                                          int butmod, GpReal xn, GpReal yn));

/* Variables to store coordinate system and mouse coordinates after
   last mouse motion (also see gxCurrentEngine in xbasic.h). */
PLUG_API int gxCurrentSys;
PLUG_API GpReal gxCurrentX, gxCurrentY;

#endif