home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-10-21 | 28.5 KB | 1,001 lines |
- static int base_x, base_y;
- ! static PIX_ROT_FONT canvas_zoomed_font;
-
- static int work_psflag, work_font, work_fontsize, work_textjust;
- ! static PIX_ROT_FONT work_fontstruct;
- ! static float work_angle;
- static finish_n_start();
- static init_text_input(), cancel_text_input();
- static wrap_up();
- --- 42,54 ----
- int leng_prefix, leng_suffix;
- static int char_ht;
- static int base_x, base_y;
- ! static PIX_FONT canvas_zoomed_font;
-
- + static int is_newline;
- static int work_psflag, work_font, work_fontsize, work_textjust;
- ! static PIX_FONT work_fontstruct;
- ! static float work_angle; /* in RADIANS */
- ! static double sin_t, cos_t; /* sin(work_angle) and cos(work_angle) */
- static finish_n_start();
- static init_text_input(), cancel_text_input();
- static wrap_up();
- ***************
- *** 71,76 ****
- --- 74,80 ----
- canvas_rightbut_proc = null_proc;
- set_mousefun("posn cursor", "", "");
- set_cursor(pencil_cursor);
- + is_newline = 0;
- }
-
- static
- ***************
- *** 105,123 ****
- new_text_line()
- {
- wrap_up();
- ! if (work_angle < 90.0 - 0.001) {
- ! cur_y += (int) ((float) char_ht * cur_textstep);
- ! cur_x = base_x;
- ! } else if (work_angle < 180.0 - 0.001) {
- ! cur_x += (int) ((float) char_ht * cur_textstep);
- ! cur_y = base_y;
- ! } else if (work_angle < 270.0 - 0.001) {
- ! cur_y -= (int) ((float) char_ht * cur_textstep);
- ! cur_x = base_x;
- ! } else {
- ! cur_x -= (int) ((float) char_ht * cur_textstep);
- ! cur_y = base_y;
- }
- init_text_input(cur_x, cur_y);
- }
-
- --- 109,122 ----
- new_text_line()
- {
- wrap_up();
- ! if (cur_t) { /* use current text's position as ref */
- ! cur_x = round(cur_t->base_x + char_ht*cur_textstep*sin_t);
- ! cur_y = round(cur_t->base_y + char_ht*cur_textstep*cos_t);
- ! } else { /* use position from previous text */
- ! cur_x = round(base_x + char_ht*cur_textstep*sin_t);
- ! cur_y = round(base_y + char_ht*cur_textstep*cos_t);
- }
- + is_newline = 1;
- init_text_input(cur_x, cur_y);
- }
-
- ***************
- *** 170,177 ****
- init_text_input(x, y)
- int x, y;
- {
- ! int length, d;
- PR_SIZE tsize;
-
- cur_x = x;
- cur_y = y;
- --- 169,177 ----
- init_text_input(x, y)
- int x, y;
- {
- ! int length, posn;
- PR_SIZE tsize;
- + float lensin, lencos;
-
- cur_x = x;
- cur_y = y;
- ***************
- *** 191,198 ****
- * through
- */
-
- ! put_msg("Ready for text input (from keyboard)");
- ! if ((cur_t = text_search(cur_x, cur_y)) == NULL) { /* new text input */
- leng_prefix = leng_suffix = 0;
- *suffix = 0;
- prefix[leng_prefix] = '\0';
- --- 191,197 ----
- * through
- */
-
- ! if ((cur_t = text_search(cur_x, cur_y, &posn)) == NULL) { /* new text input */
- leng_prefix = leng_suffix = 0;
- *suffix = 0;
- prefix[leng_prefix] = '\0';
- ***************
- *** 199,221 ****
- base_x = cur_x;
- base_y = cur_y;
-
- ! work_fontsize = cur_fontsize;
- ! work_font = using_ps ? cur_ps_font : cur_latex_font;
- ! work_psflag = using_ps;
- ! work_textjust = cur_textjust;
- ! work_angle = cur_elltextangle;
- ! if (work_angle < 0.0)
- ! work_angle += 360.0;
-
- ! /* load the X font and get its id for this font, size and angle UNZOOMED */
- ! /* this is to get widths etc for the unzoomed chars */
- ! canvas_font = lookfont(x_fontnum(work_psflag, work_font),
- ! work_fontsize, work_angle*M_PI/180.0);
- ! /* get the ZOOMED font for actually drawing on the canvas */
- ! canvas_zoomed_font = lookfont(x_fontnum(work_psflag, work_font),
- ! round(work_fontsize*zoomscale), work_angle*M_PI/180.0);
- ! /* save the working font structure */
- ! work_fontstruct = canvas_zoomed_font;
- } else { /* clicked on existing text */
- if (hidden_text(cur_t)) {
- put_msg("Can't edit hidden text");
- --- 198,226 ----
- base_x = cur_x;
- base_y = cur_y;
-
- ! if (is_newline) { /* working settings already set */
- ! is_newline = 0;
- ! } else { /* set working settings from ind panel */
- ! work_fontsize = cur_fontsize;
- ! work_font = using_ps ? cur_ps_font : cur_latex_font;
- ! work_psflag = using_ps;
- ! work_textjust = cur_textjust;
- ! work_angle = cur_elltextangle*M_PI/180.0;
- ! while (work_angle < 0.0)
- ! work_angle += M_2PI;
- ! sin_t = sin((double)work_angle);
- ! cos_t = cos((double)work_angle);
-
- ! /* load the X font and get its id for this font and size UNZOOMED */
- ! /* this is to get widths etc for the unzoomed chars */
- ! canvas_font = lookfont(x_fontnum(work_psflag, work_font),
- ! work_fontsize);
- ! /* get the ZOOMED font for actually drawing on the canvas */
- ! canvas_zoomed_font = lookfont(x_fontnum(work_psflag, work_font),
- ! round(work_fontsize*zoomscale));
- ! /* save the working font structure */
- ! work_fontstruct = canvas_zoomed_font;
- ! }
- } else { /* clicked on existing text */
- if (hidden_text(cur_t)) {
- put_msg("Can't edit hidden text");
- ***************
- *** 229,241 ****
- work_fontsize = cur_t->size;
- work_psflag = cur_t->flags;
- work_textjust = cur_t->type;
- ! work_angle = cur_t->angle*180.0/M_PI;
- ! if (work_angle < 0.0)
- ! work_angle += 360.0;
- /* load the X font and get its id for this font, size and angle UNZOOMED */
- /* this is to get widths etc for the unzoomed chars */
- canvas_font = lookfont(x_fontnum(work_psflag, work_font),
- ! work_fontsize, work_angle*M_PI/180.0);
-
- toggle_textmarker(cur_t);
- draw_text(cur_t, ERASE);
- --- 234,249 ----
- work_fontsize = cur_t->size;
- work_psflag = cur_t->flags;
- work_textjust = cur_t->type;
- ! work_angle = cur_t->angle;
- ! while (work_angle < 0.0)
- ! work_angle += M_2PI;
- ! sin_t = sin((double)work_angle);
- ! cos_t = cos((double)work_angle);
- !
- /* load the X font and get its id for this font, size and angle UNZOOMED */
- /* this is to get widths etc for the unzoomed chars */
- canvas_font = lookfont(x_fontnum(work_psflag, work_font),
- ! work_fontsize);
-
- toggle_textmarker(cur_t);
- draw_text(cur_t, ERASE);
- ***************
- *** 242,298 ****
- base_x = cur_t->base_x;
- base_y = cur_t->base_y;
- length = cur_t->length;
- switch (cur_t->type) {
- case T_CENTER_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001)
- ! base_x -= length / 2;
- ! else if (work_angle < 180.0 - 0.001)
- ! base_y += length / 2;
- ! else if (work_angle < 270.0 - 0.001)
- ! base_x += length / 2;
- ! else
- ! base_y -= length / 2;
- break;
-
- case T_RIGHT_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001)
- ! base_x -= length;
- ! else if (work_angle < 180.0 - 0.001)
- ! base_y += length;
- ! else if (work_angle < 270.0 - 0.001)
- ! base_x += length;
- ! else
- ! base_y -= length;
- break;
- } /* switch */
- ! if (work_angle < 90.0 - 0.001 || (work_angle >= 180.0 - 0.001
- ! && work_angle < 270.0 - 0.001))
- ! d = abs(cur_x - base_x);
- ! else
- ! d = abs(cur_y - base_y);
- leng_suffix = strlen(cur_t->cstring);
- /* leng_prefix is # of char in the text before the cursor */
- ! leng_prefix = prefix_length(cur_t->cstring, d);
- leng_suffix -= leng_prefix;
- cpy_n_char(prefix, cur_t->cstring, leng_prefix);
- strcpy(suffix, &cur_t->cstring[leng_prefix]);
- tsize = pf_textwidth(canvas_font, leng_prefix, prefix);
-
- ! if (work_angle < 90.0 - 0.001) {
- ! cur_x = base_x + tsize.x;
- ! cur_y = base_y;
- ! } else if (work_angle < 180.0 - 0.001) {
- ! cur_x = base_x;
- ! cur_y = base_y - tsize.x;
- ! } else if (work_angle < 270.0 - 0.001) {
- ! cur_x = base_x - tsize.x;
- ! cur_y = base_y;
- ! } else {
- ! cur_x = base_x;
- ! cur_y = base_y + tsize.x;
- ! }
- }
- ! char_ht = rot_char_height(canvas_font);
- initialize_char_handler(canvas_win, finish_text_input,
- base_x, base_y);
- draw_char_string();
- --- 250,283 ----
- base_x = cur_t->base_x;
- base_y = cur_t->base_y;
- length = cur_t->length;
- + lencos = length*cos_t;
- + lensin = length*sin_t;
- +
- switch (cur_t->type) {
- case T_CENTER_JUSTIFIED:
- ! base_x = round(base_x - lencos/2.0);
- ! base_y = round(base_y + lensin/2.0);
- break;
-
- case T_RIGHT_JUSTIFIED:
- ! base_x = round(base_x - lencos);
- ! base_y = round(base_y + lensin);
- break;
- } /* switch */
- !
- leng_suffix = strlen(cur_t->cstring);
- /* leng_prefix is # of char in the text before the cursor */
- ! leng_prefix = prefix_length(cur_t->cstring, posn);
- leng_suffix -= leng_prefix;
- cpy_n_char(prefix, cur_t->cstring, leng_prefix);
- strcpy(suffix, &cur_t->cstring[leng_prefix]);
- tsize = pf_textwidth(canvas_font, leng_prefix, prefix);
-
- ! cur_x = round(base_x + tsize.x * cos_t);
- ! cur_y = round(base_y - tsize.x * sin_t);
- }
- ! put_msg("Ready for text input (from keyboard)");
- ! char_ht = char_height(canvas_font);
- initialize_char_handler(canvas_win, finish_text_input,
- base_x, base_y);
- draw_char_string();
- ***************
- *** 316,322 ****
- text->font = work_font; /* put in current font number */
- text->fontstruct = work_fontstruct;
- text->size = work_fontsize;
- ! text->angle = work_angle/180.0*M_PI; /* convert to radians */
- text->flags = cur_textflags;
- text->color = cur_color;
- text->depth = cur_depth;
- --- 301,307 ----
- text->font = work_font; /* put in current font number */
- text->fontstruct = work_fontstruct;
- text->size = work_fontsize;
- ! text->angle = work_angle;
- text->flags = cur_textflags;
- text->color = cur_color;
- text->depth = cur_depth;
- ***************
- *** 359,365 ****
- if (where_p >= len_p)
- return (len_c); /* entire string is the prefix */
-
- ! char_wid = rot_char_width(canvas_font);
- where_c = where_p / char_wid; /* estimated char position */
- size = pf_textwidth(canvas_font, where_c, string);
- l = size.x; /* actual length (pixels) of string of
- --- 344,350 ----
- if (where_p >= len_p)
- return (len_c); /* entire string is the prefix */
-
- ! char_wid = char_width(canvas_font);
- where_c = where_p / char_wid; /* estimated char position */
- size = pf_textwidth(canvas_font, where_c, string);
- l = size.x; /* actual length (pixels) of string of
- ***************
- *** 366,372 ****
- * where_c chars */
- if (l < where_p) {
- do { /* add the width of next char to l */
- ! l += (char_wid = rot_char_advance(canvas_font,
- (unsigned char) string[where_c++]));
- } while (l < where_p);
- if (l - (char_wid >> 1) >= where_p)
- --- 351,357 ----
- * where_c chars */
- if (l < where_p) {
- do { /* add the width of next char to l */
- ! l += (char_wid = char_advance(canvas_font,
- (unsigned char) string[where_c++]));
- } while (l < where_p);
- if (l - (char_wid >> 1) >= where_p)
- ***************
- *** 373,382 ****
- where_c--;
- } else if (l > where_p) {
- do { /* subtract the width of last char from l */
- ! l -= (char_wid = rot_char_advance(canvas_font,
- (unsigned char) string[--where_c]));
- } while (l > where_p);
- ! if (l + (char_wid >> 1) >= where_p)
- where_c++;
- }
- if (where_c < 0) {
- --- 358,367 ----
- where_c--;
- } else if (l > where_p) {
- do { /* subtract the width of last char from l */
- ! l -= (char_wid = char_advance(canvas_font,
- (unsigned char) string[--where_c]));
- } while (l > where_p);
- ! if (l + (char_wid >> 1) <= where_p)
- where_c++;
- }
- if (where_c < 0) {
- ***************
- *** 383,388 ****
- --- 368,375 ----
- fprintf(stderr, "xfig file %s line %d: Error in prefix_length - adjusted\n", __FILE__, __LINE__);
- where_c = 0;
- }
- + if ( where_c > len_c )
- + return (len_c);
- return (where_c);
- }
-
- ***************
- *** 405,422 ****
- draw_cursor(x, y)
- int x, y;
- {
- ! if (work_angle < 90.0 - 0.001) /* 0-89 degrees */
- ! pw_vector(pw, x, y, x, y-ch_height, INV_PAINT, 1, RUBBER_LINE, 0.0,
- ! DEFAULT_COLOR);
- ! else if (work_angle < 180.0 - 0.001) /* 90-179 degrees */
- ! pw_vector(pw, x-ch_height, y, x, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
- ! DEFAULT_COLOR);
- ! else if (work_angle < 270.0 - 0.001) /* 180-269 degrees */
- ! pw_vector(pw, x, y+ch_height, x, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
- ! DEFAULT_COLOR);
- ! else /* 270-359 degrees */
- ! pw_vector(pw, x, y, x+ch_height, y, INV_PAINT, 1, RUBBER_LINE, 0.0,
- ! DEFAULT_COLOR);
- }
-
- static int
- --- 392,401 ----
- draw_cursor(x, y)
- int x, y;
- {
- ! pw_vector(pw, x, y,
- ! round(x-ch_height*sin_t),
- ! round(y-ch_height*cos_t),
- ! INV_PAINT, 1, RUBBER_LINE, 0.0, DEFAULT_COLOR);
- }
-
- static int
- ***************
- *** 432,438 ****
- rcur_x = cur_x;
- rcur_y = cur_y;
-
- ! ch_height = rot_char_height(canvas_font);
- turn_on_blinking_cursor(draw_cursor, draw_cursor,
- cur_x, cur_y, (long) BLINK_INTERVAL);
- }
- --- 411,417 ----
- rcur_x = cur_x;
- rcur_y = cur_y;
-
- ! ch_height = canvas_font->max_bounds.ascent;
- turn_on_blinking_cursor(draw_cursor, draw_cursor,
- cur_x, cur_y, (long) BLINK_INTERVAL);
- }
- ***************
- *** 454,463 ****
- erase_char_string()
- {
- pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font,
- ! prefix, DEFAULT_COLOR);
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! suffix, DEFAULT_COLOR);
- }
-
- static int
- --- 433,442 ----
- erase_char_string()
- {
- pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font,
- ! work_angle, prefix, DEFAULT_COLOR);
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! work_angle, suffix, DEFAULT_COLOR);
- }
-
- static int
- ***************
- *** 464,473 ****
- draw_char_string()
- {
- pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font,
- ! prefix, DEFAULT_COLOR);
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! suffix, DEFAULT_COLOR);
- move_blinking_cursor(cur_x, cur_y);
- }
-
- --- 443,452 ----
- draw_char_string()
- {
- pw_text(pw, cbase_x, cbase_y, INV_PAINT, canvas_zoomed_font,
- ! work_angle, prefix, DEFAULT_COLOR);
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! work_angle, suffix, DEFAULT_COLOR);
- move_blinking_cursor(cur_x, cur_y);
- }
-
- ***************
- *** 476,482 ****
- {
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, PAINT, canvas_zoomed_font,
- ! suffix, DEFAULT_COLOR);
- }
-
- static int
- --- 455,461 ----
- {
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, PAINT, canvas_zoomed_font,
- ! work_angle, suffix, DEFAULT_COLOR);
- }
-
- static int
- ***************
- *** 484,490 ****
- {
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! suffix, DEFAULT_COLOR);
- }
-
- static int
- --- 463,469 ----
- {
- if (leng_suffix)
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! work_angle, suffix, DEFAULT_COLOR);
- }
-
- static int
- ***************
- *** 495,501 ****
- s[0]=c;
- s[1]='\0';
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! s, DEFAULT_COLOR);
- }
-
- char_handler(c)
- --- 474,480 ----
- s[0]=c;
- s[1]='\0';
- pw_text(pw, cur_x, cur_y, INV_PAINT, canvas_zoomed_font,
- ! work_angle, s, DEFAULT_COLOR);
- }
-
- char_handler(c)
- ***************
- *** 502,507 ****
- --- 481,488 ----
- unsigned char c;
- {
- float cwidth, cw2;
- + float cwsin, cwcos;
- + float cw2sin, cw2cos;
-
- if (cr_proc == NULL)
- return;
- ***************
- *** 511,562 ****
- } else if (c == DEL || c == CTRL_H) {
- if (leng_prefix > 0) {
- erase_char_string();
- ! cwidth = (float) rot_char_advance(canvas_font,
- (unsigned char) prefix[leng_prefix - 1]);
- cw2 = cwidth/2.0;
- /* correct text/cursor posn for justification and zoom factor */
- switch (work_textjust) {
- case T_LEFT_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001)
- ! rcur_x -= cwidth; /* 0-89 deg, move the suffix left */
- ! else if (work_angle < 180.0 - 0.001)
- ! rcur_y += cwidth; /* 90-179 deg, move suffix down */
- ! else if (work_angle < 270.0 - 0.001)
- ! rcur_x += cwidth; /* 180-269 deg, move suffix right */
- ! else
- ! rcur_y -= cwidth; /* 270-359 deg, move suffix up */
- break;
- case T_CENTER_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001) {
- ! rbase_x += cw2; /* 0-89 deg, move base right cw/2 */
- ! rcur_x -= cw2; /* move suffix left by cw/2 */
- ! } else if (work_angle < 180.0 - 0.001) {
- ! rbase_y -= cw2; /* 90-179 deg, move base up cw/2 */
- ! rcur_y += cw2; /* move suffix down cw/2 */
- ! } else if (work_angle < 270.0 - 0.001) {
- ! rbase_x -= cw2; /* 180-269 deg, move base left cw/2 */
- ! rcur_x += cw2; /* move suffix right cw/2 */
- ! } else {
- ! rbase_y += cw2; /* 270-359 deg, move base down cw/2 */
- ! rcur_y -= cw2; /* move suffix up cw/2 */
- ! }
- break;
- case T_RIGHT_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001)
- ! rbase_x += cwidth; /* 0-89 deg, move the prefix right */
- ! else if (work_angle < 180.0 - 0.001)
- ! rbase_y -= cwidth; /* 90-179 deg, move prefix up */
- ! else if (work_angle < 270.0 - 0.001)
- ! rbase_x -= cwidth; /* 180-269 deg, move prefix left */
- ! else
- ! rbase_y += cwidth; /* 270-359 deg, move prefix down */
- break;
- }
- prefix[--leng_prefix] = '\0';
- ! cbase_x = rbase_x; /* fix */
- ! cbase_y = rbase_y;
- ! cur_x = rcur_x;
- ! cur_y = rcur_y;
- draw_char_string();
- }
- } else if (c == CTRL_X) {
- --- 492,527 ----
- } else if (c == DEL || c == CTRL_H) {
- if (leng_prefix > 0) {
- erase_char_string();
- ! cwidth = (float) char_advance(canvas_font,
- (unsigned char) prefix[leng_prefix - 1]);
- cw2 = cwidth/2.0;
- + cwsin = cwidth*sin_t;
- + cwcos = cwidth*cos_t;
- + cw2sin = cw2*sin_t;
- + cw2cos = cw2*cos_t;
- +
- /* correct text/cursor posn for justification and zoom factor */
- switch (work_textjust) {
- case T_LEFT_JUSTIFIED:
- ! rcur_x -= cwcos;
- ! rcur_y += cwsin;
- break;
- case T_CENTER_JUSTIFIED:
- ! rbase_x += cw2cos;
- ! rbase_y -= cw2sin;
- ! rcur_x -= cw2cos;
- ! rcur_y += cw2sin;
- break;
- case T_RIGHT_JUSTIFIED:
- ! rbase_x += cwcos;
- ! rbase_y -= cwsin;
- break;
- }
- prefix[--leng_prefix] = '\0';
- ! cbase_x = round(rbase_x);
- ! cbase_y = round(rbase_y);
- ! cur_x = round(rcur_x);
- ! cur_y = round(rcur_y);
- draw_char_string();
- }
- } else if (c == CTRL_X) {
- ***************
- *** 564,592 ****
- erase_char_string();
- switch (work_textjust) {
- case T_CENTER_JUSTIFIED:
- ! while (leng_prefix--) /* subtract char width/2 per char */
- ! if (work_angle < 90.0 - 0.001) /* 0-89 degrees */
- ! rcur_x -= rot_char_advance(canvas_font,
- ! (unsigned char) prefix[leng_prefix]) / 2.0;
- ! else if (work_angle < 180.0 - 0.001) /* 90-179 degrees */
- ! rcur_y += rot_char_advance(canvas_font,
- ! (unsigned char) prefix[leng_prefix]) / 2.0;
- ! else if (work_angle < 270.0 - 0.001) /* 180-269 degrees */
- ! rcur_x += rot_char_advance(canvas_font,
- ! (unsigned char) prefix[leng_prefix]) / 2.0;
- ! else /* 270-359 degrees */
- ! rcur_y -= rot_char_advance(canvas_font,
- ! (unsigned char) prefix[leng_prefix]) / 2.0;
- ! cur_x = cbase_x = rbase_x = rcur_x;
- ! cur_y = cbase_y = rbase_y = rcur_y;
- break;
- case T_RIGHT_JUSTIFIED:
- ! cbase_x = rbase_x = cur_x = rcur_x;
- ! cbase_y = rbase_y = cur_y = rcur_y;
- break;
- case T_LEFT_JUSTIFIED:
- ! cur_x = rcur_x = cbase_x = rbase_x;
- ! cur_y = rcur_y = cbase_y = rbase_y;
- break;
- }
- leng_prefix = 0;
- --- 529,556 ----
- erase_char_string();
- switch (work_textjust) {
- case T_CENTER_JUSTIFIED:
- ! while (leng_prefix--) { /* subtract char width/2 per char */
- ! rcur_x -= cos_t*char_advance(canvas_font,
- ! (unsigned char) prefix[leng_prefix]) / 2.0;
- ! rcur_y += sin_t*char_advance(canvas_font,
- ! (unsigned char) prefix[leng_prefix]) / 2.0;
- ! }
- ! rbase_x = rcur_x;
- ! cur_x = cbase_x = round(rbase_x);
- ! rbase_y = rcur_y;
- ! cur_y = cbase_y = round(rbase_y);
- break;
- case T_RIGHT_JUSTIFIED:
- ! rbase_x = rcur_x;
- ! cbase_x = cur_x = round(rbase_x);
- ! rbase_y = rcur_y;
- ! cbase_y = cur_y = round(rbase_y);
- break;
- case T_LEFT_JUSTIFIED:
- ! rcur_x = rbase_x;
- ! cur_x = cbase_x = round(rcur_x);
- ! rcur_y = rbase_y;
- ! cur_y = cbase_y = round(rcur_y);
- break;
- }
- leng_prefix = 0;
- ***************
- *** 600,653 ****
-
- /* normal text character */
- } else {
- ! draw_char_string();
- ! cwidth = rot_char_advance(canvas_font, (unsigned char) c);
- cw2 = cwidth/2.0;
- ! /* correct text/cursor posn for justification and zoom factor */
- switch (work_textjust) {
- case T_LEFT_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001)
- ! rcur_x += cwidth; /* 0-89 deg, move the suffix right */
- ! else if (work_angle < 180.0 - 0.001)
- ! rcur_y -= cwidth; /* 90-179 deg, move suffix up */
- ! else if (work_angle < 270.0 - 0.001)
- ! rcur_x -= cwidth; /* 180-269 deg, move suffix left */
- ! else
- ! rcur_y += cwidth; /* 270-359 deg, move suffix down */
- break;
- case T_CENTER_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001) {
- ! rbase_x -= cw2; /* 0-89 deg, move base left cw/2 */
- ! rcur_x += cw2; /* move suffix right by cw/2 */
- ! } else if (work_angle < 180.0 - 0.001) {
- ! rbase_y += cw2; /* 90-179 deg, move base down cw/2 */
- ! rcur_y -= cw2; /* move suffix up cw/2 */
- ! } else if (work_angle < 270.0 - 0.001) {
- ! rbase_x += cw2; /* 180-269 deg, move base right cw/2 */
- ! rcur_x -= cw2; /* move suffix left cw/2 */
- ! } else {
- ! rbase_y -= cw2; /* 270-359 deg, move base up cw/2 */
- ! rcur_y += cw2; /* move suffix down cw/2 */
- ! }
- break;
- case T_RIGHT_JUSTIFIED:
- ! if (work_angle < 90.0 - 0.001)
- ! rbase_x -= cwidth; /* 0-89 deg, move the prefix left */
- ! else if (work_angle < 180.0 - 0.001)
- ! rbase_y += cwidth; /* 90-179 deg, move prefix down */
- ! else if (work_angle < 270.0 - 0.001)
- ! rbase_x += cwidth; /* 180-269 deg, move prefix right */
- ! else
- ! rbase_y -= cwidth; /* 270-359 deg, move prefix up */
- break;
- }
- prefix[leng_prefix++] = c;
- prefix[leng_prefix] = '\0';
- ! cbase_x = rbase_x;
- ! cbase_y = rbase_y;
- ! cur_x = rcur_x;
- ! cur_y = rcur_y;
- ! draw_char_string();
- }
- }
-
- --- 564,601 ----
-
- /* normal text character */
- } else {
- ! draw_char_string(); /* erase current string */
- !
- ! cwidth = char_advance(canvas_font, (unsigned char) c);
- ! cwsin = cwidth*sin_t;
- ! cwcos = cwidth*cos_t;
- cw2 = cwidth/2.0;
- ! cw2sin = cw2*sin_t;
- ! cw2cos = cw2*cos_t;
- ! /* correct text/cursor posn for justification and rotation */
- switch (work_textjust) {
- case T_LEFT_JUSTIFIED:
- ! rcur_x += cwcos;
- ! rcur_y -= cwsin;
- break;
- case T_CENTER_JUSTIFIED:
- ! rbase_x -= cw2cos;
- ! rbase_y += cw2sin;
- ! rcur_x += cw2cos;
- ! rcur_y -= cw2sin;
- break;
- case T_RIGHT_JUSTIFIED:
- ! rbase_x -= cwcos;
- ! rbase_y += cwsin;
- break;
- }
- prefix[leng_prefix++] = c;
- prefix[leng_prefix] = '\0';
- ! cbase_x = round(rbase_x);
- ! cbase_y = round(rbase_y);
- ! cur_x = round(rcur_x);
- ! cur_y = round(rcur_y);
- ! draw_char_string(); /* draw new string */
- }
- }
-
- ***************
- *** 737,742 ****
- --- 685,695 ----
- cursor_is_moving = 0;
- }
-
- + /*
- + * Reload the font structure for all texts, the saved texts and the
- + current work_fontstruct.
- + */
- +
- reload_text_fstructs()
- {
- F_text *t;
- ***************
- *** 743,751 ****
- --- 696,708 ----
-
- /* reload the compound objects' texts */
- reload_compoundfont(objects.compounds);
- + reload_compoundfont(saved_objects.compounds);
- /* and the separate texts */
- for (t=objects.texts; t != NULL; t = t->next)
- reload_text_fstruct(t);
- + /* also for the saved texts */
- + for (t=saved_objects.texts; t != NULL; t = t->next)
- + reload_text_fstruct(t);
- }
-
- /*
- ***************
- *** 769,773 ****
- F_text *t;
- {
- t->fontstruct = lookfont(x_fontnum(t->flags, t->font),
- ! round(t->size*zoomscale), t->angle);
- }
- --- 726,730 ----
- F_text *t;
- {
- t->fontstruct = lookfont(x_fontnum(t->flags, t->font),
- ! round(t->size*zoomscale));
- }
- diff -rc xfig.2.1.7a/e_align.c xfig.2.1.8/e_align.c
- *** xfig.2.1.7a/e_align.c Tue Jan 5 11:41:05 1993
- --- xfig.2.1.8/e_align.c Fri Jul 2 11:08:20 1993
- ***************
- *** 184,190 ****
-
- for (t = cur_c->texts; t != NULL; t = t->next) {
- int dum;
- ! text_bound_actual(t, t->angle, &llx, &lly, &urx, &ury,
- &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
- get_dx_dy();
- translate_text(t, dx, dy);
- --- 184,190 ----
-
- for (t = cur_c->texts; t != NULL; t = t->next) {
- int dum;
- ! text_bound(t, &llx, &lly, &urx, &ury,
- &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum);
- get_dx_dy();
- translate_text(t, dx, dy);
- ***************
- *** 195,224 ****
- get_dx_dy()
- {
- switch (cur_valign) {
- ! case NONE:
- dy = 0;
- break;
- ! case TOP:
- dy = ycmin - lly;
- break;
- ! case BOTTOM:
- dy = ycmax - ury;
- break;
- ! case CENTER:
- dy = (ycmin - lly) + (abs(ycmin - lly) + abs(ycmax - ury)) / 2;
- break;
- }
- switch (cur_halign) {
- ! case NONE:
- dx = 0;
- break;
- ! case LEFT:
- dx = xcmin - llx;
- break;
- ! case RIGHT:
- dx = xcmax - urx;
- break;
- ! case CENTER:
- dx = (xcmin - llx) + (abs(xcmin - llx) + abs(xcmax - urx)) / 2;
- break;
- }
- --- 195,224 ----
- get_dx_dy()
- {
- switch (cur_valign) {
- ! case ALIGN_NONE:
- dy = 0;
- break;
- ! case ALIGN_TOP:
- dy = ycmin - lly;
- break;
- ! case ALIGN_BOTTOM:
- dy = ycmax - ury;
- break;
- ! case ALIGN_CENTER:
- dy = (ycmin - lly) + (abs(ycmin - lly) + abs(ycmax - ury)) / 2;
- break;
- }
- switch (cur_halign) {
- ! case ALIGN_NONE:
- dx = 0;
- break;
- ! case ALIGN_LEFT:
- dx = xcmin - llx;
- break;
- ! case ALIGN_RIGHT:
- dx = xcmax - urx;
- break;
- ! case ALIGN_CENTER:
- dx = (xcmin - llx) + (abs(xcmin - llx) + abs(xcmax - urx)) / 2;
- break;
- }
- diff -rc xfig.2.1.7a/e_copy.c xfig.2.1.8/e_copy.c
- *** xfig.2.1.7a/e_copy.c Wed Dec 9 15:42:43 1992
- --- xfig.2.1.8/e_copy.c Wed Jul 7 14:58:53 1993
- ***************
- *** 181,186 ****
- fclose(fp);
- return;
- }
- ! put_msg("Object copied to scrap");
- fclose(fp);
- }
- --- 181,186 ----
- fclose(fp);
- return;
- }
- ! put_msg("Object copied to scrapfile %s",cut_buf_name);
- fclose(fp);
- }
- diff -rc xfig.2.1.7a/e_delete.c xfig.2.1.8/e_delete.c
- *** xfig.2.1.7a/e_delete.c Wed Dec 9 15:42:50 1992
- --- xfig.2.1.8/e_delete.c Wed Jul 7 14:59:28 1993
- ***************
- *** 222,228 ****
- fclose(fp);
- return;
- }
- ! put_msg("Object deleted to scrap");
- fclose(fp);
- }
-
- --- 222,228 ----
- fclose(fp);
- return;
- }
- ! put_msg("Object deleted to scrapfile %s",cut_buf_name);
- fclose(fp);
- }
-
- diff -rc xfig.2.1.7a/e_edit.c xfig.2.1.8/e_edit.c
- *** xfig.2.1.7a/e_edit.c Wed Feb 3 13:31:40 1993
- --- xfig.2.1.8/e_edit.c Tue Aug 31 14:18:09 1993
- ***************
- *** 29,35 ****
- #include "w_mousefun.h"
-
- extern char *panel_get_value();
- ! extern PIX_ROT_FONT lookfont();
- Widget make_popup_menu();
- static Widget make_color_popup_menu();
-
- --- 29,35 ----
- #include "w_mousefun.h"
-
- extern char *panel_get_value();
- ! extern PIX_FONT lookfont();
- Widget make_popup_menu();
- static Widget make_color_popup_menu();
-
- ***************
- *** 343,350 ****
- XButtonEvent *ev;
- {
- struct f_point p1, p2;
- ! int dx, dy, rotation;
- ! float ratio;
- register float orig_ratio = new_l->eps->hw_ratio;
-
- p1.x = atoi(panel_get_value(x1_panel));
- --- 343,349 ----
- XButtonEvent *ev;
- {
- struct f_point p1, p2;
- ! int dx, dy;
- register float orig_ratio = new_l->eps->hw_ratio;
-
- p1.x = atoi(panel_get_value(x1_panel));
- ***************
- *** 380,388 ****
- new_c = copy_compound(c);
- new_c->next = c;
- generic_window("COMPOUND", "", &glue_ic, done_compound, 0, 0);
- ! f_pos_panel(&c->nwcorner, "Top Left Corner:", &x1_panel, &y1_panel);
- ! f_pos_panel(&c->secorner, "Bottom Right Corner:", &x2_panel, &y2_panel);
- ! int_label(object_count(c), "Num Objects: ", &num_objects);
- }
-
- static
- --- 379,387 ----
- new_c = copy_compound(c);
- new_c->next = c;
- generic_window("COMPOUND", "", &glue_ic, done_compound, 0, 0);
- ! f_pos_panel(&c->nwcorner, "Top Left Corner", &x1_panel, &y1_panel);
- ! f_pos_panel(&c->secorner, "Bottom Right Corner", &x2_panel, &y2_panel);
- ! int_label(object_count(c), "Num Objects ", &num_objects);
- }
-
- static
- ***************
- *** 476,490 ****
-