PLplot: pltkwd.h Source File

PLplot 5.15.0

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
41 static int plplot_tkwin_ccmap = 0;
42
43 // One of these holds the display info, shared by all streams on a given
44 // display
45
46 typedef 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
64 } TkwDisplay;
65
66 // One of these holds the X driver state information
67
68 typedef 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
111 extern "C" {
112 #endif
113
114 // Performs basic driver initialization.
115
116 void
117 plD_open_tkwin( PLStream *pls );
118
119 // Copies the supplied PLColor to an XColor
120
121 void
122 PLColor_to_TkColor( PLColor *plcolor, XColor *xcolor );
123
124 // Copies the supplied XColor to a PLColor
125
126 void
127 PLColor_from_TkColor( PLColor *plcolor, XColor *xcolor );
128
129 // Same but also tells me if the color changed
130 int
131 PLColor_from_TkColor_Changed( PLColor *plcolor, XColor *xcolor );
132
133 void Tkw_StoreColor( PLStream* pls, TkwDisplay* tkwd, XColor* col );
134
135 // Set background & foreground colors.
136
137 void
138 pltkwin_setBGFG( PLStream *pls );
139
140 #ifdef __cplusplus
141 }
142 #endif
143
144 #endif // __PLTKWD_H__
TkwDisplay::displayName
char * displayName
Definition: pltkwd.h:50
PLColor
Definition: plplot.h:546
PLColor_to_TkColor
void PLColor_to_TkColor(PLColor *plcolor, XColor *xcolor)
plplot_tkwin_ccmap
static int plplot_tkwin_ccmap
Definition: pltkwd.h:41
TkwDev::ylen
short ylen
Definition: pltkwd.h:89
TkwDev::event_mask
long event_mask
Definition: pltkwd.h:77
TkwDisplay::display
Display * display
Definition: pltkwd.h:52
TkwDisplay::xhair_cursor
Tk_Cursor xhair_cursor
Definition: pltkwd.h:63
TkwDisplay::visual
Visual * visual
Definition: pltkwd.h:53
PlPlotter::height
int height
Definition: plplotter.c:121
TkwDev::drawing_xhairs
int drawing_xhairs
Definition: pltkwd.h:100
TkwDisplay::ncol0
int ncol0
Definition: pltkwd.h:58
TkwDev::init_width
long init_width
Definition: pltkwd.h:79
Tk_Cursor
#define Tk_Cursor
Definition: plframe.c:80
TkwDev::curcolor
XColor curcolor
Definition: pltkwd.h:75
TkwDev::xscale
double xscale
Definition: pltkwd.h:86
TkwDev::flags
int flags
Definition: pltkwd.h:78
TkwDisplay::ncol1
int ncol1
Definition: pltkwd.h:59
PlPlotter::xhair_x
XPoint xhair_x[2]
Definition: plplotter.c:181
TkwDisplay::depth
unsigned depth
Definition: pltkwd.h:56
TkwDev::pixmap
Pixmap pixmap
Definition: pltkwd.h:73
TkwDisplay::color
int color
Definition: pltkwd.h:57
TkwDev::locate_mode
int locate_mode
Definition: pltkwd.h:99
PlPlotter::xhair_y
XPoint xhair_y[2]
Definition: plplotter.c:182
plD_open_tkwin
void plD_open_tkwin(PLStream *pls)
TkwDisplay::nstreams
int nstreams
Definition: pltkwd.h:48
TkwDev::init_height
long init_height
Definition: pltkwd.h:80
TkwDisplay::gcXor
GC gcXor
Definition: pltkwd.h:54
TkwDev::xscale_init
double xscale_init
Definition: pltkwd.h:84
TkwDev::yscale
double yscale
Definition: pltkwd.h:87
PLColor_from_TkColor_Changed
int PLColor_from_TkColor_Changed(PLColor *plcolor, XColor *xcolor)
TkwDisplay::ixwd
int ixwd
Definition: pltkwd.h:49
TkwDev::yscale_init
double yscale_init
Definition: pltkwd.h:85
TkwDev::instr
int instr
Definition: pltkwd.h:94
TkwDisplay
Definition: pltkwd.h:46
TkwDev::gc
GC gc
Definition: pltkwd.h:74
TkwDisplay::screen
int screen
Definition: pltkwd.h:51
pls
static PLStream * pls[PL_NSTREAMS]
Definition: plcore.h:88
PLStream
Definition: plstrm.h:523
TkwDev::width
unsigned width
Definition: pltkwd.h:82
TkwDisplay::fgcolor
XColor fgcolor
Definition: pltkwd.h:62
TkwDev::gin
PLGraphicsIn gin
Definition: pltkwd.h:97
TkwDisplay::map
Colormap map
Definition: pltkwd.h:55
TkwDev::write_to_window
int write_to_window
Definition: pltkwd.h:91
TkwDev::tkwd
TkwDisplay * tkwd
Definition: pltkwd.h:70
PLColor_from_TkColor
void PLColor_from_TkColor(PLColor *plcolor, XColor *xcolor)
PlPlotter::border
Tk_3DBorder border
Definition: plplotter.c:115
TkwDev::max_instr
int max_instr
Definition: pltkwd.h:95
pltkwin_setBGFG
void pltkwin_setBGFG(PLStream *pls)
TkwDev
Definition: pltkwd.h:68
plstrm.h
TkwDev::write_to_pixmap
int write_to_pixmap
Definition: pltkwd.h:92
plplot.h
TkwDev::window
Window window
Definition: pltkwd.h:72
Tkw_StoreColor
void Tkw_StoreColor(PLStream *pls, TkwDisplay *tkwd, XColor *col)
PLGraphicsIn
Definition: plplot.h:433