home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume21 / xfig / patch02j < prev    next >
Encoding:
Text File  |  1993-10-21  |  31.6 KB  |  1,062 lines

  1. Newsgroups: comp.sources.x
  2. From: envbvs@epb12.lbl.gov (Brian V. Smith)
  3. Subject: v21i030:  xfig - Draw amd manipulate objects in an X-Window, Patch02j/16
  4. Message-ID: <1993Oct21.185904.7263@sparky.sterling.com>
  5. X-Md4-Signature: cb6b70adb1a5e0ca3d3c1d0dfa5ee284
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Thu, 21 Oct 1993 18:59:04 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: envbvs@epb12.lbl.gov (Brian V. Smith)
  12. Posting-number: Volume 21, Issue 30
  13. Archive-name: xfig/patch02j
  14. Environment: patch, X11, xfig
  15. Patch-To: xfig: Volume 19, Issue 113-139
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  xfig.02
  22. # Wrapped by chris@sparky on Thu Oct 21 13:40:06 1993
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 10 (of 16)."'
  26. if test -f 'xfig.02' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'xfig.02'\"
  28. else
  29.   echo shar: Extracting \"'xfig.02'\" \(29145 characters\)
  30.   sed "s/^X//" >'xfig.02' <<'END_OF_FILE'
  31. X  static int    base_x, base_y;
  32. X! static PIX_ROT_FONT canvas_zoomed_font;
  33. X  
  34. X  static int    work_psflag, work_font, work_fontsize, work_textjust;
  35. X! static PIX_ROT_FONT work_fontstruct;
  36. X! static float    work_angle;
  37. X  static        finish_n_start();
  38. X  static        init_text_input(), cancel_text_input();
  39. X  static        wrap_up();
  40. X--- 42,54 ----
  41. X  int        leng_prefix, leng_suffix;
  42. X  static int    char_ht;
  43. X  static int    base_x, base_y;
  44. X! static PIX_FONT canvas_zoomed_font;
  45. X  
  46. X+ static int    is_newline;
  47. X  static int    work_psflag, work_font, work_fontsize, work_textjust;
  48. X! static PIX_FONT work_fontstruct;
  49. X! static float    work_angle;        /* in RADIANS */
  50. X! static double    sin_t, cos_t;        /* sin(work_angle) and cos(work_angle) */
  51. X  static        finish_n_start();
  52. X  static        init_text_input(), cancel_text_input();
  53. X  static        wrap_up();
  54. X***************
  55. X*** 71,76 ****
  56. X--- 74,80 ----
  57. X      canvas_rightbut_proc = null_proc;
  58. X      set_mousefun("posn cursor", "", "");
  59. X      set_cursor(pencil_cursor);
  60. X+     is_newline = 0;
  61. X  }
  62. X  
  63. X  static
  64. X***************
  65. X*** 105,123 ****
  66. X  new_text_line()
  67. X  {
  68. X      wrap_up();
  69. X!     if (work_angle < 90.0 - 0.001) {
  70. X!     cur_y += (int) ((float) char_ht * cur_textstep);
  71. X!     cur_x = base_x;
  72. X!     } else if (work_angle < 180.0 - 0.001) {
  73. X!     cur_x += (int) ((float) char_ht * cur_textstep);
  74. X!     cur_y = base_y;
  75. X!     } else if (work_angle < 270.0 - 0.001) {
  76. X!     cur_y -= (int) ((float) char_ht * cur_textstep);
  77. X!     cur_x = base_x;
  78. X!     } else {
  79. X!     cur_x -= (int) ((float) char_ht * cur_textstep);
  80. X!     cur_y = base_y;
  81. X      }
  82. X      init_text_input(cur_x, cur_y);
  83. X  }
  84. X  
  85. X--- 109,122 ----
  86. X  new_text_line()
  87. X  {
  88. X      wrap_up();
  89. X!     if (cur_t) {    /* use current text's position as ref */
  90. X!     cur_x = round(cur_t->base_x + char_ht*cur_textstep*sin_t);
  91. X!     cur_y = round(cur_t->base_y + char_ht*cur_textstep*cos_t);
  92. X!     } else {        /* use position from previous text */
  93. X!     cur_x = round(base_x + char_ht*cur_textstep*sin_t);
  94. X!     cur_y = round(base_y + char_ht*cur_textstep*cos_t);
  95. X      }
  96. X+     is_newline = 1;
  97. X      init_text_input(cur_x, cur_y);
  98. X  }
  99. X  
  100. X***************
  101. X*** 170,177 ****
  102. X  init_text_input(x, y)
  103. X      int            x, y;
  104. X  {
  105. X!     int            length, d;
  106. X      PR_SIZE        tsize;
  107. X  
  108. X      cur_x = x;
  109. X      cur_y = y;
  110. X--- 169,177 ----
  111. X  init_text_input(x, y)
  112. X      int            x, y;
  113. X  {
  114. X!     int            length, posn;
  115. X      PR_SIZE        tsize;
  116. X+     float        lensin, lencos;
  117. X  
  118. X      cur_x = x;
  119. X      cur_y = y;
  120. X***************
  121. X*** 191,198 ****
  122. X       * through
  123. X       */
  124. X  
  125. X!     put_msg("Ready for text input (from keyboard)");
  126. X!     if ((cur_t = text_search(cur_x, cur_y)) == NULL) {    /* new text input */
  127. X      leng_prefix = leng_suffix = 0;
  128. X      *suffix = 0;
  129. X      prefix[leng_prefix] = '\0';
  130. X--- 191,197 ----
  131. X       * through
  132. X       */
  133. X  
  134. X!     if ((cur_t = text_search(cur_x, cur_y, &posn)) == NULL) {    /* new text input */
  135. X      leng_prefix = leng_suffix = 0;
  136. X      *suffix = 0;
  137. X      prefix[leng_prefix] = '\0';
  138. X***************
  139. X*** 199,221 ****
  140. X      base_x = cur_x;
  141. X      base_y = cur_y;
  142. X  
  143. X!     work_fontsize = cur_fontsize;
  144. X!     work_font     = using_ps ? cur_ps_font : cur_latex_font;
  145. X!     work_psflag   = using_ps;
  146. X!     work_textjust = cur_textjust;
  147. X!     work_angle    = cur_elltextangle;
  148. X!     if (work_angle < 0.0)
  149. X!         work_angle += 360.0;
  150. X  
  151. X!     /* load the X font and get its id for this font, size and angle UNZOOMED */
  152. X!     /* this is to get widths etc for the unzoomed chars */
  153. X!     canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  154. X!                work_fontsize, work_angle*M_PI/180.0);
  155. X!     /* get the ZOOMED font for actually drawing on the canvas */
  156. X!     canvas_zoomed_font = lookfont(x_fontnum(work_psflag, work_font), 
  157. X!                round(work_fontsize*zoomscale), work_angle*M_PI/180.0);
  158. X!     /* save the working font structure */
  159. X!     work_fontstruct = canvas_zoomed_font;
  160. X      } else {            /* clicked on existing text */
  161. X      if (hidden_text(cur_t)) {
  162. X          put_msg("Can't edit hidden text");
  163. X--- 198,226 ----
  164. X      base_x = cur_x;
  165. X      base_y = cur_y;
  166. X  
  167. X!     if (is_newline) {    /* working settings already set */
  168. X!         is_newline = 0;
  169. X!     } else {        /* set working settings from ind panel */
  170. X!         work_fontsize = cur_fontsize;
  171. X!         work_font     = using_ps ? cur_ps_font : cur_latex_font;
  172. X!         work_psflag   = using_ps;
  173. X!         work_textjust = cur_textjust;
  174. X!         work_angle    = cur_elltextangle*M_PI/180.0;
  175. X!         while (work_angle < 0.0)
  176. X!         work_angle += M_2PI;
  177. X!         sin_t = sin((double)work_angle);
  178. X!         cos_t = cos((double)work_angle);
  179. X  
  180. X!         /* load the X font and get its id for this font and size UNZOOMED */
  181. X!         /* this is to get widths etc for the unzoomed chars */
  182. X!         canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  183. X!                work_fontsize);
  184. X!         /* get the ZOOMED font for actually drawing on the canvas */
  185. X!         canvas_zoomed_font = lookfont(x_fontnum(work_psflag, work_font), 
  186. X!                round(work_fontsize*zoomscale));
  187. X!         /* save the working font structure */
  188. X!         work_fontstruct = canvas_zoomed_font;
  189. X!     }
  190. X      } else {            /* clicked on existing text */
  191. X      if (hidden_text(cur_t)) {
  192. X          put_msg("Can't edit hidden text");
  193. X***************
  194. X*** 229,241 ****
  195. X      work_fontsize = cur_t->size;
  196. X      work_psflag   = cur_t->flags;
  197. X      work_textjust = cur_t->type;
  198. X!     work_angle    = cur_t->angle*180.0/M_PI;
  199. X!     if (work_angle < 0.0)
  200. X!         work_angle += 360.0;
  201. X      /* load the X font and get its id for this font, size and angle UNZOOMED */
  202. X      /* this is to get widths etc for the unzoomed chars */
  203. X      canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  204. X!                work_fontsize, work_angle*M_PI/180.0);
  205. X  
  206. X      toggle_textmarker(cur_t);
  207. X      draw_text(cur_t, ERASE);
  208. X--- 234,249 ----
  209. X      work_fontsize = cur_t->size;
  210. X      work_psflag   = cur_t->flags;
  211. X      work_textjust = cur_t->type;
  212. X!     work_angle    = cur_t->angle;
  213. X!     while (work_angle < 0.0)
  214. X!         work_angle += M_2PI;
  215. X!     sin_t = sin((double)work_angle);
  216. X!     cos_t = cos((double)work_angle);
  217. X! 
  218. X      /* load the X font and get its id for this font, size and angle UNZOOMED */
  219. X      /* this is to get widths etc for the unzoomed chars */
  220. X      canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
  221. X!                work_fontsize);
  222. X  
  223. X      toggle_textmarker(cur_t);
  224. X      draw_text(cur_t, ERASE);
  225. X***************
  226. X*** 242,298 ****
  227. X      base_x = cur_t->base_x;
  228. X      base_y = cur_t->base_y;
  229. X      length = cur_t->length;
  230. X      switch (cur_t->type) {
  231. X      case T_CENTER_JUSTIFIED:
  232. X!         if (work_angle < 90.0 - 0.001) 
  233. X!         base_x -= length / 2;
  234. X!         else if (work_angle < 180.0 - 0.001)
  235. X!         base_y += length / 2;
  236. X!         else if (work_angle < 270.0 - 0.001)
  237. X!         base_x += length / 2;
  238. X!         else
  239. X!         base_y -= length / 2;
  240. X          break;
  241. X  
  242. X      case T_RIGHT_JUSTIFIED:
  243. X!         if (work_angle < 90.0 - 0.001) 
  244. X!         base_x -= length;
  245. X!         else if (work_angle < 180.0 - 0.001)
  246. X!         base_y += length;
  247. X!         else if (work_angle < 270.0 - 0.001)
  248. X!         base_x += length;
  249. X!         else
  250. X!         base_y -= length;
  251. X          break;
  252. X      } /* switch */
  253. X!     if (work_angle < 90.0 - 0.001 || (work_angle >= 180.0 - 0.001 
  254. X!         && work_angle < 270.0 - 0.001))
  255. X!         d = abs(cur_x - base_x);
  256. X!     else
  257. X!         d = abs(cur_y - base_y);
  258. X      leng_suffix = strlen(cur_t->cstring);
  259. X      /* leng_prefix is # of char in the text before the cursor */
  260. X!     leng_prefix = prefix_length(cur_t->cstring, d);
  261. X      leng_suffix -= leng_prefix;
  262. X      cpy_n_char(prefix, cur_t->cstring, leng_prefix);
  263. X      strcpy(suffix, &cur_t->cstring[leng_prefix]);
  264. X      tsize = pf_textwidth(canvas_font, leng_prefix, prefix);
  265. X  
  266. X!     if (work_angle < 90.0 - 0.001) {
  267. X!         cur_x = base_x + tsize.x;
  268. X!         cur_y = base_y;
  269. X!     } else if (work_angle < 180.0 - 0.001) {
  270. X!         cur_x = base_x;
  271. X!         cur_y = base_y - tsize.x;
  272. X!     } else if (work_angle < 270.0 - 0.001) {
  273. X!         cur_x = base_x - tsize.x;
  274. X!         cur_y = base_y;
  275. X!     } else {
  276. X!         cur_x = base_x;
  277. X!         cur_y = base_y + tsize.x;
  278. X!     }
  279. X      }
  280. X!     char_ht = rot_char_height(canvas_font);
  281. X      initialize_char_handler(canvas_win, finish_text_input,
  282. X                  base_x, base_y);
  283. X      draw_char_string();
  284. X--- 250,283 ----
  285. X      base_x = cur_t->base_x;
  286. X      base_y = cur_t->base_y;
  287. X      length = cur_t->length;
  288. X+     lencos = length*cos_t;
  289. X+     lensin = length*sin_t;
  290. X+ 
  291. X      switch (cur_t->type) {
  292. X      case T_CENTER_JUSTIFIED:
  293. X!         base_x = round(base_x - lencos/2.0);
  294. X!         base_y = round(base_y + lensin/2.0);
  295. X          break;
  296. X  
  297. X      case T_RIGHT_JUSTIFIED:
  298. X!         base_x = round(base_x - lencos);
  299. X!         base_y = round(base_y + lensin);
  300. X          break;
  301. X      } /* switch */
  302. X! 
  303. X      leng_suffix = strlen(cur_t->cstring);
  304. X      /* leng_prefix is # of char in the text before the cursor */
  305. X!     leng_prefix = prefix_length(cur_t->cstring, posn);
  306. X      leng_suffix -= leng_prefix;
  307. X      cpy_n_char(prefix, cur_t->cstring, leng_prefix);
  308. X      strcpy(suffix, &cur_t->cstring[leng_prefix]);
  309. X      tsize = pf_textwidth(canvas_font, leng_prefix, prefix);
  310. X  
  311. X!     cur_x = round(base_x + tsize.x * cos_t);
  312. X!     cur_y = round(base_y - tsize.x * sin_t);
  313. X      }
  314. X!     put_msg("Ready for text input (from keyboard)");
  315. X!     char_ht = char_height(canvas_font);
  316. X      initialize_char_handler(canvas_win, finish_text_input,
  317. X                  base_x, base_y);
  318. X      draw_char_string();
  319. X***************
  320. X*** 316,322 ****
  321. X      text->font = work_font;    /* put in current font number */
  322. X      text->fontstruct = work_fontstruct;
  323. X      text->size = work_fontsize;
  324. X!     text->angle = work_angle/180.0*M_PI;    /* convert to radians */
  325. X      text->flags = cur_textflags;
  326. X      text->color = cur_color;
  327. X      text->depth = cur_depth;
  328. X--- 301,307 ----
  329. X      text->font = work_font;    /* put in current font number */
  330. X      text->fontstruct = work_fontstruct;
  331. X      text->size = work_fontsize;
  332. X!     text->angle = work_angle;
  333. X      text->flags = cur_textflags;
  334. X      text->color = cur_color;
  335. X      text->depth = cur_depth;
  336. X***************
  337. X*** 359,365 ****
  338. X      if (where_p >= len_p)
  339. X      return (len_c);        /* entire string is the prefix */
  340. X  
  341. X!     char_wid = rot_char_width(canvas_font);
  342. X      where_c = where_p / char_wid;    /* estimated char position */
  343. X      size = pf_textwidth(canvas_font, where_c, string);
  344. X      l = size.x;            /* actual length (pixels) of string of
  345. X--- 344,350 ----
  346. X      if (where_p >= len_p)
  347. X      return (len_c);        /* entire string is the prefix */
  348. X  
  349. X!     char_wid = char_width(canvas_font);
  350. X      where_c = where_p / char_wid;    /* estimated char position */
  351. X      size = pf_textwidth(canvas_font, where_c, string);
  352. X      l = size.x;            /* actual length (pixels) of string of
  353. X***************
  354. X*** 366,372 ****
  355. X                   * where_c chars */
  356. X      if (l < where_p) {
  357. X      do {            /* add the width of next char to l */
  358. X!         l += (char_wid = rot_char_advance(canvas_font, 
  359. X                  (unsigned char) string[where_c++]));
  360. X      } while (l < where_p);
  361. X      if (l - (char_wid >> 1) >= where_p)
  362. X--- 351,357 ----
  363. X                   * where_c chars */
  364. X      if (l < where_p) {
  365. X      do {            /* add the width of next char to l */
  366. X!         l += (char_wid = char_advance(canvas_font, 
  367. X                  (unsigned char) string[where_c++]));
  368. X      } while (l < where_p);
  369. X      if (l - (char_wid >> 1) >= where_p)
  370. X***************
  371. X*** 373,382 ****
  372. X          where_c--;
  373. X      } else if (l > where_p) {
  374. X      do {            /* subtract the width of last char from l */
  375. X!         l -= (char_wid = rot_char_advance(canvas_font, 
  376. X                  (unsigned char) string[--where_c]));
  377. X      } while (l > where_p);
  378. X!     if (l + (char_wid >> 1) >= where_p)
  379. X          where_c++;
  380. X      }
  381. X      if (where_c < 0) {
  382. X--- 358,367 ----
  383. X          where_c--;
  384. X      } else if (l > where_p) {
  385. X      do {            /* subtract the width of last char from l */
  386. X!         l -= (char_wid = char_advance(canvas_font, 
  387. X                  (unsigned char) string[--where_c]));
  388. X      } while (l > where_p);
  389. X!     if (l + (char_wid >> 1) <= where_p)
  390. X          where_c++;
  391. X      }
  392. X      if (where_c < 0) {
  393. X***************
  394. X*** 383,388 ****
  395. X--- 368,375 ----
  396. X      fprintf(stderr, "xfig file %s line %d: Error in prefix_length - adjusted\n", __FILE__, __LINE__);
  397. X      where_c = 0;
  398. X      }
  399. X+     if ( where_c > len_c ) 
  400. X+     return (len_c);
  401. X      return (where_c);
  402. X  }
  403. X  
  404. X***************
  405. X*** 405,422 ****
  406. X  draw_cursor(x, y)
  407. X      int            x, y;
  408. X  {
  409. X!     if (work_angle < 90.0 - 0.001)        /* 0-89 degrees */
  410. X!         pw_vector(pw, x, y, x, y-ch_height, INV_PAINT, 1, RUBBER_LINE, 0.0,
  411. X!         DEFAULT_COLOR);
  412. X!     else if (work_angle < 180.0 - 0.001)    /* 90-179 degrees */
  413. X!         pw_vector(pw, x-ch_height, y, x, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
  414. X!         DEFAULT_COLOR);
  415. X!     else if (work_angle < 270.0 - 0.001)    /* 180-269 degrees */
  416. X!         pw_vector(pw, x, y+ch_height, x, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
  417. X!         DEFAULT_COLOR);
  418. X!     else                /* 270-359 degrees */
  419. X!         pw_vector(pw, x, y, x+ch_height, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
  420. X!         DEFAULT_COLOR);
  421. X  }
  422. X  
  423. X  static int
  424. X--- 392,401 ----
  425. X  draw_cursor(x, y)
  426. X      int            x, y;
  427. X  {
  428. X!     pw_vector(pw, x, y, 
  429. X!         round(x-ch_height*sin_t),
  430. X!         round(y-ch_height*cos_t),
  431. X!         INV_PAINT, 1, RUBBER_LINE, 0.0, DEFAULT_COLOR);
  432. X  }
  433. X  
  434. X  static int
  435. X***************
  436. X*** 432,438 ****
  437. X      rcur_x = cur_x;
  438. X      rcur_y = cur_y;
  439. X  
  440. X!     ch_height = rot_char_height(canvas_font);
  441. X      turn_on_blinking_cursor(draw_cursor, draw_cursor,
  442. X                  cur_x, cur_y, (long) BLINK_INTERVAL);
  443. X  }
  444. X--- 411,417 ----
  445. X      rcur_x = cur_x;
  446. X      rcur_y = cur_y;
  447. X  
  448. X!     ch_height = canvas_font->max_bounds.ascent;
  449. X      turn_on_blinking_cursor(draw_cursor, draw_cursor,
  450. X                  cur_x, cur_y, (long) BLINK_INTERVAL);
  451. X  }
  452. X***************
  453. X*** 454,463 ****
  454. X  erase_char_string()
  455. X  {
  456. X      pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  457. X!         prefix, DEFAULT_COLOR);
  458. X      if (leng_suffix)
  459. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  460. X!         suffix, DEFAULT_COLOR);
  461. X  }
  462. X  
  463. X  static int
  464. X--- 433,442 ----
  465. X  erase_char_string()
  466. X  {
  467. X      pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  468. X!         work_angle, prefix, DEFAULT_COLOR);
  469. X      if (leng_suffix)
  470. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  471. X!         work_angle, suffix, DEFAULT_COLOR);
  472. X  }
  473. X  
  474. X  static int
  475. X***************
  476. X*** 464,473 ****
  477. X  draw_char_string()
  478. X  {
  479. X      pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  480. X!         prefix, DEFAULT_COLOR);
  481. X      if (leng_suffix)
  482. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  483. X!         suffix, DEFAULT_COLOR);
  484. X      move_blinking_cursor(cur_x, cur_y);
  485. X  }
  486. X  
  487. X--- 443,452 ----
  488. X  draw_char_string()
  489. X  {
  490. X      pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font, 
  491. X!         work_angle, prefix, DEFAULT_COLOR);
  492. X      if (leng_suffix)
  493. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  494. X!         work_angle, suffix, DEFAULT_COLOR);
  495. X      move_blinking_cursor(cur_x, cur_y);
  496. X  }
  497. X  
  498. X***************
  499. X*** 476,482 ****
  500. X  {
  501. X      if (leng_suffix)
  502. X      pw_text(pw, cur_x, cur_y, PAINT, canvas_zoomed_font, 
  503. X!         suffix, DEFAULT_COLOR);
  504. X  }
  505. X  
  506. X  static int
  507. X--- 455,461 ----
  508. X  {
  509. X      if (leng_suffix)
  510. X      pw_text(pw, cur_x, cur_y, PAINT, canvas_zoomed_font, 
  511. X!         work_angle, suffix, DEFAULT_COLOR);
  512. X  }
  513. X  
  514. X  static int
  515. X***************
  516. X*** 484,490 ****
  517. X  {
  518. X      if (leng_suffix)
  519. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  520. X!         suffix, DEFAULT_COLOR);
  521. X  }
  522. X  
  523. X  static int
  524. X--- 463,469 ----
  525. X  {
  526. X      if (leng_suffix)
  527. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  528. X!         work_angle, suffix, DEFAULT_COLOR);
  529. X  }
  530. X  
  531. X  static int
  532. X***************
  533. X*** 495,501 ****
  534. X      s[0]=c;
  535. X      s[1]='\0';
  536. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  537. X!         s, DEFAULT_COLOR);
  538. X  }
  539. X  
  540. X  char_handler(c)
  541. X--- 474,480 ----
  542. X      s[0]=c;
  543. X      s[1]='\0';
  544. X      pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font, 
  545. X!         work_angle, s, DEFAULT_COLOR);
  546. X  }
  547. X  
  548. X  char_handler(c)
  549. X***************
  550. X*** 502,507 ****
  551. X--- 481,488 ----
  552. X      unsigned char   c;
  553. X  {
  554. X      float        cwidth, cw2;
  555. X+     float        cwsin, cwcos;
  556. X+     float        cw2sin, cw2cos;
  557. X  
  558. X      if (cr_proc == NULL)
  559. X      return;
  560. X***************
  561. X*** 511,562 ****
  562. X      } else if (c == DEL || c == CTRL_H) {
  563. X      if (leng_prefix > 0) {
  564. X          erase_char_string();
  565. X!         cwidth = (float) rot_char_advance(canvas_font, 
  566. X              (unsigned char) prefix[leng_prefix - 1]);
  567. X          cw2 = cwidth/2.0;
  568. X          /* correct text/cursor posn for justification and zoom factor */
  569. X          switch (work_textjust) {
  570. X          case T_LEFT_JUSTIFIED:
  571. X!         if (work_angle < 90.0 - 0.001)
  572. X!             rcur_x -= cwidth;           /* 0-89 deg, move the suffix left */
  573. X!         else if (work_angle < 180.0 - 0.001) 
  574. X!             rcur_y += cwidth;           /* 90-179 deg, move suffix down */
  575. X!         else if (work_angle < 270.0 - 0.001) 
  576. X!             rcur_x += cwidth;           /* 180-269 deg, move suffix right */
  577. X!         else 
  578. X!             rcur_y -= cwidth;           /* 270-359 deg, move suffix up */
  579. X          break;
  580. X          case T_CENTER_JUSTIFIED:
  581. X!         if (work_angle < 90.0 - 0.001) { 
  582. X!             rbase_x += cw2;    /* 0-89 deg, move base right cw/2 */
  583. X!             rcur_x -= cw2;    /* move suffix left by cw/2 */
  584. X!         } else if (work_angle < 180.0 - 0.001) { 
  585. X!             rbase_y -= cw2;    /* 90-179 deg, move base up cw/2 */
  586. X!             rcur_y += cw2;    /* move suffix down cw/2 */
  587. X!         } else if (work_angle < 270.0 - 0.001) {
  588. X!             rbase_x -= cw2;    /* 180-269 deg, move base left cw/2 */
  589. X!             rcur_x += cw2;    /* move suffix right cw/2 */
  590. X!         } else {                      
  591. X!             rbase_y += cw2;    /* 270-359 deg, move base down cw/2 */
  592. X!             rcur_y -= cw2;    /* move suffix up cw/2 */
  593. X!         }
  594. X          break;
  595. X          case T_RIGHT_JUSTIFIED:
  596. X!         if (work_angle < 90.0 - 0.001) 
  597. X!             rbase_x += cwidth;           /* 0-89 deg, move the prefix right */
  598. X!         else if (work_angle < 180.0 - 0.001)
  599. X!             rbase_y -= cwidth;           /* 90-179 deg, move prefix up */
  600. X!         else if (work_angle < 270.0 - 0.001)
  601. X!             rbase_x -= cwidth;           /* 180-269 deg, move prefix left */
  602. X!         else
  603. X!             rbase_y += cwidth;           /* 270-359 deg, move prefix down */
  604. X          break;
  605. X          }
  606. X          prefix[--leng_prefix] = '\0';
  607. X!         cbase_x = rbase_x;    /* fix */
  608. X!         cbase_y = rbase_y;
  609. X!         cur_x = rcur_x;
  610. X!         cur_y = rcur_y;
  611. X          draw_char_string();
  612. X      }
  613. X      } else if (c == CTRL_X) {
  614. X--- 492,527 ----
  615. X      } else if (c == DEL || c == CTRL_H) {
  616. X      if (leng_prefix > 0) {
  617. X          erase_char_string();
  618. X!         cwidth = (float) char_advance(canvas_font, 
  619. X              (unsigned char) prefix[leng_prefix - 1]);
  620. X          cw2 = cwidth/2.0;
  621. X+         cwsin = cwidth*sin_t;
  622. X+         cwcos = cwidth*cos_t;
  623. X+         cw2sin = cw2*sin_t;
  624. X+         cw2cos = cw2*cos_t;
  625. X+ 
  626. X          /* correct text/cursor posn for justification and zoom factor */
  627. X          switch (work_textjust) {
  628. X          case T_LEFT_JUSTIFIED:
  629. X!         rcur_x -= cwcos;
  630. X!         rcur_y += cwsin;
  631. X          break;
  632. X          case T_CENTER_JUSTIFIED:
  633. X!         rbase_x += cw2cos;
  634. X!         rbase_y -= cw2sin;
  635. X!         rcur_x -= cw2cos;
  636. X!         rcur_y += cw2sin;
  637. X          break;
  638. X          case T_RIGHT_JUSTIFIED:
  639. X!         rbase_x += cwcos;
  640. X!         rbase_y -= cwsin;
  641. X          break;
  642. X          }
  643. X          prefix[--leng_prefix] = '\0';
  644. X!         cbase_x = round(rbase_x);
  645. X!         cbase_y = round(rbase_y);
  646. X!         cur_x = round(rcur_x);
  647. X!         cur_y = round(rcur_y);
  648. X          draw_char_string();
  649. X      }
  650. X      } else if (c == CTRL_X) {
  651. X***************
  652. X*** 564,592 ****
  653. X          erase_char_string();
  654. X          switch (work_textjust) {
  655. X          case T_CENTER_JUSTIFIED:
  656. X!         while (leng_prefix--)    /* subtract char width/2 per char */
  657. X!             if (work_angle < 90.0 - 0.001)    /* 0-89 degrees */
  658. X!             rcur_x -= rot_char_advance(canvas_font, 
  659. X!                 (unsigned char) prefix[leng_prefix]) / 2.0;
  660. X!         else if (work_angle < 180.0 - 0.001)     /* 90-179 degrees */
  661. X!             rcur_y += rot_char_advance(canvas_font, 
  662. X!                 (unsigned char) prefix[leng_prefix]) / 2.0;
  663. X!         else if (work_angle < 270.0 - 0.001)     /* 180-269 degrees */
  664. X!             rcur_x += rot_char_advance(canvas_font, 
  665. X!                 (unsigned char) prefix[leng_prefix]) / 2.0;
  666. X!         else                     /* 270-359 degrees */
  667. X!             rcur_y -= rot_char_advance(canvas_font, 
  668. X!                 (unsigned char) prefix[leng_prefix]) / 2.0;
  669. X!         cur_x = cbase_x = rbase_x = rcur_x;
  670. X!         cur_y = cbase_y = rbase_y = rcur_y;
  671. X          break;
  672. X          case T_RIGHT_JUSTIFIED:
  673. X!         cbase_x = rbase_x = cur_x = rcur_x;
  674. X!         cbase_y = rbase_y = cur_y = rcur_y;
  675. X          break;
  676. X          case T_LEFT_JUSTIFIED:
  677. X!         cur_x = rcur_x = cbase_x = rbase_x;
  678. X!         cur_y = rcur_y = cbase_y = rbase_y;
  679. X          break;
  680. X          }
  681. X          leng_prefix = 0;
  682. X--- 529,556 ----
  683. X          erase_char_string();
  684. X          switch (work_textjust) {
  685. X          case T_CENTER_JUSTIFIED:
  686. X!         while (leng_prefix--) {    /* subtract char width/2 per char */
  687. X!             rcur_x -= cos_t*char_advance(canvas_font,
  688. X!                     (unsigned char) prefix[leng_prefix]) / 2.0;
  689. X!             rcur_y += sin_t*char_advance(canvas_font,
  690. X!                     (unsigned char) prefix[leng_prefix]) / 2.0;
  691. X!         }
  692. X!         rbase_x = rcur_x;
  693. X!         cur_x = cbase_x = round(rbase_x);
  694. X!         rbase_y = rcur_y;
  695. X!         cur_y = cbase_y = round(rbase_y);
  696. X          break;
  697. X          case T_RIGHT_JUSTIFIED:
  698. X!         rbase_x = rcur_x;
  699. X!         cbase_x = cur_x = round(rbase_x);
  700. X!         rbase_y = rcur_y;
  701. X!         cbase_y = cur_y = round(rbase_y);
  702. X          break;
  703. X          case T_LEFT_JUSTIFIED:
  704. X!         rcur_x = rbase_x;
  705. X!         cur_x = cbase_x = round(rcur_x);
  706. X!         rcur_y = rbase_y;
  707. X!         cur_y = cbase_y = round(rcur_y);
  708. X          break;
  709. X          }
  710. X          leng_prefix = 0;
  711. X***************
  712. X*** 600,653 ****
  713. X  
  714. X      /* normal text character */
  715. X      } else {    
  716. X!     draw_char_string();
  717. X!     cwidth = rot_char_advance(canvas_font, (unsigned char) c);
  718. X      cw2 = cwidth/2.0;
  719. X!     /* correct text/cursor posn for justification and zoom factor */
  720. X      switch (work_textjust) {
  721. X        case T_LEFT_JUSTIFIED:
  722. X!         if (work_angle < 90.0 - 0.001)
  723. X!         rcur_x += cwidth;           /* 0-89 deg, move the suffix right */
  724. X!         else if (work_angle < 180.0 - 0.001) 
  725. X!         rcur_y -= cwidth;           /* 90-179 deg, move suffix up */
  726. X!         else if (work_angle < 270.0 - 0.001) 
  727. X!         rcur_x -= cwidth;           /* 180-269 deg, move suffix left */
  728. X!         else 
  729. X!         rcur_y += cwidth;           /* 270-359 deg, move suffix down */
  730. X          break;
  731. X        case T_CENTER_JUSTIFIED:
  732. X!         if (work_angle < 90.0 - 0.001) { 
  733. X!         rbase_x -= cw2;    /* 0-89 deg, move base left cw/2 */
  734. X!         rcur_x += cw2;    /* move suffix right by cw/2 */
  735. X!         } else if (work_angle < 180.0 - 0.001) { 
  736. X!         rbase_y += cw2;    /* 90-179 deg, move base down cw/2 */
  737. X!         rcur_y -= cw2;    /* move suffix up cw/2 */
  738. X!         } else if (work_angle < 270.0 - 0.001) {
  739. X!         rbase_x += cw2;    /* 180-269 deg, move base right cw/2 */
  740. X!         rcur_x -= cw2;    /* move suffix left cw/2 */
  741. X!         } else {                      
  742. X!         rbase_y -= cw2;    /* 270-359 deg, move base up cw/2 */
  743. X!         rcur_y += cw2;    /* move suffix down cw/2 */
  744. X!         }
  745. X          break;
  746. X        case T_RIGHT_JUSTIFIED:
  747. X!         if (work_angle < 90.0 - 0.001) 
  748. X!         rbase_x -= cwidth;           /* 0-89 deg, move the prefix left */
  749. X!         else if (work_angle < 180.0 - 0.001)
  750. X!         rbase_y += cwidth;           /* 90-179 deg, move prefix down */
  751. X!         else if (work_angle < 270.0 - 0.001)
  752. X!         rbase_x += cwidth;           /* 180-269 deg, move prefix right */
  753. X!         else
  754. X!         rbase_y -= cwidth;           /* 270-359 deg, move prefix up */
  755. X          break;
  756. X      }
  757. X      prefix[leng_prefix++] = c;
  758. X      prefix[leng_prefix] = '\0';
  759. X!     cbase_x = rbase_x;
  760. X!     cbase_y = rbase_y;
  761. X!     cur_x = rcur_x;
  762. X!     cur_y = rcur_y;
  763. X!     draw_char_string();
  764. X      }
  765. X  }
  766. X  
  767. X--- 564,601 ----
  768. X  
  769. X      /* normal text character */
  770. X      } else {    
  771. X!     draw_char_string();    /* erase current string */
  772. X! 
  773. X!     cwidth = char_advance(canvas_font, (unsigned char) c);
  774. X!     cwsin = cwidth*sin_t;
  775. X!     cwcos = cwidth*cos_t;
  776. X      cw2 = cwidth/2.0;
  777. X!     cw2sin = cw2*sin_t;
  778. X!     cw2cos = cw2*cos_t;
  779. X!     /* correct text/cursor posn for justification and rotation */
  780. X      switch (work_textjust) {
  781. X        case T_LEFT_JUSTIFIED:
  782. X!         rcur_x += cwcos;
  783. X!         rcur_y -= cwsin;
  784. X          break;
  785. X        case T_CENTER_JUSTIFIED:
  786. X!         rbase_x -= cw2cos;
  787. X!         rbase_y += cw2sin;
  788. X!         rcur_x += cw2cos;
  789. X!         rcur_y -= cw2sin;
  790. X          break;
  791. X        case T_RIGHT_JUSTIFIED:
  792. X!         rbase_x -= cwcos;
  793. X!         rbase_y += cwsin;
  794. X          break;
  795. X      }
  796. X      prefix[leng_prefix++] = c;
  797. X      prefix[leng_prefix] = '\0';
  798. X!     cbase_x = round(rbase_x);
  799. X!     cbase_y = round(rbase_y);
  800. X!     cur_x = round(rcur_x);
  801. X!     cur_y = round(rcur_y);
  802. X!     draw_char_string();    /* draw new string */
  803. X      }
  804. X  }
  805. X  
  806. X***************
  807. X*** 737,742 ****
  808. X--- 685,695 ----
  809. X      cursor_is_moving = 0;
  810. X  }
  811. X  
  812. X+ /*
  813. X+  * Reload the font structure for all texts, the saved texts and the 
  814. X+    current work_fontstruct.
  815. X+  */
  816. X+ 
  817. X  reload_text_fstructs()
  818. X  {
  819. X      F_text       *t;
  820. X***************
  821. X*** 743,751 ****
  822. X--- 696,708 ----
  823. X  
  824. X      /* reload the compound objects' texts */
  825. X      reload_compoundfont(objects.compounds);
  826. X+     reload_compoundfont(saved_objects.compounds);
  827. X      /* and the separate texts */
  828. X      for (t=objects.texts; t != NULL; t = t->next)
  829. X      reload_text_fstruct(t);
  830. X+     /* also for the saved texts */
  831. X+     for (t=saved_objects.texts; t != NULL; t = t->next)
  832. X+     reload_text_fstruct(t);
  833. X  }
  834. X  
  835. X  /*
  836. X***************
  837. X*** 769,773 ****
  838. X      F_text       *t;
  839. X  {
  840. X      t->fontstruct = lookfont(x_fontnum(t->flags, t->font), 
  841. X!             round(t->size*zoomscale), t->angle);
  842. X  }
  843. X--- 726,730 ----
  844. X      F_text       *t;
  845. X  {
  846. X      t->fontstruct = lookfont(x_fontnum(t->flags, t->font), 
  847. X!             round(t->size*zoomscale));
  848. X  }
  849. Xdiff -rc xfig.2.1.7a/e_align.c xfig.2.1.8/e_align.c
  850. X*** xfig.2.1.7a/e_align.c    Tue Jan  5 11:41:05 1993
  851. X--- xfig.2.1.8/e_align.c    Fri Jul  2 11:08:20 1993
  852. X***************
  853. X*** 184,190 ****
  854. X  
  855. X      for (t = cur_c->texts; t != NULL; t = t->next) {
  856. X      int   dum;
  857. X!     text_bound_actual(t, t->angle, &llx, &lly, &urx, &ury,
  858. X             &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
  859. X      get_dx_dy();
  860. X      translate_text(t, dx, dy);
  861. X--- 184,190 ----
  862. X  
  863. X      for (t = cur_c->texts; t != NULL; t = t->next) {
  864. X      int   dum;
  865. X!     text_bound(t, &llx, &lly, &urx, &ury,
  866. X             &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
  867. X      get_dx_dy();
  868. X      translate_text(t, dx, dy);
  869. X***************
  870. X*** 195,224 ****
  871. X  get_dx_dy()
  872. X  {
  873. X      switch (cur_valign) {
  874. X!     case NONE:
  875. X      dy = 0;
  876. X      break;
  877. X!     case TOP:
  878. X      dy = ycmin - lly;
  879. X      break;
  880. X!     case BOTTOM:
  881. X      dy = ycmax - ury;
  882. X      break;
  883. X!     case CENTER:
  884. X      dy = (ycmin - lly) + (abs(ycmin - lly) + abs(ycmax - ury)) / 2;
  885. X      break;
  886. X      }
  887. X      switch (cur_halign) {
  888. X!     case NONE:
  889. X      dx = 0;
  890. X      break;
  891. X!     case LEFT:
  892. X      dx = xcmin - llx;
  893. X      break;
  894. X!     case RIGHT:
  895. X      dx = xcmax - urx;
  896. X      break;
  897. X!     case CENTER:
  898. X      dx = (xcmin - llx) + (abs(xcmin - llx) + abs(xcmax - urx)) / 2;
  899. X      break;
  900. X      }
  901. X--- 195,224 ----
  902. X  get_dx_dy()
  903. X  {
  904. X      switch (cur_valign) {
  905. X!     case ALIGN_NONE:
  906. X      dy = 0;
  907. X      break;
  908. X!     case ALIGN_TOP:
  909. X      dy = ycmin - lly;
  910. X      break;
  911. X!     case ALIGN_BOTTOM:
  912. X      dy = ycmax - ury;
  913. X      break;
  914. X!     case ALIGN_CENTER:
  915. X      dy = (ycmin - lly) + (abs(ycmin - lly) + abs(ycmax - ury)) / 2;
  916. X      break;
  917. X      }
  918. X      switch (cur_halign) {
  919. X!     case ALIGN_NONE:
  920. X      dx = 0;
  921. X      break;
  922. X!     case ALIGN_LEFT:
  923. X      dx = xcmin - llx;
  924. X      break;
  925. X!     case ALIGN_RIGHT:
  926. X      dx = xcmax - urx;
  927. X      break;
  928. X!     case ALIGN_CENTER:
  929. X      dx = (xcmin - llx) + (abs(xcmin - llx) + abs(xcmax - urx)) / 2;
  930. X      break;
  931. X      }
  932. Xdiff -rc xfig.2.1.7a/e_copy.c xfig.2.1.8/e_copy.c
  933. X*** xfig.2.1.7a/e_copy.c    Wed Dec  9 15:42:43 1992
  934. X--- xfig.2.1.8/e_copy.c    Wed Jul  7 14:58:53 1993
  935. X***************
  936. X*** 181,186 ****
  937. X      fclose(fp);
  938. X      return;
  939. X      }
  940. X!     put_msg("Object copied to scrap");
  941. X      fclose(fp);
  942. X  }
  943. X--- 181,186 ----
  944. X      fclose(fp);
  945. X      return;
  946. X      }
  947. X!     put_msg("Object copied to scrapfile %s",cut_buf_name);
  948. X      fclose(fp);
  949. X  }
  950. Xdiff -rc xfig.2.1.7a/e_delete.c xfig.2.1.8/e_delete.c
  951. X*** xfig.2.1.7a/e_delete.c    Wed Dec  9 15:42:50 1992
  952. X--- xfig.2.1.8/e_delete.c    Wed Jul  7 14:59:28 1993
  953. X***************
  954. X*** 222,228 ****
  955. X      fclose(fp);
  956. X      return;
  957. X      }
  958. X!     put_msg("Object deleted to scrap");
  959. X      fclose(fp);
  960. X  }
  961. X  
  962. X--- 222,228 ----
  963. X      fclose(fp);
  964. X      return;
  965. X      }
  966. X!     put_msg("Object deleted to scrapfile %s",cut_buf_name);
  967. X      fclose(fp);
  968. X  }
  969. X  
  970. Xdiff -rc xfig.2.1.7a/e_edit.c xfig.2.1.8/e_edit.c
  971. X*** xfig.2.1.7a/e_edit.c    Wed Feb  3 13:31:40 1993
  972. X--- xfig.2.1.8/e_edit.c    Tue Aug 31 14:18:09 1993
  973. X***************
  974. X*** 29,35 ****
  975. X  #include "w_mousefun.h"
  976. X  
  977. X  extern char    *panel_get_value();
  978. X! extern PIX_ROT_FONT lookfont();
  979. X  Widget        make_popup_menu();
  980. X  static Widget    make_color_popup_menu();
  981. X  
  982. X--- 29,35 ----
  983. X  #include "w_mousefun.h"
  984. X  
  985. X  extern char    *panel_get_value();
  986. X! extern PIX_FONT lookfont();
  987. X  Widget        make_popup_menu();
  988. X  static Widget    make_color_popup_menu();
  989. X  
  990. X***************
  991. X*** 343,350 ****
  992. X      XButtonEvent   *ev;
  993. X  {
  994. X      struct f_point  p1, p2;
  995. X!     int            dx, dy, rotation;
  996. X!     float        ratio;
  997. X      register float  orig_ratio = new_l->eps->hw_ratio;
  998. X  
  999. X      p1.x = atoi(panel_get_value(x1_panel));
  1000. X--- 343,349 ----
  1001. X      XButtonEvent   *ev;
  1002. X  {
  1003. X      struct f_point  p1, p2;
  1004. X!     int            dx, dy;
  1005. X      register float  orig_ratio = new_l->eps->hw_ratio;
  1006. X  
  1007. X      p1.x = atoi(panel_get_value(x1_panel));
  1008. X***************
  1009. X*** 380,388 ****
  1010. X      new_c = copy_compound(c);
  1011. X      new_c->next = c;
  1012. X      generic_window("COMPOUND", "", &glue_ic, done_compound, 0, 0);
  1013. X!     f_pos_panel(&c->nwcorner, "Top Left Corner:", &x1_panel, &y1_panel);
  1014. X!     f_pos_panel(&c->secorner, "Bottom Right Corner:", &x2_panel, &y2_panel);
  1015. X!     int_label(object_count(c), "Num Objects: ", &num_objects);
  1016. X  }
  1017. X  
  1018. X  static
  1019. X--- 379,387 ----
  1020. X      new_c = copy_compound(c);
  1021. X      new_c->next = c;
  1022. X      generic_window("COMPOUND", "", &glue_ic, done_compound, 0, 0);
  1023. X!     f_pos_panel(&c->nwcorner, "Top Left Corner", &x1_panel, &y1_panel);
  1024. X!     f_pos_panel(&c->secorner, "Bottom Right Corner", &x2_panel, &y2_panel);
  1025. X!     int_label(object_count(c), "Num Objects ", &num_objects);
  1026. X  }
  1027. X  
  1028. X  static
  1029. X***************
  1030. X*** 476,490 ****
  1031. END_OF_FILE
  1032.   if test 29145 -ne `wc -c <'xfig.02'`; then
  1033.     echo shar: \"'xfig.02'\" unpacked with wrong size!
  1034.   fi
  1035.   # end of 'xfig.02'
  1036. fi
  1037. echo shar: End of archive 10 \(of 16\).
  1038. cp /dev/null ark10isdone
  1039. MISSING=""
  1040. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
  1041.     if test ! -f ark${I}isdone ; then
  1042.     MISSING="${MISSING} ${I}"
  1043.     fi
  1044. done
  1045. if test "${MISSING}" = "" ; then
  1046.     echo You have unpacked all 16 archives.
  1047.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1048.     echo Creating merged patch file xfig.p2
  1049.     cat xfig.[01][0-9] > xfig.p2
  1050.     rm -f xfig.[01][0-9]
  1051. else
  1052.     echo You still must unpack the following archives:
  1053.     echo "        " ${MISSING}
  1054. fi
  1055. exit 0
  1056. exit 0 # Just in case...
  1057. -- 
  1058.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  1059. \X/  Amiga - The only way to fly! |    sources-x@sterling.com
  1060.  "It's intuitively obvious to the |
  1061.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1062.