low level functions for floaters and floater text caches is implemented
This commit is contained in:
parent
9ea9d529f7
commit
ee1979b8b2
177
src/actions.c
177
src/actions.c
|
|
@ -79,18 +79,46 @@ unsigned int hash_file(const char *f, int skip_path_lines)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* mod=-1 used to force set title */
|
||||
int there_are_floaters(void)
|
||||
{
|
||||
int floaters = 0, k;
|
||||
for(k = 0; k < xctx->texts; k++) {
|
||||
if(xctx->text[k].flags & TEXT_FLOATER) {
|
||||
floaters = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return floaters;
|
||||
}
|
||||
|
||||
/* mod=-1 used to force set title
|
||||
* mod=-2 used to reset floaters cache */
|
||||
void set_modify(int mod)
|
||||
{
|
||||
char *top_path;
|
||||
int i, floaters = 0;
|
||||
|
||||
top_path = xctx->top_path[0] ? xctx->top_path : ".";
|
||||
if(mod != -1) xctx->modified = mod;
|
||||
if(mod != -2 && mod != -1) xctx->modified = mod;
|
||||
dbg(1, "set_modify(): %d\n", mod);
|
||||
if(mod == -1 || mod != xctx->prev_set_modify) { /* mod=-1 used to force set title */
|
||||
|
||||
if(mod == 1 || mod == -1 || mod == -2) {
|
||||
/* hash instance names if there are (many) floaters and many instances for faster lookup */
|
||||
for(i = 0; i < xctx->texts; i++)
|
||||
if(xctx->text[i].flags & TEXT_FLOATER) {
|
||||
floaters++;
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); /* clear floater cached value */
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].floater_instname); /* clear floater cached value */
|
||||
}
|
||||
if(floaters) {
|
||||
floater_hash_all_names();
|
||||
} else {
|
||||
int_hash_free(&xctx->floater_inst_table);
|
||||
}
|
||||
}
|
||||
if(mod != -2 && (mod == -1 || mod != xctx->prev_set_modify) ) { /* mod=-1 used to force set title */
|
||||
if(mod != -1) xctx->prev_set_modify = mod;
|
||||
else mod = xctx->modified;
|
||||
if(has_x && strcmp(get_cell(xctx->sch[xctx->currsch],1), "systemlib/font")) {
|
||||
char *top_path = xctx->top_path[0] ? xctx->top_path : ".";
|
||||
if(mod == 1) {
|
||||
tclvareval("wm title ", top_path, " \"xschem - [file tail [xschem get schname]]*\"", NULL);
|
||||
tclvareval("wm iconname ", top_path, " \"xschem - [file tail [xschem get schname]]*\"", NULL);
|
||||
|
|
@ -99,9 +127,9 @@ void set_modify(int mod)
|
|||
tclvareval("wm iconname ", top_path, " \"xschem - [file tail [xschem get schname]]\"", NULL);
|
||||
}
|
||||
}
|
||||
if(xctx->modified) tcleval("set_tab_names *");
|
||||
else tcleval("set_tab_names");
|
||||
}
|
||||
if(xctx->modified) tcleval("set_tab_names *");
|
||||
else tcleval("set_tab_names");
|
||||
}
|
||||
|
||||
void print_version()
|
||||
|
|
@ -546,6 +574,12 @@ void remove_symbol(int j)
|
|||
if(xctx->sym[j].text[i].font != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].font);
|
||||
}
|
||||
if(xctx->sym[j].text[i].floater_instname != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].floater_instname);
|
||||
}
|
||||
if(xctx->sym[j].text[i].floater_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].floater_ptr);
|
||||
}
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].text);
|
||||
|
||||
|
|
@ -606,6 +640,38 @@ int set_rect_flags(xRect *r)
|
|||
return f;
|
||||
}
|
||||
|
||||
const char *get_text_floater(int i)
|
||||
{
|
||||
const char *txt_ptr = xctx->text[i].txt_ptr;
|
||||
Int_hashentry *entry;
|
||||
if(xctx->text[i].flags & TEXT_FLOATER) {
|
||||
int inst = -1;
|
||||
const char *instname;
|
||||
|
||||
if(xctx->text[i].floater_instname)
|
||||
instname = xctx->text[i].floater_instname;
|
||||
else
|
||||
instname = get_tok_value(xctx->text[i].prop_ptr, "floater", 0);
|
||||
if(xctx->floater_inst_table.table) {
|
||||
entry = int_hash_lookup(&xctx->floater_inst_table, instname, 0, XLOOKUP);
|
||||
inst = entry ? entry->value : -1;
|
||||
} else {
|
||||
inst = get_instance(instname);
|
||||
}
|
||||
if(inst >= 0) {
|
||||
if(xctx->text[i].floater_ptr) {
|
||||
txt_ptr = xctx->text[i].floater_ptr;
|
||||
} else {
|
||||
/* cache floater translated text to avoid re-evaluating every time schematic is drawn */
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[i].floater_ptr, translate(inst, xctx->text[i].txt_ptr));
|
||||
txt_ptr = xctx->text[i].floater_ptr;
|
||||
}
|
||||
dbg(1, "floater: %s\n",txt_ptr);
|
||||
}
|
||||
}
|
||||
return txt_ptr;
|
||||
}
|
||||
|
||||
int set_text_flags(xText *t)
|
||||
{
|
||||
const char *str;
|
||||
|
|
@ -630,6 +696,7 @@ int set_text_flags(xText *t)
|
|||
t->flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
|
||||
str = get_tok_value(t->prop_ptr, "floater", 0);
|
||||
t->flags |= xctx->tok_size ? TEXT_FLOATER : 0;
|
||||
my_strdup2(_ALLOC_ID_, &t->floater_instname, get_tok_value(t->prop_ptr, "floater", 0));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -694,6 +761,8 @@ void clear_drawing(void)
|
|||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].font);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].floater_instname);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr);
|
||||
}
|
||||
|
|
@ -726,6 +795,7 @@ void clear_drawing(void)
|
|||
}
|
||||
dbg(1, "clear drawing(): deleted data structures, now deleting hash\n");
|
||||
int_hash_free(&xctx->inst_table);
|
||||
int_hash_free(&xctx->floater_inst_table);
|
||||
}
|
||||
|
||||
/* xctx->n_active_layers is the total number of layers for hilights. */
|
||||
|
|
@ -817,8 +887,6 @@ short connect_by_kissing(void)
|
|||
done_undo = 1;
|
||||
}
|
||||
storeobject(-1, pinx0, piny0, pinx0, piny0, WIRE, 0, SELECTED1, NULL);
|
||||
/* storeobject sets modify, but we clear it here, will be set if move operation completes */
|
||||
set_modify(0);
|
||||
changed = 1;
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
}
|
||||
|
|
@ -1135,7 +1203,6 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot
|
|||
if(draw_sym & 3) {
|
||||
bbox(ADD, xctx->inst[n].x1, xctx->inst[n].y1, xctx->inst[n].x2, xctx->inst[n].y2);
|
||||
}
|
||||
/* set_modify(1); */
|
||||
if(draw_sym&1) {
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
|
|
@ -1336,10 +1403,14 @@ void copy_symbol(xSymbol *dest_sym, xSymbol *src_sym)
|
|||
dest_sym->text[j].prop_ptr = NULL;
|
||||
dest_sym->text[j].txt_ptr = NULL;
|
||||
dest_sym->text[j].font = NULL;
|
||||
dest_sym->text[j].floater_instname = NULL;
|
||||
dest_sym->text[j].floater_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &dest_sym->text[j].prop_ptr, src_sym->text[j].prop_ptr);
|
||||
my_strdup(_ALLOC_ID_, &dest_sym->text[j].floater_ptr, src_sym->text[j].floater_ptr);
|
||||
dbg(1, "copy_symbol1(): allocating sym %d text %d\n", dest_sym - xctx->sym, j);
|
||||
my_strdup(_ALLOC_ID_, &dest_sym->text[j].txt_ptr, src_sym->text[j].txt_ptr);
|
||||
my_strdup(_ALLOC_ID_, &dest_sym->text[j].font, src_sym->text[j].font);
|
||||
my_strdup2(_ALLOC_ID_, &dest_sym->text[j].floater_instname, src_sym->text[j].floater_instname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1783,27 +1854,42 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
if(has_x && selected != 2) for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
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]);
|
||||
#endif
|
||||
if(text_bbox(xctx->text[i].txt_ptr, 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,
|
||||
&rect.x1,&rect.y1, &rect.x2,&rect.y2, &no_of_lines, &longest_line) ) {
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
if(has_x && selected != 2) {
|
||||
int floaters = 0;
|
||||
/* hash instance names if there are (many) floaters and many instances for faster lookup */
|
||||
if(xctx->floater_inst_table.table == NULL) {
|
||||
for(i = 0; i < xctx->texts; i++) {
|
||||
if(xctx->text[i].flags & TEXT_FLOATER) {
|
||||
floaters++;
|
||||
}
|
||||
}
|
||||
if(floaters) {
|
||||
floater_hash_all_names();
|
||||
}
|
||||
}
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
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]);
|
||||
#endif
|
||||
if(text_bbox(get_text_floater(i), 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,
|
||||
&rect.x1,&rect.y1, &rect.x2,&rect.y2, &no_of_lines, &longest_line) ) {
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
|
|
@ -2116,7 +2202,7 @@ static void restore_selection(double x1, double y1, double x2, double y2)
|
|||
void new_wire(int what, double mx_snap, double my_snap)
|
||||
{
|
||||
int big = xctx->wires> 2000 || xctx->instances > 2000 ;
|
||||
int s_pnetname;
|
||||
int s_pnetname, modified = 0;
|
||||
if( (what & PLACE) ) {
|
||||
s_pnetname = tclgetboolvar("show_pin_net_names");
|
||||
if( (xctx->ui_state & STARTWIRE) && (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) ) {
|
||||
|
|
@ -2127,6 +2213,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1,WIRE,0,0,NULL);
|
||||
modified = 1;
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1, 0, NULL);
|
||||
}
|
||||
|
|
@ -2135,6 +2222,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
modified = 1;
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
|
|
@ -2144,6 +2232,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
modified = 1;
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
|
|
@ -2152,6 +2241,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
modified = 1;
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
|
|
@ -2160,6 +2250,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,WIRE,0,0,NULL);
|
||||
modified = 1;
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
|
|
@ -2224,6 +2315,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
}
|
||||
}
|
||||
xctx->ui_state |= STARTWIRE;
|
||||
if(modified) set_modify(1);
|
||||
}
|
||||
if( what & END) {
|
||||
xctx->ui_state &= ~STARTWIRE;
|
||||
|
|
@ -2292,7 +2384,7 @@ void change_layer()
|
|||
{
|
||||
int k, n, type, c;
|
||||
double x1,y1,x2,y2, a, b, r;
|
||||
|
||||
int modified = 0;
|
||||
|
||||
if(xctx->lastsel) xctx->push_undo();
|
||||
for(k=0;k<xctx->lastsel; ++k)
|
||||
|
|
@ -2306,6 +2398,7 @@ void change_layer()
|
|||
x2 = xctx->line[c][n].x2;
|
||||
y2 = xctx->line[c][n].y2;
|
||||
storeobject(-1, x1,y1,x2,y2,LINE,xctx->rectcolor, 0, xctx->line[c][n].prop_ptr);
|
||||
modified = 1;
|
||||
}
|
||||
if(type==ARC && xctx->arc[c][n].sel==SELECTED) {
|
||||
x1 = xctx->arc[c][n].x;
|
||||
|
|
@ -2325,11 +2418,11 @@ void change_layer()
|
|||
x2 = xctx->rect[c][n].x2;
|
||||
y2 = xctx->rect[c][n].y2;
|
||||
storeobject(-1, x1,y1,x2,y2,xRECT,xctx->rectcolor, 0, xctx->rect[c][n].prop_ptr);
|
||||
modified = 1;
|
||||
}
|
||||
else if(type==xTEXT && xctx->text[n].sel==SELECTED) {
|
||||
if(xctx->rectcolor != xctx->text[n].layer) {
|
||||
char *p;
|
||||
set_modify(1);
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[n].prop_ptr,
|
||||
subst_token(xctx->text[n].prop_ptr, "layer", dtoa(xctx->rectcolor) ));
|
||||
xctx->text[n].layer = xctx->rectcolor;
|
||||
|
|
@ -2338,11 +2431,13 @@ void change_layer()
|
|||
if(*p == '\n') *p = ' ';
|
||||
++p;
|
||||
}
|
||||
modified = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(xctx->lastsel) delete_only_rect_line_arc_poly();
|
||||
unselect_all(1);
|
||||
if(modified) set_modify(1);
|
||||
}
|
||||
|
||||
void new_arc(int what, double sweep)
|
||||
|
|
@ -2371,6 +2466,7 @@ void new_arc(int what, double sweep)
|
|||
xctx->push_undo();
|
||||
drawarc(xctx->rectcolor, NOW, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b, 0, 0);
|
||||
store_arc(-1, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b, xctx->rectcolor, 0, NULL);
|
||||
set_modify(1);
|
||||
}
|
||||
xctx->ui_state &= ~STARTARC;
|
||||
xctx->nl_state=0;
|
||||
|
|
@ -2399,6 +2495,7 @@ void new_arc(int what, double sweep)
|
|||
|
||||
void new_line(int what)
|
||||
{
|
||||
int modified = 0;
|
||||
if( (what & PLACE) )
|
||||
{
|
||||
if( (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) && (xctx->ui_state & STARTLINE) )
|
||||
|
|
@ -2410,6 +2507,7 @@ void new_line(int what)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1,LINE,xctx->rectcolor,0,NULL);
|
||||
modified = 1;
|
||||
drawline(xctx->rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1, 0, NULL);
|
||||
}
|
||||
if(xctx->nl_yy2!=xctx->nl_yy1) {
|
||||
|
|
@ -2417,6 +2515,7 @@ void new_line(int what)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,LINE,xctx->rectcolor,0,NULL);
|
||||
modified = 1;
|
||||
drawline(xctx->rectcolor,NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
} else if(xctx->manhattan_lines==2) {
|
||||
|
|
@ -2425,6 +2524,7 @@ void new_line(int what)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2,LINE,xctx->rectcolor,0,NULL);
|
||||
modified = 1;
|
||||
drawline(xctx->rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
if(xctx->nl_xx2!=xctx->nl_xx1) {
|
||||
|
|
@ -2432,6 +2532,7 @@ void new_line(int what)
|
|||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2,LINE,xctx->rectcolor,0,NULL);
|
||||
modified = 1;
|
||||
drawline(xctx->rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -2439,8 +2540,10 @@ void new_line(int what)
|
|||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
storeobject(-1, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2,LINE,xctx->rectcolor,0,NULL);
|
||||
modified = 1;
|
||||
drawline(xctx->rectcolor,NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
if(modified) set_modify(1);
|
||||
}
|
||||
xctx->nl_x1=xctx->nl_x2=xctx->mousex_snap;xctx->nl_y1=xctx->nl_y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTLINE;
|
||||
|
|
@ -2513,6 +2616,7 @@ void new_line(int what)
|
|||
|
||||
void new_rect(int what)
|
||||
{
|
||||
int modified = 0;
|
||||
if( (what & PLACE) )
|
||||
{
|
||||
if( (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) && (xctx->ui_state & STARTRECT) )
|
||||
|
|
@ -2527,9 +2631,11 @@ void new_rect(int what)
|
|||
filledrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2);
|
||||
xctx->draw_window = save_draw;
|
||||
storeobject(-1, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2,xRECT,xctx->rectcolor, 0, NULL);
|
||||
modified = 1;
|
||||
}
|
||||
xctx->nl_x1=xctx->nl_x2=xctx->mousex_snap;xctx->nl_y1=xctx->nl_y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTRECT;
|
||||
if(modified) set_modify(1);
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
|
|
@ -2568,6 +2674,7 @@ void new_polygon(int what)
|
|||
/* fprintf(errfp, "added point: %.16g %.16g\n", xctx->nl_polyx[xctx->nl_points-1],
|
||||
xctx->nl_polyy[xctx->nl_points-1]); */
|
||||
xctx->ui_state |= STARTPOLYGON;
|
||||
set_modify(1);
|
||||
}
|
||||
if( what & ADD)
|
||||
{
|
||||
|
|
@ -2821,7 +2928,9 @@ int place_text(int draw_text, double mx, double my)
|
|||
check_text_storage();
|
||||
t->txt_ptr=NULL;
|
||||
t->prop_ptr=NULL; /* 20111006 added missing initialization of pointer */
|
||||
t->floater_ptr = NULL;
|
||||
t->font=NULL;
|
||||
t->floater_instname=NULL;
|
||||
my_strdup(_ALLOC_ID_, &t->txt_ptr, txt);
|
||||
t->x0=mx;
|
||||
t->y0=my;
|
||||
|
|
@ -2859,7 +2968,8 @@ int place_text(int draw_text, double mx, double my)
|
|||
save_draw=xctx->draw_window;
|
||||
xctx->draw_window=1;
|
||||
if(draw_text) {
|
||||
draw_string(textlayer, NOW, t->txt_ptr, 0, 0, t->hcenter, t->vcenter, t->x0,t->y0, t->xscale, t->yscale);
|
||||
draw_string(textlayer, NOW, get_text_floater(xctx->texts), 0, 0,
|
||||
t->hcenter, t->vcenter, t->x0,t->y0, t->xscale, t->yscale);
|
||||
}
|
||||
xctx->draw_window = save_draw;
|
||||
#if HAS_CAIRO==1
|
||||
|
|
@ -2873,7 +2983,6 @@ int place_text(int draw_text, double mx, double my)
|
|||
rebuild_selected_array(); /* sets xctx->ui_state |= SELECTION */
|
||||
drawtemprect(xctx->gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtempline(xctx->gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
set_modify(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
21
src/draw.c
21
src/draw.c
|
|
@ -809,8 +809,8 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
ROTATION(rot, flip, 0.0,0.0,arc->x,arc->y,x1,y1);
|
||||
drawtemparc(gc, what, x0+x1, y0+y1, arc->r, angle, arc->b);
|
||||
}
|
||||
|
||||
if(layer==PROPERTYLAYER && xctx->sym_txt)
|
||||
|
||||
if( !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && layer==SELLAYER && xctx->sym_txt)
|
||||
{
|
||||
char *txtptr = NULL;
|
||||
for(j=0;j< symptr->texts; ++j)
|
||||
|
|
@ -2707,10 +2707,10 @@ int embed_rawfile(const char *rawfile)
|
|||
if(xctx->lastsel==1 && xctx->sel_array[0].type==ELEMENT) {
|
||||
xInstance *i = &xctx->inst[xctx->sel_array[0].n];
|
||||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
ptr = base64_from_file(rawfile, &len);
|
||||
my_strdup2(_ALLOC_ID_, &i->prop_ptr, subst_token(i->prop_ptr, "spice_data", ptr));
|
||||
my_free(_ALLOC_ID_, &ptr);
|
||||
set_modify(1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -3599,7 +3599,7 @@ void draw(void)
|
|||
Instentry *instanceptr;
|
||||
Wireentry *wireptr;
|
||||
int use_hash;
|
||||
int cc, c, i = 0;
|
||||
int cc, c, i = 0 /*, floaters = 0 */;
|
||||
xSymbol *symptr;
|
||||
int textlayer;
|
||||
#if HAS_CAIRO==1
|
||||
|
|
@ -3634,6 +3634,7 @@ void draw(void)
|
|||
if(!xctx->only_probes) drawgrid();
|
||||
draw_graph_all((xctx->graph_flags & 6) + 8); /* xctx->graph_flags for cursors */
|
||||
draw_images_all();
|
||||
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
x2 = X_TO_XSCHEM(xctx->areax2);
|
||||
|
|
@ -3729,19 +3730,11 @@ void draw(void)
|
|||
if(xctx->draw_single_layer ==-1 || xctx->draw_single_layer==TEXTLAYER) {
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
const char *txt_ptr = xctx->text[i].txt_ptr;
|
||||
const char *txt_ptr;
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(!xctx->show_hidden_texts && (xctx->text[i].flags & HIDE_TEXT)) continue;
|
||||
if(xctx->only_probes) textlayer = GRIDLAYER;
|
||||
else if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
dbg(1, "draw(): drawing string %d = %s\n",i, txt_ptr);
|
||||
if(xctx->text[i].flags & TEXT_FLOATER) {
|
||||
int inst = get_instance(get_tok_value(xctx->text[i].prop_ptr, "floater", 0));
|
||||
if(inst >= 0) {
|
||||
dbg(1, "floater: %s\n", xctx->text[i].txt_ptr);
|
||||
txt_ptr = translate(inst, xctx->text[i].txt_ptr);
|
||||
}
|
||||
}
|
||||
#if HAS_CAIRO==1
|
||||
if(!xctx->enable_layer[textlayer]) continue;
|
||||
textfont = xctx->text[i].font;
|
||||
|
|
@ -3765,6 +3758,8 @@ void draw(void)
|
|||
cairo_font_face_destroy(xctx->cairo_font);
|
||||
}
|
||||
#endif
|
||||
txt_ptr = get_text_floater(i);
|
||||
dbg(1, "draw(): drawing string %d = %s\n",i, txt_ptr);
|
||||
draw_string(textlayer, ADD, txt_ptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
|
|
|
|||
428
src/editprop.c
428
src/editprop.c
|
|
@ -758,12 +758,12 @@ int count_lines_bytes(int fd, size_t *lines, size_t *bytes)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void edit_rect_property(int x)
|
||||
static int edit_rect_property(int x)
|
||||
{
|
||||
int i, c, n;
|
||||
int drw = 0;
|
||||
const char *dash, *fill;
|
||||
int preserve;
|
||||
int preserve, modified = 0;
|
||||
char *oldprop=NULL;
|
||||
my_strdup(_ALLOC_ID_, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
if(oldprop && oldprop[0]) {
|
||||
|
|
@ -785,7 +785,6 @@ static void edit_rect_property(int x)
|
|||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
for(i=0; i<xctx->lastsel; ++i) {
|
||||
if(xctx->sel_array[i].type != xRECT) continue;
|
||||
c = xctx->sel_array[i].col;
|
||||
|
|
@ -828,15 +827,17 @@ static void edit_rect_property(int x)
|
|||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
modified = 1;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &oldprop);
|
||||
return modified;
|
||||
}
|
||||
|
||||
static void edit_line_property(void)
|
||||
static int edit_line_property(void)
|
||||
{
|
||||
int i, c, n;
|
||||
const char *dash;
|
||||
int preserve;
|
||||
int preserve, modified = 0;
|
||||
char *oldprop=NULL;
|
||||
my_strdup(_ALLOC_ID_, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
if(oldprop && oldprop[0]) {
|
||||
|
|
@ -852,7 +853,6 @@ static void edit_line_property(void)
|
|||
{
|
||||
double y1, y2;
|
||||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
for(i=0; i<xctx->lastsel; ++i) {
|
||||
if(xctx->sel_array[i].type != LINE) continue;
|
||||
|
|
@ -881,14 +881,16 @@ static void edit_line_property(void)
|
|||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
modified = 1;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &oldprop);
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
static void edit_wire_property(void)
|
||||
static int edit_wire_property(void)
|
||||
{
|
||||
int i;
|
||||
int i, modified = 0;
|
||||
int preserve;
|
||||
char *oldprop=NULL;
|
||||
const char *bus_ptr;
|
||||
|
|
@ -906,7 +908,6 @@ static void edit_wire_property(void)
|
|||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
for(i=0; i<xctx->lastsel; ++i) {
|
||||
int oldbus=0;
|
||||
|
|
@ -944,18 +945,20 @@ static void edit_wire_property(void)
|
|||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
modified = 1;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &oldprop);
|
||||
return modified;
|
||||
}
|
||||
|
||||
static void edit_arc_property(void)
|
||||
static int edit_arc_property(void)
|
||||
{
|
||||
int old_fill;
|
||||
double x1, y1, x2, y2;
|
||||
int c, i, ii, old_dash, drw = 0;
|
||||
char *oldprop = NULL;
|
||||
const char *dash;
|
||||
int preserve;
|
||||
int preserve, modified = 0;
|
||||
|
||||
my_strdup(_ALLOC_ID_, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
if(oldprop && oldprop[0]) {
|
||||
|
|
@ -969,8 +972,7 @@ static void edit_arc_property(void)
|
|||
preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
|
||||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
|
||||
set_modify(1); xctx->push_undo();
|
||||
xctx->push_undo();
|
||||
for(ii=0; ii<xctx->lastsel; ii++) {
|
||||
if(xctx->sel_array[ii].type != ARC) continue;
|
||||
|
||||
|
|
@ -1011,10 +1013,12 @@ static void edit_arc_property(void)
|
|||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
modified = 1;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
static void edit_polygon_property(void)
|
||||
static int edit_polygon_property(void)
|
||||
{
|
||||
int old_fill;
|
||||
int k;
|
||||
|
|
@ -1023,7 +1027,7 @@ static void edit_polygon_property(void)
|
|||
int drw = 0;
|
||||
char *oldprop = NULL;
|
||||
const char *dash;
|
||||
int preserve;
|
||||
int preserve, modified = 0;
|
||||
|
||||
dbg(1, "edit_property(): input property:\n");
|
||||
my_strdup(_ALLOC_ID_, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
|
|
@ -1038,8 +1042,7 @@ static void edit_polygon_property(void)
|
|||
preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
|
||||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
|
||||
set_modify(1); xctx->push_undo();
|
||||
xctx->push_undo();
|
||||
for(ii=0; ii<xctx->lastsel; ii++) {
|
||||
if(xctx->sel_array[ii].type != POLYGON) continue;
|
||||
|
||||
|
|
@ -1082,169 +1085,176 @@ static void edit_polygon_property(void)
|
|||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
modified = 1;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
||||
/* x=0 use text widget x=1 use vim editor */
|
||||
static void edit_text_property(int x)
|
||||
static int edit_text_property(int x)
|
||||
{
|
||||
int rot, flip;
|
||||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
int sel, k, text_changed = 0, props_changed = 0, size_changed = 0, tmp;
|
||||
int c,l, preserve;
|
||||
double hsize, vsize, dtmp;
|
||||
double xx1,yy1,xx2,yy2;
|
||||
double pcx,pcy; /* pin center 20070317 */
|
||||
char property[100];/* used for float 2 string conv (xscale and yscale) overflow safe */
|
||||
/* const char *str; */
|
||||
char *oldprop = NULL;
|
||||
int rot, flip, modified = 0;
|
||||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
int sel, k, text_changed = 0, props_changed = 0, size_changed = 0, tmp;
|
||||
int c,l, preserve;
|
||||
double hsize, vsize, dtmp;
|
||||
double xx1,yy1,xx2,yy2;
|
||||
double pcx,pcy; /* pin center 20070317 */
|
||||
char property[100];/* used for float 2 string conv (xscale and yscale) overflow safe */
|
||||
/* const char *str; */
|
||||
char *oldprop = NULL;
|
||||
|
||||
dbg(1, "edit_text_property(): entering\n");
|
||||
sel = xctx->sel_array[0].n;
|
||||
my_strdup(_ALLOC_ID_, &oldprop, xctx->text[sel].prop_ptr);
|
||||
if(oldprop && oldprop[0])
|
||||
tclsetvar("props", oldprop);
|
||||
else
|
||||
tclsetvar("props","");
|
||||
tclsetvar("retval",xctx->text[sel].txt_ptr);
|
||||
my_snprintf(property, S(property), "%.16g",xctx->text[sel].yscale);
|
||||
tclsetvar("vsize",property);
|
||||
my_snprintf(property, S(property), "%.16g",xctx->text[sel].xscale);
|
||||
tclsetvar("hsize",property);
|
||||
if(x==0) {
|
||||
const char *props;
|
||||
xctx->semaphore++;
|
||||
tcleval("enter_text {text:} normal");
|
||||
xctx->semaphore--;
|
||||
hsize =atof(tclgetvar("hsize"));
|
||||
vsize =atof(tclgetvar("vsize"));
|
||||
props = tclgetvar("props");
|
||||
if(xctx->text[sel].xscale != hsize || xctx->text[sel].yscale != vsize) {
|
||||
size_changed = 1;
|
||||
}
|
||||
if( (oldprop && strcmp(oldprop, tclgetvar("props"))) || (!oldprop && props[0]) ) props_changed = 1;
|
||||
}
|
||||
else if(x==2) tcleval("viewdata $::retval");
|
||||
else if(x==1) tcleval("edit_vi_prop {Text:}");
|
||||
else {
|
||||
fprintf(errfp, "edit_text_property() : unknown parameter x=%d\n",x); exit(EXIT_FAILURE);
|
||||
}
|
||||
preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
|
||||
if(x == 0 || x == 1) {
|
||||
if(strcmp(xctx->text[sel].txt_ptr, tclgetvar("retval") ) ) {
|
||||
dbg(1, "edit_text_property(): x=%d, text_changed=1\n", x);
|
||||
text_changed=1;
|
||||
}
|
||||
}
|
||||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
dbg(1, "edit_text_property(): rcode !=\"\"\n");
|
||||
if(text_changed || size_changed || props_changed) {
|
||||
set_modify(1);
|
||||
xctx->push_undo();
|
||||
}
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
for(k=0;k<xctx->lastsel; ++k)
|
||||
{
|
||||
if(xctx->sel_array[k].type!=xTEXT) continue;
|
||||
sel=xctx->sel_array[k].n;
|
||||
rot = xctx->text[sel].rot; /* calculate bbox, some cleanup needed here */
|
||||
flip = xctx->text[sel].flip;
|
||||
#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, (short)rot, (short)flip, xctx->text[sel].hcenter,
|
||||
dbg(1, "edit_text_property(): entering\n");
|
||||
sel = xctx->sel_array[0].n;
|
||||
my_strdup(_ALLOC_ID_, &oldprop, xctx->text[sel].prop_ptr);
|
||||
if(oldprop && oldprop[0])
|
||||
tclsetvar("props", oldprop);
|
||||
else
|
||||
tclsetvar("props","");
|
||||
tclsetvar("retval",xctx->text[sel].txt_ptr);
|
||||
my_snprintf(property, S(property), "%.16g",xctx->text[sel].yscale);
|
||||
tclsetvar("vsize",property);
|
||||
my_snprintf(property, S(property), "%.16g",xctx->text[sel].xscale);
|
||||
tclsetvar("hsize",property);
|
||||
if(x==0) {
|
||||
const char *props;
|
||||
xctx->semaphore++;
|
||||
tcleval("enter_text {text:} normal");
|
||||
xctx->semaphore--;
|
||||
hsize =atof(tclgetvar("hsize"));
|
||||
vsize =atof(tclgetvar("vsize"));
|
||||
props = tclgetvar("props");
|
||||
if(xctx->text[sel].xscale != hsize || xctx->text[sel].yscale != vsize) {
|
||||
size_changed = 1;
|
||||
}
|
||||
if( (oldprop && strcmp(oldprop, tclgetvar("props"))) || (!oldprop && props[0]) ) props_changed = 1;
|
||||
}
|
||||
else if(x==2) tcleval("viewdata $::retval");
|
||||
else if(x==1) tcleval("edit_vi_prop {Text:}");
|
||||
else {
|
||||
fprintf(errfp, "edit_text_property() : unknown parameter x=%d\n",x); exit(EXIT_FAILURE);
|
||||
}
|
||||
preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
|
||||
if(x == 0 || x == 1) {
|
||||
if(strcmp(xctx->text[sel].txt_ptr, tclgetvar("retval") ) ) {
|
||||
dbg(1, "edit_text_property(): x=%d, text_changed=1\n", x);
|
||||
text_changed=1;
|
||||
}
|
||||
}
|
||||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
dbg(1, "edit_text_property(): rcode !=\"\"\n");
|
||||
if(text_changed || size_changed || props_changed) {
|
||||
modified = 1;
|
||||
xctx->push_undo();
|
||||
}
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
for(k=0;k<xctx->lastsel; ++k)
|
||||
{
|
||||
if(xctx->sel_array[k].type!=xTEXT) continue;
|
||||
sel=xctx->sel_array[k].n;
|
||||
rot = xctx->text[sel].rot; /* calculate bbox, some cleanup needed here */
|
||||
flip = xctx->text[sel].flip;
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
text_bbox(get_text_floater(sel), xctx->text[sel].xscale,
|
||||
xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter,
|
||||
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
/* dbg(1, "edit_property(): text props=%s text=%s\n", tclgetvar("props"), tclgetvar("retval")); */
|
||||
if(text_changed) {
|
||||
double cg;
|
||||
cg = tclgetdoublevar("cadgrid");
|
||||
c = xctx->rects[PINLAYER];
|
||||
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(get_text_floater(sel), xctx->text[sel].xscale,
|
||||
xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter,
|
||||
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
|
||||
#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(
|
||||
/* 20171206 20171221 */
|
||||
(fabs( (yy1+yy2)/2 - pcy) < cg/2 &&
|
||||
(fabs(xx1 - pcx) < cg*3 || fabs(xx2 - pcx) < cg*3) )
|
||||
||
|
||||
(fabs( (xx1+xx2)/2 - pcx) < cg/2 &&
|
||||
(fabs(yy1 - pcy) < cg*3 || fabs(yy2 - pcy) < cg*3) )
|
||||
) {
|
||||
if(x==0)
|
||||
my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
|
||||
(char *) tclgetvar("retval")) );
|
||||
else
|
||||
my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
|
||||
(char *) tclgetvar("retval")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval"));
|
||||
}
|
||||
if(x==0 && props_changed) {
|
||||
if(oldprop && preserve)
|
||||
set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop);
|
||||
else
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props"));
|
||||
|
||||
my_free(_ALLOC_ID_, &xctx->text[sel].floater_ptr);
|
||||
set_text_flags(&xctx->text[sel]);
|
||||
}
|
||||
if(size_changed) {
|
||||
xctx->text[sel].xscale=hsize;
|
||||
xctx->text[sel].yscale=vsize;
|
||||
}
|
||||
/* calculate bbox, some cleanup needed here */
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
text_bbox(get_text_floater(sel), xctx->text[sel].xscale,
|
||||
xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter,
|
||||
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
/* dbg(1, "edit_property(): text props=%s text=%s\n", tclgetvar("props"), tclgetvar("retval")); */
|
||||
if(text_changed) {
|
||||
double cg;
|
||||
cg = tclgetdoublevar("cadgrid");
|
||||
c = xctx->rects[PINLAYER];
|
||||
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, (short)rot, (short)flip, xctx->text[sel].hcenter,
|
||||
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
|
||||
#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(
|
||||
/* 20171206 20171221 */
|
||||
(fabs( (yy1+yy2)/2 - pcy) < cg/2 &&
|
||||
(fabs(xx1 - pcx) < cg*3 || fabs(xx2 - pcx) < cg*3) )
|
||||
||
|
||||
(fabs( (xx1+xx2)/2 - pcx) < cg/2 &&
|
||||
(fabs(yy1 - pcy) < cg*3 || fabs(yy2 - pcy) < cg*3) )
|
||||
) {
|
||||
if(x==0)
|
||||
my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
|
||||
(char *) tclgetvar("retval")) );
|
||||
else
|
||||
my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
|
||||
(char *) tclgetvar("retval")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval"));
|
||||
}
|
||||
if(x==0 && props_changed) {
|
||||
if(oldprop && preserve)
|
||||
set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop);
|
||||
else
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props"));
|
||||
set_text_flags(&xctx->text[sel]);
|
||||
}
|
||||
if(size_changed) {
|
||||
xctx->text[sel].xscale=hsize;
|
||||
xctx->text[sel].yscale=vsize;
|
||||
}
|
||||
/* calculate bbox, some cleanup needed here */
|
||||
#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, (short)rot, (short)flip, xctx->text[sel].hcenter,
|
||||
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
}
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
bbox(END,0.0,0.0,0.0,0.0);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &oldprop);
|
||||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
}
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
bbox(END,0.0,0.0,0.0,0.0);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &oldprop);
|
||||
return modified;
|
||||
}
|
||||
|
||||
/* x=0 use text widget x=1 use vim editor */
|
||||
static void update_symbol(const char *result, int x)
|
||||
static int update_symbol(const char *result, int x)
|
||||
{
|
||||
int k, sym_number;
|
||||
int no_change_props=0;
|
||||
|
|
@ -1258,13 +1268,15 @@ static void update_symbol(const char *result, int x)
|
|||
int pushed=0;
|
||||
int *ii = &xctx->edit_sym_i; /* static var */
|
||||
int *netl_com = &xctx->netlist_commands; /* static var */
|
||||
int floaters, modified = 0;
|
||||
|
||||
floaters = there_are_floaters();
|
||||
dbg(1, "update_symbol(): entering\n");
|
||||
*ii=xctx->sel_array[0].n;
|
||||
if(!result) {
|
||||
dbg(1, "update_symbol(): edit symbol prop aborted\n");
|
||||
my_free(_ALLOC_ID_, &xctx->old_prop);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
/* create new_prop updated attribute string */
|
||||
if(*netl_com && x==1) {
|
||||
|
|
@ -1283,7 +1295,7 @@ static void update_symbol(const char *result, int x)
|
|||
no_change_props=atoi(tclgetvar("no_change_attrs") );
|
||||
only_different=atoi(tclgetvar("preserve_unchanged_attrs") );
|
||||
copy_cell=atoi(tclgetvar("user_wants_copy_cell") );
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
if(!floaters) bbox(START,0.0,0.0,0.0,0.0);
|
||||
/* 20191227 necessary? --> Yes since a symbol copy has already been done
|
||||
in edit_symbol_property() -> tcl edit_prop, this ensures new symbol is loaded from disk.
|
||||
if for some reason a symbol with matching name is loaded in xschem this
|
||||
|
|
@ -1304,8 +1316,8 @@ static void update_symbol(const char *result, int x)
|
|||
/* 20171220 calculate bbox before changes to correctly redraw areas */
|
||||
/* must be recalculated as cairo text extents vary with zoom factor. */
|
||||
symbol_bbox(*ii, &xctx->inst[*ii].x1, &xctx->inst[*ii].y1, &xctx->inst[*ii].x2, &xctx->inst[*ii].y2);
|
||||
bbox(ADD, xctx->inst[*ii].x1, xctx->inst[*ii].y1, xctx->inst[*ii].x2, xctx->inst[*ii].y2);
|
||||
|
||||
if(!floaters)
|
||||
bbox(ADD, xctx->inst[*ii].x1, xctx->inst[*ii].y1, xctx->inst[*ii].x2, xctx->inst[*ii].y2);
|
||||
my_strdup2(_ALLOC_ID_, &old_translated_sym, translate(*ii, xctx->inst[*ii].name));
|
||||
|
||||
/* update property string from tcl dialog */
|
||||
|
|
@ -1315,7 +1327,7 @@ static void update_symbol(const char *result, int x)
|
|||
char * ss=NULL;
|
||||
my_strdup(_ALLOC_ID_, &ss, xctx->inst[*ii].prop_ptr);
|
||||
if( set_different_token(&ss, new_prop, xctx->old_prop) ) {
|
||||
if(!pushed) { xctx->push_undo(); pushed=1; set_modify(1);}
|
||||
if(!pushed) { xctx->push_undo(); pushed=1;}
|
||||
my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, ss);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &ss);
|
||||
|
|
@ -1325,12 +1337,12 @@ static void update_symbol(const char *result, int x)
|
|||
if(!xctx->inst[*ii].prop_ptr || strcmp(xctx->inst[*ii].prop_ptr, new_prop)) {
|
||||
dbg(1, "update_symbol(): changing prop: |%s| -> |%s|\n",
|
||||
xctx->inst[*ii].prop_ptr, new_prop);
|
||||
if(!pushed) { xctx->push_undo(); pushed=1; set_modify(1);}
|
||||
if(!pushed) { xctx->push_undo(); pushed=1;}
|
||||
dbg(1, "update_symbol(): *ii=%d, new_prop=%s\n", *ii, new_prop ? new_prop : "NULL");
|
||||
my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, new_prop);
|
||||
}
|
||||
} else {
|
||||
if(!pushed) { xctx->push_undo(); pushed=1; set_modify(1);}
|
||||
if(!pushed) { xctx->push_undo(); pushed=1;}
|
||||
my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, "");
|
||||
}
|
||||
}
|
||||
|
|
@ -1352,7 +1364,7 @@ static void update_symbol(const char *result, int x)
|
|||
|
||||
if(sym_number>=0) /* changing symbol ! */
|
||||
{
|
||||
if(!pushed) { xctx->push_undo(); pushed=1; set_modify(1);}
|
||||
if(!pushed) { xctx->push_undo(); pushed=1;}
|
||||
delete_inst_node(*ii); /* 20180208 fix crashing bug: delete node info if changing symbol */
|
||||
/* if number of pins is different we must delete these data *before* */
|
||||
/* changing ysmbol, otherwise *ii might end up deleting non allocated data. */
|
||||
|
|
@ -1423,35 +1435,40 @@ static void update_symbol(const char *result, int x)
|
|||
xctx->inst[*ii].embed = !strcmp(get_tok_value(xctx->inst[*ii].prop_ptr, "embed", 2), "true");
|
||||
|
||||
} /* end for(k=0;k<xctx->lastsel; ++k) */
|
||||
|
||||
if(pushed) modified = 1;
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
if(xctx->modified) {
|
||||
if(modified) {
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
find_inst_to_be_redrawn(1 + 4 + 32); /* 32: call prepare_netlist_structs(0) */
|
||||
find_inst_to_be_redrawn(16); /* clear data */
|
||||
if(!floaters) {
|
||||
find_inst_to_be_redrawn(1 + 4 + 32); /* 32: call prepare_netlist_structs(0) */
|
||||
find_inst_to_be_redrawn(16); /* clear data */
|
||||
}
|
||||
if(xctx->hilight_nets) {
|
||||
propagate_hilights(1, 1, XINSERT_NOREPLACE);
|
||||
}
|
||||
}
|
||||
/* redraw symbol with new props */
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
if(!floaters) bbox(SET,0.0,0.0,0.0,0.0);
|
||||
else set_modify(-2); /* reset floaters caches */
|
||||
dbg(1, "update_symbol(): redrawing inst_ptr.txtprop string\n");
|
||||
draw();
|
||||
bbox(END,0.0,0.0,0.0,0.0);
|
||||
if(!floaters) bbox(END,0.0,0.0,0.0,0.0);
|
||||
my_free(_ALLOC_ID_, &name);
|
||||
my_free(_ALLOC_ID_, &ptr);
|
||||
my_free(_ALLOC_ID_, &new_prop);
|
||||
my_free(_ALLOC_ID_, &xctx->old_prop);
|
||||
return modified;
|
||||
}
|
||||
|
||||
/* x=0 use text widget x=1 use vim editor */
|
||||
static void edit_symbol_property(int x)
|
||||
static int edit_symbol_property(int x)
|
||||
{
|
||||
char *result=NULL;
|
||||
int *ii = &xctx->edit_sym_i; /* static var */
|
||||
int *netl_com = &xctx->netlist_commands; /* static var */
|
||||
int modified = 0;
|
||||
|
||||
*ii=xctx->sel_array[0].n;
|
||||
*netl_com = 0;
|
||||
|
|
@ -1485,10 +1502,11 @@ static void edit_symbol_property(int x)
|
|||
my_strdup(_ALLOC_ID_, &result, tclresult());
|
||||
}
|
||||
dbg(1, "edit_symbol_property(): before update_symbol, modified=%d\n", xctx->modified);
|
||||
update_symbol(result, x);
|
||||
modified = update_symbol(result, x);
|
||||
my_free(_ALLOC_ID_, &result);
|
||||
dbg(1, "edit_symbol_property(): done update_symbol, modified=%d\n", xctx->modified);
|
||||
dbg(1, "edit_symbol_property(): done update_symbol, modified=%d\n", modified);
|
||||
*ii=-1;
|
||||
return modified;
|
||||
}
|
||||
|
||||
void change_elem_order(void)
|
||||
|
|
@ -1497,7 +1515,7 @@ void change_elem_order(void)
|
|||
xRect tmpbox;
|
||||
xWire tmpwire;
|
||||
char tmp_txt[50]; /* overflow safe */
|
||||
int c, new_n;
|
||||
int c, new_n, modified = 0;
|
||||
|
||||
rebuild_selected_array();
|
||||
if(xctx->lastsel==1)
|
||||
|
|
@ -1510,7 +1528,7 @@ void change_elem_order(void)
|
|||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
modified = 1;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
|
|
@ -1547,6 +1565,7 @@ void change_elem_order(void)
|
|||
dbg(1, "change_elem_order(): selected element %d\n", xctx->sel_array[0].n);
|
||||
}
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
if(modified) set_modify(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1610,7 +1629,7 @@ char *str_chars_replace(const char *str, const char *replace_set, const char wit
|
|||
/* x=0 use tcl text widget x=1 use vim editor x=2 only view data */
|
||||
void edit_property(int x)
|
||||
{
|
||||
int j;
|
||||
int j, modified = 0;
|
||||
|
||||
if(!has_x) return;
|
||||
rebuild_selected_array(); /* from the .sel field in objects build */
|
||||
|
|
@ -1671,27 +1690,32 @@ void edit_property(int x)
|
|||
{
|
||||
if(xctx->netlist_type==CAD_SYMBOL_ATTRS &&
|
||||
(!xctx->schsymbolprop || strcmp(xctx->schsymbolprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); xctx->push_undo();
|
||||
xctx->push_undo();
|
||||
modified = 1;
|
||||
my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(xctx->netlist_type==CAD_VERILOG_NETLIST &&
|
||||
(!xctx->schverilogprop || strcmp(xctx->schverilogprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); xctx->push_undo();
|
||||
modified = 1;
|
||||
xctx->push_undo();
|
||||
my_strdup(_ALLOC_ID_, &xctx->schverilogprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(xctx->netlist_type==CAD_SPICE_NETLIST &&
|
||||
(!xctx->schprop || strcmp(xctx->schprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); xctx->push_undo();
|
||||
modified = 1;
|
||||
xctx->push_undo();
|
||||
my_strdup(_ALLOC_ID_, &xctx->schprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(xctx->netlist_type==CAD_TEDAX_NETLIST &&
|
||||
(!xctx->schtedaxprop || strcmp(xctx->schtedaxprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); xctx->push_undo();
|
||||
modified = 1;
|
||||
xctx->push_undo();
|
||||
my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(xctx->netlist_type==CAD_VHDL_NETLIST &&
|
||||
(!xctx->schvhdlprop || strcmp(xctx->schvhdlprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); xctx->push_undo();
|
||||
modified = 1;
|
||||
xctx->push_undo();
|
||||
my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, (char *) tclgetvar("retval"));
|
||||
}
|
||||
}
|
||||
|
|
@ -1722,13 +1746,13 @@ void edit_property(int x)
|
|||
switch(xctx->sel_array[0].type)
|
||||
{
|
||||
case ELEMENT:
|
||||
edit_symbol_property(x);
|
||||
modified |= edit_symbol_property(x);
|
||||
while( x == 0 && tclgetvar("edit_symbol_prop_new_sel")[0] == '1' ) {
|
||||
unselect_all(1);
|
||||
select_object(xctx->mousex, xctx->mousey, SELECTED, 0);
|
||||
rebuild_selected_array();
|
||||
if(xctx->lastsel && xctx->sel_array[0].type ==ELEMENT) {
|
||||
edit_symbol_property(0);
|
||||
modified |= edit_symbol_property(0);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
@ -1736,25 +1760,25 @@ void edit_property(int x)
|
|||
tclsetvar("edit_symbol_prop_new_sel", "");
|
||||
break;
|
||||
case ARC:
|
||||
edit_arc_property();
|
||||
modified |= edit_arc_property();
|
||||
break;
|
||||
case xRECT:
|
||||
edit_rect_property(x);
|
||||
modified |= edit_rect_property(x);
|
||||
break;
|
||||
case WIRE:
|
||||
edit_wire_property();
|
||||
modified |= edit_wire_property();
|
||||
break;
|
||||
case POLYGON:
|
||||
edit_polygon_property();
|
||||
modified |= edit_polygon_property();
|
||||
break;
|
||||
case LINE:
|
||||
edit_line_property();
|
||||
modified |= edit_line_property();
|
||||
break;
|
||||
case xTEXT:
|
||||
edit_text_property(x);
|
||||
modified |= edit_text_property(x);
|
||||
break;
|
||||
}
|
||||
|
||||
if(modified) set_modify(1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ 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,
|
||||
text_bbox(get_text_floater(i),
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ static void free_undo_texts(int slot)
|
|||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_instname);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_ptr);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr);
|
||||
xctx->uslot[slot].texts = 0;
|
||||
|
|
@ -174,6 +176,12 @@ static void free_undo_symbols(int slot)
|
|||
if(sym->text[j].font != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->text[j].font);
|
||||
}
|
||||
if(sym->text[j].floater_instname != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->text[j].floater_instname);
|
||||
}
|
||||
if(sym->text[j].floater_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->text[j].floater_ptr);
|
||||
}
|
||||
}
|
||||
my_free(_ALLOC_ID_, &sym->text);
|
||||
sym->texts = 0;
|
||||
|
|
@ -352,9 +360,13 @@ void mem_push_undo(void)
|
|||
xctx->uslot[slot].tptr[i].prop_ptr = NULL;
|
||||
xctx->uslot[slot].tptr[i].txt_ptr = NULL;
|
||||
xctx->uslot[slot].tptr[i].font = NULL;
|
||||
xctx->uslot[slot].tptr[i].floater_instname = NULL;
|
||||
xctx->uslot[slot].tptr[i].floater_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr, xctx->text[i].prop_ptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr, xctx->text[i].txt_ptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font, xctx->text[i].font);
|
||||
my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_instname, xctx->text[i].floater_instname);
|
||||
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_ptr, xctx->text[i].floater_ptr);
|
||||
}
|
||||
|
||||
/* wires */
|
||||
|
|
@ -512,10 +524,14 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
xctx->text[i] = xctx->uslot[slot].tptr[i];
|
||||
xctx->text[i].txt_ptr = NULL;
|
||||
xctx->text[i].font = NULL;
|
||||
xctx->text[i].floater_instname = NULL;
|
||||
xctx->text[i].floater_ptr = NULL;
|
||||
xctx->text[i].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[i].prop_ptr, xctx->uslot[slot].tptr[i].prop_ptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[i].txt_ptr, xctx->uslot[slot].tptr[i].txt_ptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[i].font, xctx->uslot[slot].tptr[i].font);
|
||||
my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_instname, xctx->uslot[slot].tptr[i].floater_instname);
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[i].floater_ptr, xctx->uslot[slot].tptr[i].floater_ptr);
|
||||
}
|
||||
|
||||
/* wires */
|
||||
|
|
|
|||
68
src/move.c
68
src/move.c
|
|
@ -210,7 +210,7 @@ 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,
|
||||
draw_temp_string(g,ADD, get_text_floater(n),
|
||||
(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,
|
||||
|
|
@ -661,15 +661,17 @@ void copy_objects(int what)
|
|||
if(what & END) /* copy selected objects */
|
||||
{
|
||||
int l, firstw, firsti;
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
int floaters = there_are_floaters();
|
||||
if(!floaters) bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
newpropcnt=0;
|
||||
set_modify(1); xctx->push_undo(); /* 20150327 push_undo */
|
||||
xctx->push_undo();
|
||||
|
||||
firstw = firsti = 1;
|
||||
|
||||
draw_selection(xctx->gctiled,0);
|
||||
update_symbol_bboxes(0, 0);
|
||||
find_inst_to_be_redrawn(0); /* build list before copying and recalculating prepare_netlist_structs() */
|
||||
/* build list before copying and recalculating prepare_netlist_structs() */
|
||||
if(!floaters) find_inst_to_be_redrawn(0);
|
||||
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
|
|
@ -718,13 +720,13 @@ void copy_objects(int what)
|
|||
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
|
||||
if(xctx->wire[l].y1 < xctx->wire[l].y2) { y1 = xctx->wire[l].y1-ov; y2 = xctx->wire[l].y2+ov; }
|
||||
else { y1 = xctx->wire[l].y1+ov; y2 = xctx->wire[l].y2-ov; }
|
||||
bbox(ADD, xctx->wire[l].x1-ov, y1 , xctx->wire[l].x2+ov , y2 );
|
||||
if(!floaters) bbox(ADD, xctx->wire[l].x1-ov, y1 , xctx->wire[l].x2+ov , y2 );
|
||||
} else {
|
||||
double ov, y1, y2;
|
||||
ov = cadhalfdotsize;
|
||||
if(xctx->wire[l].y1 < xctx->wire[l].y2) { y1 = xctx->wire[l].y1-ov; y2 = xctx->wire[l].y2+ov; }
|
||||
else { y1 = xctx->wire[l].y1+ov; y2 = xctx->wire[l].y2-ov; }
|
||||
bbox(ADD, xctx->wire[l].x1-ov, y1 , xctx->wire[l].x2+ov , y2 );
|
||||
if(!floaters) bbox(ADD, xctx->wire[l].x1-ov, y1 , xctx->wire[l].x2+ov , y2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -779,14 +781,14 @@ void copy_objects(int what)
|
|||
if(xctx->line[c][l].y1 < xctx->line[c][l].y2)
|
||||
{ y1 = xctx->line[c][l].y1-ov; y2 = xctx->line[c][l].y2+ov; }
|
||||
else { y1 = xctx->line[c][l].y1+ov; y2 = xctx->line[c][l].y2-ov; }
|
||||
bbox(ADD, xctx->line[c][l].x1-ov, y1 , xctx->line[c][l].x2+ov , y2 );
|
||||
if(!floaters) bbox(ADD, xctx->line[c][l].x1-ov, y1 , xctx->line[c][l].x2+ov , y2 );
|
||||
} else {
|
||||
double ov, y1, y2;
|
||||
ov = cadhalfdotsize;
|
||||
if(xctx->line[c][l].y1 < xctx->line[c][l].y2)
|
||||
{ y1 = xctx->line[c][l].y1-ov; y2 = xctx->line[c][l].y2+ov; }
|
||||
else { y1 = xctx->line[c][l].y1+ov; y2 = xctx->line[c][l].y2-ov; }
|
||||
bbox(ADD, xctx->line[c][l].x1-ov, y1 , xctx->line[c][l].x2+ov , y2 );
|
||||
if(!floaters) bbox(ADD, xctx->line[c][l].x1-ov, y1 , xctx->line[c][l].x2+ov , y2 );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -816,7 +818,7 @@ void copy_objects(int what)
|
|||
if(j==0 || x[j] > bx2) bx2 = x[j];
|
||||
if(j==0 || y[j] > by2) by2 = y[j];
|
||||
}
|
||||
bbox(ADD, bx1, by1, bx2, by2);
|
||||
if(!floaters) bbox(ADD, bx1, by1, bx2, by2);
|
||||
xctx->sel_array[i].n=xctx->polygons[c];
|
||||
store_poly(-1, x, y, p->points, c, p->sel, p->prop_ptr);
|
||||
p->sel=0;
|
||||
|
|
@ -849,14 +851,16 @@ void copy_objects(int what)
|
|||
xctx->arc[c][n].r, angle, xctx->arc[c][n].b, c, SELECTED, xctx->arc[c][n].prop_ptr);
|
||||
|
||||
l = xctx->arcs[c] - 1;
|
||||
if(xctx->arc[c][l].fill)
|
||||
arc_bbox(xctx->arc[c][l].x, xctx->arc[c][l].y, xctx->arc[c][l].r, 0, 360,
|
||||
&tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
else
|
||||
arc_bbox(xctx->arc[c][l].x, xctx->arc[c][l].y, xctx->arc[c][l].r,
|
||||
xctx->arc[c][l].a, xctx->arc[c][n].b,
|
||||
&tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
bbox(ADD, tmp.x1, tmp.y1, tmp.x2, tmp.y2);
|
||||
if(!floaters) {
|
||||
if(xctx->arc[c][l].fill) {
|
||||
arc_bbox(xctx->arc[c][l].x, xctx->arc[c][l].y, xctx->arc[c][l].r,
|
||||
0, 360, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
} else {
|
||||
arc_bbox(xctx->arc[c][l].x, xctx->arc[c][l].y, xctx->arc[c][l].r,
|
||||
xctx->arc[c][l].a, xctx->arc[c][n].b, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
}
|
||||
bbox(ADD, tmp.x1, tmp.y1, tmp.x2, tmp.y2);
|
||||
}
|
||||
break;
|
||||
|
||||
case xRECT:
|
||||
|
|
@ -879,7 +883,7 @@ void copy_objects(int what)
|
|||
storeobject(-1, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
|
||||
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay,xRECT, c, SELECTED, xctx->rect[c][n].prop_ptr);
|
||||
l = xctx->rects[c] - 1;
|
||||
bbox(ADD, xctx->rect[c][l].x1, xctx->rect[c][l].y1, xctx->rect[c][l].x2, xctx->rect[c][l].y2);
|
||||
if(!floaters) bbox(ADD, xctx->rect[c][l].x1, xctx->rect[c][l].y1, xctx->rect[c][l].x2, xctx->rect[c][l].y2);
|
||||
break;
|
||||
|
||||
case xTEXT:
|
||||
|
|
@ -905,7 +909,10 @@ void copy_objects(int what)
|
|||
xctx->text[xctx->texts].sel=SELECTED;
|
||||
xctx->text[xctx->texts].prop_ptr=NULL;
|
||||
xctx->text[xctx->texts].font=NULL;
|
||||
xctx->text[xctx->texts].floater_instname=NULL;
|
||||
xctx->text[xctx->texts].floater_ptr=NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[xctx->texts].prop_ptr, xctx->text[n].prop_ptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->text[xctx->texts].floater_ptr, xctx->text[n].floater_ptr);
|
||||
set_text_flags(&xctx->text[xctx->texts]);
|
||||
xctx->text[xctx->texts].xscale=xctx->text[n].xscale;
|
||||
xctx->text[xctx->texts].yscale=xctx->text[n].yscale;
|
||||
|
|
@ -915,7 +922,7 @@ 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,
|
||||
text_bbox(get_text_floater(l), 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,
|
||||
|
|
@ -925,7 +932,7 @@ void copy_objects(int what)
|
|||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
bbox(ADD, xctx->rx1, xctx->ry1, xctx->rx2, xctx->ry2 );
|
||||
if(!floaters) bbox(ADD, xctx->rx1, xctx->ry1, xctx->rx2, xctx->ry2 );
|
||||
|
||||
xctx->sel_array[i].n=xctx->texts;
|
||||
xctx->texts++;
|
||||
|
|
@ -983,6 +990,10 @@ void copy_objects(int what)
|
|||
if(!newpropcnt) hash_all_names();
|
||||
new_prop_string(xctx->instances, xctx->inst[n].prop_ptr,newpropcnt++,
|
||||
tclgetboolvar("disable_unique_names"));
|
||||
/* this is needed since no find_inst_to_be_redrawn() is executed if floaters are present */
|
||||
if(floaters) symbol_bbox(xctx->instances,
|
||||
&xctx->inst[xctx->instances].x1, &xctx->inst[xctx->instances].y1,
|
||||
&xctx->inst[xctx->instances].x2, &xctx->inst[xctx->instances].y2);
|
||||
xctx->instances++;
|
||||
} /* if(xctx->sel_array[i].type == ELEMENT) */
|
||||
} /* for(i = 0; i < xctx->lastsel; ++i) */
|
||||
|
|
@ -993,8 +1004,10 @@ void copy_objects(int what)
|
|||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
/* build after copying and after recalculating prepare_netlist_structs() */
|
||||
find_inst_to_be_redrawn(1 + 2 + 4 + 32); /* 32: call prepare_netlist_structs(0) */
|
||||
find_inst_to_be_redrawn(16); /* clear data */
|
||||
if(!floaters) {
|
||||
find_inst_to_be_redrawn(1 + 2 + 4 + 32); /* 32: call prepare_netlist_structs(0) */
|
||||
find_inst_to_be_redrawn(16); /* clear data */
|
||||
}
|
||||
check_collapsing_objects();
|
||||
if(tclgetboolvar("autotrim_wires")) trim_wires();
|
||||
if(xctx->hilight_nets) {
|
||||
|
|
@ -1003,9 +1016,10 @@ void copy_objects(int what)
|
|||
xctx->ui_state &= ~STARTCOPY;
|
||||
xctx->x1 = xctx->y_1 = xctx->x2 = xctx->y_2 = xctx->deltax = xctx->deltay = 0;
|
||||
xctx->move_rot = xctx->move_flip = 0;
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
set_modify(1);
|
||||
if(!floaters) bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
if(!floaters) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
xctx->rotatelocal=0;
|
||||
} /* if(what & END) */
|
||||
draw_selection(xctx->gc[SELLAYER], 0);
|
||||
|
|
@ -1076,7 +1090,6 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
int firsti, firstw;
|
||||
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
set_modify(1);
|
||||
/* no undo push for MERGE ad PLACE, already done before */
|
||||
if( !xctx->kissing && !(xctx->ui_state & (STARTMERGE | PLACE_SYMBOL | PLACE_TEXT)) ) {
|
||||
dbg(1, "move_objects(): push undo state\n");
|
||||
|
|
@ -1436,7 +1449,7 @@ 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,
|
||||
text_bbox(get_text_floater(n), 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, &dtmp);
|
||||
|
|
@ -1462,7 +1475,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(get_text_floater(n), 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, &dtmp);
|
||||
|
|
@ -1523,6 +1536,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
xctx->rotatelocal=0;
|
||||
set_modify(1);
|
||||
}
|
||||
draw_selection(xctx->gc[SELLAYER], 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,12 @@ static void merge_text(FILE *fd)
|
|||
}
|
||||
xctx->text[i].prop_ptr=NULL;
|
||||
xctx->text[i].font=NULL;
|
||||
xctx->text[i].floater_instname=NULL;
|
||||
xctx->text[i].floater_ptr=NULL;
|
||||
xctx->text[i].sel=0;
|
||||
load_ascii_string(&xctx->text[i].prop_ptr,fd);
|
||||
set_text_flags(&xctx->text[i]);
|
||||
select_text(i,SELECTED, 1);
|
||||
set_modify(1);
|
||||
xctx->texts++;
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +109,6 @@ static void merge_box(FILE *fd)
|
|||
set_rect_flags(&xctx->rect[c][i]); /* set cached .flags bitmask from on attributes */
|
||||
select_box(c,i, SELECTED, 1, 1);
|
||||
xctx->rects[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
static void merge_arc(FILE *fd)
|
||||
|
|
@ -150,7 +150,6 @@ static void merge_arc(FILE *fd)
|
|||
|
||||
select_arc(c,i, SELECTED, 1);
|
||||
xctx->arcs[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -207,7 +206,6 @@ static void merge_polygon(FILE *fd)
|
|||
|
||||
select_polygon(c,i, SELECTED, 1);
|
||||
xctx->polygons[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
static void merge_line(FILE *fd)
|
||||
|
|
@ -243,7 +241,6 @@ static void merge_line(FILE *fd)
|
|||
}
|
||||
select_line(c,i, SELECTED, 1);
|
||||
xctx->lines[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
static void merge_inst(int k,FILE *fd)
|
||||
|
|
@ -302,7 +299,6 @@ static void merge_inst(int k,FILE *fd)
|
|||
xctx->inst[i].embed = !strcmp(get_tok_value(xctx->inst[i].prop_ptr, "embed", 2), "true");
|
||||
my_free(_ALLOC_ID_, &prop_ptr);
|
||||
xctx->instances++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
/* merge selection if selection_load=1, otherwise ask for filename */
|
||||
|
|
@ -452,4 +448,5 @@ void merge_file(int selection_load, const char ext[])
|
|||
} else {
|
||||
dbg(0, "merge_file(): can not open %s\n", name);
|
||||
}
|
||||
set_modify(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1126,12 +1126,12 @@ void create_ps(char **psfile, int what)
|
|||
my_snprintf(ps_font_family, S(ps_font_family), "%s-Oblique", ps_font_name);
|
||||
|
||||
if(text_ps) {
|
||||
ps_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
ps_draw_string(textlayer, get_text_floater(i),
|
||||
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, get_text_floater(i),
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1827,6 +1827,8 @@ static void load_text(FILE *fd)
|
|||
}
|
||||
xctx->text[i].prop_ptr=NULL;
|
||||
xctx->text[i].font=NULL;
|
||||
xctx->text[i].floater_instname=NULL;
|
||||
xctx->text[i].floater_ptr=NULL;
|
||||
xctx->text[i].sel=0;
|
||||
load_ascii_string(&xctx->text[i].prop_ptr,fd);
|
||||
set_text_flags(&xctx->text[i]);
|
||||
|
|
@ -3074,7 +3076,7 @@ static void calc_symbol_bbox(int pos)
|
|||
int tmp;
|
||||
* count++;
|
||||
* rot=tt[i].rot;flip=tt[i].flip;
|
||||
* text_bbox(tt[i].txt_ptr, tt[i].xscale, tt[i].yscale, rot, flip,
|
||||
* text_bbox(get_text_floater(i), tt[i].xscale, tt[i].yscale, rot, flip,
|
||||
* 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);
|
||||
|
|
@ -3605,7 +3607,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
lastr[c]++;
|
||||
break;
|
||||
case 'T':
|
||||
tmptext.prop_ptr = tmptext.txt_ptr = tmptext.font = NULL;
|
||||
tmptext.floater_instname = tmptext.prop_ptr = tmptext.txt_ptr = tmptext.font = tmptext.floater_ptr = NULL;
|
||||
load_ascii_string(&tmptext.txt_ptr, lcc[level].fd);
|
||||
if(fscanf(lcc[level].fd, "%lf %lf %hd %hd %lf %lf ",&tmptext.x0, &tmptext.y0, &tmptext.rot,
|
||||
&tmptext.flip, &tmptext.xscale, &tmptext.yscale) < 6 ) {
|
||||
|
|
@ -3630,6 +3632,8 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
tt[i].xscale = tmptext.xscale;
|
||||
tt[i].yscale = tmptext.yscale;
|
||||
tt[i].prop_ptr = tmptext.prop_ptr;
|
||||
tt[i].floater_ptr = tmptext.floater_ptr;
|
||||
tt[i].floater_instname = tmptext.floater_instname;
|
||||
dbg(1, "l_s_d(): txt1: level=%d tt[i].txt_ptr=%s, i=%d\n", level, tt[i].txt_ptr, i);
|
||||
if (level>0) {
|
||||
const char* tmp = translate2(lcc, level, tt[i].txt_ptr);
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
rebuild_selected_array();
|
||||
move_objects(START,0,0,0);
|
||||
xctx->ui_state |= START_SYMPIN;
|
||||
set_modify(1);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
|
|
@ -1821,6 +1822,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
save = xctx->draw_window; xctx->draw_window = 1;
|
||||
drawline(xctx->rectcolor,NOW, x1,y1,x2,y2, 0, NULL);
|
||||
xctx->draw_window = save;
|
||||
set_modify(1);
|
||||
}
|
||||
else xctx->ui_state |= MENUSTARTLINE;
|
||||
}
|
||||
|
|
@ -2750,6 +2752,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
save = xctx->draw_window; xctx->draw_window = 1;
|
||||
drawrect(xctx->rectcolor,NOW, x1,y1,x2,y2, 0);
|
||||
xctx->draw_window = save;
|
||||
set_modify(1);
|
||||
}
|
||||
else xctx->ui_state |= MENUSTARTRECT;
|
||||
}
|
||||
|
|
@ -2835,7 +2838,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
my_strncpy(symbol, argv[3], S(symbol));
|
||||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
if(!fast) {
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
|
|
@ -2882,6 +2884,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
/* redraw symbol */
|
||||
set_modify(1);
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
bbox(END,0.0,0.0,0.0,0.0);
|
||||
|
|
@ -3324,7 +3327,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
xctx->push_undo();
|
||||
}
|
||||
set_modify(1);
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
|
|
@ -3373,6 +3375,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else xctx->inst[inst].flags &= ~HIDE_SYMBOL_TEXTS;
|
||||
|
||||
xctx->inst[inst].embed = !strcmp(get_tok_value(xctx->inst[inst].prop_ptr, "embed", 2), "true");
|
||||
set_modify(1);
|
||||
if(!fast) {
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
|
|
@ -3538,7 +3541,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
if(change_done) set_modify(1);
|
||||
set_text_flags(t);
|
||||
text_bbox(t->txt_ptr, t->xscale,
|
||||
text_bbox(get_text_floater(n), t->xscale,
|
||||
t->yscale, t->rot, t->flip, t->hcenter,
|
||||
t->vcenter, t->x0, t->y0,
|
||||
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
|
||||
|
|
@ -3925,6 +3928,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
drawline(WIRELAYER,NOW, x1,y1,x2,y2, 0, NULL);
|
||||
xctx->draw_window = save;
|
||||
if(tclgetboolvar("autotrim_wires")) trim_wires();
|
||||
set_modify(1);
|
||||
}
|
||||
else xctx->ui_state |= MENUSTARTWIRE;
|
||||
}
|
||||
|
|
|
|||
80
src/select.c
80
src/select.c
|
|
@ -192,7 +192,7 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2)
|
|||
}
|
||||
|
||||
|
||||
static void del_rect_line_arc_poly(void)
|
||||
static void del_rect_line_arc_poly(int floaters)
|
||||
{
|
||||
xRect tmp;
|
||||
int c, j, i, k, itmp;
|
||||
|
|
@ -200,6 +200,7 @@ static void del_rect_line_arc_poly(void)
|
|||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
int deleted = 0;
|
||||
|
||||
for(k=0;k<xctx->lastsel; ++k)
|
||||
{
|
||||
|
|
@ -211,7 +212,7 @@ static void del_rect_line_arc_poly(void)
|
|||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&xctx->text[n]);
|
||||
#endif
|
||||
text_bbox(xctx->text[n].txt_ptr, xctx->text[n].xscale,
|
||||
text_bbox(get_text_floater(n), 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);
|
||||
|
|
@ -220,7 +221,7 @@ static void del_rect_line_arc_poly(void)
|
|||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
if(!floaters) bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
|
|
@ -232,10 +233,10 @@ static void del_rect_line_arc_poly(void)
|
|||
{
|
||||
if(c == GRIDLAYER) xctx->graph_lastsel = -1; /* invalidate last selected graph */
|
||||
++j;
|
||||
bbox(ADD, xctx->rect[c][i].x1, xctx->rect[c][i].y1, xctx->rect[c][i].x2, xctx->rect[c][i].y2);
|
||||
if(!floaters) bbox(ADD, xctx->rect[c][i].x1, xctx->rect[c][i].y1, xctx->rect[c][i].x2, xctx->rect[c][i].y2);
|
||||
my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr);
|
||||
set_rect_extraptr(0, &xctx->rect[c][i]);
|
||||
set_modify(1);
|
||||
deleted = 1;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -255,11 +256,11 @@ static void del_rect_line_arc_poly(void)
|
|||
ov = INT_BUS_WIDTH(xctx->lw);
|
||||
if(xctx->line[c][i].y1 < xctx->line[c][i].y2) { y1 = xctx->line[c][i].y1-ov; y2 = xctx->line[c][i].y2+ov; }
|
||||
else { y1 = xctx->line[c][i].y1+ov; y2 = xctx->line[c][i].y2-ov; }
|
||||
bbox(ADD, xctx->line[c][i].x1-ov, y1 , xctx->line[c][i].x2+ov , y2 );
|
||||
if(!floaters) bbox(ADD, xctx->line[c][i].x1-ov, y1 , xctx->line[c][i].x2+ov , y2 );
|
||||
} else {
|
||||
bbox(ADD, xctx->line[c][i].x1, xctx->line[c][i].y1 , xctx->line[c][i].x2 , xctx->line[c][i].y2 );
|
||||
if(!floaters) bbox(ADD, xctx->line[c][i].x1, xctx->line[c][i].y1 , xctx->line[c][i].x2 , xctx->line[c][i].y2 );
|
||||
}
|
||||
set_modify(1);
|
||||
deleted = 1;
|
||||
my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -283,9 +284,9 @@ static void del_rect_line_arc_poly(void)
|
|||
else
|
||||
arc_bbox(xctx->arc[c][i].x, xctx->arc[c][i].y, xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b,
|
||||
&tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
bbox(ADD, tmp.x1, tmp.y1, tmp.x2, tmp.y2);
|
||||
if(!floaters) bbox(ADD, tmp.x1, tmp.y1, tmp.x2, tmp.y2);
|
||||
my_free(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr);
|
||||
set_modify(1);
|
||||
deleted = 1;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -311,13 +312,13 @@ static void del_rect_line_arc_poly(void)
|
|||
if(k==0 || xctx->poly[c][i].y[k] > y2) y2 = xctx->poly[c][i].y[k];
|
||||
}
|
||||
++j;
|
||||
bbox(ADD, x1, y1, x2, y2);
|
||||
if(!floaters) bbox(ADD, x1, y1, x2, y2);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[c][i].x);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[c][i].y);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[c][i].selected_point);
|
||||
/*fprintf(errfp, "bbox: %.16g %.16g %.16g %.16g\n", x1, y1, x2, y2); */
|
||||
set_modify(1);
|
||||
deleted = 1;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -327,28 +328,31 @@ static void del_rect_line_arc_poly(void)
|
|||
}
|
||||
xctx->polygons[c] -= j;
|
||||
}
|
||||
if(deleted) set_modify(1);
|
||||
}
|
||||
|
||||
|
||||
void delete(int to_push_undo)
|
||||
{
|
||||
int i, j, tmp;
|
||||
int i, j, tmp, deleted = 0, floaters;
|
||||
int select_rot = 0, select_flip = 0;
|
||||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
double xx1,yy1,xx2,yy2, dtmp;
|
||||
|
||||
floaters = there_are_floaters();
|
||||
dbg(3, "delete(): start\n");
|
||||
j = 0;
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
if(!floaters) bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
rebuild_selected_array();
|
||||
if(to_push_undo && xctx->lastsel) xctx->push_undo();
|
||||
/* first calculate bbox, because symbol_bbox() needs translate (@#0:net_name) which
|
||||
* needs prepare_netlist_structs which needs a consistent xctx->inst[] data structure */
|
||||
find_inst_to_be_redrawn(4 + 32); /* 32: call prepare_netlist_structs(0) if show net names enabled
|
||||
* 4: call symbol_bbox() to precisely update bbox to current zoom level
|
||||
*/
|
||||
if(!floaters) find_inst_to_be_redrawn(4 + 32);
|
||||
/* 32: call prepare_netlist_structs(0) if show net names enabled
|
||||
* 4: call symbol_bbox() to precisely update bbox to current zoom level
|
||||
*/
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
if(xctx->text[i].sel == SELECTED)
|
||||
|
|
@ -358,7 +362,7 @@ 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(!floaters) text_bbox(get_text_floater(i), xctx->text[i].xscale,
|
||||
xctx->text[i].yscale, (short) select_rot, (short) select_flip, xctx->text[i].hcenter,
|
||||
xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0,
|
||||
&xx1,&yy1, &xx2,&yy2, &tmp, &dtmp);
|
||||
|
|
@ -367,11 +371,13 @@ void delete(int to_push_undo)
|
|||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
if(!floaters) bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].font);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].floater_instname);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr);
|
||||
set_modify(1);
|
||||
deleted = 1;
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -389,7 +395,7 @@ void delete(int to_push_undo)
|
|||
{
|
||||
if(xctx->inst[i].sel == SELECTED)
|
||||
{
|
||||
set_modify(1);
|
||||
deleted = 1;
|
||||
if(xctx->inst[i].prop_ptr != NULL)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr);
|
||||
|
|
@ -423,19 +429,19 @@ void delete(int to_push_undo)
|
|||
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
|
||||
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
|
||||
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
|
||||
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
|
||||
if(!floaters) bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
|
||||
} else {
|
||||
double ov, y1, y2;
|
||||
ov = cadhalfdotsize;
|
||||
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
|
||||
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
|
||||
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
|
||||
if(!floaters) bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
|
||||
}
|
||||
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].node);
|
||||
|
||||
set_modify(1);
|
||||
deleted = 1;
|
||||
continue;
|
||||
}
|
||||
if(j) {
|
||||
|
|
@ -449,22 +455,26 @@ void delete(int to_push_undo)
|
|||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
if(tclgetboolvar("autotrim_wires")) trim_wires();
|
||||
del_rect_line_arc_poly();
|
||||
del_rect_line_arc_poly(floaters);
|
||||
update_conn_cues(WIRELAYER, 0, 0);
|
||||
if(xctx->hilight_nets) {
|
||||
propagate_hilights(1, 1, XINSERT_NOREPLACE);
|
||||
}
|
||||
|
||||
find_inst_to_be_redrawn(2 + 4 + 8 + 32); /* 32: call prepare_netlist_structs(0)
|
||||
if(!floaters) {
|
||||
find_inst_to_be_redrawn(2 + 4 + 8 + 32);
|
||||
/* 32: call prepare_netlist_structs(0)
|
||||
* 2: add previously built list
|
||||
* 4: call symbol_bbox to precisely update bboxes ... needed?
|
||||
* 8: do not iterate over selection (there is no more selection, deleted)
|
||||
*/
|
||||
find_inst_to_be_redrawn(16); /* clear data */
|
||||
find_inst_to_be_redrawn(16); /* clear data */
|
||||
}
|
||||
if(deleted) set_modify(1);
|
||||
xctx->lastsel = 0;
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
if(!floaters) bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
if(!floaters) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
xctx->ui_state &= ~SELECTION;
|
||||
}
|
||||
|
||||
|
|
@ -472,7 +482,7 @@ void delete(int to_push_undo)
|
|||
void delete_only_rect_line_arc_poly(void)
|
||||
{
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
del_rect_line_arc_poly();
|
||||
del_rect_line_arc_poly(0);
|
||||
xctx->lastsel = 0;
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
|
|
@ -642,7 +652,7 @@ void unselect_all(int dr)
|
|||
#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,
|
||||
draw_temp_string(xctx->gctiled,ADD, get_text_floater(i),
|
||||
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);
|
||||
|
|
@ -806,7 +816,6 @@ void select_text(int i,unsigned short select_mode, int fast)
|
|||
#if HAS_CAIRO==1
|
||||
int customfont;
|
||||
#endif
|
||||
|
||||
if(!fast) {
|
||||
my_strncpy(s,xctx->text[i].prop_ptr!=NULL?xctx->text[i].prop_ptr:"<NULL>",S(s));
|
||||
my_snprintf(str, S(str), "selected text %d: properties: %s", i,s);
|
||||
|
|
@ -820,12 +829,12 @@ void select_text(int i,unsigned short select_mode, int fast)
|
|||
customfont = set_text_custom_font(&xctx->text[i]);
|
||||
#endif
|
||||
if(select_mode)
|
||||
draw_temp_string(xctx->gc[SELLAYER],ADD, xctx->text[i].txt_ptr,
|
||||
draw_temp_string(xctx->gc[SELLAYER],ADD, get_text_floater(i),
|
||||
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, get_text_floater(i),
|
||||
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);
|
||||
|
|
@ -1050,7 +1059,8 @@ 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,
|
||||
|
||||
text_bbox(get_text_floater(i),
|
||||
xctx->text[i].xscale, xctx->text[i].yscale, (short)select_rot, (short)select_flip,
|
||||
xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0, xctx->text[i].y0,
|
||||
|
|
|
|||
13
src/store.c
13
src/store.c
|
|
@ -159,7 +159,6 @@ void store_arc(int pos, double x, double y, double r, double a, double b,
|
|||
xctx->arc[rectc][n].dash = 0;
|
||||
|
||||
xctx->arcs[rectc]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
void store_poly(int pos, double *x, double *y, int points, unsigned int rectc,
|
||||
|
|
@ -208,14 +207,13 @@ void store_poly(int pos, double *x, double *y, int points, unsigned int rectc,
|
|||
|
||||
|
||||
xctx->polygons[rectc]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
void storeobject(int pos, double x1,double y1,double x2,double y2,
|
||||
int storeobject(int pos, double x1,double y1,double x2,double y2,
|
||||
unsigned short type, unsigned int rectc,
|
||||
unsigned short sel, const char *prop_ptr)
|
||||
{
|
||||
int n, j;
|
||||
int n, j, modified = 0;
|
||||
const char *dash;
|
||||
if(type == LINE)
|
||||
{
|
||||
|
|
@ -248,7 +246,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
} else
|
||||
xctx->line[rectc][n].dash = 0;
|
||||
xctx->lines[rectc]++;
|
||||
set_modify(1);
|
||||
modified = 1;
|
||||
}
|
||||
if(type == xRECT)
|
||||
{
|
||||
|
|
@ -286,7 +284,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
draw_image(0, r, &r->x1, &r->y1, &r->x2, &r->y2, 0, 0);
|
||||
}
|
||||
xctx->rects[rectc]++;
|
||||
set_modify(1);
|
||||
modified = 1;
|
||||
}
|
||||
if(type == WIRE)
|
||||
{
|
||||
|
|
@ -314,6 +312,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
else xctx->wire[n].bus=0;
|
||||
xctx->wire[n].sel=sel;
|
||||
xctx->wires++;
|
||||
set_modify(1);
|
||||
modified = 1;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -789,12 +789,12 @@ void svg_draw(void)
|
|||
my_snprintf(svg_font_style, S(svg_font_style), "oblique");
|
||||
|
||||
if(text_svg)
|
||||
svg_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
svg_draw_string(textlayer, get_text_floater(i),
|
||||
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, get_text_floater(i),
|
||||
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);
|
||||
|
|
|
|||
37
src/token.c
37
src/token.c
|
|
@ -42,6 +42,18 @@ static char *find_bracket(char *s)
|
|||
return s;
|
||||
}
|
||||
|
||||
void floater_hash_all_names(void)
|
||||
{
|
||||
int i;
|
||||
int_hash_free(&xctx->floater_inst_table);
|
||||
int_hash_init(&xctx->floater_inst_table, HASHSIZE);
|
||||
for(i=0; i<xctx->instances; ++i) {
|
||||
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
|
||||
int_hash_lookup(&xctx->floater_inst_table, xctx->inst[i].instname, i, XINSERT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hash_all_names(void)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -50,6 +62,7 @@ void hash_all_names(void)
|
|||
int_hash_init(&xctx->inst_table, HASHSIZE);
|
||||
for(i=0; i<xctx->instances; ++i) {
|
||||
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
|
||||
if(xctx->inst[i].ptr == -1) continue;
|
||||
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if(!type) continue;
|
||||
my_strdup(_ALLOC_ID_, &upinst, xctx->inst[i].instname);
|
||||
|
|
@ -91,7 +104,7 @@ const char *tcl_hook2(const char *cmd)
|
|||
*/
|
||||
void check_unique_names(int rename)
|
||||
{
|
||||
int i, first = 1;
|
||||
int i, first = 1, modified = 0;
|
||||
int newpropcnt = 0;
|
||||
char *tmp = NULL;
|
||||
Int_hashentry *entry;
|
||||
|
|
@ -109,6 +122,7 @@ void check_unique_names(int rename)
|
|||
first = 1;
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
|
||||
if(xctx->inst[i].ptr == -1) continue;
|
||||
if(!(xctx->inst[i].ptr+ xctx->sym)->type) continue;
|
||||
my_strdup(_ALLOC_ID_, &upinst, xctx->inst[i].instname);
|
||||
strtoupper(upinst);
|
||||
|
|
@ -119,7 +133,8 @@ void check_unique_names(int rename)
|
|||
if(rename == 1) {
|
||||
if(first) {
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
set_modify(1); xctx->push_undo();
|
||||
modified = 1;
|
||||
xctx->push_undo();
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
|
|
@ -145,6 +160,7 @@ void check_unique_names(int rename)
|
|||
}
|
||||
} /* for(i...) */
|
||||
my_free(_ALLOC_ID_, &upinst);
|
||||
if(modified) set_modify(1);
|
||||
if(rename == 1 && xctx->hilight_nets) {
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
|
|
@ -176,6 +192,13 @@ int is_generator(const char *name)
|
|||
/* regfree(&re); */
|
||||
return res;
|
||||
#else
|
||||
if (!name) return 0;
|
||||
char cmd[PATH_MAX+100];
|
||||
my_snprintf(cmd, S(cmd), "my_regexp {%s} {%s} [list %s]", "-nocase", "^[^ \\t()]+\\([^()]*\\)[ \\t]*$", name);
|
||||
tcleval(cmd);
|
||||
int ret = atoi(tclresult());
|
||||
if (ret > 0)
|
||||
return 1;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -218,9 +241,19 @@ char *get_generator_command(const char *str)
|
|||
if(stat(cmd_filename, &buf)) { /* symbol generator not found */
|
||||
goto end;
|
||||
}
|
||||
#ifdef __unix__
|
||||
my_strdup(_ALLOC_ID_, &gen_cmd, cmd_filename);
|
||||
*spc_idx = ' ';
|
||||
my_strcat(_ALLOC_ID_, &gen_cmd, spc_idx);
|
||||
#else
|
||||
/* tclsh "cmd_filename" a b c */
|
||||
/* command tclsh is needed so new TCL windows will NOT open */
|
||||
/* quotes are needed for filename if filename has spaces */
|
||||
*spc_idx = ' ';
|
||||
int len = 8 + strlen(cmd_filename) + strlen(spc_idx) + 1; /*8="tclsh "+ "\""*2*/
|
||||
gen_cmd = my_malloc(_ALLOC_ID_, len * sizeof(char));
|
||||
my_snprintf(gen_cmd, len, "tclsh \"%s\"%s", cmd_filename, spc_idx);
|
||||
#endif
|
||||
dbg(1, "get_generator_command(): cmd_filename=%s\n", cmd_filename);
|
||||
dbg(1, "get_generator_command(): gen_cmd=%s\n", gen_cmd);
|
||||
dbg(1, "get_generator_command(): is_symgen=%d\n", is_generator(str));
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ static int vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
int i,l;
|
||||
char *type=NULL;
|
||||
|
||||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
if(!vhdl_stop) {
|
||||
xctx->prep_net_structs = 0;
|
||||
err |= prepare_netlist_structs(1);
|
||||
|
|
|
|||
|
|
@ -323,7 +323,6 @@ static void free_xschem_data()
|
|||
free_simdata();
|
||||
|
||||
my_free(_ALLOC_ID_, &xctx->node_table);
|
||||
my_free(_ALLOC_ID_, &xctx->inst_table);
|
||||
my_free(_ALLOC_ID_, &xctx->hilight_table);
|
||||
|
||||
my_free(_ALLOC_ID_, &xctx->wire);
|
||||
|
|
@ -491,6 +490,8 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->node_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Node_hashentry *));
|
||||
xctx->inst_table.table = NULL;
|
||||
xctx->inst_table.size = 0;
|
||||
xctx->floater_inst_table.table = NULL;
|
||||
xctx->floater_inst_table.size = 0;
|
||||
xctx->hilight_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Hilight_hashentry *));
|
||||
|
||||
xctx->inst_redraw_table = NULL;
|
||||
|
|
|
|||
24
src/xschem.h
24
src/xschem.h
|
|
@ -491,6 +491,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
char *txt_ptr;
|
||||
char *floater_ptr; /* cached value of translated text for floaters (avoid calls to translate() */
|
||||
double x0,y0;
|
||||
short rot;
|
||||
short flip;
|
||||
|
|
@ -498,10 +499,16 @@ typedef struct
|
|||
double xscale;
|
||||
double yscale;
|
||||
char *prop_ptr;
|
||||
char *floater_instname; /* cached value of floater=... attribute in prop_ptr */
|
||||
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; /* bit 0 : TEXT_BOLD
|
||||
* bit 1 : TEXT_OBLIQUE
|
||||
* bit 2 : TEXT_ITALICi
|
||||
* bit 3 : HIDE_TEXT
|
||||
* bit 4 : TEXT_FLOATER */
|
||||
|
||||
} xText;
|
||||
|
||||
typedef struct
|
||||
|
|
@ -647,15 +654,6 @@ typedef struct {
|
|||
int port;
|
||||
} Drivers;
|
||||
|
||||
/* instance name (refdes) hash table, for unique name checking */
|
||||
typedef struct inst_hashentry Inst_hashentry;
|
||||
struct inst_hashentry
|
||||
{
|
||||
struct inst_hashentry *next;
|
||||
unsigned int hash;
|
||||
char *token;
|
||||
int value;
|
||||
};
|
||||
|
||||
/* generic string hash table */
|
||||
|
||||
|
|
@ -896,6 +894,7 @@ typedef struct {
|
|||
int tail_undo_ptr;
|
||||
int head_undo_ptr;
|
||||
Int_hashtable inst_table;
|
||||
Int_hashtable floater_inst_table;
|
||||
Node_hashentry **node_table;
|
||||
Hilight_hashentry **hilight_table;
|
||||
|
||||
|
|
@ -1130,6 +1129,7 @@ extern int raw_read_from_attr(const char *type);
|
|||
extern char *base64_from_file(const char *f, size_t *length);
|
||||
extern int set_rect_flags(xRect *r);
|
||||
extern int set_text_flags(xText *t);
|
||||
extern const char *get_text_floater(int i);
|
||||
extern int set_rect_extraptr(int what, xRect *drptr);
|
||||
extern unsigned char *base64_decode(const char *data, const size_t input_length, size_t *output_length);
|
||||
extern char *base64_encode(const unsigned char *data, const size_t input_length, size_t *output_length, int brk);
|
||||
|
|
@ -1154,6 +1154,7 @@ extern void set_snap(double);
|
|||
extern void set_grid(double);
|
||||
extern void create_plot_cmd(void);
|
||||
extern void set_modify(int mod);
|
||||
extern int there_are_floaters(void);
|
||||
extern void dbg(int level, char *fmt, ...);
|
||||
extern unsigned int hash_file(const char *f, int skip_path_lines);
|
||||
extern void here(double i);
|
||||
|
|
@ -1287,7 +1288,7 @@ extern void check_touch(int i, int j,
|
|||
unsigned short *included, unsigned short *includes,
|
||||
double *xt, double *yt);
|
||||
|
||||
extern void storeobject(int pos, double x1,double y1,double x2,double y2,
|
||||
extern int storeobject(int pos, double x1,double y1,double x2,double y2,
|
||||
unsigned short type,unsigned int rectcolor,
|
||||
unsigned short sel, const char *prop_ptr);
|
||||
extern void store_poly(int pos, double *x, double *y, int points,
|
||||
|
|
@ -1450,6 +1451,7 @@ extern const char *subst_token(const char *s, const char *tok, const char *new_v
|
|||
extern void new_prop_string(int i, const char *old_prop,int fast, int dis_uniq_names);
|
||||
extern void hash_name(char *token, int remove);
|
||||
extern void hash_all_names(void);
|
||||
extern void floater_hash_all_names(void);
|
||||
extern void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2);
|
||||
/* extern char *escape_chars(char *dest, const char *source, int size); */
|
||||
|
||||
|
|
|
|||
|
|
@ -6405,6 +6405,13 @@ proc setup_tcp_xschem {} {
|
|||
return 1
|
||||
}
|
||||
|
||||
proc my_regexp {options pattern name} {
|
||||
if { [regexp $options $pattern $name] } {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
proc setup_tcp_bespice {} {
|
||||
global bespice_listen_port bespice_server_getdata
|
||||
if { [info exists bespice_listen_port] && ($bespice_listen_port ne {}) } {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,11 @@ L 4 1130 -1060 1130 -1020 {}
|
|||
L 4 1130 -1060 1150 -1060 {}
|
||||
L 4 1150 -1060 1150 -1020 {}
|
||||
L 4 1150 -1020 1160 -1020 {}
|
||||
L 4 890 -690 890 -650 {}
|
||||
L 4 880 -650 890 -650 {}
|
||||
L 4 880 -650 890 -640 {}
|
||||
L 4 890 -640 900 -650 {}
|
||||
L 4 890 -650 900 -650 {}
|
||||
B 2 1260 -560 1680 -390 {flags=graph
|
||||
y1 = -0.42
|
||||
y2 = 22
|
||||
|
|
@ -167,6 +172,13 @@ T {set between 0 and 1
|
|||
to simulate
|
||||
sun radiation
|
||||
level} 10 -390 0 0 0.2 0.2 {}
|
||||
T {@name} 885 -628.75 0 0 0.2 0.2 {floater=L2
|
||||
layer=7}
|
||||
T {@value} 885 -613.75 0 0 0.2 0.2 {floater=L2
|
||||
layer=7}
|
||||
T {m=@m} 885 -598.75 0 0 0.2 0.2 {floater=L2
|
||||
layer=7}
|
||||
T {Floater text example} 860 -720 0 0 0.4 0.4 {}
|
||||
N 1010 -160 1100 -160 {lab=0}
|
||||
N 1100 -250 1100 -160 {lab=0}
|
||||
N 640 -560 730 -560 {lab=#net1}
|
||||
|
|
@ -250,7 +262,8 @@ C {ind.sym} 890 -560 3 1 {name=L2
|
|||
m=1
|
||||
value=40u
|
||||
footprint=1206
|
||||
device=inductor net_name=true}
|
||||
device=inductor net_name=true
|
||||
hide_texts=true}
|
||||
C {lab_pin.sym} 1140 -390 0 1 {name=l7 lab=LED }
|
||||
C {lab_pin.sym} 820 -500 0 1 {name=l9 lab=SW }
|
||||
C {capa.sym} 1010 -230 0 0 {name=C1
|
||||
|
|
@ -318,7 +331,7 @@ C {lab_pin.sym} 760 -670 0 0 {name=l13 lab=CTRL1 }
|
|||
C {comp_ngspice.sym} 660 -870 0 0 {name=x3 OFFSET=0.5 AMPLITUDE=1 ROUT=7k COUT=1n}
|
||||
C {lab_pin.sym} 550 -840 0 0 {name=l16
|
||||
lab=REF}
|
||||
C {lab_pin.sym} 550 -900 0 0 {name=l15 lab=LED }
|
||||
C {lab_pin.sym} 550 -900 0 0 {name=l15 lab=LED}
|
||||
C {lab_pin.sym} 830 -870 0 1 {name=l18 lab=LEVEL}
|
||||
C {comp_ngspice.sym} 950 -1000 0 0 {name=x4 OFFSET=0.5 AMPLITUDE=1 ROUT=1 COUT=1p}
|
||||
C {lab_pin.sym} 1060 -1000 0 1 {name=l19 lab=CTRL1 }
|
||||
|
|
|
|||
Loading…
Reference in New Issue