home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume19 / xfig / part09 < prev    next >
Encoding:
Text File  |  1993-05-26  |  69.8 KB  |  2,472 lines

  1. Newsgroups: comp.sources.x
  2. From: envbvs@epb9.lbl.gov (Brian V. Smith)
  3. Subject: v19i121:  xfig - Draw amd manipulate objects in an X-Window, Part09/27
  4. Message-ID: <1993May21.021359.5646@sparky.imd.sterling.com>
  5. X-Md4-Signature: 5814eb403936751af46cbac30a798e10
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Fri, 21 May 1993 02:13:59 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: envbvs@epb9.lbl.gov (Brian V. Smith)
  12. Posting-number: Volume 19, Issue 121
  13. Archive-name: xfig/part09
  14. Environment: X11
  15. Supersedes: xfig: Volume 16, Issue 6-30,39
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 9 (of 27)."
  24. # Contents:  Examples/arithmetic.fig.uu f_epsobj.c f_readold.c
  25. #   u_create.c u_drag.c w_file.c
  26. # Wrapped by envbvs@epb9.lbl.gov.lbl.gov on Mon May  3 12:05:51 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'Examples/arithmetic.fig.uu' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Examples/arithmetic.fig.uu'\"
  30. else
  31. echo shar: Extracting \"'Examples/arithmetic.fig.uu'\" \(10539 characters\)
  32. sed "s/^X//" >'Examples/arithmetic.fig.uu' <<'END_OF_FILE'
  33. Xbegin 444 arithmetic.fig
  34. XM(T9)1R`R+C$*.#`@,@H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,B`P("TQ(#`@,"XP,#`@
  203. X5-"`Y(#,S(#(U."`Q-#(@041$,`$*
  204. X`
  205. Xend
  206. END_OF_FILE
  207. if test 10539 -ne `wc -c <'Examples/arithmetic.fig.uu'`; then
  208.     echo shar: \"'Examples/arithmetic.fig.uu'\" unpacked with wrong size!
  209. fi
  210. # end of 'Examples/arithmetic.fig.uu'
  211. fi
  212. if test -f 'f_epsobj.c' -a "${1}" != "-c" ; then 
  213.   echo shar: Will not clobber existing file \"'f_epsobj.c'\"
  214. else
  215. echo shar: Extracting \"'f_epsobj.c'\" \(10986 characters\)
  216. sed "s/^X//" >'f_epsobj.c' <<'END_OF_FILE'
  217. X/*
  218. X * FIG : Facility for Interactive Generation of figures
  219. X * Copyright (c) 1992 by Brian Boyter
  220. X * DPS option Copyright 1992 by Dave Hale
  221. X *
  222. X * "Permission to use, copy, modify, distribute, and sell this software and its
  223. X * documentation for any purpose is hereby granted without fee, provided that
  224. X * the above copyright notice appear in all copies and that both the copyright
  225. X * notice and this permission notice appear in supporting documentation. 
  226. X * No representations are made about the suitability of this software for 
  227. X * any purpose.  It is provided "as is" without express or implied warranty."
  228. X */
  229. X
  230. X/* GS bitmap generation added: 13 Nov 1992, by Michael C. Grant
  231. X*  (mcgrant@rascals.stanford.edu) adapted from Marc Goldburg's
  232. X*  (marcg@rascals.stanford.edu) original idea and code. */
  233. X
  234. X#include "fig.h"
  235. X#include "resources.h"
  236. X#include "object.h"
  237. X#include "paintop.h"
  238. X#include "u_create.h"
  239. X#include "u_elastic.h"
  240. X#include "w_canvas.h"
  241. X#include "w_setup.h"
  242. X#include "mode.h"
  243. X
  244. Xread_epsf(eps)
  245. X    F_eps       *eps;
  246. X{
  247. X    int            nbitmap;
  248. X    int            bitmapz;
  249. X    char       *cp;
  250. X    unsigned char  *mp;
  251. X    unsigned int    hexnib;
  252. X    int            flag,preview;
  253. X    char        buf[300];
  254. X    int            llx, lly, urx, ury, bad_bbox;
  255. X    FILE       *epsf;
  256. X    register unsigned char *last;
  257. X#ifdef DPS
  258. X    int dummy, useDPS;
  259. X#endif
  260. X#ifdef GSBIT
  261. X    FILE           *ppmfile, *gsfile;
  262. X    char           *ppmnam;
  263. X    int            useGS;
  264. X#endif
  265. X    int            usePV;
  266. X#ifdef DPS
  267. X    useDPS = 0;
  268. X#endif
  269. X#ifdef GSBIT
  270. X    useGS = 0;
  271. X#endif
  272. X    usePV = 0;
  273. X
  274. X    /* don't touch the flipped flag - caller has already set it */
  275. X    eps->bitmap = (unsigned char *) NULL;
  276. X    eps->hw_ratio = 0.0;
  277. X    eps->size_x = 0;
  278. X    eps->size_y = 0;
  279. X    eps->bit_size.x = 0;
  280. X    eps->bit_size.y = 0;
  281. X    eps->pixmap = (Pixmap) NULL;
  282. X    eps->pix_rotation = 0;
  283. X    eps->pix_width = 0;
  284. X    eps->pix_height = 0;
  285. X    eps->pix_flipped = 0;
  286. X
  287. X    epsf = fopen(eps->file, "r");
  288. X    if (epsf == NULL) {
  289. X    file_msg("Cannot open file: %s", eps->file);
  290. X    return 0;
  291. X    }
  292. X    while (fgets(buf, 300, epsf) != NULL) {
  293. X    lower(buf);
  294. X    if (!strncmp(buf, "%%boundingbox", 13)) {
  295. X        /* the Encapsulated PostScript Specifications (2.0) doesn't say
  296. X           that the values for the bounding box must be integers */
  297. X        float rllx, rlly, rurx, rury;
  298. X        if (sscanf(buf, "%%%%boundingbox: %f %f %f %f",
  299. X               &rllx, &rlly, &rurx, &rury) < 4) {
  300. X        file_msg("Bad EPS file: %s", eps->file);
  301. X        fclose(epsf);
  302. X        return 0;
  303. X        }
  304. X        llx = round(rllx);
  305. X        lly = round(rlly);
  306. X        urx = round(rurx);
  307. X        ury = round(rury);
  308. X        break;
  309. X    }
  310. X    }
  311. X
  312. X    eps->hw_ratio = (float) (ury - lly) / (float) (urx - llx);
  313. X    eps->size_x = (urx - llx) * PIX_PER_INCH / 72.0;
  314. X    eps->size_y = (ury - lly) * PIX_PER_INCH / 72.0;
  315. X
  316. X    if ( bad_bbox = ( urx <= llx || ury <= lly ) ) {
  317. X    file_msg("Bad values in EPS bounding box");
  318. X    }
  319. X    bitmapz = 0;
  320. X
  321. X#ifdef DPS
  322. X    /* if Display PostScript on server */
  323. X    if (XQueryExtension(tool_d,"DPSExtension",&dummy,&dummy,&dummy)) {
  324. X    eps->bit_size.x = eps->size_x;
  325. X    eps->bit_size.y = eps->size_y;
  326. X    bitmapz = 1;
  327. X    useDPS = 1;
  328. X    /* else if no Display PostScript */
  329. X    } else {
  330. X#endif
  331. X    /* look for a preview bitmap */
  332. X    while (fgets(buf, 300, epsf) != NULL) {
  333. X        lower(buf);
  334. X        if (!strncmp(buf, "%%beginpreview", 14)) {
  335. X        sscanf(buf, "%%%%beginpreview: %d %d %d",
  336. X           &eps->bit_size.x, &eps->bit_size.y, &bitmapz);
  337. X        bitmapz = 1;
  338. X        usePV = 1;
  339. X        break;
  340. X        }
  341. X    }
  342. X#ifdef GSBIT
  343. X    /* if GhostScript exists */
  344. X    if (!bitmapz && !bad_bbox && (gsfile = popen("gs -sDEVICE=bit -q -","w" ))) {
  345. X        ppmnam = tempnam(NULL,"xfig");
  346. X        eps->bit_size.x = urx - llx + 1;
  347. X        eps->bit_size.y = ury - lly + 1;
  348. X        bitmapz = 1;
  349. X        useGS = 1;
  350. X    }
  351. X#endif
  352. X#ifdef DPS
  353. X    }
  354. X#endif
  355. X    if (!bitmapz) {
  356. X        file_msg("EPS object read OK, but no preview bitmap found/generated");
  357. X        fclose(epsf);
  358. X        return 0;
  359. X    } else if ( eps->bit_size.x <= 0 || eps->bit_size.y <= 0 ) {
  360. X        file_msg("Strange bounding-box/bitmap-size error, no bitmap found/generated");
  361. X        fclose(epsf);
  362. X#ifdef GSBIT
  363. X        if ( useGS )
  364. X            pclose( gsfile );
  365. X#endif
  366. X        return 0;
  367. X    } else {
  368. X    nbitmap = (eps->bit_size.x + 7) / 8 * eps->bit_size.y;
  369. X    eps->bitmap = (unsigned char *) malloc(nbitmap);
  370. X    if (eps->bitmap == NULL) {
  371. X        file_msg("Could not allocate %d bytes of memory for EPS bitmap\n",
  372. X                     nbitmap);
  373. X        fclose(epsf);
  374. X#ifdef GSBIT
  375. X            if ( useGS )
  376. X                pclose( gsfile );
  377. X#endif
  378. X        return 0;
  379. X    }
  380. X    }
  381. X#ifdef DPS
  382. X    /* if Display PostScript */
  383. X    if ( useDPS ) {
  384. X    static int bitmapDPS (FILE*,int,int,int,int,int,int,int,unsigned char *);
  385. X        if (!bitmapDPS(epsf,llx,lly,urx,ury,
  386. X                       eps->size_x,eps->size_y,nbitmap,eps->bitmap)) {
  387. X            file_msg("DPS extension failed to generate EPS bitmap\n");
  388. X            fclose(epsf);
  389. X            return 0;
  390. X        }
  391. X    }
  392. X#endif
  393. X#ifdef GSBIT
  394. X    /* if GhostScript */
  395. X    if ( useGS ) {
  396. X        ppmnam = tempnam("/usr/tmp","xfig");
  397. X     fprintf(gsfile, "[1 0 0 1 0 0] %d %d <ff 00>\n", eps->bit_size.x, 
  398. X         eps->bit_size.y);
  399. X     fprintf(gsfile, "makeimagedevice setdevice\n");
  400. X     fprintf(gsfile, "0 %d translate 1 -1 scale\n", eps->bit_size.y);
  401. X     fprintf(gsfile, "%d neg %d neg translate\n", llx, lly);
  402. X     fprintf(gsfile, "/showpage {null exec} def (%s) run\n", eps->file);
  403. X     fprintf(gsfile, "(%s) (w) file currentdevice writeppmfile quit\n",
  404. X         ppmnam);        
  405. X        if ( pclose(gsfile) != 0 || ( ppmfile = fopen(ppmnam,"r") ) == NULL ) {
  406. X            put_msg( "Could not parse EPS file with GS: %s", eps->file);
  407. X            free(eps->bitmap); eps->bitmap = NULL;
  408. X            unlink(ppmnam);
  409. X            return 0;
  410. X        }
  411. X        fgets(buf, 300, ppmfile);
  412. X        fgets(buf, 300, ppmfile);
  413. X        fgets(buf, 300, ppmfile);
  414. X        if ( fread(eps->bitmap,nbitmap,1,ppmfile) != 1 ) {
  415. X            put_msg("Error reading ppm file (EPS problems?): %s", ppmnam);
  416. X            fclose(ppmfile); unlink(ppmnam);
  417. X            free(eps->bitmap); eps->bitmap = NULL;
  418. X            return 0;
  419. X        }
  420. X        fclose(ppmfile); unlink(ppmnam);
  421. X    }
  422. X#endif
  423. X    if ( usePV ) {
  424. X        mp = eps->bitmap;
  425. X        bzero(mp, nbitmap);    /* init bitmap to zero */
  426. X        last = eps->bitmap + nbitmap;
  427. X        flag = True;
  428. X        while (fgets(buf, 300, epsf) != NULL && mp < last) {
  429. X            lower(buf);
  430. X            if (!strncmp(buf, "%%endpreview", 12) ||
  431. X                !strncmp(buf, "%%endimage", 10))
  432. X                break;
  433. X            cp = buf;
  434. X            if (*cp != '%')
  435. X                break;
  436. X            cp++;
  437. X            while (*cp != '\0') {
  438. X                if (isxdigit(*cp)) {
  439. X                    hexnib = hex(*cp);
  440. X                    if (flag) {
  441. X                        flag = False;
  442. X                        *mp = hexnib << 4;
  443. X                    } else {
  444. X                        flag = True;
  445. X                        *mp = *mp + hexnib;
  446. X                        mp++;
  447. X                        if (mp >= last)
  448. X                            break;
  449. X                    }
  450. X                }
  451. X                cp++;
  452. X            }
  453. X        }
  454. X    }
  455. X    put_msg("EPS object read OK");
  456. X    fclose(epsf);
  457. X    return 1;
  458. X}
  459. X
  460. Xint
  461. Xhex(c)
  462. X    char        c;
  463. X{
  464. X    if (isdigit(c))
  465. X    return (c - 48);
  466. X    else
  467. X    return (c - 87);
  468. X}
  469. X
  470. Xlower(buf)
  471. X    char       *buf;
  472. X{
  473. X    while (*buf) {
  474. X    if (isupper(*buf))
  475. X        *buf = (char) tolower(*buf);
  476. X    buf++;
  477. X    }
  478. X}
  479. X
  480. X/* Display PostScript */
  481. X#ifdef DPS
  482. X
  483. X#ifdef sgi
  484. X#include <X11/extensions/XDPS.h>
  485. X#include <X11/extensions/XDPSlib.h>
  486. X#include <X11/extensions/dpsXclient.h>
  487. X#else
  488. X#include <DPS/XDPS.h>
  489. X#include <DPS/XDPSlib.h>
  490. X#include <DPS/dpsXclient.h>
  491. X#endif
  492. X
  493. X#define LBUF 1000
  494. X
  495. Xstatic 
  496. Xint bitmapDPS (FILE *fp, int llx, int lly, int urx, int ury,
  497. X    int width, int height, int nbitmap, unsigned char *bitmap)
  498. X{
  499. X    Display *dpy=tool_d;
  500. X    int scr=tool_sn;
  501. X    unsigned long black=BlackPixel(dpy,scr),white=WhitePixel(dpy,scr);
  502. X    char buf[LBUF];
  503. X    unsigned char *bp,*dp;
  504. X    int line,byte,nbyte;
  505. X    int scrwidth,scrheight,scrwidthmm,scrheightmm;
  506. X    float dppi;
  507. X    GC gcbit;
  508. X    Colormap cm;
  509. X    Pixmap bit;
  510. X    XColor color;
  511. X    XStandardColormap *scm;
  512. X    XImage *image;
  513. X    DPSContext dps;
  514. X    
  515. X    /* create bit pixmap and its GC */
  516. X    bit = XCreatePixmap(dpy,DefaultRootWindow(dpy),width,height,
  517. X                DefaultDepthOfScreen(tool_s));
  518. X        gcbit = XCreateGC(dpy,bit,0,NULL);
  519. X
  520. X        /* create standard colormap for black-and-white only */
  521. X        cm = XCreateColormap(dpy,RootWindow(dpy,scr),
  522. X                DefaultVisual(dpy,scr),AllocAll);
  523. X        color.pixel = 0;
  524. X        color.red = color.green = color.blue = 0;
  525. X        color.flags = DoRed | DoGreen | DoBlue;
  526. X        XStoreColor(dpy,cm,&color);
  527. X        color.pixel = 1;
  528. X        color.red = color.green = color.blue = 65535;
  529. X        color.flags = DoRed | DoGreen | DoBlue;
  530. X        XStoreColor(dpy,cm,&color);
  531. X        scm = XAllocStandardColormap();
  532. X        scm->colormap = cm;
  533. X        scm->red_max = 1;
  534. X        scm->red_mult = 1;
  535. X        scm->base_pixel = 0;
  536. X        scm->visualid = XVisualIDFromVisual(DefaultVisual(dpy,scr));
  537. X
  538. X        /* create and set Display PostScript context for bit pixmap */
  539. X        dps = XDPSCreateContext(dpy,bit,gcbit,0,height,0,scm,NULL,0,
  540. X                DPSDefaultTextBackstop,DPSDefaultErrorProc,NULL);
  541. X        if (dps==NULL) {
  542. X        file_msg("Cannot create Display PostScript context!");
  543. X        return 0;
  544. X        }
  545. X        DPSPrintf(dps,"\n resyncstart\n");
  546. X        DPSSetContext(dps);
  547. X        DPSFlushContext(dps);
  548. X        DPSWaitContext(dps);
  549. X
  550. X    /* display pixels per inch */
  551. X    scrwidth = WidthOfScreen(DefaultScreenOfDisplay(dpy));
  552. X    scrheight = HeightOfScreen(DefaultScreenOfDisplay(dpy));
  553. X    scrwidthmm = WidthMMOfScreen(DefaultScreenOfDisplay(dpy));
  554. X    scrheightmm = HeightMMOfScreen(DefaultScreenOfDisplay(dpy));
  555. X    dppi = 0.5*((int)(25.4*scrwidth/scrwidthmm)+
  556. X        (int)(25.4*scrheight/scrheightmm));
  557. X
  558. X        /* scale */
  559. X        DPSPrintf(dps,"%f %f scale\n",PIX_PER_INCH/dppi,PIX_PER_INCH/dppi);
  560. X
  561. X        /* paint white background */
  562. X        DPSPrintf(dps,
  563. X                  "gsave\n 1 setgray\n 0 0 %d %d rectfill\n grestore\n",
  564. X                  urx-llx+2,ury-lly+2);
  565. X
  566. X        /* translate */
  567. X        DPSPrintf(dps,"%d %d translate\n",-llx,-lly);
  568. X
  569. X        /* read PostScript from standard input and render in bit pixmap */
  570. X        DPSPrintf(dps,"/showpage {} def\n");
  571. X        while (fgets(buf,LBUF,fp)!=NULL)
  572. X                DPSWritePostScript(dps,buf,strlen(buf));
  573. X        DPSFlushContext(dps);
  574. X        DPSWaitContext(dps);
  575. X
  576. X    /* get image from bit pixmap */
  577. X    image = XGetImage(dpy,bit,0,0,width,height,1,XYPixmap);
  578. X
  579. X    /* copy bits from image to bitmap */
  580. X    bzero(bitmap,nbitmap);
  581. X    nbyte = (width+7)/8;
  582. X    for (line=0; line<height; ++line) {
  583. X        bp = bitmap+line*nbyte;
  584. X        dp = (unsigned char*)(image->data+line*image->bytes_per_line);
  585. X        for (byte=0; byte<nbyte; ++byte)
  586. X            *bp++ = ~(*dp++);
  587. X    }
  588. X
  589. X    /* clean up */
  590. X        DPSDestroySpace(DPSSpaceFromContext(dps));
  591. X    XFreePixmap(dpy,bit);
  592. X    XFreeColormap(dpy,cm);
  593. X    XFreeGC(dpy,gcbit);
  594. X    XDestroyImage(image);
  595. X}
  596. X#endif /* DPS */
  597. END_OF_FILE
  598. if test 10986 -ne `wc -c <'f_epsobj.c'`; then
  599.     echo shar: \"'f_epsobj.c'\" unpacked with wrong size!
  600. fi
  601. # end of 'f_epsobj.c'
  602. fi
  603. if test -f 'f_readold.c' -a "${1}" != "-c" ; then 
  604.   echo shar: Will not clobber existing file \"'f_readold.c'\"
  605. else
  606. echo shar: Extracting \"'f_readold.c'\" \(10730 characters\)
  607. sed "s/^X//" >'f_readold.c' <<'END_OF_FILE'
  608. X/*
  609. X * FIG : Facility for Interactive Generation of figures
  610. X * Copyright (c) 1985 by Supoj Sutanthavibul
  611. X *
  612. X * "Permission to use, copy, modify, distribute, and sell this software and its
  613. X * documentation for any purpose is hereby granted without fee, provided that
  614. X * the above copyright notice appear in all copies and that both the copyright
  615. X * notice and this permission notice appear in supporting documentation. 
  616. X * No representations are made about the suitability of this software for 
  617. X * any purpose.  It is provided "as is" without express or implied warranty."
  618. X */
  619. X
  620. X#include "fig.h"
  621. X#include "resources.h"
  622. X#include "object.h"
  623. X#include "u_create.h"
  624. X
  625. X/*******    Fig 1.3 subtype of objects      *******/
  626. X#define            DRAW_ELLIPSE_BY_RAD    1
  627. X#define            DRAW_ELLIPSE_BY_DIA    2
  628. X#define            DRAW_CIRCLE_BY_RAD    3
  629. X#define            DRAW_CIRCLE_BY_DIA    4
  630. X#define            DRAW_CIRCULAR_ARC    5
  631. X#define            DRAW_POLYLINE        6
  632. X#define            DRAW_BOX        7
  633. X#define            DRAW_POLYGON        8
  634. X#define            DRAW_TEXT        9
  635. X#define            DRAW_SPLINE        10
  636. X#define            DRAW_CLOSEDSPLINE    11
  637. X#define            DRAW_COMPOUND        13
  638. X
  639. Xstatic F_ellipse *read_1_3_ellipseobject();
  640. Xstatic F_line  *read_1_3_lineobject();
  641. Xstatic F_text  *read_1_3_textobject();
  642. Xstatic F_spline *read_1_3_splineobject();
  643. Xstatic F_arc   *read_1_3_arcobject();
  644. Xstatic F_compound *read_1_3_compoundobject();
  645. X
  646. Xextern int    line_no;
  647. Xextern int    num_object;
  648. X
  649. Xint
  650. Xread_1_3_objects(fp, obj)
  651. X    FILE       *fp;
  652. X    F_compound       *obj;
  653. X{
  654. X    F_ellipse       *e, *le = NULL;
  655. X    F_line       *l, *ll = NULL;
  656. X    F_text       *t, *lt = NULL;
  657. X    F_spline       *s, *ls = NULL;
  658. X    F_arc       *a, *la = NULL;
  659. X    F_compound       *c, *lc = NULL;
  660. X    int            n;
  661. X    int            object, pixperinch, canvaswid, canvasht, coord_sys;
  662. X
  663. X    n = fscanf(fp, "%d%d%d%d\n", &pixperinch, &coord_sys, &canvaswid, &canvasht);
  664. X    if (n != 4) {
  665. X    file_msg("Incorrect format in the first line in input file");
  666. X    return (-1);
  667. X    }
  668. X    obj->nwcorner.x = pixperinch;
  669. X    obj->nwcorner.y = coord_sys;
  670. X    while (fscanf(fp, "%d", &object) == 1) {
  671. X    switch (object) {
  672. X    case O_POLYLINE:
  673. X        if ((l = read_1_3_lineobject(fp)) == NULL)
  674. X        return (-1);
  675. X        if (ll)
  676. X        ll = (ll->next = l);
  677. X        else
  678. X        ll = obj->lines = l;
  679. X        num_object++;
  680. X        break;
  681. X    case O_SPLINE:
  682. X        if ((s = read_1_3_splineobject(fp)) == NULL)
  683. X        return (-1);
  684. X        if (ls)
  685. X        ls = (ls->next = s);
  686. X        else
  687. X        ls = obj->splines = s;
  688. X        num_object++;
  689. X        break;
  690. X    case O_ELLIPSE:
  691. X        if ((e = read_1_3_ellipseobject(fp)) == NULL)
  692. X        return (-1);
  693. X        if (le)
  694. X        le = (le->next = e);
  695. X        else
  696. X        le = obj->ellipses = e;
  697. X        num_object++;
  698. X        break;
  699. X    case O_ARC:
  700. X        if ((a = read_1_3_arcobject(fp)) == NULL)
  701. X        return (-1);
  702. X        if (la)
  703. X        la = (la->next = a);
  704. X        else
  705. X        la = obj->arcs = a;
  706. X        num_object++;
  707. X        break;
  708. X    case O_TEXT:
  709. X        if ((t = read_1_3_textobject(fp)) == NULL)
  710. X        return (-1);
  711. X        if (lt)
  712. X        lt = (lt->next = t);
  713. X        else
  714. X        lt = obj->texts = t;
  715. X        num_object++;
  716. X        break;
  717. X    case O_COMPOUND:
  718. X        if ((c = read_1_3_compoundobject(fp)) == NULL)
  719. X        return (-1);
  720. X        if (lc)
  721. X        lc = (lc->next = c);
  722. X        else
  723. X        lc = obj->compounds = c;
  724. X        num_object++;
  725. X        break;
  726. X    default:
  727. X        file_msg("Incorrect object code %d", object);
  728. X        return (-1);
  729. X    }            /* switch */
  730. X    }                /* while */
  731. X    if (feof(fp))
  732. X    return (0);
  733. X    else
  734. X    return (errno);
  735. X}
  736. X
  737. Xstatic F_arc   *
  738. Xread_1_3_arcobject(fp)
  739. X    FILE       *fp;
  740. X{
  741. X    F_arc       *a;
  742. X    int            f, b, h, w, n;
  743. X
  744. X    if ((a = create_arc()) == NULL)
  745. X    return (NULL);
  746. X
  747. X    a->type = T_3_POINTS_ARC;
  748. X    a->color = BLACK;
  749. X    a->depth = 0;
  750. X    a->pen = 0;
  751. X    a->for_arrow = NULL;
  752. X    a->back_arrow = NULL;
  753. X    a->next = NULL;
  754. X    n = fscanf(fp, " %d %d %d %f %d %d %d %d %d %f %f %d %d %d %d %d %d\n",
  755. X           &a->type, &a->style, &a->thickness,
  756. X           &a->style_val, &a->direction, &f, &b,
  757. X           &h, &w, &a->center.x, &a->center.y,
  758. X           &a->point[0].x, &a->point[0].y,
  759. X           &a->point[1].x, &a->point[1].y,
  760. X           &a->point[2].x, &a->point[2].y);
  761. X    if (n != 17) {
  762. X    file_msg("Incomplete arc data");
  763. X    free((char *) a);
  764. X    return (NULL);
  765. X    }
  766. X    if (f) {
  767. X    a->for_arrow = forward_arrow();
  768. X    a->for_arrow->wid = w;
  769. X    a->for_arrow->ht = h;
  770. X    }
  771. X    if (b) {
  772. X    a->back_arrow = backward_arrow();
  773. X    a->back_arrow->wid = w;
  774. X    a->back_arrow->ht = h;
  775. X    }
  776. X    return (a);
  777. X}
  778. X
  779. Xstatic F_compound *
  780. Xread_1_3_compoundobject(fp)
  781. X    FILE       *fp;
  782. X{
  783. X    F_arc       *a, *la = NULL;
  784. X    F_ellipse       *e, *le = NULL;
  785. X    F_line       *l, *ll = NULL;
  786. X    F_spline       *s, *ls = NULL;
  787. X    F_text       *t, *lt = NULL;
  788. X    F_compound       *com, *c, *lc = NULL;
  789. X    int            n, object;
  790. X
  791. X    if ((com = create_compound()) == NULL)
  792. X    return (NULL);
  793. X
  794. X    com->arcs = NULL;
  795. X    com->ellipses = NULL;
  796. X    com->lines = NULL;
  797. X    com->splines = NULL;
  798. X    com->texts = NULL;
  799. X    com->compounds = NULL;
  800. X    com->next = NULL;
  801. X    n = fscanf(fp, " %d %d %d %d\n", &com->nwcorner.x, &com->nwcorner.y,
  802. X           &com->secorner.x, &com->secorner.y);
  803. X    if (n != 4) {
  804. X    file_msg("Incorrect compound object format");
  805. X    return (NULL);
  806. X    }
  807. X    while (fscanf(fp, "%d", &object) == 1) {
  808. X    switch (object) {
  809. X    case O_POLYLINE:
  810. X        if ((l = read_1_3_lineobject(fp)) == NULL) {
  811. X        free_line(&l);
  812. X        return (NULL);
  813. X        }
  814. X        if (ll)
  815. X        ll = (ll->next = l);
  816. X        else
  817. X        ll = com->lines = l;
  818. X        break;
  819. X    case O_SPLINE:
  820. X        if ((s = read_1_3_splineobject(fp)) == NULL) {
  821. X        free_spline(&s);
  822. X        return (NULL);
  823. X        }
  824. X        if (ls)
  825. X        ls = (ls->next = s);
  826. X        else
  827. X        ls = com->splines = s;
  828. X        break;
  829. X    case O_ELLIPSE:
  830. X        if ((e = read_1_3_ellipseobject(fp)) == NULL) {
  831. X        free_ellipse(&e);
  832. X        return (NULL);
  833. X        }
  834. X        if (le)
  835. X        le = (le->next = e);
  836. X        else
  837. X        le = com->ellipses = e;
  838. X        break;
  839. X    case O_ARC:
  840. X        if ((a = read_1_3_arcobject(fp)) == NULL) {
  841. X        free_arc(&a);
  842. X        return (NULL);
  843. X        }
  844. X        if (la)
  845. X        la = (la->next = a);
  846. X        else
  847. X        la = com->arcs = a;
  848. X        break;
  849. X    case O_TEXT:
  850. X        if ((t = read_1_3_textobject(fp)) == NULL) {
  851. X        free_text(&t);
  852. X        return (NULL);
  853. X        }
  854. X        if (lt)
  855. X        lt = (lt->next = t);
  856. X        else
  857. X        lt = com->texts = t;
  858. X        break;
  859. X    case O_COMPOUND:
  860. X        if ((c = read_1_3_compoundobject(fp)) == NULL) {
  861. X        free_compound(&c);
  862. X        return (NULL);
  863. X        }
  864. X        if (lc)
  865. X        lc = (lc->next = c);
  866. X        else
  867. X        lc = com->compounds = c;
  868. X        break;
  869. X    case O_END_COMPOUND:
  870. X        return (com);
  871. X    }            /* switch */
  872. X    }
  873. X    if (feof(fp))
  874. X    return (com);
  875. X    else {
  876. X    file_msg("Format error: %s", sys_errlist[errno]);
  877. X    return (NULL);
  878. X    }
  879. X}
  880. X
  881. Xstatic F_ellipse *
  882. Xread_1_3_ellipseobject(fp)
  883. X    FILE       *fp;
  884. X{
  885. X    F_ellipse       *e;
  886. X    int            n, t;
  887. X
  888. X    if ((e = create_ellipse()) == NULL)
  889. X    return (NULL);
  890. X
  891. X    e->color = BLACK;
  892. X    e->angle = 0.0;
  893. X    e->depth = 0;
  894. X    e->pen = 0;
  895. X    e->fill_style = 0;
  896. X    e->next = NULL;
  897. X    n = fscanf(fp, " %d %d %d %f %d %d %d %d %d %d %d %d %d\n",
  898. X           &t, &e->style,
  899. X           &e->thickness, &e->style_val, &e->direction,
  900. X           &e->center.x, &e->center.y,
  901. X           &e->radiuses.x, &e->radiuses.y,
  902. X           &e->start.x, &e->start.y,
  903. X           &e->end.x, &e->end.y);
  904. X    if (n != 13) {
  905. X    file_msg("Incomplete ellipse data");
  906. X    free((char *) e);
  907. X    return (NULL);
  908. X    }
  909. X    if (t == DRAW_ELLIPSE_BY_RAD)
  910. X    e->type = T_ELLIPSE_BY_RAD;
  911. X    else if (t == DRAW_ELLIPSE_BY_DIA)
  912. X    e->type = T_ELLIPSE_BY_DIA;
  913. X    else if (t == DRAW_CIRCLE_BY_RAD)
  914. X    e->type = T_CIRCLE_BY_RAD;
  915. X    else
  916. X    e->type = T_CIRCLE_BY_DIA;
  917. X    return (e);
  918. X}
  919. X
  920. Xstatic F_line  *
  921. Xread_1_3_lineobject(fp)
  922. X    FILE       *fp;
  923. X{
  924. X    F_line       *l;
  925. X    F_point       *p, *q;
  926. X    int            f, b, h, w, n, t, x, y;
  927. X
  928. X    if ((l = create_line()) == NULL)
  929. X    return (NULL);
  930. X
  931. X    l->color = BLACK;
  932. X    l->depth = 0;
  933. X    l->pen = 0;
  934. X    l->fill_style = 0;
  935. X    l->for_arrow = NULL;
  936. X    l->back_arrow = NULL;
  937. X    l->next = NULL;
  938. X    if ((p = create_point()) == NULL) {
  939. X    free((char *) l);
  940. X    return (NULL);
  941. X    }
  942. X    l->points = p;
  943. X    n = fscanf(fp, " %d %d %d %f %d %d %d %d %d %d", &t,
  944. X           &l->style, &l->thickness, &l->style_val,
  945. X           &f, &b, &h, &w, &p->x, &p->y);
  946. X    if (n != 10) {
  947. X    file_msg("Incomplete line data");
  948. X    free((char *) l);
  949. X    return (NULL);
  950. X    }
  951. X    if (t == DRAW_POLYLINE)
  952. X    l->type = T_POLYLINE;
  953. X    else if (t == DRAW_POLYGON)
  954. X    l->type = T_POLYGON;
  955. X    else
  956. X    l->type = T_BOX;
  957. X    if (f) {
  958. X    l->for_arrow = forward_arrow();
  959. X    l->for_arrow->wid = w;
  960. X    l->for_arrow->ht = h;
  961. X    }
  962. X    if (b) {
  963. X    l->back_arrow = backward_arrow();
  964. X    l->back_arrow->wid = w;
  965. X    l->back_arrow->ht = h;
  966. X    }
  967. X    for (;;) {
  968. X    if (fscanf(fp, " %d %d", &x, &y) != 2) {
  969. X        file_msg("Incomplete line object");
  970. X        free_linestorage(l);
  971. X        return (NULL);
  972. X    }
  973. X    if (x == 9999)
  974. X        break;
  975. X    if ((q = create_point()) == NULL)
  976. X        return (NULL);
  977. X    q->x = x;
  978. X    q->y = y;
  979. X    q->next = NULL;
  980. X    p->next = q;
  981. X    p = q;
  982. X    }
  983. X    return (l);
  984. X}
  985. X
  986. Xstatic F_spline *
  987. Xread_1_3_splineobject(fp)
  988. X    FILE       *fp;
  989. X{
  990. X    F_spline       *s;
  991. X    F_point       *p, *q;
  992. X    int            f, b, h, w, n, t, x, y;
  993. X
  994. X    if ((s = create_spline()) == NULL)
  995. X    return (NULL);
  996. X
  997. X    s->color = BLACK;
  998. X    s->depth = 0;
  999. X    s->pen = 0;
  1000. X    s->fill_style = 0;
  1001. X    s->for_arrow = NULL;
  1002. X    s->back_arrow = NULL;
  1003. X    s->controls = NULL;
  1004. X    s->next = NULL;
  1005. X    if ((p = create_point()) == NULL) {
  1006. X    free((char *) s);
  1007. X    return (NULL);
  1008. X    }
  1009. X    s->points = p;
  1010. X    n = fscanf(fp, " %d %d %d %f %d %d %d %d %d %d",
  1011. X           &t, &s->style, &s->thickness, &s->style_val,
  1012. X           &f, &b,
  1013. X           &h, &w, &p->x, &p->y);
  1014. X    if (n != 10) {
  1015. X    file_msg("Incomplete spline data");
  1016. X    free((char *) s);
  1017. X    return (NULL);
  1018. X    }
  1019. X    if (t == DRAW_CLOSEDSPLINE)
  1020. X    s->type = T_CLOSED_NORMAL;
  1021. X    else
  1022. X    s->type = T_OPEN_NORMAL;
  1023. X    if (f) {
  1024. X    s->for_arrow = forward_arrow();
  1025. X    s->for_arrow->wid = w;
  1026. X    s->for_arrow->ht = h;
  1027. X    }
  1028. X    if (b) {
  1029. X    s->back_arrow = backward_arrow();
  1030. X    s->back_arrow->wid = w;
  1031. X    s->back_arrow->ht = h;
  1032. X    }
  1033. X    for (;;) {
  1034. X    if (fscanf(fp, " %d %d", &x, &y) != 2) {
  1035. X        file_msg("Incomplete spline object");
  1036. X        free_splinestorage(s);
  1037. X        return (NULL);
  1038. X    };
  1039. X    if (x == 9999)
  1040. X        break;
  1041. X    if ((q = create_point()) == NULL) {
  1042. X        free_splinestorage(s);
  1043. X        return (NULL);
  1044. X    }
  1045. X    q->x = x;
  1046. X    q->y = y;
  1047. X    q->next = NULL;
  1048. X    p->next = q;
  1049. X    p = q;
  1050. X    }
  1051. X    return (s);
  1052. X}
  1053. X
  1054. Xstatic F_text  *
  1055. Xread_1_3_textobject(fp)
  1056. X    FILE       *fp;
  1057. X{
  1058. X    F_text       *t;
  1059. X    int            n;
  1060. X    char        buf[128];
  1061. X
  1062. X    if ((t = create_text()) == NULL)
  1063. X    return (NULL);
  1064. X
  1065. X    t->type = T_LEFT_JUSTIFIED;
  1066. X    t->flags = RIGID_TEXT;
  1067. X    t->color = BLACK;
  1068. X    t->depth = 0;
  1069. X    t->pen = 0;
  1070. X    t->angle = 0.0;
  1071. X    t->next = NULL;
  1072. X    n = fscanf(fp, " %d %d %d %d %d %d %d %[^\n]", &t->font,
  1073. X           &t->size, &t->flags, &t->height, &t->length,
  1074. X           &t->base_x, &t->base_y, buf);
  1075. X    if (n != 8) {
  1076. X    file_msg("Incomplete text data");
  1077. X    free((char *) t);
  1078. X    return (NULL);
  1079. X    }
  1080. X    if ((t->cstring = new_string(strlen(buf) + 1)) == NULL) {
  1081. X    free((char *) t);
  1082. X    return (NULL);
  1083. X    }
  1084. X    strcpy(t->cstring, buf);
  1085. X    if (t->size == 0)
  1086. X    t->size = 18;
  1087. X    return (t);
  1088. X}
  1089. END_OF_FILE
  1090. if test 10730 -ne `wc -c <'f_readold.c'`; then
  1091.     echo shar: \"'f_readold.c'\" unpacked with wrong size!
  1092. fi
  1093. # end of 'f_readold.c'
  1094. fi
  1095. if test -f 'u_create.c' -a "${1}" != "-c" ; then 
  1096.   echo shar: Will not clobber existing file \"'u_create.c'\"
  1097. else
  1098. echo shar: Extracting \"'u_create.c'\" \(10951 characters\)
  1099. sed "s/^X//" >'u_create.c' <<'END_OF_FILE'
  1100. X/*
  1101. X * FIG : Facility for Interactive Generation of figures
  1102. X * Copyright (c) 1985 by Supoj Sutanthavibul
  1103. X *
  1104. X * "Permission to use, copy, modify, distribute, and sell this software and its
  1105. X * documentation for any purpose is hereby granted without fee, provided that
  1106. X * the above copyright notice appear in all copies and that both the copyright
  1107. X * notice and this permission notice appear in supporting documentation. 
  1108. X * No representations are made about the suitability of this software for 
  1109. X * any purpose.  It is provided "as is" without express or implied warranty."
  1110. X */
  1111. X
  1112. X#include "fig.h"
  1113. X#include "resources.h"
  1114. X#include "object.h"
  1115. X#include "u_create.h"
  1116. X
  1117. Xextern int    cur_linewidth;
  1118. X
  1119. X/* LOCAL */
  1120. X
  1121. Xstatic float    forward_arrow_wid = 4;
  1122. Xstatic float    forward_arrow_ht = 8;
  1123. Xstatic int    forward_arrow_type = 0;
  1124. Xstatic int    forward_arrow_style = 0;
  1125. Xstatic float    forward_arrow_thickness = 1;
  1126. X
  1127. Xstatic float    backward_arrow_wid = 4;
  1128. Xstatic float    backward_arrow_ht = 8;
  1129. Xstatic int    backward_arrow_type = 0;
  1130. Xstatic int    backward_arrow_style = 0;
  1131. Xstatic float    backward_arrow_thickness = 1;
  1132. X
  1133. Xstatic F_arrow *create_arrow();
  1134. Xstatic char    Err_mem[] = "Running out of memory.";
  1135. X
  1136. X/****************** ARROWS ****************/
  1137. X
  1138. Xstatic F_arrow *
  1139. Xcreate_arrow()
  1140. X{
  1141. X    F_arrow       *a;
  1142. X
  1143. X    if ((a = (F_arrow *) malloc(ARROW_SIZE)) == NULL)
  1144. X    put_msg(Err_mem);
  1145. X    return (a);
  1146. X}
  1147. X
  1148. XF_arrow           *
  1149. Xforward_arrow()
  1150. X{
  1151. X    F_arrow       *a;
  1152. X
  1153. X    if ((a = create_arrow()) == NULL)
  1154. X    return (NULL);
  1155. X
  1156. X    a->type = forward_arrow_type;
  1157. X    a->style = forward_arrow_style;
  1158. X    a->thickness = forward_arrow_thickness = (float) cur_linewidth;
  1159. X    a->wid = forward_arrow_thickness * forward_arrow_wid;
  1160. X    a->ht = forward_arrow_thickness * forward_arrow_ht;
  1161. X    return (a);
  1162. X}
  1163. X
  1164. XF_arrow           *
  1165. Xbackward_arrow()
  1166. X{
  1167. X    F_arrow       *a;
  1168. X
  1169. X    if ((a = create_arrow()) == NULL)
  1170. X    return (NULL);
  1171. X
  1172. X    a->type = backward_arrow_type;
  1173. X    a->style = backward_arrow_style;
  1174. X    a->thickness = backward_arrow_thickness = (float) cur_linewidth;
  1175. X    a->wid = backward_arrow_thickness * backward_arrow_wid;
  1176. X    a->ht = backward_arrow_thickness * backward_arrow_ht;
  1177. X    return (a);
  1178. X}
  1179. X
  1180. XF_arrow           *
  1181. Xnew_arrow(type, style, thickness, wid, ht)
  1182. X    int            type, style;
  1183. X    float        thickness, wid, ht;
  1184. X{
  1185. X    F_arrow       *a;
  1186. X
  1187. X    if ((a = create_arrow()) == NULL)
  1188. X    return (NULL);
  1189. X
  1190. X    a->type = type;
  1191. X    a->style = style;
  1192. X    a->thickness = thickness;
  1193. X    a->wid = wid;
  1194. X    a->ht = ht;
  1195. X    return (a);
  1196. X}
  1197. X
  1198. X/************************ SMART LINKS *************************/
  1199. X
  1200. XF_linkinfo     *
  1201. Xnew_link(l, ep, pp)
  1202. X    F_line       *l;
  1203. X    F_point       *ep, *pp;
  1204. X{
  1205. X    F_linkinfo       *k;
  1206. X
  1207. X    if ((k = (F_linkinfo *) malloc(LINKINFO_SIZE)) == NULL) {
  1208. X    put_msg(Err_mem);
  1209. X    return (NULL);
  1210. X    }
  1211. X    k->line = l;
  1212. X    k->endpt = ep;
  1213. X    k->prevpt = pp;
  1214. X    k->next = NULL;
  1215. X    return (k);
  1216. X}
  1217. X
  1218. X/************************ POINTS *************************/
  1219. X
  1220. XF_point           *
  1221. Xcreate_point()
  1222. X{
  1223. X    F_point       *p;
  1224. X
  1225. X    if ((p = (F_point *) malloc(POINT_SIZE)) == NULL)
  1226. X    put_msg(Err_mem);
  1227. X    return (p);
  1228. X}
  1229. X
  1230. XF_control      *
  1231. Xcreate_cpoint()
  1232. X{
  1233. X    F_control       *cp;
  1234. X
  1235. X    if ((cp = (F_control *) malloc(CONTROL_SIZE)) == NULL)
  1236. X    put_msg(Err_mem);
  1237. X    return (cp);
  1238. X}
  1239. X
  1240. XF_point           *
  1241. Xcopy_points(orig_pt)
  1242. X    F_point       *orig_pt;
  1243. X{
  1244. X    F_point       *new_pt, *prev_pt, *first_pt;
  1245. X
  1246. X    if ((new_pt = create_point()) == NULL)
  1247. X    return (NULL);
  1248. X
  1249. X    first_pt = new_pt;
  1250. X    *new_pt = *orig_pt;
  1251. X    new_pt->next = NULL;
  1252. X    prev_pt = new_pt;
  1253. X    for (orig_pt = orig_pt->next; orig_pt != NULL; orig_pt = orig_pt->next) {
  1254. X    if ((new_pt = create_point()) == NULL) {
  1255. X        free_points(first_pt);
  1256. X        return (NULL);
  1257. X    }
  1258. X    prev_pt->next = new_pt;
  1259. X    *new_pt = *orig_pt;
  1260. X    new_pt->next = NULL;
  1261. X    prev_pt = new_pt;
  1262. X    }
  1263. X    return (first_pt);
  1264. X}
  1265. X
  1266. X/************************ ARCS *************************/
  1267. X
  1268. XF_arc           *
  1269. Xcreate_arc()
  1270. X{
  1271. X    F_arc       *a;
  1272. X
  1273. X    if ((a = (F_arc *) malloc(ARCOBJ_SIZE)) == NULL)
  1274. X    put_msg(Err_mem);
  1275. X    a->tagged = 0;
  1276. X    return (a);
  1277. X}
  1278. X
  1279. XF_arc           *
  1280. Xcopy_arc(a)
  1281. X    F_arc       *a;
  1282. X{
  1283. X    F_arc       *arc;
  1284. X    F_arrow       *arrow;
  1285. X
  1286. X    if ((arc = create_arc()) == NULL)
  1287. X    return (NULL);
  1288. X
  1289. X    *arc = *a;
  1290. X    arc->next = NULL;
  1291. X    if (a->for_arrow) {
  1292. X    if ((arrow = create_arrow()) == NULL) {
  1293. X        free((char *) arc);
  1294. X        return (NULL);
  1295. X    }
  1296. X    arc->for_arrow = arrow;
  1297. X    *arrow = *a->for_arrow;
  1298. X    }
  1299. X    if (a->back_arrow) {
  1300. X    if ((arrow = create_arrow()) == NULL) {
  1301. X        free((char *) arc);
  1302. X        return (NULL);
  1303. X    }
  1304. X    arc->back_arrow = arrow;
  1305. X    *arrow = *a->back_arrow;
  1306. X    }
  1307. X    return (arc);
  1308. X}
  1309. X
  1310. X/************************ ELLIPSES *************************/
  1311. X
  1312. XF_ellipse      *
  1313. Xcreate_ellipse()
  1314. X{
  1315. X    F_ellipse       *e;
  1316. X
  1317. X    if ((e = (F_ellipse *) malloc(ELLOBJ_SIZE)) == NULL)
  1318. X    put_msg(Err_mem);
  1319. X    e->tagged = 0;
  1320. X    return (e);
  1321. X}
  1322. X
  1323. XF_ellipse      *
  1324. Xcopy_ellipse(e)
  1325. X    F_ellipse       *e;
  1326. X{
  1327. X    F_ellipse       *ellipse;
  1328. X
  1329. X    if ((ellipse = create_ellipse()) == NULL)
  1330. X    return (NULL);
  1331. X
  1332. X    *ellipse = *e;
  1333. X    ellipse->next = NULL;
  1334. X    return (ellipse);
  1335. X}
  1336. X
  1337. X/************************ LINES *************************/
  1338. X
  1339. XF_line           *
  1340. Xcreate_line()
  1341. X{
  1342. X    F_line       *l;
  1343. X
  1344. X    if ((l = (F_line *) malloc(LINOBJ_SIZE)) == NULL)
  1345. X    put_msg(Err_mem);
  1346. X    l->tagged = 0;
  1347. X    l->eps = NULL;
  1348. X    l->next = NULL;
  1349. X    l->for_arrow = NULL;
  1350. X    l->back_arrow = NULL;
  1351. X    l->points = NULL;
  1352. X    l->radius = DEFAULT;
  1353. X    return (l);
  1354. X}
  1355. X
  1356. XF_eps           *
  1357. Xcreate_eps()
  1358. X{
  1359. X    F_eps       *e;
  1360. X
  1361. X    if ((e = (F_eps *) malloc(EPS_SIZE)) == NULL)
  1362. X    put_msg(Err_mem);
  1363. X    return (e);
  1364. X}
  1365. X
  1366. XF_line           *
  1367. Xcopy_line(l)
  1368. X    F_line       *l;
  1369. X{
  1370. X    F_line       *line;
  1371. X    F_arrow       *arrow;
  1372. X    int            nbytes;
  1373. X
  1374. X    if ((line = create_line()) == NULL)
  1375. X    return (NULL);
  1376. X
  1377. X    *line = *l;
  1378. X    line->next = NULL;
  1379. X    if (l->for_arrow) {
  1380. X    if ((arrow = create_arrow()) == NULL) {
  1381. X        free((char *) line);
  1382. X        return (NULL);
  1383. X    }
  1384. X    line->for_arrow = arrow;
  1385. X    *arrow = *l->for_arrow;
  1386. X    }
  1387. X    if (l->back_arrow) {
  1388. X    if ((arrow = create_arrow()) == NULL) {
  1389. X        free((char *) line);
  1390. X        return (NULL);
  1391. X    }
  1392. X    line->back_arrow = arrow;
  1393. X    *arrow = *l->back_arrow;
  1394. X    }
  1395. X    line->points = copy_points(l->points);
  1396. X    if (NULL == line->points) {
  1397. X    put_msg(Err_mem);
  1398. X    free_linestorage(line);
  1399. X    return (NULL);
  1400. X    }
  1401. X    if (l->eps != NULL) {
  1402. X    if ((line->eps = create_eps()) == NULL) {
  1403. X        free((char *) line);
  1404. X        return (NULL);
  1405. X    }
  1406. X    bcopy(l->eps, line->eps, EPS_SIZE);
  1407. X    if (l->eps->bitmap != NULL) {
  1408. X        nbytes = (line->eps->bit_size.x + 7) / 8 * line->eps->bit_size.y;
  1409. X        line->eps->bitmap = (unsigned char *) malloc(nbytes);
  1410. X        if (line->eps->bitmap == NULL)
  1411. X        fprintf(stderr, "xfig: out of memory in function copy_line");
  1412. X        bcopy(l->eps->bitmap, line->eps->bitmap, nbytes);
  1413. X        line->eps->pix_width = 0;
  1414. X        line->eps->pix_height = 0;
  1415. X        line->eps->pixmap = 0;
  1416. X    }
  1417. X    }
  1418. X    return (line);
  1419. X}
  1420. X
  1421. X/************************ SPLINES *************************/
  1422. X
  1423. XF_spline       *
  1424. Xcreate_spline()
  1425. X{
  1426. X    F_spline       *s;
  1427. X
  1428. X    if ((s = (F_spline *) malloc(SPLOBJ_SIZE)) == NULL)
  1429. X    put_msg(Err_mem);
  1430. X    s->tagged = 0;
  1431. X    return (s);
  1432. X}
  1433. X
  1434. XF_spline       *
  1435. Xcopy_spline(s)
  1436. X    F_spline       *s;
  1437. X{
  1438. X    F_spline       *spline;
  1439. X    F_control       *new_cp, *orig_cp, *last_cp;
  1440. X    F_arrow       *arrow;
  1441. X
  1442. X    if ((spline = create_spline()) == NULL)
  1443. X    return (NULL);
  1444. X
  1445. X    *spline = *s;
  1446. X    spline->next = NULL;
  1447. X    if (s->for_arrow) {
  1448. X    if ((arrow = create_arrow()) == NULL) {
  1449. X        free((char *) spline);
  1450. X        return (NULL);
  1451. X    }
  1452. X    spline->for_arrow = arrow;
  1453. X    *arrow = *s->for_arrow;
  1454. X    }
  1455. X    if (s->back_arrow) {
  1456. X    if ((arrow = create_arrow()) == NULL) {
  1457. X        free((char *) spline);
  1458. X        return (NULL);
  1459. X    }
  1460. X    spline->back_arrow = arrow;
  1461. X    *arrow = *s->back_arrow;
  1462. X    }
  1463. X    spline->points = copy_points(s->points);
  1464. X    if (NULL == spline->points) {
  1465. X    put_msg(Err_mem);
  1466. X    free_splinestorage(spline);
  1467. X    return (NULL);
  1468. X    }
  1469. X    spline->controls = NULL;
  1470. X    if (s->controls == NULL)
  1471. X    return (spline);
  1472. X
  1473. X    if ((new_cp = create_cpoint()) == NULL) {
  1474. X    free_splinestorage(spline);
  1475. X    return (NULL);
  1476. X    }
  1477. X    new_cp->next = NULL;
  1478. X    last_cp = spline->controls = new_cp;
  1479. X    orig_cp = s->controls;
  1480. X    *new_cp = *orig_cp;
  1481. X    for (orig_cp = orig_cp->next; orig_cp != NULL; orig_cp = orig_cp->next) {
  1482. X    if ((new_cp = create_cpoint()) == NULL) {
  1483. X        free_splinestorage(spline);
  1484. X        return (NULL);
  1485. X    }
  1486. X    last_cp->next = new_cp;
  1487. X    new_cp->next = NULL;
  1488. X    *new_cp = *orig_cp;
  1489. X    last_cp = new_cp;
  1490. X    }
  1491. X    return (spline);
  1492. X}
  1493. X
  1494. X/************************ TEXTS *************************/
  1495. X
  1496. XF_text           *
  1497. Xcreate_text()
  1498. X{
  1499. X    F_text       *t;
  1500. X
  1501. X    if ((t = (F_text *) malloc(TEXOBJ_SIZE)) == NULL)
  1502. X    put_msg(Err_mem);
  1503. X    t->tagged = 0;
  1504. X    return (t);
  1505. X}
  1506. X
  1507. Xchar           *
  1508. Xnew_string(len)
  1509. X    int            len;
  1510. X{
  1511. X    char       *c;
  1512. X
  1513. X    if ((c = (char *) calloc((unsigned) len, sizeof(char))) == NULL)
  1514. X    put_msg(Err_mem);
  1515. X    return (c);
  1516. X}
  1517. X
  1518. XF_text           *
  1519. Xcopy_text(t)
  1520. X    F_text       *t;
  1521. X{
  1522. X    F_text       *text;
  1523. X
  1524. X    if ((text = create_text()) == NULL)
  1525. X    return (NULL);
  1526. X
  1527. X    *text = *t;
  1528. X    if ((text->cstring = new_string(strlen(t->cstring) + 1)) == NULL) {
  1529. X    free((char *) text);
  1530. X    return (NULL);
  1531. X    }
  1532. X    strcpy(text->cstring, t->cstring);
  1533. X    text->next = NULL;
  1534. X    return (text);
  1535. X}
  1536. X
  1537. X/************************ COMPOUNDS *************************/
  1538. X
  1539. XF_compound     *
  1540. Xcreate_compound()
  1541. X{
  1542. X    F_compound       *c;
  1543. X
  1544. X    if ((c = (F_compound *) malloc(COMOBJ_SIZE)) == NULL)
  1545. X    put_msg(Err_mem);
  1546. X    c->tagged = 0;
  1547. X    return (c);
  1548. X}
  1549. X
  1550. XF_compound     *
  1551. Xcopy_compound(c)
  1552. X    F_compound       *c;
  1553. X{
  1554. X    F_ellipse       *e, *ee;
  1555. X    F_arc       *a, *aa;
  1556. X    F_line       *l, *ll;
  1557. X    F_spline       *s, *ss;
  1558. X    F_text       *t, *tt;
  1559. X    F_compound       *cc, *ccc, *compound;
  1560. X
  1561. X    if ((compound = create_compound()) == NULL)
  1562. X    return (NULL);
  1563. X
  1564. X    compound->nwcorner = c->nwcorner;
  1565. X    compound->secorner = c->secorner;
  1566. X    compound->arcs = NULL;
  1567. X    compound->ellipses = NULL;
  1568. X    compound->lines = NULL;
  1569. X    compound->splines = NULL;
  1570. X    compound->texts = NULL;
  1571. X    compound->compounds = NULL;
  1572. X    compound->next = NULL;
  1573. X    for (e = c->ellipses; e != NULL; e = e->next) {
  1574. X    if (NULL == (ee = copy_ellipse(e))) {
  1575. X        put_msg(Err_mem);
  1576. X        return (NULL);
  1577. X    }
  1578. X    list_add_ellipse(&compound->ellipses, ee);
  1579. X    }
  1580. X    for (a = c->arcs; a != NULL; a = a->next) {
  1581. X    if (NULL == (aa = copy_arc(a))) {
  1582. X        put_msg(Err_mem);
  1583. X        return (NULL);
  1584. X    }
  1585. X    list_add_arc(&compound->arcs, aa);
  1586. X    }
  1587. X    for (l = c->lines; l != NULL; l = l->next) {
  1588. X    if (NULL == (ll = copy_line(l))) {
  1589. X        put_msg(Err_mem);
  1590. X        return (NULL);
  1591. X    }
  1592. X    list_add_line(&compound->lines, ll);
  1593. X    }
  1594. X    for (s = c->splines; s != NULL; s = s->next) {
  1595. X    if (NULL == (ss = copy_spline(s))) {
  1596. X        put_msg(Err_mem);
  1597. X        return (NULL);
  1598. X    }
  1599. X    list_add_spline(&compound->splines, ss);
  1600. X    }
  1601. X    for (t = c->texts; t != NULL; t = t->next) {
  1602. X    if (NULL == (tt = copy_text(t))) {
  1603. X        put_msg(Err_mem);
  1604. X        return (NULL);
  1605. X    }
  1606. X    list_add_text(&compound->texts, tt);
  1607. X    }
  1608. X    for (cc = c->compounds; cc != NULL; cc = cc->next) {
  1609. X    if (NULL == (ccc = copy_compound(cc))) {
  1610. X        put_msg(Err_mem);
  1611. X        return (NULL);
  1612. X    }
  1613. X    list_add_compound(&compound->compounds, ccc);
  1614. X    }
  1615. X    return (compound);
  1616. X}
  1617. END_OF_FILE
  1618. if test 10951 -ne `wc -c <'u_create.c'`; then
  1619.     echo shar: \"'u_create.c'\" unpacked with wrong size!
  1620. fi
  1621. # end of 'u_create.c'
  1622. fi
  1623. if test -f 'u_drag.c' -a "${1}" != "-c" ; then 
  1624.   echo shar: Will not clobber existing file \"'u_drag.c'\"
  1625. else
  1626. echo shar: Extracting \"'u_drag.c'\" \(10463 characters\)
  1627. sed "s/^X//" >'u_drag.c' <<'END_OF_FILE'
  1628. X/*
  1629. X * FIG : Facility for Interactive Generation of figures
  1630. X * Copyright (c) 1985 by Supoj Sutanthavibul
  1631. X *
  1632. X * "Permission to use, copy, modify, distribute, and sell this software and its
  1633. X * documentation for any purpose is hereby granted without fee, provided that
  1634. X * the above copyright notice appear in all copies and that both the copyright
  1635. X * notice and this permission notice appear in supporting documentation. 
  1636. X * No representations are made about the suitability of this software for 
  1637. X * any purpose.  It is provided "as is" without express or implied warranty."
  1638. X */
  1639. X
  1640. X#include "fig.h"
  1641. X#include "resources.h"
  1642. X#include "object.h"
  1643. X#include "paintop.h"
  1644. X#include "u_draw.h"
  1645. X#include "u_elastic.h"
  1646. X#include "u_list.h"
  1647. X#include "u_undo.h"
  1648. X#include "mode.h"
  1649. X#include "w_canvas.h"
  1650. X#include "w_drawprim.h"
  1651. X#include "w_zoom.h"
  1652. X
  1653. Xstatic int    place_line(), cancel_line();
  1654. Xstatic int    place_arc(), cancel_arc();
  1655. Xstatic int    place_spline(), cancel_spline();
  1656. Xstatic int    place_ellipse(), cancel_ellipse();
  1657. Xstatic int    place_text(), cancel_text();
  1658. Xstatic int    place_compound(), cancel_compound();
  1659. X
  1660. Xextern int    copy_selected();
  1661. X
  1662. X/***************************** ellipse section ************************/
  1663. X
  1664. Xinit_ellipsedragging(e, x, y)
  1665. X    F_ellipse       *e;
  1666. X    int            x, y;
  1667. X{
  1668. X    new_e = e;
  1669. X    fix_x = cur_x = x;
  1670. X    fix_y = cur_y = y;
  1671. X    cur_angle = e->angle;
  1672. X    x1off = (e->center.x - e->radiuses.x) - cur_x;
  1673. X    x2off = (e->center.x + e->radiuses.x) - cur_x;
  1674. X    y1off = (e->center.y - e->radiuses.y) - cur_y;
  1675. X    y2off = (e->center.y + e->radiuses.y) - cur_y;
  1676. X    canvas_locmove_proc = moving_ellipse;
  1677. X    canvas_leftbut_proc = place_ellipse;
  1678. X    canvas_rightbut_proc = cancel_ellipse;
  1679. X    set_action_on();
  1680. X    elastic_moveellipse();
  1681. X}
  1682. X
  1683. Xstatic
  1684. Xcancel_ellipse()
  1685. X{
  1686. X    elastic_moveellipse();
  1687. X    if (return_proc == copy_selected) {
  1688. X    free_ellipse(&new_e);
  1689. X    } else {
  1690. X    list_add_ellipse(&objects.ellipses, new_e);
  1691. X    redisplay_ellipse(new_e);
  1692. X    }
  1693. X    (*return_proc) ();
  1694. X    draw_mousefun_canvas();
  1695. X}
  1696. X
  1697. Xstatic
  1698. Xplace_ellipse(x, y)
  1699. X    int            x, y;
  1700. X{
  1701. X    elastic_moveellipse();
  1702. X    adjust_pos(x, y, fix_x, fix_y, &x, &y);
  1703. X    translate_ellipse(new_e, x - fix_x, y - fix_y);
  1704. X    if (return_proc == copy_selected) {
  1705. X    add_ellipse(new_e);
  1706. X    } else {
  1707. X    list_add_ellipse(&objects.ellipses, new_e);
  1708. X    clean_up();
  1709. X    set_lastposition(fix_x, fix_y);
  1710. X    set_newposition(x, y);
  1711. X    set_action_object(F_MOVE, O_ELLIPSE);
  1712. X    set_latestellipse(new_e);
  1713. X    set_modifiedflag();
  1714. X    }
  1715. X    redisplay_ellipse(new_e);
  1716. X    (*return_proc) ();
  1717. X    draw_mousefun_canvas();
  1718. X}
  1719. X
  1720. X/*****************************    arc  section  *******************/
  1721. X
  1722. Xinit_arcdragging(a, x, y)
  1723. X    F_arc       *a;
  1724. X    int            x, y;
  1725. X{
  1726. X    new_a = a;
  1727. X    fix_x = cur_x = x;
  1728. X    fix_y = cur_y = y;
  1729. X    canvas_locmove_proc = moving_arc;
  1730. X    canvas_leftbut_proc = place_arc;
  1731. X    canvas_rightbut_proc = cancel_arc;
  1732. X    set_action_on();
  1733. X    elastic_movearc(new_a);
  1734. X}
  1735. X
  1736. Xstatic
  1737. Xcancel_arc()
  1738. X{
  1739. X    elastic_movearc(new_a);
  1740. X    if (return_proc == copy_selected) {
  1741. X    free_arc(&new_a);
  1742. X    } else {
  1743. X    list_add_arc(&objects.arcs, new_a);
  1744. X    redisplay_arc(new_a);
  1745. X    }
  1746. X    (*return_proc) ();
  1747. X    draw_mousefun_canvas();
  1748. X}
  1749. X
  1750. Xstatic
  1751. Xplace_arc(x, y)
  1752. X    int            x, y;
  1753. X{
  1754. X    elastic_movearc(new_a);
  1755. X    adjust_pos(x, y, fix_x, fix_y, &x, &y);
  1756. X    translate_arc(new_a, x - fix_x, y - fix_y);
  1757. X    if (return_proc == copy_selected) {
  1758. X    add_arc(new_a);
  1759. X    } else {
  1760. X    list_add_arc(&objects.arcs, new_a);
  1761. X    clean_up();
  1762. X    set_lastposition(fix_x, fix_y);
  1763. X    set_newposition(x, y);
  1764. X    set_action_object(F_MOVE, O_ARC);
  1765. X    set_latestarc(new_a);
  1766. X    set_modifiedflag();
  1767. X    }
  1768. X    redisplay_arc(new_a);
  1769. X    (*return_proc) ();
  1770. X    draw_mousefun_canvas();
  1771. X}
  1772. X
  1773. X/*************************  line  section  **********************/
  1774. X
  1775. Xinit_linedragging(l, x, y)
  1776. X    F_line       *l;
  1777. X    int            x, y;
  1778. X{
  1779. X    int            xmin, ymin, xmax, ymax;
  1780. X
  1781. X    new_l = l;
  1782. X    cur_x = fix_x = x;
  1783. X    cur_y = fix_y = y;
  1784. X    canvas_locmove_proc = moving_line;
  1785. X    canvas_leftbut_proc = place_line;
  1786. X    canvas_rightbut_proc = cancel_line;
  1787. X    set_action_on();
  1788. X    if (l->type == T_BOX || l->type == T_ARC_BOX || l->type == T_EPS_BOX) {
  1789. X    line_bound(l, &xmin, &ymin, &xmax, &ymax);
  1790. X    get_links(xmin, ymin, xmax, ymax);
  1791. X    }
  1792. X    elastic_moveline(new_l->points);
  1793. X}
  1794. X
  1795. Xstatic
  1796. Xcancel_line()
  1797. X{
  1798. X    elastic_moveline(new_l->points);
  1799. X    free_linkinfo(&cur_links);
  1800. X    if (return_proc == copy_selected) {
  1801. X    free_line(&new_l);
  1802. X    } else {
  1803. X    list_add_line(&objects.lines, new_l);
  1804. X    redisplay_line(new_l);
  1805. X    }
  1806. X    (*return_proc) ();
  1807. X    draw_mousefun_canvas();
  1808. X}
  1809. X
  1810. Xstatic
  1811. Xplace_line(x, y)
  1812. X    int            x, y;
  1813. X{
  1814. X    int            dx, dy;
  1815. X
  1816. X    elastic_moveline(new_l->points);
  1817. X    adjust_pos(x, y, fix_x, fix_y, &x, &y);
  1818. X    dx = x - fix_x;
  1819. X    dy = y - fix_y;
  1820. X    translate_line(new_l, dx, dy);
  1821. X    clean_up();
  1822. X    set_latestline(new_l);
  1823. X    if (return_proc == copy_selected) {
  1824. X    adjust_links(cur_linkmode, cur_links, dx, dy, 0, 0, 1.0, 1.0, 1);
  1825. X    tail(&objects, &object_tails);
  1826. X    append_objects(&objects, &saved_objects, &object_tails);
  1827. X    set_action_object(F_ADD, O_ALL_OBJECT);
  1828. X    free_linkinfo(&cur_links);
  1829. X    } else {
  1830. X    list_add_line(&objects.lines, new_l);
  1831. X    adjust_links(cur_linkmode, cur_links, dx, dy, 0, 0, 1.0, 1.0, 0);
  1832. X    set_lastposition(fix_x, fix_y);
  1833. X    set_newposition(x, y);
  1834. X    set_lastlinkinfo(cur_linkmode, cur_links);
  1835. X    cur_links = NULL;
  1836. X    set_action_object(F_MOVE, O_POLYLINE);
  1837. X    }
  1838. X    set_modifiedflag();
  1839. X    redisplay_line(new_l);
  1840. X    (*return_proc) ();
  1841. X    draw_mousefun_canvas();
  1842. X}
  1843. X
  1844. X/************************  text section     **************************/
  1845. X
  1846. Xstatic PR_SIZE    txsize;
  1847. X
  1848. Xinit_textdragging(t, x, y)
  1849. X    F_text       *t;
  1850. X    int            x, y;
  1851. X{
  1852. X    int           cw,cw2;
  1853. X    float       angle;
  1854. X
  1855. X    new_t = t;
  1856. X    /* adjust in case text was off positioning grid and positioning is now on */
  1857. X    round_coords(new_t->base_x,new_t->base_y);
  1858. X    fix_x = cur_x = x;
  1859. X    fix_y = cur_y = y;
  1860. X    x1off = new_t->base_x - x;
  1861. X    y1off = new_t->base_y - y;
  1862. X    if (t->type == T_CENTER_JUSTIFIED || t->type == T_RIGHT_JUSTIFIED) {
  1863. X    txsize = pf_textwidth(t->fontstruct, strlen(t->cstring), t->cstring);
  1864. X    angle = t->angle*180.0/M_PI;
  1865. X    if (t->type == T_CENTER_JUSTIFIED) {
  1866. X        cw2 = round(txsize.x/2/zoomscale);
  1867. X        if (angle < 90.0 - 0.001)
  1868. X        x1off -= cw2;
  1869. X        else if (angle < 180.0 - 0.001) 
  1870. X        y1off += cw2;
  1871. X        else if (angle < 270.0 - 0.001) 
  1872. X        x1off += cw2;
  1873. X        else 
  1874. X        y1off -= cw2;
  1875. X    } else { /* T_RIGHT_JUSTIFIED */
  1876. X        cw = round(txsize.x/zoomscale);
  1877. X        if (angle < 90.0 - 0.001)
  1878. X        x1off -= cw;
  1879. X        else if (angle < 180.0 - 0.001) 
  1880. X        y1off += cw;
  1881. X        else if (angle < 270.0 - 0.001) 
  1882. X        x1off += cw;
  1883. X        else 
  1884. X        y1off -= cw;
  1885. X    }
  1886. X    }
  1887. X    canvas_locmove_proc = moving_text;
  1888. X    canvas_leftbut_proc = place_text;
  1889. X    canvas_rightbut_proc = cancel_text;
  1890. X    elastic_movetext();
  1891. X    set_action_on();
  1892. X}
  1893. X
  1894. Xstatic
  1895. Xcancel_text()
  1896. X{
  1897. X    elastic_movetext();
  1898. X    if (return_proc == copy_selected) {
  1899. X    free_text(&new_t);
  1900. X    } else {
  1901. X    list_add_text(&objects.texts, new_t);
  1902. X    redisplay_text(new_t);
  1903. X    }
  1904. X    (*return_proc) ();
  1905. X    draw_mousefun_canvas();
  1906. X}
  1907. X
  1908. Xstatic
  1909. Xplace_text(x, y)
  1910. X    int            x, y;
  1911. X{
  1912. X    elastic_movetext();
  1913. X    adjust_pos(x, y, fix_x, fix_y, &x, &y);
  1914. X    translate_text(new_t, x - fix_x, y - fix_y);
  1915. X    if (return_proc == copy_selected) {
  1916. X    add_text(new_t);
  1917. X    } else {
  1918. X    list_add_text(&objects.texts, new_t);
  1919. X    clean_up();
  1920. X    set_lastposition(fix_x, fix_y);
  1921. X    set_newposition(x, y);
  1922. X    set_action_object(F_MOVE, O_TEXT);
  1923. X    set_latesttext(new_t);
  1924. X    set_modifiedflag();
  1925. X    }
  1926. X    redisplay_text(new_t);
  1927. X    (*return_proc) ();
  1928. X    draw_mousefun_canvas();
  1929. X}
  1930. X
  1931. X/*************************  spline  section  **********************/
  1932. X
  1933. Xinit_splinedragging(s, x, y)
  1934. X    F_spline       *s;
  1935. X    int            x, y;
  1936. X{
  1937. X    new_s = s;
  1938. X    cur_x = fix_x = x;
  1939. X    cur_y = fix_y = y;
  1940. X    canvas_locmove_proc = moving_spline;
  1941. X    canvas_leftbut_proc = place_spline;
  1942. X    canvas_rightbut_proc = cancel_spline;
  1943. X    set_action_on();
  1944. X    elastic_moveline(new_s->points);
  1945. X}
  1946. X
  1947. Xstatic
  1948. Xcancel_spline()
  1949. X{
  1950. X    elastic_moveline(new_s->points);
  1951. X    if (return_proc == copy_selected) {
  1952. X    free_spline(&new_s);
  1953. X    } else {
  1954. X    list_add_spline(&objects.splines, new_s);
  1955. X    redisplay_spline(new_s);
  1956. X    }
  1957. X    (*return_proc) ();
  1958. X    draw_mousefun_canvas();
  1959. X}
  1960. X
  1961. Xstatic
  1962. Xplace_spline(x, y)
  1963. X    int            x, y;
  1964. X{
  1965. X    elastic_moveline(new_s->points);
  1966. X    adjust_pos(x, y, fix_x, fix_y, &x, &y);
  1967. X    translate_spline(new_s, x - fix_x, y - fix_y);
  1968. X    if (return_proc == copy_selected) {
  1969. X    add_spline(new_s);
  1970. X    } else {
  1971. X    list_add_spline(&objects.splines, new_s);
  1972. X    clean_up();
  1973. X    set_lastposition(fix_x, fix_y);
  1974. X    set_newposition(x, y);
  1975. X    set_action_object(F_MOVE, O_SPLINE);
  1976. X    set_latestspline(new_s);
  1977. X    set_modifiedflag();
  1978. X    }
  1979. X    redisplay_spline(new_s);
  1980. X    (*return_proc) ();
  1981. X    draw_mousefun_canvas();
  1982. X}
  1983. X
  1984. X/*****************************    Compound section  *******************/
  1985. X
  1986. Xinit_compounddragging(c, x, y)
  1987. X    F_compound       *c;
  1988. X    int            x, y;
  1989. X{
  1990. X    new_c = c;
  1991. X    fix_x = cur_x = x;
  1992. X    fix_y = cur_y = y;
  1993. X    x1off = c->nwcorner.x - x;
  1994. X    x2off = c->secorner.x - x;
  1995. X    y1off = c->nwcorner.y - y;
  1996. X    y2off = c->secorner.y - y;
  1997. X    canvas_locmove_proc = moving_box;
  1998. X    canvas_leftbut_proc = place_compound;
  1999. X    canvas_rightbut_proc = cancel_compound;
  2000. X    set_action_on();
  2001. X    get_links(c->nwcorner.x, c->nwcorner.y, c->secorner.x, c->secorner.y);
  2002. X    elastic_movebox();
  2003. X}
  2004. X
  2005. Xstatic
  2006. Xcancel_compound()
  2007. X{
  2008. X    elastic_movebox();
  2009. X    free_linkinfo(&cur_links);
  2010. X    if (return_proc == copy_selected) {
  2011. X    free_compound(&new_c);
  2012. X    } else {
  2013. X    list_add_compound(&objects.compounds, new_c);
  2014. X    redisplay_compound(new_c);
  2015. X    }
  2016. X    (*return_proc) ();
  2017. X    draw_mousefun_canvas();
  2018. X}
  2019. X
  2020. Xstatic
  2021. Xplace_compound(x, y)
  2022. X    int            x, y;
  2023. X{
  2024. X    int            dx, dy;
  2025. X
  2026. X    elastic_movebox();
  2027. X    adjust_pos(x, y, fix_x, fix_y, &x, &y);
  2028. X    dx = x - fix_x;
  2029. X    dy = y - fix_y;
  2030. X    translate_compound(new_c, dx, dy);
  2031. X    clean_up();
  2032. X    set_latestcompound(new_c);
  2033. X    if (return_proc == copy_selected) {
  2034. X    adjust_links(cur_linkmode, cur_links, dx, dy, 0, 0, 1.0, 1.0, 1);
  2035. X    tail(&objects, &object_tails);
  2036. X    append_objects(&objects, &saved_objects, &object_tails);
  2037. X    set_action_object(F_ADD, O_ALL_OBJECT);
  2038. X    free_linkinfo(&cur_links);
  2039. X    } else {
  2040. X    list_add_compound(&objects.compounds, new_c);
  2041. X    adjust_links(cur_linkmode, cur_links, dx, dy, 0, 0, 1.0, 1.0, 0);
  2042. X    set_lastposition(fix_x, fix_y);
  2043. X    set_newposition(x, y);
  2044. X    set_lastlinkinfo(cur_linkmode, cur_links);
  2045. X    cur_links = NULL;
  2046. X    set_action_object(F_MOVE, O_COMPOUND);
  2047. X    }
  2048. X    set_modifiedflag();
  2049. X    redisplay_compound(new_c);
  2050. X    (*return_proc) ();
  2051. X    draw_mousefun_canvas();
  2052. X}
  2053. END_OF_FILE
  2054. if test 10463 -ne `wc -c <'u_drag.c'`; then
  2055.     echo shar: \"'u_drag.c'\" unpacked with wrong size!
  2056. fi
  2057. # end of 'u_drag.c'
  2058. fi
  2059. if test -f 'w_file.c' -a "${1}" != "-c" ; then 
  2060.   echo shar: Will not clobber existing file \"'w_file.c'\"
  2061. else
  2062. echo shar: Extracting \"'w_file.c'\" \(11258 characters\)
  2063. sed "s/^X//" >'w_file.c' <<'END_OF_FILE'
  2064. X/*
  2065. X * FIG : Facility for Interactive Generation of figures
  2066. X * Copyright (c) 1991 by Brian V. Smith
  2067. X *
  2068. X * "Permission to use, copy, modify, distribute, and sell this software and its
  2069. X * documentation for any purpose is hereby granted without fee, provided that
  2070. X * the above copyright notice appear in all copies and that both the copyright
  2071. X * notice and this permission notice appear in supporting documentation. 
  2072. X * No representations are made about the suitability of this software for 
  2073. X * any purpose.  It is provided "as is" without express or implied warranty."
  2074. X */
  2075. X
  2076. X#include "fig.h"
  2077. X#include "figx.h"
  2078. X#include "resources.h"
  2079. X#include "object.h"
  2080. X#include "mode.h"
  2081. X#include "w_drawprim.h"        /* for char_height */
  2082. X#include "w_dir.h"
  2083. X#include "w_util.h"
  2084. X#include "w_setup.h"
  2085. X
  2086. Xextern Boolean    file_msg_is_popped;
  2087. Xextern Widget    file_msg_popup;
  2088. X
  2089. Xextern String    text_translations;
  2090. Xstatic char    load_msg[] = "The current figure is modified.\nDo you want to discard it and load the new file?";
  2091. Xstatic char    buf[40];
  2092. X
  2093. XDeclareStaticArgs(12);
  2094. Xstatic Widget    file_status, num_objects;
  2095. Xstatic Widget    cfile_lab, cfile_text;
  2096. Xstatic Widget    cancel, save, merge, load;
  2097. Xstatic Widget    file_w;
  2098. Xstatic Position xposn, yposn;
  2099. Xstatic String    file_name_translations =
  2100. X    "<Key>Return: load()\n";
  2101. Xstatic void    file_panel_cancel(), do_merge();
  2102. Xvoid        do_load(), do_save();
  2103. Xstatic XtActionsRec    file_name_actions[] =
  2104. X{
  2105. X    {"load", (XtActionProc) do_load},
  2106. X};
  2107. Xstatic String    file_translations =
  2108. X    "<Message>WM_PROTOCOLS: DismissFile()\n";
  2109. Xstatic XtActionsRec    file_actions[] =
  2110. X{
  2111. X    {"DismissFile", (XtActionProc) file_panel_cancel},
  2112. X    {"cancel", (XtActionProc) file_panel_cancel},
  2113. X    {"load", (XtActionProc) do_load},
  2114. X    {"save", (XtActionProc) do_save},
  2115. X    {"merge", (XtActionProc) do_merge},
  2116. X};
  2117. X
  2118. X/* Global so w_dir.c can access us */
  2119. X
  2120. XWidget        file_panel,    /* so w_dir can access the scrollbars */
  2121. X        file_popup,    /* the popup itself */
  2122. X        file_selfile,    /* selected file widget */
  2123. X        file_mask,    /* mask widget */
  2124. X        file_dir,    /* current directory widget */
  2125. X        file_flist,    /* file list wiget */
  2126. X        file_dlist;    /* dir list wiget */
  2127. X
  2128. XBoolean        file_up = False;
  2129. X
  2130. Xstatic void
  2131. Xfile_panel_dismiss()
  2132. X{
  2133. X    FirstArg(XtNstring, "\0");
  2134. X    SetValues(file_selfile);    /* clear Filename string */
  2135. X    XtPopdown(file_popup);
  2136. X    XtSetSensitive(file_w, True);
  2137. X    file_up = False;
  2138. X}
  2139. X
  2140. Xstatic void
  2141. Xdo_merge(w, ev)
  2142. X    Widget        w;
  2143. X    XButtonEvent   *ev;
  2144. X{
  2145. X    char        filename[100];
  2146. X    char       *fval, *dval;
  2147. X
  2148. X    FirstArg(XtNstring, &fval);
  2149. X    GetValues(file_selfile);    /* check the ascii widget for a filename */
  2150. X    if (emptyname(fval))
  2151. X    fval = cur_filename;    /* "Filename" widget empty, use current filename */
  2152. X
  2153. X    if (emptyname_msg(fval, "MERGE"))
  2154. X    return;
  2155. X
  2156. X    FirstArg(XtNstring, &dval);
  2157. X    GetValues(file_dir);
  2158. X
  2159. X    strcpy(filename, dval);
  2160. X    strcat(filename, "/");
  2161. X    strcat(filename, fval);
  2162. X    if (merge_file(filename) == 0)
  2163. X    file_panel_dismiss();
  2164. X}
  2165. X
  2166. Xvoid
  2167. Xdo_load(w, ev)
  2168. X    Widget        w;
  2169. X    XButtonEvent   *ev;
  2170. X{
  2171. X    char       *fval, *dval;
  2172. X
  2173. X    if (file_popup) {
  2174. X    FirstArg(XtNstring, &dval);
  2175. X    GetValues(file_dir);
  2176. X    FirstArg(XtNstring, &fval);
  2177. X    GetValues(file_selfile);    /* check the ascii widget for a filename */
  2178. X    if (emptyname(fval))
  2179. X        fval = cur_filename;    /* "Filename" widget empty, use current filename */
  2180. X
  2181. X    if (emptyname_msg(fval, "LOAD"))
  2182. X        return;
  2183. X
  2184. X    if (!emptyfigure() && figure_modified) {
  2185. X        XtSetSensitive(load, False);
  2186. X        if (!popup_query(QUERY_YES, load_msg)) {
  2187. X        XtSetSensitive(load, True);
  2188. X        return;
  2189. X        }
  2190. X        XtSetSensitive(load, True);
  2191. X    }
  2192. X    if (change_directory(dval) == 0) {
  2193. X        if (load_file(fval) == 0) {
  2194. X        FirstArg(XtNlabel, fval);
  2195. X        SetValues(cfile_text);        /* set the current filename */
  2196. X        if (fval != cur_filename)
  2197. X            update_cur_filename(fval);    /* and update cur_filename */
  2198. X        update_def_filename();        /* and the default export filename */
  2199. X        file_panel_dismiss();
  2200. X        }
  2201. X    }
  2202. X    } else {
  2203. X    (void) load_file(cur_filename);
  2204. X    }
  2205. X}
  2206. X
  2207. Xvoid
  2208. Xdo_save(w)
  2209. X    Widget        w;
  2210. X{
  2211. X    char       *fval, *dval;
  2212. X
  2213. X    if (emptyfigure_msg("Save"))
  2214. X    return;
  2215. X
  2216. X    if (file_popup) {
  2217. X    FirstArg(XtNstring, &fval);
  2218. X    GetValues(file_selfile);    /* check the ascii widget for a filename */
  2219. X    if (emptyname(fval)) {
  2220. X        fval = cur_filename;    /* "Filename" widget empty, use current filename */
  2221. X        warnexist = False;        /* don't warn if this file exists */
  2222. X    /* copy the name from the file_name widget to the current filename */
  2223. X    } else
  2224. X        {
  2225. X        warnexist = True;            /* warn if this file exists */
  2226. X        }
  2227. X
  2228. X    if (emptyname_msg(fval, "Save"))
  2229. X        return;
  2230. X
  2231. X    /* get the directory from the ascii widget */
  2232. X    FirstArg(XtNstring, &dval);
  2233. X    GetValues(file_dir);
  2234. X
  2235. X    if (change_directory(dval) == 0) {
  2236. X        XtSetSensitive(save, False);
  2237. X        if (write_file(fval) == 0) {
  2238. X        FirstArg(XtNlabel, fval);
  2239. X        SetValues(cfile_text);
  2240. X        if (strcmp(fval,cur_filename) != 0) {
  2241. X            update_cur_filename(fval);    /* update cur_filename */
  2242. X            update_def_filename();    /* update the default export filename */
  2243. X        }
  2244. X        reset_modifiedflag();
  2245. X        file_panel_dismiss();
  2246. X        }
  2247. X        XtSetSensitive(save, True);
  2248. X    }
  2249. X    } else {
  2250. X    /* not using popup => filename not changed so ok to write existing file */
  2251. X    warnexist = False;            
  2252. X    if (write_file(cur_filename) == 0)
  2253. X        reset_modifiedflag();
  2254. X    }
  2255. X}
  2256. X
  2257. Xstatic void
  2258. Xfile_panel_cancel(w, ev)
  2259. X    Widget        w;
  2260. X    XButtonEvent   *ev;
  2261. X{
  2262. X    file_panel_dismiss();
  2263. X}
  2264. X
  2265. Xpopup_file_panel(w)
  2266. X    Widget        w;
  2267. X{
  2268. X    extern Atom     wm_delete_window;
  2269. X
  2270. X    set_temp_cursor(wait_cursor);
  2271. X    XtSetSensitive(w, False);
  2272. X    file_up = True;
  2273. X
  2274. X    if (!file_popup)
  2275. X    create_file_panel(w);
  2276. X    else
  2277. X    Rescan(0, 0, 0, 0);
  2278. X
  2279. X    FirstArg(XtNlabel, (figure_modified ? "      File Status: Modified    " :
  2280. X                      "      File Status: Not modified"));
  2281. X    SetValues(file_status);
  2282. X    sprintf(buf, "Number of Objects: %d", object_count(&objects));
  2283. X    FirstArg(XtNlabel, buf);
  2284. X    SetValues(num_objects);
  2285. X    XtPopup(file_popup, XtGrabNonexclusive);
  2286. X    (void) XSetWMProtocols(XtDisplay(file_popup), XtWindow(file_popup),
  2287. X               &wm_delete_window, 1);
  2288. X    if (file_msg_is_popped)
  2289. X    XtAddGrab(file_msg_popup, False, False);
  2290. X    reset_cursor();
  2291. X}
  2292. X
  2293. Xcreate_file_panel(w)
  2294. X    Widget           w;
  2295. X{
  2296. X    Widget           file, dir, beside, below;
  2297. X    PIX_FONT       temp_font;
  2298. X    static int       actions_added=0;
  2299. X    file_w = w;
  2300. X    XtTranslateCoords(w, (Position) 0, (Position) 0, &xposn, &yposn);
  2301. X
  2302. X    FirstArg(XtNx, xposn);
  2303. X    NextArg(XtNy, yposn + 50);
  2304. X    NextArg(XtNtitle, "Xfig: File menu");
  2305. X    file_popup = XtCreatePopupShell("xfig_file_menu",
  2306. X                    transientShellWidgetClass,
  2307. X                    tool, Args, ArgCount);
  2308. X    XtOverrideTranslations(file_popup,
  2309. X               XtParseTranslationTable(file_translations));
  2310. X
  2311. X    file_panel = XtCreateManagedWidget("file_panel", formWidgetClass,
  2312. X                       file_popup, NULL, ZERO);
  2313. X
  2314. X    FirstArg(XtNlabel, "");
  2315. X    NextArg(XtNwidth, 400);
  2316. X    NextArg(XtNjustify, XtJustifyLeft);
  2317. X    NextArg(XtNborderWidth, 0);
  2318. X    NextArg(XtNresize, False);
  2319. X    file_status = XtCreateManagedWidget("file_status", labelWidgetClass,
  2320. X                        file_panel, Args, ArgCount);
  2321. X
  2322. X    FirstArg(XtNlabel, "");
  2323. X    NextArg(XtNwidth, 400);
  2324. X    NextArg(XtNfromVert, file_status);
  2325. X    NextArg(XtNjustify, XtJustifyLeft);
  2326. X    NextArg(XtNborderWidth, 0);
  2327. X    NextArg(XtNresize, False);
  2328. X    num_objects = XtCreateManagedWidget("num_objects", labelWidgetClass,
  2329. X                        file_panel, Args, ArgCount);
  2330. X
  2331. X    FirstArg(XtNlabel, " Current Filename:");
  2332. X    NextArg(XtNfromVert, num_objects);
  2333. X    NextArg(XtNvertDistance, 15);
  2334. X    NextArg(XtNjustify, XtJustifyLeft);
  2335. X    NextArg(XtNborderWidth, 0);
  2336. X    cfile_lab = XtCreateManagedWidget("cur_file_label", labelWidgetClass,
  2337. X                      file_panel, Args, ArgCount);
  2338. X
  2339. X    FirstArg(XtNlabel, cur_filename);
  2340. X    NextArg(XtNfromVert, num_objects);
  2341. X    NextArg(XtNfromHoriz, cfile_lab);
  2342. X    NextArg(XtNvertDistance, 15);
  2343. X    NextArg(XtNjustify, XtJustifyLeft);
  2344. X    NextArg(XtNborderWidth, 0);
  2345. X    NextArg(XtNwidth, 250);
  2346. X    cfile_text = XtCreateManagedWidget("cur_file_name", labelWidgetClass,
  2347. X                       file_panel, Args, ArgCount);
  2348. X
  2349. X    FirstArg(XtNlabel, "         Filename:");
  2350. X    NextArg(XtNvertDistance, 15);
  2351. X    NextArg(XtNfromVert, cfile_lab);
  2352. X    NextArg(XtNborderWidth, 0);
  2353. X    file = XtCreateManagedWidget("file_label", labelWidgetClass,
  2354. X                     file_panel, Args, ArgCount);
  2355. X    FirstArg(XtNfont, &temp_font);
  2356. X    GetValues(file);
  2357. X
  2358. X    FirstArg(XtNwidth, 350);
  2359. X    NextArg(XtNheight, char_height(temp_font) * 2 + 4);
  2360. X    NextArg(XtNeditType, "edit");
  2361. X    NextArg(XtNstring, cur_filename);
  2362. X    NextArg(XtNinsertPosition, strlen(cur_filename));
  2363. X    NextArg(XtNfromHoriz, file);
  2364. X    NextArg(XtNborderWidth, INTERNAL_BW);
  2365. X    NextArg(XtNvertDistance, 15);
  2366. X    NextArg(XtNfromVert, cfile_lab);
  2367. X    NextArg(XtNscrollHorizontal, XawtextScrollWhenNeeded);
  2368. X    file_selfile = XtCreateManagedWidget("file_name", asciiTextWidgetClass,
  2369. X                         file_panel, Args, ArgCount);
  2370. X    XtOverrideTranslations(file_selfile,
  2371. X               XtParseTranslationTable(text_translations));
  2372. X
  2373. X    if (!actions_added) {
  2374. X        XtAppAddActions(tool_app, file_actions, XtNumber(file_actions));
  2375. X        actions_added = 1;
  2376. X        /* add action to load file */
  2377. X        XtAppAddActions(tool_app, file_name_actions, XtNumber(file_name_actions));
  2378. X    }
  2379. X
  2380. X    /* make <return> in the filename window load the file */
  2381. X    XtOverrideTranslations(file_selfile,
  2382. X               XtParseTranslationTable(file_name_translations));
  2383. X
  2384. X    create_dirinfo(file_panel, file_selfile, &beside, &below,
  2385. X               &file_mask, &file_dir, &file_flist, &file_dlist);
  2386. X    /* make <return> in the file list window load the file */
  2387. X    XtOverrideTranslations(file_flist,
  2388. X               XtParseTranslationTable(file_name_translations));
  2389. X    FirstArg(XtNlabel, "Cancel");
  2390. X    NextArg(XtNvertDistance, 15);
  2391. X    NextArg(XtNhorizDistance, 25);
  2392. X    NextArg(XtNheight, 25);
  2393. X    NextArg(XtNfromHoriz, beside);
  2394. X    NextArg(XtNfromVert, below);
  2395. X    NextArg(XtNborderWidth, INTERNAL_BW);
  2396. X    cancel = XtCreateManagedWidget("cancel", commandWidgetClass,
  2397. X                       file_panel, Args, ArgCount);
  2398. X    XtAddEventHandler(cancel, ButtonReleaseMask, (Boolean) 0,
  2399. X              (XtEventHandler)file_panel_cancel, (XtPointer) NULL);
  2400. X
  2401. X    FirstArg(XtNlabel, "Save");
  2402. X    NextArg(XtNfromHoriz, cancel);
  2403. X    NextArg(XtNfromVert, below);
  2404. X    NextArg(XtNvertDistance, 15);
  2405. X    NextArg(XtNhorizDistance, 25);
  2406. X    NextArg(XtNheight, 25);
  2407. X    NextArg(XtNborderWidth, INTERNAL_BW);
  2408. X    save = XtCreateManagedWidget("save", commandWidgetClass,
  2409. X                     file_panel, Args, ArgCount);
  2410. X    XtAddEventHandler(save, ButtonReleaseMask, (Boolean) 0,
  2411. X              (XtEventHandler)do_save, (XtPointer) NULL);
  2412. X
  2413. X    FirstArg(XtNlabel, "Load");
  2414. X    NextArg(XtNborderWidth, INTERNAL_BW);
  2415. X    NextArg(XtNfromHoriz, save);
  2416. X    NextArg(XtNfromVert, below);
  2417. X    NextArg(XtNvertDistance, 15);
  2418. X    NextArg(XtNhorizDistance, 25);
  2419. X    NextArg(XtNheight, 25);
  2420. X    load = XtCreateManagedWidget("load", commandWidgetClass,
  2421. X                     file_panel, Args, ArgCount);
  2422. X    XtAddEventHandler(load, ButtonReleaseMask, (Boolean) 0,
  2423. X              (XtEventHandler)do_load, (XtPointer) NULL);
  2424. X
  2425. X    FirstArg(XtNlabel, "Merge Read");
  2426. X    NextArg(XtNfromHoriz, load);
  2427. X    NextArg(XtNfromVert, below);
  2428. X    NextArg(XtNborderWidth, INTERNAL_BW);
  2429. X    NextArg(XtNvertDistance, 15);
  2430. X    NextArg(XtNhorizDistance, 25);
  2431. X    NextArg(XtNheight, 25);
  2432. X    merge = XtCreateManagedWidget("merge", commandWidgetClass,
  2433. X                      file_panel, Args, ArgCount);
  2434. X    XtAddEventHandler(merge, ButtonReleaseMask, (Boolean) 0,
  2435. X              (XtEventHandler)do_merge, (XtPointer) NULL);
  2436. X
  2437. X    XtInstallAccelerators(file_panel, cancel);
  2438. X    XtInstallAccelerators(file_panel, save);
  2439. X    XtInstallAccelerators(file_panel, load);
  2440. X    XtInstallAccelerators(file_panel, merge);
  2441. X}
  2442. END_OF_FILE
  2443. if test 11258 -ne `wc -c <'w_file.c'`; then
  2444.     echo shar: \"'w_file.c'\" unpacked with wrong size!
  2445. fi
  2446. # end of 'w_file.c'
  2447. fi
  2448. echo shar: End of archive 9 \(of 27\).
  2449. cp /dev/null ark9isdone
  2450. MISSING=""
  2451. 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 ; do
  2452.     if test ! -f ark${I}isdone ; then
  2453.     MISSING="${MISSING} ${I}"
  2454.     fi
  2455. done
  2456. if test "${MISSING}" = "" ; then
  2457.     echo You have unpacked all 27 archives.
  2458.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2459. else
  2460.     echo You still need to unpack the following archives:
  2461.     echo "        " ${MISSING}
  2462. fi
  2463. ##  End of shell archive.
  2464. exit 0
  2465.  
  2466. exit 0 # Just in case...
  2467. -- 
  2468.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  2469. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  2470.  "It's intuitively obvious to the |
  2471.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  2472.