~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to bindings/tk-x-plat/plplotter.c

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: plplotter.c,v 1.17 2004/01/17 16:41:37 rlaboiss Exp $
2
 
 * $Log: plplotter.c,v $
3
 
 * Revision 1.17  2004/01/17 16:41:37  rlaboiss
4
 
 * This jumbo cvs commit is the result of a herculean task to update the
5
 
 * copyright notices of most of the source files of PLplot.
6
 
 *
7
 
 * I hope that I did not introduce any serious breakage.  This seems plausible,
8
 
 * because I did changes only at the beginning of the files and only in
9
 
 * commented lines.  However, I used a semi-automatic procedure for doing that
10
 
 * and some bugs may have slipped into the files.  The sources still build okay
11
 
 * (at least the Debian packages) and I can install the libraries, and compile
12
 
 * and run some C examples.  That is not enough, so PLEASE TEST!
13
 
 *
14
 
 * This is what I did in more detail:
15
 
 *
16
 
 * 1) From the CVS ChangeLog, I considered all the files that changed since the
17
 
 *    last release (5.2.1).  I then added the line:
18
 
 *
19
 
 *        Copyright (C) 2004  Joe C. V. S. Committer
20
 
 *
21
 
 *    where the name of the developper who did the CVS commit is included.
22
 
 *
23
 
 * 2) Notice that the year in the line above should read 2004, even if the
24
 
 *    changes were done last year, since Copyright years refer to when the
25
 
 *    software is released.
26
 
 *
27
 
 * 3) For the same reason, I did not bother adding missing Copyright entries
28
 
 *    for previous authors of each file.  One copyright holder is enough for
29
 
 *    our purposes.
30
 
 *
31
 
 * 4) I also reformatted and reworded the License Conditions text.  This
32
 
 *    included changing things like "This file is free software" to "PLplot is
33
 
 *    free sofware" and so on.
34
 
 *
35
 
 * 5) Finally, some files were lacking License notices, especially the src/*.c.
36
 
 *    I added them and put in the Copyright holder line the name of the
37
 
 *    developer who did the last cvs commit for the file.
38
 
 *
39
 
 * If you wish to know where your name appears, you can run from the
40
 
 * $(top_builddir):
41
 
 *
42
 
 *     grep -ri "copyright.*2004".
43
 
 *
44
 
 *
 
1
/* $Id: plplotter.c,v 1.20 2005/04/27 06:43:39 rlaboiss Exp $
45
2
 * Copyright (C) 2004  Joao Cardoso
46
3
 *
47
4
 * This file is part of PLplot.
58
15
 *
59
16
 * You should have received a copy of the GNU Library General Public License
60
17
 * along with PLplot; if not, write to the Free Software
61
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
62
 
 *
63
 
 * Revision 1.16  2003/10/29 19:40:54  jcard
64
 
 * Mostly cosmetic changes that enable plplot to compiled with (almost) no warnings, even with gcc -Wall.
65
 
 *
66
 
 * Most changes are just casts, and most of them are tcl/tk related. For tcl/tk-8.4, no warnings occurs.
67
 
 * Also tested with tcl/tk-8.3, where some warnings remain.
68
 
 * There are no java/f77/cxx/python/octave changes.
69
 
 *
70
 
 * Revision 1.15  2002/12/03 08:39:22  airwin
71
 
 * Merged AT branch into MAIN, a new configuration era has started
72
 
 *
73
 
 * Revision 1.14.2.1  2002/11/29 22:58:14  airwin
74
 
 * Finish AT tcl binding.  These are only small fairly non-consequential
75
 
 * refinements that I did while trying to debug the extended search problem
76
 
 * (which had a simple solution which I will discuss on list).
77
 
 *
78
 
 * Prepare the start of the tk and tk-x-plat bindings by dropping "plplot/"
79
 
 * from the #include statements in the source files.
80
 
 *
81
 
 * Revision 1.14  2002/08/05 17:21:15  vincentdarley
82
 
 * compile fix
83
 
 *
84
 
 * Revision 1.13  2002/08/05 15:05:02  vincentdarley
85
 
 * removed redundant defintion
86
 
 *
87
 
 * Revision 1.12  2002/08/05 14:10:16  vincentdarley
88
 
 * removed dependence on tkInt, fixed win-tk compile
89
 
 *
90
 
 * Revision 1.11  2002/07/28 22:41:15  airwin
91
 
 * Split tkwin.c into tkwin_common.c and tkwin.c to remove cross-linking issue
92
 
 * and allow tkwin.c to act like a normal driver.  So the last "special" version
93
 
 * of drivers is gone.
94
 
 *
95
 
 * Reconfigured library dependencies and link lines so that we now have reasonably
96
 
 * rational hierarchical dependencies and linking on Linux.
97
 
 *
98
 
 * Revision 1.10  2002/07/15 18:11:33  vincentdarley
99
 
 * plwidget partial merge
100
 
 *
101
 
 * Revision 1.9  2002/07/13 15:34:55  airwin
102
 
 * Work around missing compat/limits.h in private includes from tcl/tk.
103
 
 *
104
 
 * Revision 1.8  2002/07/12 16:59:26  vincentdarley
105
 
 * option class for plframes fixed
106
 
 *
107
 
 * Revision 1.7  2002/07/11 08:52:03  vincentdarley
108
 
 * resolve name conflict between tk, tk-x-plat
109
 
 *
110
 
 * Revision 1.6  2002/07/10 16:12:11  airwin
111
 
 * Need these #include's for Linux/Unix.
112
 
 *
113
 
 * Revision 1.5  2002/07/10 14:02:28  vincentdarley
114
 
 * remove need for internal tcl
115
 
 *
116
 
 * Revision 1.4  2002/07/10 13:59:25  vincentdarley
117
 
 * removing symbols conflict with xwin and use tk.h
118
 
 *
119
 
 * Revision 1.3  2002/07/10 09:52:38  vincentdarley
120
 
 * resolve name clashes, and sync pltools.tcl
121
 
 *
122
 
 * Revision 1.2  2002/07/05 17:17:46  vincentdarley
123
 
 * removed compiler warnings
124
 
 *
125
 
 * Revision 1.1  2002/07/02 09:03:44  vincentdarley
126
 
 * x-platform tk code
127
 
 *
128
 
 * Revision 1.62.4.1  2000/07/28 17:48:10  airwin
129
 
 * AWI: pltk patch changes to existing files
130
 
 *
131
 
 * Revision 1.60  1999/09/06 vince
132
 
 *
133
 
 * Simplified things for Tcl/Tk 8.2, streamlined interface between plwidget
134
 
 * (Plplotwin) and this widget.  Added optional argument 'wait' to some
135
 
 * of the 'view' subcommands so the plot is only ever updated once after
136
 
 * zooming/resetting.  Previously it could be updated/redrawn/resized
137
 
 * as many as three times, when the user really only carried out one
138
 
 * operation.  Plplotwin code updated to use new wait argument.
139
 
 *
140
 
 * Revision 1.59  1998/08/21 21:35:14 vince
141
 
 *
142
 
 * Fixes to compile under Unix with Tcl8.
143
 
 *
144
 
 * '-background' config option works properly now (with redraw/dbl-buffer etc)
145
 
 *
146
 
 *
147
 
 * Scrollbars were having some problems; not sure why, so I rewrote
148
 
 * them to use the new syntax for Tk4 and newer.  It's actually much
149
 
 * simpler than the old stuff.  Replaced functions xScroll and yScroll
150
 
 * by one simple 'Scroll'.  Renamed widget commands xscroll and yscroll
151
 
 * to xview and yview so (i) they're like the newer Tk widgets and
152
 
 * (ii) so they give an obvious error if you try to use the old mechanism.
153
 
 *
154
 
 * Fixed the weird init process in the widget where there were all
155
 
 * sorts of problems due to widget not being mapped when desired
156
 
 * etc.  These seemed to break with each successive Tk release.
157
 
 * The solution?  Force the window into existence (not onto the
158
 
 * screen, just into existence inside Tk, so Tk_WindowId(tkwin)
159
 
 * works) using Tk_MakeWindowExist, then you can continue with
160
 
 * the initialisation immediately.
161
 
 *
162
 
 * Rearranged a few things to be more like the widgets in
163
 
 * the Tk 8 distribution.  Works on Windows.  I hope it
164
 
 * still works on Unix and MacOS!
165
 
 *
166
 
 * Revision 1.58  1996/07/13 21:35:14 vince
167
 
 * Fixed for cross-platform support.  Works on MacOS now.
168
 
 * Removed backwards compatibility stuff (for old Tcl/Tk).
169
 
 * This is designed to be a cross-platform widget now, and that
170
 
 * old stuff was just getting in the way.
171
 
 * Some stuff like OpenLink, Print don't work on MacOS yet.
172
 
 * Uses the new 'tkwin' driver rather than 'xwin'.
173
 
 * Crosshair cursor always used in plot now, if the plot is 'active'
174
 
 * -- set with a new configuration option -activeplot
175
 
 * Added ButtonPressEH for rubber-banding.
176
 
 *
177
 
 * Revision 1.57  1996/06/26  21:35:14  furnish
178
 
 * Various hacks to support Tcl 7.5 and Tk 4.1.
179
 
 *
180
 
 * Revision 1.56  1996/02/24  05:06:30  shouman
181
 
 * Added #ifdef to allow compilation without itcl.
182
 
 * Set value of ndev on call to plgFileDevs (bounds check).
183
 
 *
184
 
 * Revision 1.55  1996/02/23  21:03:57  furnish
185
 
 * Introduce support for rubber banding in the plframe.  This entails
186
 
 * adding new functions to support drawing, updating, etc, the rubber
187
 
 * band, and also fixing some of the old event handlers for the xhairs so
188
 
 * that they work for both the xhairs and the rubber band, possibly even
189
 
 * both simultaneously.  Initial testing seems to indicate this is
190
 
 * working just fine.  However, we probably need to add some more
191
 
 * configuration support so Tcl apps can query, set, and otherwise
192
 
 * manipulate the rubber band ends.  Anyway, it is a good start.
193
 
 *
194
 
 * Revision 1.54  1995/09/22  16:04:11  mjl
195
 
 * Fixes to names of member variables of PLiodev structs.
196
 
 *
197
 
 * Revision 1.53  1995/09/18  20:15:46  furnish
198
 
 * Some changes to mirror what was done to Tk in the newest itcl 2.
199
 
 *
200
 
 * Revision 1.52  1995/08/22  16:17:22  mjl
201
 
 * Widget configure command now only calls for a refresh when required (i.e.
202
 
 * when geometry is changed).  Bug in ConfigureNotify event handling fixed
203
 
 * (first seen under Tk4 for some reason).  Locator report changed to be
204
 
 * of the form "<x> <y>", where <x> is the floating point representation
205
 
 * of the x coordinate, etc.
206
 
 *
207
 
 * Revision 1.51  1995/06/02  20:32:58  mjl
208
 
 * Fixed obscure bug that was causing the plframe to not be properly
209
 
 * redisplayed after a zoom in some cases.
210
 
 *
211
 
 * Revision 1.50  1995/06/01  21:23:10  mjl
212
 
 * Changed header file inclusions.
213
 
 *
214
 
 * Revision 1.49  1995/05/26  20:13:01  mjl
215
 
 * Changed "save as" widget command to accept device keyword, not number.
216
 
 * Eliminated "info devices" widget command in favor of "info devkeys", which
217
 
 * returns device keywords, and "info devnames", which returns device names.
218
 
 *
219
 
 * Revision 1.48  1995/05/19  22:24:18  mjl
220
 
 * Fixes for Tk 4.0.  Updated Tk_Draw3DRectangle syntax when compiling with
221
 
 * Tk versions 4.0 and later.  Eliminated -geometry option for much the same
222
 
 * reason as it was eliminated in the Tk 4.0 frame, to avoid problems with
223
 
 * some valid X *geometry specifications.  Use -width and/or -height instead.
224
 
 * Code is still compatible with Tk 3.6 and should remain so for a while.
225
 
 * Newer Tk 4.0 frame options like -class, -colormap, and -visual will be
226
 
 * added at a later date.
227
 
 *
228
 
 * Revision 1.47  1995/05/08  20:26:26  mjl
229
 
 * Split the crossing event handler into separate enter and leave event
230
 
 * handlers to better keep track of whether we should be drawing graphic
231
 
 * crosshairs or not.  Now works properly under all combinations of expose,
232
 
 * pointer in or out of window, and with or without a pixmap, as far as I can
233
 
 * tell.
234
 
 *
235
 
 * Revision 1.46  1995/05/06  17:10:51  mjl
236
 
 * Added EnterNotify and LeaveNotify event handling, to draw or undraw
237
 
 * crosshairs as needed.  Improved debugging output.
238
 
 *
239
 
 * Revision 1.45  1995/04/17  19:21:52  furnish
240
 
 * Implemented a new "report" widget command for performing on-demand
241
 
 * translations of window coordinates to world coordinates.  This is
242
 
 * especiallly useful when invoked from within a Tk binding.
243
 
 *
244
 
 * Revision 1.44  1995/04/12  08:08:09  mjl
245
 
 * A data link cleanup command added.
246
 
 *
247
 
 * Revision 1.43  1995/03/16  23:07:26  mjl
248
 
 * Implemented graphic crosshairs, which are turned on or off using the
249
 
 * "-xhairs <boolean>" widget configure command.  This inserts an event handler
250
 
 * to draw and update the graphic crosshairs on cursor motion, as well as
251
 
 * intercepting cursor key movements and moving the drawn cursor appropriately.
252
 
 * The expose event handling was broken off into a separate handler and changed
253
 
 * to redraw the graphic crosshairs if necessary.
254
 
 *
255
 
 * Revision 1.42  1995/01/13  23:20:44  mjl
256
 
 * Changed widget commands to set/get the cmap1 palette to handle the new
257
 
 * "rev" cmap1 control point attribute.
258
 
 *
259
 
 * Revision 1.41  1994/10/11  18:54:50  mjl
260
 
 * Now uses "early initialization" of PLplot X driver so that the fg/bg
261
 
 * colors can be set from the plframe widget.  This ensures that fg/bg colors
262
 
 * are consistent in both the widget and the driver, even if the bg color is
263
 
 * changed dynamically (through program or user interface control).  A bug
264
 
 * fixed in the xor GC also.  This fixes problems with the rubber-band
265
 
 * drawing (used in zooms), where the line color would sometimes change or be
266
 
 * hard to see against the background.
267
 
 *
268
 
 * Revision 1.40  1994/09/23  07:39:14  mjl
269
 
 * Incorrect order of calls to freeing malloc'ed memory at exit fixed, found
270
 
 * by Brent Townshend.
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
19
 *
271
20
 */
272
21
 
273
22
/*
1845
1594
    g = (PLFLT)(((unsigned) (xcol.green & 0xFF00) >> 8) / 255.0);
1846
1595
    b = (PLFLT)(((unsigned) (xcol.blue  & 0xFF00) >> 8) / 255.0);
1847
1596
 
1848
 
    plRGB_HLS(r, g, b, &h, &l, &s);
 
1597
    plrgbhls(r, g, b, &h, &l, &s);
1849
1598
 
1850
1599
    p = (PLFLT) (atof(pos) / 100.0);
1851
1600
    reverse = atoi(rev);
1952
1701
            l = pls->cmap1cp[i].l;
1953
1702
            s = pls->cmap1cp[i].s;
1954
1703
 
1955
 
            plHLS_RGB(h, l, s, &r, &g, &b);
 
1704
            plhlsrgb(h, l, s, &r, &g, &b);
1956
1705
 
1957
1706
            r1 = MAX(0, MIN(255, (int) (256. * r)));
1958
1707
            g1 = MAX(0, MIN(255, (int) (256. * g)));