home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume40 / gnuplot / part14 < prev    next >
Text File  |  1993-10-22  |  81KB  |  2,457 lines

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i026:  gnuplot - interactive function plotting utility, Part14/33
  4. Message-ID: <1993Oct22.163444.23882@sparky.sterling.com>
  5. X-Md4-Signature: a62ecb7ae6c857261fb8b880e0d9709a
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Fri, 22 Oct 1993 16:34:44 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 26
  13. Archive-name: gnuplot/part14
  14. Environment: UNIX, MS-DOS, VMS
  15. Supersedes: gnuplot3: Volume 24, Issue 23-48
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  gnuplot/0FAQ gnuplot/0INSTALL gnuplot/win/wgraph.c
  22. # Wrapped by kent@sparky on Wed Oct 20 17:14:48 1993
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 14 (of 33)."'
  26. if test -f 'gnuplot/0FAQ' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'gnuplot/0FAQ'\"
  28. else
  29.   echo shar: Extracting \"'gnuplot/0FAQ'\" \(25601 characters\)
  30.   sed "s/^X//" >'gnuplot/0FAQ' <<'END_OF_FILE'
  31. XFrom ig25@fg70.rz.uni-karlsruhe.de Mon Sep 13 16:18:32 1993
  32. XReturn-Path: <info-gnuplot-people-request@wildcat.dartmouth.edu>
  33. XPath: uunet!noc.near.net!howland.reston.ans.net!xlink.net!rz.uni-karlsruhe.de!fg70.rz.uni-karlsruhe.de!ig25
  34. XFrom: ig25@fg70.rz.uni-karlsruhe.de (Koenig)
  35. XNewsgroups: comp.graphics.gnuplot,comp.answers,news.answers
  36. XSubject: comp.graphics.gnuplot FAQ (Frequent Answered Questions)
  37. XSupersedes: <comp-graphics-gnuplot-faq_746677383@fg70.rz.uni-karlsruhe.de>
  38. XFollowup-To: comp.graphics.gnuplot
  39. XDate: 13 Sep 1993 02:23:13 GMT
  40. XOrganization: University of Karlsruhe, Germany
  41. XLines: 613
  42. XApproved: news-answers-request@MIT.Edu
  43. XExpires: 11 Oct 1993 02:23:01 GMT
  44. XReply-To: ig25@rz.uni-karlsruhe.de
  45. XNntp-Posting-Host: fg70.rz.uni-karlsruhe.de
  46. XMime-Version: 1.0
  47. XContent-Type: text/plain; charset=iso-8859-1
  48. XContent-Transfer-Encoding: 8bit
  49. XSummary: This is the FAQ (Frequently Answered Questions) list of the
  50. X         comp.graphics.gnuplot newsgroup, which discusses the
  51. X         gnuplot program for plotting 2D - and 3D - graphs.
  52. XKeywords: computer graphics, gnuplot
  53. XXref: uunet comp.graphics.gnuplot:2095 comp.answers:1938 news.answers:12461
  54. XSender: info-gnuplot-request@dartmouth.edu
  55. XTo: info-gnuplot@dartmouth.edu
  56. X
  57. XArchive-name: graphics/gnuplot-faq
  58. XVersion: $Header: comp-graphics-gnuplot,v 1.24 93/08/31 23:58:52 ig25 Exp $
  59. X
  60. XThis is the FAQ (Frequently Answered Questions) list of the
  61. Xcomp.graphics.gnuplot newsgroup, which discusses the gnuplot program for
  62. Xplotting 2D - and 3D - graphs.
  63. X
  64. XMost of the information in this document came from public discussion on
  65. Xcomp.graphics.gnuplot; quotations are believed to be in the public
  66. Xdomain.
  67. X
  68. XHere's a list of the questions.  If you are looking for the answer for a
  69. Xspecific question, look for the string Qx.x:  at the beginning of a line,
  70. Xwith x.x being the question number.
  71. X
  72. XQuestions:
  73. X
  74. XSection 0: Meta - Questions
  75. XQ0.1: Where do I get this document?
  76. XQ0.2: Where do I send comments about this document?
  77. X
  78. XSection 1: General Information
  79. XQ1.1: What is gnuplot?
  80. XQ1.2: How did it come about and why is it called gnuplot?
  81. XQ1.3: Does gnuplot have anything to do with the FSF and the GNU project?
  82. XQ1.4: What does gnuplot offer?
  83. XQ1.5: Is gnuplot suitable for batch processing?
  84. XQ1.6: Can I run gnuplot on my computer?
  85. X
  86. XSection 2: Setting it up
  87. XQ2.1: What is the current version of gnuplot?
  88. XQ2.2: Where can I get gnuplot?
  89. XQ2.3: How do I get gnuplot to compile on my system?
  90. XQ2.4: What documentation is there, and how do I get it?
  91. X
  92. XSection 3: Working with it
  93. XQ3.1: How do I get help?
  94. XQ3.2: How do I print out my graphs?
  95. XQ3.3: How do I include my graphs in <word processor>?
  96. X
  97. XSection 4: Wanted features in gnuplot
  98. XQ4.1: Does gnuplot have hidden line removal?
  99. XQ4.2: Does gnuplot support bar-charts/histograms/boxes?
  100. XQ4.3: Does gnuplot support multiple y-axes on a single plot?
  101. XQ4.4: Can I put multiple plots on a single page?
  102. XQ4.5: Can I put both data files and commands into a single file?
  103. XQ4.6: Can I put Greek letters and super/subscripts into my labels?
  104. XQ4.7: Can I do 1:1 scaling of axes?
  105. XQ4.8: Can I put tic marks for x and y axes into 3d plots?
  106. X
  107. XSection 5: Miscellaneous
  108. XQ5.1: I've found a bug, what do I do?
  109. XQ5.2: Can I use gnuplot routines for my own programs?
  110. XQ5.3: What extensions have people made to gnuplot?  Where can I get them?
  111. XQ5.4: Can I do heavy - duty data processing with gnuplot?
  112. XQ5.5: I have ported gnuplot to another system, or patched it.  What do I do?
  113. X
  114. XSection 6: Making life easier
  115. XQ6.1: How do I plot two functions in non - overlapping regions?
  116. XQ6.2: How do I run my data through a filter before plotting?
  117. XQ6.3: How do I make it easier to use gnuplot with LaTeX?
  118. XQ6.4: How do I save and restore my settings?
  119. X
  120. XSection 7: Known Problems
  121. X
  122. XQ7.1: Gnuplot is not plotting any points under X11!  How come?
  123. XQ7.2: My isoline data generated by a Fortran program is not handled
  124. X        correctly.  What can I do?
  125. XQ7.3: Why does gnuplot ignore my very small numbers?
  126. X
  127. XSection 8: Credits
  128. X
  129. XQuestions and Answers:
  130. X
  131. XSection 0: Meta - Questions.
  132. X
  133. XQ0.1: Where do I get this document?
  134. X
  135. XThis document is posted about once every two weeks to the newsgroups
  136. Xcomp.graphics.gnuplot, comp.answers and news.answers.  Like many other
  137. XFAQ's, it is available via anonymous ftp from rtfm.mit.edu [18.70.0.224]
  138. X>from the directory /pub/usenet/news.answers under the Archive-Name:  at
  139. Xthe top of the article, graphics/gnuplot-faq, and from the directory
  140. X/pub/usenet/comp.graphics.gnuplot, as well as via gopher from
  141. Xgopher.univ-lyon1.fr [134.214.100.25].
  142. X
  143. XQ0.2: Where do I send comments about this document?
  144. X
  145. XSend comments, suggestions etc. via e-mail to Thomas Koenig,
  146. Xig25@rz.uni-karlsruhe.de or ig25@dkauni2.bitnet.
  147. X
  148. XSection 1: General Information
  149. X
  150. XQ1.1: What is gnuplot?
  151. X
  152. XGnuplot is a command-driven interactive function plotting program.  It
  153. Xcan be used to plot functions and data points in both two- and three-
  154. Xdimensional plots in many different formats, and will accommodate many
  155. Xof the needs of today's scientists for graphic data representation.
  156. XGnuplot is copyrighted, but freely distributable; you don't have to pay
  157. Xfor it.
  158. X
  159. XQ1.2: How did it come about and why is it called gnuplot?
  160. X
  161. XThe authors of gnuplot are:
  162. X
  163. XThomas Williams, Colin Kelley, Russell Lang, Dave Kotz, John Campbell,
  164. XGershon Elber, Alexander Woo and many others.
  165. X
  166. XThe following quote comes from Thomas Williams:
  167. X
  168. XI was taking a differential equation class and Colin was taking
  169. XElectromagnetics, we both thought it'd be helpful to visualize the
  170. Xmathematics behind them.  We were both working as sys admin for an EE
  171. XVLSI lab, so we had the graphics terminals and the time to do some
  172. Xcoding.  The posting was better received than we expected, and prompted
  173. Xus to add some, albeit lame, support for file data.
  174. X
  175. XAny reference to GNUplot is incorrect.  The real name of the program
  176. Xis "gnuplot".  You see people use "Gnuplot" quite a bit because many
  177. Xof us have an aversion to starting a sentence with a lower case
  178. Xletter, even in the case of proper nouns and titles.  Gnuplot is not
  179. Xrelated to the GNU project or the FSF in any but the most peripheral
  180. Xsense.  Our software was designed completely independently and the
  181. Xname "gnuplot" was actually a compromise.  I wanted to call it
  182. X"llamaplot" and Colin wanted to call it "nplot."  We agreed that
  183. X"newplot" was acceptable but, we then discovered that there was an
  184. Xabsolutely ghastly pascal program of that name that the Computer
  185. XScience Dept. occasionally used.  I decided that "gnuplot" would make
  186. Xa nice pun and after a fashion Colin agreed.
  187. X
  188. XQ1.3: Does gnuplot have anything to do with the FSF and the GNU project?
  189. X
  190. XGnuplot is neither written nor maintained by the FSF.  It is not covered
  191. Xby the General Public License, either.
  192. X
  193. XHowever, the FSF has decided to distribute gnuplot as part of the GNU
  194. Xsystem, because it is useful, redistributable software.
  195. X
  196. XQ1.4: What does gnuplot offer?
  197. X
  198. X- Plotting of two - dimensional functions and data points in many different
  199. X  styles (points, lines, error bars)
  200. X- plotting of three - dimensional data points and surfaces in many
  201. X  different styles (contour plot, mesh).
  202. X- support for complex arithmetic
  203. X- self - defined functions
  204. X- support for a large number of operating systems, graphics file formats
  205. X  and devices
  206. X- extensive on-line help
  207. X- labels for title, axes, data points
  208. X- command line editing and history on most platforms
  209. X
  210. XQ1.5: Is gnuplot suitable for batch processing?
  211. X
  212. XYes.  You can read in files from the command line, or you can redirect
  213. Xyour standard input to read from a file.  Both data and command files
  214. Xcan be generated automatically, from data acquisition programs or
  215. Xwhatever else you use.
  216. X
  217. XQ1.6: Can I run gnuplot on my computer?
  218. X
  219. XGnuplot is available for a number of platforms.  These are:  Unix (X11
  220. Xand NeXTSTEP), VAX/VMS, OS/2, MS-DOS, Amiga, MS-Windows, OS-9/68k and
  221. Xthe Macintosh.  Modifications for NEC PC-9801 are said to exist (where?).
  222. XA version for the Atari ST exists at atari.archive.umich.edu, but is
  223. Xunstable.
  224. X
  225. XSection 2: Setting it up
  226. X
  227. XQ2.1: What is the current version of gnuplot?
  228. X
  229. XThe current version of gnuplot is 3.4, patchlevel 4.
  230. X
  231. XQ2.2: Where can I get gnuplot?
  232. X
  233. X[This information may be dated, due to the release of gnuplot 3.4.
  234. XPlease report any inaccuracies, if you find them.  Ed.]
  235. X
  236. XAll of the later addresses refer to ftp sites.  Please note that it is
  237. Xpreferable for you to use the symbolic name, rather than the IP address
  238. Xgiven in brackets, because that address is much more subject to change.
  239. X
  240. XThe official distribution site for the gnuplot source is dartmouth.edu
  241. X[129.170.16.4], the file is called /pub/gnuplot/gnuplot.3.4.tar.Z.
  242. XOfficial mirrors of that distribution are (for Australia)
  243. Xmonu1.cc.monash.edu.au [130.194.1.101] and (for Europe) irisa.irisa.fr
  244. X[131.254.254.2].  You can also get it from your friendly neighbourhood
  245. Xcomp.sources.misc archive.
  246. X
  247. XMS-DOS and MS-Windows binaries are available from oak.oakland.edu (North
  248. XAmerica) [141.210.10.117] as pub/msdos/plot/gpt34*.zip, garbo.uwasa.fi
  249. X(Europe) [128.214.87.1] as /pc/plot/gpt34*.zip and archie.au (Australia)
  250. X[139.130.4.6] as micros/pc/oak/plot/gpt34*.zip.  The files are:
  251. Xgpt34doc.zip, gpt34exe.zip, gpt34src.zip and gpt34win.zip.
  252. X
  253. XOS/2 2.x binaries are at ftp-os2.nmsu.edu [128.123.35.151], in
  254. X/os2/2.x/unix/gnu/gplt34.zip .
  255. X
  256. XAmiga sources and binaries are available from wuarchive.wustl.edu
  257. X[128.252.135.4] as /pub/amiga/aminet/util/gnu/gnuplot-3.4*; there
  258. Xare numerous mirrors of this distribution.
  259. X
  260. XThe NeXTSTEP front end can be found at sonata.cc.purdue.edu and
  261. Xcs.orst.edu.
  262. X
  263. XA version for OS-9/68K can be found at cabrales.cs.wisc.edu
  264. X[128.105.36.20] as /pub/OSK/GRAPHICS/gnuplot32x.tar.Z; it includes both
  265. XX-Windows and non - X-windows versions.
  266. X
  267. XA version of gnuplot for the Macintosh is included in the gpcontrb
  268. Xfile, or can be found at wuarchive.wustl.edu [128.252.135.4], in
  269. Xedu/math/mac/graphingAids, as MacGnuPlot3.2.sea.hqx and
  270. XMacGnuPlotPackage3.2.sea.hqx.
  271. X
  272. XPeople without ftp access can use an ftp-mail server; send mail to
  273. Xbitftp@pucc.bitnet (for BITNET only) or ftpmail@decwrl.dec.com with the
  274. Xword 'help' in the mail body for more information.
  275. X
  276. XIt is a good idea to look for a nearby ftp site when downloading things.
  277. XYou can use archie for this.  See if an archie client is installed at
  278. Xyour system (by simply typing archie at the command prompt), or send
  279. Xmail to archie@sura.net with the word 'help' in both the subject line
  280. Xand the body of the mail.  However, be aware that the version you find
  281. Xat a near ftp site may well be out of date; check the last modification
  282. Xdate and the number of bytes against the newest release at one of the
  283. Xofficial servers.
  284. X
  285. XQ2.3: How do I get gnuplot to compile on my system?
  286. X
  287. XAs you would any other installation.  Read the files README and
  288. XREADME.Install, edit the Makefile according to taste, and run make or
  289. Xwhatever is suitable for your operating system.
  290. X
  291. XIf you get a complaint about a missing file libplot.a or something
  292. Xsimilar when building gnuplot for x11, remove -DUNIXPLOT from the
  293. XTERMFLAGS= line, remove -lplot from the LIBS= line and run again.  If
  294. Xyou are making x11 on a sun, type 'make x11_sun'.
  295. X
  296. XQ2.4: What documentation is there, and how do I get it?
  297. X
  298. XThe documentation is included in the source distribution.  Look at the
  299. Xdocs subdirectory, where you'll find
  300. X
  301. X - a Unix man page, which says how to start gnuplot
  302. X - a help file, which also can be printed as a manual
  303. X - a tutorial on using gnuplot with LaTeX
  304. X - a quick reference summary sheet for TeX only
  305. X
  306. XPostScript copies of the documentation can be ftp'd from dartmouth.edu,
  307. Xin pub/gnuplot, as manual.ps.Z and tutorial.ps.Z
  308. X
  309. X
  310. XSection 3: Working with it
  311. X
  312. XQ3.1: How do I get help?
  313. X
  314. XGive the 'help' command at the initial prompt.  After that, keep
  315. Xlooking through the keywords.  Good starting points are 'plot'
  316. Xand 'set'.
  317. X
  318. XRead the manual, if you have it.
  319. X
  320. XAsk your colleagues, the system administrator or the person who set
  321. Xup gnuplot.
  322. X
  323. XPost a question to comp.graphics.gnuplot or send mail to the gatewayed
  324. Xmailing list info-gnuplot@dartmouth.edu.  If you want to subscribe to
  325. Xthe mailing list, send mail to info-gnuplot-request@dartmouth.edu,
  326. Xbut please don't do this if you can get comp.graphics.gnuplot directly.
  327. XIf you pose a question there, it is considered good form to solicit
  328. Xe-mail replies and post a summary.
  329. X
  330. XQ3.2: How do I print out my graphs?
  331. X
  332. XThe kind of output produced is determined by the 'set terminal' command;
  333. Xfor example, 'set terminal postscript' will produce the graph in
  334. XPostScript format.  Output can be redirected using the 'set output'
  335. Xcommand.
  336. X
  337. XAs an example, the following prints out a graph of sin(x) on a Unix
  338. Xmachine running X - Windows.
  339. X
  340. Xgnuplot> plot [-6:6] sin(x)
  341. Xgnuplot> set terminal postscript
  342. XTerminal type set to 'postscript'
  343. XOptions are 'landscape monochrome "Courier" 14'
  344. Xgnuplot> set output "sin.ps"
  345. Xgnuplot> replot
  346. Xgnuplot> set output                      # set output back to default
  347. Xgnuplot> set terminal x11                # ditto for terminal type
  348. Xgnuplot> ! lp -ops sin.ps                # print ps - File (site dependent)
  349. Xrequest id is lprint-3433 (standard input)
  350. Xlp: printed file sin.ps on fg20.rz.uni-karlsruhe.de (5068 Byte)
  351. X!
  352. Xgnuplot>
  353. X
  354. XQ3.3: How do I include my graphs in <word processor>?
  355. X
  356. XBasically, you save your plot to a file in a format your word processor
  357. Xcan understand (using "set term" and "set output", see above), and then
  358. Xyou read in the plot from your word processor.
  359. X
  360. XDetails depend on the kind of word processor you use; use "set term" to
  361. Xget a list of available file formats.
  362. X
  363. XMany word processors can use Encapsulated PostScript for graphs.  This
  364. Xcan be generated by the 'set terminal postscript eps' command.  Most
  365. XMS-DOS word processors understand HPGL (terminal type hpgl).
  366. X
  367. XWith TeX, it depends on what you use to print your dvi files.  If you
  368. Xuse dvips or dvi2ps, you can use Encapsulated PostScript.  For
  369. XemTeX (popular for MS-DOS), you can use emTeX, otherwise use the
  370. XLaTeX terminal type, which generates a picture environment.
  371. X
  372. XIf nothing else helps, try using the pgm or ppm format and converting it
  373. Xto a bitmap format your favourite word processor can understand.  An
  374. Xinvaluable tool for this is Jef Poskanzer's PBMPLUS package.
  375. X
  376. X
  377. XSection 4:  Wanted features in gnuplot
  378. X
  379. XQ4.1: Does gnuplot have hidden line removal?
  380. X
  381. XVersion 3.4 supports hidden line removal on all platforms except MS-DOS;
  382. Xuse the command
  383. X
  384. X    set hidden3d
  385. X
  386. XIf someone can solve the 64K DGROUP memory problem, gnuplot would
  387. Xsupport hidden line removal on MS-DOS as well.  Version 3.2 supports
  388. Xlimited hidden line removal.
  389. X
  390. XQ4.2: Does gnuplot support bar-charts/histograms/boxes?
  391. X
  392. XVersion 3.4 does.
  393. X
  394. XQ4.3: Does gnuplot support multiple y-axes on a single plot?
  395. X
  396. XNo.
  397. X
  398. XQ4.4: Can I put multiple plots on a single page?
  399. X
  400. XLook at the rosendorf subdirectory in the gpcontrb distribution;
  401. Xif you are using PostScript output, check out mpage, which can
  402. Xbe ftp'd from
  403. X
  404. Xftp.eng.umd.edu:pub/misc/mpage-2.tar.Z
  405. X
  406. XQ4.5: Can I put both data files and commands into a single file?
  407. X
  408. XAlex Woo has just put out an unofficial modification for beta test,
  409. Xwhich does exactly this.  Otherwise, you might consider using Fudgit,
  410. Xwhich can do it.
  411. X
  412. XQ4.6: Can I put Greek letters and super/subscripts into my labels?
  413. X
  414. XYou might try using the LaTeX terminal type and putting text like
  415. X\alpha_{3} into it.
  416. X
  417. XIf you use PostScript output, you might find something in the Green
  418. Xsubdirectory of the gpcontrb file (see Q5.3).
  419. X
  420. XQ4.7: Can I do 1:1 scaling of axes?
  421. X
  422. XNot easily.
  423. X
  424. XQ4.8: Can I put tic marks for x and y axes into 3d plots?
  425. X
  426. XThere are patches to do this on prep.ai.mit.edu.
  427. X
  428. X
  429. XSection 5:  Miscellaneous
  430. X
  431. XQ5.1: I've found a bug, what do I do?
  432. X
  433. XFirst, try to see whether it actually is a bug, or whether it is a feature
  434. Xwhich may be turned off by some obscure set - command.  If you have a
  435. Xfairly general sort of bug report, posting to comp.graphics.gnuplot is
  436. Xprobably the way to go.  If you have investigated a problem in detail,
  437. Xespecially if you have a context diff that fixes the problem, please
  438. Xe-email a report to bug-gnuplot@dartmouth.edu.  The bug-gnuplot list
  439. Xis for reporting and collecting bug fixes, the comp.graphics.gnuplot
  440. Xmailing list will be more help for finding work arounds or actually
  441. Xsolving gnuplot related problems.  If you do send in a bug report, be
  442. Xsure and include the version of gnuplot (including patchlevel), terminal
  443. Xdriver, operating system, an exact description of the bug and input
  444. Xwhich can reproduce the bug.  Also, any context diffs should be
  445. Xreferenced against the latest official version of gnuplot if at all
  446. Xpossible.
  447. X
  448. XQ5.2: Can I use gnuplot routines for my own programs?
  449. X
  450. XYes.  John Campbell <jdc@nauvax.ucc.nau.edu> has written gplotlib, a
  451. Xversion of gnuplot as C subroutines callable from a C program.  This is
  452. Xavailable as gplotlib.tar.Z on the machine ftp.nau.edu in the directory
  453. X/pub/gplotlib.tar.Z.  It is also included in the gpcontrb distribution
  454. Xin the campbell subdirectory.
  455. X
  456. XQ5.3: What extensions have people made to gnuplot?  Where can I get them?
  457. X
  458. X[This is still hazy; please check this out and see whether it is correct.
  459. XEd.]
  460. X
  461. XExtensions have been put into the file gpcontrb.tar.z, which is
  462. Xavailable with the 3.4 release, from the same places you can
  463. Xdownload the main distribution from.
  464. X
  465. XNote that it is 3.5 megabytes and compressed using gzip.  The gzip
  466. Xprogram is available from everywhere where you can find GNU software.
  467. XThe main distribution site is prep.ai.mit.edu [18.71.0.38], in the
  468. Xdirectory /pub/gnu.
  469. X
  470. XIt contains the following subdirectories:
  471. X
  472. Xbigler subdirectory:
  473. X        From: bigler@cicg-calcul.grenet.fr
  474. X        Subject: Multiple plots from a Fortran program
  475. Xbudelsky subdirectory:
  476. X        From: budelsky@haegar.ikp.uni-koeln.de
  477. X        Subject: This is the information file for porting gnuplot 3.2
  478. X                to OS-9/68000
  479. Xbyrne subdirectory:
  480. X        From: "Margaret R. Byrne" <mrb2j@kelvin.seas.virginia.edu>
  481. X        Subject: congp3d3 preprocessor to draw contour plots on
  482. X                irregular regions.
  483. Xclark subdirectory:
  484. X        From: Michael Clark <clarkmp@prony.Colorado.EDU>
  485. X        Subject: data filtering: adds point_skip & point_offs
  486. Xclift subdirectory:
  487. X        From: ssclift@neumann.uwaterloo.ca (Simon Clift)
  488. X        Subject: Re: Running gnuplot from Fortran, (and C)
  489. Xgreen subdirectory:
  490. X        From: Roque Donizete de Oliveira <oliveria@engin.umich.edu>
  491. X        Subject: PostScript Greek symbols in gnuplot, new prologue
  492. Xhanna subdirectory:
  493. X        From: gregor@kafka.saic.com (gregg hanna)
  494. X        Subject: x11-library mode, gnulib_x11.[c,h], xlibtest.c,makefile.xlib
  495. Xklosowski subdirectory:
  496. X        From:   Carsten Steger <stegerc@informatik.tu-muenchen.de>
  497. X        Subject: New file "klein.dat"
  498. X        From: przemek@rrdstrad.nist.gov (Przemek Klosowski)
  499. X        Subject: calling gnuplot from Fortran
  500. Xkocaturk subdirectory:
  501. X        From: mustafa@seas.smu.edu (Mustafa Kocaturk)
  502. X        Subject: Histograms in gnuplot
  503. Xrichardson subdirectory:
  504. X        From: amr@chiton.ucsd.edu (Tony Richardson)
  505. X        Subject: Programmatic control of gnuplot from Unix
  506. Xrosendorf subdirectory:
  507. X        From:  prf@jprix.che.wisc.edu
  508. X        Subject: Multiple plots on a page
  509. Xvanzandt subdirectory:
  510. X        From: James R. Van Zandt <jrv@mitre-bedford.ARPA>
  511. X        Subject: Spline generating program
  512. Xwhite subdirectory:
  513. X        From: gwhite@bionet.bio.dfo.ca
  514. X        Subject: gnuplot 3.2 for Titan 3000
  515. Xwoo subdirectory:
  516. X        From: "Alex Woo" <woo@ra-next.arc.nasa.gov>
  517. X        Subject: two additional title lines and fixes to errorbar style
  518. Xyamamoto subdirectory:
  519. X        From: "NOBORU YAMAMOTO     " <sun!kekvax.kek.jp!YAMAMOTO@pixar.com>
  520. X        Subject: Re: gnuplot on Apple Macintosh, "diff -c" of version 3.0
  521. X                (now includes binaries)
  522. Xcastro subdirectory:
  523. X        From: maurice@bruce.cs.monash.edu.au (Maurice Castro)
  524. X        Subject: Controlling gnuplot from another Windows program
  525. Xgrammes subdirectory:
  526. X        From: ph12hucg@rz.uni-sb.de (Carsten Grammes)
  527. X        Subject: Nonlinear least squares fit mechanism
  528. Xhenke subdirectory:
  529. X        From: mgr@asgard.bo.open.de (Lars Hanke)
  530. X        Subject: Re: Changes to gnuplot 3.3b9
  531. Xwalton subdirectory:
  532. X        From: dwalton@athena.mit.edu (Dave Walton)
  533. X        Subject: Inter Process Communication stuff
  534. X
  535. XQ5.4: Can I do heavy - duty data processing with gnuplot?
  536. X
  537. XGnuplot alone is not suited very well for this.  One thing you might try
  538. Xis fudgit, an interactive multi-purpose fitting program written by
  539. XMartin-D. Lacasse (isaac@frodo.physics.mcgill.ca).  It can use gnuplot
  540. Xas its graphics back end and is available from ftp.physics.mcgill.ca
  541. Xin /pub/Fudgit/fudgit_2.33.tar.Z [132.206.9.13], and from the main Linux
  542. Xserver, tsx-11.mit.edu [18.172.1.2] and its numerous mirrors around the
  543. Xworld as /pub/linux/sources/usr.bin/fudgit-2.33.tar.z.  Versions are
  544. Xavailable for AIX, Data General, HP-UX, IRIX 4, Linux, NeXT, Sun3, Sun4,
  545. XUltrix, OS/2 and MS-DOS.  The MS-DOS version is available on simtel20
  546. Xand mirrors in the "math" subdirectory as fudg_231.zip.
  547. X
  548. XCarsten Grammes has written a fitting program which goes together
  549. Xwith gnuplot; it is called gnufit and is available from ftp.uni-kl.de
  550. X[131.246.9.95] from the directory /pub/gnu/gnufit as gnufit10.tar.gz
  551. Xor gft10dos.zip.
  552. X
  553. XYou might also want to look at the applications developed by the
  554. XSoftware Tools Group (STG) at the National Center for Supercomputing
  555. XApplications.  Ftp to ftp.ncsa.uiuc.edu [141.142.20.50] and get the
  556. Xfile README.BROCHURE for more information.
  557. X
  558. XQ5.5: I have ported gnuplot to another system, or patched it.  What do I do?
  559. X
  560. XIf your patch is small, mail it to bug-gnuplot@dartmouth.edu, with
  561. Xa thorough description of what the patch is supposed to do, which version
  562. Xof gnuplot it is relative to, etc.  Please don't mail it to the FAQ
  563. Xmaintainer.
  564. X
  565. XIf your modifications are extensive (such as a port to another system),
  566. Xupload your modifications to dartmouth.edu:/pub/dropoff.  Please drop a
  567. Xnote to David.Kotz@dartmouth.edu, the maintainer of the gnuplot
  568. Xsubdirectory there, plus a note to bug-gnuplot@dartmouth.edu.
  569. X
  570. X
  571. XSection 6: Making life easier
  572. X
  573. XQ6.1: How do I plot two functions in non - overlapping regions?
  574. X
  575. XUse a parametric plot.  An example:
  576. X
  577. Xset parametric
  578. Xa=1
  579. Xb=3
  580. Xc=2
  581. Xd=4
  582. Xx1(t) = a+(b-a)*t
  583. Xx2(t) = c+(d-c)*t
  584. Xf1(x) = sin(x)
  585. Xf2(x) = x**2/8
  586. Xplot [t=0:1] x1(t),f1(x1(t)) title "f1", x2(t), f2(x2(t)) title "f2"
  587. X
  588. XQ6.2: How do I run my data through a filter before plotting?
  589. X
  590. XIf your system supports the popen() - function, as Unix does, you should
  591. Xbe able to run the output through another process such as a short awk
  592. Xprogram (use the "help plot datafile" command for an example).
  593. XUnfortunately, in 3.2, there is a rather short limitation on the maximum
  594. Xargument length, so your command line may be truncated (usually, this
  595. Xwill mean that awk cannot find the filename).  Also, you may need to
  596. Xescape the $ - characters in your awk programs.
  597. X
  598. XVersion 3.4 includes the thru - keyword for the plot command for running
  599. Xdata files through a gnuplot - defined function.
  600. X
  601. XQ6.3: How do I make it easier to use gnuplot with LaTeX?
  602. X
  603. XThere is a set of LaTeX macros and shell scripts that are meant to
  604. Xmake your life easier when using gnuplot with LaTeX.  This package can
  605. Xbe found on dartmouth.edu [129.170.16.4] in pub/gnuplot/latex.shar, by
  606. XDavid Kotz.  For example, the program "plotskel" can turn a
  607. Xgnuplot-output file plot.tex into a skeleton file skel.tex, that has
  608. Xthe same size as the original plot but contains no graph.  With the
  609. Xright macros, the skeleton can be used for preliminary LaTeX passes,
  610. Xreserving the full graph for later passes, saving tremendous amounts
  611. Xof time.
  612. X
  613. XQ6.4: How do I save and restore my settings?
  614. X
  615. XUse the "save" and "load" commands for this; see "help save" and
  616. X"help load" for details.
  617. X
  618. X
  619. XSection 7: Known problems
  620. X
  621. XQ7.1: Gnuplot is not plotting any points under X11!  How come?
  622. X
  623. XVery probably, you still are using an old version of gnuplot_x11.
  624. XRemove that, then do a full installation.
  625. X
  626. XQ7.2: My isoline data generated by a Fortran program is not handled
  627. X        correctly.  What can I do?
  628. X
  629. XOne known cause for this is the use of list - directed output (as in
  630. XWRITE (10,*) for generating blank lines.  Fortran uses ASA carriage
  631. Xcontrol characters, and for list - directed output this results
  632. Xin a space being output before the newline.  Gnuplot does not like
  633. Xthis.
  634. X
  635. XThe solution is to generate blank lines using formatted output, as in
  636. XWRITE (10,'()').
  637. X
  638. XQ7.3: Why does gnuplot ignore my very small numbers?
  639. X
  640. XGnuplot treats all numbers less than 1e-08 as zero, by default.  Thus,
  641. Xif you are trying to plot a collection of very small numbers, they may
  642. Xbe plotted as zero.  Worse, if you're plotting on a log scale, they will
  643. Xbe off scale.  Or, if the whole set of numbers is "zero", your range may
  644. Xbe considered empty:
  645. X
  646. Xgnuplot> plot 'test1'
  647. XWarning: empty y range [4.047e-19:3e-11], adjusting to [-1:1]
  648. Xgnuplot> set yrange [4e-19:3e-11]
  649. Xgnuplot> plot 'test1'
  650. X                     ^
  651. X         y range is less than `zero`
  652. X
  653. XThe solution is to change gnuplot's idea of "zero":
  654. X        set zero 1e-20
  655. XFor more information,
  656. X        help set zero
  657. X
  658. X
  659. XSection 8: Credits
  660. X
  661. XThis list was initially compiled by John Fletcher with contributions
  662. X>from Russell Lang, John Campbell, David Kotz, Rob Cunningham,
  663. XDaniel Lewart and Alex Woo.  Reworked by Thomas Koenig from a draft by
  664. XAlex Woo, with corrections and additions from Alex Woo, John Campbell,
  665. XRussell Lang, David Kotz and many corrections from Daniel Lewart.
  666. X-- 
  667. XThomas Kvnig, ig25@rz.uni-karlsruhe.de, ig25@dkauni2.bitnet
  668. XThe joy of engineering is to find a straight line on a double
  669. Xlogarithmic diagram.
  670. X
  671. X
  672. END_OF_FILE
  673.   if test 25601 -ne `wc -c <'gnuplot/0FAQ'`; then
  674.     echo shar: \"'gnuplot/0FAQ'\" unpacked with wrong size!
  675.   fi
  676.   # end of 'gnuplot/0FAQ'
  677. fi
  678. if test -f 'gnuplot/0INSTALL' -a "${1}" != "-c" ; then 
  679.   echo shar: Will not clobber existing file \"'gnuplot/0INSTALL'\"
  680. else
  681.   echo shar: Extracting \"'gnuplot/0INSTALL'\" \(9760 characters\)
  682.   sed "s/^X//" >'gnuplot/0INSTALL' <<'END_OF_FILE'
  683. XThe GNUPLOT source code and executables may be copied and/or modified
  684. Xfreely as long as the copyright messages are left intact.
  685. X
  686. XSee the History file for changes to GNUPLOT.
  687. X
  688. XCompilation instructions are near the end of this file.
  689. X
  690. XGNUPLOT has been tested on Sun3's and Sun4's (SunOS 4.0.3 and 4.1.1),
  691. Xa VAX 6410 (VMS 5.2), Commodore Amiga's (KS/WB 1.3 and 2.0, SAS/C 6.2
  692. Xand Aztec C beta 5.2a), IBM PC XT's and AT's (MS-DOS 3.3/5.0 BC++
  693. X3.1/TC++ 1.0 MSC 7.0), IRIS 4D/70G and 4D/25G with MIPS C, NeXT with
  694. Xgnu C 1.34, DECStation 5000/200PXG (ULTRIX V4.1), AT&T 3B1 (version
  695. X3.51m with cc and gcc 1.39), and Apollo's (DomainOS SR10.3 BSD4.3
  696. Xwith C compiler 68K Rev 6.7(316)).  The code is written with
  697. Xportability in mind.  GNUPLOT has not been tested on Pyramid 90x.
  698. X
  699. XThere is a mailing list for gnuplot users. Note, however, that the
  700. Xnewsgroup 
  701. X    comp.graphics.gnuplot 
  702. Xis identical to the mailing list (they
  703. Xboth carry the same set of messages). We prefer that you read the
  704. Xmessages through that newsgroup, to subscribing to the mailing list.
  705. X(If you can read that newsgroup, and are already on the mailing list,
  706. Xplease send a message info-gnuplot-request@dartmouth.edu, asking to be
  707. Xremoved from the mailing list.)
  708. X
  709. XThe address for mailing to list members is
  710. X       info-gnuplot@dartmouth.edu
  711. Xand for mailing administrative requests is 
  712. X       info-gnuplot-request@dartmouth.edu
  713. XThe mailing list for bug reports is 
  714. X       bug-gnuplot@dartmouth.edu
  715. XThe list of those interested in beta-test versions is
  716. X       info-gnuplot-beta@dartmouth.edu
  717. X
  718. X[Please tell us the version and machine on which your bug occurred.]
  719. X
  720. X
  721. X
  722. X                       PREPROCESSOR #DEFINES
  723. X
  724. XThese #defines should be checked before compilation (see the makefiles):
  725. Xdefine      file            note
  726. X------      ----            --------
  727. XNOVFORK     Makefile        define if you don't have the vfork() system call
  728. XGAMMA       Makefile        define if you've got gamma(3)
  729. XMEMCPY      Makefile        define if your bcopy() is called memcpy()
  730. XMEMSET      Makefile        define if you have memset() but not bzero()
  731. XNOCOPY      Makefile        define if you've don't have a memcpy() by any name
  732. Xbcopy()     plot.h          define if you've got a memcpy() by some OTHER name
  733. X                              (see example in plot.h)
  734. XPC          Makefile        define if compiling on a PClone
  735. XMSDOS       Makefile        define if compiling under MSDOS;
  736. X                              automatically defined by Microsoft C 5.10
  737. XHELPFILE    Makefile        name including path of gnuplot.gih file.
  738. XVERYLARGE   plot.h          define to be largest coordinate number.
  739. XSHELL       plot.h          default shell to spawn if SHELL environment
  740. X                              variable not found at run-time
  741. XNOCWDRC     Makefile        define to inhibit check of ./.gnuplot
  742. XREADLINE    Makefile        define if you want command-line editing
  743. X
  744. XValid TERMFLAGS defines.  These defines are used to include the
  745. Xvarious plotting terminals, printers, and protocols that a given version
  746. Xof gnuplot can access:
  747. X
  748. Xdefine      file            note
  749. X------      ----            --------
  750. XTERMFLAGS   Makefile        the set of terminals you want, from below
  751. X            or term.h
  752. X
  753. X   AED         AED 512 and AED 767
  754. X   AIFM        Adobe Illustrator Format
  755. X   AMIGASCREEN Amiga custom screen
  756. X   APOLLO      Apollo Graphics Primitive Resource (resizable window)
  757. X   ATT6300     PC with AT&T 6300 graphics
  758. X   BITGRAPH    BBN BitGraph
  759. X   CGI         SCO CGI
  760. X   COREL       COREL! Draw Format
  761. X   CORONA      PC with Corona graphics 325
  762. X   DXY800A     Roland DXY800A plotter
  763. X   DUMB        Printer or glass dumb terminal
  764. X   DXF         AutoCad (Release 10.x) dxf file format
  765. X   EEPIC       EEPIC-extended LaTeX driver, for EEPIC users
  766. X   EGALIB      PC with EGA/VGA graphics.
  767. X   EMTEX       LaTeX picture environment with emTeX specials
  768. X   EPS180      Epson-LQ style 24-pin 180-dot per inch printers
  769. X   EPS60       Epson-style 60-dot per inch printers
  770. X   EPSONP      Epson LX-800, Star NL-10, NX-1000 and lots of others
  771. X   EXCL        Talaris EXCL laser printer format
  772. X   FIG         Fig graphics language (requires object.h from TransFig)
  773. X   GPR         Apollo Graphics Primitive Resource (fixed-size window)
  774. X   HERCULES    IBM PC/Clone with Hercules graphics board
  775. X   HP2648      HP2648, HP2647
  776. X   HP26        HP2623A and maybe others
  777. X   HP500C      HP Deskjet 500 C and maybe other Color Deskjets
  778. X   HP75        HP7580, and probably other HPs
  779. X   HPGL        HP7475 and (hopefully) lots of others
  780. X   HPLJII      HP Laserjet II
  781. X   HPPJ        HP PaintJet
  782. X   IMAGEN      Imagen laser printers (300dpi) (requires -Iterm also)
  783. X   IRIS4D      IRIS4D series computer
  784. X   KERMIT      MS-DOS Kermit Tektronix 4010 emulator
  785. X   LATEX       LaTeX picture environment
  786. X   MF          Metafont Format
  787. X   MIF         FrameMaker MIF 3.00 Format
  788. X   NEC         NEC CP6 pinwriter printer
  789. X   NEXT        NeXTStep Window System (only grey scale)
  790. X   OS2PM       OS/2 Presentation Manager
  791. X   PBM         PBMPLUS pbm, pgm, ppm formats
  792. X   PCL         HP PCL5 (actually  HPGL/2)
  793. X   POSTSCRIPT  PostScript
  794. X   PRESCRIBE   Kyocera Laser printer
  795. X   PSLATEX     Postscript graphics, LaTeX labels and titles
  796. X   PSTRICKS    PSTRICKS 0.91 format
  797. X   QMS         QMS/QUIC laserprinter (Talaris 1200 and others)
  798. X   REGIS       ReGis graphics (vt125, vt220, vt240, Gigis...)
  799. X   RGIP        Redwood Graphics Interface Protocol
  800. X   SELANAR     Selanar
  801. X   STARC       Star Color Printer
  802. X   SUN         Sun Microsystems Workstation
  803. X   T410X       Tektronix 4106, 4107, 4109 and 420x terminals
  804. X   TANDY60     Tandy DMP-130 series 60-dot per inch graphics
  805. X   TEK         Tektronix 4010, and probably others
  806. X   TEXDRAW     TeXDraw format (for LaTeX)
  807. X   TGIF        TGIF X11 Drawing Tool
  808. X   TPIC        Tpic specials for TeX
  809. X   UNIXPC      unixpc (ATT 3b1 or ATT 7300)
  810. X   UNIXPLOT    unixplot
  811. X   V384        Vectrix 384 and tandy color printer
  812. X   VTTEK       VT like Tektronix 4010 emulator
  813. X   X11         X11R4 window system
  814. X
  815. X
  816. XThese #defines are defined automatically by various compilers, some
  817. Xgnuplot routines check these defines to implement features found in the
  818. Xvarious environments:
  819. X
  820. Xdefine        note
  821. X------        --------
  822. XAMIGA_AC_5    defined for Manx Aztec C 5.2a on the Amiga
  823. XAMIGA_SC_6_1  defined for SAS/C 6.1 or later versions on the Amiga
  824. Xapollo        defined by Apollo's C compilers.
  825. X_CRAY         defined by CRAY's C compiler.
  826. X__TURBOC__    defined automatically by  Borland C++ 3.x
  827. Xunix          defined by most unix C compilers.
  828. Xvms           (and VMS) defined by VAX-11 C under VMS.
  829. X__ZTC__       Zortech C compiler under MSDOS.
  830. X_Windows      defined by Borland C++ 3.0 compiling for MS-Windows
  831. X
  832. X
  833. X                             TO COMPILE
  834. X
  835. Xunder UNIX:
  836. XTo compile do:
  837. X  Copy makefile.unx to Makefile
  838. X      cp makefile.unx Makefile
  839. X  Look through the Makefile to see if you need to make any changes.
  840. X  See especially the HELPDEST and TERMFLAGS variables.  Edit if needed.
  841. X  Alternatively, all these variables may be set as command line arguments to
  842. X  'make'. For example:
  843. X
  844. X        make <MACHINE> HELPDEST='/usr/um/misc/lib/gnuplot.gih' \
  845. X                DEST='/usr/um/misc/bin' READLINE=
  846. X
  847. X  Edit term.h, to include/exclude terminals
  848. X  Type
  849. X      make
  850. X  For further instructions.
  851. X  If that works, try
  852. X      make install
  853. X  For further instructions.
  854. X
  855. Xunder VMS:
  856. X  To compile:
  857. X     copy makefile.vms makefile.
  858. X     make
  859. X  Or if you don't have a suitable make:
  860. X     @buildvms
  861. X  To tell gnuplot where to find the help library:
  862. X      $ define gnuplot$help disk:[directory]gnuplot.hlb
  863. X  Alternatively (and preferably) put the help in the main system help library.
  864. X
  865. Xunder AmigaDOS:
  866. XUsing Aztec C 5.2a
  867. X      make -f makefile.ami
  868. XUsing SAS/C 6.1 or later versions
  869. X      smake -f makefile.amg
  870. X
  871. XUsing Microsoft C 7.0 and compiling for MS-Windows
  872. X      copy makefile.msw makefile
  873. X      nmake
  874. X  Put wgnuplot.exe, wgnuplot.dll, wgnuplot.hlp and wgnuplot.mnu
  875. X  in the windows directory.
  876. X
  877. Xunder MSDOS:
  878. XUsing Microsoft C 7.0.
  879. X      copy makefile.msc makefile
  880. X      nmake 
  881. X
  882. XUsing Borland C++ 3.1 and compiling for MS-Windows
  883. X      copy makefile.win makefile
  884. X  Edit makefile to change TC.
  885. X      make
  886. X  Put wgnuplot.exe, wgnuplot.dll, wgnuplot.hlp and wgnuplot.mnu
  887. X  in the windows directory.
  888. X
  889. XUsing Borland C++ 3.0
  890. X      copy makefile.tc makefile
  891. X  Edit makefile to change TC, BIN, BGI, BGIOBJ. You may also want to turn
  892. X  off overlays (See manual for more on overlays).
  893. X      make
  894. X
  895. X
  896. XThe file gnuplot.gih is needed for help on the PC.
  897. XIf the file gnuplot.gih is not in the default directory, then use:
  898. X    set GNUHELP={full path name of gnuplot.gih}
  899. X
  900. X
  901. X                         ENVIRONMENT VARIABLES
  902. X
  903. XSee 'help environment'.
  904. X
  905. XIf the environment variable GNUTERM is found, it is used as the terminal
  906. Xtype. Otherwise, in some cases the variable TERM will be used, or the
  907. Xhardware may be automatically detected.
  908. X
  909. XThe PC version looks for the environment variable GNUPLOT to contain
  910. Xthe name of the directory from which to load the initialization file
  911. XGNUPLOT.INI.  See the help on 'start_up' for more information.
  912. X
  913. XHOME is examined as a directory where a .gnuplot startup file might be
  914. Xfound. See help on "start-up".
  915. X
  916. XIf defined, the environment variable GNUHELP is used for the name
  917. Xof the .gih help file, otherwise HELPFILE (defined in makefile or
  918. Xplot.c) is used.
  919. X
  920. XThe VMS version looks for the logical name GNUPLOT$HELP to locate
  921. Xthe help library.
  922. X
  923. XThe CGI drivers need the CGIPATH environment variable to set the path
  924. Xto the CGI agents, and the CGIDISP and/or CGIPRNT environment
  925. Xvariables to set the output devices.
  926. X
  927. XThe CGI drivers need the CGIPATH environment variable to set the path
  928. Xto the CGI agents, and the CGIDISP and/or CGIPRNT environment
  929. Xvariables to set the output devices.
  930. END_OF_FILE
  931.   if test 9760 -ne `wc -c <'gnuplot/0INSTALL'`; then
  932.     echo shar: \"'gnuplot/0INSTALL'\" unpacked with wrong size!
  933.   fi
  934.   # end of 'gnuplot/0INSTALL'
  935. fi
  936. if test -f 'gnuplot/win/wgraph.c' -a "${1}" != "-c" ; then 
  937.   echo shar: Will not clobber existing file \"'gnuplot/win/wgraph.c'\"
  938. else
  939.   echo shar: Extracting \"'gnuplot/win/wgraph.c'\" \(40601 characters\)
  940.   sed "s/^X//" >'gnuplot/win/wgraph.c' <<'END_OF_FILE'
  941. X#ifndef lint
  942. Xstatic char *RCSid = "$Id: wgraph.c%v 3.50.1.13 1993/08/19 03:21:26 woo Exp $";
  943. X#endif
  944. X
  945. X/* GNUPLOT - win/wgraph.c */
  946. X/*
  947. X * Copyright (C) 1992   Maurice Castro, Russell Lang
  948. X *
  949. X * Permission to use, copy, and distribute this software and its
  950. X * documentation for any purpose with or without fee is hereby granted, 
  951. X * provided that the above copyright notice appear in all copies and 
  952. X * that both that copyright notice and this permission notice appear 
  953. X * in supporting documentation.
  954. X *
  955. X * Permission to modify the software is granted, but not the right to
  956. X * distribute the modified code.  Modifications are to be distributed 
  957. X * as patches to released version.
  958. X *  
  959. X * This software is provided "as is" without express or implied warranty.
  960. X * 
  961. X *
  962. X * AUTHORS
  963. X * 
  964. X *   Maurice Castro
  965. X *   Russell Lang
  966. X * 
  967. X * Send your comments or suggestions to 
  968. X *  info-gnuplot@dartmouth.edu.
  969. X * This is a mailing list; to join it send a note to 
  970. X *  info-gnuplot-request@dartmouth.edu.  
  971. X * Send bug reports to
  972. X *  bug-gnuplot@dartmouth.edu.
  973. X */
  974. X
  975. X#define STRICT
  976. X#include <windows.h>
  977. X#include <windowsx.h>
  978. X#if WINVER >= 0x030a
  979. X#include <commdlg.h>
  980. X#endif
  981. X#ifndef __MSC__
  982. X#include <mem.h>
  983. X#endif
  984. X#include <string.h>
  985. X#include "wgnuplib.h"
  986. X#include "wresourc.h"
  987. X#include "wcommon.h"
  988. X
  989. XLRESULT CALLBACK _export WndGraphProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
  990. Xvoid ReadGraphIni(LPGW lpgw);
  991. X
  992. X/* ================================== */
  993. X
  994. X#define MAXSTR 255
  995. X
  996. X#define WGDEFCOLOR 15
  997. XCOLORREF wginitcolor[WGDEFCOLOR] =  {
  998. X    RGB(0,0,255),    /* blue */
  999. X    RGB(0,255,0),    /* green */
  1000. X    RGB(255,0,0),    /* red */
  1001. X    RGB(255,0,255), /* magenta */
  1002. X    RGB(0,0,128),    /* dark blue */
  1003. X    RGB(128,0,0),    /* dark red */
  1004. X    RGB(0,128,128),    /* dark cyan */
  1005. X    RGB(0,0,0),    /* black */
  1006. X    RGB(128,128,128), /* grey */
  1007. X    RGB(0,128,64),    /* very dark cyan */
  1008. X    RGB(128,128,0), /* dark yellow */
  1009. X    RGB(128,0,128),    /* dark magenta */
  1010. X    RGB(192,192,192), /* light grey */
  1011. X    RGB(0,255,255),    /* cyan */
  1012. X    RGB(255,255,0),    /* yellow */
  1013. X};
  1014. X#define WGDEFSTYLE 5
  1015. Xint wginitstyle[WGDEFSTYLE] = {PS_SOLID, PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT};
  1016. X
  1017. X/* ================================== */
  1018. X
  1019. X/* destroy memory blocks holding graph operations */
  1020. Xvoid
  1021. XDestroyBlocks(LPGW lpgw)
  1022. X{
  1023. X    struct GWOPBLK *this, *next;
  1024. X    struct GWOP FAR *gwop;
  1025. X    unsigned int i;
  1026. X
  1027. X    this = lpgw->gwopblk_head;
  1028. X    while (this != NULL) {
  1029. X        next = this->next;
  1030. X        if (!this->gwop) {
  1031. X            this->gwop = (struct GWOP FAR *)GlobalLock(this->hblk);
  1032. X        }
  1033. X        if (this->gwop) {
  1034. X            /* free all text strings within this block */
  1035. X            gwop = this->gwop;
  1036. X            for (i=0; i<GWOPMAX; i++) {
  1037. X                if (gwop->htext)
  1038. X                    LocalFree(gwop->htext);
  1039. X                gwop++;
  1040. X            }
  1041. X        }
  1042. X        GlobalUnlock(this->hblk);
  1043. X        GlobalFree(this->hblk);
  1044. X        LocalFreePtr(this);
  1045. X        this = next;
  1046. X    }
  1047. X    lpgw->gwopblk_head = NULL;
  1048. X    lpgw->gwopblk_tail = NULL;
  1049. X    lpgw->nGWOP = 0;
  1050. X}
  1051. X        
  1052. X    
  1053. X/* add a new memory block for graph operations */
  1054. X/* returns TRUE if block allocated */
  1055. XBOOL 
  1056. XAddBlock(LPGW lpgw)
  1057. X{
  1058. XHGLOBAL hblk;
  1059. Xstruct GWOPBLK *next, *this;
  1060. X
  1061. X    /* create new block */
  1062. X    next = (struct GWOPBLK *)LocalAllocPtr(LHND, sizeof(struct GWOPBLK) );
  1063. X    if (next == NULL)
  1064. X        return FALSE;
  1065. X    hblk = GlobalAlloc(GHND, GWOPMAX*sizeof(struct GWOP));
  1066. X    if (hblk == NULL)
  1067. X        return FALSE;
  1068. X    next->hblk = hblk;
  1069. X    next->gwop = (struct GWOP FAR *)NULL;
  1070. X    next->next = (struct GWOPBLK *)NULL;
  1071. X    next->used = 0;
  1072. X    
  1073. X    /* attach it to list */
  1074. X    this = lpgw->gwopblk_tail;
  1075. X    if (this == NULL) {
  1076. X        lpgw->gwopblk_head = next;
  1077. X    }
  1078. X    else {
  1079. X        this->next = next;
  1080. X        this->gwop = (struct GWOP FAR *)NULL;
  1081. X        GlobalUnlock(this->hblk);
  1082. X    }
  1083. X    lpgw->gwopblk_tail = next;
  1084. X    next->gwop = (struct GWOP FAR *)GlobalLock(next->hblk);
  1085. X    if (next->gwop == (struct GWOP FAR *)NULL)
  1086. X        return FALSE;
  1087. X        
  1088. X    return TRUE;
  1089. X}
  1090. X
  1091. X
  1092. Xvoid WDPROC
  1093. XGraphOp(LPGW lpgw, WORD op, WORD x, WORD y, LPSTR str)
  1094. X{
  1095. X    struct GWOPBLK *this;
  1096. X    struct GWOP FAR *gwop;
  1097. X    char *npstr;
  1098. X    
  1099. X    this = lpgw->gwopblk_tail;
  1100. X    if ( (this==NULL) || (this->used >= GWOPMAX) ) {
  1101. X        /* not enough space so get new block */
  1102. X        if (!AddBlock(lpgw))
  1103. X            return;
  1104. X        this = lpgw->gwopblk_tail;
  1105. X    }
  1106. X    gwop = &this->gwop[this->used];
  1107. X    gwop->op = op;
  1108. X    gwop->x = x;
  1109. X    gwop->y = y;
  1110. X    gwop->htext = 0;
  1111. X    if (str) {
  1112. X        gwop->htext = LocalAlloc(LHND, _fstrlen(str)+1);
  1113. X        npstr = LocalLock(gwop->htext);
  1114. X        if (gwop->htext && (npstr != (char *)NULL))
  1115. X            lstrcpy(npstr, str);
  1116. X        LocalUnlock(gwop->htext);
  1117. X    }
  1118. X    this->used++;
  1119. X    lpgw->nGWOP++;
  1120. X    return;
  1121. X}
  1122. X
  1123. X/* ================================== */
  1124. X
  1125. Xvoid WDPROC
  1126. XGraphInit(LPGW lpgw)
  1127. X{
  1128. X    HMENU sysmenu;
  1129. X    WNDCLASS wndclass;
  1130. X    char buf[80];
  1131. X
  1132. X    if (!lpgw->hPrevInstance) {
  1133. X        wndclass.style = CS_HREDRAW | CS_VREDRAW;
  1134. X        wndclass.lpfnWndProc = WndGraphProc;
  1135. X        wndclass.cbClsExtra = 0;
  1136. X        wndclass.cbWndExtra = 2 * sizeof(void FAR *);
  1137. X        wndclass.hInstance = lpgw->hInstance;
  1138. X        wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  1139. X        wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
  1140. X        wndclass.hbrBackground = GetStockBrush(WHITE_BRUSH);
  1141. X        wndclass.lpszMenuName = NULL;
  1142. X        wndclass.lpszClassName = szGraphClass;
  1143. X        RegisterClass(&wndclass);
  1144. X    }
  1145. X
  1146. X    ReadGraphIni(lpgw);
  1147. X
  1148. X    lpgw->hWndGraph = CreateWindow(szGraphClass, lpgw->Title,
  1149. X        WS_OVERLAPPEDWINDOW,
  1150. X        lpgw->Origin.x, lpgw->Origin.y,
  1151. X        lpgw->Size.x, lpgw->Size.y,
  1152. X        NULL, NULL, lpgw->hInstance, lpgw);
  1153. X
  1154. X    lpgw->hPopMenu = CreatePopupMenu();
  1155. X    AppendMenu(lpgw->hPopMenu, MF_STRING | (lpgw->graphtotop ? MF_CHECKED : MF_UNCHECKED), 
  1156. X        M_GRAPH_TO_TOP, "Bring to &Top");
  1157. X    AppendMenu(lpgw->hPopMenu, MF_STRING | (lpgw->color ? MF_CHECKED : MF_UNCHECKED), 
  1158. X        M_COLOR, "C&olor");
  1159. X    AppendMenu(lpgw->hPopMenu, MF_STRING, M_COPY_CLIP, "&Copy to Clipboard");
  1160. X#if WINVER >= 0x030a
  1161. X    AppendMenu(lpgw->hPopMenu, MF_STRING, M_BACKGROUND, "&Background...");
  1162. X    AppendMenu(lpgw->hPopMenu, MF_STRING, M_CHOOSE_FONT, "Choose &Font...");
  1163. X    AppendMenu(lpgw->hPopMenu, MF_STRING, M_LINESTYLE, "&Line Styles...");
  1164. X#endif
  1165. X    AppendMenu(lpgw->hPopMenu, MF_STRING, M_PRINT, "&Print...");
  1166. X    if (lpgw->IniFile != (LPSTR)NULL) {
  1167. X        wsprintf(buf,"&Update %s",lpgw->IniFile);
  1168. X        AppendMenu(lpgw->hPopMenu, MF_STRING, M_WRITEINI, (LPSTR)buf);
  1169. X    }
  1170. X
  1171. X    /* modify the system menu to have the new items we want */
  1172. X    sysmenu = GetSystemMenu(lpgw->hWndGraph,0);
  1173. X    AppendMenu(sysmenu, MF_SEPARATOR, 0, NULL);
  1174. X    AppendMenu(sysmenu, MF_POPUP, (UINT)lpgw->hPopMenu, "&Options");
  1175. X    AppendMenu(sysmenu, MF_STRING, M_ABOUT, "&About");
  1176. X
  1177. X    ShowWindow(lpgw->hWndGraph, SW_SHOWNORMAL);
  1178. X}
  1179. X
  1180. X/* close a graph window */
  1181. Xvoid WDPROC
  1182. XGraphClose(LPGW lpgw)
  1183. X{
  1184. X    /* close window */
  1185. X    if (lpgw->hWndGraph)
  1186. X        DestroyWindow(lpgw->hWndGraph);
  1187. X    TextMessage();
  1188. X    lpgw->hWndGraph = NULL;
  1189. X
  1190. X    lpgw->locked = TRUE;
  1191. X    DestroyBlocks(lpgw);
  1192. X    lpgw->locked = FALSE;
  1193. X
  1194. X}
  1195. X    
  1196. X
  1197. Xvoid WDPROC
  1198. XGraphStart(LPGW lpgw)
  1199. X{
  1200. X    lpgw->locked = TRUE;
  1201. X    DestroyBlocks(lpgw);
  1202. X    if ( !lpgw->hWndGraph || !IsWindow(lpgw->hWndGraph) )
  1203. X        GraphInit(lpgw);
  1204. X    if (IsIconic(lpgw->hWndGraph))
  1205. X        ShowWindow(lpgw->hWndGraph, SW_SHOWNORMAL);
  1206. X    if (lpgw->graphtotop)
  1207. X        BringWindowToTop(lpgw->hWndGraph);
  1208. X}
  1209. X        
  1210. Xvoid WDPROC
  1211. XGraphEnd(LPGW lpgw)
  1212. X{
  1213. XRECT rect;
  1214. X    GetClientRect(lpgw->hWndGraph, &rect);
  1215. X    InvalidateRect(lpgw->hWndGraph, (LPRECT) &rect, 1);
  1216. X    lpgw->locked = FALSE;
  1217. X    UpdateWindow(lpgw->hWndGraph);
  1218. X}
  1219. X
  1220. Xvoid WDPROC
  1221. XGraphPrint(LPGW lpgw)
  1222. X{
  1223. X    if (lpgw->hWndGraph && IsWindow(lpgw->hWndGraph))
  1224. X        SendMessage(lpgw->hWndGraph,WM_COMMAND,M_PRINT,0L);
  1225. X}
  1226. X
  1227. Xvoid WDPROC
  1228. XGraphRedraw(LPGW lpgw)
  1229. X{
  1230. X    if (lpgw->hWndGraph && IsWindow(lpgw->hWndGraph))
  1231. X        SendMessage(lpgw->hWndGraph,WM_COMMAND,M_REBUILDTOOLS,0L);
  1232. X}
  1233. X/* ================================== */
  1234. X
  1235. Xvoid
  1236. XStorePen(LPGW lpgw, int i, COLORREF ref, int colorstyle, int monostyle)
  1237. X{
  1238. X    LOGPEN FAR *plp;
  1239. X
  1240. X    plp = &lpgw->colorpen[i];
  1241. X    plp->lopnColor = ref;
  1242. X    if (colorstyle < 0) {
  1243. X        plp->lopnWidth.x = -colorstyle;
  1244. X        plp->lopnStyle = 0;
  1245. X    }
  1246. X    else {
  1247. X        plp->lopnWidth.x = 1;
  1248. X        plp->lopnStyle = colorstyle % 5;
  1249. X    }
  1250. X    plp->lopnWidth.y = 0;
  1251. X
  1252. X    plp = &lpgw->monopen[i];
  1253. X    plp->lopnColor = RGB(0,0,0);
  1254. X    if (monostyle < 0) {
  1255. X        plp->lopnWidth.x = -monostyle;
  1256. X            plp->lopnStyle = 0;
  1257. X    }
  1258. X    else {
  1259. X        plp->lopnWidth.x = 1;
  1260. X        plp->lopnStyle = monostyle % 5;
  1261. X    }
  1262. X    plp->lopnWidth.y = 0;
  1263. X}
  1264. X
  1265. Xvoid
  1266. XMakePens(LPGW lpgw, HDC hdc)
  1267. X{
  1268. X    int i;
  1269. X
  1270. X    if ((GetDeviceCaps(hdc,NUMCOLORS) == 2) || !lpgw->color) {
  1271. X        /* Monochrome Device */
  1272. X        /* create border pens */
  1273. X        lpgw->hbpen = CreatePenIndirect((LOGPEN FAR *)&lpgw->monopen[0]);    /* border */
  1274. X        lpgw->hapen = CreatePenIndirect((LOGPEN FAR *)&lpgw->monopen[1]);     /* axis */
  1275. X        /* create drawing pens */
  1276. X        for (i=0; i<WGNUMPENS; i++)
  1277. X        {
  1278. X            lpgw->hpen[i] = CreatePenIndirect((LOGPEN FAR *)&lpgw->monopen[i+2]);
  1279. X            }
  1280. X        /* find number of solid, unit width line styles */
  1281. X        for (i=0; i<WGNUMPENS && lpgw->monopen[i+2].lopnStyle==PS_SOLID
  1282. X            && lpgw->monopen[i+2].lopnWidth.x==1; i++) ;
  1283. X        lpgw->numsolid = i ? i : 1;    /* must be at least 1 */
  1284. X        lpgw->hbrush = CreateSolidBrush(RGB(255,255,255));
  1285. X    }
  1286. X    else {
  1287. X        /* Color Device */
  1288. X        /* create border pens */
  1289. X        lpgw->hbpen = CreatePenIndirect((LOGPEN FAR *)&lpgw->colorpen[0]);    /* border */
  1290. X        lpgw->hapen = CreatePenIndirect((LOGPEN FAR *)&lpgw->colorpen[1]);     /* axis */
  1291. X        /* create drawing pens */
  1292. X        for (i=0; i<WGNUMPENS; i++)
  1293. X        {
  1294. X            lpgw->hpen[i] = CreatePenIndirect((LOGPEN FAR *)&lpgw->colorpen[i+2]);
  1295. X            }
  1296. X        /* find number of solid, unit width line styles */
  1297. X        for (i=0; i<WGNUMPENS && lpgw->colorpen[i+2].lopnStyle==PS_SOLID
  1298. X            && lpgw->colorpen[i+2].lopnWidth.x==1; i++) ;
  1299. X        lpgw->numsolid = i ? i : 1;    /* must be at least 1 */
  1300. X        lpgw->hbrush = CreateSolidBrush(lpgw->background);
  1301. X    }
  1302. X}
  1303. X
  1304. Xvoid
  1305. XDestroyPens(LPGW lpgw)
  1306. X{
  1307. X    int i;
  1308. X
  1309. X    DeleteBrush(lpgw->hbrush);
  1310. X    DeletePen(lpgw->hbpen);
  1311. X    DeletePen(lpgw->hapen);
  1312. X    for (i=0; i<WGNUMPENS; i++)
  1313. X        DeletePen(lpgw->hpen[i]);
  1314. X}
  1315. X
  1316. X/* ================================== */
  1317. X
  1318. Xvoid
  1319. XMakeFonts(LPGW lpgw, LPRECT lprect, HDC hdc)
  1320. X{
  1321. X    LOGFONT lf;
  1322. X    HFONT hfontold;
  1323. X    TEXTMETRIC tm;
  1324. X    int result;
  1325. X    char FAR *p;
  1326. X    int cx, cy;
  1327. X
  1328. X    lpgw->rotate = FALSE;
  1329. X    _fmemset(&lf, 0, sizeof(LOGFONT));
  1330. X    _fstrncpy(lf.lfFaceName,lpgw->fontname,LF_FACESIZE);
  1331. X    lf.lfHeight = -MulDiv(lpgw->fontsize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
  1332. X    lf.lfCharSet = DEFAULT_CHARSET;
  1333. X    if ( (p = _fstrstr(lpgw->fontname," Italic")) != (LPSTR)NULL ) {
  1334. X        lf.lfFaceName[ (unsigned int)(p-lpgw->fontname) ] = '\0';
  1335. X        lf.lfItalic = TRUE;
  1336. X    }
  1337. X    if ( (p = _fstrstr(lpgw->fontname," Bold")) != (LPSTR)NULL ) {
  1338. X        lf.lfFaceName[ (unsigned int)(p-lpgw->fontname) ] = '\0';
  1339. X        lf.lfWeight = FW_BOLD;
  1340. X    }
  1341. X
  1342. X    if (lpgw->hfonth == 0) {
  1343. X        lpgw->hfonth = CreateFontIndirect((LOGFONT FAR *)&lf);
  1344. X    }
  1345. X
  1346. X    if (lpgw->hfontv == 0) {
  1347. X        lf.lfEscapement = 900;
  1348. X        lf.lfOrientation = 900;
  1349. X        lpgw->hfontv = CreateFontIndirect((LOGFONT FAR *)&lf);
  1350. X    }
  1351. X
  1352. X    /* save text size */
  1353. X    hfontold = SelectFont(hdc, lpgw->hfonth);
  1354. X#ifdef WIN32
  1355. X    {
  1356. X    SIZE size;
  1357. X    GetTextExtentPoint(hdc,"0123456789",10, (LPSIZE)&size);
  1358. X    cx = size.cx;
  1359. X    cy = size.cy;
  1360. X    }
  1361. X#else
  1362. X    {
  1363. X    DWORD extent;
  1364. X    extent = GetTextExtent(hdc,"0123456789",10);
  1365. X    cx = LOWORD(extent);
  1366. X    cy = HIWORD(extent);
  1367. X    }
  1368. X#endif
  1369. X    lpgw->vchar = MulDiv(cy,lpgw->ymax,lprect->bottom - lprect->top);
  1370. X    lpgw->hchar = MulDiv(cx/10,lpgw->xmax,lprect->right - lprect->left);
  1371. X    /* find out if we can rotate text 90deg */
  1372. X    SelectFont(hdc, lpgw->hfontv);
  1373. X    result = GetDeviceCaps(hdc, TEXTCAPS);
  1374. X    if ((result & TC_CR_90) || (result & TC_CR_ANY))
  1375. X        lpgw->rotate = 1;
  1376. X    GetTextMetrics(hdc,(TEXTMETRIC FAR *)&tm);
  1377. X    if (tm.tmPitchAndFamily & TMPF_VECTOR)
  1378. X        lpgw->rotate = 1;    /* vector fonts can all be rotated */
  1379. X#if WINVER >=0x030a
  1380. X    if (tm.tmPitchAndFamily & TMPF_TRUETYPE)
  1381. X        lpgw->rotate = 1;    /* truetype fonts can all be rotated */
  1382. X#endif
  1383. X    SelectFont(hdc, hfontold);
  1384. X    return;
  1385. X}
  1386. X
  1387. Xvoid
  1388. XDestroyFonts(LPGW lpgw)
  1389. X{
  1390. X    if (lpgw->hfonth) {
  1391. X        DeleteFont(lpgw->hfonth);
  1392. X        lpgw->hfonth = 0;
  1393. X    }
  1394. X    if (lpgw->hfontv) {
  1395. X        DeleteFont(lpgw->hfontv);
  1396. X        lpgw->hfontv = 0;
  1397. X    }
  1398. X    return;
  1399. X}
  1400. X
  1401. Xvoid
  1402. XSetFont(LPGW lpgw, HDC hdc)
  1403. X{
  1404. X    if (lpgw->rotate && lpgw->angle) {
  1405. X        if (lpgw->hfontv)
  1406. X            SelectFont(hdc, lpgw->hfontv);
  1407. X    }
  1408. X    else {
  1409. X        if (lpgw->hfonth)
  1410. X            SelectFont(hdc, lpgw->hfonth);
  1411. X    }
  1412. X    return;
  1413. X}
  1414. X
  1415. Xvoid
  1416. XSelFont(LPGW lpgw) {
  1417. X#if WINVER >= 0x030a
  1418. X    LOGFONT lf;
  1419. X    CHOOSEFONT cf;
  1420. X    HDC hdc;
  1421. X    char lpszStyle[LF_FACESIZE]; 
  1422. X    char FAR *p;
  1423. X
  1424. X    /* Set all structure fields to zero. */
  1425. X    _fmemset(&cf, 0, sizeof(CHOOSEFONT));
  1426. X    _fmemset(&lf, 0, sizeof(LOGFONT));
  1427. X    cf.lStructSize = sizeof(CHOOSEFONT);
  1428. X    cf.hwndOwner = lpgw->hWndGraph;
  1429. X    _fstrncpy(lf.lfFaceName,lpgw->fontname,LF_FACESIZE);
  1430. X    if ( (p = _fstrstr(lpgw->fontname," Bold")) != (LPSTR)NULL ) {
  1431. X        _fstrncpy(lpszStyle,p+1,LF_FACESIZE);
  1432. X        lf.lfFaceName[ (unsigned int)(p-lpgw->fontname) ] = '\0';
  1433. X    }
  1434. X    else if ( (p = _fstrstr(lpgw->fontname," Italic")) != (LPSTR)NULL ) {
  1435. X        _fstrncpy(lpszStyle,p+1,LF_FACESIZE);
  1436. X        lf.lfFaceName[ (unsigned int)(p-lpgw->fontname) ] = '\0';
  1437. X    }
  1438. X    else
  1439. X        _fstrcpy(lpszStyle,"Regular");
  1440. X    cf.lpszStyle = lpszStyle;
  1441. X    hdc = GetDC(lpgw->hWndGraph);
  1442. X    lf.lfHeight = -MulDiv(lpgw->fontsize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
  1443. X    ReleaseDC(lpgw->hWndGraph, hdc);
  1444. X    cf.lpLogFont = &lf;
  1445. X    cf.nFontType = SCREEN_FONTTYPE;
  1446. X    cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_USESTYLE;
  1447. X    if (ChooseFont(&cf)) {
  1448. X        _fstrcpy(lpgw->fontname,lf.lfFaceName);
  1449. X        lpgw->fontsize = cf.iPointSize / 10;
  1450. X        if (cf.nFontType & BOLD_FONTTYPE)
  1451. X            lstrcat(lpgw->fontname," Bold");
  1452. X        if (cf.nFontType & ITALIC_FONTTYPE)
  1453. X            lstrcat(lpgw->fontname," Italic");
  1454. X        SendMessage(lpgw->hWndGraph,WM_COMMAND,M_REBUILDTOOLS,0L);
  1455. X    }
  1456. X#endif
  1457. X}
  1458. X
  1459. X/* ================================== */
  1460. X
  1461. Xvoid
  1462. Xdrawgraph(LPGW lpgw, HDC hdc, LPRECT rect)
  1463. X{
  1464. X    int xdash, ydash;            /* the transformed coordinates */
  1465. X    int rr, rl, rt, rb;
  1466. X    struct GWOP FAR *curptr;
  1467. X    struct GWOPBLK *blkptr;
  1468. X    int htic, vtic, vshift;
  1469. X    unsigned int lastop=-1;        /* used for plotting last point on a line */
  1470. X    int pen, numsolid;
  1471. X    int polymax = 200;
  1472. X    int polyi = 0;
  1473. X    POINT *ppt;
  1474. X    unsigned int ngwop=0;
  1475. X    BOOL isColor;
  1476. X
  1477. X    if (lpgw->locked) 
  1478. X        return;
  1479. X
  1480. X     isColor= GetDeviceCaps(hdc, NUMCOLORS) > 2;
  1481. X    if (lpgw->background != RGB(255,255,255) && lpgw->color && isColor) {
  1482. X        SetBkColor(hdc,lpgw->background);
  1483. X        FillRect(hdc, rect, lpgw->hbrush);
  1484. X    }
  1485. X
  1486. X    ppt = (POINT *)LocalAllocPtr(LHND, (polymax+1) * sizeof(POINT));
  1487. X
  1488. X    rr = rect->right;
  1489. X    rl = rect->left;
  1490. X    rt = rect->top;
  1491. X    rb = rect->bottom;
  1492. X
  1493. X    htic = MulDiv(lpgw->htic, rr-rl, lpgw->xmax) + 1;
  1494. X    vtic = MulDiv(lpgw->vtic, rb-rt, lpgw->ymax) + 1;
  1495. X
  1496. X    lpgw->angle = 0;
  1497. X    SetFont(lpgw, hdc);
  1498. X    SetTextAlign(hdc, TA_LEFT|TA_BOTTOM);
  1499. X    vshift = MulDiv(lpgw->vchar, rb-rt, lpgw->ymax)/2;
  1500. X
  1501. X    pen = 0;
  1502. X    SelectPen(hdc, lpgw->hpen[pen]);
  1503. X    numsolid = lpgw->numsolid;
  1504. X
  1505. X    /* do the drawing */
  1506. X    blkptr = lpgw->gwopblk_head;
  1507. X    curptr = NULL;
  1508. X    if (blkptr) {
  1509. X        if (!blkptr->gwop)
  1510. X            blkptr->gwop = (struct GWOP FAR *)GlobalLock(blkptr->hblk);
  1511. X        if (!blkptr->gwop)
  1512. X            return;
  1513. X        curptr = (struct GWOP FAR *)blkptr->gwop;
  1514. X    }
  1515. X    while(ngwop < lpgw->nGWOP)
  1516. X       {
  1517. X        /* transform the coordinates */
  1518. X        xdash = MulDiv(curptr->x, rr-rl-1, lpgw->xmax) + rl;
  1519. X        ydash = MulDiv(curptr->y, rt-rb+1, lpgw->ymax) + rb - 1;
  1520. X        if ((lastop==W_vect) && (curptr->op!=W_vect)) {
  1521. X            if (polyi >= 2)
  1522. X                Polyline(hdc, ppt, polyi);
  1523. X            polyi = 0;
  1524. X        }
  1525. X        switch (curptr->op) {
  1526. X            case 0:    /* have run past last in this block */
  1527. X                break;
  1528. X            case W_move:
  1529. X                ppt[0].x = xdash;
  1530. X                ppt[0].y = ydash;
  1531. X                polyi = 1;;
  1532. X                break;
  1533. X            case W_vect:
  1534. X                ppt[polyi].x = xdash;
  1535. X                ppt[polyi].y = ydash;
  1536. X                polyi++;
  1537. X                if (polyi >= polymax) {
  1538. X                    Polyline(hdc, ppt, polyi);
  1539. X                    ppt[0].x = xdash;
  1540. X                    ppt[0].y = ydash;
  1541. X                    polyi = 1;;
  1542. X                }
  1543. X                break;
  1544. X            case W_line_type:
  1545. X                switch (curptr->x)
  1546. X                {
  1547. X                    case -2:        /* black 2 pixel wide */
  1548. X                        SelectPen(hdc, lpgw->hbpen);
  1549. X                        if (lpgw->color && isColor)
  1550. X                            SetTextColor(hdc, lpgw->colorpen[0].lopnColor);
  1551. X                        break;
  1552. X                    case -1:        /* black 1 pixel wide doted */
  1553. X                        SelectPen(hdc, lpgw->hapen);
  1554. X                        if (lpgw->color && isColor)
  1555. X                            SetTextColor(hdc, lpgw->colorpen[1].lopnColor);
  1556. X                        break;
  1557. X                    default:
  1558. X                        SelectPen(hdc, lpgw->hpen[(curptr->x)%WGNUMPENS]);
  1559. X                        if (lpgw->color && isColor)
  1560. X                            SetTextColor(hdc, lpgw->colorpen[(curptr->x)%WGNUMPENS + 2].lopnColor);
  1561. X                }
  1562. X                pen = curptr->x;
  1563. X                break;
  1564. X            case W_put_text:
  1565. X                {char *str;
  1566. X                str = LocalLock(curptr->htext);
  1567. X                if (str) {
  1568. X                    ydash += vshift;
  1569. X                    SetBkMode(hdc,TRANSPARENT);
  1570. X                    TextOut(hdc,xdash,ydash,str,lstrlen(str));
  1571. X                    SetBkMode(hdc,OPAQUE);
  1572. X                }
  1573. X                LocalUnlock(curptr->htext);
  1574. X                }
  1575. X                break;
  1576. X            case W_text_angle:
  1577. X                lpgw->angle = curptr->x;
  1578. X                SetFont(lpgw,hdc);
  1579. X                break;
  1580. X            case W_justify:
  1581. X                switch (curptr->x)
  1582. X                {
  1583. X                    case LEFT:
  1584. X                        SetTextAlign(hdc, TA_LEFT|TA_BOTTOM);
  1585. X                        break;
  1586. X                    case RIGHT:
  1587. X                        SetTextAlign(hdc, TA_RIGHT|TA_BOTTOM);
  1588. X                        break;
  1589. X                    case CENTRE:
  1590. X                        SetTextAlign(hdc, TA_CENTER|TA_BOTTOM);
  1591. X                        break;
  1592. X                    }
  1593. X                break;
  1594. X            case W_dot:
  1595. X                if (pen >= numsolid) {
  1596. X                    pen %= numsolid;    /* select solid pen */
  1597. X                    SelectPen(hdc, lpgw->hpen[pen]);
  1598. X                }
  1599. X                MoveTo(hdc,xdash,ydash);
  1600. X                LineTo(hdc,xdash+1,ydash);
  1601. X                break;
  1602. X            case W_diamond: /* do diamond */ 
  1603. X                if (pen >= numsolid) {
  1604. X                    pen %= numsolid;
  1605. X                    SelectPen(hdc, lpgw->hpen[pen]);
  1606. X                }
  1607. X                MoveTo(hdc,xdash-htic,ydash);
  1608. X                LineTo(hdc,xdash,ydash-vtic);
  1609. X                LineTo(hdc,xdash+htic,ydash);
  1610. X                LineTo(hdc,xdash,ydash+vtic);
  1611. X                LineTo(hdc,xdash-htic,ydash);
  1612. X                MoveTo(hdc,xdash,ydash);
  1613. X                LineTo(hdc,xdash+1,ydash);
  1614. X                break;
  1615. X            case W_plus: /* do plus */ 
  1616. X                if (pen >= numsolid) {
  1617. X                    pen %= numsolid;
  1618. X                    SelectPen(hdc, lpgw->hpen[pen]);
  1619. X                }
  1620. X                MoveTo(hdc,xdash-htic,ydash);
  1621. X                LineTo(hdc,xdash+htic+1,ydash);
  1622. X                MoveTo(hdc,xdash,ydash-vtic);
  1623. X                LineTo(hdc,xdash,ydash+vtic+1);
  1624. X                break;
  1625. X            case W_box: /* do box */ 
  1626. X                if (pen >= numsolid) {
  1627. X                    pen %= numsolid;
  1628. X                    SelectPen(hdc, lpgw->hpen[pen]);
  1629. X                }
  1630. X                MoveTo(hdc,xdash-htic,ydash-vtic);
  1631. X                LineTo(hdc,xdash+htic,ydash-vtic);
  1632. X                LineTo(hdc,xdash+htic,ydash+vtic);
  1633. X                LineTo(hdc,xdash-htic,ydash+vtic);
  1634. X                LineTo(hdc,xdash-htic,ydash-vtic);
  1635. X                MoveTo(hdc,xdash,ydash);
  1636. X                LineTo(hdc,xdash+1,ydash);
  1637. X                break;
  1638. X            case W_cross: /* do X */ 
  1639. X                if (pen >= numsolid) {
  1640. X                    pen %= numsolid;
  1641. X                    SelectPen(hdc, lpgw->hpen[pen]);
  1642. X                }
  1643. X                MoveTo(hdc,xdash-htic,ydash-vtic);
  1644. X                LineTo(hdc,xdash+htic+1,ydash+vtic+1);
  1645. X                MoveTo(hdc,xdash-htic,ydash+vtic);
  1646. X                LineTo(hdc,xdash+htic+1,ydash-vtic-1);
  1647. X                break;
  1648. X            case W_triangle: /* do triangle */ 
  1649. X                if (pen >= numsolid) {
  1650. X                    pen %= numsolid;
  1651. X                    SelectPen(hdc, lpgw->hpen[pen]);
  1652. X                }
  1653. X                MoveTo(hdc,xdash,ydash-(4*vtic/3));
  1654. X                LineTo(hdc,xdash-(4*htic/3),ydash+(2*vtic/3));
  1655. X                LineTo(hdc,xdash+(4*htic/3),ydash+(2*vtic/3));
  1656. X                LineTo(hdc,xdash,ydash-(4*vtic/3));
  1657. X                MoveTo(hdc,xdash,ydash);
  1658. X                LineTo(hdc,xdash+1,ydash);
  1659. X                break;
  1660. X            case W_star: /* do star */ 
  1661. X                if (pen >= numsolid) {
  1662. X                    pen %= numsolid;
  1663. X                    SelectPen(hdc, lpgw->hpen[pen]);
  1664. X                }
  1665. X                MoveTo(hdc,xdash-htic,ydash);
  1666. X                LineTo(hdc,xdash+htic+1,ydash);
  1667. X                MoveTo(hdc,xdash,ydash-vtic);
  1668. X                LineTo(hdc,xdash,ydash+vtic+1);
  1669. X                MoveTo(hdc,xdash-htic,ydash-vtic);
  1670. X                LineTo(hdc,xdash+htic+1,ydash+vtic+1);
  1671. X                MoveTo(hdc,xdash-htic,ydash+vtic);
  1672. X                LineTo(hdc,xdash+htic+1,ydash-vtic-1);
  1673. X                break;
  1674. X        }
  1675. X        lastop = curptr->op;
  1676. X        ngwop++;
  1677. X        curptr++;
  1678. X        if ((unsigned)(curptr - blkptr->gwop) >= GWOPMAX) {
  1679. X            GlobalUnlock(blkptr->hblk);
  1680. X            blkptr->gwop = (struct GWOP FAR *)NULL;
  1681. X            blkptr = blkptr->next;
  1682. X            if (!blkptr->gwop)
  1683. X                blkptr->gwop = (struct GWOP FAR *)GlobalLock(blkptr->hblk);
  1684. X            if (!blkptr->gwop)
  1685. X                    return;
  1686. X                curptr = (struct GWOP FAR *)blkptr->gwop;
  1687. X        }
  1688. X    }
  1689. X    if (polyi >= 2)
  1690. X        Polyline(hdc, ppt, polyi);
  1691. X    LocalFreePtr(ppt);
  1692. X}
  1693. X
  1694. X/* ================================== */
  1695. X
  1696. X/* copy graph window to clipboard */
  1697. Xvoid
  1698. XCopyClip(LPGW lpgw)
  1699. X{
  1700. X    RECT rect;
  1701. X    HDC mem;
  1702. X    HBITMAP bitmap;
  1703. X    HANDLE hmf;
  1704. X    GLOBALHANDLE hGMem;
  1705. X    LPMETAFILEPICT lpMFP;
  1706. X    HWND hwnd;
  1707. X    HDC hdc;
  1708. X
  1709. X    hwnd = lpgw->hWndGraph;
  1710. X
  1711. X    /* view the window */
  1712. X    if (IsIconic(hwnd))
  1713. X        ShowWindow(hwnd, SW_SHOWNORMAL);
  1714. X    BringWindowToTop(hwnd);
  1715. X    UpdateWindow(hwnd);
  1716. X
  1717. X    /* get the context */
  1718. X    hdc = GetDC(hwnd);
  1719. X    GetClientRect(hwnd, &rect);
  1720. X    /* make a bitmap and copy it there */
  1721. X    mem = CreateCompatibleDC(hdc);
  1722. X    bitmap = CreateCompatibleBitmap(hdc, rect.right - rect.left,
  1723. X            rect.bottom - rect.top);
  1724. X    if (bitmap) {
  1725. X        /* there is enough memory and the bitmaps OK */
  1726. X        SelectBitmap(mem, bitmap);
  1727. X        BitBlt(mem,0,0,rect.right - rect.left, 
  1728. X            rect.bottom - rect.top, hdc, rect.left,
  1729. X            rect.top, SRCCOPY);
  1730. X    }
  1731. X    else {
  1732. X        MessageBeep(MB_ICONHAND);
  1733. X        MessageBox(hwnd, "Insufficient Memory to Copy Clipboard", 
  1734. X            lpgw->Title, MB_ICONHAND | MB_OK);
  1735. X    }
  1736. X    DeleteDC(mem);
  1737. X    ReleaseDC(hwnd, hdc);
  1738. X
  1739. X    hdc = CreateMetaFile((LPSTR)NULL);
  1740. X    SetMapMode(hdc, MM_ANISOTROPIC);
  1741. X#ifdef WIN32
  1742. X    SetWindowExtEx(hdc, rect.right, rect.bottom, (LPSIZE)NULL);
  1743. X#else
  1744. X    SetWindowExt(hdc, rect.right, rect.bottom);
  1745. X#endif
  1746. X    drawgraph(lpgw, hdc, (void *) &rect);
  1747. X    hmf = CloseMetaFile(hdc);
  1748. X
  1749. X    hGMem = GlobalAlloc(GMEM_MOVEABLE, (DWORD)sizeof(METAFILEPICT));
  1750. X    lpMFP = (LPMETAFILEPICT) GlobalLock(hGMem);
  1751. X    hdc = GetDC(hwnd);    /* get window size */
  1752. X    GetClientRect(hwnd, &rect);
  1753. X    /* in MM_ANISOTROPIC, xExt & yExt give suggested size in 0.01mm units */
  1754. X    lpMFP->mm = MM_ANISOTROPIC;
  1755. X    lpMFP->xExt = MulDiv(rect.right-rect.left, 2540, GetDeviceCaps(hdc, LOGPIXELSX));
  1756. X    lpMFP->yExt = MulDiv(rect.bottom-rect.top, 2540, GetDeviceCaps(hdc, LOGPIXELSX));
  1757. X    lpMFP->hMF = hmf;
  1758. X    ReleaseDC(hwnd, hdc);
  1759. X    GlobalUnlock(hGMem);
  1760. X
  1761. X    OpenClipboard(hwnd);
  1762. X    EmptyClipboard();
  1763. X    SetClipboardData(CF_METAFILEPICT,hGMem);
  1764. X    SetClipboardData(CF_BITMAP, bitmap);
  1765. X    CloseClipboard();
  1766. X    return;
  1767. X}
  1768. X
  1769. X/* copy graph window to printer */
  1770. Xvoid
  1771. XCopyPrint(LPGW lpgw)
  1772. X{
  1773. X#if WINVER >= 0x030a
  1774. X    HDC printer;
  1775. X    DLGPROC lpfnAbortProc;
  1776. X    DLGPROC lpfnPrintDlgProc;
  1777. X    PRINTDLG pd;
  1778. X    HWND hwnd;
  1779. X    RECT rect;
  1780. X    PRINT pr;
  1781. X    UINT widabort;
  1782. X
  1783. X    hwnd = lpgw->hWndGraph;
  1784. X
  1785. X    _fmemset(&pd, 0, sizeof(PRINTDLG));
  1786. X    pd.lStructSize = sizeof(PRINTDLG);
  1787. X    pd.hwndOwner = hwnd;
  1788. X    pd.Flags = PD_PRINTSETUP | PD_RETURNDC;
  1789. X
  1790. X    if (!PrintDlg(&pd))
  1791. X        return;
  1792. X    printer = pd.hDC;
  1793. X    if (NULL == printer)
  1794. X        return;    /* abort */
  1795. X
  1796. X    if (!PrintSize(printer, hwnd, &rect)) {
  1797. X        DeleteDC(printer);
  1798. X        return; /* abort */
  1799. X    }
  1800. X
  1801. X    pr.hdcPrn = printer;
  1802. X    SetWindowLong(hwnd, 4, (LONG)((LPPRINT)&pr));
  1803. X    PrintRegister((LPPRINT)&pr);
  1804. X
  1805. X    EnableWindow(hwnd,FALSE);
  1806. X    pr.bUserAbort = FALSE;
  1807. X#ifdef __DLL__
  1808. X    lpfnPrintDlgProc = (DLGPROC)GetProcAddress(hdllInstance, "PrintDlgProc");
  1809. X    lpfnAbortProc = (DLGPROC)GetProcAddress(hdllInstance, "PrintAbortProc");
  1810. X#else
  1811. X    lpfnPrintDlgProc = (DLGPROC)MakeProcInstance((FARPROC)PrintDlgProc, hdllInstance);
  1812. X    lpfnAbortProc = (DLGPROC)MakeProcInstance((FARPROC)PrintAbortProc, hdllInstance);
  1813. X#endif
  1814. X    pr.hDlgPrint = CreateDialogParam(hdllInstance,"PrintDlgBox",hwnd,lpfnPrintDlgProc,(LPARAM)lpgw->Title);
  1815. X    Escape(printer,SETABORTPROC,0,(LPSTR)lpfnAbortProc,NULL);  
  1816. X    if (Escape(printer, STARTDOC, lstrlen(lpgw->Title),lpgw->Title, NULL) > 0) {
  1817. X        SetMapMode(printer, MM_TEXT);
  1818. X        SetBkMode(printer,OPAQUE);
  1819. X        DestroyFonts(lpgw);
  1820. X        MakeFonts(lpgw, (RECT FAR *)&rect, printer);
  1821. X        DestroyPens(lpgw);    /* rebuild pens */
  1822. X        MakePens(lpgw, printer);
  1823. X        drawgraph(lpgw, printer, (void *) &rect);
  1824. X        if (Escape(printer,NEWFRAME,0,NULL,NULL) > 0)
  1825. X            Escape(printer,ENDDOC,0,NULL,NULL);
  1826. X    }
  1827. X    if (!pr.bUserAbort) {
  1828. X        EnableWindow(hwnd,TRUE);
  1829. X        DestroyWindow(pr.hDlgPrint);
  1830. X    }
  1831. X#ifndef __DLL__
  1832. X    FreeProcInstance((FARPROC)lpfnPrintDlgProc);
  1833. X    FreeProcInstance((FARPROC)lpfnAbortProc);
  1834. X#endif
  1835. X    DeleteDC(printer);
  1836. X    SetWindowLong(hwnd, 4, (LONG)(0L));
  1837. X    PrintUnregister((LPPRINT)&pr);
  1838. X    /* make certain that the screen pen set is restored */
  1839. X    SendMessage(lpgw->hWndGraph,WM_COMMAND,M_REBUILDTOOLS,0L);
  1840. X#endif
  1841. X    return;
  1842. X}
  1843. X
  1844. X/* ================================== */
  1845. X/*  INI file stuff */
  1846. Xvoid
  1847. XWriteGraphIni(LPGW lpgw)
  1848. X{
  1849. X    RECT rect;
  1850. X    int i;
  1851. X    char entry[32];
  1852. X    LPLOGPEN pc;
  1853. X    LPLOGPEN pm;
  1854. X    LPSTR file = lpgw->IniFile;
  1855. X    LPSTR section = lpgw->IniSection;
  1856. X    char profile[80];
  1857. X
  1858. X    if ((file == (LPSTR)NULL) || (section == (LPSTR)NULL))
  1859. X        return;
  1860. X    if (IsIconic(lpgw->hWndGraph))
  1861. X        ShowWindow(lpgw->hWndGraph, SW_SHOWNORMAL);
  1862. X    GetWindowRect(lpgw->hWndGraph,&rect);
  1863. X    wsprintf(profile, "%d %d", rect.left, rect.top);
  1864. X    WritePrivateProfileString(section, "GraphOrigin", profile, file);
  1865. X    wsprintf(profile, "%d %d", rect.right-rect.left, rect.bottom-rect.top);
  1866. X    WritePrivateProfileString(section, "GraphSize", profile, file);
  1867. X    wsprintf(profile, "%s,%d", lpgw->fontname, lpgw->fontsize);
  1868. X    WritePrivateProfileString(section, "GraphFont", profile, file);
  1869. X    wsprintf(profile, "%d", lpgw->color);
  1870. X    WritePrivateProfileString(section, "GraphColor", profile, file);
  1871. X    wsprintf(profile, "%d", lpgw->graphtotop);
  1872. X    WritePrivateProfileString(section, "GraphToTop", profile, file);
  1873. X    wsprintf(profile, "%d %d %d",GetRValue(lpgw->background),
  1874. X            GetGValue(lpgw->background), GetBValue(lpgw->background));
  1875. X    WritePrivateProfileString(section, "GraphBackground", profile, file);
  1876. X
  1877. X    /* now save pens */
  1878. X    for (i=0; i<WGNUMPENS+2; i++) {
  1879. X        if (i==0)
  1880. X            _fstrcpy(entry,"Border");
  1881. X        else if (i==1)
  1882. X            _fstrcpy(entry,"Axis");
  1883. X        else
  1884. X             wsprintf(entry,"Line%d",i-1);
  1885. X        pc = &lpgw->colorpen[i];
  1886. X        pm = &lpgw->monopen[i];
  1887. X        wsprintf(profile, "%d %d %d %d %d",GetRValue(pc->lopnColor),
  1888. X            GetGValue(pc->lopnColor), GetBValue(pc->lopnColor),
  1889. X            (pc->lopnWidth.x != 1) ? -pc->lopnWidth.x : pc->lopnStyle, 
  1890. X            (pm->lopnWidth.x != 1) ? -pm->lopnWidth.x : pm->lopnStyle);
  1891. X        WritePrivateProfileString(section, entry, profile, file);
  1892. X    }
  1893. X    return;
  1894. X}
  1895. X
  1896. Xvoid
  1897. XReadGraphIni(LPGW lpgw)
  1898. X{
  1899. X    LPSTR file = lpgw->IniFile;
  1900. X    LPSTR section = lpgw->IniSection;
  1901. X    char profile[81];
  1902. X    char entry[32];
  1903. X    LPSTR p;
  1904. X    int i,r,g,b,colorstyle,monostyle;
  1905. X    COLORREF ref;
  1906. X    BOOL bOKINI;
  1907. X
  1908. X    bOKINI = (file != (LPSTR)NULL) && (section != (LPSTR)NULL);
  1909. X    if (!bOKINI)
  1910. X        profile[0] = '\0';
  1911. X
  1912. X    if (bOKINI)
  1913. X      GetPrivateProfileString(section, "GraphOrigin", "", profile, 80, file);
  1914. X    if ( (p = GetInt(profile, &lpgw->Origin.x)) == NULL)
  1915. X        lpgw->Origin.x = CW_USEDEFAULT;
  1916. X    if ( (p = GetInt(p, &lpgw->Origin.y)) == NULL)
  1917. X        lpgw->Origin.y = CW_USEDEFAULT;
  1918. X    if (bOKINI)
  1919. X      GetPrivateProfileString(section, "GraphSize", "", profile, 80, file);
  1920. X    if ( (p = GetInt(profile, &lpgw->Size.x)) == NULL)
  1921. X        lpgw->Size.x = CW_USEDEFAULT;
  1922. X    if ( (p = GetInt(p, &lpgw->Size.y)) == NULL)
  1923. X        lpgw->Size.y = CW_USEDEFAULT;
  1924. X
  1925. X    if (bOKINI)
  1926. X      GetPrivateProfileString(section, "GraphFont", "", profile, 80, file);
  1927. X    {
  1928. X        char FAR *size;
  1929. X        size = _fstrchr(profile,',');
  1930. X        if (size) {
  1931. X            *size++ = '\0';
  1932. X            if ( (p = GetInt(size, &lpgw->fontsize)) == NULL)
  1933. X                lpgw->fontsize = WINFONTSIZE;
  1934. X        }
  1935. X        _fstrcpy(lpgw->fontname, profile);
  1936. X        if (lpgw->fontsize == 0)
  1937. X            lpgw->fontsize = WINFONTSIZE;
  1938. X        if (!(*lpgw->fontname))
  1939. X            if (LOWORD(GetVersion()) == 3)
  1940. X                _fstrcpy(lpgw->fontname,WIN30FONT);
  1941. X            else
  1942. X                _fstrcpy(lpgw->fontname,WINFONT);
  1943. X    }
  1944. X
  1945. X    if (bOKINI)
  1946. X      GetPrivateProfileString(section, "GraphColor", "", profile, 80, file);
  1947. X        if ( (p = GetInt(profile, &lpgw->color)) == NULL)
  1948. X            lpgw->color = TRUE;
  1949. X
  1950. X    if (bOKINI)
  1951. X      GetPrivateProfileString(section, "GraphToTop", "", profile, 80, file);
  1952. X        if ( (p = GetInt(profile, &lpgw->graphtotop)) == NULL)
  1953. X            lpgw->graphtotop = TRUE;
  1954. X
  1955. X    lpgw->background = RGB(255,255,255);
  1956. X    if (bOKINI)
  1957. X      GetPrivateProfileString(section, "GraphBackground", "", profile, 80, file);
  1958. X    if ( ((p = GetInt(profile, &r)) != NULL) &&
  1959. X         ((p = GetInt(p, &g)) != NULL) &&
  1960. X         ((p = GetInt(p, &b)) != NULL) )
  1961. X            lpgw->background = RGB(r,g,b);
  1962. X
  1963. X    StorePen(lpgw, 0,RGB(0,0,0),PS_SOLID,PS_SOLID);
  1964. X    if (bOKINI)
  1965. X      GetPrivateProfileString(section, "Border", "", profile, 80, file);
  1966. X    if ( ((p = GetInt(profile, &r)) != NULL) &&
  1967. X         ((p = GetInt(p, &g)) != NULL) &&
  1968. X         ((p = GetInt(p, &b)) != NULL) &&
  1969. X         ((p = GetInt(p, &colorstyle)) != NULL) &&
  1970. X         ((p = GetInt(p, &monostyle)) != NULL) )
  1971. X            StorePen(lpgw,0,RGB(r,g,b),colorstyle,monostyle);
  1972. X
  1973. X    StorePen(lpgw, 1,RGB(192,192,192),PS_DOT,PS_DOT);
  1974. X    if (bOKINI)
  1975. X      GetPrivateProfileString(section, "Axis", "", profile, 80, file);
  1976. X    if ( ((p = GetInt(profile, &r)) != NULL) &&
  1977. X         ((p = GetInt(p, &g)) != NULL) &&
  1978. X         ((p = GetInt(p, &b)) != NULL) &&
  1979. X         ((p = GetInt(p, &colorstyle)) != NULL) &&
  1980. X         ((p = GetInt(p, &monostyle)) != NULL) )
  1981. X            StorePen(lpgw,1,RGB(r,g,b),colorstyle,monostyle);
  1982. X
  1983. X    for (i=0; i<WGNUMPENS; i++)
  1984. X    {
  1985. X        ref = wginitcolor[ i%WGDEFCOLOR ];
  1986. X        colorstyle = wginitstyle[ (i/WGDEFCOLOR) % WGDEFSTYLE ];
  1987. X        monostyle  = wginitstyle[ i%WGDEFSTYLE ];
  1988. X        StorePen(lpgw, i+2,ref,colorstyle,monostyle);
  1989. X        wsprintf(entry,"Line%d",i+1);
  1990. X        if (bOKINI)
  1991. X          GetPrivateProfileString(section, entry, "", profile, 80, file);
  1992. X        if ( ((p = GetInt(profile, &r)) != NULL) &&
  1993. X             ((p = GetInt(p, &g)) != NULL) &&
  1994. X             ((p = GetInt(p, &b)) != NULL) &&
  1995. X             ((p = GetInt(p, &colorstyle)) != NULL) &&
  1996. X             ((p = GetInt(p, &monostyle)) != NULL) )
  1997. X                StorePen(lpgw,i+2,RGB(r,g,b),colorstyle,monostyle);
  1998. X    }
  1999. X}
  2000. X
  2001. X
  2002. X/* ================================== */
  2003. X
  2004. X#define LS_DEFLINE 2
  2005. Xtypedef struct tagLS {
  2006. X    int    widtype;
  2007. X    int    wid;
  2008. X    HWND    hwnd;
  2009. X    int    pen;            /* current pen number */
  2010. X    LOGPEN    colorpen[WGNUMPENS+2];    /* logical color pens */
  2011. X    LOGPEN    monopen[WGNUMPENS+2];    /* logical mono pens */
  2012. X} LS;
  2013. Xtypedef LS FAR*  LPLS;
  2014. X    
  2015. X
  2016. XCOLORREF
  2017. XGetColor(HWND hwnd, COLORREF ref)
  2018. X{
  2019. XCHOOSECOLOR cc;
  2020. XCOLORREF aclrCust[16];
  2021. Xint i;
  2022. X
  2023. X    for (i=0; i<16; i++) {
  2024. X        aclrCust[i] = RGB(0,0,0);
  2025. X    }
  2026. X    _fmemset(&cc, 0, sizeof(CHOOSECOLOR));
  2027. X    cc.lStructSize = sizeof(CHOOSECOLOR);
  2028. X    cc.hwndOwner = hwnd;
  2029. X    cc.lpCustColors = aclrCust;
  2030. X    cc.rgbResult = ref;
  2031. X    cc.Flags = CC_RGBINIT;
  2032. X    if (ChooseColor(&cc))
  2033. X        return cc.rgbResult;
  2034. X    return ref;
  2035. X}
  2036. X
  2037. X
  2038. X/* force update of owner draw button */
  2039. Xvoid
  2040. XUpdateColorSample(HWND hdlg)
  2041. X{
  2042. X    RECT rect;
  2043. X    POINT ptul, ptlr;
  2044. X    GetWindowRect( GetDlgItem(hdlg, LS_COLORSAMPLE), &rect);
  2045. X    ptul.x = rect.left;
  2046. X    ptul.y = rect.top;
  2047. X    ptlr.x = rect.right;
  2048. X    ptlr.y = rect.bottom;
  2049. X    ScreenToClient(hdlg, &ptul);
  2050. X    ScreenToClient(hdlg, &ptlr);
  2051. X    rect.left   = ptul.x;
  2052. X    rect.top    = ptul.y;
  2053. X    rect.right  = ptlr.x;
  2054. X    rect.bottom = ptlr.y;
  2055. X    InvalidateRect(hdlg, &rect, TRUE);
  2056. X    UpdateWindow(hdlg);
  2057. X}
  2058. X
  2059. XBOOL CALLBACK _export
  2060. XLineStyleDlgProc(HWND hdlg, UINT wmsg, WPARAM wparam, LPARAM lparam)
  2061. X{
  2062. X    char buf[16];
  2063. X    LPLS lpls;
  2064. X    int i;
  2065. X    UINT pen;
  2066. X    LPLOGPEN plpm, plpc;
  2067. X    lpls = (LPLS)GetWindowLong(GetParent(hdlg), 4);
  2068. X
  2069. X    switch (wmsg) {
  2070. X        case WM_INITDIALOG:
  2071. X            pen = 2;
  2072. X            for (i=0; i<WGNUMPENS+2; i++) {
  2073. X                if (i==0)
  2074. X                    _fstrcpy(buf,"Border");
  2075. X                else if (i==1)
  2076. X                    _fstrcpy(buf,"Axis");
  2077. X                else
  2078. X                     wsprintf(buf,"Line%d",i-1);
  2079. X                SendDlgItemMessage(hdlg, LS_LINENUM, LB_ADDSTRING, 0, 
  2080. X                    (LPARAM)((LPSTR)buf));
  2081. X            }
  2082. X            SendDlgItemMessage(hdlg, LS_LINENUM, LB_SETCURSEL, pen, 0L);
  2083. X
  2084. X            SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_ADDSTRING, 0, 
  2085. X                (LPARAM)((LPSTR)"Solid"));
  2086. X            SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_ADDSTRING, 0, 
  2087. X                (LPARAM)((LPSTR)"Dash"));
  2088. X            SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_ADDSTRING, 0, 
  2089. X                (LPARAM)((LPSTR)"Dot"));
  2090. X            SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_ADDSTRING, 0, 
  2091. X                (LPARAM)((LPSTR)"DashDot"));
  2092. X            SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_ADDSTRING, 0, 
  2093. X                (LPARAM)((LPSTR)"DashDotDot"));
  2094. X
  2095. X            plpm = &lpls->monopen[pen];
  2096. X            SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_SETCURSEL, 
  2097. X                plpm->lopnStyle, 0L);
  2098. X            wsprintf(buf,"%d",plpm->lopnWidth.x);
  2099. X            SetDlgItemText(hdlg, LS_MONOWIDTH, buf);
  2100. X
  2101. X            SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_ADDSTRING, 0, 
  2102. X                (LPARAM)((LPSTR)"Solid"));
  2103. X            SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_ADDSTRING, 0, 
  2104. X                (LPARAM)((LPSTR)"Dash"));
  2105. X            SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_ADDSTRING, 0, 
  2106. X                (LPARAM)((LPSTR)"Dot"));
  2107. X            SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_ADDSTRING, 0, 
  2108. X                (LPARAM)((LPSTR)"DashDot"));
  2109. X            SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_ADDSTRING, 0, 
  2110. X                (LPARAM)((LPSTR)"DashDotDot"));
  2111. X
  2112. X            plpc = &lpls->colorpen[pen];
  2113. X            SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_SETCURSEL, 
  2114. X                plpc->lopnStyle, 0L);
  2115. X            wsprintf(buf,"%d",plpc->lopnWidth.x);
  2116. X            SetDlgItemText(hdlg, LS_COLORWIDTH, buf);
  2117. X
  2118. X            return TRUE;
  2119. X        case WM_COMMAND:
  2120. X            pen = (UINT)SendDlgItemMessage(hdlg, LS_LINENUM, LB_GETCURSEL, 0, 0L);
  2121. X            plpm = &lpls->monopen[pen];
  2122. X            plpc = &lpls->colorpen[pen];
  2123. X            switch (LOWORD(wparam)) {
  2124. X                case LS_LINENUM:
  2125. X                    wsprintf(buf,"%d",plpm->lopnWidth.x);
  2126. X                    SetDlgItemText(hdlg, LS_MONOWIDTH, buf);
  2127. X                    SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_SETCURSEL, 
  2128. X                        plpm->lopnStyle, 0L);
  2129. X                    wsprintf(buf,"%d",plpc->lopnWidth.x);
  2130. X                    SetDlgItemText(hdlg, LS_COLORWIDTH, buf);
  2131. X                    SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_SETCURSEL, 
  2132. X                        plpc->lopnStyle, 0L);
  2133. X                    UpdateColorSample(hdlg);
  2134. X                    return FALSE;
  2135. X                case LS_MONOSTYLE:
  2136. X                    plpm->lopnStyle = 
  2137. X                        (UINT)SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_GETCURSEL, 0, 0L);
  2138. X                    if (plpm->lopnStyle != 0) {
  2139. X                        plpm->lopnWidth.x = 1;
  2140. X                        wsprintf(buf,"%d",plpm->lopnWidth.x);
  2141. X                        SetDlgItemText(hdlg, LS_MONOWIDTH, buf);
  2142. X                    }
  2143. X                    return FALSE;
  2144. X                case LS_MONOWIDTH:
  2145. X                    GetDlgItemText(hdlg, LS_MONOWIDTH, buf, 15);
  2146. X                    GetInt(buf, &plpm->lopnWidth.x);
  2147. X                    if (plpm->lopnWidth.x != 1) {
  2148. X                        plpm->lopnStyle = 0;
  2149. X                        SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_SETCURSEL, 
  2150. X                            plpm->lopnStyle, 0L);
  2151. X                    }
  2152. X                    return FALSE;
  2153. X                case LS_CHOOSECOLOR:
  2154. X                    plpc->lopnColor = GetColor(hdlg, plpc->lopnColor);
  2155. X                    UpdateColorSample(hdlg);
  2156. X                    return FALSE;
  2157. X                case LS_COLORSTYLE:
  2158. X                    plpc->lopnStyle = 
  2159. X                        (UINT)SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_GETCURSEL, 0, 0L);
  2160. X                    if (plpc->lopnStyle != 0) {
  2161. X                        plpc->lopnWidth.x = 1;
  2162. X                        wsprintf(buf,"%d",plpc->lopnWidth.x);
  2163. X                        SetDlgItemText(hdlg, LS_COLORWIDTH, buf);
  2164. X                    }
  2165. X                    return FALSE;
  2166. X                case LS_COLORWIDTH:
  2167. X                    GetDlgItemText(hdlg, LS_COLORWIDTH, buf, 15);
  2168. X                    GetInt(buf, &plpc->lopnWidth.x);
  2169. X                    if (plpc->lopnWidth.x != 1) {
  2170. X                        plpc->lopnStyle = 0;
  2171. X                        SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_SETCURSEL, 
  2172. X                            plpc->lopnStyle, 0L);
  2173. X                    }
  2174. X                    return FALSE;
  2175. X                case LS_DEFAULT:
  2176. X                    plpm = lpls->monopen;
  2177. X                    plpc = lpls->colorpen;
  2178. X                    /* border */
  2179. X                    plpc->lopnColor   = RGB(0,0,0);
  2180. X                    plpc->lopnStyle   = PS_SOLID;
  2181. X                    plpc->lopnWidth.x = 1;
  2182. X                    plpm->lopnStyle   = PS_SOLID;
  2183. X                    plpm->lopnWidth.x = 1;
  2184. X                    plpc++; plpm++;
  2185. X                    /* axis */
  2186. X                    plpc->lopnColor   = RGB(192,192,192);
  2187. X                    plpc->lopnStyle   = PS_DOT;
  2188. X                    plpc->lopnWidth.x = 1;
  2189. X                    plpm->lopnStyle   = PS_DOT;
  2190. X                    plpm->lopnWidth.x = 1;
  2191. X                    /* LineX */
  2192. X                    for (i=0; i<WGNUMPENS; i++) {
  2193. X                        plpc++; plpm++;
  2194. X                        plpc->lopnColor   = wginitcolor[ i%WGDEFCOLOR ];
  2195. X                        plpc->lopnStyle   = wginitstyle[ (i/WGDEFCOLOR) % WGDEFSTYLE ];
  2196. X                        plpc->lopnWidth.x = 1;
  2197. X                        plpm->lopnStyle   = wginitstyle[ i%WGDEFSTYLE ];
  2198. X                        plpm->lopnWidth.x = 1;
  2199. X                    }
  2200. X                    /* update window */
  2201. X                    plpm = &lpls->monopen[pen];
  2202. X                    plpc = &lpls->colorpen[pen];
  2203. X                    SendDlgItemMessage(hdlg, LS_LINENUM, LB_SETCURSEL, pen, 0L);
  2204. X                    wsprintf(buf,"%d",plpm->lopnWidth.x);
  2205. X                    SetDlgItemText(hdlg, LS_MONOWIDTH, buf);
  2206. X                    SendDlgItemMessage(hdlg, LS_MONOSTYLE, CB_SETCURSEL, 
  2207. X                        plpm->lopnStyle, 0L);
  2208. X                    wsprintf(buf,"%d",plpc->lopnWidth.x);
  2209. X                    SetDlgItemText(hdlg, LS_COLORWIDTH, buf);
  2210. X                    SendDlgItemMessage(hdlg, LS_COLORSTYLE, CB_SETCURSEL, 
  2211. X                        plpc->lopnStyle, 0L);
  2212. X                    UpdateColorSample(hdlg);
  2213. X                    return FALSE;
  2214. X                case IDOK:
  2215. X                    EndDialog(hdlg, IDOK);
  2216. X                    return TRUE;
  2217. X                case IDCANCEL:
  2218. X                    EndDialog(hdlg, IDCANCEL);
  2219. X                    return TRUE;
  2220. X            }
  2221. X            break;
  2222. X        case WM_DRAWITEM:
  2223. X            {
  2224. X            HBRUSH hBrush;
  2225. X            LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lparam;
  2226. X            pen = (UINT)SendDlgItemMessage(hdlg, LS_LINENUM, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
  2227. X            plpc = &lpls->colorpen[pen];
  2228. X            hBrush = CreateSolidBrush(plpc->lopnColor);
  2229. X            FillRect(lpdis->hDC, &lpdis->rcItem, hBrush);
  2230. X            FrameRect(lpdis->hDC, &lpdis->rcItem, GetStockBrush(BLACK_BRUSH));
  2231. X            DeleteBrush(hBrush);
  2232. X            }
  2233. X            return FALSE;
  2234. X    }
  2235. X    return FALSE;
  2236. X}
  2237. X
  2238. X
  2239. X
  2240. X/* GetWindowLong(hwnd, 4) must be available for use */
  2241. XBOOL
  2242. XLineStyle(LPGW lpgw)
  2243. X{
  2244. XDLGPROC lpfnLineStyleDlgProc ;
  2245. XBOOL status = FALSE;
  2246. XLS ls;
  2247. X    
  2248. X    SetWindowLong(lpgw->hWndGraph, 4, (LONG)((LPLS)&ls));
  2249. X    _fmemcpy(&ls.colorpen, &lpgw->colorpen, (WGNUMPENS + 2) * sizeof(LOGPEN));
  2250. X    _fmemcpy(&ls.monopen, &lpgw->monopen, (WGNUMPENS + 2) * sizeof(LOGPEN));
  2251. X
  2252. X#ifdef __DLL__
  2253. X    lpfnLineStyleDlgProc = (DLGPROC)GetProcAddress(hdllInstance, "LineStyleDlgProc");
  2254. X#else
  2255. X    lpfnLineStyleDlgProc = (DLGPROC)MakeProcInstance((FARPROC)LineStyleDlgProc, hdllInstance);
  2256. X#endif
  2257. X    if (DialogBox (hdllInstance, "LineStyleDlgBox", lpgw->hWndGraph, lpfnLineStyleDlgProc)
  2258. X        == IDOK) {
  2259. X        _fmemcpy(&lpgw->colorpen, &ls.colorpen, (WGNUMPENS + 2) * sizeof(LOGPEN));
  2260. X        _fmemcpy(&lpgw->monopen, &ls.monopen, (WGNUMPENS + 2) * sizeof(LOGPEN));
  2261. X        status = TRUE;
  2262. X    }
  2263. X#ifndef __DLL__
  2264. X    FreeProcInstance((FARPROC)lpfnLineStyleDlgProc);
  2265. X#endif
  2266. X    SetWindowLong(lpgw->hWndGraph, 4, (LONG)(0L));
  2267. X    return status;
  2268. X}
  2269. X
  2270. X/* ================================== */
  2271. X
  2272. XLRESULT CALLBACK _export
  2273. XWndGraphProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  2274. X{
  2275. X    HDC hdc;
  2276. X    PAINTSTRUCT ps;
  2277. X    RECT rect;
  2278. X    LPGW lpgw;
  2279. X
  2280. X    lpgw = (LPGW)GetWindowLong(hwnd, 0);
  2281. X
  2282. X    switch(message)
  2283. X    {
  2284. X        case WM_SYSCOMMAND:
  2285. X            switch(LOWORD(wParam))
  2286. X            {
  2287. X                case M_GRAPH_TO_TOP:
  2288. X                case M_COLOR:
  2289. X                case M_CHOOSE_FONT:
  2290. X                case M_COPY_CLIP:
  2291. X                case M_LINESTYLE:
  2292. X                case M_PRINT:
  2293. X                case M_WRITEINI:
  2294. X                case M_REBUILDTOOLS:
  2295. X                    SendMessage(hwnd, WM_COMMAND, wParam, lParam);
  2296. X                    break;
  2297. X                case M_ABOUT:
  2298. X                    if (lpgw->lptw)
  2299. X                        AboutBox(hwnd,lpgw->lptw->AboutText);
  2300. X                    return 0;
  2301. X            }
  2302. X            break;
  2303. X        case WM_COMMAND:
  2304. X            switch(LOWORD(wParam))
  2305. X            {
  2306. X                case M_GRAPH_TO_TOP:
  2307. X                    lpgw->graphtotop = !lpgw->graphtotop;
  2308. X                    SendMessage(hwnd,WM_COMMAND,M_REBUILDTOOLS,0L);
  2309. X                    return(0);
  2310. X                case M_COLOR:
  2311. X                    lpgw->color = !lpgw->color;
  2312. X                    SendMessage(hwnd,WM_COMMAND,M_REBUILDTOOLS,0L);
  2313. X                    return(0);
  2314. X                case M_CHOOSE_FONT:
  2315. X                    SelFont(lpgw);
  2316. X                    return 0;
  2317. X                case M_COPY_CLIP:
  2318. X                    CopyClip(lpgw);
  2319. X                    return 0;
  2320. X                case M_LINESTYLE:
  2321. X                    if (LineStyle(lpgw))
  2322. X                        SendMessage(hwnd,WM_COMMAND,M_REBUILDTOOLS,0L);
  2323. X                    return 0;
  2324. X                case M_BACKGROUND:
  2325. X                    lpgw->background = GetColor(hwnd, lpgw->background);
  2326. X                    SendMessage(hwnd,WM_COMMAND,M_REBUILDTOOLS,0L);
  2327. X                    return 0;
  2328. X                case M_PRINT:
  2329. X                    CopyPrint(lpgw);
  2330. X                    return 0;
  2331. X                case M_WRITEINI:
  2332. X                    WriteGraphIni(lpgw);
  2333. X                    if (lpgw->lptw)
  2334. X                        WriteTextIni(lpgw->lptw);
  2335. X                    return 0;
  2336. X                case M_REBUILDTOOLS:
  2337. X                    lpgw->resized = TRUE;
  2338. X                    if (lpgw->color) 
  2339. X                        CheckMenuItem(lpgw->hPopMenu, M_COLOR, MF_BYCOMMAND | MF_CHECKED);
  2340. X                    else
  2341. X                        CheckMenuItem(lpgw->hPopMenu, M_COLOR, MF_BYCOMMAND | MF_UNCHECKED);
  2342. X                    if (lpgw->graphtotop) 
  2343. X                        CheckMenuItem(lpgw->hPopMenu, M_GRAPH_TO_TOP, MF_BYCOMMAND | MF_CHECKED);
  2344. X                    else
  2345. X                        CheckMenuItem(lpgw->hPopMenu, M_GRAPH_TO_TOP, MF_BYCOMMAND | MF_UNCHECKED);
  2346. X                    DestroyPens(lpgw);
  2347. X                    DestroyFonts(lpgw);
  2348. X                    hdc = GetDC(hwnd);
  2349. X                    MakePens(lpgw, hdc);
  2350. X                    GetClientRect(hwnd, &rect);
  2351. X                    MakeFonts(lpgw, (LPRECT)&rect, hdc);
  2352. X                    ReleaseDC(hwnd, hdc);
  2353. X                    GetClientRect(hwnd, &rect);
  2354. X                    InvalidateRect(hwnd, (LPRECT) &rect, 1);
  2355. X                    UpdateWindow(hwnd);
  2356. X                    return 0;
  2357. X            }
  2358. X            return 0;
  2359. X        case WM_RBUTTONDOWN:
  2360. X            {
  2361. X            POINT pt;
  2362. X            pt.x = LOWORD(lParam);
  2363. X            pt.y = HIWORD(lParam);
  2364. X            ClientToScreen(hwnd,&pt);
  2365. X            TrackPopupMenu(lpgw->hPopMenu, TPM_LEFTALIGN, 
  2366. X                pt.x, pt.y, 0, hwnd, NULL);
  2367. X            }
  2368. X            return(0);
  2369. X        case WM_CREATE:
  2370. X            lpgw = ((CREATESTRUCT FAR *)lParam)->lpCreateParams;
  2371. X            SetWindowLong(hwnd, 0, (LONG)lpgw);
  2372. X            lpgw->hWndGraph = hwnd;
  2373. X            hdc = GetDC(hwnd);
  2374. X            MakePens(lpgw, hdc);
  2375. X            GetClientRect(hwnd, &rect);
  2376. X            MakeFonts(lpgw, (LPRECT)&rect, hdc);
  2377. X            ReleaseDC(hwnd, hdc);
  2378. X#if WINVER >= 0x030a
  2379. X            {
  2380. X            WORD version = LOWORD(GetVersion());
  2381. X            if ((LOBYTE(version)*100 + HIBYTE(version)) >= 310)
  2382. X                if ( lpgw->lptw && (lpgw->lptw->DragPre!=(LPSTR)NULL) && (lpgw->lptw->DragPost!=(LPSTR)NULL) )
  2383. X                    DragAcceptFiles(hwnd, TRUE);
  2384. X            }
  2385. X#endif
  2386. X            return(0);
  2387. X        case WM_PAINT:
  2388. X            hdc = BeginPaint(hwnd, &ps);
  2389. X            SetMapMode(hdc, MM_TEXT);
  2390. X            SetBkMode(hdc,OPAQUE);
  2391. X            GetClientRect(hwnd, &rect);
  2392. X            SetViewportExt(hdc, rect.right, rect.bottom);
  2393. X            drawgraph(lpgw, hdc, (void *) &rect);
  2394. X            EndPaint(hwnd, &ps);
  2395. X            return 0;
  2396. X        case WM_SIZE:
  2397. X            /* update font sizes if graph resized */
  2398. X            if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED)) {
  2399. X                RECT rect;
  2400. X                SendMessage(hwnd,WM_SYSCOMMAND,M_REBUILDTOOLS,0L);
  2401. X                GetWindowRect(hwnd,&rect);
  2402. X                lpgw->Size.x = rect.right-rect.left;
  2403. X                lpgw->Size.y = rect.bottom-rect.top;
  2404. X            }
  2405. X            break;
  2406. X#if WINVER >= 0x030a
  2407. X        case WM_DROPFILES:
  2408. X            {
  2409. X            WORD version = LOWORD(GetVersion());
  2410. X            if ((LOBYTE(version)*100 + HIBYTE(version)) >= 310)
  2411. X                if (lpgw->lptw)
  2412. X                    DragFunc(lpgw->lptw, (HDROP)wParam);
  2413. X            }
  2414. X            break;
  2415. X#endif
  2416. X        case WM_DESTROY:
  2417. X            DestroyPens(lpgw);
  2418. X            DestroyFonts(lpgw);
  2419. X#if __TURBOC__ >= 0x410    /* Borland C++ 3.1 or later */
  2420. X            {
  2421. X            WORD version = LOWORD(GetVersion());
  2422. X            if ((LOBYTE(version)*100 + HIBYTE(version)) >= 310)
  2423. X                DragAcceptFiles(hwnd, FALSE);
  2424. X            }
  2425. X#endif
  2426. X            return 0;
  2427. X        case WM_CLOSE:
  2428. X            GraphClose(lpgw);
  2429. X            return 0;
  2430. X        }
  2431. X    return DefWindowProc(hwnd, message, wParam, lParam);
  2432. X}
  2433. X
  2434. END_OF_FILE
  2435.   if test 40601 -ne `wc -c <'gnuplot/win/wgraph.c'`; then
  2436.     echo shar: \"'gnuplot/win/wgraph.c'\" unpacked with wrong size!
  2437.   fi
  2438.   # end of 'gnuplot/win/wgraph.c'
  2439. fi
  2440. echo shar: End of archive 14 \(of 33\).
  2441. cp /dev/null ark14isdone
  2442. MISSING=""
  2443. for I in 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 ; do
  2444.     if test ! -f ark${I}isdone ; then
  2445.     MISSING="${MISSING} ${I}"
  2446.     fi
  2447. done
  2448. if test "${MISSING}" = "" ; then
  2449.     echo You have unpacked all 33 archives.
  2450.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2451. else
  2452.     echo You still must unpack the following archives:
  2453.     echo "        " ${MISSING}
  2454. fi
  2455. exit 0
  2456. exit 0 # Just in case...
  2457.