diff --git a/src/actions.c b/src/actions.c index 2c3c1d98..da2453d5 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1512,7 +1512,8 @@ void calc_drawing_bbox(xRect *boundbox, int selected) } if(has_x && selected != 2) for(i=0;itexts;i++) { - int no_of_lines, longest_line; + int no_of_lines; + double longest_line; if(selected == 1 && !xctx->text[i].sel) continue; #if HAS_CAIRO==1 customfont = set_text_custom_font(&xctx->text[i]); @@ -2328,7 +2329,7 @@ void new_polygon(int what) #if HAS_CAIRO==1 int text_bbox(const char *str, double xscale, double yscale, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, - double *rx2, double *ry2, int *cairo_lines, int *cairo_longest_line) + double *rx2, double *ry2, int *cairo_lines, double *cairo_longest_line) { int c=0; char *str_ptr, *s = NULL; @@ -2376,7 +2377,7 @@ int text_bbox(const char *str, double xscale, double yscale, } my_free(1159, &s); hh = hh*fext.height * cairo_font_line_spacing; - *cairo_longest_line = (int) ww; + *cairo_longest_line = ww; *rx1=x1;*ry1=y1; if(hcenter) { @@ -2413,11 +2414,11 @@ int text_bbox(const char *str, double xscale, double yscale, } int text_bbox_nocairo(const char *str,double xscale, double yscale, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, - double *rx2, double *ry2, int *cairo_lines, int *cairo_longest_line) + double *rx2, double *ry2, int *cairo_lines, double *cairo_longest_line) #else int text_bbox(const char *str,double xscale, double yscale, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, - double *rx2, double *ry2, int *cairo_lines, int *cairo_longest_line) + double *rx2, double *ry2, int *cairo_lines, double *cairo_longest_line) #endif { register int c=0, length =0; @@ -2433,7 +2434,7 @@ int text_bbox(const char *str,double xscale, double yscale, w = length; } w *= (FONTWIDTH+FONTWHITESPACE)*xscale* tclgetdoublevar("nocairo_font_xscale"); - *cairo_longest_line = (int)w; + *cairo_longest_line = w; h *= (FONTHEIGHT+FONTDESCENT+FONTWHITESPACE)*yscale* tclgetdoublevar("nocairo_font_yscale"); *rx1=x1;*ry1=y1; if( rot==0) *ry1-=nocairo_vert_correct; diff --git a/src/draw.c b/src/draw.c index e96377c4..d6b96d02 100644 --- a/src/draw.c +++ b/src/draw.c @@ -197,7 +197,7 @@ int set_text_custom_font(xText *txt) static void cairo_draw_string_line(cairo_t *c_ctx, char *s, double x, double y, short rot, short flip, int lineno, double fontheight, double fontascent, double fontdescent, - int llength, int no_of_lines, int longest_line) + int llength, int no_of_lines, double longest_line) { double ix, iy; short rot1; @@ -247,7 +247,8 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in int lineno=0; double size; cairo_font_extents_t fext; - int llength=0, no_of_lines, longest_line; + int llength=0, no_of_lines; + double longest_line; (void)what; /* UNUSED in cairo version, avoid compiler warning */ if(str==NULL || !has_x ) return; @@ -329,7 +330,8 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in int pos=0,pos2=0; unsigned int cc; double *char_ptr_x1,*char_ptr_y1,*char_ptr_x2,*char_ptr_y2; - int i,lines, no_of_lines, longest_line; + int i,lines, no_of_lines; + double longest_line; if(str==NULL || !has_x ) return; dbg(2, "draw_string(): string=%s\n",str); @@ -387,10 +389,11 @@ void draw_temp_string(GC gctext, int what, const char *str, short rot, short fli { double textx1,textx2,texty1,texty2; int tmp; + double dtmp; if(!has_x) return; dbg(2, "draw_string(): string=%s\n",str); if(!text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1, - &textx1,&texty1,&textx2,&texty2, &tmp, &tmp)) return; + &textx1,&texty1,&textx2,&texty2, &tmp, &dtmp)) return; drawtemprect(gctext,what, textx1,texty1,textx2,texty2); } @@ -2075,7 +2078,7 @@ static void draw_cursor(double active_cursorx, double other_cursorx, int cursor_ { double xx = W_X(active_cursorx); - double tx1, ty1, tx2, ty2; + double tx1, ty1, tx2, ty2, dtmp; int tmp; char tmpstr[1024]; double txtsize = gr->txtsizex; @@ -2089,7 +2092,7 @@ static void draw_cursor(double active_cursorx, double other_cursorx, int cursor_ my_snprintf(tmpstr, S(tmpstr), "%.4g%c", gr->unitx * active_cursorx , gr->unitx_suffix); else my_snprintf(tmpstr, S(tmpstr), "%.4g", active_cursorx); - text_bbox(tmpstr, txtsize, txtsize, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, &tx1, &ty1, &tx2, &ty2, &tmp, &tmp); + text_bbox(tmpstr, txtsize, txtsize, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, &tx1, &ty1, &tx2, &ty2, &tmp, &dtmp); filledrect(0, NOW, tx1, ty1, tx2, ty2); draw_string(cursor_color, NOW, tmpstr, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, txtsize, txtsize); } @@ -2109,18 +2112,18 @@ static void draw_cursor_difference(Graph_ctx *gr) double diffw = fabs(xctx->graph_cursor2_x - xctx->graph_cursor1_x); double xx = ( a + b ) * 0.5; double yy = gr->ry2 - 1; - double tmpd; + double dtmp; double yline; if(xctx->graph_sim_type == 3) return; if(gr->unitx != 1.0) my_snprintf(tmpstr, S(tmpstr), "%.4g%c", gr->unitx * diffw , gr->unitx_suffix); else my_snprintf(tmpstr, S(tmpstr), "%.4g", diffw); - text_bbox(tmpstr, txtsize, txtsize, 2, 0, 1, 0, xx, yy, &tx1, &ty1, &tx2, &ty2, &tmp, &tmp); + text_bbox(tmpstr, txtsize, txtsize, 2, 0, 1, 0, xx, yy, &tx1, &ty1, &tx2, &ty2, &tmp, &dtmp); if( tx2 - tx1 < diff ) { draw_string(3, NOW, tmpstr, 2, 0, 1, 0, xx, yy, txtsize, txtsize); if( a > b) { - tmpd = a; a = b; b = tmpd; + dtmp = a; a = b; b = dtmp; } yline = (ty1 + ty2) * 0.5; if( tx1 - a > 4.0) drawline(3, NOW, a + 2, yline, tx1 - 2, yline, 1); diff --git a/src/editprop.c b/src/editprop.c index 1cbefc4f..f618053d 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -835,7 +835,7 @@ static void edit_text_property(int x) #endif int sel, k, text_changed, tmp; int c,l, preserve, changesize=0; - double hsize, vsize; + double hsize, vsize, dtmp; double xx1,yy1,xx2,yy2; double pcx,pcy; /* pin center 20070317 */ char property[1024];/* used for float 2 string conv (xscale and yscale) overflow safe */ @@ -892,7 +892,7 @@ static void edit_text_property(int x) text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale, xctx->text[sel].yscale, rot, flip, xctx->text[sel].hcenter, xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0, - &xx1,&yy1,&xx2,&yy2, &tmp, &tmp); + &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif @@ -913,7 +913,7 @@ static void edit_text_property(int x) text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale, xctx->text[sel].yscale, rot, flip, xctx->text[sel].hcenter, xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0, - &xx1,&yy1,&xx2,&yy2, &tmp, &tmp); + &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif @@ -980,7 +980,7 @@ static void edit_text_property(int x) text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale, xctx->text[sel].yscale, rot, flip, xctx->text[sel].hcenter, xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0, - &xx1,&yy1,&xx2,&yy2, &tmp, &tmp); + &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif diff --git a/src/findnet.c b/src/findnet.c index 776f833b..8232b0ea 100644 --- a/src/findnet.c +++ b/src/findnet.c @@ -279,7 +279,7 @@ static void find_closest_text(double mx,double my) short rot,flip; double xx1,xx2,yy1,yy2; int i,r=-1, tmp; - double threshold; + double threshold, dtmp; #if HAS_CAIRO==1 int customfont; #endif @@ -295,7 +295,7 @@ static void find_closest_text(double mx,double my) xctx->text[i].xscale, xctx->text[i].yscale, rot, flip, xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0, - &xx1,&yy1, &xx2,&yy2, &tmp, &tmp); + &xx1,&yy1, &xx2,&yy2, &tmp, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif diff --git a/src/move.c b/src/move.c index 5b2acdbd..9a2075de 100644 --- a/src/move.c +++ b/src/move.c @@ -599,7 +599,7 @@ void copy_objects(int what) { int tmpi, c, i, n, k /*, tmp */ ; xRect tmp; - double angle; + double angle, dtmp; int newpropcnt; double tmpx, tmpy; const char *str; @@ -934,7 +934,7 @@ void copy_objects(int what) xctx->text[l].yscale, xctx->text[l].rot,xctx->text[l].flip, xctx->text[l].hcenter, xctx->text[l].vcenter, xctx->text[l].x0, xctx->text[l].y0, - &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpi, &tmpi); + &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpi, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif @@ -1030,7 +1030,7 @@ void move_objects(int what, int merge, double dx, double dy) { int c, i, n, k, tmpint; xRect tmp; - double angle; + double angle, dtmp; double tx1,ty1; /* temporaries for swapping coordinates 20070302 */ #if HAS_CAIRO==1 int customfont; @@ -1448,7 +1448,7 @@ void move_objects(int what, int merge, double dx, double dy) text_bbox(xctx->text[n].txt_ptr, xctx->text[n].xscale, xctx->text[n].yscale, xctx->text[n].rot,xctx->text[n].flip, xctx->text[n].hcenter, xctx->text[n].vcenter, xctx->text[n].x0, xctx->text[n].y0, - &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &tmpint); + &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif @@ -1472,7 +1472,7 @@ void move_objects(int what, int merge, double dx, double dy) text_bbox(xctx->text[n].txt_ptr, xctx->text[n].xscale, xctx->text[n].yscale, xctx->text[n].rot,xctx->text[n].flip, xctx->text[n].hcenter, xctx->text[n].vcenter, xctx->text[n].x0, xctx->text[n].y0, - &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &tmpint); + &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif diff --git a/src/psprint.c b/src/psprint.c index f7ee4eeb..6862d364 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -264,7 +264,7 @@ static void ps_drawline(int gc, double linex1,double liney1,double linex2,double static void ps_draw_string_line(int layer, char *s, double x, double y, double size, short rot, short flip, int lineno, double fontheight, double fontascent, - double fontdescent, int llength, int no_of_lines, int longest_line) + double fontdescent, int llength, int no_of_lines, double longest_line) { double ix, iy; short rot1; @@ -343,7 +343,8 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in char c; int lineno=0; double size, height, ascent, descent; - int llength=0, no_of_lines, longest_line; + int llength=0, no_of_lines; + double longest_line; if(str==NULL) return; size = xscale*53.; @@ -417,7 +418,8 @@ static void old_ps_draw_string(int gctext, const char *str, { double a,yy,curr_x1,curr_y1,curr_x2,curr_y2,rx1,rx2,ry1,ry2; int pos=0,cc,pos2=0; - int i, no_of_lines, longest_line; + int i, no_of_lines; + double longest_line; if(str==NULL) return; #if HAS_CAIRO==1 diff --git a/src/save.c b/src/save.c index 5e353c24..6b881aca 100644 --- a/src/save.c +++ b/src/save.c @@ -2423,7 +2423,7 @@ static void calc_symbol_bbox(int pos) * count++; * rot=tt[i].rot;flip=tt[i].flip; * text_bbox(tt[i].txt_ptr, tt[i].xscale, tt[i].yscale, rot, flip, -* tt[i].x0, tt[i].y0, &rx1,&ry1,&rx2,&ry2, &tmp); +* tt[i].x0, tt[i].y0, &rx1,&ry1,&rx2,&ry2, &dtmp); * tmp.x1=rx1;tmp.y1=ry1;tmp.x2=rx2;tmp.y2=ry2; * updatebbox(count,&boundbox,&tmp); * } diff --git a/src/select.c b/src/select.c index 57af3c65..6eb08d62 100644 --- a/src/select.c +++ b/src/select.c @@ -150,7 +150,7 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2) xText text; const char *tmp_txt; short rot,flip; - double x0, y0 ; + double x0, y0, dtmp; double text_x0, text_y0; short sym_rot, sym_flip; double xx1,yy1,xx2,yy2; @@ -190,7 +190,7 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2) text_bbox(tmp_txt, text.xscale, text.yscale, (text.rot + ( (sym_flip && (text.rot & 1) ) ? sym_rot+2 : sym_rot)) &0x3, sym_flip ^ text.flip, text.hcenter, text.vcenter, - x0+text_x0,y0+text_y0, &xx1,&yy1,&xx2,&yy2, &tmp, &tmp); + x0+text_x0,y0+text_y0, &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif @@ -322,7 +322,7 @@ void delete(int to_push_undo) #if HAS_CAIRO==1 int customfont; #endif - double xx1,yy1,xx2,yy2; + double xx1,yy1,xx2,yy2, dtmp; dbg(3, "delete(): start\n"); j = 0; @@ -346,7 +346,7 @@ void delete(int to_push_undo) text_bbox(xctx->text[i].txt_ptr, xctx->text[i].xscale, xctx->text[i].yscale, select_rot, select_flip, xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0, - &xx1,&yy1, &xx2,&yy2, &tmp, &tmp); + &xx1,&yy1, &xx2,&yy2, &tmp, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif @@ -987,7 +987,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u { int c,i, tmpint; double x, y, r, a, b, xa, ya, xb, yb; /* arc */ - double xx1,yy1,xx2,yy2; + double xx1,yy1,xx2,yy2, dtmp; xRect tmp; int en_s; int select_rot = 0, select_flip = 0; @@ -1025,7 +1025,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u xctx->text[i].xscale, xctx->text[i].yscale, select_rot, select_flip, xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0, - &xx1,&yy1, &xx2,&yy2, &tmpint, &tmpint); + &xx1,&yy1, &xx2,&yy2, &tmpint, &dtmp); #if HAS_CAIRO==1 if(customfont) cairo_restore(xctx->cairo_ctx); #endif diff --git a/src/svgdraw.c b/src/svgdraw.c index d6664e09..d675fb9b 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -187,7 +187,7 @@ static void svg_drawline(int gc, int bus, double linex1,double liney1,double lin static void svg_draw_string_line(int layer, char *s, double x, double y, double size, short rot, short flip, int lineno, double fontheight, double fontascent, - double fontdescent, int llength, int no_of_lines, int longest_line) + double fontdescent, int llength, int no_of_lines, double longest_line) { double ix, iy; short rot1; @@ -256,7 +256,8 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i char c; int lineno=0; double size, height, ascent, descent; - int llength=0, no_of_lines, longest_line; + int llength=0, no_of_lines; + double longest_line; if(str==NULL) return; size = xscale*52.; @@ -319,7 +320,8 @@ static void old_svg_draw_string(int layer, const char *str, { double a,yy,curr_x1,curr_y1,curr_x2,curr_y2,rx1,rx2,ry1,ry2; int pos=0,cc,pos2=0; - int i, no_of_lines, longest_line; + int i, no_of_lines; + double longest_line; if(str==NULL) return; #if HAS_CAIRO==1 diff --git a/src/xschem.h b/src/xschem.h index d5f388d2..25af0c62 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -1092,7 +1092,7 @@ extern int set_text_custom_font(xText *txt); extern int text_bbox(const char * str,double xscale, double yscale, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, - double *rx2, double *ry2, int *cairo_lines, int *longest_line); + double *rx2, double *ry2, int *cairo_lines, double *longest_line); extern int get_color(int value); extern void incr_hilight_color(void); @@ -1106,7 +1106,7 @@ extern void hash_instances(void); /* 20171203 insert instance bbox in spatial h extern int text_bbox_nocairo(const char * str,double xscale, double yscale, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, - double *rx2, double *ry2, int *cairo_lines, int *longest_line); + double *rx2, double *ry2, int *cairo_lines, double *longest_line); #endif extern unsigned short select_object(double mx,double my, unsigned short sel_mode,