PLplot 5.15.0
Loading...
Searching...
No Matches
pltkwd.h
Go to the documentation of this file.
1//
2// Holds system header includes, prototypes of xwin driver
3// utility functions, and definition of the state structure.
4//
5
6#ifndef __PLTKWD_H__
7#define __PLTKWD_H__
8
9#include "plplot.h"
10#include "plstrm.h"
11
12// System headers
13
14#ifndef MAC_TCL
15#ifndef __MWERKS__
16#include <sys/types.h>
17#endif
18#endif
19
20#include <tk.h>
21#ifdef MAC_TCL
22#else
23// These are pulled in by 'tkMacPort.h'
24#include <X11/Xlib.h>
25#include <X11/Xutil.h>
26#include <X11/cursorfont.h>
27#include <X11/keysym.h>
28#endif
29// Specify max number of displays in use
30
31#define PLTKDISPLAYS 100
32
33// Set constants for dealing with colormap. In brief:
34//
35// ccmap When set, turns on custom color map
36//
37// See Init_CustomCmap() and Init_DefaultCmap() for more info.
38// Set ccmap at your own risk -- still under development.
39//
40
41static int plplot_tkwin_ccmap = 0;
42
43// One of these holds the display info, shared by all streams on a given
44// display
45
46typedef struct
47{
48 int nstreams; // Number of streams using display
49 int ixwd; // Specifies tkwDisplay number
50 char *displayName; // Name of X display
51 int screen; // X screen
52 Display *display; // X display
53 Visual *visual; // X Visual
54 GC gcXor; // Graphics context for XOR draws
55 Colormap map; // Colormap
56 unsigned depth; // display depth
57 int color; // Set to 1 if a color output device
58 int ncol0; // Number of cmap 0 colors allocated
59 int ncol1; // Number of cmap 1 colors allocated
60 XColor cmap0[16]; // Color entries for cmap 0
61 XColor cmap1[256]; // Color entries for cmap 1
62 XColor fgcolor; // Foreground color (if grayscale)
63 Tk_Cursor xhair_cursor; // Crosshair cursor
65
66// One of these holds the X driver state information
67
68typedef struct
69{
70 TkwDisplay *tkwd; // Pointer to display info
71
72 Window window; // X window id
73 Pixmap pixmap; // Off-screen pixmap
74 GC gc; // Graphics context
75 XColor curcolor; // Current pen color
76
77 long event_mask; // Event mask
78 int flags; // 1 = delete, 2 = exit event loop
79 long init_width; // Initial window width
80 long init_height; // Initial window height
81
82 unsigned width, height, border; // Current window dimensions
83
84 double xscale_init; // initial pixels/lx (virt. coords)
85 double yscale_init; // initial pixels/ly (virt. coords)
86 double xscale; // as above, but current value
87 double yscale; // (after possible resizing)
88
89 short xlen, ylen; // Lengths of device coord space
90
91 int write_to_window; // Set if plotting direct to window
92 int write_to_pixmap; // Set if plotting to pixmap
93
94 int instr; // Instruction timer
95 int max_instr; // Limit before X server is queried
96
97 PLGraphicsIn gin; // Graphics input structure
98
99 int locate_mode; // Set while in locate mode
100 int drawing_xhairs; // Set during xhair draws
101 XPoint xhair_x[2], xhair_y[2]; // Crosshair lines
102
103 void ( *MasterEH )( PLStream *, XEvent * ); // Master X event handler
104} TkwDev;
105
106//--------------------------------------------------------------------------
107// Function Prototypes
108//--------------------------------------------------------------------------
109
110#ifdef __cplusplus
111extern "C" {
112#endif
113
114// Performs basic driver initialization.
115
116void
118
119// Copies the supplied PLColor to an XColor
120
121void
122PLColor_to_TkColor( PLColor *plcolor, XColor *xcolor );
123
124// Copies the supplied XColor to a PLColor
125
126void
127PLColor_from_TkColor( PLColor *plcolor, XColor *xcolor );
128
129// Same but also tells me if the color changed
130int
131PLColor_from_TkColor_Changed( PLColor *plcolor, XColor *xcolor );
132
133void Tkw_StoreColor( PLStream* pls, TkwDisplay* tkwd, XColor* col );
134
135// Set background & foreground colors.
136
137void
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif // __PLTKWD_H__
static PLStream * pls[PL_NSTREAMS]
Definition plcore.h:88
#define Tk_Cursor
Definition plframe.c:80
void pltkwin_setBGFG(PLStream *pls)
static int plplot_tkwin_ccmap
Definition pltkwd.h:41
int PLColor_from_TkColor_Changed(PLColor *plcolor, XColor *xcolor)
void Tkw_StoreColor(PLStream *pls, TkwDisplay *tkwd, XColor *col)
void PLColor_from_TkColor(PLColor *plcolor, XColor *xcolor)
void PLColor_to_TkColor(PLColor *plcolor, XColor *xcolor)
void plD_open_tkwin(PLStream *pls)
double xscale_init
Definition pltkwd.h:84
short xlen
Definition pltkwd.h:89
unsigned width
Definition pltkwd.h:82
Window window
Definition pltkwd.h:72
double xscale
Definition pltkwd.h:86
int drawing_xhairs
Definition pltkwd.h:100
unsigned border
Definition pltkwd.h:82
XPoint xhair_x[2]
Definition pltkwd.h:101
void(* MasterEH)(PLStream *, XEvent *)
Definition pltkwd.h:103
long init_height
Definition pltkwd.h:80
XColor curcolor
Definition pltkwd.h:75
int flags
Definition pltkwd.h:78
Pixmap pixmap
Definition pltkwd.h:73
int write_to_window
Definition pltkwd.h:91
int write_to_pixmap
Definition pltkwd.h:92
int max_instr
Definition pltkwd.h:95
GC gc
Definition pltkwd.h:74
long event_mask
Definition pltkwd.h:77
int locate_mode
Definition pltkwd.h:99
long init_width
Definition pltkwd.h:79
XPoint xhair_y[2]
Definition pltkwd.h:101
unsigned height
Definition pltkwd.h:82
TkwDisplay * tkwd
Definition pltkwd.h:70
short ylen
Definition pltkwd.h:89
double yscale
Definition pltkwd.h:87
int instr
Definition pltkwd.h:94
PLGraphicsIn gin
Definition pltkwd.h:97
double yscale_init
Definition pltkwd.h:85
int nstreams
Definition pltkwd.h:48
int screen
Definition pltkwd.h:51
Display * display
Definition pltkwd.h:52
char * displayName
Definition pltkwd.h:50
int ncol1
Definition pltkwd.h:59
GC gcXor
Definition pltkwd.h:54
Colormap map
Definition pltkwd.h:55
int ncol0
Definition pltkwd.h:58
Visual * visual
Definition pltkwd.h:53
Tk_Cursor xhair_cursor
Definition pltkwd.h:63
int color
Definition pltkwd.h:57
XColor cmap0[16]
Definition pltkwd.h:60
unsigned depth
Definition pltkwd.h:56
int ixwd
Definition pltkwd.h:49
XColor cmap1[256]
Definition pltkwd.h:61
XColor fgcolor
Definition pltkwd.h:62