~ubuntu-branches/ubuntu/raring/python-scipy/raring-proposed

« back to all changes in this revision

Viewing changes to Lib/sandbox/xplt/src/gist/xbasic.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-07 14:12:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070107141212-mm0ebkh5b37hcpzn
* Remove build dependency on python-numpy-dev.
* python-scipy: Depend on python-numpy instead of python-numpy-dev.
* Package builds on other archs than i386. Closes: #402783.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * XBASIC.H
 
3
 *
 
4
 * $Id: xbasic.h 685 2003-03-08 15:26:51Z travo $
 
5
 *
 
6
 * Declare the basic play engine for GIST.
 
7
 *
 
8
 */
 
9
/*    Copyright (c) 2000.  The Regents of the University of California.
 
10
                    All rights reserved.  */
 
11
 
 
12
#ifndef XBASIC_H
 
13
#define XBASIC_H
 
14
 
 
15
#include "gist.h"
 
16
#include "engine.h"
 
17
#include "play.h"
 
18
 
 
19
typedef struct XEngine XEngine;
 
20
struct XEngine {
 
21
  Engine e;
 
22
 
 
23
  /* --------------- Specific to XEngine ------------------- */
 
24
 
 
25
  p_scr *s;
 
26
  p_win *win;
 
27
  int width, height;  /* of (virtual page) graphics window */
 
28
  int wtop, htop;     /* of actual top-level window */
 
29
  int topMargin;   /* height of top menu bar, if any */
 
30
  int leftMargin;  /* width of left menu bar, if any */
 
31
  int x, y;        /* position of graphics relative to win */
 
32
  int dpi;         /* resolution of X window (dots per inch, 75 or 100) */
 
33
  int mapped, clipping;
 
34
 
 
35
  /* if w!=win, this is animation mode */
 
36
  p_win *w;
 
37
  int a_width, a_height;        /* of animation Pixmap */
 
38
  int a_x, a_y;                 /* where it goes on graphics window */
 
39
  GpTransform swapped;          /* transform for graphics window while
 
40
                                 * in animation mode */
 
41
 
 
42
  /* if non-zero, these handlers can deal with input events */
 
43
  void (*HandleExpose)(Engine *engine, Drauing *drawing, int *xy);
 
44
  void (*HandleClick)(Engine *e,int b,int md,int x,int y, unsigned long ms);
 
45
  void (*HandleMotion)(Engine *e,int md,int x,int y);
 
46
  void (*HandleKey)(Engine *e,int k,int md);
 
47
};
 
48
 
 
49
/* GxBasic creates the basic top level window for a GpBXEngine.
 
50
   The window manager properties are filled in.
 
51
   Use the DefaultTopSize macro to set the width and
 
52
   height appropriate for a particular resolution (dpi).
 
53
   DefaultTopSize is 6 inches (450 pixels at 75 dpi, 600 at 100 dpi).  */
 
54
extern p_scr *GxBasic(char *name, char *display, int width, int height,
 
55
                      p_win **win);
 
56
 
 
57
extern p_scr *g_connect(char *displayName);
 
58
extern void g_disconnect(p_scr *s);
 
59
 
 
60
extern int gx75width, gx100width;    /* defaults are 450 and 600 pixels */
 
61
#define DefaultTopWidth(dpi) \
 
62
  (gx75width<gx100width?((dpi)*gx100width)/100:gx100width)
 
63
extern int gx75height, gx100height;  /* defaults are 450 and 600 pixels */
 
64
#define DefaultTopHeight(dpi) \
 
65
  (gx75width<gx100width?((dpi)*gx100height)/100:gx100height)
 
66
#define PixelsPerNDC(dpi) ((dpi)/ONE_INCH)
 
67
 
 
68
/* GxEngine creates an XEngine and adds it to the list of GIST engines.
 
69
   The top window will generally be smaller than the graphics
 
70
   window created by GxEngine; specific engines are responsible for
 
71
   scrolling of the graphics window relative to the top window, although
 
72
   the initial location is passed in via (x, y).  The size argument is
 
73
   sizeof(XEngine), or sizeof some derived engine class.  */
 
74
extern XEngine *GxEngine(p_scr *s, char *name, GpTransform *toPixels,
 
75
                         int x, int y,
 
76
                         int topMargin, int leftMargin, long size);
 
77
 
 
78
/* GxInput sets optional event handlers, and calls XSelectInput with
 
79
   the given eventMask.  HandleExpose, if non-zero, will be called
 
80
   instead of redrawing the Drauing associated with the Engine, which
 
81
   is the default action.  HandleResize, if non-zero, will be called
 
82
   instead of the default resize action (which is to recenter the
 
83
   graphics window).  HandleOther, if non-zero, will be called for
 
84
   keyboard, button, or other events not recogized by the default
 
85
   handler.  */
 
86
extern int GxInput(Engine *engine,
 
87
                   void (*HandleExpose)(Engine *, Drauing *, int *),
 
88
                   void (*HandleClick)(Engine *,int,int,int,int,unsigned long),
 
89
                   void (*HandleMotion)(Engine *,int,int,int),
 
90
                   void (*HandleKey)(Engine *,int,int));
 
91
 
 
92
extern XEngine *GisXEngine(Engine *engine);
 
93
 
 
94
extern void GxExpose(Engine *engine, Drauing *drawing, int *xy);
 
95
extern void GxRecenter(XEngine *xEngine, int width, int height);
 
96
 
 
97
/* GxAnimate creates an offscreen pixmap for the specified region of
 
98
   the window.  Subsequent drawing takes place on the pixmap, not
 
99
   on the graphics window.  GxStrobe copies the pixmap to the screen,
 
100
   optionally clearing it for the next frame of the animation.
 
101
   The viewport should be large enough to cover everything that will
 
102
   change as the animation proceeds, but no larger to get peak speed.
 
103
   GxDirect restores the usual direct-to-screen drawing mode.  */
 
104
extern int GxAnimate(Engine *engine, GpBox *viewport);
 
105
extern int GxStrobe(Engine *engine, int clear);
 
106
extern int GxDirect(Engine *engine);
 
107
 
 
108
extern int g_rgb_read(Engine *eng, GpColor *rgb, long *nx, long *ny);
 
109
 
 
110
#endif