home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume17 / xtexcad1 / part08 < prev    next >
Encoding:
Text File  |  1992-04-20  |  50.2 KB  |  2,274 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: Fritz Haubensak <hsk@informatik.uni-wuerzburg.de>
  4. Subject: v17i072: TeXcad (X) version 1.2, Part08/10
  5. Message-ID: <1992Apr21.131424.2534@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Nntp-Posting-Host: fascet
  9. Organization: Molecular Simulations, Inc.
  10. References: <csx-17i065-xtexcad-1.2@uunet.UU.NET>
  11. Date: Tue, 21 Apr 1992 13:14:24 GMT
  12. Approved: dcmartin@msi.com
  13. Lines: 2259
  14.  
  15. Submitted-by: Fritz Haubensak <hsk@informatik.uni-wuerzburg.de>
  16. Posting-number: Volume 17, Issue 72
  17. Archive-name: xtexcad-1.2/part08
  18.  
  19. # this is part.08 (part 8 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file pickedit.c continued
  22. #
  23. if test ! -r _shar_seq_.tmp; then
  24.     echo 'Please unpack part 1 first!'
  25.     exit 1
  26. fi
  27. (read Scheck
  28.  if test "$Scheck" != 8; then
  29.     echo Please unpack part "$Scheck" next!
  30.     exit 1
  31.  else
  32.     exit 0
  33.  fi
  34. ) < _shar_seq_.tmp || exit 1
  35. if test ! -f _shar_wnt_.tmp; then
  36.     echo 'x - still skipping pickedit.c'
  37. else
  38. echo 'x - continuing file pickedit.c'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'pickedit.c' &&
  40. X                four->v = y_pos;
  41. X            } else if (low_val == dist4)
  42. X            {
  43. X                four->x = h_pos;
  44. X                four->h = x_pos;
  45. X            }
  46. X            /* low_val==dist2 is default... */
  47. X            edit_frame(dd);
  48. X            if (refr_auto == True)
  49. X                refresh(pboard, '?', (caddr_t)DUMMY);    /* wipe screen */
  50. X        }    /* if low_val<=points */
  51. X        break;
  52. X
  53. X    case 'O':    /* which point ? */
  54. X        one = (struct fig1 *) obj[currIndex];
  55. X        dist1 = calc_distance(x, y, (int) one->x, (int) one->y);    /* upper left */
  56. X        dist2 = calc_distance(x, y, (int) one->h, (int) one->v);    /* lower right */
  57. X        dist3 = calc_distance(x, y, (int) one->h, (int) one->y);    /* upper right */
  58. X        dist4 = calc_distance(x, y, (int) one->x, (int) one->v);    /* lower left */
  59. X        if (zoomed == True)
  60. X        {
  61. X            dist1 *= 10;
  62. X            dist2 *= 10;
  63. X            dist3 *= 10;
  64. X            dist4 *= 10;
  65. X        }
  66. X        /* compute minimum */
  67. X        if (dist1 < dist2)
  68. X            low_val = dist1;
  69. X        else
  70. X            low_val = dist2;
  71. X        if (dist3 < low_val)
  72. X            low_val = dist3;
  73. X        if (dist4 < low_val)
  74. X            low_val = dist4;
  75. X        if (low_val <= points)
  76. X        {
  77. X            x_pos = one->x;
  78. X            y_pos = one->y;
  79. X            h_pos = one->h;
  80. X            v_pos = one->v;
  81. X            if (low_val == dist1)
  82. X            {
  83. X                one->x = h_pos;
  84. X                one->y = v_pos;
  85. X                one->h = x_pos;
  86. X                one->v = y_pos;
  87. X                /*
  88. X                 * now, coordinates are in the correct
  89. X                 * order...
  90. X                 */
  91. X            } else if (low_val == dist3)
  92. X            {
  93. X                one->y = v_pos;
  94. X                one->v = y_pos;
  95. X            } else if (low_val == dist4)
  96. X            {
  97. X                one->x = h_pos;
  98. X                one->h = x_pos;
  99. X            }
  100. X            /* low_val==dist2 is default... */
  101. X            edit_frame(oo);
  102. X            if (refr_auto == True)
  103. X                refresh(pboard, '?', (caddr_t)DUMMY);    /* wipe screen */
  104. X        }    /* if low_val<=points */
  105. X        break;
  106. X
  107. X    case 'C':
  108. X        low_val = valid_circle_edit(x, y);
  109. X        if (zoomed == True)
  110. X            low_val *= 10;
  111. X        if (low_val <= points)
  112. X        {
  113. X            edit_circle(cc);
  114. X            if (refr_auto == True)
  115. X                refresh(pboard, '?', (caddr_t)DUMMY);    /* wipe screen */
  116. X        }
  117. X        break;
  118. X
  119. X    case 'B':
  120. X        low_val = valid_circle_edit(x, y);
  121. X        if (zoomed == True)
  122. X            low_val *= 10;
  123. X        if (low_val <= points)
  124. X        {
  125. X            edit_circle(bb);
  126. X            if (refr_auto == True)
  127. X                refresh(pboard, '?', (caddr_t)DUMMY);    /* wipe screen */
  128. X        }
  129. X        break;
  130. X
  131. X
  132. X
  133. X    default:
  134. X        break;
  135. X
  136. X    }    /* switch */
  137. }/* pick_edit */
  138. X
  139. X
  140. int
  141. valid_circle_edit(int x, int y)
  142. {
  143. X    struct fig2    *two;
  144. X    int             dist;
  145. X    two = (struct fig2 *) obj[currIndex];
  146. X
  147. X    dist = calc_distance((int) two->x, (int) two->y, x, y);
  148. X
  149. X    return abs(dist - two->radius);
  150. }
  151. X
  152. X
  153. X
  154. X
  155. X
  156. void
  157. edit_circle(char ch)
  158. {
  159. X    struct fig2    *two;
  160. X    int             x, y, rad, zoom, rad2, oldrad;
  161. X    unsigned int    mask;
  162. X    Display        *disp = XtDisplay(pboard);
  163. X    Window          win = XtWindow(pboard);
  164. X    int             btn1 = 256, btn2 = 512, btn3 = 1024;
  165. X
  166. X
  167. X    two = (struct fig2 *) obj[currIndex];
  168. X
  169. X    oldrad = two->radius;
  170. X
  171. X
  172. X    if (zoomed == True)
  173. X    {
  174. X        real2zoomed(&two->x, &two->y);
  175. X        zoom = 10;
  176. X    } else
  177. X        zoom = 1;
  178. X
  179. X
  180. X
  181. X    do
  182. X    {
  183. X        PointerPosition(&x, &y, &mask);
  184. X
  185. X        /* delete old */
  186. X        rad = two->radius;
  187. X        if (ch == 'C')
  188. X            valid_kreis_coords((int) (two->x), (int) (two->y), &x, &y, &rad2);
  189. X        else
  190. X            valid_disc_coords((int) (two->x), (int) (two->y), &x, &y, &rad2);
  191. X
  192. X        if (rad2 != rad)
  193. X        {    /* redraw necessary */
  194. X
  195. X
  196. X            draw_coords(pboard, (caddr_t) x, (caddr_t) y);
  197. X
  198. X            if (ch == 'C')
  199. X                XDrawArc(disp, win, gc,
  200. X                     (int) (two->x) - (rad * zoom), (int) (two->y) - (rad * zoom),
  201. X                     (unsigned int) (zoom * (rad + rad)),
  202. X                     (unsigned int) (zoom * (rad + rad)), 0, 360 * 64);
  203. X            else
  204. X                XFillArc(disp, win, gc,
  205. X                     (int) (two->x) - (rad * zoom), (int) (two->y) - (rad * zoom),
  206. X                     (unsigned int) (zoom * (rad + rad)),
  207. X                     (unsigned int) (zoom * (rad + rad)), 0, 360 * 64);
  208. X
  209. X            rad = rad2;
  210. X            two->radius = rad;
  211. X            if (ch == 'C')
  212. X                XDrawArc(disp, win, gc,
  213. X                     (int) (two->x) - (rad * zoom), (int) (two->y) - (rad * zoom),
  214. X                     (unsigned int) (zoom * (rad + rad)),
  215. X                     (unsigned int) (zoom * (rad + rad)), 0, 360 * 64);
  216. X            else
  217. X                XFillArc(disp, win, gc,
  218. X                     (int) (two->x) - (rad * zoom), (int) (two->y) - (rad * zoom),
  219. X                     (unsigned int) (zoom * (rad + rad)),
  220. X                     (unsigned int) (zoom * (rad + rad)), 0, 360 * 64);
  221. X
  222. X        }    /* redraw necessary */
  223. X    } while (mask & btn1);
  224. X
  225. X
  226. X    if (zoomed == True)
  227. X        zoomed2real(&two->x, &two->y);
  228. X
  229. X    if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))
  230. X    {    /* cancel */
  231. X        two->radius = oldrad;
  232. X        return;
  233. X    }
  234. }
  235. X
  236. X
  237. void
  238. edit_bezier_curveA()
  239. {
  240. X  struct fig6 *six=(struct fig6 *) obj[currIndex];
  241. X  float sx,sy;
  242. X  float x_old;
  243. X  float y_old;
  244. X  Display *disp=XtDisplay(pboard);
  245. X  Window win=XtWindow(pboard);
  246. X  int x,y;
  247. X  unsigned int mask;
  248. X  int btn1=256, btn2=512, btn3=1024;
  249. X  float help1,help2;
  250. X
  251. X
  252. X    sx=six->sx;
  253. X    sy=six->sy;
  254. X
  255. X    if (zoomed==True) real2zoomed(&sx,&sy);
  256. X
  257. X    x_old=six->ax;
  258. X    y_old=six->ay;
  259. X    do
  260. X    {
  261. X        snapPointerPosition(&x, &y, &mask);
  262. X        
  263. X        if (zoomed==True)
  264. X            {
  265. X                help1=(float)x;
  266. X                help2=(float)y;
  267. X                zoomed2real(&help1,&help2);
  268. X                x=(int)help1;
  269. X                y=(int)help2;
  270. X            }
  271. X        
  272. X        if ((x != (int)x_old) || (y != (int)y_old)) 
  273. X        {    /* redraw necessary */
  274. X            draw_coords(pboard, (caddr_t) x, (caddr_t) y);
  275. X
  276. X            
  277. X
  278. X            /* delete old object */
  279. X            
  280. X            DrawBezier(x_old,y_old,six->ex,six->ey,sx,sy);
  281. X
  282. X            x_old=(float)x;
  283. X            y_old=(float)y;
  284. X
  285. X            /* draw new */
  286. X
  287. X            DrawBezier(x_old,y_old,six->ex,six->ey,sx,sy);
  288. X
  289. X        }  /* redraw */
  290. X
  291. X    } while (mask & btn1);
  292. X
  293. X    /* btn1 was released... */
  294. X    /* cancel, if pointer is outside of pboard */
  295. X
  296. X    if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))    /* cancel */
  297. X        return;
  298. X
  299. X
  300. X    /* save new coordinates & translate them to the right mode */
  301. X    /* new coordinate is in x_old,y_old */
  302. X
  303. X    six->ax=x_old;
  304. X    six->ay=y_old;
  305. }
  306. X
  307. X
  308. X
  309. void edit_bezier_curveE()
  310. {
  311. X  struct fig6 *six=(struct fig6 *) obj[currIndex];
  312. X  float sx,sy;
  313. X  float x_old;
  314. X  float y_old;
  315. X  Display *disp=XtDisplay(pboard);
  316. X  Window win=XtWindow(pboard);
  317. X  int x,y;
  318. X  unsigned int mask;
  319. X  int btn1=256,btn2=512,btn3=1024;
  320. X  float help1,help2;
  321. X
  322. X
  323. X    sx=six->sx;
  324. X    sy=six->sy;
  325. X
  326. X    if (zoomed==True) real2zoomed(&sx,&sy);
  327. X
  328. X    x_old=six->ex;
  329. X    y_old=six->ey;
  330. X    do
  331. X    {
  332. X        snapPointerPosition(&x, &y, &mask);
  333. X        if (zoomed==True)
  334. X        {
  335. X            help1=(float)x;
  336. X            help2=(float)y;
  337. X            zoomed2real(&help1,&help2);
  338. X            x=(int)help1;
  339. X            y=(int)help2;
  340. X        }
  341. X        if ((x != (int)x_old) || (y != (int)y_old))
  342. X        {    /* redraw necessary */
  343. X            draw_coords(pboard, (caddr_t) x, (caddr_t) y);
  344. X
  345. X            /* delete old object */
  346. X            
  347. X            DrawBezier(six->ax,six->ay,x_old,y_old,sx,sy);
  348. X
  349. X            x_old=(float)x;
  350. X            y_old=(float)y;
  351. X
  352. X            /* draw new */
  353. X
  354. X            DrawBezier(six->ax,six->ay,x_old,y_old,sx,sy);
  355. X
  356. X        } /* redraw */
  357. X
  358. X    } while (mask & btn1);
  359. X
  360. X    /* btn1 was released... */
  361. X    /* cancel, if pointer is outside of pboard */
  362. X
  363. X    if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))    /* cancel */
  364. X        return;
  365. X
  366. X
  367. X    /* save new coordinates & translate them to the right mode */
  368. X    /* new coordinate is in x_old,y_old */
  369. X
  370. X    six->ex=x_old;
  371. X    six->ey=y_old;
  372. }
  373. X
  374. X
  375. void edit_bezier_curveS()
  376. {
  377. X  struct fig6 *six=(struct fig6 *) obj[currIndex];
  378. X  float sx,sy;
  379. X  float x_old;
  380. X  float y_old;
  381. X  Display *disp=XtDisplay(pboard);
  382. X  Window win=XtWindow(pboard);
  383. X  int x,y;
  384. X  unsigned int mask;
  385. X  int btn1=256,btn2=512,btn3=1024;
  386. X  
  387. X
  388. X    
  389. X
  390. X    
  391. X
  392. X    x_old=six->sx;
  393. X    y_old=six->sy;
  394. X
  395. X    if (zoomed==True) real2zoomed(&x_old,&y_old);
  396. X    do
  397. X    {
  398. X        snapPointerPosition(&x, &y, &mask);
  399. X        if ((x != (int)x_old) || (y != (int)y_old))
  400. X        {    /* redraw necessary */
  401. X            draw_coords(pboard, (caddr_t) x, (caddr_t) y);
  402. X
  403. X            /* delete old object */
  404. X            
  405. X            DrawBezier(six->ax,six->ay,six->ex,six->ey,x_old,y_old);
  406. X
  407. X            x_old=(float)x;
  408. X            y_old=(float)y;
  409. X
  410. X            /* draw new */
  411. X
  412. X            DrawBezier(six->ax,six->ay,six->ex,six->ey,x_old,y_old);
  413. X
  414. X        } /* redraw */
  415. X
  416. X    } while (mask & btn1);
  417. X
  418. X    /* btn1 was released... */
  419. X    /* cancel, if pointer is outside of pboard */
  420. X
  421. X    if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))    /* cancel */
  422. X        return;
  423. X
  424. X
  425. X    /* save new coordinates & translate them to the right mode */
  426. X    /* new coordinate is in x_old,y_old */
  427. X
  428. X    if (zoomed==True) zoomed2real(&x_old,&y_old);
  429. X
  430. X    six->sx=x_old;
  431. X    six->sy=y_old;
  432. }
  433. X
  434. X
  435. void
  436. edit_frame(char ch)
  437. {
  438. X    struct fig1    *one;
  439. X    struct fig2    *two;
  440. X    struct fig3    *three;
  441. X    struct fig4    *four;
  442. X    unsigned int    mask;
  443. X    Display        *disp = XtDisplay(pboard);
  444. X    Window          win = XtWindow(pboard);
  445. X    int             btn1 = 256, btn2 = 512, btn3 = 1024;
  446. X    float           x1, x2, y1, y2, y1old, y2old;
  447. X    float           x11, x22, y11, y22;
  448. X    int             x, y;
  449. X    y22 = 999.0;
  450. X
  451. X    switch (ch)
  452. X    {
  453. X
  454. X    case 'N':
  455. X        three = (struct fig3 *) obj[currIndex];
  456. X        x1 = three->x;
  457. X        x2 = three->y;
  458. X        y1 = three->h;
  459. X        y2 = three->v;
  460. X        break;
  461. X
  462. X    case 'D':
  463. X        four = (struct fig4 *) obj[currIndex];
  464. X        x1 = four->x;
  465. X        x2 = four->y;
  466. X        y1 = four->h;
  467. X        y2 = four->v;
  468. X        break;
  469. X
  470. X    case 'F':
  471. X        two = (struct fig2 *) obj[currIndex];
  472. X        x1 = two->x;
  473. X        x2 = two->y;
  474. X        y1 = two->h;
  475. X        y2 = two->v;
  476. X        break;
  477. X
  478. X    case 'O':
  479. X        one = (struct fig1 *) obj[currIndex];
  480. X        x1 = one->x;
  481. X        x2 = one->y;
  482. X        y1 = one->h;
  483. X        y2 = one->v;
  484. X        break;
  485. X
  486. X    default:
  487. X        break;
  488. X
  489. X    }    /* switch */
  490. X
  491. X
  492. X
  493. X
  494. X
  495. X    /* x=(x1,x2)  y=(y1,y2) */
  496. X
  497. X    /* save y-coordinate */
  498. X    y1old = y1;
  499. X    y2old = y2;
  500. X
  501. X
  502. X    if (zoomed == True)
  503. X    {
  504. X        real2zoomed(&x1, &x2);
  505. X        real2zoomed(&y1, &y2);
  506. X    }
  507. X    /* (x1,x2) is a fixed point, 'edit' influences (y1,y2) only */
  508. X
  509. X
  510. X
  511. X    do
  512. X    {
  513. X        snapPointerPosition(&x, &y, &mask);
  514. X        if ((x != y1) || (y != y2))
  515. X        {    /* redraw necessary */
  516. X            draw_coords(pboard, (caddr_t) x, (caddr_t) y);
  517. X            /* delete old object */
  518. X            if (y22 == 999.0)
  519. X            {
  520. X                y11 = y1;
  521. X                y22 = y2;
  522. X                x11 = x1;
  523. X                x22 = x2;
  524. X                norm_rectangle(&x11, &x22, &y11, &y22);
  525. X            }
  526. X            switch (ch)
  527. X            {
  528. X            case 'N':
  529. X                XDrawRectangle(disp, win, gc, (int) x11, (int) x22,
  530. X                     (unsigned int) ((int) (y11 - x11)),
  531. X                    (unsigned int) ((int) (y22 - x22)));
  532. X                break;
  533. X            case 'F':
  534. X                XFillRectangle(disp, win, gc, (int) x11, (int) x22,
  535. X                     (unsigned int) ((int) (y11 - x11)),
  536. X                    (unsigned int) ((int) (y22 - x22)));
  537. X                break;
  538. X
  539. X
  540. X            case 'D':
  541. X                XSetLineAttributes(disp, gc, 0, LineOnOffDash, CapButt, JoinMiter);
  542. X                XDrawRectangle(disp, win, gc, (int) x11, (int) x22,
  543. X                     (unsigned int) ((int) (y11 - x11)),
  544. X                    (unsigned int) ((int) (y22 - x22)));
  545. X                XSetLineAttributes(disp, gc, 0, LineSolid, CapButt, JoinMiter);
  546. X                break;
  547. X
  548. X            case 'O':
  549. X                DrawOval((int) x11, (int) x22, (int) y11, (int) y22);
  550. X                break;
  551. X
  552. X            default:
  553. X                break;
  554. X
  555. X            }    /* switch */
  556. X
  557. X
  558. X
  559. X            /* draw new */
  560. X            x11 = x1;
  561. X            x22 = x2;
  562. X            y11 = (float) x;
  563. X            y22 = (float) y;
  564. X            y1 = y11;
  565. X            y2 = y22;
  566. X            norm_rectangle(&x11, &x22, &y11, &y22);
  567. X            switch (ch)
  568. X            {
  569. X            case 'N':
  570. X                XDrawRectangle(disp, win, gc, (int) x11, (int) x22,
  571. X                     (unsigned int) ((int) (y11 - x11)),
  572. X                    (unsigned int) ((int) (y22 - x22)));
  573. X                break;
  574. X            case 'F':
  575. X                XFillRectangle(disp, win, gc, (int) x11, (int) x22,
  576. X                     (unsigned int) ((int) (y11 - x11)),
  577. X                    (unsigned int) ((int) (y22 - x22)));
  578. X                break;
  579. X
  580. X
  581. X            case 'D':
  582. X                XSetLineAttributes(disp, gc, 0, LineOnOffDash, CapButt, JoinMiter);
  583. X                XDrawRectangle(disp, win, gc, (int) x11, (int) x22,
  584. X                     (unsigned int) ((int) (y11 - x11)),
  585. X                    (unsigned int) ((int) (y22 - x22)));
  586. X                XSetLineAttributes(disp, gc, 0, LineSolid, CapButt, JoinMiter);
  587. X                break;
  588. X
  589. X            case 'O':
  590. X                DrawOval((int) x11, (int) x22, (int) y11, (int) y22);
  591. X                break;
  592. X
  593. X            default:
  594. X                break;
  595. X
  596. X            }    /* switch */
  597. X
  598. X        }    /* redraw */
  599. X    } while (mask & btn1);
  600. X
  601. X    /* btn1 was released... */
  602. X    /* cancel, if pointer is outside of pboard */
  603. X
  604. X    if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))    /* cancel */
  605. X        return;
  606. X
  607. X
  608. X    /* save new coordinates & translate them to the right mode */
  609. X
  610. X    switch (ch)
  611. X    {
  612. X    case 'N':
  613. X        three->h = y1;
  614. X        three->v = y2;
  615. X        if (zoomed == True)
  616. X            zoomed2real(&three->h, &three->v);
  617. X        norm_rectangle(&three->x, &three->y, &three->h, &three->v);
  618. X        break;
  619. X
  620. X    case 'D':
  621. X        four->h = y1;
  622. X        four->v = y2;
  623. X        if (zoomed == True)
  624. X            zoomed2real(&four->h, &four->v);
  625. X        norm_rectangle(&four->x, &four->y, &four->h, &four->v);
  626. X        break;
  627. X
  628. X    case 'F':
  629. X        two->h = y1;
  630. X        two->v = y2;
  631. X        if (zoomed == True)
  632. X            zoomed2real(&two->h, &two->v);
  633. X        norm_rectangle(&two->x, &two->y, &two->h, &two->v);
  634. X        break;
  635. X
  636. X    case 'O':
  637. X        one->h = y1;
  638. X        one->v = y2;
  639. X        if (zoomed == True)
  640. X            zoomed2real(&one->h, &one->v);
  641. X        norm_rectangle(&one->x, &one->y, &one->h, &one->v);
  642. X        break;
  643. X
  644. X    default:
  645. X        break;
  646. X
  647. X    }    /* switch */
  648. X
  649. X
  650. }
  651. X
  652. X
  653. X
  654. int
  655. calc_distance(int x, int y, int h, int v)
  656. {
  657. X    double          res;
  658. X    x -= h;
  659. X    y -= v;
  660. X
  661. X    res = (double) (x * x + y * y);
  662. X    return (int) sqrt(res);
  663. }
  664. X
  665. X
  666. X
  667. X
  668. X
  669. void
  670. edit_x_line()
  671. {
  672. X
  673. X    struct fig2    *two;
  674. X    int             x, y;
  675. X    unsigned int    mask;
  676. X    Display        *disp = XtDisplay(pboard);
  677. X    Window          win = XtWindow(pboard);
  678. X    int             btn1 = 256, btn2 = 512, btn3 = 1024;
  679. X    float           xold, yold;
  680. X    float           x1, x2, y1, y2;
  681. X    two = (struct fig2 *) obj[currIndex];
  682. X
  683. X    if (zoomed == True)
  684. X    {    /* prepare coordinates for right mode */
  685. X        real2zoomed(&two->x, &two->y);
  686. X        real2zoomed(&two->h, &two->v);
  687. X    }
  688. X    /* save coordinates */
  689. X    xold = two->x;
  690. X    yold = two->y;
  691. X
  692. X    do
  693. X    {
  694. X        PointerPosition(&x, &y, &mask);
  695. X        /*
  696. X         * watch the correct slopes (line and vector slopes are
  697. X         * different !)
  698. X         */
  699. X        /* so, what object is selected ? line or vector ? */
  700. X        if (kind[currIndex] == 'L')
  701. X            valid_line_coords((int) two->h, (int) two->v, &x, &y);
  702. X        else
  703. X            valid_vector_coords((int) two->h, (int) two->v, &x, &y);
  704. X
  705. X        if ((two->x != (float) x) || (two->y != (float) y))
  706. X        {    /* redraw necessary */
  707. X
  708. X
  709. X            draw_coords(pboard, (caddr_t) x, (caddr_t) y);    /* dummy parameters */
  710. X
  711. X            /* delete old */
  712. X            XDrawLine(disp, win, gc, (int) two->x, (int) two->y, (int) two->h, (int) two->v);
  713. X            /* draw new */
  714. X            two->x = (float) x;
  715. X            two->y = (float) y;
  716. X            XDrawLine(disp, win, gc, (int) two->x, (int) two->y, (int) two->h, (int) two->v);
  717. X        }    /* redraw */
  718. X    } while (mask & btn1);
  719. X
  720. X    /* btn1 was released... */
  721. X    /* cancel, if pointer is outside of pboard */
  722. X
  723. X    if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))
  724. X    {    /* cancel */
  725. X        two->x = xold;
  726. X        two->y = yold;
  727. X        if (zoomed == True)
  728. X        {
  729. X            zoomed2real(&two->h, &two->v);
  730. X            zoomed2real(&two->x, &two->y);
  731. X        }
  732. X        return;
  733. X    }
  734. X    /* translate coordinates to the right mode */
  735. X
  736. X    if (zoomed == True)
  737. X    {
  738. X        zoomed2real(&two->h, &two->v);
  739. X        zoomed2real(&two->x, &two->y);
  740. X    }
  741. }/* edit_x_line */
  742. X
  743. X
  744. X
  745. X
  746. void
  747. edit_y_line()
  748. {
  749. X    float           swap_x, swap_y;
  750. X    struct fig2    *two;
  751. X
  752. X
  753. X    /* swap x,y with h,v and call edit_x_line() */
  754. X
  755. X    two = (struct fig2 *) obj[currIndex];
  756. X
  757. X    swap_x = two->x;
  758. X    swap_y = two->y;
  759. X
  760. X    two->x = two->h;
  761. X    two->y = two->v;
  762. X
  763. X    two->h = swap_x;
  764. X    two->v = swap_y;
  765. X
  766. X    edit_x_line();
  767. X
  768. }/* edit_y_line */
  769. X
  770. X
  771. X
  772. void
  773. del_vector_marker(float x, float y, float h, float v)
  774. {
  775. X    if (zoomed == True)
  776. X    {
  777. X        real2zoomed(&x, &y);
  778. X        real2zoomed(&h, &v);
  779. X    }
  780. X    draw_vector_marker(x, y, h, v);
  781. }
  782. X
  783. X
  784. X
  785. void
  786. edit_x_vector()
  787. {
  788. X    struct fig2    *two;
  789. X    two = (struct fig2 *) obj[currIndex];
  790. X
  791. X    del_vector_marker(two->x, two->y, two->h, two->v);
  792. X
  793. X    edit_x_line();
  794. X
  795. X    if (refr_auto == True)
  796. X        refresh(pboard, '?', (caddr_t)DUMMY);    /* wipe screen */
  797. X
  798. }
  799. X
  800. X
  801. X
  802. void
  803. edit_y_vector()
  804. {
  805. X    struct fig2    *two;
  806. X    float           x, y;
  807. X    two = (struct fig2 *) obj[currIndex];
  808. X
  809. X    del_vector_marker(two->x, two->y, two->h, two->v);
  810. X
  811. X    edit_y_line();
  812. X
  813. X    /* swap coordinates */
  814. X    x = two->x;
  815. X    y = two->y;
  816. X    two->x = two->h;
  817. X    two->y = two->v;
  818. X    two->v = y;
  819. X    two->h = x;
  820. X
  821. X    if (refr_auto == True)
  822. X        refresh(pboard, '?', (caddr_t)DUMMY);    /* wipe screen */
  823. X
  824. X
  825. }
  826. X
  827. X
  828. X
  829. X
  830. X
  831. X
  832. /* --==--==--==--==--==--==--==--==--==-- */
  833. void
  834. set_pick_erase()
  835. {
  836. X    /* Override Translation Manager */
  837. X    XtTranslations  trans_table;
  838. X    char            destination[80] = "<Btn1Down>: pick_erase()";
  839. X    static XtActionsRec actions[80] = {{"pick_erase", pick_erase}};
  840. X    XtAddActions(actions, XtNumber(actions));
  841. X    trans_table = XtParseTranslationTable(destination);
  842. X    XtOverrideTranslations(pboard, trans_table);
  843. X
  844. }
  845. X
  846. X
  847. X
  848. void
  849. pick_erase()
  850. {
  851. X    /* pointer button one was pressed */
  852. X
  853. X
  854. X    Display        *disp;
  855. X    Window          win;
  856. X    unsigned int    mask, mask2;
  857. X    int             h, v, x, y;
  858. X    Position        x_rel, y_rel, xx, yy;
  859. X    int             btn1 = 256, btn2 = 512, btn3 = 1024;
  860. X    PointerPosition(&x, &y, &mask);
  861. X
  862. X    disp = XtDisplay(pboard);
  863. X    win = XtWindow(pboard);
  864. X
  865. X    XtUninstallTranslations(pboard);
  866. X
  867. X    set_pick_stack(x, y);
  868. X
  869. X    while (True)
  870. X    {
  871. X        h = nextObject();
  872. X
  873. X        if (h == -1)
  874. X        {
  875. X            left();
  876. X            leave_pick("No valid object found !");
  877. X            return;
  878. X        }
  879. X        prepare_top_stack_object();
  880. X
  881. X        headline(toplevel, "Actions: press Button 2 to ERASE object ----- press Button 3 for MORE");
  882. X
  883. X        do
  884. X        {    /* listen closely to button number 2! If pressed ->
  885. X             * erase object */
  886. X            PointerPosition(&x, &y, &mask);
  887. X            if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))
  888. X            {
  889. X                left();
  890. X                prepare_top_stack_object();
  891. X                return;
  892. X            }
  893. X        } while ((!(mask & btn3)) && (!(mask & btn2)));
  894. X
  895. X        do
  896. X        {
  897. X            PointerPosition(&x, &y, &mask2);
  898. X            if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))
  899. X            {
  900. X                left();
  901. X                prepare_top_stack_object();
  902. X                return;
  903. X            }
  904. X        } while (mask == mask2);
  905. X
  906. X
  907. X        prepare_top_stack_object();
  908. X
  909. X        if (mask & 512)
  910. X            erase_current_object();    /* yes, erase this object */
  911. X
  912. X        /* now work with the next object on the pick-stack */
  913. X    }
  914. X
  915. }
  916. X
  917. X
  918. void
  919. set_dash_mode()
  920. {
  921. X    XGCValues       gcvals;
  922. X    Display        *disp = XtDisplay(pboard);
  923. X    Window          win = XtWindow(pboard);
  924. X    XSetLineAttributes(disp, gc, 0, LineDoubleDash, CapButt, JoinMiter);
  925. X
  926. X    gcvals.dashes = 12;
  927. X    XChangeGC(disp, gc, GCDashList, &gcvals);
  928. }
  929. X
  930. X
  931. X
  932. void
  933. set_normal_mode()
  934. {
  935. X    XGCValues       gcvals;
  936. X    Display        *disp = XtDisplay(pboard);
  937. X    Window          win = XtWindow(pboard);
  938. X    XSetLineAttributes(disp, gc, 0, LineSolid, CapButt, JoinMiter);
  939. X
  940. X    gcvals.dashes = 5;
  941. X    XChangeGC(disp, gc, GCDashList, &gcvals);
  942. }
  943. X
  944. X
  945. X
  946. void
  947. prepare_top_stack_object()
  948. {
  949. X    struct fig1    *one;
  950. X    struct fig2    *two;
  951. X    struct fig3    *three;
  952. X    struct fig4    *four;
  953. X    struct fig6    *six;
  954. X    Display        *disp = XtDisplay(pboard);
  955. X    Window          win = XtWindow(pboard);
  956. X    float           x, y, h, v, a, b;
  957. X    int             rad;
  958. X
  959. X
  960. X
  961. X    switch (kind[currIndex])
  962. X    {
  963. X    case 'I':
  964. X        six = (struct fig6 *) obj[currIndex];
  965. X        x = six->ax;
  966. X        y = six->ay;
  967. X        h = six->ex;
  968. X        v = six->ey;
  969. X        a = six->sx;
  970. X        b = six->sy;
  971. X        if (zoomed == True)
  972. X        {
  973. X            real2zoomed(&x, &y);
  974. X            real2zoomed(&h, &v);
  975. X            real2zoomed(&a, &b);
  976. X        }
  977. X        XDrawArc(disp, win, gc, (int) x - points, (int) y - points,
  978. X             (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  979. X        XDrawArc(disp, win, gc, (int) a - points, (int) b - points,
  980. X             (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  981. X        XDrawArc(disp, win, gc, (int) h - points, (int) v - points,
  982. X             (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  983. X        set_dash_mode();
  984. X        XDrawLine(disp,win,gc,(int)a,(int)b,(int)h,(int)v);
  985. X        XDrawLine(disp,win,gc,(int)h,(int)v,(int)x,(int)y);
  986. X        XDrawLine(disp,win,gc,(int)x,(int)y,(int)a,(int)b);
  987. X        set_normal_mode();
  988. X        break;
  989. X
  990. X    case 'L':
  991. X        two = (struct fig2 *) obj[currIndex];
  992. X        x = two->x;
  993. X        y = two->y;
  994. X        h = two->h;
  995. X        v = two->v;
  996. X        if (zoomed == True)
  997. X        {
  998. X            real2zoomed(&x, &y);
  999. X            real2zoomed(&h, &v);
  1000. X        }
  1001. X        set_dash_mode();
  1002. X        XDrawLine(disp, win, gc, (int) x, (int) y, (int) h, (int) v);
  1003. X        set_normal_mode();
  1004. X        XDrawArc(disp, win, gc, (int) x - points, (int) y - points,
  1005. X             (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1006. X        XDrawArc(disp, win, gc, (int) h - points, (int) v - points,
  1007. X             (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1008. X        break;
  1009. X
  1010. X    case 'V':
  1011. X        two = (struct fig2 *) obj[currIndex];
  1012. X        x = two->x;
  1013. X        y = two->y;
  1014. X        h = two->h;
  1015. X        v = two->v;
  1016. X        if (zoomed == True)
  1017. X        {
  1018. X            real2zoomed(&x, &y);
  1019. X            real2zoomed(&h, &v);
  1020. X        }
  1021. X        set_dash_mode();
  1022. X        XDrawLine(disp, win, gc, (int) x, (int) y, (int) h, (int) v);
  1023. X        set_normal_mode();
  1024. X        XDrawArc(disp, win, gc, (int) x - points, (int) y - points,
  1025. X             (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1026. X        XDrawArc(disp, win, gc, (int) h - points, (int) v - points,
  1027. X             (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1028. X        break;
  1029. X
  1030. X
  1031. X    case 'N':
  1032. X        three = (struct fig3 *) obj[currIndex];
  1033. X        x = three->x;
  1034. X        y = three->y;
  1035. X        h = three->h;
  1036. X        v = three->v;
  1037. X        if (zoomed == True)
  1038. X        {
  1039. X            real2zoomed(&x, &y);
  1040. X            real2zoomed(&h, &v);
  1041. X        }
  1042. X        set_dash_mode();
  1043. X        XDrawRectangle(disp, win, gc, (int) x, (int) y,
  1044. X                (unsigned int) (h - x), (unsigned int) (v - y));
  1045. X        XDrawLine(disp, win, gc, (int) x, (int) y, (int) h, (int) v);
  1046. X        XDrawLine(disp, win, gc, (int) x, (int) v, (int) h, (int) y);
  1047. X        set_normal_mode();
  1048. X        draw_edit_marker(x, y, h, v);
  1049. X        break;
  1050. X
  1051. X    case 'D':
  1052. X        four = (struct fig4 *) obj[currIndex];
  1053. X        x = four->x;
  1054. X        y = four->y;
  1055. X        h = four->h;
  1056. X        v = four->v;
  1057. X        if (zoomed == True)
  1058. X        {
  1059. X            real2zoomed(&x, &y);
  1060. X            real2zoomed(&h, &v);
  1061. X        }
  1062. X        x -= 1;
  1063. X        y -= 1;
  1064. X        h += 1;
  1065. X        v += 1;
  1066. X        set_dash_mode();
  1067. X        XDrawRectangle(disp, win, gc, (int) x, (int) y,
  1068. X                (unsigned int) (h - x), (unsigned int) (v - y));
  1069. X        XDrawLine(disp, win, gc, (int) x, (int) y, (int) h, (int) v);
  1070. X        XDrawLine(disp, win, gc, (int) x, (int) v, (int) h, (int) y);
  1071. X        set_normal_mode();
  1072. X        draw_edit_marker(x, y, h, v);
  1073. X        break;
  1074. X
  1075. X    case 'F':
  1076. X        two = (struct fig2 *) obj[currIndex];
  1077. X        x = two->x;
  1078. X        y = two->y;
  1079. X        h = two->h;
  1080. X        v = two->v;
  1081. X        if (zoomed == True)
  1082. X        {
  1083. X            real2zoomed(&x, &y);
  1084. X            real2zoomed(&h, &v);
  1085. X        }
  1086. X        set_dash_mode();
  1087. X        XDrawRectangle(disp, win, gc, (int) x, (int) y,
  1088. X                (unsigned int) (h - x), (unsigned int) (v - y));
  1089. X        XDrawLine(disp, win, gc, (int) x, (int) y, (int) h, (int) v);
  1090. X        XDrawLine(disp, win, gc, (int) x, (int) v, (int) h, (int) y);
  1091. X        set_normal_mode();
  1092. X        draw_edit_marker(x, y, h, v);
  1093. X        break;
  1094. X
  1095. X    case 'C':
  1096. X        two = (struct fig2 *) obj[currIndex];
  1097. X        x = two->x;
  1098. X        y = two->y;
  1099. X        rad = two->radius;
  1100. X        if (zoomed == True)
  1101. X        {
  1102. X            real2zoomed(&x, &y);
  1103. X            rad *= 10;
  1104. X        }
  1105. X        set_dash_mode();
  1106. X        XDrawArc(disp, win, gc, (int) x - rad, (int) y - rad,
  1107. X             (unsigned int) (2 * rad), (unsigned int) (2 * rad), 0, 360 * 64);
  1108. X        set_normal_mode();
  1109. X
  1110. X        break;
  1111. X
  1112. X    case 'B':
  1113. X        two = (struct fig2 *) obj[currIndex];
  1114. X        x = two->x;
  1115. X        y = two->y;
  1116. X        rad = two->radius;
  1117. X        if (zoomed == True)
  1118. X        {
  1119. X            real2zoomed(&x, &y);
  1120. X            rad *= 10;
  1121. X        }
  1122. X        rad += 5;
  1123. X        set_dash_mode();
  1124. X        XDrawArc(disp, win, gc, (int) x - rad, (int) y - rad,
  1125. X             (unsigned int) (2 * rad), (unsigned int) (2 * rad), 0, 360 * 64);
  1126. X        set_normal_mode();
  1127. X        break;
  1128. X
  1129. X    case 'O':
  1130. X        one = (struct fig1 *) obj[currIndex];
  1131. X        x = one->x;
  1132. X        y = one->y;
  1133. X        h = one->h;
  1134. X        v = one->v;
  1135. X        if (zoomed == True)
  1136. X        {
  1137. X            real2zoomed(&x, &y);
  1138. X            real2zoomed(&h, &v);
  1139. X        }
  1140. X        set_dash_mode();
  1141. X        DrawOval(x, y, h, v);
  1142. X        set_normal_mode();
  1143. X        draw_edit_marker(x, y, h, v);
  1144. X        break;
  1145. X
  1146. X    default:
  1147. X        break;
  1148. X    }    /* switch */
  1149. X
  1150. X
  1151. X    set_normal_mode();
  1152. X
  1153. }
  1154. X
  1155. X
  1156. X
  1157. void
  1158. draw_edit_marker(float x, float y, float h, float v)
  1159. {
  1160. X    Display        *disp = XtDisplay(pboard);
  1161. X    Window          win = XtWindow(pboard);
  1162. X    XDrawArc(disp, win, gc, (int) x - points, (int) y - points,
  1163. X         (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1164. X    XDrawArc(disp, win, gc, (int) h - points, (int) v - points,
  1165. X         (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1166. X    XDrawArc(disp, win, gc, (int) x - points, (int) v - points,
  1167. X         (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1168. X    XDrawArc(disp, win, gc, (int) h - points, (int) y - points,
  1169. X         (unsigned int) (2 * points), (unsigned int) (2 * points), 0, 360 * 64);
  1170. }
  1171. X
  1172. X
  1173. X
  1174. void
  1175. erase_current_object()
  1176. {
  1177. X    Display        *disp = XtDisplay(pboard);
  1178. X    Window          win = XtWindow(pboard);
  1179. X    struct fig1    *one;
  1180. X    struct fig2    *two;
  1181. X    struct fig3    *three;
  1182. X    struct fig4    *four;
  1183. X    struct fig6    *six;
  1184. X    float           x, y, h, v;
  1185. X    int             rad;
  1186. X
  1187. X
  1188. X    /* the object with index currIndex is to be erased */
  1189. X
  1190. X    switch (kind[currIndex])
  1191. X    {
  1192. X    case 'I':
  1193. X        bezier_marker = (struct fig6 *) obj[currIndex];
  1194. X        /* redraw object */
  1195. X        if (zoomed == True) real2zoomed(&bezier_marker->sx, &bezier_marker->sy);
  1196. X        
  1197. X        DrawBezier(bezier_marker->ax, bezier_marker->ay,
  1198. X               bezier_marker->ex, bezier_marker->ey,
  1199. X               bezier_marker->sx, bezier_marker->sy);
  1200. X
  1201. X        if (bezier_start == obj[currIndex])
  1202. X        {    /* first entry */
  1203. X            bezier_marker = (struct fig6 *) obj[currIndex];
  1204. X
  1205. X            if (bezier_curr == bezier_start)
  1206. X            {    /* exactly 1 entry */
  1207. X
  1208. X                bezier_start = NULL;
  1209. X                bezier_curr = NULL;
  1210. X
  1211. X            } else
  1212. X                bezier_start = bezier_start->next;
  1213. X
  1214. X            free(bezier_marker);
  1215. X        } else
  1216. X        {
  1217. X            bezier_marker = bezier_start;
  1218. X            do
  1219. X            {
  1220. X                six = (struct fig6 *) bezier_marker;
  1221. X                /* remember the last object */
  1222. X                bezier_marker = bezier_marker->next;
  1223. X
  1224. X            } while (bezier_marker != obj[currIndex]);
  1225. X            /* <bezier_marker> points to the desired object and */
  1226. X            /* <six> to the object before */
  1227. X
  1228. X            /* last entry ? */
  1229. X            if (bezier_marker == bezier_curr)
  1230. X            {
  1231. X                bezier_marker = NULL;
  1232. X                free(bezier_curr);
  1233. X                bezier_curr = six;
  1234. X            } else
  1235. X                /* no! the object was somewhere in the middle */
  1236. X            {
  1237. X                six->next = bezier_marker->next;
  1238. X                free(bezier_marker);
  1239. X            }
  1240. X        }    /* else & line */
  1241. X        break;
  1242. X
  1243. X    case 'L':
  1244. X        strich_marker = (struct fig2 *) obj[currIndex];
  1245. X        /* redraw object */
  1246. X        x = strich_marker->x;
  1247. X        y = strich_marker->y;
  1248. X        h = strich_marker->h;
  1249. X        v = strich_marker->v;
  1250. X        if (zoomed == True)
  1251. X        {
  1252. X            real2zoomed(&x, &y);
  1253. X            real2zoomed(&h, &v);
  1254. X        }
  1255. X        XDrawLine(disp, win, gc, (int) x, (int) y, (int) h, (int) v);
  1256. X
  1257. X        if (strich_start == obj[currIndex])
  1258. X        {    /* first entry */
  1259. X            strich_marker = (struct fig2 *) obj[currIndex];
  1260. X
  1261. X            if (strich_curr == strich_start)
  1262. X            {    /* exactly 1 entry */
  1263. X
  1264. X                strich_start = NULL;
  1265. X                strich_curr = NULL;
  1266. X
  1267. X            } else
  1268. X                strich_start = strich_start->next;
  1269. X
  1270. X            free(strich_marker);
  1271. X        } else
  1272. X        {
  1273. X            strich_marker = strich_start;
  1274. X            do
  1275. X            {
  1276. X                two = (struct fig2 *) strich_marker;
  1277. X                /* remember the last object */
  1278. X                strich_marker = strich_marker->next;
  1279. X
  1280. X            } while (strich_marker != obj[currIndex]);
  1281. X            /* <strich_marker> points to the desired objects and */
  1282. X            /* <two> to the object before */
  1283. X
  1284. X            /* last entry ? */
  1285. X            if (strich_marker == strich_curr)
  1286. X            {
  1287. X                strich_marker = NULL;
  1288. X                free(strich_curr);
  1289. X                strich_curr = two;
  1290. X            } else
  1291. X                /* no! the object was somewhere in the middle */
  1292. X            {
  1293. X                two->next = strich_marker->next;
  1294. X                free(strich_marker);
  1295. X            }
  1296. X        }    /* else & line */
  1297. X        break;
  1298. X
  1299. X    case 'V':
  1300. X        pfeil_marker = (struct fig2 *) obj[currIndex];
  1301. X        /* redraw object */
  1302. X        x = pfeil_marker->x;
  1303. X        y = pfeil_marker->y;
  1304. X        h = pfeil_marker->h;
  1305. X        v = pfeil_marker->v;
  1306. X        if (zoomed == True)
  1307. X        {
  1308. X            real2zoomed(&x, &y);
  1309. X            real2zoomed(&h, &v);
  1310. X        }
  1311. X        XDrawLine(disp, win, gc, (int) x, (int) y, (int) h, (int) v);
  1312. X        draw_vector_marker(x, y, h, v);
  1313. X
  1314. X        if (pfeil_start == obj[currIndex])
  1315. X        {    /* first entry */
  1316. X            pfeil_marker = (struct fig2 *) obj[currIndex];
  1317. X
  1318. X            if (pfeil_curr == pfeil_start)
  1319. X            {    /* exactly 1 entry */
  1320. X
  1321. X                pfeil_start = NULL;
  1322. X                pfeil_curr = NULL;
  1323. X
  1324. X            } else
  1325. X                pfeil_start = pfeil_start->next;
  1326. X
  1327. X            free(pfeil_marker);
  1328. X        } else
  1329. X        {
  1330. X            pfeil_marker = pfeil_start;
  1331. X            do
  1332. X            {
  1333. X                two = (struct fig2 *) pfeil_marker;
  1334. X                /* remember the last object */
  1335. X                pfeil_marker = pfeil_marker->next;
  1336. X
  1337. X            } while (pfeil_marker != obj[currIndex]);
  1338. X            /* <pfeil_marker> points to the desired objects and */
  1339. X            /* <two> to the object before */
  1340. X
  1341. X            /* last entry ? */
  1342. X            if (pfeil_marker == pfeil_curr)
  1343. X            {
  1344. X                pfeil_marker = NULL;
  1345. X                free(pfeil_curr);
  1346. X                pfeil_curr = two;
  1347. X            } else
  1348. X                /* no! the object was somewhere in the middle */
  1349. X            {
  1350. X                two->next = pfeil_marker->next;
  1351. X                free(pfeil_marker);
  1352. X            }
  1353. X        }    /* else & pfeil */
  1354. X        break;
  1355. X
  1356. X    case 'N':
  1357. X        framedBox_marker = (struct fig3 *) obj[currIndex];
  1358. X        /* redraw object */
  1359. X        x = framedBox_marker->x;
  1360. X        y = framedBox_marker->y;
  1361. X        h = framedBox_marker->h;
  1362. X        v = framedBox_marker->v;
  1363. X        if (zoomed == True)
  1364. X        {
  1365. X            real2zoomed(&x, &y);
  1366. X            real2zoomed(&h, &v);
  1367. X        }
  1368. X        XDrawRectangle(disp, win, gc, (int) x, (int) y,
  1369. X                (unsigned int) (h - x), (unsigned int) (v - y));
  1370. X
  1371. X        if (framedBox_start == obj[currIndex])
  1372. X        {    /* first entry */
  1373. X            framedBox_marker = (struct fig3 *) obj[currIndex];
  1374. X
  1375. X            if (framedBox_curr == framedBox_start)
  1376. X            {    /* exactly 1 entry */
  1377. X
  1378. X                framedBox_start = NULL;
  1379. X                framedBox_curr = NULL;
  1380. X
  1381. X            } else
  1382. X                framedBox_start = framedBox_start->next;
  1383. X
  1384. X            free(framedBox_marker);
  1385. X        } else
  1386. X        {
  1387. X            framedBox_marker = framedBox_start;
  1388. X            do
  1389. X            {
  1390. X                three = (struct fig3 *) framedBox_marker;
  1391. X                /* remember the last object */
  1392. X                framedBox_marker = framedBox_marker->next;
  1393. X
  1394. X            } while (framedBox_marker != obj[currIndex]);
  1395. X            /*
  1396. X             * <framedBox_marker> points to the desired objects
  1397. X             * and
  1398. X             */
  1399. X            /* <three> to the object before */
  1400. X
  1401. X            /* last entry ? */
  1402. X            if (framedBox_marker == framedBox_curr)
  1403. X            {
  1404. X                framedBox_marker = NULL;
  1405. X                free(framedBox_curr);
  1406. X                framedBox_curr = three;
  1407. X            } else
  1408. X                /* no! the object was somewhere in the middle */
  1409. X            {
  1410. X                three->next = framedBox_marker->next;
  1411. X                free(framedBox_marker);
  1412. X            }
  1413. X        }    /* else & framedBox */
  1414. X        break;
  1415. X
  1416. X    case 'D':
  1417. X        dashedBox_marker = (struct fig4 *) obj[currIndex];
  1418. X        /* redraw object */
  1419. X        x = dashedBox_marker->x;
  1420. X        y = dashedBox_marker->y;
  1421. X        h = dashedBox_marker->h;
  1422. X        v = dashedBox_marker->v;
  1423. X        if (zoomed == True)
  1424. X        {
  1425. X            real2zoomed(&x, &y);
  1426. X            real2zoomed(&h, &v);
  1427. X        }
  1428. X        XSetLineAttributes(disp, gc, 0, LineOnOffDash, CapButt, JoinMiter);
  1429. X        XDrawRectangle(disp, win, gc, (int) x, (int) y,
  1430. X                (unsigned int) (h - x), (unsigned int) (v - y));
  1431. X        XSetLineAttributes(disp, gc, 0, LineSolid, CapButt, JoinMiter);
  1432. X
  1433. X        if (dashedBox_start == obj[currIndex])
  1434. X        {    /* first entry */
  1435. X            dashedBox_marker = (struct fig4 *) obj[currIndex];
  1436. X
  1437. X            if (dashedBox_curr == dashedBox_start)
  1438. X            {    /* exactly 1 entry */
  1439. X
  1440. X                dashedBox_start = NULL;
  1441. X                dashedBox_curr = NULL;
  1442. X
  1443. X            } else
  1444. X                dashedBox_start = dashedBox_start->next;
  1445. X
  1446. X            free(dashedBox_marker);
  1447. X        } else
  1448. X        {
  1449. X            dashedBox_marker = dashedBox_start;
  1450. X            do
  1451. X            {
  1452. X                four = (struct fig4 *) dashedBox_marker;
  1453. X                /* remember the last object */
  1454. X                dashedBox_marker = dashedBox_marker->next;
  1455. X
  1456. X            } while (dashedBox_marker != obj[currIndex]);
  1457. X            /*
  1458. X             * <dashedBox_marker> points to the desired objects
  1459. X             * and
  1460. X             */
  1461. X            /* <four> to the object before */
  1462. X
  1463. X            /* last entry ? */
  1464. X            if (dashedBox_marker == dashedBox_curr)
  1465. X            {
  1466. X                dashedBox_marker = NULL;
  1467. X                free(dashedBox_curr);
  1468. X                dashedBox_curr = four;
  1469. X            } else
  1470. X                /* no! the object was somewhere in the middle */
  1471. X            {
  1472. X                four->next = dashedBox_marker->next;
  1473. X                free(dashedBox_marker);
  1474. X            }
  1475. X        }    /* else & dashedBox */
  1476. X        break;
  1477. X
  1478. X    case 'F':
  1479. X        filledBox_marker = (struct fig2 *) obj[currIndex];
  1480. X        /* redraw object */
  1481. X        x = filledBox_marker->x;
  1482. X        y = filledBox_marker->y;
  1483. X        h = filledBox_marker->h;
  1484. X        v = filledBox_marker->v;
  1485. X        if (zoomed == True)
  1486. X        {
  1487. X            real2zoomed(&x, &y);
  1488. X            real2zoomed(&h, &v);
  1489. X        }
  1490. X        XFillRectangle(disp, win, gc, (int) x, (int) y,
  1491. X                (unsigned int) (h - x), (unsigned int) (v - y));
  1492. X
  1493. X        if (filledBox_start == obj[currIndex])
  1494. X        {    /* first entry */
  1495. X            filledBox_marker = (struct fig2 *) obj[currIndex];
  1496. X
  1497. X            if (filledBox_curr == filledBox_start)
  1498. X            {    /* exactly 1 entry */
  1499. X
  1500. X                filledBox_start = NULL;
  1501. X                filledBox_curr = NULL;
  1502. X
  1503. X            } else
  1504. X                filledBox_start = filledBox_start->next;
  1505. X
  1506. X            free(filledBox_marker);
  1507. X        } else
  1508. X        {
  1509. X            filledBox_marker = filledBox_start;
  1510. X            do
  1511. X            {
  1512. X                two = (struct fig2 *) filledBox_marker;
  1513. X                /* remember the last object */
  1514. X                filledBox_marker = filledBox_marker->next;
  1515. X
  1516. X            } while (filledBox_marker != obj[currIndex]);
  1517. X            /*
  1518. X             * <filledBox_marker> points to the desired object
  1519. X             * and
  1520. X             */
  1521. X            /* <two> to the object before */
  1522. X
  1523. X            /* last entry ? */
  1524. X            if (filledBox_marker == filledBox_curr)
  1525. X            {
  1526. X                filledBox_marker = NULL;
  1527. X                free(filledBox_curr);
  1528. X                filledBox_curr = two;
  1529. X            } else
  1530. X                /* no! the object was somewhere in the middle */
  1531. X            {
  1532. X                two->next = filledBox_marker->next;
  1533. X                free(filledBox_marker);
  1534. X            }
  1535. X        }    /* else & filledBox */
  1536. X        break;
  1537. X
  1538. X    case 'C':
  1539. X        kreis_marker = (struct fig2 *) obj[currIndex];
  1540. X        /* redraw object */
  1541. X        x = kreis_marker->x;
  1542. X        y = kreis_marker->y;
  1543. X        rad = kreis_marker->radius;
  1544. X
  1545. X        if (zoomed == True)
  1546. X        {
  1547. X            real2zoomed(&x, &y);
  1548. X            rad *= 10;
  1549. X        }
  1550. X        XDrawArc(disp, win, gc, (int) (x - rad), (int) (y - rad),
  1551. X             (unsigned int) (rad + rad),
  1552. X             (unsigned int) (rad + rad), 0, 360 * 64);
  1553. X
  1554. X        if (kreis_start == obj[currIndex])
  1555. X        {    /* first entry */
  1556. X            kreis_marker = (struct fig2 *) obj[currIndex];
  1557. X
  1558. X            if (kreis_curr == kreis_start)
  1559. X            {    /* exactly 1 entry */
  1560. X
  1561. X                kreis_start = NULL;
  1562. X                kreis_curr = NULL;
  1563. X
  1564. X            } else
  1565. X                kreis_start = kreis_start->next;
  1566. X
  1567. X            free(kreis_marker);
  1568. X        } else
  1569. X        {
  1570. X            kreis_marker = kreis_start;
  1571. X            do
  1572. X            {
  1573. X                two = (struct fig2 *) kreis_marker;
  1574. X                /* remember the last object */
  1575. X                kreis_marker = kreis_marker->next;
  1576. X
  1577. X            } while (kreis_marker != obj[currIndex]);
  1578. X            /* <kreis_marker> points to the desired object and */
  1579. X            /* <two> to the object before */
  1580. X
  1581. X            /* last entry ? */
  1582. X            if (kreis_marker == kreis_curr)
  1583. X            {
  1584. X                kreis_marker = NULL;
  1585. X                free(kreis_curr);
  1586. X                kreis_curr = two;
  1587. X            } else
  1588. X                /* no! the object was somewhere in the middle */
  1589. X            {
  1590. X                two->next = kreis_marker->next;
  1591. X                free(kreis_marker);
  1592. X            }
  1593. X        }    /* else & kreis */
  1594. X        break;
  1595. X
  1596. X    case 'B':
  1597. X        disc_marker = (struct fig2 *) obj[currIndex];
  1598. X        /* redraw object */
  1599. X        x = disc_marker->x;
  1600. X        y = disc_marker->y;
  1601. X        rad = disc_marker->radius;
  1602. X
  1603. X        if (zoomed == True)
  1604. X        {
  1605. X            real2zoomed(&x, &y);
  1606. X            rad *= 10;
  1607. X        }
  1608. X        XFillArc(disp, win, gc, (int) (x - rad), (int) (y - rad),
  1609. X             (unsigned int) (rad + rad),
  1610. X             (unsigned int) (rad + rad), 0, 360 * 64);
  1611. X
  1612. X        if (disc_start == obj[currIndex])
  1613. X        {    /* first entry */
  1614. X            disc_marker = (struct fig2 *) obj[currIndex];
  1615. X
  1616. X            if (disc_curr == disc_start)
  1617. X            {    /* exactly 1 entry */
  1618. X
  1619. X                disc_start = NULL;
  1620. X                disc_curr = NULL;
  1621. X
  1622. X            } else
  1623. X                disc_start = disc_start->next;
  1624. X
  1625. X            free(disc_marker);
  1626. X        } else
  1627. X        {
  1628. X            disc_marker = disc_start;
  1629. X            do
  1630. X            {
  1631. X                two = (struct fig2 *) disc_marker;
  1632. X                /* remember the last object */
  1633. X                disc_marker = disc_marker->next;
  1634. X
  1635. X            } while (disc_marker != obj[currIndex]);
  1636. X            /* <disc_marker> points to the desired object and */
  1637. X            /* <two> to the object before */
  1638. X
  1639. X            /* last entry ? */
  1640. X            if (disc_marker == disc_curr)
  1641. X            {
  1642. X                disc_marker = NULL;
  1643. X                free(disc_curr);
  1644. X                disc_curr = two;
  1645. X            } else
  1646. X                /* no! the object was somewhere in the middle */
  1647. X            {
  1648. X                two->next = disc_marker->next;
  1649. X                free(disc_marker);
  1650. X            }
  1651. X        }    /* else & disc */
  1652. X        break;
  1653. X
  1654. X    case 'O':
  1655. X        oval_marker = (struct fig1 *) obj[currIndex];
  1656. X        /* redraw object */
  1657. X        x = oval_marker->x;
  1658. X        y = oval_marker->y;
  1659. X        h = oval_marker->h;
  1660. X        v = oval_marker->v;
  1661. X        if (zoomed == True)
  1662. X        {
  1663. X            real2zoomed(&x, &y);
  1664. X            real2zoomed(&h, &v);
  1665. X        }
  1666. X        DrawOval((int) x, (int) y, (int) h, (int) v);
  1667. X
  1668. X        if (oval_start == obj[currIndex])
  1669. X        {    /* first entry */
  1670. X            oval_marker = (struct fig1 *) obj[currIndex];
  1671. X
  1672. X            if (oval_curr == oval_start)
  1673. X            {    /* exactly 1 entry */
  1674. X
  1675. X                oval_start = NULL;
  1676. X                oval_curr = NULL;
  1677. X
  1678. X            } else
  1679. X                oval_start = oval_start->next;
  1680. X
  1681. X            free(oval_marker);
  1682. X        } else
  1683. X        {
  1684. X            oval_marker = oval_start;
  1685. X            do
  1686. X            {
  1687. X                one = (struct fig1 *) oval_marker;
  1688. X                /* remember the last object */
  1689. X                oval_marker = oval_marker->next;
  1690. X
  1691. X            } while (oval_marker != obj[currIndex]);
  1692. X            /* <oval_marker> points to the desired object and */
  1693. X            /* <one> to the object before */
  1694. X
  1695. X            /* last entry ? */
  1696. X            if (oval_marker == oval_curr)
  1697. X            {
  1698. X                oval_marker = NULL;
  1699. X                free(oval_curr);
  1700. X                oval_curr = one;
  1701. X            } else
  1702. X                /* no! the object was somewhere in the middle */
  1703. X            {
  1704. X                one->next = oval_marker->next;
  1705. X                free(oval_marker);
  1706. X            }
  1707. X        }    /* else & oval */
  1708. X        break;
  1709. X
  1710. X
  1711. X
  1712. X    }    /* switch */
  1713. X
  1714. }
  1715. X
  1716. X
  1717. void
  1718. init_no_objects_sign()
  1719. {
  1720. X    XtTranslations  trans_table =
  1721. X    XtParseTranslationTable("<LeaveNotify>    :    XtMenuPopdown() \n");
  1722. X    n = 0;
  1723. X    XtSetArg(args[n], XtNheight, (XtArgVal) 250);
  1724. X    n++;
  1725. X    XtSetArg(args[n], XtNwidth, (XtArgVal) 250);
  1726. X    n++;
  1727. X    
  1728. X    sign_up = XtCreatePopupShell("Report", transientShellWidgetClass, pboard, args, n);
  1729. X
  1730. X    n = 0;
  1731. X    XtSetArg(args[n], XtNheight, (XtArgVal) 200);
  1732. X    n++;
  1733. X    XtSetArg(args[n], XtNwidth, (XtArgVal) 200);
  1734. X    n++;
  1735. X    XtSetArg(args[n], XtNborderWidth, (XtArgVal) 5);
  1736. X    n++;
  1737. X    XtSetArg(args[n], XtNjustify, XtJustifyCenter);
  1738. X    n++;
  1739. X    XtSetArg(args[n], XtNlabel, "No valid object found !");
  1740. X    n++;
  1741. X    
  1742. X    sign_msg = XtCreateManagedWidget("dialogue", labelWidgetClass, sign_up, args, n);
  1743. X
  1744. X    XtOverrideTranslations(sign_up, trans_table);
  1745. X
  1746. }
  1747. X
  1748. X
  1749. X
  1750. void
  1751. manage_copy(void)
  1752. {
  1753. X
  1754. X
  1755. X    int             index;
  1756. X    unsigned int    mask;
  1757. X
  1758. X
  1759. X
  1760. X
  1761. X    PointerPosition(&x_pick, &y_pick, &mask);
  1762. X
  1763. X    XtUninstallTranslations(pboard);
  1764. X
  1765. X    set_pick_stack(x_pick, y_pick);    /* pick_stack is filled with matching
  1766. X                     * objects */
  1767. X
  1768. X    index = nextObject();
  1769. X
  1770. X    if (index == -1)
  1771. X    {    /* no objects found */
  1772. X        left();
  1773. X        leave_pick("No valid object found !");
  1774. X        return;
  1775. X    } else
  1776. X        copy_manager();
  1777. }
  1778. X
  1779. X
  1780. X
  1781. void
  1782. copy_manager()
  1783. {
  1784. X    int             btn1 = 256, btn2 = 512, btn3 = 1024;
  1785. X    int             index;
  1786. X    int             x, y, h, v;
  1787. X    unsigned int    mask, mask2;
  1788. X    Display        *disp = XtDisplay(pboard);
  1789. X    Window          win = XtWindow(pboard);
  1790. X    headline(toplevel, "Actions: hold Button 2 to MOVE  -----  press Button 3 for MORE");
  1791. X
  1792. X    while (True)
  1793. X    {
  1794. X
  1795. X        prepare_top_stack_object();
  1796. X
  1797. X        do
  1798. X        {    /* watch for any buttonPress */
  1799. X            PointerPosition(&x, &y, &mask);
  1800. X            if ((x < x_A4_min) || (x > x_A4_max) || (y < y_A4_min) || (y > y_A4_max))
  1801. X            {
  1802. X                left();
  1803. X                prepare_top_stack_object();
  1804. X                return;
  1805. X            }
  1806. X            draw_coords(pboard, (caddr_t) x, (caddr_t) y);
  1807. X
  1808. X
  1809. X        } while ((!(mask & btn3)) && (!(mask & btn2)));
  1810. X
  1811. X
  1812. X        /* wait for btn3 release */
  1813. X        do
  1814. X            PointerPosition(&x, &y, &mask2);
  1815. X        while (mask2 & btn3);
  1816. X
  1817. X
  1818. X
  1819. X        prepare_top_stack_object();    /* redraw */
  1820. X
  1821. X
  1822. X
  1823. X        if (mask & btn2)
  1824. X            copy_it(x, y);
  1825. X        else
  1826. X        {    /* more */
  1827. X            index = nextObject();
  1828. X
  1829. X            if (index == -1)
  1830. X            {    /* no objects found */
  1831. X                left();
  1832. X                leave_pick("No valid object found !");
  1833. X                return;
  1834. X            }
  1835. X        }
  1836. X
  1837. X    }    /* while */
  1838. }
  1839. X
  1840. X
  1841. X
  1842. X
  1843. void
  1844. copy_it(int x, int y)
  1845. {
  1846. X    /* min. 1 object exists ! */
  1847. X    struct fig1    *one, *one_mark;
  1848. X    struct fig2    *two, *two_mark;
  1849. X    struct fig3    *three, *three_mark;
  1850. X    struct fig4    *four, *four_mark;
  1851. X    struct fig6    *six, *six_mark;
  1852. X    Display        *disp = XtDisplay(pboard);
  1853. X    Window          win = XtWindow(pboard);
  1854. X    float           ax, ay, bx, by;
  1855. X    int             res, rad;
  1856. X
  1857. X
  1858. X    switch (kind[currIndex])
  1859. X    {
  1860. X    case 'I':
  1861. X        six = (struct fig6 *) malloc(sizeof(bezier));
  1862. X        /* copy struct */
  1863. X        bezier_marker = (struct fig6 *) obj[currIndex];
  1864. X        six->ax = bezier_marker->ax + 5.0;
  1865. X        six->ay = bezier_marker->ay + 5.0;
  1866. X        six->ex = bezier_marker->ex + 5.0;
  1867. X        six->ey = bezier_marker->ey + 5.0;
  1868. X        six->sx = bezier_marker->sx + 5.0;
  1869. X        six->sy = bezier_marker->sy + 5.0;
  1870. X        six->next = NULL;
  1871. X        bezier_marker = bezier_curr;
  1872. X        bezier_curr->next = six;
  1873. X        obj[currIndex] = six;
  1874. X        bezier_curr = bezier_curr->next;
  1875. X        /* make a copy */
  1876. X        ax = six->sx;
  1877. X        ay = six->sy;
  1878. X        if (zoomed == True) real2zoomed(&ax, &ay);
  1879. X            
  1880. X        DrawBezier(six->ax, six->ay,
  1881. X               six->ex, six->ey,
  1882. X               ax,ay);
  1883. X
  1884. X        six_mark = bezier_marker;
  1885. X        break;
  1886. X
  1887. X    case 'L':
  1888. X        two = (struct fig2 *) malloc(sizeof(strich));
  1889. X        /* copy struct */
  1890. X        strich_marker = (struct fig2 *) obj[currIndex];
  1891. X        two->x = strich_marker->x + 5.0;
  1892. X        two->y = strich_marker->y + 5.0;
  1893. X        two->h = strich_marker->h + 5.0;
  1894. X        two->v = strich_marker->v + 5.0;
  1895. X        two->next = NULL;
  1896. X        strich_marker = strich_curr;
  1897. X        strich_curr->next = two;
  1898. X        obj[currIndex] = two;
  1899. X        strich_curr = strich_curr->next;
  1900. X        /* make a copy */
  1901. X        ax = two->x;
  1902. X        ay = two->y;
  1903. X        bx = two->h;
  1904. X        by = two->v;
  1905. X        if (zoomed == True)
  1906. X        {
  1907. X            real2zoomed(&ax, &ay);
  1908. X            real2zoomed(&bx, &by);
  1909. X        }
  1910. X        XDrawLine(disp, win, gc, (int) ax, (int) ay, (int) bx, (int) by);
  1911. X        two_mark = strich_marker;
  1912. X        break;
  1913. X
  1914. X    case 'V':
  1915. X        two = (struct fig2 *) malloc(sizeof(pfeil));
  1916. X        /* copy struct */
  1917. X        pfeil_marker = (struct fig2 *) obj[currIndex];
  1918. X        two->x = pfeil_marker->x + 5.0;
  1919. X        two->y = pfeil_marker->y + 5.0;
  1920. X        two->h = pfeil_marker->h + 5.0;
  1921. X        two->v = pfeil_marker->v + 5.0;
  1922. X        two->next = NULL;
  1923. X        pfeil_marker = pfeil_curr;
  1924. X        pfeil_curr->next = two;
  1925. X        obj[currIndex] = two;
  1926. X        pfeil_curr = pfeil_curr->next;
  1927. X        /* make a copy */
  1928. X        ax = two->x;
  1929. X        ay = two->y;
  1930. X        bx = two->h;
  1931. X        by = two->v;
  1932. X        if (zoomed == True)
  1933. X        {
  1934. X            real2zoomed(&ax, &ay);
  1935. X            real2zoomed(&bx, &by);
  1936. X        }
  1937. X        XDrawLine(disp, win, gc, (int) ax, (int) ay, (int) bx, (int) by);
  1938. X        draw_vector_marker(ax, ay, bx, by);
  1939. X        two_mark = pfeil_marker;
  1940. X
  1941. X        break;
  1942. X
  1943. X    case 'F':
  1944. X        two = (struct fig2 *) malloc(sizeof(filledBox));
  1945. X        /* copy struct */
  1946. X        filledBox_marker = (struct fig2 *) obj[currIndex];
  1947. X        two->x = filledBox_marker->x + 5.0;
  1948. X        two->y = filledBox_marker->y + 5.0;
  1949. X        two->h = filledBox_marker->h + 5.0;
  1950. X        two->v = filledBox_marker->v + 5.0;
  1951. X        two->next = NULL;
  1952. X        filledBox_marker = filledBox_curr;
  1953. X        filledBox_curr->next = two;
  1954. X        obj[currIndex] = two;
  1955. X        filledBox_curr = filledBox_curr->next;
  1956. X        /* make a copy */
  1957. X        ax = two->x;
  1958. X        ay = two->y;
  1959. X        bx = two->h;
  1960. X        by = two->v;
  1961. X        if (zoomed == True)
  1962. X        {
  1963. X            real2zoomed(&ax, &ay);
  1964. X            real2zoomed(&bx, &by);
  1965. X        }
  1966. X        XFillRectangle(disp, win, gc, (int) ax, (int) ay,
  1967. X            (unsigned int) (bx - ax), (unsigned int) (by - ay));
  1968. X        two_mark = filledBox_marker;
  1969. X        break;
  1970. X
  1971. X    case 'C':
  1972. X        two = (struct fig2 *) malloc(sizeof(kreis));
  1973. X        /* copy struct */
  1974. X        kreis_marker = (struct fig2 *) obj[currIndex];
  1975. X        two->x = kreis_marker->x + 5.0;
  1976. X        two->y = kreis_marker->y + 5.0;
  1977. X        two->radius = kreis_marker->radius;
  1978. X        two->next = NULL;
  1979. X        rad = two->radius;
  1980. X        kreis_marker = kreis_curr;
  1981. X        kreis_curr->next = two;
  1982. X        obj[currIndex] = two;
  1983. X        kreis_curr = kreis_curr->next;
  1984. X        /* make a copy */
  1985. X        ax = two->x;
  1986. X        ay = two->y;
  1987. X        if (zoomed == True)
  1988. X        {
  1989. X            real2zoomed(&ax, &ay);
  1990. X            rad *= 10;
  1991. X        }
  1992. X        XDrawArc(disp, win, gc, (int) (ax - rad), (int) (ay - rad),
  1993. X             (unsigned int) (rad + rad),
  1994. X             (unsigned int) (rad + rad), 0, 360 * 64);
  1995. X        two_mark = kreis_marker;
  1996. X        break;
  1997. X
  1998. X
  1999. X    case 'B':
  2000. X        two = (struct fig2 *) malloc(sizeof(disc));
  2001. X        /* copy struct */
  2002. X        disc_marker = (struct fig2 *) obj[currIndex];
  2003. X        two->x = disc_marker->x + 5.0;
  2004. X        two->y = disc_marker->y + 5.0;
  2005. X        two->radius = disc_marker->radius;
  2006. X        two->next = NULL;
  2007. X        rad = two->radius;
  2008. X        disc_marker = disc_curr;
  2009. X        disc_curr->next = two;
  2010. X        obj[currIndex] = two;
  2011. X        disc_curr = disc_curr->next;
  2012. X        /* make a copy */
  2013. X        ax = two->x;
  2014. X        ay = two->y;
  2015. X        if (zoomed == True)
  2016. X        {
  2017. X            real2zoomed(&ax, &ay);
  2018. X            rad *= 10;
  2019. X        }
  2020. X        XFillArc(disp, win, gc, (int) (ax - rad), (int) (ay - rad),
  2021. X             (unsigned int) (rad + rad),
  2022. X             (unsigned int) (rad + rad), 0, 360 * 64);
  2023. X        two_mark = disc_marker;
  2024. X        break;
  2025. X
  2026. X    case 'N':
  2027. X        three = (struct fig3 *) malloc(sizeof(framedBox));
  2028. X        /* copy struct */
  2029. X        framedBox_marker = (struct fig3 *) obj[currIndex];
  2030. X        three->x = framedBox_marker->x + 5.0;
  2031. X        three->y = framedBox_marker->y + 5.0;
  2032. X        three->h = framedBox_marker->h + 5.0;
  2033. X        three->v = framedBox_marker->v + 5.0;
  2034. X        three->next = NULL;
  2035. X        framedBox_marker = framedBox_curr;
  2036. X        framedBox_curr->next = three;
  2037. X        obj[currIndex] = three;
  2038. X        framedBox_curr = framedBox_curr->next;
  2039. X        /* make a copy */
  2040. X        ax = three->x;
  2041. X        ay = three->y;
  2042. X        bx = three->h;
  2043. X        by = three->v;
  2044. X        three->text = (char *) malloc(strlen(framedBox_marker->text) + 1);
  2045. X        strcpy(three->text, framedBox_marker->text);
  2046. X        strcpy(three->textpos, framedBox_marker->textpos);
  2047. X        if (zoomed == True)
  2048. X        {
  2049. X            real2zoomed(&ax, &ay);
  2050. X            real2zoomed(&bx, &by);
  2051. X        }
  2052. X        XDrawRectangle(disp, win, gc, (int) ax, (int) ay,
  2053. X            (unsigned int) (bx - ax), (unsigned int) (by - ay));
  2054. X        print_box_text(three->textpos, ax, ay, bx, by, three->text);
  2055. X        three_mark = framedBox_marker;
  2056. X        break;
  2057. X
  2058. X    case 'D':
  2059. X        four = (struct fig4 *) malloc(sizeof(dashedBox));
  2060. X        /* copy struct */
  2061. X        dashedBox_marker = (struct fig4 *) obj[currIndex];
  2062. X        four->x = dashedBox_marker->x + 5.0;
  2063. X        four->y = dashedBox_marker->y + 5.0;
  2064. X        four->h = dashedBox_marker->h + 5.0;
  2065. X        four->v = dashedBox_marker->v + 5.0;
  2066. X        four->next = NULL;
  2067. X        dashedBox_marker = dashedBox_curr;
  2068. X        dashedBox_curr->next = four;
  2069. X        obj[currIndex] = four;
  2070. X        dashedBox_curr = dashedBox_curr->next;
  2071. X        /* make a copy */
  2072. X        ax = four->x;
  2073. X        ay = four->y;
  2074. X        bx = four->h;
  2075. X        by = four->v;
  2076. X        four->text = (char *) malloc(strlen(dashedBox_marker->text) + 1);
  2077. X        strcpy(four->text, dashedBox_marker->text);
  2078. X        strcpy(four->textpos, dashedBox_marker->textpos);
  2079. X        if (zoomed == True)
  2080. X        {
  2081. X            real2zoomed(&ax, &ay);
  2082. X            real2zoomed(&bx, &by);
  2083. X        }
  2084. X        XSetLineAttributes(disp, gc, 0, LineOnOffDash, CapButt, JoinMiter);
  2085. X        XDrawRectangle(disp, win, gc, (int) ax, (int) ay,
  2086. X            (unsigned int) (bx - ax), (unsigned int) (by - ay));
  2087. X        XSetLineAttributes(disp, gc, 0, LineSolid, CapButt, JoinMiter);
  2088. X        print_box_text(four->textpos, ax, ay, bx, by, four->text);
  2089. X        four_mark = dashedBox_marker;
  2090. X        break;
  2091. X
  2092. X    case 'O':
  2093. X        one = (struct fig1 *) malloc(sizeof(oval));
  2094. X        /* copy struct */
  2095. X        oval_marker = (struct fig1 *) obj[currIndex];
  2096. X        one->x = oval_marker->x + 5.0;
  2097. X        one->y = oval_marker->y + 5.0;
  2098. X        one->h = oval_marker->h + 5.0;
  2099. X        one->v = oval_marker->v + 5.0;
  2100. X        one->next = NULL;
  2101. X        oval_marker = oval_curr;
  2102. X        oval_curr->next = one;
  2103. X        obj[currIndex] = one;
  2104. X        oval_curr = oval_curr->next;
  2105. X        /* make a copy */
  2106. X        ax = one->x;
  2107. X        ay = one->y;
  2108. X        bx = one->h;
  2109. X        by = one->v;
  2110. X        if (zoomed == True)
  2111. X        {
  2112. X            real2zoomed(&ax, &ay);
  2113. X            real2zoomed(&bx, &by);
  2114. X        }
  2115. X        DrawOval(ax, ay, bx, by);
  2116. X        one_mark = oval_marker;
  2117. X        break;
  2118. X
  2119. X    default:
  2120. X        break;
  2121. X
  2122. X    }    /* switch */
  2123. X
  2124. X
  2125. X
  2126. X    res = pick_move(x, y);
  2127. X
  2128. X
  2129. X
  2130. X
  2131. X    if (res == -1)
  2132. X    {    /* cancel */
  2133. X        switch (kind[currIndex])
  2134. X        {
  2135. X        case 'I':
  2136. X            bezier_curr = six_mark;
  2137. X            bezier_curr->next = NULL;
  2138. X            free(six);
  2139. X            break;
  2140. X
  2141. X        case 'L':
  2142. X            strich_curr = two_mark;
  2143. X            strich_curr->next = NULL;
  2144. X            free(two);
  2145. X            break;
  2146. X
  2147. X        case 'V':
  2148. X            pfeil_curr = two_mark;
  2149. X            pfeil_curr->next = NULL;
  2150. X            free(two);
  2151. X            break;
  2152. X
  2153. X        case 'B':
  2154. X            disc_curr = two_mark;
  2155. X            disc_curr->next = NULL;
  2156. X            free(two);
  2157. X            break;
  2158. X
  2159. X        case 'C':
  2160. X            kreis_curr = two_mark;
  2161. X            kreis_curr->next = NULL;
  2162. X            free(two);
  2163. X            break;
  2164. X
  2165. X        case 'F':
  2166. X            filledBox_curr = two_mark;
  2167. X            filledBox_curr->next = NULL;
  2168. X            free(two);
  2169. X            break;
  2170. X
  2171. X        case 'O':
  2172. X            oval_curr = one_mark;
  2173. X            oval_curr->next = NULL;
  2174. X            free(one);
  2175. X            break;
  2176. X
  2177. X        case 'N':
  2178. X            framedBox_curr = three_mark;
  2179. X            framedBox_curr->next = NULL;
  2180. X            free(three);
  2181. X            break;
  2182. X
  2183. X        case 'D':
  2184. X            dashedBox_curr = four_mark;
  2185. X            dashedBox_curr->next = NULL;
  2186. X            free(four);
  2187. X            break;
  2188. X
  2189. X        default:
  2190. X            break;
  2191. X
  2192. X        }    /* switch */
  2193. X        refresh(pboard, '?', (caddr_t)DUMMY);
  2194. X    }    /* cancel */
  2195. }/* copy_it */
  2196. SHAR_EOF
  2197. echo 'File pickedit.c is complete' &&
  2198. chmod 0644 pickedit.c ||
  2199. echo 'restore of pickedit.c failed'
  2200. Wc_c="`wc -c < 'pickedit.c'`"
  2201. test 85301 -eq "$Wc_c" ||
  2202.     echo 'pickedit.c: original size 85301, current size' "$Wc_c"
  2203. rm -f _shar_wnt_.tmp
  2204. fi
  2205. # ============= pickedit.h ==============
  2206. if test -f 'pickedit.h' -a X"$1" != X"-c"; then
  2207.     echo 'x - skipping pickedit.h (File already exists)'
  2208.     rm -f _shar_wnt_.tmp
  2209. else
  2210. > _shar_wnt_.tmp
  2211. echo 'x - extracting pickedit.h (Text)'
  2212. sed 's/^X//' << 'SHAR_EOF' > 'pickedit.h' &&
  2213. /* xtexcad  V1.2 - graphic editor for LaTeX */
  2214. /* 1991 by K.Zitzmann */
  2215. /* header-file pickedit.h */
  2216. X
  2217. #ifndef PICKEDITH
  2218. #define PICKEDITH
  2219. X
  2220. int analyse_pin(struct fig2 *p, int *d, int xpos, int ypos);
  2221. int analyse_nbox(struct fig3 *p, int *d, int xpos, int ypos);
  2222. int analyse_dbox(struct fig4 *p, int *d, int xpos, int ypos);
  2223. int analyse_fbox(struct fig2 *p, int *d, int xpos, int ypos);
  2224. int analyse_ncircle(struct fig2 *p, int *d, int xpos, int ypos);
  2225. int analyse_ocircle(struct fig1 *p, int *d, int xpos, int ypos);
  2226. int analyse_fcircle(struct fig2 *p, int *d, int xpos, int ypos);
  2227. void init_pick(void);
  2228. void set_pick_stack(int x, int y);
  2229. void insert_object(void *p, int d, char c);
  2230. int nextObject(void);
  2231. void set_pick_object(void);
  2232. void set_copy_object();
  2233. void manage_pick(void);
  2234. int pick_move(int x, int y);
  2235. void pick_edit(void);
  2236. void erase_current_object(void);
  2237. void prepare_top_stack_object(void);
  2238. void set_pick_erase(void);
  2239. void pick_erase(void);
  2240. void init_no_objects_sign(void);
  2241. void pick_manager(void);
  2242. void leave_pick(char *msg);
  2243. void edit_y_line(void);
  2244. void edit_x_line(void);
  2245. void edit_y_vector(void);
  2246. void edit_x_vector(void);
  2247. void set_dash_mode(void);
  2248. void set_normal_mode(void);
  2249. void del_vector_marker(float x, float y, float h, float v);
  2250. int calc_distance(int x, int y, int h, int v);
  2251. void edit_frame(char c);
  2252. void draw_edit_marker(float x, float y, float h, float v);
  2253. void edit_circle(char c);
  2254. int valid_circle_edit(int x, int y);
  2255. void manage_copy(void);
  2256. void copy_manager(void);
  2257. void copy_it(int x, int y);
  2258. void edit_bezier_curveS(void);
  2259. SHAR_EOF
  2260. true || echo 'restore of pickedit.h failed'
  2261. fi
  2262. echo 'End of  part 8'
  2263. echo 'File pickedit.h is continued in part 9'
  2264. echo 9 > _shar_seq_.tmp
  2265. exit 0
  2266. -- 
  2267. --
  2268. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  2269. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  2270. Sunnyvale, California 94086            at&t: 408/522-9236
  2271.