change_layer() now works also for text objects

This commit is contained in:
Stefan Frederik 2022-10-14 00:08:46 +02:00
parent 3c4d9e99fb
commit 41c62134a2
2 changed files with 36 additions and 1 deletions

View File

@ -2067,6 +2067,20 @@ void change_layer()
y2 = xctx->rect[c][n].y2;
storeobject(-1, x1,y1,x2,y2,xRECT,xctx->rectcolor, 0, xctx->rect[c][n].prop_ptr);
}
else if(type==xTEXT && xctx->text[n].sel==SELECTED) {
if(xctx->rectcolor != xctx->text[n].layer) {
char *p;
set_modify(1);
my_strdup(1386, &xctx->text[n].prop_ptr,
subst_token(xctx->text[n].prop_ptr, "layer", dtoa(xctx->rectcolor) ));
xctx->text[n].layer = xctx->rectcolor;
p = xctx->text[n].prop_ptr;
while(*p) {
if(*p == '\n') *p = ' ';
p++;
}
}
}
}
if(xctx->lastsel) delete_only_rect_line_arc_poly();
unselect_all(1);

View File

@ -193,8 +193,29 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2)
static void del_rect_line_arc_poly(void)
{
xRect tmp;
int c, j, i;
int c, j, i, k, itmp, customfont;
double dtmp;
for(k=0;k<xctx->lastsel;k++)
{
double xx1, yy1, xx2, yy2;
int n=xctx->sel_array[k].n;
int type=xctx->sel_array[k].type;
if(type==xTEXT && xctx->text[n].sel==SELECTED) {
#if HAS_CAIRO==1
customfont = set_text_custom_font(&xctx->text[n]);
#endif
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,
&xx1,&yy1,&xx2,&yy2, &itmp, &dtmp);
#if HAS_CAIRO==1
if(customfont) cairo_restore(xctx->cairo_ctx);
#endif
bbox(ADD, xx1, yy1, xx2, yy2 );
}
}
for(c=0;c<cadlayers;c++)
{
j = 0;