TEXT_TRANSLATE flag: pro-floaters addition
This commit is contained in:
parent
8be5ae7eb0
commit
2a205d298a
File diff suppressed because it is too large
Load Diff
|
|
@ -455,6 +455,12 @@
|
|||
<Component Id="cmpA09FF5912D8BA41EEB0996635BEEC9B4" Guid="{78FB528F-AE9B-4FD0-8E38-6FEB527150AF}">
|
||||
<File Id="filBA94F3BC5390F4FCD6C45DC3885F9A35" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\mos_power_ampli.sym" />
|
||||
</Component>
|
||||
<Component Id="cmpFB71DC857A280B8DAB60A4D728486301" Guid="{06B934B1-E602-4928-833A-8E80C6F5D8ED}">
|
||||
<File Id="fil3C1DD1E8A1FB40C847E9F760E91003E3" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\mos_power_ampli_extracted.sch" />
|
||||
</Component>
|
||||
<Component Id="cmpEECD7C005CB17CFFDDB6648324AA82BD" Guid="{54EB70F0-0F77-4321-9734-FE79566432A4}">
|
||||
<File Id="filBA198FC2A8A0096EB3C0D7A1CD91971E" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\mos_power_ampli_extracted.sym" />
|
||||
</Component>
|
||||
<Component Id="cmp4645F86F70A874D170C2FA99BE0AB260" Guid="{FE656FCC-CA6B-4D6B-A87F-57C509A58E71}">
|
||||
<File Id="filAE190DBFB41992DF835AA5D02698A8BE" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\MSA-2643.sch" />
|
||||
</Component>
|
||||
|
|
@ -596,6 +602,12 @@
|
|||
<Component Id="cmp67FF7D4EB6E699EEC0A31BF183FA828E" Guid="{7561011E-54C6-42BA-84F5-05F7DAB21752}">
|
||||
<File Id="fil2F44BBFE88AADBFBEF5B4B523B53C26C" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_doublepin.sym" />
|
||||
</Component>
|
||||
<Component Id="cmpC16AA3364EC55046BA68DBB76C8ED4BB" Guid="{9594A853-9699-4A46-B0A4-AF7F1D48371E}">
|
||||
<File Id="filA09BA584D59F52E8214515A03DDB6047" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_extracted_netlist.sch" />
|
||||
</Component>
|
||||
<Component Id="cmp0898DA6C877FCE7864D357A26953F87A" Guid="{A01C4B30-3880-4A65-8930-31C91909C861}">
|
||||
<File Id="fil82A165D995D6368288BB7A46B7261CCD" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_extracted_netlist.sym" />
|
||||
</Component>
|
||||
<Component Id="cmp77E0F6C53A43FB1A2E8231AA49C7A604" Guid="{62C5CBE3-D841-4D0E-A076-75414096A2DA}">
|
||||
<File Id="fil44DEAF0637B5696172643A0ED1297267" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_lm324.sch" />
|
||||
</Component>
|
||||
|
|
@ -5538,6 +5550,8 @@
|
|||
<ComponentRef Id="cmpCC1EF43542BF710C9208786B7BAAB640" />
|
||||
<ComponentRef Id="cmp6BB4D20CE5F4AB1EA408FC90F4BAAAE7" />
|
||||
<ComponentRef Id="cmpA09FF5912D8BA41EEB0996635BEEC9B4" />
|
||||
<ComponentRef Id="cmpFB71DC857A280B8DAB60A4D728486301" />
|
||||
<ComponentRef Id="cmpEECD7C005CB17CFFDDB6648324AA82BD" />
|
||||
<ComponentRef Id="cmp4645F86F70A874D170C2FA99BE0AB260" />
|
||||
<ComponentRef Id="cmp1C93C0F9C62DFC7BC3512CE705469387" />
|
||||
<ComponentRef Id="cmp79988C8256719C0A5B441B02B8ABCECD" />
|
||||
|
|
@ -5585,6 +5599,8 @@
|
|||
<ComponentRef Id="cmpAEF56BDB09D122243A6EAE07734B3F38" />
|
||||
<ComponentRef Id="cmp1CB191EAD2BF728BA3BBB51212CD9247" />
|
||||
<ComponentRef Id="cmp67FF7D4EB6E699EEC0A31BF183FA828E" />
|
||||
<ComponentRef Id="cmpC16AA3364EC55046BA68DBB76C8ED4BB" />
|
||||
<ComponentRef Id="cmp0898DA6C877FCE7864D357A26953F87A" />
|
||||
<ComponentRef Id="cmp77E0F6C53A43FB1A2E8231AA49C7A604" />
|
||||
<ComponentRef Id="cmp4B4D8B4C4B196D864383F4138BBA8B2D" />
|
||||
<ComponentRef Id="cmp7BBFD4FFD4BD205783E8852433FC5873" />
|
||||
|
|
|
|||
|
|
@ -1412,6 +1412,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
{
|
||||
xRect rect;
|
||||
int c, i;
|
||||
const char *txtptr;
|
||||
int count=0;
|
||||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
|
|
@ -1512,10 +1513,18 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
{
|
||||
int no_of_lines, longest_line;
|
||||
if(selected == 1 && !xctx->text[i].sel) continue;
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[i]);
|
||||
#endif
|
||||
if(text_bbox(xctx->text[i].txt_ptr, xctx->text[i].xscale,
|
||||
if(text_bbox(txtptr, xctx->text[i].xscale,
|
||||
xctx->text[i].yscale,xctx->text[i].rot, xctx->text[i].flip,
|
||||
xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0, xctx->text[i].y0,
|
||||
|
|
@ -2558,7 +2567,9 @@ int place_text(int draw_text, double mx, double my)
|
|||
str = get_tok_value(t->prop_ptr, "weight", 0);
|
||||
t->flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(t->prop_ptr, "hide", 0);
|
||||
t->flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
|
||||
t->flags |= strcmp(str, "true") ? 0 : TEXT_HIDE;
|
||||
str = get_tok_value(t->prop_ptr, "inst", 0);
|
||||
t->flags |= str[0] ? TEXT_TRANSLATE : 0;
|
||||
|
||||
my_strdup(21, &t->font, get_tok_value(t->prop_ptr, "font", 0));
|
||||
textlayer = t->layer;
|
||||
|
|
|
|||
16
src/draw.c
16
src/draw.c
|
|
@ -515,7 +515,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
{
|
||||
text = symptr->text[j];
|
||||
if(text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
if(symptr->text[j].flags & HIDE_TEXT) continue;
|
||||
if(symptr->text[j].flags & TEXT_HIDE) continue;
|
||||
if( hide && text.txt_ptr && strcmp(text.txt_ptr, "@symname") && strcmp(text.txt_ptr, "@name") ) continue;
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
|
|
@ -3032,12 +3032,20 @@ void draw(void)
|
|||
drawline(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
}
|
||||
if(xctx->draw_single_layer ==-1 || xctx->draw_single_layer==TEXTLAYER) {
|
||||
const char *txtptr;
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
{
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(xctx->text[i].flags & HIDE_TEXT) continue;
|
||||
if(xctx->text[i].flags & TEXT_HIDE) continue;
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
dbg(1, "draw(): drawing string %d = %s\n",i, xctx->text[i].txt_ptr);
|
||||
dbg(1, "draw(): drawing string %d = %s\n",i, txtptr);
|
||||
#if HAS_CAIRO==1
|
||||
if(!xctx->enable_layer[textlayer]) continue;
|
||||
textfont = xctx->text[i].font;
|
||||
|
|
@ -3058,7 +3066,7 @@ void draw(void)
|
|||
cairo_select_font_face (xctx->cairo_save_ctx, textfont, slant, weight);
|
||||
}
|
||||
#endif
|
||||
draw_string(textlayer, ADD, xctx->text[i].txt_ptr,
|
||||
draw_string(textlayer, ADD, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ static void edit_text_property(int x)
|
|||
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 */
|
||||
const char *str;
|
||||
const char *str, *txtptr;
|
||||
char *oldprop = NULL;
|
||||
|
||||
dbg(1, "edit_text_property(): entering\n");
|
||||
|
|
@ -884,16 +884,20 @@ static void edit_text_property(int x)
|
|||
sel=xctx->sel_array[k].n;
|
||||
rot = xctx->text[sel].rot; /* calculate bbox, some cleanup needed here */
|
||||
flip = xctx->text[sel].flip;
|
||||
if(xctx->text[sel].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[sel].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[sel].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[sel].txt_ptr;
|
||||
}
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale,
|
||||
text_bbox(txtptr, 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);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) cairo_restore(xctx->cairo_ctx);
|
||||
#endif
|
||||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
dbg(1, "edit_property(): text props: props=%s text=%s\n",
|
||||
tclgetvar("props"),
|
||||
|
|
@ -905,16 +909,6 @@ static void edit_text_property(int x)
|
|||
for(l=0;l<c;l++) {
|
||||
if(!strcmp( (get_tok_value(xctx->rect[PINLAYER][l].prop_ptr, "name",0)),
|
||||
xctx->text[sel].txt_ptr) ) {
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
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);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) cairo_restore(xctx->cairo_ctx);
|
||||
#endif
|
||||
pcx = (xctx->rect[PINLAYER][l].x1+xctx->rect[PINLAYER][l].x2)/2.0;
|
||||
pcy = (xctx->rect[PINLAYER][l].y1+xctx->rect[PINLAYER][l].y2)/2.0;
|
||||
if(
|
||||
|
|
@ -938,6 +932,9 @@ static void edit_text_property(int x)
|
|||
}
|
||||
my_strdup(74, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval"));
|
||||
}
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) cairo_restore(xctx->cairo_ctx);
|
||||
#endif
|
||||
if(x==0) {
|
||||
if(oldprop && preserve)
|
||||
set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop, 0, 0);
|
||||
|
|
@ -958,7 +955,10 @@ static void edit_text_property(int x)
|
|||
str = get_tok_value(xctx->text[sel].prop_ptr, "weight", 0);
|
||||
xctx->text[sel].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "hide", 0);
|
||||
xctx->text[sel].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
|
||||
xctx->text[sel].flags |= strcmp(str, "true") ? 0 : TEXT_HIDE;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "inst", 0);
|
||||
xctx->text[sel].flags |= str[0] ? TEXT_TRANSLATE : 0;
|
||||
|
||||
if(k == 0 ) {
|
||||
hsize =atof(tclgetvar("hsize"));
|
||||
vsize =atof(tclgetvar("vsize"));
|
||||
|
|
@ -975,7 +975,14 @@ static void edit_text_property(int x)
|
|||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale,
|
||||
if(xctx->text[sel].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[sel].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[sel].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[sel].txt_ptr;
|
||||
}
|
||||
text_bbox(txtptr, 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);
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ static void find_closest_text(double mx,double my)
|
|||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
const char *txtptr;
|
||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
{
|
||||
|
|
@ -291,7 +292,14 @@ static void find_closest_text(double mx,double my)
|
|||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[i]);
|
||||
#endif
|
||||
text_bbox(xctx->text[i].txt_ptr,
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
text_bbox(txtptr,
|
||||
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,
|
||||
|
|
|
|||
42
src/move.c
42
src/move.c
|
|
@ -192,6 +192,7 @@ void draw_selection(GC g, int interruptable)
|
|||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
const char *txtptr;
|
||||
|
||||
if(g == xctx->gc[SELLAYER]) xctx->movelastsel = xctx->lastsel;
|
||||
for(i=0;i<xctx->movelastsel;i++)
|
||||
|
|
@ -210,7 +211,15 @@ void draw_selection(GC g, int interruptable)
|
|||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[n]);
|
||||
#endif
|
||||
draw_temp_string(g,ADD, xctx->text[n].txt_ptr,
|
||||
if(xctx->text[n].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[n].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[n].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[n].txt_ptr;
|
||||
}
|
||||
|
||||
draw_temp_string(g,ADD, txtptr,
|
||||
(xctx->text[n].rot +
|
||||
( (xctx->move_flip && (xctx->text[n].rot & 1) ) ? xctx->move_rot+2 : xctx->move_rot) ) & 0x3,
|
||||
xctx->text[n].flip^xctx->move_flip, xctx->text[n].hcenter, xctx->text[n].vcenter,
|
||||
|
|
@ -607,7 +616,7 @@ void copy_objects(int what)
|
|||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
|
||||
const char *txtptr;
|
||||
if(what & START)
|
||||
{
|
||||
xctx->rotatelocal=0;
|
||||
|
|
@ -919,7 +928,10 @@ void copy_objects(int what)
|
|||
str = get_tok_value(xctx->text[xctx->texts].prop_ptr, "weight", 0);
|
||||
xctx->text[xctx->texts].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[xctx->texts].prop_ptr, "hide", 0);
|
||||
xctx->text[xctx->texts].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
|
||||
xctx->text[xctx->texts].flags |= strcmp(str, "true") ? 0 : TEXT_HIDE;
|
||||
str = get_tok_value(xctx->text[xctx->texts].prop_ptr, "inst", 0);
|
||||
xctx->text[xctx->texts].flags |= str[0] ? TEXT_TRANSLATE : 0;
|
||||
|
||||
|
||||
xctx->text[xctx->texts].xscale=xctx->text[n].xscale;
|
||||
xctx->text[xctx->texts].yscale=xctx->text[n].yscale;
|
||||
|
|
@ -929,7 +941,14 @@ void copy_objects(int what)
|
|||
#if HAS_CAIRO==1 /* bbox after copy */
|
||||
customfont = set_text_custom_font(&xctx->text[l]);
|
||||
#endif
|
||||
text_bbox(xctx->text[l].txt_ptr, xctx->text[l].xscale,
|
||||
if(xctx->text[l].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[l].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[l].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[l].txt_ptr;
|
||||
}
|
||||
text_bbox(txtptr, xctx->text[l].xscale,
|
||||
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,
|
||||
|
|
@ -951,9 +970,6 @@ void copy_objects(int what)
|
|||
|
||||
} /* end for(k=0;k<cadlayers;k++) */
|
||||
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < xctx->lastsel; i++) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type == ELEMENT) {
|
||||
|
|
@ -1035,6 +1051,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
#endif
|
||||
xLine ** const line = xctx->line;
|
||||
xWire * const wire = xctx->wire;
|
||||
const char *txtptr;
|
||||
|
||||
if(what & START)
|
||||
{
|
||||
|
|
@ -1442,7 +1459,14 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
#if HAS_CAIRO==1 /* bbox before move */
|
||||
customfont = set_text_custom_font(&xctx->text[n]);
|
||||
#endif
|
||||
text_bbox(xctx->text[n].txt_ptr, xctx->text[n].xscale,
|
||||
if(xctx->text[n].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[n].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[n].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[n].txt_ptr;
|
||||
}
|
||||
text_bbox(txtptr, 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);
|
||||
|
|
@ -1466,7 +1490,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
#if HAS_CAIRO==1 /* bbox after move */
|
||||
customfont = set_text_custom_font(&xctx->text[n]);
|
||||
#endif
|
||||
text_bbox(xctx->text[n].txt_ptr, xctx->text[n].xscale,
|
||||
text_bbox(txtptr, 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);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,10 @@ static void merge_text(FILE *fd)
|
|||
str = get_tok_value(xctx->text[i].prop_ptr, "weight", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "hide", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
|
||||
xctx->text[i].flags |= strcmp(str, "true") ? 0 : TEXT_HIDE;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
xctx->text[i].flags |= str[0] ? TEXT_TRANSLATE : 0;
|
||||
|
||||
|
||||
select_text(i,SELECTED, 1);
|
||||
set_modify(1);
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ static void fill_ps_colors()
|
|||
|
||||
}
|
||||
|
||||
static void create_ps(char **psfile, int what)
|
||||
void create_ps(char **psfile, int what)
|
||||
{
|
||||
double dx, dy, scale, scaley;
|
||||
int landscape=1;
|
||||
|
|
@ -684,7 +684,7 @@ static void create_ps(char **psfile, int what)
|
|||
xRect boundbox;
|
||||
int c,i, textlayer;
|
||||
int old_grid;
|
||||
const char *textfont;
|
||||
const char *textfont, *txtptr;
|
||||
|
||||
if(what & 1) { /* prolog */
|
||||
numpages = 0;
|
||||
|
|
@ -831,13 +831,20 @@ static void create_ps(char **psfile, int what)
|
|||
else if( xctx->text[i].flags & TEXT_OBLIQUE)
|
||||
my_snprintf(ps_font_family, S(ps_font_family), "%s-Oblique", ps_font_name);
|
||||
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
if(text_ps) {
|
||||
ps_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
ps_draw_string(textlayer, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
} else {
|
||||
old_ps_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
old_ps_draw_string(textlayer, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
|
|
|
|||
10
src/save.c
10
src/save.c
|
|
@ -1289,7 +1289,10 @@ static void load_text(FILE *fd)
|
|||
str = get_tok_value(xctx->text[i].prop_ptr, "weight", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "hide", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
|
||||
xctx->text[i].flags |= strcmp(str, "true") ? 0 : TEXT_HIDE;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
xctx->text[i].flags |= str[0] ? TEXT_TRANSLATE : 0;
|
||||
|
||||
|
||||
xctx->texts++;
|
||||
}
|
||||
|
|
@ -2807,7 +2810,10 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
str = get_tok_value(tt[i].prop_ptr, "weight", 0);
|
||||
tt[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(tt[i].prop_ptr, "hide", 0);
|
||||
tt[i].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
|
||||
tt[i].flags |= strcmp(str, "true") ? 0 : TEXT_HIDE;
|
||||
str = get_tok_value(tt[i].prop_ptr, "inst", 0);
|
||||
tt[i].flags |= str[0] ? TEXT_TRANSLATE : 0;
|
||||
|
||||
lastt++;
|
||||
break;
|
||||
case 'N': /* store wires as lines on layer WIRELAYER. */
|
||||
|
|
|
|||
44
src/select.c
44
src/select.c
|
|
@ -323,6 +323,7 @@ void delete(int to_push_undo)
|
|||
int customfont;
|
||||
#endif
|
||||
double xx1,yy1,xx2,yy2;
|
||||
const char *txtptr;
|
||||
|
||||
dbg(3, "delete(): start\n");
|
||||
j = 0;
|
||||
|
|
@ -343,7 +344,14 @@ void delete(int to_push_undo)
|
|||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[i]);
|
||||
#endif
|
||||
text_bbox(xctx->text[i].txt_ptr, xctx->text[i].xscale,
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
text_bbox(txtptr, 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);
|
||||
|
|
@ -618,11 +626,19 @@ void unselect_all(void)
|
|||
{
|
||||
if(xctx->text[i].sel == SELECTED)
|
||||
{
|
||||
const char *txtptr;
|
||||
xctx->text[i].sel = 0;
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(& xctx->text[i]); /* needed for bbox calculation */
|
||||
#endif
|
||||
draw_temp_string(xctx->gctiled,ADD, xctx->text[i].txt_ptr,
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
draw_temp_string(xctx->gctiled,ADD, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0, xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
|
|
@ -779,6 +795,7 @@ void select_text(int i,unsigned short select_mode, int fast)
|
|||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
const char *txtptr;
|
||||
|
||||
if(!fast) {
|
||||
my_strncpy(s,xctx->text[i].prop_ptr!=NULL?xctx->text[i].prop_ptr:"<NULL>",S(s));
|
||||
|
|
@ -792,13 +809,21 @@ void select_text(int i,unsigned short select_mode, int fast)
|
|||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[i]);
|
||||
#endif
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
|
||||
if(select_mode)
|
||||
draw_temp_string(xctx->gc[SELLAYER],ADD, xctx->text[i].txt_ptr,
|
||||
draw_temp_string(xctx->gc[SELLAYER],ADD, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0, xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
else
|
||||
draw_temp_string(xctx->gctiled,NOW, xctx->text[i].txt_ptr,
|
||||
draw_temp_string(xctx->gctiled,NOW, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0, xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
|
|
@ -994,6 +1019,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
const char *txtptr;
|
||||
|
||||
en_s = tclgetboolvar("enable_stretch");
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
|
|
@ -1021,7 +1047,15 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[i]);
|
||||
#endif
|
||||
text_bbox(xctx->text[i].txt_ptr,
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
|
||||
text_bbox(txtptr,
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ void svg_draw(void)
|
|||
int c,i, textlayer;
|
||||
int old_grid;
|
||||
static char lastdir[PATH_MAX] = "";
|
||||
const char *r, *textfont;
|
||||
const char *r, *textfont, *txtptr;
|
||||
int *unused_layer;
|
||||
int color;
|
||||
Hilight_hashentry *entry;
|
||||
|
|
@ -744,14 +744,20 @@ void svg_draw(void)
|
|||
my_snprintf(svg_font_style, S(svg_font_style), "italic");
|
||||
if( xctx->text[i].flags & TEXT_OBLIQUE)
|
||||
my_snprintf(svg_font_style, S(svg_font_style), "oblique");
|
||||
|
||||
if(xctx->text[i].flags & TEXT_TRANSLATE) {
|
||||
const char *inst;
|
||||
inst = get_tok_value(xctx->text[i].prop_ptr, "inst", 0);
|
||||
txtptr = translate(atoi(inst), xctx->text[i].txt_ptr);
|
||||
} else {
|
||||
txtptr = xctx->text[i].txt_ptr;
|
||||
}
|
||||
if(text_svg)
|
||||
svg_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
svg_draw_string(textlayer, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
else
|
||||
old_svg_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
old_svg_draw_string(textlayer, txtptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
|
|
|
|||
|
|
@ -266,7 +266,8 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define TEXT_OBLIQUE 2
|
||||
#define TEXT_ITALIC 4
|
||||
/* flag (.flags field) to hide text in symbols when displaying instances */
|
||||
#define HIDE_TEXT 8
|
||||
#define TEXT_HIDE 8
|
||||
#define TEXT_TRANSLATE 16
|
||||
|
||||
#define S(a) (sizeof(a)/sizeof(a[0]))
|
||||
#define BUS_WIDTH 4
|
||||
|
|
@ -463,7 +464,7 @@ typedef struct
|
|||
int layer; /* 20171201 for cairo */
|
||||
short hcenter, vcenter;
|
||||
char *font; /* 20171201 for cairo */
|
||||
int flags; /* TEXT_BOLD:1 TEXT_OBLIQUE:2 TEXT_ITALIC:4 HIDE_TEXT:8 */
|
||||
int flags; /* TEXT_BOLD:1 TEXT_OBLIQUE:2 TEXT_ITALIC:4 TEXT_HIDE:8 */
|
||||
} xText;
|
||||
|
||||
typedef struct
|
||||
|
|
@ -1390,5 +1391,6 @@ extern void del_wire_table(void);
|
|||
extern void del_object_table(void);
|
||||
extern const char *create_tmpdir(char *prefix);
|
||||
extern FILE *open_tmpfile(char *prefix, char **filename);
|
||||
extern void create_ps(char** psfile, int what);
|
||||
|
||||
#endif /*CADGLOBALS */
|
||||
|
|
|
|||
Loading…
Reference in New Issue