more globals into xctx context struct
This commit is contained in:
parent
2dc28726d3
commit
e279262f00
405
src/actions.c
405
src/actions.c
|
|
@ -33,7 +33,7 @@ void here(void)
|
|||
void set_modify(int mod)
|
||||
{
|
||||
static int prev = -1;
|
||||
modified = mod;
|
||||
xctx->modified = mod;
|
||||
dbg(1, "set_modify(): %d\n", mod);
|
||||
if(mod != prev) {
|
||||
prev = mod;
|
||||
|
|
@ -208,39 +208,39 @@ void resetwin(int create_pixmap, int clear_pixmap, int preview_window)
|
|||
}
|
||||
/* if(wattr.map_state==IsUnmapped) return; */
|
||||
|
||||
xschem_w=wattr.width;
|
||||
xschem_h=wattr.height;
|
||||
areax2 = xschem_w+2*INT_WIDTH(xctx->lw);
|
||||
areay2 = xschem_h+2*INT_WIDTH(xctx->lw);
|
||||
areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
areaw = areax2-areax1;
|
||||
areah = areay2-areay1;
|
||||
xctx->xschem_w=wattr.width;
|
||||
xctx->xschem_h=wattr.height;
|
||||
xctx->areax2 = xctx->xschem_w+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = xctx->xschem_h+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areaw = xctx->areax2-xctx->areax1;
|
||||
xctx->areah = xctx->areay2-xctx->areay1;
|
||||
|
||||
/* if no preview_window or create_pixmap==1 avoid unnecessary work if no resize */
|
||||
/* !create_pixmap ensures the XSetTile is executed when done with the preview */
|
||||
if( preview_window || !create_pixmap || xschem_w !=xrect[0].width || xschem_h !=xrect[0].height) {
|
||||
dbg(1, "resetwin(): x=%d y=%d xschem_w=%d xschem_h=%d\n",
|
||||
wattr.x, wattr.y, xschem_w,xschem_h);
|
||||
if( preview_window || !create_pixmap || xctx->xschem_w !=xrect[0].width || xctx->xschem_h !=xrect[0].height) {
|
||||
dbg(1, "resetwin(): x=%d y=%d xctx->xschem_w=%d xctx->xschem_h=%d\n",
|
||||
wattr.x, wattr.y, xctx->xschem_w,xctx->xschem_h);
|
||||
dbg(1, "resetwin(): changing size\n\n");
|
||||
xrect[0].x = 0;
|
||||
xrect[0].y = 0;
|
||||
xrect[0].width = xschem_w;
|
||||
xrect[0].height = xschem_h;
|
||||
xrect[0].width = xctx->xschem_w;
|
||||
xrect[0].height = xctx->xschem_h;
|
||||
|
||||
if(clear_pixmap) XFreePixmap(display,save_pixmap);
|
||||
|
||||
/*
|
||||
{
|
||||
unsigned int w, h;
|
||||
XQueryBestSize(display, TileShape, window, xschem_w, xschem_h, &w, &h);
|
||||
XQueryBestSize(display, TileShape, window, xctx->xschem_w, xctx->xschem_h, &w, &h);
|
||||
dbg(1, "XQueryBestSize: req: w=%d, h=%d, opt: w=%d h=%d\n",
|
||||
xschem_w, xschem_h, w, h);
|
||||
xctx->xschem_w, xctx->xschem_h, w, h);
|
||||
}
|
||||
*/
|
||||
|
||||
if(create_pixmap) {
|
||||
save_pixmap = XCreatePixmap(display, window, xschem_w, xschem_h, depth);
|
||||
save_pixmap = XCreatePixmap(display, window, xctx->xschem_w, xctx->xschem_h, depth);
|
||||
}
|
||||
XSetTile(display,gctiled, save_pixmap);
|
||||
#else
|
||||
|
|
@ -257,27 +257,28 @@ void resetwin(int create_pixmap, int clear_pixmap, int preview_window)
|
|||
{
|
||||
unsigned int width = rct.right - rct.left;
|
||||
unsigned int height = rct.bottom - rct.top;
|
||||
xschem_w = width;
|
||||
xschem_h = height;
|
||||
areax2 = xschem_w + 2 * INT_WIDTH(xctx->lw);
|
||||
areay2 = xschem_h + 2 * INT_WIDTH(xctx->lw);
|
||||
areax1 = -2 * INT_WIDTH(xctx->lw);
|
||||
areay1 = -2 * INT_WIDTH(xctx->lw);
|
||||
areaw = areax2 - areax1;
|
||||
areah = areay2 - areay1;
|
||||
xctx->xschem_w = width;
|
||||
xctx->xschem_h = height;
|
||||
xctx->areax2 = xctx->xschem_w + 2 * INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = xctx->xschem_h + 2 * INT_WIDTH(xctx->lw);
|
||||
xctx->areax1 = -2 * INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = -2 * INT_WIDTH(xctx->lw);
|
||||
xctx->areaw = xctx->areax2 - xctx->areax1;
|
||||
xctx->areah = xctx->areay2 - xctx->areay1;
|
||||
/* if no preview_window or create_pixmap==1 avoid unnecessary work if no resize */
|
||||
/* !create_pixmap ensures the XSetTile is executed when done with the preview */
|
||||
if( preview_window || !create_pixmap || xschem_w !=xrect[0].width || xschem_h !=xrect[0].height) {
|
||||
dbg(1, "resetwin(): x=%d y=%d xschem_w=%d xschem_h=%d\n",
|
||||
rct.right, rct.bottom, xschem_w, xschem_h);
|
||||
if( preview_window || !create_pixmap || xctx->xschem_w !=xrect[0].width ||
|
||||
xctx->xschem_h !=xrect[0].height) {
|
||||
dbg(1, "resetwin(): x=%d y=%d xctx->xschem_w=%d xctx->xschem_h=%d\n",
|
||||
rct.right, rct.bottom, xctx->xschem_w, xctx->xschem_h);
|
||||
dbg(1, "resetwin(): changing size\n\n");
|
||||
xrect[0].x = 0;
|
||||
xrect[0].y = 0;
|
||||
xrect[0].width = xschem_w;
|
||||
xrect[0].height = xschem_h;
|
||||
xrect[0].width = xctx->xschem_w;
|
||||
xrect[0].height = xctx->xschem_h;
|
||||
if(clear_pixmap) Tk_FreePixmap(display, save_pixmap);
|
||||
if(create_pixmap) {
|
||||
save_pixmap = Tk_GetPixmap(display, window, xschem_w, xschem_h, depth);
|
||||
save_pixmap = Tk_GetPixmap(display, window, xctx->xschem_w, xctx->xschem_h, depth);
|
||||
}
|
||||
XSetTile(display, gctiled, save_pixmap);
|
||||
}
|
||||
|
|
@ -289,13 +290,13 @@ void resetwin(int create_pixmap, int clear_pixmap, int preview_window)
|
|||
#if HAS_XRENDER==1
|
||||
#if HAS_XCB==1
|
||||
save_sfc = cairo_xcb_surface_create_with_xrender_format(xcbconn, screen_xcb, save_pixmap,
|
||||
&format_rgb, xschem_w, xschem_h);
|
||||
&format_rgb, xctx->xschem_w, xctx->xschem_h);
|
||||
#else
|
||||
save_sfc = cairo_xlib_surface_create_with_xrender_format(display, save_pixmap,
|
||||
DefaultScreenOfDisplay(display), format, xschem_w, xschem_h);
|
||||
DefaultScreenOfDisplay(display), format, xctx->xschem_w, xctx->xschem_h);
|
||||
#endif /* HAS_XCB */
|
||||
#else
|
||||
save_sfc = cairo_xlib_surface_create(display, save_pixmap, visual, xschem_w, xschem_h);
|
||||
save_sfc = cairo_xlib_surface_create(display, save_pixmap, visual, xctx->xschem_w, xctx->xschem_h);
|
||||
#endif /* HAS_XRENDER */
|
||||
if(cairo_surface_status(save_sfc)!=CAIRO_STATUS_SUCCESS) {
|
||||
fprintf(errfp, "ERROR: invalid cairo xcb surface\n");
|
||||
|
|
@ -309,9 +310,9 @@ void resetwin(int create_pixmap, int clear_pixmap, int preview_window)
|
|||
cairo_set_font_size (cairo_save_ctx, 20);
|
||||
/* 20171125 select xlib or xcb :-) */
|
||||
#if HAS_XCB==1 && HAS_XRENDER==1
|
||||
cairo_xcb_surface_set_size(sfc, xschem_w, xschem_h);
|
||||
cairo_xcb_surface_set_size(sfc, xctx->xschem_w, xctx->xschem_h);
|
||||
#else
|
||||
cairo_xlib_surface_set_size(sfc, xschem_w, xschem_h);
|
||||
cairo_xlib_surface_set_size(sfc, xctx->xschem_w, xctx->xschem_h);
|
||||
#endif /* HAS_XCB */
|
||||
#endif /* HAS_CAIRO */
|
||||
|
||||
|
|
@ -405,7 +406,8 @@ void new_window(const char *cell, int symbol)
|
|||
exit(0); /* --> child of child will be reparented to init */
|
||||
} else if (!pid2) {
|
||||
/* child of child */
|
||||
if(!(freopen("/dev/null","w",stdout) && freopen("/dev/null","r",stdin)&& freopen("/dev/null","w",stderr))){
|
||||
if(!(freopen("/dev/null","w",stdout) && freopen("/dev/null","r",stdin) &&
|
||||
freopen("/dev/null","w",stderr))){
|
||||
fprintf(errfp, "new_window(): freopen error\n");
|
||||
tcleval("exit");
|
||||
}
|
||||
|
|
@ -413,8 +415,6 @@ void new_window(const char *cell, int symbol)
|
|||
execl(xschem_executable,xschem_executable,"-r", NULL);
|
||||
}
|
||||
else if(!symbol) {
|
||||
|
||||
|
||||
my_strncpy(f, cell, S(f));
|
||||
execl(xschem_executable,xschem_executable,"-r",f, NULL);
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ int save(int confirm) /* 20171006 add confirm */
|
|||
|
||||
save_ok=0;
|
||||
cancel=0;
|
||||
if(modified)
|
||||
if(xctx->modified)
|
||||
{
|
||||
if(confirm) {
|
||||
tcleval("ask_save");
|
||||
|
|
@ -531,7 +531,7 @@ void ask_new_file(void)
|
|||
|
||||
if(!has_x) return;
|
||||
|
||||
if(modified) {
|
||||
if(xctx->modified) {
|
||||
if(save(1)) return; /* user cancels save, so do nothing. */
|
||||
}
|
||||
tcleval("load_file_dialog {Load Schematic} .sch.sym INITIALLOADDIR");
|
||||
|
|
@ -759,13 +759,13 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */
|
|||
/* printf("indirect=%d\n", indirect); */
|
||||
|
||||
rebuild_selected_array();
|
||||
k = lastselected;
|
||||
k = xctx->lastsel;
|
||||
first_call=1; /* 20171214 for place_symbol--> new_prop_string */
|
||||
prepare_netlist_structs(0);
|
||||
for(j=0;j<k;j++) if(selectedgroup[j].type==ELEMENT) {
|
||||
for(j=0;j<k;j++) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
|
||||
found=1;
|
||||
my_strdup(5, &prop, xctx->inst[selectedgroup[j].n].instname);
|
||||
my_strdup(5, &prop, xctx->inst[xctx->sel_array[j].n].instname);
|
||||
my_strcat(6, &prop, "_");
|
||||
tclsetvar("custom_label_prefix",prop);
|
||||
|
||||
|
|
@ -783,7 +783,7 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */
|
|||
rot_txt = tclgetvar("rotated_text");
|
||||
if(strcmp(rot_txt,"")) rotated_text=atoi(rot_txt);
|
||||
|
||||
my_strdup(7, &type,(xctx->inst[selectedgroup[j].n].ptr+ xctx->sym)->type);
|
||||
my_strdup(7, &type,(xctx->inst[xctx->sel_array[j].n].ptr+ xctx->sym)->type);
|
||||
if( type && IS_LABEL_OR_PIN(type) ) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -791,16 +791,16 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */
|
|||
if(!do_all_inst && !strcmp(tclgetvar("do_all_inst"),"1")) do_all_inst=1;
|
||||
|
||||
dbg(1, "attach_labels_to_inst(): 1--> %s %.16g %.16g %s\n",
|
||||
xctx->inst[selectedgroup[j].n].name,
|
||||
xctx->inst[selectedgroup[j].n].x0,
|
||||
xctx->inst[selectedgroup[j].n].y0,
|
||||
xctx->sym[xctx->inst[selectedgroup[j].n].ptr].name);
|
||||
xctx->inst[xctx->sel_array[j].n].name,
|
||||
xctx->inst[xctx->sel_array[j].n].x0,
|
||||
xctx->inst[xctx->sel_array[j].n].y0,
|
||||
xctx->sym[xctx->inst[xctx->sel_array[j].n].ptr].name);
|
||||
|
||||
x0 = xctx->inst[selectedgroup[j].n].x0;
|
||||
y0 = xctx->inst[selectedgroup[j].n].y0;
|
||||
rot = xctx->inst[selectedgroup[j].n].rot;
|
||||
flip = xctx->inst[selectedgroup[j].n].flip;
|
||||
symbol = xctx->sym + xctx->inst[selectedgroup[j].n].ptr;
|
||||
x0 = xctx->inst[xctx->sel_array[j].n].x0;
|
||||
y0 = xctx->inst[xctx->sel_array[j].n].y0;
|
||||
rot = xctx->inst[xctx->sel_array[j].n].rot;
|
||||
flip = xctx->inst[xctx->sel_array[j].n].flip;
|
||||
symbol = xctx->sym + xctx->inst[xctx->sel_array[j].n].ptr;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
|
||||
|
|
@ -829,7 +829,7 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */
|
|||
skip=0;
|
||||
while(iptr) {
|
||||
ii = iptr->n;
|
||||
if(ii == selectedgroup[j].n) {
|
||||
if(ii == xctx->sel_array[j].n) {
|
||||
iptr = iptr->next;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -895,9 +895,9 @@ void delete_files(void)
|
|||
{
|
||||
char str[PATH_MAX + 100];
|
||||
rebuild_selected_array();
|
||||
if(lastselected && selectedgroup[0].type==ELEMENT) {
|
||||
if(xctx->lastsel && xctx->sel_array[0].type==ELEMENT) {
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""));
|
||||
abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""));
|
||||
} else {
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(xctx->sch[xctx->currsch], ""));
|
||||
|
|
@ -910,19 +910,19 @@ void place_net_label(int type)
|
|||
struct stat buf;
|
||||
if(type == 1) {
|
||||
if(!stat(abs_sym_path("lab_pin.sym", ""), &buf)) {
|
||||
place_symbol(-1, "lab_pin.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1);
|
||||
place_symbol(-1, "lab_pin.sym", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1);
|
||||
} else if(!stat(abs_sym_path("devices/lab_pin.sym", ""), &buf)) {
|
||||
place_symbol(-1, "devices/lab_pin.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1);
|
||||
place_symbol(-1, "devices/lab_pin.sym", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1);
|
||||
}
|
||||
} else {
|
||||
if(!stat(abs_sym_path("lab_wire.sym", ""), &buf)) {
|
||||
place_symbol(-1, "lab_wire.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1);
|
||||
place_symbol(-1, "lab_wire.sym", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1);
|
||||
} else if(!stat(abs_sym_path("devices/lab_wire.sym", ""), &buf)) {
|
||||
place_symbol(-1, "devices/lab_wire.sym", mousex_snap, mousey_snap, 0, 0, NULL, 4, 1);
|
||||
place_symbol(-1, "devices/lab_wire.sym", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1);
|
||||
}
|
||||
}
|
||||
move_objects(START,0,0,0);
|
||||
ui_state |= START_SYMPIN;
|
||||
xctx->ui_state |= START_SYMPIN;
|
||||
}
|
||||
|
||||
/* draw_sym==4 select element after placing */
|
||||
|
|
@ -960,7 +960,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot,
|
|||
if(pos==-1 || pos > xctx->instances) n=xctx->instances;
|
||||
else
|
||||
{
|
||||
prepared_hash_instances = 0; /* instances moved so need to rebuild hash */
|
||||
xctx->prep_hash_inst = 0; /* instances moved so need to rebuild hash */
|
||||
for(j=xctx->instances;j>pos;j--)
|
||||
{
|
||||
xctx->inst[j]=xctx->inst[j-1];
|
||||
|
|
@ -975,8 +975,8 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot,
|
|||
dbg(1, "place_symbol(): entering my_strdup: name=%s\n",name); /* 03-02-2000 */
|
||||
my_strdup(12, &xctx->inst[n].name ,name);
|
||||
dbg(1, "place_symbol(): done my_strdup: name=%s\n",name); /* 03-02-2000 */
|
||||
/* xctx->inst[n].x0=symbol_name ? x : mousex_snap; */
|
||||
/* xctx->inst[n].y0=symbol_name ? y : mousey_snap; */
|
||||
/* xctx->inst[n].x0=symbol_name ? x : xctx->mousex_snap; */
|
||||
/* xctx->inst[n].y0=symbol_name ? y : xctx->mousey_snap; */
|
||||
xctx->inst[n].x0= x ; /* 20070228 x and y given in callback */
|
||||
xctx->inst[n].y0= y ;
|
||||
xctx->inst[n].rot=symbol_name ? rot : 0;
|
||||
|
|
@ -1008,14 +1008,14 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot,
|
|||
xctx->instances++; /* must be updated before calling symbol_bbox() */
|
||||
|
||||
|
||||
if(prepared_hash_instances) hash_inst(XINSERT, n); /* no need to rehash, add item */
|
||||
/* prepared_hash_instances=0; */
|
||||
if(xctx->prep_hash_inst) hash_inst(XINSERT, n); /* no need to rehash, add item */
|
||||
/* xctx->prep_hash_inst=0; */
|
||||
|
||||
|
||||
/* force these vars to 0 to trigger a prepare_netlist_structs(0) needed by symbol_bbox->translate
|
||||
* to translate @#n:net_name texts */
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
symbol_bbox(n, &xctx->inst[n].x1, &xctx->inst[n].y1,
|
||||
&xctx->inst[n].x2, &xctx->inst[n].y2);
|
||||
if(draw_sym & 3) bbox(ADD, xctx->inst[n].x1, xctx->inst[n].y1, xctx->inst[n].x2, xctx->inst[n].y2);
|
||||
|
|
@ -1029,11 +1029,11 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot,
|
|||
|
||||
if(draw_sym & 4 ) {
|
||||
select_element(n, SELECTED,0, 0);
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
drawtemparc(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtemprect(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtempline(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
need_rebuild_selected_array = 1;
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
rebuild_selected_array();
|
||||
}
|
||||
|
||||
|
|
@ -1044,13 +1044,13 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot,
|
|||
void symbol_in_new_window(void)
|
||||
{
|
||||
rebuild_selected_array();
|
||||
if(lastselected !=1 || selectedgroup[0].type!=ELEMENT)
|
||||
if(xctx->lastsel !=1 || xctx->sel_array[0].type!=ELEMENT)
|
||||
{
|
||||
new_window(xctx->sch[xctx->currsch],1);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_window(abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""),1);
|
||||
new_window(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""),1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1060,7 +1060,7 @@ void schematic_in_new_window(void)
|
|||
{
|
||||
char filename[PATH_MAX];
|
||||
rebuild_selected_array();
|
||||
if(lastselected !=1 || selectedgroup[0].type!=ELEMENT)
|
||||
if(xctx->lastsel !=1 || xctx->sel_array[0].type!=ELEMENT)
|
||||
{
|
||||
/* new_window("", 0); */
|
||||
new_window(xctx->sch[xctx->currsch], 0); /* 20111007 duplicate current schematic if no inst selected */
|
||||
|
|
@ -1069,22 +1069,22 @@ void schematic_in_new_window(void)
|
|||
else
|
||||
{
|
||||
if( /* do not descend if not subcircuit */
|
||||
(xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type &&
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type &&
|
||||
strcmp(
|
||||
(xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type,
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type,
|
||||
"subcircuit"
|
||||
) &&
|
||||
strcmp(
|
||||
(xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type,
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type,
|
||||
"primitive"
|
||||
)
|
||||
) return;
|
||||
|
||||
my_strncpy(filename, abs_sym_path(get_tok_value(
|
||||
(xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
, S(filename));
|
||||
if(!filename[0]) {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""), ".sch"), S(filename));
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
|
||||
new_window(filename, 0);
|
||||
|
|
@ -1097,13 +1097,13 @@ void launcher(void)
|
|||
char program[PATH_MAX];
|
||||
int n;
|
||||
rebuild_selected_array();
|
||||
if(lastselected ==1 && selectedgroup[0].type==ELEMENT)
|
||||
if(xctx->lastsel ==1 && xctx->sel_array[0].type==ELEMENT)
|
||||
{
|
||||
double mx=mousex, my=mousey;
|
||||
double mx=xctx->mousex, my=xctx->mousey;
|
||||
select_object(mx,my,SELECTED, 0);
|
||||
tcleval("update; after 300");
|
||||
select_object(mx,my,0, 0);
|
||||
n=selectedgroup[0].n;
|
||||
n=xctx->sel_array[0].n;
|
||||
my_strncpy(program, get_tok_value(xctx->inst[n].prop_ptr,"program",0), S(program)); /* handle backslashes */
|
||||
str = get_tok_value(xctx->inst[n].prop_ptr,"url",0); /* handle backslashes */
|
||||
dbg(1, "launcher(): str=%s\n", str);
|
||||
|
|
@ -1132,14 +1132,14 @@ void descend_schematic(int instnumber)
|
|||
int save_ok = 0;
|
||||
|
||||
rebuild_selected_array();
|
||||
if(lastselected !=1 || selectedgroup[0].type!=ELEMENT)
|
||||
if(xctx->lastsel !=1 || xctx->sel_array[0].type!=ELEMENT)
|
||||
{
|
||||
dbg(1, "descend_schematic(): wrong selection\n");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg(1, "descend_schematic(): selected:%s\n", xctx->inst[selectedgroup[0].n].name);
|
||||
dbg(1, "descend_schematic(): selected:%s\n", xctx->inst[xctx->sel_array[0].n].name);
|
||||
/* no name set for current schematic: save it before descending*/
|
||||
if(!strcmp(xctx->sch[xctx->currsch],""))
|
||||
{
|
||||
|
|
@ -1157,25 +1157,25 @@ void descend_schematic(int instnumber)
|
|||
if(save_ok==-1) return;
|
||||
}
|
||||
|
||||
dbg(1, "descend_schematic(): type of instance: %s\n", (xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type);
|
||||
dbg(1, "descend_schematic(): type of instance: %s\n", (xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type);
|
||||
|
||||
if( /* do not descend if not subcircuit */
|
||||
(xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type &&
|
||||
strcmp( (xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type, "subcircuit") &&
|
||||
strcmp( (xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type, "primitive")
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type &&
|
||||
strcmp( (xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type, "subcircuit") &&
|
||||
strcmp( (xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type, "primitive")
|
||||
) return;
|
||||
|
||||
if(modified)
|
||||
if(xctx->modified)
|
||||
{
|
||||
if(save(1)) return;
|
||||
}
|
||||
|
||||
/* build up current hierarchy path */
|
||||
dbg(1, "descend_schematic(): selected instname=%s\n", xctx->inst[selectedgroup[0].n].instname);
|
||||
dbg(1, "descend_schematic(): selected instname=%s\n", xctx->inst[xctx->sel_array[0].n].instname);
|
||||
|
||||
|
||||
if(xctx->inst[selectedgroup[0].n].instname && xctx->inst[selectedgroup[0].n].instname[0]) {
|
||||
str=expandlabel(xctx->inst[selectedgroup[0].n].instname, &inst_mult);
|
||||
if(xctx->inst[xctx->sel_array[0].n].instname && xctx->inst[xctx->sel_array[0].n].instname[0]) {
|
||||
str=expandlabel(xctx->inst[xctx->sel_array[0].n].instname, &inst_mult);
|
||||
} else {
|
||||
str = "";
|
||||
inst_mult = 1;
|
||||
|
|
@ -1213,7 +1213,7 @@ void descend_schematic(int instnumber)
|
|||
dbg(1, "descend_schematic(): current path: %s\n", xctx->sch_path[xctx->currsch+1]);
|
||||
dbg(1, "descend_schematic(): inst_number=%d\n", inst_number);
|
||||
|
||||
xctx->previous_instance[xctx->currsch]=selectedgroup[0].n;
|
||||
xctx->previous_instance[xctx->currsch]=xctx->sel_array[0].n;
|
||||
xctx->zoom_array[xctx->currsch].x=xctx->xorigin;
|
||||
xctx->zoom_array[xctx->currsch].y=xctx->yorigin;
|
||||
xctx->zoom_array[xctx->currsch].zoom=xctx->zoom;
|
||||
|
|
@ -1221,7 +1221,7 @@ void descend_schematic(int instnumber)
|
|||
hilight_child_pins();
|
||||
|
||||
my_strncpy(filename, abs_sym_path(get_tok_value(
|
||||
(xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
, S(filename));
|
||||
|
||||
unselect_all();
|
||||
|
|
@ -1229,7 +1229,7 @@ void descend_schematic(int instnumber)
|
|||
if(filename[0]) {
|
||||
load_schematic(1,filename, 1);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""), ".sch"), S(filename));
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(filename));
|
||||
load_schematic(1, filename, 1);
|
||||
}
|
||||
if(hilight_nets)
|
||||
|
|
@ -1237,7 +1237,7 @@ void descend_schematic(int instnumber)
|
|||
prepare_netlist_structs(0);
|
||||
if(enable_drill) drill_hilight();
|
||||
}
|
||||
dbg(1, "descend_schematic(): before zoom(): prepared_hash_instances=%d\n", prepared_hash_instances);
|
||||
dbg(1, "descend_schematic(): before zoom(): xctx->prep_hash_inst=%d\n", xctx->prep_hash_inst);
|
||||
zoom_full(1, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1253,7 +1253,7 @@ void go_back(int confirm) /* 20171006 add confirm */
|
|||
if(xctx->currsch>0)
|
||||
{
|
||||
/* if current sym/schematic is changed ask save before going up */
|
||||
if(modified)
|
||||
if(xctx->modified)
|
||||
{
|
||||
if(confirm) {
|
||||
tcleval("ask_save");
|
||||
|
|
@ -1276,12 +1276,12 @@ void go_back(int confirm) /* 20171006 add confirm */
|
|||
}
|
||||
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
|
||||
xctx->currsch--;
|
||||
save_modified = modified; /* we propagate modified flag (cleared by load_schematic */
|
||||
save_modified = xctx->modified; /* we propagate xctx->modified flag (cleared by load_schematic */
|
||||
/* by default) to parent schematic if going back from embedded symbol */
|
||||
|
||||
my_strncpy(filename, xctx->sch[xctx->currsch], S(filename));
|
||||
load_schematic(1, filename, 1);
|
||||
if(from_embedded_sym) modified=save_modified; /* to force ask save embedded sym in parent schematic */
|
||||
if(from_embedded_sym) xctx->modified=save_modified; /* to force ask save embedded sym in parent schematic */
|
||||
|
||||
hilight_parent_pins();
|
||||
if(enable_drill) drill_hilight();
|
||||
|
|
@ -1321,12 +1321,12 @@ void change_linewidth(double w)
|
|||
}
|
||||
XSetLineAttributes (display, gctiled, INT_WIDTH(xctx->lw), LineSolid, CapRound , JoinRound);
|
||||
}
|
||||
areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
areax2 = xrect[0].width+2*INT_WIDTH(xctx->lw);
|
||||
areay2 = xrect[0].height+2*INT_WIDTH(xctx->lw);
|
||||
areaw = areax2-areax1;
|
||||
areah = areay2 - areay1;
|
||||
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areax2 = xrect[0].width+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = xrect[0].height+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areaw = xctx->areax2-xctx->areax1;
|
||||
xctx->areah = xctx->areay2 - xctx->areay1;
|
||||
}
|
||||
|
||||
void calc_drawing_bbox(xRect *boundbox, int selected)
|
||||
|
|
@ -1452,8 +1452,9 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
int j, rects, found, hilight_conn_inst;
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
found = 0;
|
||||
hilight_conn_inst = !strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true") ||
|
||||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true");
|
||||
hilight_conn_inst = !strcmp(
|
||||
get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true") ||
|
||||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true");
|
||||
if( hilight_conn_inst && (rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0 ) {
|
||||
prepare_netlist_structs(0);
|
||||
for(j=0;j<rects;j++) {
|
||||
|
|
@ -1499,22 +1500,23 @@ void zoom_full(int dr, int sel)
|
|||
if(change_lw) {
|
||||
xctx->lw = 1.;
|
||||
}
|
||||
areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
areax2 = xrect[0].width+2*INT_WIDTH(xctx->lw);
|
||||
areay2 = xrect[0].height+2*INT_WIDTH(xctx->lw);
|
||||
areaw = areax2-areax1;
|
||||
areah = areay2 - areay1;
|
||||
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areax2 = xrect[0].width+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = xrect[0].height+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areaw = xctx->areax2-xctx->areax1;
|
||||
xctx->areah = xctx->areay2 - xctx->areay1;
|
||||
|
||||
calc_drawing_bbox(&boundbox, sel);
|
||||
xctx->zoom=(boundbox.x2-boundbox.x1)/(areaw-4*INT_WIDTH(xctx->lw));
|
||||
yy1=(boundbox.y2-boundbox.y1)/(areah-4*INT_WIDTH(xctx->lw));
|
||||
xctx->zoom=(boundbox.x2-boundbox.x1)/(xctx->areaw-4*INT_WIDTH(xctx->lw));
|
||||
yy1=(boundbox.y2-boundbox.y1)/(xctx->areah-4*INT_WIDTH(xctx->lw));
|
||||
if(yy1>xctx->zoom) xctx->zoom=yy1;
|
||||
xctx->zoom*=1.05;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
xctx->xorigin=-boundbox.x1+(areaw-4*INT_WIDTH(xctx->lw))/40*xctx->zoom;
|
||||
xctx->yorigin=(areah-4*INT_WIDTH(xctx->lw))*xctx->zoom-boundbox.y2 - (areah-4*INT_WIDTH(xctx->lw))/40*xctx->zoom;
|
||||
dbg(1, "zoom_full(): areaw=%d, areah=%d\n", areaw, areah);
|
||||
xctx->xorigin=-boundbox.x1+(xctx->areaw-4*INT_WIDTH(xctx->lw))/40*xctx->zoom;
|
||||
xctx->yorigin=(xctx->areah-4*INT_WIDTH(xctx->lw))*xctx->zoom-boundbox.y2 -
|
||||
(xctx->areah-4*INT_WIDTH(xctx->lw))/40*xctx->zoom;
|
||||
dbg(1, "zoom_full(): xctx->areaw=%d, xctx->areah=%d\n", xctx->areaw, xctx->areah);
|
||||
|
||||
change_linewidth(-1.);
|
||||
if(dr)
|
||||
|
|
@ -1533,8 +1535,8 @@ void view_zoom(double z)
|
|||
if(xctx->zoom<CADMINZOOM) return;
|
||||
xctx->zoom/= factor;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
xctx->xorigin=-mousex_snap+(mousex_snap+xctx->xorigin)/factor;
|
||||
xctx->yorigin=-mousey_snap+(mousey_snap+xctx->yorigin)/factor;
|
||||
xctx->xorigin=-xctx->mousex_snap+(xctx->mousex_snap+xctx->xorigin)/factor;
|
||||
xctx->yorigin=-xctx->mousey_snap+(xctx->mousey_snap+xctx->yorigin)/factor;
|
||||
change_linewidth(-1.);
|
||||
draw();
|
||||
}
|
||||
|
|
@ -1550,11 +1552,11 @@ void view_unzoom(double z)
|
|||
/* 20181022 make unzoom and zoom symmetric */
|
||||
/* keeping the mouse pointer as the origin */
|
||||
if(unzoom_nodrift) {
|
||||
xctx->xorigin=-mousex_snap+(mousex_snap+xctx->xorigin)*factor;
|
||||
xctx->yorigin=-mousey_snap+(mousey_snap+xctx->yorigin)*factor;
|
||||
xctx->xorigin=-xctx->mousex_snap+(xctx->mousex_snap+xctx->xorigin)*factor;
|
||||
xctx->yorigin=-xctx->mousey_snap+(xctx->mousey_snap+xctx->yorigin)*factor;
|
||||
} else {
|
||||
xctx->xorigin=xctx->xorigin+areaw*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->yorigin=xctx->yorigin+areah*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->xorigin=xctx->xorigin+xctx->areaw*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->yorigin=xctx->yorigin+xctx->areah*xctx->zoom*(1-1/factor)/2;
|
||||
}
|
||||
change_linewidth(-1.);
|
||||
draw();
|
||||
|
|
@ -1567,29 +1569,30 @@ void zoom_box(int what)
|
|||
|
||||
if( (what & START) )
|
||||
{
|
||||
x1=x2=mousex_snap;y1=y2=mousey_snap;
|
||||
ui_state |= STARTZOOM;
|
||||
x1=x2=xctx->mousex_snap;y1=y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTZOOM;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
ui_state &= ~STARTZOOM;
|
||||
xctx->ui_state &= ~STARTZOOM;
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
drawtemprect(gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
xctx->xorigin=-x1;xctx->yorigin=-y1;
|
||||
xctx->zoom=(x2-x1)/(areaw-4*INT_WIDTH(xctx->lw));
|
||||
yy1=(y2-y1)/(areah-4*INT_WIDTH(xctx->lw));
|
||||
xctx->zoom=(x2-x1)/(xctx->areaw-4*INT_WIDTH(xctx->lw));
|
||||
yy1=(y2-y1)/(xctx->areah-4*INT_WIDTH(xctx->lw));
|
||||
if(yy1>xctx->zoom) xctx->zoom=yy1;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
change_linewidth(-1.);
|
||||
draw();
|
||||
dbg(1, "zoom_box(): coord: %.16g %.16g %.16g %.16g zoom=%.16g\n",x1,y1,mousex_snap, mousey_snap,xctx->zoom);
|
||||
dbg(1, "zoom_box(): coord: %.16g %.16g %.16g %.16g zoom=%.16g\n",
|
||||
x1,y1,xctx->mousex_snap, xctx->mousey_snap,xctx->zoom);
|
||||
}
|
||||
if(what & RUBBER)
|
||||
{
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(gctiled,NOW, xx1,yy1,xx2,yy2);
|
||||
x2=mousex_snap;y2=mousey_snap;
|
||||
x2=xctx->mousex_snap;y2=xctx->mousey_snap;
|
||||
|
||||
|
||||
/* 20171211 update selected objects while dragging */
|
||||
|
|
@ -1621,10 +1624,10 @@ void draw_stuff(void)
|
|||
#endif
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
w=(float)(areaw*xctx->zoom/800) * rand() / (RAND_MAX+1.0);
|
||||
h=(float)(areah*xctx->zoom/80) * rand() / (RAND_MAX+1.0);
|
||||
x1=(float)(areaw*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->xorigin;
|
||||
y1=(float)(areah*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->yorigin;
|
||||
w=(float)(xctx->areaw*xctx->zoom/800) * rand() / (RAND_MAX+1.0);
|
||||
h=(float)(xctx->areah*xctx->zoom/80) * rand() / (RAND_MAX+1.0);
|
||||
x1=(float)(xctx->areaw*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->xorigin;
|
||||
y1=(float)(xctx->areah*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->yorigin;
|
||||
x2=x1+w;
|
||||
y2=y1+h;
|
||||
ORDER(x1,y1,x2,y2);
|
||||
|
|
@ -1638,10 +1641,10 @@ void draw_stuff(void)
|
|||
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
w=(float)(areaw*xctx->zoom/80) * rand() / (RAND_MAX+1.0);
|
||||
h=(float)(areah*xctx->zoom/800) * rand() / (RAND_MAX+1.0);
|
||||
x1=(float)(areaw*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->xorigin;
|
||||
y1=(float)(areah*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->yorigin;
|
||||
w=(float)(xctx->areaw*xctx->zoom/80) * rand() / (RAND_MAX+1.0);
|
||||
h=(float)(xctx->areah*xctx->zoom/800) * rand() / (RAND_MAX+1.0);
|
||||
x1=(float)(xctx->areaw*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->xorigin;
|
||||
y1=(float)(xctx->areah*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->yorigin;
|
||||
x2=x1+w;
|
||||
y2=y1+h;
|
||||
ORDER(x1,y1,x2,y2);
|
||||
|
|
@ -1657,8 +1660,8 @@ void draw_stuff(void)
|
|||
{
|
||||
w=(float)xctx->zoom * rand() / (RAND_MAX+1.0);
|
||||
h=w;
|
||||
x1=(float)(areaw*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->xorigin;
|
||||
y1=(float)(areah*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->yorigin;
|
||||
x1=(float)(xctx->areaw*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->xorigin;
|
||||
y1=(float)(xctx->areah*xctx->zoom) * rand() / (RAND_MAX+1.0)-xctx->yorigin;
|
||||
x2=x1+w;
|
||||
y2=y1+h;
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
|
|
@ -1683,7 +1686,7 @@ void restore_selection(double x1, double y1, double x2, double y2)
|
|||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
rebuild_selected_array();
|
||||
if(!lastselected) return;
|
||||
if(!xctx->lastsel) return;
|
||||
bbox(START,0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, xx1, yy1, xx2, yy2);
|
||||
bbox(SET,0.0, 0.0, 0.0, 0.0);
|
||||
|
|
@ -1697,7 +1700,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
static double xx1,yy1,xx2,yy2;
|
||||
|
||||
if( (what & PLACE) ) {
|
||||
if( (ui_state & STARTWIRE) && (x1!=x2 || y1!=y2) ) {
|
||||
if( (xctx->ui_state & STARTWIRE) && (x1!=x2 || y1!=y2) ) {
|
||||
push_undo();
|
||||
if(manhattan_lines==1) {
|
||||
if(xx2!=xx1) {
|
||||
|
|
@ -1732,8 +1735,8 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
drawline(WIRELAYER,NOW, xx1,yy1,xx2,yy2, 0);
|
||||
}
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
/* prepared_hash_wires = 0; */
|
||||
prepared_hilight_structs = 0;
|
||||
/* xctx->prep_hash_wires = 0; */
|
||||
xctx->prep_hi_structs = 0;
|
||||
|
||||
update_conn_cues(1,1);
|
||||
if(show_pin_net_names) {
|
||||
|
|
@ -1750,12 +1753,12 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
if(! (what &END)) {
|
||||
x1=mx_snap;
|
||||
y1=my_snap;
|
||||
x2=mousex_snap;
|
||||
y2=mousey_snap;
|
||||
x2=xctx->mousex_snap;
|
||||
y2=xctx->mousey_snap;
|
||||
xx1=x1;
|
||||
yy1=y1;
|
||||
xx2=mousex_snap;
|
||||
yy2=mousey_snap;
|
||||
xx2=xctx->mousex_snap;
|
||||
yy2=xctx->mousey_snap;
|
||||
if(manhattan_lines==1) {
|
||||
x2 = mx_snap; y2 = my_snap;
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
|
|
@ -1779,10 +1782,10 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
drawtempline(gc[WIRELAYER], NOW, xx1,yy1,xx2,yy2);
|
||||
}
|
||||
}
|
||||
ui_state |= STARTWIRE;
|
||||
xctx->ui_state |= STARTWIRE;
|
||||
}
|
||||
if( what & END) {
|
||||
ui_state &= ~STARTWIRE;
|
||||
xctx->ui_state &= ~STARTWIRE;
|
||||
}
|
||||
if( (what & RUBBER) ) {
|
||||
if(manhattan_lines==1) {
|
||||
|
|
@ -1840,12 +1843,12 @@ void change_layer()
|
|||
double x1,y1,x2,y2, a, b, r;
|
||||
|
||||
|
||||
if(lastselected) push_undo();
|
||||
for(k=0;k<lastselected;k++)
|
||||
if(xctx->lastsel) push_undo();
|
||||
for(k=0;k<xctx->lastsel;k++)
|
||||
{
|
||||
n=selectedgroup[k].n;
|
||||
type=selectedgroup[k].type;
|
||||
c=selectedgroup[k].col;
|
||||
n=xctx->sel_array[k].n;
|
||||
type=xctx->sel_array[k].type;
|
||||
c=xctx->sel_array[k].col;
|
||||
if(type==LINE && xctx->line[c][n].sel==SELECTED) {
|
||||
x1 = xctx->line[c][n].x1;
|
||||
y1 = xctx->line[c][n].y1;
|
||||
|
|
@ -1873,7 +1876,7 @@ void change_layer()
|
|||
storeobject(-1, x1,y1,x2,y2,xRECT,rectcolor, 0, xctx->rect[c][n].prop_ptr);
|
||||
}
|
||||
}
|
||||
if(lastselected) delete_only_rect_line_arc_poly();
|
||||
if(xctx->lastsel) delete_only_rect_line_arc_poly();
|
||||
unselect_all();
|
||||
}
|
||||
|
||||
|
|
@ -1888,19 +1891,19 @@ void new_arc(int what, double sweep)
|
|||
state=0;
|
||||
r = -1.;
|
||||
sweep_angle=sweep;
|
||||
xx1 = xx2 = x1 = x2 = x3 = mousex_snap;
|
||||
yy1 = yy2 = y1 = y2 = y3 = mousey_snap;
|
||||
ui_state |= STARTARC;
|
||||
xx1 = xx2 = x1 = x2 = x3 = xctx->mousex_snap;
|
||||
yy1 = yy2 = y1 = y2 = y3 = xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTARC;
|
||||
}
|
||||
if(what & SET) {
|
||||
if(state==0) {
|
||||
x2 = mousex_snap;
|
||||
y2 = mousey_snap;
|
||||
x2 = xctx->mousex_snap;
|
||||
y2 = xctx->mousey_snap;
|
||||
drawtempline(gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
state=1;
|
||||
} else if(state==1) {
|
||||
x3 = mousex_snap;
|
||||
y3 = mousey_snap;
|
||||
x3 = xctx->mousex_snap;
|
||||
y3 = xctx->mousey_snap;
|
||||
arc_3_points(x1, y1, x2, y2, x3, y3, &x, &y, &r, &a, &b);
|
||||
if(sweep_angle==360.) b=360.;
|
||||
if(r>0.) {
|
||||
|
|
@ -1908,22 +1911,22 @@ void new_arc(int what, double sweep)
|
|||
drawarc(rectcolor, NOW, x, y, r, a, b, 0, 0);
|
||||
store_arc(-1, x, y, r, a, b, rectcolor, 0, NULL);
|
||||
}
|
||||
ui_state &= ~STARTARC;
|
||||
xctx->ui_state &= ~STARTARC;
|
||||
state=0;
|
||||
}
|
||||
}
|
||||
if(what & RUBBER) {
|
||||
if(state==0) {
|
||||
drawtempline(gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
xx2 = mousex_snap;
|
||||
yy2 = mousey_snap;
|
||||
xx2 = xctx->mousex_snap;
|
||||
yy2 = xctx->mousey_snap;
|
||||
xx1 = x1;yy1 = y1;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gc[SELLAYER], NOW, xx1,yy1,xx2,yy2);
|
||||
}
|
||||
else if(state==1) {
|
||||
x3 = mousex_snap;
|
||||
y3 = mousey_snap;
|
||||
x3 = xctx->mousex_snap;
|
||||
y3 = xctx->mousey_snap;
|
||||
if(r>0.) drawtemparc(gctiled, NOW, x, y, r, a, b);
|
||||
arc_3_points(x1, y1, x2, y2, x3, y3, &x, &y, &r, &a, &b);
|
||||
if(sweep_angle==360.) b=360.;
|
||||
|
|
@ -1938,7 +1941,7 @@ void new_line(int what)
|
|||
|
||||
if( (what & PLACE) )
|
||||
{
|
||||
if( (x1!=x2 || y1!=y2) && (ui_state & STARTLINE) )
|
||||
if( (x1!=x2 || y1!=y2) && (xctx->ui_state & STARTLINE) )
|
||||
{
|
||||
push_undo();
|
||||
if(manhattan_lines==1) {
|
||||
|
|
@ -1974,12 +1977,12 @@ void new_line(int what)
|
|||
drawline(rectcolor,NOW, xx1,yy1,xx2,yy2, 0);
|
||||
}
|
||||
}
|
||||
x1=x2=mousex_snap;y1=y2=mousey_snap;
|
||||
ui_state |= STARTLINE;
|
||||
x1=x2=xctx->mousex_snap;y1=y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTLINE;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
ui_state &= ~STARTLINE;
|
||||
xctx->ui_state &= ~STARTLINE;
|
||||
}
|
||||
|
||||
if(what & RUBBER)
|
||||
|
|
@ -1992,7 +1995,7 @@ void new_line(int what)
|
|||
ORDER(xx2,yy1,xx2,yy2);
|
||||
drawtempline(gctiled, NOW, xx2,yy1,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = mousex_snap; y2 = mousey_snap;
|
||||
x2 = xctx->mousex_snap; y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy1);
|
||||
|
|
@ -2009,7 +2012,7 @@ void new_line(int what)
|
|||
ORDER(xx1,yy2,xx2,yy2);
|
||||
drawtempline(gctiled, NOW, xx1,yy2,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = mousex_snap; y2 = mousey_snap;
|
||||
x2 = xctx->mousex_snap; y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx1,yy2);
|
||||
|
|
@ -2023,7 +2026,7 @@ void new_line(int what)
|
|||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
restore_selection(x1, y1, x2, y2);
|
||||
x2 = mousex_snap; y2 = mousey_snap;
|
||||
x2 = xctx->mousex_snap; y2 = xctx->mousey_snap;
|
||||
if(!(what & CLEAR)) {
|
||||
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
|
|
@ -2040,7 +2043,7 @@ void new_rect(int what)
|
|||
|
||||
if( (what & PLACE) )
|
||||
{
|
||||
if( (x1!=x2 || y1!=y2) && (ui_state & STARTRECT) )
|
||||
if( (x1!=x2 || y1!=y2) && (xctx->ui_state & STARTRECT) )
|
||||
{
|
||||
int save_draw;
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
|
|
@ -2052,19 +2055,19 @@ void new_rect(int what)
|
|||
draw_window = save_draw;
|
||||
storeobject(-1, x1,y1,x2,y2,xRECT,rectcolor, 0, NULL);
|
||||
}
|
||||
x1=x2=mousex_snap;y1=y2=mousey_snap;
|
||||
ui_state |= STARTRECT;
|
||||
x1=x2=xctx->mousex_snap;y1=y2=xctx->mousey_snap;
|
||||
xctx->ui_state |= STARTRECT;
|
||||
}
|
||||
if( what & END)
|
||||
{
|
||||
ui_state &= ~STARTRECT;
|
||||
xctx->ui_state &= ~STARTRECT;
|
||||
}
|
||||
if(what & RUBBER)
|
||||
{
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(gctiled,NOW, xx1,yy1,xx2,yy2);
|
||||
x2=mousex_snap;y2=mousey_snap;
|
||||
x2=xctx->mousex_snap;y2=xctx->mousey_snap;
|
||||
xx1=x1;yy1=y1;xx2=x2;yy2=y2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(gc[rectcolor], NOW, xx1,yy1,xx2,yy2);
|
||||
|
|
@ -2088,13 +2091,13 @@ void new_polygon(int what)
|
|||
if( what & PLACE )
|
||||
{
|
||||
/* fprintf(errfp, "new_poly: PLACE, points=%d\n", points); */
|
||||
y[points]=mousey_snap;
|
||||
x[points]=mousex_snap;
|
||||
y[points]=xctx->mousey_snap;
|
||||
x[points]=xctx->mousex_snap;
|
||||
points++;
|
||||
x[points]=x[points-1]; /* prepare next point for rubber */
|
||||
y[points] = y[points-1];
|
||||
/* fprintf(errfp, "added point: %.16g %.16g\n", x[points-1], y[points-1]); */
|
||||
ui_state |= STARTPOLYGON;
|
||||
xctx->ui_state |= STARTPOLYGON;
|
||||
}
|
||||
if( what & ADD)
|
||||
{
|
||||
|
|
@ -2106,8 +2109,8 @@ void new_polygon(int what)
|
|||
y[points] = y[0];
|
||||
/* add point */
|
||||
} else if(x[points] != x[points-1] || y[points] != y[points-1]) {
|
||||
x[points] = mousex_snap;
|
||||
y[points] = mousey_snap;
|
||||
x[points] = xctx->mousex_snap;
|
||||
y[points] = xctx->mousey_snap;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2124,7 +2127,7 @@ void new_polygon(int what)
|
|||
store_poly(-1, x, y, points, rectcolor, 0, NULL);
|
||||
/* fprintf(errfp, "new_poly: finish: points=%d\n", points); */
|
||||
drawtemppolygon(gc[rectcolor], NOW, x, y, points);
|
||||
ui_state &= ~STARTPOLYGON;
|
||||
xctx->ui_state &= ~STARTPOLYGON;
|
||||
drawpolygon(rectcolor, NOW, x, y, points, 0, 0);
|
||||
my_free(711, &x);
|
||||
my_free(712, &y);
|
||||
|
|
@ -2134,8 +2137,8 @@ void new_polygon(int what)
|
|||
{
|
||||
/* fprintf(errfp, "new_poly: RUBBER\n"); */
|
||||
drawtemppolygon(gctiled, NOW, x, y, points+1);
|
||||
y[points] = mousey_snap;
|
||||
x[points] = mousex_snap;
|
||||
y[points] = xctx->mousey_snap;
|
||||
x[points] = xctx->mousex_snap;
|
||||
drawtemppolygon(gc[rectcolor], NOW, x, y, points+1);
|
||||
}
|
||||
}
|
||||
|
|
@ -2412,20 +2415,20 @@ void pan(int what)
|
|||
xx1=xpan;yy1=ypan;xx2=xpan2;yy2=ypan2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gctiled, NOW, xx1,yy1,xx2,yy2);
|
||||
xpan2=mousex_snap;ypan2=mousey_snap;
|
||||
xpan2=xctx->mousex_snap;ypan2=xctx->mousey_snap;
|
||||
xx1=xpan;yy1=ypan;xx2=xpan2;yy2=ypan2;
|
||||
ORDER(xx1,yy1,xx2,yy2);
|
||||
drawtempline(gc[SELLAYER], NOW, xx1,yy1,xx2,yy2);
|
||||
}
|
||||
if(what & START)
|
||||
{
|
||||
ui_state |= STARTPAN;
|
||||
xpan=mousex_snap;ypan=mousey_snap;xpan2=xpan;ypan2=ypan;
|
||||
xctx->ui_state |= STARTPAN;
|
||||
xpan=xctx->mousex_snap;ypan=xctx->mousey_snap;xpan2=xpan;ypan2=ypan;
|
||||
}
|
||||
if(what & END)
|
||||
{
|
||||
ui_state &= ~STARTPAN;
|
||||
xctx->xorigin+=-xpan+mousex_snap;xctx->yorigin+=-ypan+mousey_snap;
|
||||
xctx->ui_state &= ~STARTPAN;
|
||||
xctx->xorigin+=-xpan+xctx->mousex_snap;xctx->yorigin+=-ypan+xctx->mousey_snap;
|
||||
draw();
|
||||
}
|
||||
}
|
||||
|
|
@ -2447,7 +2450,7 @@ void select_rect(int what, int select)
|
|||
xx1=xr;xx2=xr2;yy1=yr;yy2=yr2;
|
||||
RECTORDER(xx1,yy1,xx2,yy2);
|
||||
drawtemprect(gctiled,NOW, xx1,yy1,xx2,yy2);
|
||||
xr2=mousex_snap;yr2=mousey_snap;
|
||||
xr2=xctx->mousex_snap;yr2=xctx->mousey_snap;
|
||||
|
||||
/* 20171026 update unselected objects while dragging */
|
||||
rebuild_selected_array();
|
||||
|
|
@ -2470,16 +2473,16 @@ void select_rect(int what, int select)
|
|||
* }
|
||||
*/
|
||||
sel = select;
|
||||
ui_state |= STARTSELECT;
|
||||
xctx->ui_state |= STARTSELECT;
|
||||
|
||||
/* use m[xy]_double_save instead of mouse[xy]_snap */
|
||||
/* to avoid delays in setting the start point of a */
|
||||
/* selection rectangle, this is noticeable and annoying on */
|
||||
/* networked / slow X servers. 20171218 */
|
||||
/* xr=xr2=mousex_snap; */
|
||||
/* yr=yr2=mousey_snap; */
|
||||
xr=xr2=mx_double_save;
|
||||
yr=yr2=my_double_save;
|
||||
/* xr=xr2=xctx->mousex_snap; */
|
||||
/* yr=yr2=xctx->mousey_snap; */
|
||||
xr=xr2=xctx->mx_double_save;
|
||||
yr=yr2=xctx->my_double_save;
|
||||
sem=1;
|
||||
}
|
||||
else if(what & END)
|
||||
|
|
@ -2497,7 +2500,7 @@ void select_rect(int what, int select)
|
|||
bbox(END,0.0, 0.0, 0.0, 0.0);
|
||||
/* /20171219 */
|
||||
|
||||
ui_state &= ~STARTSELECT;
|
||||
xctx->ui_state &= ~STARTSELECT;
|
||||
sem=0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
508
src/callback.c
508
src/callback.c
File diff suppressed because it is too large
Load Diff
42
src/check.c
42
src/check.c
|
|
@ -56,10 +56,10 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
if(!xctx->wires) return;
|
||||
if(!draw_dots) return;
|
||||
if(cadhalfdotsize*xctx->mooz<0.7) return;
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
x2 = X_TO_XSCHEM(xctx->areax2);
|
||||
y2 = Y_TO_XSCHEM(xctx->areay2);
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
k=wireptr->n;
|
||||
/* optimization when editing small areas (detailed zoom) of a huge schematic */
|
||||
|
|
@ -142,7 +142,7 @@ void trim_wires(void)
|
|||
static unsigned short *wireflag=NULL;
|
||||
|
||||
doloops = 0;
|
||||
prepared_hash_wires = 0;
|
||||
xctx->prep_hash_wires = 0;
|
||||
timer(0);
|
||||
do {
|
||||
dbg(1, "trim_wires(): start: %g\n", timer(1));
|
||||
|
|
@ -264,7 +264,7 @@ void trim_wires(void)
|
|||
}
|
||||
xctx->wires -= j;
|
||||
if(j) {
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
changed = 1;
|
||||
}
|
||||
dbg(1, "trim_wires(): delete_1: %g\n", timer(1));
|
||||
|
|
@ -359,15 +359,15 @@ void trim_wires(void)
|
|||
}
|
||||
xctx->wires -= j;
|
||||
if(j) {
|
||||
prepared_hash_wires=0; /* after wire deletions full rehash is needed */
|
||||
xctx->prep_hash_wires=0; /* after wire deletions full rehash is needed */
|
||||
changed = 1;
|
||||
}
|
||||
dbg(1, "trim_wires(): delete_2: %g\n", timer(1));
|
||||
|
||||
if(changed) {
|
||||
need_rebuild_selected_array = 1;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
set_modify(1);
|
||||
}
|
||||
} while(changed);
|
||||
|
|
@ -384,12 +384,12 @@ void break_wires_at_pins(void)
|
|||
int changed=0;
|
||||
|
||||
hash_wires();
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
rebuild_selected_array();
|
||||
|
||||
/* for(k=0;k<xctx->instances;k++) */
|
||||
for(j=0;j<lastselected;j++) if(selectedgroup[j].type==ELEMENT) {
|
||||
k = selectedgroup[j].n;
|
||||
for(j=0;j<xctx->lastsel;j++) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
k = xctx->sel_array[j].n;
|
||||
if( (rects = (xctx->inst[k].ptr+ xctx->sym)->rects[PINLAYER]) > 0 )
|
||||
{
|
||||
for(r=0;r<rects;r++)
|
||||
|
|
@ -426,7 +426,7 @@ void break_wires_at_pins(void)
|
|||
xctx->wire[xctx->wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx->wires, 0); /* insertion happens at beginning of list */
|
||||
my_strdup(32, &xctx->wire[xctx->wires].node, xctx->wire[i].node);
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
xctx->wires++;
|
||||
xctx->wire[i].x1 = x0;
|
||||
xctx->wire[i].y1 = y0;
|
||||
|
|
@ -436,14 +436,14 @@ void break_wires_at_pins(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
/* prepared_hash_wires=0; */
|
||||
/* xctx->prep_hash_wires=0; */
|
||||
/* hash_wires(); */
|
||||
rebuild_selected_array();
|
||||
for(j=0;j<lastselected;j++) if(selectedgroup[j].type==WIRE) {
|
||||
for(j=0;j<xctx->lastsel;j++) if(xctx->sel_array[j].type==WIRE) {
|
||||
/* for(k=0; k < xctx->wires; k++) { */
|
||||
int l;
|
||||
|
||||
k = selectedgroup[j].n;
|
||||
k = xctx->sel_array[j].n;
|
||||
for(l=0;l<2;l++) {
|
||||
if(l==0 ) {
|
||||
x0 = xctx->wire[k].x1;
|
||||
|
|
@ -481,7 +481,7 @@ void break_wires_at_pins(void)
|
|||
xctx->wire[xctx->wires].bus=0;
|
||||
xctx->wire[xctx->wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx->wires, 0); /* insertion happens at beginning of list */
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
xctx->wires++;
|
||||
xctx->wire[i].x1 = x0;
|
||||
xctx->wire[i].y1 = y0;
|
||||
|
|
@ -491,9 +491,9 @@ void break_wires_at_pins(void)
|
|||
}
|
||||
}
|
||||
set_modify(1);
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
/*update_conn_cues(0, 0); */
|
||||
|
||||
}
|
||||
|
|
|
|||
10
src/clip.c
10
src/clip.c
|
|
@ -31,9 +31,9 @@
|
|||
static int outcode(double x,double y)
|
||||
{
|
||||
register int code=0;
|
||||
if(y > xschem_h) code = UP;
|
||||
if(y > xctx->xschem_h) code = UP;
|
||||
else if(y < 0) code = DOWN;
|
||||
if(x > xschem_w) code |= RIGHT;
|
||||
if(x > xctx->xschem_w) code |= RIGHT;
|
||||
else if(x < 0) code |= LEFT;
|
||||
return code;
|
||||
}
|
||||
|
|
@ -53,11 +53,11 @@ int clip( double *xa,double *ya,double *xb,double *yb)
|
|||
{
|
||||
outpoint=outa? outa:outb;
|
||||
if(UP & outpoint)
|
||||
{x= *xa + (*xb-*xa) * (xschem_h - *ya) / (*yb - *ya); y = xschem_h;}
|
||||
{x= *xa + (*xb-*xa) * (xctx->xschem_h - *ya) / (*yb - *ya); y = xctx->xschem_h;}
|
||||
else if(DOWN & outpoint)
|
||||
{x= *xa + (*xb-*xa) * (0 - *ya) / (*yb - *ya); y = 0;}
|
||||
else if(RIGHT & outpoint)
|
||||
{y= *ya + (*yb-*ya) * (xschem_w - *xa) / (*xb - *xa); x = xschem_w;}
|
||||
{y= *ya + (*yb-*ya) * (xctx->xschem_w - *xa) / (*xb - *xa); x = xctx->xschem_w;}
|
||||
/* else if(LEFT & outpoint) */
|
||||
else
|
||||
{y= *ya + (*yb-*ya) * (0 - *xa) / (*xb - *xa); x = 0;}
|
||||
|
|
@ -98,7 +98,7 @@ double dist_from_rect(double mx, double my, double x1, double y1, double x2, dou
|
|||
if(tmp < dist) dist=tmp;
|
||||
|
||||
dbg(1, "dist_from_rect(): x1,y1,x2,y2=%.16g,%.16g,%.16g,%.16g\n",x1,y1,x2,y2);
|
||||
dbg(1, "dist_from_rect(): mx,my==%.16g,%.16g\n",mousex,mousey);
|
||||
dbg(1, "dist_from_rect(): mx,my==%.16g,%.16g\n",xctx->mousex,xctx->mousey);
|
||||
dbg(1, "dist_from_rect(): dist=%.16g\n",dist);
|
||||
return dist*dist;
|
||||
}
|
||||
|
|
|
|||
121
src/draw.c
121
src/draw.c
|
|
@ -59,15 +59,15 @@ void print_image()
|
|||
if(!has_x) return ;
|
||||
|
||||
changed_size = 0;
|
||||
w = ww = xschem_w;
|
||||
h = hh = xschem_h;
|
||||
w = ww = xctx->xschem_w;
|
||||
h = hh = xctx->xschem_h;
|
||||
if(!plotfile[0]) {
|
||||
my_snprintf(cmd, S(cmd), "input_line {Enter image size} {} {%dx%d}", xschem_w, xschem_h);
|
||||
my_snprintf(cmd, S(cmd), "input_line {Enter image size} {} {%dx%d}", xctx->xschem_w, xctx->xschem_h);
|
||||
tcleval(cmd);
|
||||
if(sscanf(tclresult(), "%dx%d", &w, &h) != 2) {
|
||||
w = xschem_w; h = xschem_h;
|
||||
w = xctx->xschem_w; h = xctx->xschem_h;
|
||||
} else {
|
||||
if(w != xschem_w || h != xschem_h) changed_size = 1;
|
||||
if(w != xctx->xschem_w || h != xctx->xschem_h) changed_size = 1;
|
||||
}
|
||||
my_strdup(60, &tmpstring, "tk_getSaveFile -title {Select destination file} -initialdir [pwd]");
|
||||
tcleval(tmpstring);
|
||||
|
|
@ -77,7 +77,7 @@ void print_image()
|
|||
else return;
|
||||
}
|
||||
|
||||
modified_save=modified; /* 20161121 save state */
|
||||
modified_save=xctx->modified; /* 20161121 save state */
|
||||
push_undo();
|
||||
trim_wires(); /* 20161121 add connection boxes on wires but undo at end */
|
||||
|
||||
|
|
@ -85,20 +85,20 @@ void print_image()
|
|||
|
||||
xrect[0].x = 0;
|
||||
xrect[0].y = 0;
|
||||
xschem_w = xrect[0].width = w;
|
||||
xschem_h = xrect[0].height = h;
|
||||
areax2 = w+2*INT_WIDTH(xctx->lw);
|
||||
areay2 = h+2*INT_WIDTH(xctx->lw);
|
||||
areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
areaw = areax2-areax1;
|
||||
areah = areay2-areay1;
|
||||
xctx->xschem_w = xrect[0].width = w;
|
||||
xctx->xschem_h = xrect[0].height = h;
|
||||
xctx->areax2 = w+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = h+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areaw = xctx->areax2-xctx->areax1;
|
||||
xctx->areah = xctx->areay2-xctx->areay1;
|
||||
saveorx = xctx->xorigin;
|
||||
saveory = xctx->yorigin;
|
||||
savezoom = xctx->zoom;
|
||||
#ifdef __unix__
|
||||
XFreePixmap(display,save_pixmap);
|
||||
/* save_pixmap = XCreatePixmap(display,window,areaw,areah,depth); */
|
||||
/* save_pixmap = XCreatePixmap(display,window,xctx->areaw,xctx->areah,depth); */
|
||||
save_pixmap = XCreatePixmap(display,window,w,h,depth); /* 20161119 pixmap should be exact size of */
|
||||
/* cliprectangle to avoid random borders */
|
||||
#else
|
||||
|
|
@ -156,29 +156,29 @@ void print_image()
|
|||
} else tcleval( "convert_to_png plot.xpm plot.png");
|
||||
my_strncpy(plotfile,"", S(plotfile));
|
||||
pop_undo(0); /* 20161121 restore state */
|
||||
modified=modified_save;
|
||||
xctx->modified=modified_save;
|
||||
|
||||
w=ww;h=hh;
|
||||
xrect[0].x = 0;
|
||||
xrect[0].y = 0;
|
||||
xschem_w = xrect[0].width = w;
|
||||
xschem_h = xrect[0].height = h;
|
||||
areax2 = w+2*INT_WIDTH(xctx->lw);
|
||||
areay2 = h+2*INT_WIDTH(xctx->lw);
|
||||
areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
areaw = areax2-areax1;
|
||||
areah = areay2-areay1;
|
||||
xctx->xschem_w = xrect[0].width = w;
|
||||
xctx->xschem_h = xrect[0].height = h;
|
||||
xctx->areax2 = w+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = h+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areaw = xctx->areax2-xctx->areax1;
|
||||
xctx->areah = xctx->areay2-xctx->areay1;
|
||||
xctx->zoom = savezoom;
|
||||
xctx->mooz = 1/xctx->zoom;
|
||||
xctx->xorigin = saveorx;
|
||||
xctx->yorigin = saveory;
|
||||
#ifdef __unix__
|
||||
XFreePixmap(display,save_pixmap);
|
||||
save_pixmap = XCreatePixmap(display,window,areaw,areah,depth);
|
||||
save_pixmap = XCreatePixmap(display,window,xctx->areaw,xctx->areah,depth);
|
||||
#else
|
||||
Tk_FreePixmap(display, save_pixmap);
|
||||
save_pixmap = Tk_GetPixmap(display, window, areaw, areah, depth);
|
||||
save_pixmap = Tk_GetPixmap(display, window, xctx->areaw, xctx->areah, depth);
|
||||
#endif
|
||||
XSetTile(display, gctiled, save_pixmap);
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ void draw_string(int layer, int what, const char *str, int rot, int flip, int hc
|
|||
if(size*xctx->mooz>1600) return; /* too big */
|
||||
|
||||
text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x,y, &textx1,&texty1,&textx2,&texty2);
|
||||
if(!textclip(areax1,areay1,areax2,areay2,textx1,texty1,textx2,texty2)) {
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ void draw_string(int layer, int what, const char *str, int rot, int flip, int hc
|
|||
text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1, &textx1,&texty1,&textx2,&texty2);
|
||||
xscale*=nocairo_font_xscale;
|
||||
yscale*=nocairo_font_yscale;
|
||||
if(!textclip(areax1,areay1,areax2,areay2,textx1,texty1,textx2,texty2)) return;
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) return;
|
||||
x1=textx1;y1=texty1;
|
||||
if(rot&1) {y1=texty2;rot=3;}
|
||||
else rot=0;
|
||||
|
|
@ -499,7 +499,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
|
|||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
else if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
{
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
|
|
@ -659,7 +659,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,int tmp_flip, int rot,
|
|||
x2=X_TO_SCREEN(xctx->inst[n].x2+xoffset);
|
||||
y1=Y_TO_SCREEN(xctx->inst[n].y1+yoffset);
|
||||
y2=Y_TO_SCREEN (xctx->inst[n].y2+yoffset);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
{
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
|
|
@ -761,22 +761,22 @@ void drawgrid()
|
|||
delta=cadgrid*xctx->mooz;
|
||||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xctx->xorigin*xctx->mooz;y = xctx->yorigin*xctx->mooz;
|
||||
if(y>areay1 && y<areay2)
|
||||
if(y>xctx->areay1 && y<xctx->areay2)
|
||||
{
|
||||
if(draw_window) XDrawLine(display, window, gc[GRIDLAYER],areax1+1,(int)y, areax2-1, (int)y);
|
||||
if(draw_window) XDrawLine(display, window, gc[GRIDLAYER],xctx->areax1+1,(int)y, xctx->areax2-1, (int)y);
|
||||
if(draw_pixmap)
|
||||
XDrawLine(display, save_pixmap, gc[GRIDLAYER],areax1+1,(int)y, areax2-1, (int)y);
|
||||
XDrawLine(display, save_pixmap, gc[GRIDLAYER],xctx->areax1+1,(int)y, xctx->areax2-1, (int)y);
|
||||
}
|
||||
if(x>areax1 && x<areax2)
|
||||
if(x>xctx->areax1 && x<xctx->areax2)
|
||||
{
|
||||
if(draw_window) XDrawLine(display, window, gc[GRIDLAYER],(int)x,areay1+1, (int)x, areay2-1);
|
||||
if(draw_window) XDrawLine(display, window, gc[GRIDLAYER],(int)x,xctx->areay1+1, (int)x, xctx->areay2-1);
|
||||
if(draw_pixmap)
|
||||
XDrawLine(display, save_pixmap, gc[GRIDLAYER],(int)x,areay1+1, (int)x, areay2-1);
|
||||
XDrawLine(display, save_pixmap, gc[GRIDLAYER],(int)x,xctx->areay1+1, (int)x, xctx->areay2-1);
|
||||
}
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx->yorigin*xctx->mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin*xctx->mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((xctx->areay1+1)/delta)*delta-fmod(-xctx->yorigin*xctx->mooz,delta);
|
||||
for(x=floor((xctx->areax1+1)/delta)*delta-fmod(-xctx->xorigin*xctx->mooz,delta);x<xctx->areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
for(y=tmp;y<xctx->areay2;y+=delta)
|
||||
{
|
||||
if(i>=CADMAXGRIDPOINTS)
|
||||
{
|
||||
|
|
@ -1006,7 +1006,7 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
|
|||
y1=Y_TO_SCREEN(y1);
|
||||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
xarc[i].x=(short)xx1;
|
||||
xarc[i].y=(short)yy1;
|
||||
|
|
@ -1028,7 +1028,7 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
|
|||
y1=Y_TO_SCREEN(y1);
|
||||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
XDrawArc(display, window, gc, xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
|
||||
}
|
||||
|
|
@ -1101,7 +1101,7 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b
|
|||
y1=Y_TO_SCREEN(y1);
|
||||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
xarc[i].x=(short)xx1;
|
||||
xarc[i].y=(short)yy1;
|
||||
|
|
@ -1123,7 +1123,7 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b
|
|||
y1=Y_TO_SCREEN(y1);
|
||||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(draw_window) XFillArc(display, window, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
|
||||
if(draw_pixmap) XFillArc(display, save_pixmap, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
|
||||
|
|
@ -1166,7 +1166,7 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
|
|||
y1=Y_TO_SCREEN(y1);
|
||||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
xarc[i].x=(short)xx1;
|
||||
xarc[i].y=(short)yy1;
|
||||
|
|
@ -1191,7 +1191,7 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
|
|||
y1=Y_TO_SCREEN(y1);
|
||||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(dash) {
|
||||
char dash_arr[2];
|
||||
|
|
@ -1245,7 +1245,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
|
|||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
if(!only_probes && (x2-x1)< 2 && (y2-y1)< 2) return;
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(draw_window) XFillRectangle(display, window, gcstipple[c], (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
|
|
@ -1271,7 +1271,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
|
|||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
if(!only_probes && (x2-x1)< 2 && (y2-y1)< 2) return;
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
r[i].x=(short)x1;
|
||||
r[i].y=(short)y1;
|
||||
|
|
@ -1370,7 +1370,7 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
|
|||
y1=Y_TO_SCREEN(y1);
|
||||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
if( !rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) ) {
|
||||
if( !rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) {
|
||||
return;
|
||||
}
|
||||
if( !only_probes && (x2-x1)<0.3 && (y2-y1)<0.3) return;
|
||||
|
|
@ -1415,7 +1415,7 @@ void drawtemppolygon(GC g, int what, double *x, double *y, int points)
|
|||
x2=X_TO_SCREEN(x2);
|
||||
y2=Y_TO_SCREEN(y2);
|
||||
p = my_malloc(39, sizeof(XPoint) * points);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) ) {
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) {
|
||||
for(i=0;i<points; i++) {
|
||||
p[i].x = X_TO_SCREEN(x[i]);
|
||||
p[i].y = Y_TO_SCREEN(y[i]);
|
||||
|
|
@ -1441,7 +1441,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double
|
|||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
if(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) return;
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(dash) {
|
||||
dash_arr[0] = dash_arr[1] = dash;
|
||||
|
|
@ -1477,7 +1477,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double
|
|||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
if(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) return;
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
r[i].x=(short)x1;
|
||||
r[i].y=(short)y1;
|
||||
|
|
@ -1508,7 +1508,7 @@ void drawtemprect(GC gc, int what, double rectx1,double recty1,double rectx2,dou
|
|||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
if( (x2-x1)< 0.3 && (y2-y1)< 0.3) return;
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
XDrawRectangle(display, window, gc, (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
|
|
@ -1528,7 +1528,7 @@ void drawtemprect(GC gc, int what, double rectx1,double recty1,double rectx2,dou
|
|||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
if( (x2-x1)< 0.3 && (y2-y1)< 0.3) return;
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
r[i].x=(short)x1;
|
||||
r[i].y=(short)y1;
|
||||
|
|
@ -1565,14 +1565,15 @@ void draw(void)
|
|||
rebuild_selected_array();
|
||||
if(has_x) {
|
||||
if(draw_pixmap)
|
||||
XFillRectangle(display, save_pixmap, gc[BACKLAYER], areax1, areay1, areaw, areah);
|
||||
if(draw_window) XFillRectangle(display, window, gc[BACKLAYER], areax1, areay1, areaw, areah);
|
||||
dbg(2, "draw(): window: %d %d %d %d\n",areax1, areay1, areax2, areay2);
|
||||
XFillRectangle(display, save_pixmap, gc[BACKLAYER], xctx->areax1, xctx->areay1, xctx->areaw, xctx->areah);
|
||||
if(draw_window)
|
||||
XFillRectangle(display, window, gc[BACKLAYER], xctx->areax1, xctx->areay1, xctx->areaw, xctx->areah);
|
||||
dbg(2, "draw(): window: %d %d %d %d\n",xctx->areax1, xctx->areay1, xctx->areax2, xctx->areay2);
|
||||
drawgrid();
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
x2 = X_TO_XSCHEM(xctx->areax2);
|
||||
y2 = Y_TO_XSCHEM(xctx->areay2);
|
||||
use_hash = (xctx->wires> 2000 || xctx->instances > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
|
||||
if(use_hash) {
|
||||
|
|
|
|||
172
src/editprop.c
172
src/editprop.c
|
|
@ -401,8 +401,8 @@ void edit_rect_property(void)
|
|||
const char *dash;
|
||||
int preserve;
|
||||
char *oldprop=NULL;
|
||||
if(xctx->rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(67, &oldprop, xctx->rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(67, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
tclsetvar("retval",oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -414,10 +414,10 @@ void edit_rect_property(void)
|
|||
{
|
||||
push_undo();
|
||||
set_modify(1);
|
||||
for(i=0; i<lastselected; i++) {
|
||||
if(selectedgroup[i].type != xRECT) continue;
|
||||
c = selectedgroup[i].col;
|
||||
n = selectedgroup[i].n;
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
if(xctx->sel_array[i].type != xRECT) continue;
|
||||
c = xctx->sel_array[i].col;
|
||||
n = xctx->sel_array[i].n;
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx->rect[c][n].prop_ptr,
|
||||
(char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
|
|
@ -456,8 +456,8 @@ void edit_line_property(void)
|
|||
const char *dash;
|
||||
int preserve;
|
||||
char *oldprop=NULL;
|
||||
if(xctx->line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(46, &oldprop, xctx->line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(46, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -470,10 +470,10 @@ void edit_line_property(void)
|
|||
push_undo();
|
||||
set_modify(1);
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
for(i=0; i<lastselected; i++) {
|
||||
if(selectedgroup[i].type != LINE) continue;
|
||||
c = selectedgroup[i].col;
|
||||
n = selectedgroup[i].n;
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
if(xctx->sel_array[i].type != LINE) continue;
|
||||
c = xctx->sel_array[i].col;
|
||||
n = xctx->sel_array[i].n;
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx->line[c][n].prop_ptr,
|
||||
(char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
|
|
@ -510,8 +510,8 @@ void edit_wire_property(void)
|
|||
char *oldprop=NULL;
|
||||
const char *bus_ptr;
|
||||
|
||||
if(xctx->wire[selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(47, &oldprop, xctx->wire[selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->wire[xctx->sel_array[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(47, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -523,14 +523,14 @@ void edit_wire_property(void)
|
|||
push_undo();
|
||||
set_modify(1);
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
for(i=0; i<lastselected; i++) {
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
int oldbus=0;
|
||||
int k = selectedgroup[i].n;
|
||||
if(selectedgroup[i].type != WIRE) continue;
|
||||
int k = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type != WIRE) continue;
|
||||
/* does not seem to be necessary */
|
||||
/* prepared_hash_wires=0;
|
||||
* prepared_netlist_structs=0;
|
||||
* prepared_hilight_structs=0; */
|
||||
/* xctx->prep_hash_wires=0;
|
||||
* xctx->prep_net_structs=0;
|
||||
* xctx->prep_hi_structs=0; */
|
||||
oldbus = xctx->wire[k].bus;
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx->wire[k].prop_ptr,
|
||||
|
|
@ -573,8 +573,8 @@ void edit_arc_property(void)
|
|||
const char *dash;
|
||||
int preserve;
|
||||
|
||||
if(xctx->arc[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(98, &oldprop, xctx->arc[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(98, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -585,11 +585,11 @@ void edit_arc_property(void)
|
|||
{
|
||||
|
||||
set_modify(1); push_undo();
|
||||
for(ii=0; ii<lastselected; ii++) {
|
||||
if(selectedgroup[ii].type != ARC) continue;
|
||||
for(ii=0; ii<xctx->lastsel; ii++) {
|
||||
if(xctx->sel_array[ii].type != ARC) continue;
|
||||
|
||||
i = selectedgroup[ii].n;
|
||||
c = selectedgroup[ii].col;
|
||||
i = xctx->sel_array[ii].n;
|
||||
c = xctx->sel_array[ii].col;
|
||||
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
|
|
@ -640,8 +640,8 @@ void edit_polygon_property(void)
|
|||
int preserve;
|
||||
|
||||
dbg(1, "edit_property(): input property:\n");
|
||||
if(xctx->poly[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(112, &oldprop, xctx->poly[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(112, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -652,11 +652,11 @@ void edit_polygon_property(void)
|
|||
{
|
||||
|
||||
set_modify(1); push_undo();
|
||||
for(ii=0; ii<lastselected; ii++) {
|
||||
if(selectedgroup[ii].type != POLYGON) continue;
|
||||
for(ii=0; ii<xctx->lastsel; ii++) {
|
||||
if(xctx->sel_array[ii].type != POLYGON) continue;
|
||||
|
||||
i = selectedgroup[ii].n;
|
||||
c = selectedgroup[ii].col;
|
||||
i = xctx->sel_array[ii].n;
|
||||
c = xctx->sel_array[ii].col;
|
||||
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
|
|
@ -714,7 +714,7 @@ void edit_text_property(int x)
|
|||
char *oldprop = NULL;
|
||||
|
||||
dbg(1, "edit_text_property(): entering\n");
|
||||
sel = selectedgroup[0].n;
|
||||
sel = xctx->sel_array[0].n;
|
||||
my_strdup(656, &oldprop, xctx->text[sel].prop_ptr);
|
||||
if(xctx->text[sel].prop_ptr !=NULL)
|
||||
tclsetvar("props",xctx->text[sel].prop_ptr);
|
||||
|
|
@ -749,10 +749,10 @@ void edit_text_property(int x)
|
|||
dbg(1, "edit_text_property(): rcode !=\"\"\n");
|
||||
set_modify(1); push_undo();
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
for(k=0;k<lastselected;k++)
|
||||
for(k=0;k<xctx->lastsel;k++)
|
||||
{
|
||||
if(selectedgroup[k].type!=xTEXT) continue;
|
||||
sel=selectedgroup[k].n;
|
||||
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;
|
||||
|
|
@ -871,7 +871,7 @@ void edit_symbol_property(int x)
|
|||
{
|
||||
char *result=NULL;
|
||||
|
||||
i=selectedgroup[0].n;
|
||||
i=xctx->sel_array[0].n;
|
||||
netlist_commands = 0;
|
||||
if ((xctx->inst[i].ptr + xctx->sym)->type!=NULL)
|
||||
netlist_commands = !strcmp( (xctx->inst[i].ptr+ xctx->sym)->type, "netlist_commands");
|
||||
|
|
@ -902,10 +902,10 @@ void edit_symbol_property(int x)
|
|||
else if(x==2) tcleval("viewdata $::retval");
|
||||
my_strdup(78, &result, tclresult());
|
||||
}
|
||||
dbg(1, "edit_symbol_property(): before update_symbol, modified=%d\n", modified);
|
||||
dbg(1, "edit_symbol_property(): before update_symbol, xctx->modified=%d\n", xctx->modified);
|
||||
update_symbol(result, x);
|
||||
my_free(728, &result);
|
||||
dbg(1, "edit_symbol_property(): done update_symbol, modified=%d\n", modified);
|
||||
dbg(1, "edit_symbol_property(): done update_symbol, xctx->modified=%d\n", xctx->modified);
|
||||
i=-1;
|
||||
}
|
||||
|
||||
|
|
@ -924,7 +924,7 @@ void update_symbol(const char *result, int x)
|
|||
int pushed=0;
|
||||
|
||||
dbg(1, "update_symbol(): entering\n");
|
||||
i=selectedgroup[0].n;
|
||||
i=xctx->sel_array[0].n;
|
||||
if(!result) {
|
||||
dbg(1, "update_symbol(): edit symbol prop aborted\n");
|
||||
return;
|
||||
|
|
@ -975,19 +975,19 @@ void update_symbol(const char *result, int x)
|
|||
sym_number = -1;
|
||||
if(strcmp(symbol, xctx->inst[i].name)) {
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
sym_number=match_symbol(symbol); /* check if exist */
|
||||
if(sym_number>=0) {
|
||||
prefix=(get_tok_value((xctx->sym+sym_number)->templ, "name",0))[0]; /* get new symbol prefix */
|
||||
}
|
||||
}
|
||||
|
||||
for(k=0;k<lastselected;k++) {
|
||||
for(k=0;k<xctx->lastsel;k++) {
|
||||
dbg(1, "update_symbol(): for k loop: k=%d\n", k);
|
||||
if(selectedgroup[k].type!=ELEMENT) continue;
|
||||
i=selectedgroup[k].n;
|
||||
if(xctx->sel_array[k].type!=ELEMENT) continue;
|
||||
i=xctx->sel_array[k].n;
|
||||
|
||||
/* 20171220 calculate bbox before changes to correctly redraw areas */
|
||||
/* must be recalculated as cairo text extents vary with zoom factor. */
|
||||
|
|
@ -1015,9 +1015,9 @@ void update_symbol(const char *result, int x)
|
|||
if(!pushed) { push_undo(); pushed=1;}
|
||||
my_strdup(111, &xctx->inst[i].prop_ptr, ss);
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
my_free(729, &ss);
|
||||
}
|
||||
|
|
@ -1028,17 +1028,17 @@ void update_symbol(const char *result, int x)
|
|||
if(!pushed) { push_undo(); pushed=1;}
|
||||
my_strdup(84, &xctx->inst[i].prop_ptr, new_prop);
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
} else {
|
||||
if(!pushed) { push_undo(); pushed=1;}
|
||||
my_strdup(86, &xctx->inst[i].prop_ptr, "");
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1064,16 +1064,16 @@ void update_symbol(const char *result, int x)
|
|||
else xctx->inst[i].flags &=~2;
|
||||
}
|
||||
my_strdup2(90, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name",0));
|
||||
} /* end for(k=0;k<lastselected;k++) */
|
||||
} /* end for(k=0;k<xctx->lastsel;k++) */
|
||||
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
if(modified) {
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
for(k=0;k<lastselected;k++) {
|
||||
if(selectedgroup[k].type!=ELEMENT) continue;
|
||||
i=selectedgroup[k].n;
|
||||
if(xctx->modified) {
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
for(k=0;k<xctx->lastsel;k++) {
|
||||
if(xctx->sel_array[k].type!=ELEMENT) continue;
|
||||
i=xctx->sel_array[k].n;
|
||||
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
|
||||
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
|
||||
}
|
||||
|
|
@ -1114,47 +1114,47 @@ void change_elem_order(void)
|
|||
int c, new_n;
|
||||
|
||||
rebuild_selected_array();
|
||||
if(lastselected==1)
|
||||
if(xctx->lastsel==1)
|
||||
{
|
||||
my_snprintf(tmp_txt, S(tmp_txt), "%d",selectedgroup[0].n);
|
||||
my_snprintf(tmp_txt, S(tmp_txt), "%d",xctx->sel_array[0].n);
|
||||
tclsetvar("retval",tmp_txt);
|
||||
tcleval("text_line {Object Sequence number} 0");
|
||||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
push_undo();
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
sscanf(tclgetvar("retval"), "%d",&new_n);
|
||||
|
||||
if(selectedgroup[0].type==ELEMENT)
|
||||
if(xctx->sel_array[0].type==ELEMENT)
|
||||
{
|
||||
if(new_n>=xctx->instances) new_n=xctx->instances-1;
|
||||
tmpinst=xctx->inst[new_n];
|
||||
xctx->inst[new_n]=xctx->inst[selectedgroup[0].n];
|
||||
xctx->inst[selectedgroup[0].n]=tmpinst;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", selectedgroup[0].n);
|
||||
xctx->inst[new_n]=xctx->inst[xctx->sel_array[0].n];
|
||||
xctx->inst[xctx->sel_array[0].n]=tmpinst;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", xctx->sel_array[0].n);
|
||||
}
|
||||
else if(selectedgroup[0].type==xRECT)
|
||||
else if(xctx->sel_array[0].type==xRECT)
|
||||
{
|
||||
c=selectedgroup[0].col;
|
||||
c=xctx->sel_array[0].col;
|
||||
if(new_n>=xctx->rects[c]) new_n=xctx->rects[c]-1;
|
||||
tmpbox=xctx->rect[c][new_n];
|
||||
xctx->rect[c][new_n]=xctx->rect[c][selectedgroup[0].n];
|
||||
xctx->rect[c][selectedgroup[0].n]=tmpbox;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", selectedgroup[0].n);
|
||||
xctx->rect[c][new_n]=xctx->rect[c][xctx->sel_array[0].n];
|
||||
xctx->rect[c][xctx->sel_array[0].n]=tmpbox;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", xctx->sel_array[0].n);
|
||||
}
|
||||
else if(selectedgroup[0].type==WIRE)
|
||||
else if(xctx->sel_array[0].type==WIRE)
|
||||
{
|
||||
if(new_n>=xctx->wires) new_n=xctx->wires-1;
|
||||
tmpwire=xctx->wire[new_n];
|
||||
xctx->wire[new_n]=xctx->wire[selectedgroup[0].n];
|
||||
xctx->wire[selectedgroup[0].n]=tmpwire;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", selectedgroup[0].n);
|
||||
xctx->wire[new_n]=xctx->wire[xctx->sel_array[0].n];
|
||||
xctx->wire[xctx->sel_array[0].n]=tmpwire;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", xctx->sel_array[0].n);
|
||||
}
|
||||
need_rebuild_selected_array = 1;
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1165,7 +1165,7 @@ void edit_property(int x)
|
|||
|
||||
if(!has_x) return;
|
||||
rebuild_selected_array(); /* from the .sel field in objects build */
|
||||
if(lastselected==0 ) /* the array of selected objs */
|
||||
if(xctx->lastsel==0 ) /* the array of selected objs */
|
||||
{
|
||||
char *old_prop = NULL;
|
||||
char *new_prop = NULL;
|
||||
|
|
@ -1262,15 +1262,15 @@ void edit_property(int x)
|
|||
return;
|
||||
}
|
||||
|
||||
switch(selectedgroup[0].type)
|
||||
switch(xctx->sel_array[0].type)
|
||||
{
|
||||
case ELEMENT:
|
||||
edit_symbol_property(x);
|
||||
while( x == 0 && tclgetvar("edit_symbol_prop_new_sel")[0] == '1' ) {
|
||||
unselect_all();
|
||||
select_object(mousex, mousey, SELECTED, 0);
|
||||
select_object(xctx->mousex, xctx->mousey, SELECTED, 0);
|
||||
rebuild_selected_array();
|
||||
if(lastselected && selectedgroup[0].type ==ELEMENT) {
|
||||
if(xctx->lastsel && xctx->sel_array[0].type ==ELEMENT) {
|
||||
edit_symbol_property(0);
|
||||
} else {
|
||||
break;
|
||||
|
|
|
|||
14
src/font.c
14
src/font.c
|
|
@ -38,19 +38,19 @@ void compile_font(void)
|
|||
select_inside(code*FONTOFFSET-1,-FONTHEIGHT-1,
|
||||
code*FONTOFFSET+FONTWIDTH+1,FONTWHITESPACE + FONTDESCENT+1, 1);
|
||||
rebuild_selected_array();
|
||||
character[code] = my_calloc(134, lastselected*4+1, sizeof(double));
|
||||
character[code][0] = (double)lastselected;
|
||||
character[code] = my_calloc(134, xctx->lastsel*4+1, sizeof(double));
|
||||
character[code][0] = (double)xctx->lastsel;
|
||||
dbg(2, "compile_font(): character[%d][]={%.16g",code,character[code][0]);
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
character[code][i*4+1] =
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].x1-code*FONTOFFSET;
|
||||
xctx->line[xctx->sel_array[i].col][xctx->sel_array[i].n].x1-code*FONTOFFSET;
|
||||
character[code][i*4+2] =
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].y1+FONTHEIGHT;
|
||||
xctx->line[xctx->sel_array[i].col][xctx->sel_array[i].n].y1+FONTHEIGHT;
|
||||
character[code][i*4+3] =
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].x2-code*FONTOFFSET;
|
||||
xctx->line[xctx->sel_array[i].col][xctx->sel_array[i].n].x2-code*FONTOFFSET;
|
||||
character[code][i*4+4] =
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].y2+FONTHEIGHT;
|
||||
xctx->line[xctx->sel_array[i].col][xctx->sel_array[i].n].y2+FONTHEIGHT;
|
||||
dbg(2, ",\n%.16g,%.16g,%.16g,%.16g",
|
||||
character[code][i*4+1],character[code][i*4+2],
|
||||
character[code][i*4+3],character[code][i*4+4]);
|
||||
|
|
|
|||
|
|
@ -163,8 +163,6 @@ int incr_hilight=1;
|
|||
int auto_hilight=0;
|
||||
unsigned int color_index[256]; /* layer color lookup table */
|
||||
unsigned int rectcolor ; /* this is the currently used layer */
|
||||
unsigned long ui_state = 0; /* this signals that we are doing a net place,panning etc. */
|
||||
/* used to prevent nesting of some commands */
|
||||
char *undo_dirname = NULL;
|
||||
int cur_undo_ptr=0;
|
||||
int tail_undo_ptr=0;
|
||||
|
|
@ -179,21 +177,12 @@ int cadlayers=0;
|
|||
int *enable_layer;
|
||||
int n_active_layers=0;
|
||||
int *active_layer;
|
||||
int need_rebuild_selected_array=1;
|
||||
int depth;
|
||||
int *fill_type; /*20171117 for every layer: 0: no fill, 1, solid fill, 2: stipple fill */
|
||||
char **color_array;
|
||||
int areax1,areay1,areax2,areay2,areaw,areah; /* window corners / size */
|
||||
int xschem_h, xschem_w; /* 20171130 window size */
|
||||
double mousex,mousey; /* mouse coord. */
|
||||
double mousex_snap,mousey_snap; /* mouse coord. snapped to grid */
|
||||
double mx_double_save, my_double_save;
|
||||
char *xschem_executable=NULL;
|
||||
double cadsnap = CADSNAP;
|
||||
double *character[256]; /* array or per-char coordinates of xschem internal vector font */
|
||||
int lastselected = 0;
|
||||
int max_selected;
|
||||
Selected *selectedgroup; /* array of selected objects to be */
|
||||
Tcl_Interp *interp;
|
||||
int do_netlist=0; /* set by process_options if user wants netllist from cmdline */
|
||||
int do_simulation=0;
|
||||
|
|
@ -206,20 +195,14 @@ int netlist_show=0;
|
|||
int flat_netlist=0;
|
||||
int netlist_type=-1;
|
||||
char bus_replacement_char[3] = {0, 0, 0};
|
||||
int prepared_netlist_structs=0;
|
||||
int prepared_hilight_structs=0;
|
||||
int prepared_hash_instances=0;
|
||||
int prepared_hash_wires=0;
|
||||
int horizontal_move=0;
|
||||
int vertical_move=0;
|
||||
int modified = 0;
|
||||
int color_ps=-1;
|
||||
int only_probes=0;
|
||||
int hilight_color=0;
|
||||
int pending_fullzoom=0;
|
||||
int split_files=0; /* split netlist files 20081202 */
|
||||
char *netlist_dir=NULL; /* user set netlist directory via cmd-option or menu or xschemrc */
|
||||
char user_top_netl_name[PATH_MAX] = ""; /* user set netlist name via cmd option -N <name> */
|
||||
int dark_colorscheme=1;
|
||||
double color_dim=0.0;
|
||||
int no_undo=0;
|
||||
|
|
|
|||
|
|
@ -314,9 +314,9 @@ void hilight_net_pin_mismatches(void)
|
|||
|
||||
rebuild_selected_array();
|
||||
prepare_netlist_structs(0);
|
||||
for(k=0; k<lastselected; k++) {
|
||||
if(selectedgroup[k].type!=ELEMENT) continue;
|
||||
j = selectedgroup[k].n ;
|
||||
for(k=0; k<xctx->lastsel; k++) {
|
||||
if(xctx->sel_array[k].type!=ELEMENT) continue;
|
||||
j = xctx->sel_array[k].n ;
|
||||
my_strdup(23, &type,(xctx->inst[j].ptr+ xctx->sym)->type);
|
||||
if( type && IS_LABEL_SH_OR_PIN(type)) break;
|
||||
symbol = xctx->sym + xctx->inst[j].ptr;
|
||||
|
|
@ -534,7 +534,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
}
|
||||
if(sel==1) {
|
||||
select_element(i, SELECTED, 1, 0);
|
||||
ui_state|=SELECTION;
|
||||
xctx->ui_state|=SELECTION;
|
||||
}
|
||||
|
||||
if(sel==-1) { /* 20171211 unselect */
|
||||
|
|
@ -577,7 +577,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
}
|
||||
if(sel==1) {
|
||||
select_wire(i,SELECTED, 1);
|
||||
ui_state|=SELECTION;
|
||||
xctx->ui_state|=SELECTION;
|
||||
}
|
||||
if(sel==-1) {
|
||||
select_wire(i,0, 1);
|
||||
|
|
@ -601,7 +601,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
{
|
||||
if(sel==1) {
|
||||
select_line(c, i,SELECTED, 1);
|
||||
ui_state|=SELECTION;
|
||||
xctx->ui_state|=SELECTION;
|
||||
}
|
||||
if(sel==-1) {
|
||||
select_line(c, i,0, 1);
|
||||
|
|
@ -626,7 +626,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
{
|
||||
if(sel==1) {
|
||||
select_box(c, i,SELECTED, 1);
|
||||
ui_state|=SELECTION;
|
||||
xctx->ui_state|=SELECTION;
|
||||
}
|
||||
if(sel==-1) {
|
||||
select_box(c, i,0, 1);
|
||||
|
|
@ -814,10 +814,10 @@ void hilight_net(int to_waveform)
|
|||
rebuild_selected_array();
|
||||
tcleval("sim_is_xyce");
|
||||
sim_is_xyce = atoi( tclresult() );
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
{
|
||||
case WIRE:
|
||||
hilight_nets=1;
|
||||
|
|
@ -863,10 +863,10 @@ void unhilight_net(void)
|
|||
prepare_netlist_structs(0);
|
||||
dbg(1, "unhilight_net(): entering\n");
|
||||
rebuild_selected_array();
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
{
|
||||
case WIRE:
|
||||
bus_hilight_lookup(xctx->wire[n].node, hilight_color, XDELETE);
|
||||
|
|
@ -946,7 +946,7 @@ void select_hilight_net(void)
|
|||
if(entry) xctx->inst[i].sel = SELECTED;
|
||||
}
|
||||
}
|
||||
need_rebuild_selected_array = 1;
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
rebuild_selected_array();
|
||||
redraw_hilights();
|
||||
|
||||
|
|
@ -969,10 +969,10 @@ void draw_hilight_net(int on_window)
|
|||
prepare_netlist_structs(0);
|
||||
save_draw = draw_window;
|
||||
draw_window = on_window;
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
x2 = X_TO_XSCHEM(xctx->areax2);
|
||||
y2 = Y_TO_XSCHEM(xctx->areay2);
|
||||
use_hash = (xctx->wires> 2000 || xctx->instances > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
if(use_hash) {
|
||||
hash_wires();
|
||||
|
|
@ -1024,7 +1024,7 @@ void draw_hilight_net(int on_window)
|
|||
y1=Y_TO_SCREEN(xctx->inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx->inst[i].y2);
|
||||
inst_color[i]=0;
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2)) continue;
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2)) continue;
|
||||
/* /20150409 */
|
||||
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
|
|
@ -1069,7 +1069,7 @@ void draw_hilight_net(int on_window)
|
|||
x2=X_TO_SCREEN(xctx->inst[i].x2);
|
||||
y1=Y_TO_SCREEN(xctx->inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx->inst[i].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2)) continue;
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2)) continue;
|
||||
dbg(1, "draw_hilight_net(): instance:%d\n",i);
|
||||
/* 20160414 from draw() */
|
||||
symptr = (xctx->inst[i].ptr+ xctx->sym);
|
||||
|
|
@ -1228,8 +1228,8 @@ void print_hilight_net(int show)
|
|||
|
||||
/* 20170323 this delete_netlist_structs is necessary, without it segfaults when going back (ctrl-e) */
|
||||
/* from a schematic after placing pins (ctrl-j) and changing some pin direction (ipin -->iopin) */
|
||||
prepared_hilight_structs=0;
|
||||
prepared_netlist_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
|
||||
/* delete_netlist_structs(); */
|
||||
my_free(781, &filetmp1);
|
||||
|
|
|
|||
|
|
@ -423,10 +423,10 @@ void pop_undo(int redo)
|
|||
|
||||
link_symbols_to_instances();
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
update_conn_cues(0, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
182
src/move.c
182
src/move.c
|
|
@ -31,36 +31,36 @@ static int rotatelocal=0;
|
|||
|
||||
|
||||
void rebuild_selected_array() /* can be used only if new selected set is lower */
|
||||
/* that is, selectedgroup[] size can not increase */
|
||||
/* that is, xctx->sel_array[] size can not increase */
|
||||
{
|
||||
int i,c;
|
||||
|
||||
dbg(1, "rebuild selected array\n");
|
||||
if(!need_rebuild_selected_array) return;
|
||||
lastselected=0;
|
||||
if(!xctx->need_reb_sel_arr) return;
|
||||
xctx->lastsel=0;
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
if(xctx->text[i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
selectedgroup[lastselected].type = xTEXT;
|
||||
selectedgroup[lastselected].n = i;
|
||||
selectedgroup[lastselected++].col = TEXTLAYER;
|
||||
xctx->sel_array[xctx->lastsel].type = xTEXT;
|
||||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = TEXTLAYER;
|
||||
}
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
if(xctx->inst[i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
selectedgroup[lastselected].type = ELEMENT;
|
||||
selectedgroup[lastselected].n = i;
|
||||
selectedgroup[lastselected++].col = WIRELAYER;
|
||||
xctx->sel_array[xctx->lastsel].type = ELEMENT;
|
||||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = WIRELAYER;
|
||||
}
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
if(xctx->wire[i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
selectedgroup[lastselected].type = WIRE;
|
||||
selectedgroup[lastselected].n = i;
|
||||
selectedgroup[lastselected++].col = WIRELAYER;
|
||||
xctx->sel_array[xctx->lastsel].type = WIRE;
|
||||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = WIRELAYER;
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
|
|
@ -68,36 +68,36 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
if(xctx->arc[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
selectedgroup[lastselected].type = ARC;
|
||||
selectedgroup[lastselected].n = i;
|
||||
selectedgroup[lastselected++].col = c;
|
||||
xctx->sel_array[xctx->lastsel].type = ARC;
|
||||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = c;
|
||||
}
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
if(xctx->rect[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
selectedgroup[lastselected].type = xRECT;
|
||||
selectedgroup[lastselected].n = i;
|
||||
selectedgroup[lastselected++].col = c;
|
||||
xctx->sel_array[xctx->lastsel].type = xRECT;
|
||||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = c;
|
||||
}
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
if(xctx->line[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
selectedgroup[lastselected].type = LINE;
|
||||
selectedgroup[lastselected].n = i;
|
||||
selectedgroup[lastselected++].col = c;
|
||||
xctx->sel_array[xctx->lastsel].type = LINE;
|
||||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = c;
|
||||
}
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
if(xctx->poly[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
selectedgroup[lastselected].type = POLYGON;
|
||||
selectedgroup[lastselected].n = i;
|
||||
selectedgroup[lastselected++].col = c;
|
||||
xctx->sel_array[xctx->lastsel].type = POLYGON;
|
||||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = c;
|
||||
}
|
||||
}
|
||||
need_rebuild_selected_array=0;
|
||||
xctx->need_reb_sel_arr=0;
|
||||
}
|
||||
|
||||
void check_collapsing_objects()
|
||||
|
|
@ -164,7 +164,7 @@ void check_collapsing_objects()
|
|||
}
|
||||
|
||||
if(found) {
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
rebuild_selected_array();
|
||||
}
|
||||
}
|
||||
|
|
@ -175,10 +175,10 @@ void update_symbol_bboxes(int rot, int flip)
|
|||
|
||||
for(i=0;i<lastsel;i++)
|
||||
{
|
||||
n = selectedgroup[i].n;
|
||||
n = xctx->sel_array[i].n;
|
||||
dbg(1, "update_symbol_bboxes(): i=%d, lastsel=%d, n=%d\n", i, lastsel, n);
|
||||
dbg(1, "update_symbol_bboxes(): symbol flip=%d, rot=%d\n", xctx->inst[n].flip, xctx->inst[n].rot);
|
||||
if(selectedgroup[i].type == ELEMENT) {
|
||||
if(xctx->sel_array[i].type == ELEMENT) {
|
||||
save_flip = xctx->inst[n].flip;
|
||||
save_rot = xctx->inst[n].rot;
|
||||
xctx->inst[n].flip = flip ^ xctx->inst[n].flip;
|
||||
|
|
@ -197,11 +197,11 @@ void draw_selection(GC g, int interruptable)
|
|||
int customfont;
|
||||
#endif
|
||||
|
||||
if(g == gc[SELLAYER]) lastsel = lastselected;
|
||||
if(g == gc[SELLAYER]) lastsel = xctx->lastsel;
|
||||
for(i=0;i<lastsel;i++)
|
||||
{
|
||||
c = selectedgroup[i].col;n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
{
|
||||
case xTEXT:
|
||||
if(rotatelocal) {
|
||||
|
|
@ -523,17 +523,17 @@ void copy_objects(int what)
|
|||
rebuild_selected_array();
|
||||
save_selection(1);
|
||||
deltax = deltay = 0.0;
|
||||
lastsel = lastselected;
|
||||
x1=mousex_snap;y_1=mousey_snap;
|
||||
lastsel = xctx->lastsel;
|
||||
x1=xctx->mousex_snap;y_1=xctx->mousey_snap;
|
||||
move_flip = 0;move_rot = 0;
|
||||
ui_state|=STARTCOPY;
|
||||
xctx->ui_state|=STARTCOPY;
|
||||
}
|
||||
if(what & ABORT) /* draw objects while moving */
|
||||
{
|
||||
char *str = NULL; /* 20161122 overflow safe */
|
||||
draw_selection(gctiled,0);
|
||||
move_rot=move_flip=deltax=deltay=0;
|
||||
ui_state&=~STARTCOPY;
|
||||
xctx->ui_state&=~STARTCOPY;
|
||||
my_strdup(225, &str, user_conf_dir);
|
||||
my_strcat(226, &str, "/.selection.sch");
|
||||
xunlink(str);
|
||||
|
|
@ -542,7 +542,7 @@ void copy_objects(int what)
|
|||
}
|
||||
if(what & RUBBER) /* draw objects while moving */
|
||||
{
|
||||
x2=mousex_snap;y_2=mousey_snap;
|
||||
x2=xctx->mousex_snap;y_2=xctx->mousey_snap;
|
||||
draw_selection(gctiled,0);
|
||||
deltax = x2-x1; deltay = y_2 - y_1;
|
||||
draw_selection(gc[SELLAYER],1);
|
||||
|
|
@ -575,13 +575,13 @@ void copy_objects(int what)
|
|||
newpropcnt=0;
|
||||
set_modify(1); push_undo(); /* 20150327 push_undo */
|
||||
firstw = firsti = 1;
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
n = selectedgroup[i].n;
|
||||
if(selectedgroup[i].type == WIRE)
|
||||
n = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type == WIRE)
|
||||
{
|
||||
if(firstw) {
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
firstw = 0;
|
||||
}
|
||||
check_wire_storage();
|
||||
|
|
@ -627,7 +627,7 @@ void copy_objects(int what)
|
|||
if(xctx->wire[n].sel == SELECTED1) xctx->wire[n].sel = SELECTED2;
|
||||
else if(xctx->wire[n].sel == SELECTED2) xctx->wire[n].sel = SELECTED1;
|
||||
}
|
||||
selectedgroup[i].n=xctx->wires;
|
||||
xctx->sel_array[i].n=xctx->wires;
|
||||
storeobject(-1, rx1,ry1,rx2,ry2,WIRE,0,xctx->wire[n].sel,xctx->wire[n].prop_ptr);
|
||||
xctx->wire[n].sel=0;
|
||||
if(xctx->wire[n].bus)
|
||||
|
|
@ -641,10 +641,10 @@ void copy_objects(int what)
|
|||
|
||||
for(k=0;k<cadlayers;k++)
|
||||
{
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
c = selectedgroup[i].col;n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
{
|
||||
case LINE:
|
||||
if(c!=k) break;
|
||||
|
|
@ -680,7 +680,7 @@ void copy_objects(int what)
|
|||
drawline(k, THICK, rx1,ry1,rx2,ry2, xctx->line[c][n].dash);
|
||||
else
|
||||
drawline(k, ADD, rx1,ry1,rx2,ry2, xctx->line[c][n].dash);
|
||||
selectedgroup[i].n=xctx->lines[c];
|
||||
xctx->sel_array[i].n=xctx->lines[c];
|
||||
storeobject(-1, rx1, ry1, rx2, ry2, LINE, c, xctx->line[c][n].sel, xctx->line[c][n].prop_ptr);
|
||||
xctx->line[c][n].sel=0;
|
||||
break;
|
||||
|
|
@ -715,7 +715,7 @@ void copy_objects(int what)
|
|||
}
|
||||
/* bbox(ADD, bx1, by1, bx2, by2); */
|
||||
drawpolygon(k, NOW, x, y, p->points, p->fill, p->dash); /* 20180914 added fill */
|
||||
selectedgroup[i].n=xctx->polygons[c];
|
||||
xctx->sel_array[i].n=xctx->polygons[c];
|
||||
store_poly(-1, x, y, p->points, c, p->sel, p->prop_ptr);
|
||||
p->sel=0;
|
||||
my_free(819, &x);
|
||||
|
|
@ -750,7 +750,7 @@ void copy_objects(int what)
|
|||
xctx->arc[c][n].sel=0;
|
||||
drawarc(k, ADD, rx1+deltax, ry1+deltay,
|
||||
xctx->arc[c][n].r, angle, xctx->arc[c][n].b, xctx->arc[c][n].fill, xctx->arc[c][n].dash);
|
||||
selectedgroup[i].n=xctx->arcs[c];
|
||||
xctx->sel_array[i].n=xctx->arcs[c];
|
||||
store_arc(-1, rx1+deltax, ry1+deltay,
|
||||
xctx->arc[c][n].r, angle, xctx->arc[c][n].b, c, SELECTED, xctx->arc[c][n].prop_ptr);
|
||||
break;
|
||||
|
|
@ -771,7 +771,7 @@ void copy_objects(int what)
|
|||
xctx->rect[c][n].sel=0;
|
||||
drawrect(k, ADD, rx1+deltax, ry1+deltay, rx2+deltax, ry2+deltay, xctx->rect[c][n].dash);
|
||||
filledrect(k, ADD, rx1+deltax, ry1+deltay, rx2+deltax, ry2+deltay);
|
||||
selectedgroup[i].n=xctx->rects[c];
|
||||
xctx->sel_array[i].n=xctx->rects[c];
|
||||
storeobject(-1, rx1+deltax, ry1+deltay,
|
||||
rx2+deltax, ry2+deltay,xRECT, c, SELECTED, xctx->rect[c][n].prop_ptr);
|
||||
break;
|
||||
|
|
@ -869,14 +869,14 @@ void copy_objects(int what)
|
|||
cairo_restore(cairo_save_ctx);
|
||||
}
|
||||
#endif
|
||||
selectedgroup[i].n=xctx->texts;
|
||||
xctx->sel_array[i].n=xctx->texts;
|
||||
xctx->texts++;
|
||||
dbg(2, "copy_objects(): done copy string\n");
|
||||
break;
|
||||
case ELEMENT:
|
||||
if(k==0) {
|
||||
if(firsti) {
|
||||
prepared_hash_instances = 0;
|
||||
xctx->prep_hash_inst = 0;
|
||||
firsti = 0;
|
||||
}
|
||||
check_inst_storage();
|
||||
|
|
@ -909,34 +909,34 @@ void copy_objects(int what)
|
|||
new_prop_string(xctx->instances, xctx->inst[n].prop_ptr,newpropcnt++, dis_uniq_names);
|
||||
my_strdup2(235, &xctx->inst[xctx->instances].instname,
|
||||
get_tok_value(xctx->inst[xctx->instances].prop_ptr, "name", 0));
|
||||
n=selectedgroup[i].n=xctx->instances;
|
||||
n=xctx->sel_array[i].n=xctx->instances;
|
||||
|
||||
xctx->instances++;
|
||||
}
|
||||
break;
|
||||
} /* end switch(selectedgroup[i].type) */
|
||||
} /* end for(i=0;i<lastselected;i++) */
|
||||
} /* end switch(xctx->sel_array[i].type) */
|
||||
} /* end for(i=0;i<xctx->lastsel;i++) */
|
||||
|
||||
|
||||
|
||||
if(k == 0 ) {
|
||||
/* force these vars to 0 to trigger a prepare_netlist_structs(0) needed by symbol_bbox->translate
|
||||
* to translate @#n:net_name texts */
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
rebuild_selected_array();
|
||||
if(!firsti || !firstw) {
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
if(show_pin_net_names) {
|
||||
prepare_netlist_structs(0);
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < lastselected; i++) {
|
||||
n = selectedgroup[i].n;
|
||||
for(i = 0; i < xctx->lastsel; i++) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if(k == 0) {
|
||||
if(selectedgroup[i].type == ELEMENT) {
|
||||
if(xctx->sel_array[i].type == ELEMENT) {
|
||||
int p;
|
||||
symbol_bbox(n, &xctx->inst[n].x1, &xctx->inst[n].y1, &xctx->inst[n].x2, &xctx->inst[n].y2 );
|
||||
bbox(ADD, xctx->inst[n].x1, xctx->inst[n].y1, xctx->inst[n].x2, xctx->inst[n].y2 );
|
||||
|
|
@ -946,7 +946,7 @@ void copy_objects(int what)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(show_pin_net_names && selectedgroup[i].type == WIRE) {
|
||||
if(show_pin_net_names && xctx->sel_array[i].type == WIRE) {
|
||||
find_inst_to_be_redrawn(xctx->wire[n].node);
|
||||
}
|
||||
}
|
||||
|
|
@ -960,7 +960,7 @@ void copy_objects(int what)
|
|||
} /* end for(k=0;k<cadlayers;k++) */
|
||||
check_collapsing_objects();
|
||||
update_conn_cues(1, 1);
|
||||
ui_state &= ~STARTCOPY;
|
||||
xctx->ui_state &= ~STARTCOPY;
|
||||
x1=y_1=x2=y_2=move_rot=move_flip=deltax=deltay=0;
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
|
|
@ -996,26 +996,26 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
rotatelocal=0;
|
||||
deltax = deltay = 0.0;
|
||||
rebuild_selected_array();
|
||||
lastsel = lastselected;
|
||||
if(lastselected==1 && selectedgroup[0].type==ARC &&
|
||||
xctx->arc[c=selectedgroup[0].col][n=selectedgroup[0].n].sel!=SELECTED) {
|
||||
lastsel = xctx->lastsel;
|
||||
if(xctx->lastsel==1 && xctx->sel_array[0].type==ARC &&
|
||||
xctx->arc[c=xctx->sel_array[0].col][n=xctx->sel_array[0].n].sel!=SELECTED) {
|
||||
x1 = xctx->arc[c][n].x;
|
||||
y_1 = xctx->arc[c][n].y;
|
||||
} else {x1=mousex_snap;y_1=mousey_snap;}
|
||||
} else {x1=xctx->mousex_snap;y_1=xctx->mousey_snap;}
|
||||
move_flip = 0;move_rot = 0;
|
||||
ui_state|=STARTMOVE;
|
||||
xctx->ui_state|=STARTMOVE;
|
||||
}
|
||||
if(what & ABORT) /* draw objects while moving */
|
||||
{
|
||||
draw_selection(gctiled,0);
|
||||
move_rot=move_flip=deltax=deltay=0;
|
||||
ui_state &= ~STARTMOVE;
|
||||
ui_state &= ~PLACE_SYMBOL;
|
||||
xctx->ui_state &= ~STARTMOVE;
|
||||
xctx->ui_state &= ~PLACE_SYMBOL;
|
||||
update_symbol_bboxes(0, 0);
|
||||
}
|
||||
if(what & RUBBER) /* abort operation */
|
||||
{
|
||||
x2=mousex_snap;y_2=mousey_snap;
|
||||
x2=xctx->mousex_snap;y_2=xctx->mousey_snap;
|
||||
draw_selection(gctiled,0);
|
||||
deltax = x2-x1; deltay = y_2 - y_1;
|
||||
draw_selection(gc[SELLAYER],1);
|
||||
|
|
@ -1044,11 +1044,11 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
draw_selection(gctiled,0);
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
set_modify(1);
|
||||
if( !(ui_state & (STARTMERGE | PLACE_SYMBOL)) ) {
|
||||
if( !(xctx->ui_state & (STARTMERGE | PLACE_SYMBOL)) ) {
|
||||
dbg(1, "move_objects(): push undo state\n");
|
||||
push_undo(); /* 20150327 push_undo */
|
||||
}
|
||||
ui_state &= ~PLACE_SYMBOL;
|
||||
xctx->ui_state &= ~PLACE_SYMBOL;
|
||||
if(dx!=0.0 || dy!=0.0) {
|
||||
deltax = dx;
|
||||
deltay = dy;
|
||||
|
|
@ -1056,10 +1056,10 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
|
||||
/* calculate moving symbols bboxes before actually doing the move */
|
||||
firsti = firstw = 1;
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
n = selectedgroup[i].n;
|
||||
if( selectedgroup[i].type == ELEMENT) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if( xctx->sel_array[i].type == ELEMENT) {
|
||||
int p;
|
||||
symbol_bbox(n, &inst[n].x1, &inst[n].y1, &inst[n].x2, &inst[n].y2 );
|
||||
bbox(ADD, inst[n].x1, inst[n].y1, inst[n].x2, inst[n].y2 );
|
||||
|
|
@ -1069,21 +1069,21 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(show_pin_net_names && selectedgroup[i].type == WIRE) {
|
||||
if(show_pin_net_names && xctx->sel_array[i].type == WIRE) {
|
||||
find_inst_to_be_redrawn(wire[n].node);
|
||||
}
|
||||
}
|
||||
if(show_pin_net_names) find_inst_hash_clear();
|
||||
for(k=0;k<cadlayers;k++)
|
||||
{
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
c = selectedgroup[i].col;n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
{
|
||||
case WIRE:
|
||||
if(firstw) {
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
firstw = 0;
|
||||
}
|
||||
if(k == 0) {
|
||||
|
|
@ -1407,7 +1407,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
case ELEMENT:
|
||||
if(k==0) {
|
||||
if(firsti) {
|
||||
prepared_hash_instances=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
firsti = 0;
|
||||
}
|
||||
if(rotatelocal) {
|
||||
|
|
@ -1423,24 +1423,24 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
|
||||
}
|
||||
break;
|
||||
} /* end switch(selectedgroup[i].type) */
|
||||
} /* end for(i=0;i<lastselected;i++) */
|
||||
} /* end switch(xctx->sel_array[i].type) */
|
||||
} /* end for(i=0;i<xctx->lastsel;i++) */
|
||||
|
||||
if(k == 0 ) {
|
||||
/* force these vars to 0 to trigger a prepare_netlist_structs(0) needed by symbol_bbox->translate
|
||||
* to translate @#n:net_name texts */
|
||||
if(!firsti || !firstw) {
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
if(show_pin_net_names) {
|
||||
prepare_netlist_structs(0);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < lastselected; i++) {
|
||||
n = selectedgroup[i].n;
|
||||
for(i = 0; i < xctx->lastsel; i++) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if(k == 0) {
|
||||
if(selectedgroup[i].type == ELEMENT) {
|
||||
if(xctx->sel_array[i].type == ELEMENT) {
|
||||
int p;
|
||||
symbol_bbox(n, &inst[n].x1, &inst[n].y1, &inst[n].x2, &inst[n].y2 );
|
||||
bbox(ADD, inst[n].x1, inst[n].y1, inst[n].x2, inst[n].y2 );
|
||||
|
|
@ -1450,7 +1450,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(show_pin_net_names && selectedgroup[i].type == WIRE) {
|
||||
if(show_pin_net_names && xctx->sel_array[i].type == WIRE) {
|
||||
find_inst_to_be_redrawn(wire[n].node);
|
||||
}
|
||||
}
|
||||
|
|
@ -1465,11 +1465,11 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
} /*end for(k=0;k<cadlayers;k++) */
|
||||
check_collapsing_objects();
|
||||
update_conn_cues(1, 1);
|
||||
ui_state &= ~STARTMOVE;
|
||||
ui_state &= ~STARTMERGE;
|
||||
xctx->ui_state &= ~STARTMOVE;
|
||||
xctx->ui_state &= ~STARTMERGE;
|
||||
x1=y_1=x2=y_2=move_rot=move_flip=deltax=deltay=0;
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
dbg(2, "move_objects(): bbox= %d %d %d %d\n", areax1, areay1, areaw, areah);
|
||||
dbg(2, "move_objects(): bbox= %d %d %d %d\n", xctx->areax1, xctx->areay1, xctx->areaw, xctx->areah);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
rotatelocal=0;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void del_inst_table(void)
|
|||
for(i=0;i<NBOXES;i++)
|
||||
for(j=0;j<NBOXES;j++)
|
||||
insttable[i][j] = delinstentry(insttable[i][j]);
|
||||
prepared_hash_instances=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
dbg(1, "del_inst_table(): cleared object hash table\n");
|
||||
}
|
||||
|
||||
|
|
@ -114,12 +114,12 @@ void hash_instances(void) /* 20171203 insert object bbox in spatial hash table *
|
|||
{
|
||||
int n;
|
||||
|
||||
if(prepared_hash_instances) return;
|
||||
if(xctx->prep_hash_inst) return;
|
||||
del_inst_table();
|
||||
for(n=0; n<xctx->instances; n++) {
|
||||
hash_inst(XINSERT, n);
|
||||
}
|
||||
prepared_hash_instances=1;
|
||||
xctx->prep_hash_inst=1;
|
||||
}
|
||||
|
||||
static void instpindelete(int n,int pin, int x, int y)
|
||||
|
|
@ -221,7 +221,7 @@ void del_wire_table(void)
|
|||
for(i=0;i<NBOXES;i++)
|
||||
for(j=0;j<NBOXES;j++)
|
||||
wiretable[i][j] = delwireentry(wiretable[i][j]);
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
}
|
||||
|
||||
void get_square(double x, double y, int *xx, int *yy)
|
||||
|
|
@ -349,11 +349,11 @@ void hash_wires(void)
|
|||
{
|
||||
int n;
|
||||
|
||||
if(prepared_hash_wires) return;
|
||||
if(xctx->prep_hash_wires) return;
|
||||
del_wire_table();
|
||||
|
||||
for(n=0; n<xctx->wires; n++) hash_wire(XINSERT, n, 0);
|
||||
prepared_hash_wires=1;
|
||||
xctx->prep_hash_wires=1;
|
||||
}
|
||||
|
||||
/* return 0 if library path of s matches any lib name in tcl variable $xschem_libs */
|
||||
|
|
@ -630,8 +630,8 @@ void prepare_netlist_structs(int for_netlist)
|
|||
xInstance * const inst = xctx->inst;
|
||||
int const instances = xctx->instances;
|
||||
|
||||
if (for_netlist>0 && prepared_netlist_structs) return;
|
||||
else if (!for_netlist && prepared_hilight_structs) return;
|
||||
if (for_netlist>0 && xctx->prep_net_structs) return;
|
||||
else if (!for_netlist && xctx->prep_hi_structs) return;
|
||||
/* delete instance pins spatial hash, wires spatial hash, node_hash, wires and inst nodes.*/
|
||||
else delete_netlist_structs();
|
||||
if(netlist_count == 0 ) startlevel = xctx->currsch;
|
||||
|
|
@ -803,7 +803,8 @@ void prepare_netlist_structs(int for_netlist)
|
|||
my_strdup(265, &xctx->wire[i].node , tmp_str);
|
||||
my_strdup(266, &xctx->wire[i].prop_ptr,
|
||||
subst_token(xctx->wire[i].prop_ptr, "lab", xctx->wire[i].node));
|
||||
bus_hash_lookup(xctx->wire[i].node,"", XINSERT, 0,"","","",""); /* insert unnamed wire name in hash table */
|
||||
/* insert unnamed wire name in hash table */
|
||||
bus_hash_lookup(xctx->wire[i].node,"", XINSERT, 0,"","","","");
|
||||
wirecheck(i);
|
||||
}
|
||||
}
|
||||
|
|
@ -1014,9 +1015,9 @@ void prepare_netlist_structs(int for_netlist)
|
|||
/*---------------------- */
|
||||
rebuild_selected_array();
|
||||
if (for_netlist>0) {
|
||||
prepared_netlist_structs=1;
|
||||
prepared_hilight_structs=1;
|
||||
} else prepared_hilight_structs=1;
|
||||
xctx->prep_net_structs=1;
|
||||
xctx->prep_hi_structs=1;
|
||||
} else xctx->prep_hi_structs=1;
|
||||
|
||||
my_free(835, &dir);
|
||||
my_free(836, &type);
|
||||
|
|
@ -1132,7 +1133,8 @@ int sym_vs_sch_pins()
|
|||
}
|
||||
|
||||
if(fscanf(fd, "%lf %lf %d %d", &tmpd, &tmpd, &tmpi, &tmpi) < 4) {
|
||||
fprintf(errfp,"sym_vs_sch_pins() WARNING: missing fields for INST object, filename=%s\n", filename);
|
||||
fprintf(errfp,"sym_vs_sch_pins() WARNING: missing fields for INST object, filename=%s\n",
|
||||
filename);
|
||||
read_line(fd, 0);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1304,6 +1306,6 @@ void delete_netlist_structs(void)
|
|||
del_inst_pin_table();
|
||||
free_node_hash();
|
||||
dbg(1, "delete_netlist_structs(): end erasing\n");
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void check_opt(char *opt, char *optval, int type)
|
|||
|
||||
} else if( (type == SHORT && *opt == 'N') || (type == LONG && !strcmp("netlist_filename", opt)) ) {
|
||||
dbg(1, "process_options(): set netlist name to %s\n", optval);
|
||||
if(optval) my_strncpy(user_top_netl_name, optval, S(user_top_netl_name));
|
||||
if(optval) my_strncpy(xctx->netlist_name, optval, S(xctx->netlist_name));
|
||||
|
||||
} else if( (type == SHORT && *opt == 's') || (type == LONG && !strcmp("spice", opt)) ) {
|
||||
dbg(1, "process_options(): set netlist type to spice\n");
|
||||
|
|
|
|||
32
src/paste.c
32
src/paste.c
|
|
@ -317,10 +317,10 @@ void merge_file(int selection_load, const char ext[])
|
|||
my_snprintf(name, S(name), "%s/.clipboard.sch", user_conf_dir);
|
||||
}
|
||||
if( (fd=fopen(name,"r"))!= NULL) {
|
||||
prepared_hilight_structs=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
got_mouse = 0;
|
||||
push_undo();
|
||||
unselect_all();
|
||||
|
|
@ -349,9 +349,9 @@ void merge_file(int selection_load, const char ext[])
|
|||
load_ascii_string(&aux_ptr, fd);
|
||||
if(selection_load)
|
||||
{
|
||||
mx_double_save = mousex_snap;
|
||||
my_double_save = mousey_snap;
|
||||
sscanf( aux_ptr, "%lf %lf", &mousex_snap, &mousey_snap);
|
||||
xctx->mx_double_save = xctx->mousex_snap;
|
||||
xctx->my_double_save = xctx->mousey_snap;
|
||||
sscanf( aux_ptr, "%lf %lf", &xctx->mousex_snap, &xctx->mousey_snap);
|
||||
got_mouse = 1;
|
||||
}
|
||||
break;
|
||||
|
|
@ -384,20 +384,20 @@ void merge_file(int selection_load, const char ext[])
|
|||
read_line(fd, 0); /* discard any remaining characters till (but not including) newline */
|
||||
}
|
||||
if(!got_mouse) {
|
||||
mx_double_save = mousex_snap;
|
||||
my_double_save = mousey_snap;
|
||||
mousex_snap = 0.;
|
||||
mousey_snap = 0.;
|
||||
xctx->mx_double_save = xctx->mousex_snap;
|
||||
xctx->my_double_save = xctx->mousey_snap;
|
||||
xctx->mousex_snap = 0.;
|
||||
xctx->mousey_snap = 0.;
|
||||
}
|
||||
my_free(875, &aux_ptr);
|
||||
match_merged_inst(old);
|
||||
fclose(fd);
|
||||
ui_state |= STARTMERGE;
|
||||
dbg(1, "merge_file(): loaded file:wire=%d inst=%d ui_state=%ld\n",
|
||||
xctx->wires , xctx->instances, ui_state);
|
||||
xctx->ui_state |= STARTMERGE;
|
||||
dbg(1, "merge_file(): loaded file:wire=%d inst=%d xctx->ui_state=%ld\n",
|
||||
xctx->wires , xctx->instances, xctx->ui_state);
|
||||
move_objects(START,0,0,0);
|
||||
mousex_snap = mx_double_save;
|
||||
mousey_snap = my_double_save;
|
||||
xctx->mousex_snap = xctx->mx_double_save;
|
||||
xctx->mousey_snap = xctx->my_double_save;
|
||||
move_objects(RUBBER,0,0,0);
|
||||
} else {
|
||||
dbg(0, "merge_file(): can not open %s\n", name);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in
|
|||
y1=Y_TO_PS(y1);
|
||||
x2=X_TO_PS(x2);
|
||||
y2=Y_TO_PS(y2);
|
||||
if( !rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) ) {
|
||||
if( !rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,doub
|
|||
y1=Y_TO_PS(recty1);
|
||||
x2=X_TO_PS(rectx2);
|
||||
y2=Y_TO_PS(recty2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / xctx->zoom;
|
||||
if(dash) {
|
||||
|
|
@ -164,7 +164,7 @@ static void ps_drawarc(int gc, int fillarc, double x,double y,double r,double a,
|
|||
x2=X_TO_PS(x2);
|
||||
y2=Y_TO_PS(y2);
|
||||
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / xctx->zoom;
|
||||
if(dash) {
|
||||
|
|
@ -219,7 +219,7 @@ static void ps_draw_string(int gctext, const char *str,
|
|||
xscale*=nocairo_font_xscale;
|
||||
yscale*=nocairo_font_yscale;
|
||||
|
||||
if(!textclip(areax1,areay1,areax2,areay2,rx1,ry1,rx2,ry2)) return;
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) return;
|
||||
set_ps_colors(gctext);
|
||||
x1=rx1;y1=ry1;
|
||||
if(rot&1) {y1=ry2;rot=3;}
|
||||
|
|
@ -262,19 +262,19 @@ static void ps_drawgrid()
|
|||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz;
|
||||
set_ps_colors(GRIDLAYER);
|
||||
if(y>areay1 && y<areay2)
|
||||
if(y>xctx->areay1 && y<xctx->areay2)
|
||||
{
|
||||
ps_xdrawline(GRIDLAYER,areax1+1,(int)y, areax2-1, (int)y);
|
||||
ps_xdrawline(GRIDLAYER,xctx->areax1+1,(int)y, xctx->areax2-1, (int)y);
|
||||
}
|
||||
if(x>areax1 && x<areax2)
|
||||
if(x>xctx->areax1 && x<xctx->areax2)
|
||||
{
|
||||
ps_xdrawline(GRIDLAYER,(int)x,areay1+1, (int)x, areay2-1);
|
||||
ps_xdrawline(GRIDLAYER,(int)x,xctx->areay1+1, (int)x, xctx->areay2-1);
|
||||
}
|
||||
set_ps_colors(GRIDLAYER);
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx->yorigin* xctx->mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((xctx->areay1+1)/delta)*delta-fmod(-xctx->yorigin* xctx->mooz,delta);
|
||||
for(x=floor((xctx->areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);x<xctx->areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
for(y=tmp;y<xctx->areay2;y+=delta)
|
||||
{
|
||||
ps_xdrawpoint(GRIDLAYER,(int)(x), (int)(y));
|
||||
}
|
||||
|
|
@ -304,7 +304,7 @@ static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
x2=X_TO_PS(xctx->inst[n].x2);
|
||||
y1=Y_TO_PS(xctx->inst[n].y1);
|
||||
y2=Y_TO_PS(xctx->inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
{
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
|
|
@ -441,7 +441,7 @@ void ps_draw(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
modified_save=modified;
|
||||
modified_save=xctx->modified;
|
||||
push_undo();
|
||||
trim_wires(); /* 20161121 add connection boxes on wires but undo at end */
|
||||
ps_colors=my_calloc(311, cadlayers, sizeof(Ps_color));
|
||||
|
|
@ -453,8 +453,8 @@ void ps_draw(void)
|
|||
old_grid=draw_grid;
|
||||
draw_grid=0;
|
||||
|
||||
dx=areax2-areax1;
|
||||
dy=areay2-areay1;
|
||||
dx=xctx->areax2-xctx->areax1;
|
||||
dy=xctx->areay2-xctx->areay1;
|
||||
dbg(1, "ps_draw(): dx=%.16g dy=%.16g\n", dx, dy);
|
||||
|
||||
fd=fopen("plot.ps", "w");
|
||||
|
|
@ -563,10 +563,10 @@ void ps_draw(void)
|
|||
int i;
|
||||
update_conn_cues(0, 0);
|
||||
/* draw connecting dots */
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
x2 = X_TO_XSCHEM(xctx->areax2);
|
||||
y2 = Y_TO_XSCHEM(xctx->areay2);
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
|
|
@ -599,6 +599,6 @@ void ps_draw(void)
|
|||
tcleval( tmp);
|
||||
my_free(880, &tmp);
|
||||
pop_undo(0);
|
||||
modified=modified_save;
|
||||
xctx->modified=modified_save;
|
||||
}
|
||||
|
||||
|
|
|
|||
86
src/save.c
86
src/save.c
|
|
@ -934,10 +934,10 @@ int save_schematic(const char *schname) /* 20171020 added return value */
|
|||
fclose(fd);
|
||||
my_strncpy(xctx->current_name, rel_sym_path(name), S(xctx->current_name));
|
||||
/* <<<<< >>>> why clear all these? */
|
||||
prepared_hilight_structs=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
if(!strstr(xctx->sch[xctx->currsch], ".xschem_embedded_")) {
|
||||
set_modify(0);
|
||||
}
|
||||
|
|
@ -978,10 +978,10 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
|
|||
static int save_netlist_type = 0;
|
||||
static int loaded_symbol = 0;
|
||||
|
||||
prepared_hilight_structs=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
if(reset_undo) clear_undo();
|
||||
if(filename && filename[0]) {
|
||||
my_strncpy(name, filename, S(name));
|
||||
|
|
@ -1041,7 +1041,7 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
|
|||
}
|
||||
if(has_x) { /* 20161207 moved after if( (fd=..)) */
|
||||
if(reset_undo) {
|
||||
tcleval( "wm title . \"xschem - [file tail [xschem get schname]]\""); /* 20150417 set window and icon title */
|
||||
tcleval( "wm title . \"xschem - [file tail [xschem get schname]]\""); /* set window and icon title */
|
||||
tcleval( "wm iconname . \"xschem - [file tail [xschem get schname]]\"");
|
||||
}
|
||||
}
|
||||
|
|
@ -1227,10 +1227,10 @@ void pop_undo(int redo)
|
|||
dbg(2, "pop_undo(): loaded file:wire=%d inst=%d\n",xctx->wires , xctx->instances);
|
||||
link_symbols_to_instances();
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
update_conn_cues(0, 0);
|
||||
|
||||
dbg(2, "pop_undo(): returning\n");
|
||||
|
|
@ -1378,7 +1378,7 @@ void align_sch_pins_with_sym(const char *name, int pos)
|
|||
}
|
||||
|
||||
/* replace i/o/iopin instances of LCC schematics with symbol pins (boxes on PINLAYER layer) */
|
||||
void add_pinlayer_boxes(int *lastr, xRect **bb, const char *symtype, char *prop_ptr, double inst_x0, double inst_y0)
|
||||
void add_pinlayer_boxes(int *lastr, xRect **bb, const char *symtype, char *prop_ptr, double i_x0, double i_y0)
|
||||
{
|
||||
int i, save;
|
||||
const char *label;
|
||||
|
|
@ -1386,8 +1386,8 @@ void add_pinlayer_boxes(int *lastr, xRect **bb, const char *symtype, char *prop_
|
|||
|
||||
i = lastr[PINLAYER];
|
||||
my_realloc(652, &bb[PINLAYER], (i + 1) * sizeof(xRect));
|
||||
bb[PINLAYER][i].x1 = inst_x0 - 2.5; bb[PINLAYER][i].x2 = inst_x0 + 2.5;
|
||||
bb[PINLAYER][i].y1 = inst_y0 - 2.5; bb[PINLAYER][i].y2 = inst_y0 + 2.5;
|
||||
bb[PINLAYER][i].x1 = i_x0 - 2.5; bb[PINLAYER][i].x2 = i_x0 + 2.5;
|
||||
bb[PINLAYER][i].y1 = i_y0 - 2.5; bb[PINLAYER][i].y2 = i_y0 + 2.5;
|
||||
RECTORDER(bb[PINLAYER][i].x1, bb[PINLAYER][i].y1, bb[PINLAYER][i].x2, bb[PINLAYER][i].y2);
|
||||
bb[PINLAYER][i].prop_ptr = NULL;
|
||||
label = get_tok_value(prop_ptr, "lab", 0);
|
||||
|
|
@ -1822,7 +1822,8 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
if (tmp) my_strdup(651, &tt[i].txt_ptr, tmp);
|
||||
ROTATION(rot, flip, 0.0, 0.0, tt[i].x0, tt[i].y0, rx1, ry1);
|
||||
tt[i].x0 = lcc[level].x0 + rx1; tt[i].y0 = lcc[level].y0 + ry1;
|
||||
tt[i].rot = (tt[i].rot + ((lcc[level].flip && (tt[i].rot & 1)) ? lcc[level].rot + 2 : lcc[level].rot)) & 0x3;
|
||||
tt[i].rot = (tt[i].rot + ((lcc[level].flip && (tt[i].rot & 1)) ?
|
||||
lcc[level].rot + 2 : lcc[level].rot)) & 0x3;
|
||||
tt[i].flip = lcc[level].flip ^ tt[i].flip;
|
||||
}
|
||||
tt[i].prop_ptr=NULL;
|
||||
|
|
@ -2094,14 +2095,14 @@ void create_sch_from_sym(void)
|
|||
/* printf("indirect=%d\n", indirect); */
|
||||
|
||||
rebuild_selected_array();
|
||||
if(lastselected > 1) return;
|
||||
if(lastselected==1 && selectedgroup[0].type==ELEMENT)
|
||||
if(xctx->lastsel > 1) return;
|
||||
if(xctx->lastsel==1 && xctx->sel_array[0].type==ELEMENT)
|
||||
{
|
||||
my_strncpy(schname, abs_sym_path(get_tok_value(
|
||||
(xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ), "")
|
||||
, S(schname));
|
||||
if(!schname[0]) {
|
||||
my_strncpy(schname, add_ext(abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""), ".sch"), S(schname));
|
||||
my_strncpy(schname, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(schname));
|
||||
}
|
||||
if( !stat(schname, &buf) ) {
|
||||
my_strdup(353, &savecmd, "ask_save \" create schematic file: ");
|
||||
|
|
@ -2129,7 +2130,7 @@ void create_sch_from_sym(void)
|
|||
fputc('\n', fd);
|
||||
fprintf(fd, "S {}");
|
||||
fputc('\n', fd);
|
||||
ptr = xctx->inst[selectedgroup[0].n].ptr+xctx->sym;
|
||||
ptr = xctx->inst[xctx->sel_array[0].n].ptr+xctx->sym;
|
||||
npin = ptr->rects[GENERICLAYER];
|
||||
rct = ptr->rect[GENERICLAYER];
|
||||
ypos=0;
|
||||
|
|
@ -2179,7 +2180,7 @@ void create_sch_from_sym(void)
|
|||
} /* for(i) */
|
||||
} /* for(j) */
|
||||
fclose(fd);
|
||||
} /* if(lastselected...) */
|
||||
} /* if(xctx->lastsel...) */
|
||||
my_free(916, &dir);
|
||||
my_free(917, &prop);
|
||||
my_free(918, &savecmd);
|
||||
|
|
@ -2194,39 +2195,39 @@ void descend_symbol(void)
|
|||
char name[PATH_MAX];
|
||||
char name_embedded[PATH_MAX];
|
||||
rebuild_selected_array();
|
||||
if(lastselected > 1) return;
|
||||
if(lastselected==1 && selectedgroup[0].type==ELEMENT) {
|
||||
if(modified) {
|
||||
if(xctx->lastsel > 1) return;
|
||||
if(xctx->lastsel==1 && xctx->sel_array[0].type==ELEMENT) {
|
||||
if(xctx->modified) {
|
||||
if(save(1)) return;
|
||||
}
|
||||
my_snprintf(name, S(name), "%s", xctx->inst[selectedgroup[0].n].name);
|
||||
my_snprintf(name, S(name), "%s", xctx->inst[xctx->sel_array[0].n].name);
|
||||
/* dont allow descend in the default missing symbol */
|
||||
if((xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type &&
|
||||
!strcmp( (xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->type,"missing")) return;
|
||||
if((xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type &&
|
||||
!strcmp( (xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->type,"missing")) return;
|
||||
}
|
||||
else return;
|
||||
|
||||
/* build up current hierarchy path */
|
||||
my_strdup(363, &str, xctx->inst[selectedgroup[0].n].instname);
|
||||
my_strdup(363, &str, xctx->inst[xctx->sel_array[0].n].instname);
|
||||
my_strdup(364, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
|
||||
my_strcat(365, &xctx->sch_path[xctx->currsch+1], str);
|
||||
my_strcat(366, &xctx->sch_path[xctx->currsch+1], ".");
|
||||
xctx->sch_inst_number[xctx->currsch+1] = 1;
|
||||
my_free(921, &str);
|
||||
xctx->previous_instance[xctx->currsch]=selectedgroup[0].n;
|
||||
xctx->previous_instance[xctx->currsch]=xctx->sel_array[0].n;
|
||||
xctx->zoom_array[xctx->currsch].x=xctx->xorigin;
|
||||
xctx->zoom_array[xctx->currsch].y=xctx->yorigin;
|
||||
xctx->zoom_array[xctx->currsch].zoom=xctx->zoom;
|
||||
++xctx->currsch;
|
||||
if((xctx->inst[selectedgroup[0].n].ptr+ xctx->sym)->flags & EMBEDDED ||
|
||||
!strcmp(get_tok_value(xctx->inst[selectedgroup[0].n].prop_ptr,"embed", 0), "true")) {
|
||||
if((xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->flags & EMBEDDED ||
|
||||
!strcmp(get_tok_value(xctx->inst[xctx->sel_array[0].n].prop_ptr,"embed", 0), "true")) {
|
||||
/* save embedded symbol into a temporary file */
|
||||
my_snprintf(name_embedded, S(name_embedded),
|
||||
"%s/.xschem_embedded_%d_%s", tclgetvar("XSCHEM_TMP_DIR"), getpid(), get_cell_w_ext(name, 0));
|
||||
if(!(fd = fopen(name_embedded, "w")) ) {
|
||||
fprintf(errfp, "descend_symbol(): problems opening file %s \n", name_embedded);
|
||||
}
|
||||
save_embedded_symbol(xctx->inst[selectedgroup[0].n].ptr+xctx->sym, fd);
|
||||
save_embedded_symbol(xctx->inst[xctx->sel_array[0].n].ptr+xctx->sym, fd);
|
||||
fclose(fd);
|
||||
unselect_all();
|
||||
remove_symbols(); /* must follow save (if) embedded */
|
||||
|
|
@ -2247,10 +2248,10 @@ void round_schematic_to_grid(double cadsnap)
|
|||
{
|
||||
int i, c, n, p;
|
||||
rebuild_selected_array();
|
||||
for(i=0;i<lastselected;i++)
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
c = selectedgroup[i].col; n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
c = xctx->sel_array[i].col; n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
{
|
||||
case xTEXT:
|
||||
SNAP_TO_GRID(xctx->text[n].x0);
|
||||
|
|
@ -2340,11 +2341,11 @@ void save_selection(int what)
|
|||
return;
|
||||
}
|
||||
fprintf(fd, "v {xschem version=%s file_version=%s}\n", XSCHEM_VERSION, XSCHEM_FILE_VERSION);
|
||||
fprintf(fd, "G { %.16g %.16g }\n", mousex_snap, mousey_snap);
|
||||
for(i=0;i<lastselected;i++)
|
||||
fprintf(fd, "G { %.16g %.16g }\n", xctx->mousex_snap, xctx->mousey_snap);
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
{
|
||||
c = selectedgroup[i].col;n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
{
|
||||
case xTEXT:
|
||||
fprintf(fd, "T ");
|
||||
|
|
@ -2357,7 +2358,8 @@ void save_selection(int what)
|
|||
break;
|
||||
|
||||
case ARC:
|
||||
fprintf(fd, "A %d %.16g %.16g %.16g %.16g %.16g ", c, xctx->arc[c][n].x, xctx->arc[c][n].y, xctx->arc[c][n].r,
|
||||
fprintf(fd, "A %d %.16g %.16g %.16g %.16g %.16g ",
|
||||
c, xctx->arc[c][n].x, xctx->arc[c][n].y, xctx->arc[c][n].r,
|
||||
xctx->arc[c][n].a, xctx->arc[c][n].b);
|
||||
save_ascii_string(xctx->arc[c][n].prop_ptr,fd);
|
||||
fputc('\n' ,fd);
|
||||
|
|
|
|||
154
src/scheduler.c
154
src/scheduler.c
|
|
@ -205,12 +205,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else if(!strcmp(argv[1],"add_symbol_pin")) {
|
||||
unselect_all();
|
||||
storeobject(-1, mousex_snap-2.5, mousey_snap-2.5, mousex_snap+2.5, mousey_snap+2.5,
|
||||
storeobject(-1, xctx->mousex_snap-2.5, xctx->mousey_snap-2.5, xctx->mousex_snap+2.5, xctx->mousey_snap+2.5,
|
||||
xRECT, PINLAYER, SELECTED, "name=XXX\ndir=inout");
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
rebuild_selected_array();
|
||||
move_objects(START,0,0,0);
|
||||
ui_state |= START_SYMPIN;
|
||||
xctx->ui_state |= START_SYMPIN;
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
else if(!strcmp(argv[1],"make_symbol"))
|
||||
|
|
@ -278,19 +278,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(factor == 0.) factor = 1.;
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
xctx->xorigin=-x1;xctx->yorigin=-y1;
|
||||
xctx->zoom=(x2-x1)/(areaw-4*INT_WIDTH(xctx->lw));
|
||||
yy1=(y2-y1)/(areah-4*INT_WIDTH(xctx->lw));
|
||||
xctx->zoom=(x2-x1)/(xctx->areaw-4*INT_WIDTH(xctx->lw));
|
||||
yy1=(y2-y1)/(xctx->areah-4*INT_WIDTH(xctx->lw));
|
||||
if(yy1>xctx->zoom) xctx->zoom=yy1;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
xctx->xorigin=xctx->xorigin+areaw*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->yorigin=xctx->yorigin+areah*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->xorigin=xctx->xorigin+xctx->areaw*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->yorigin=xctx->yorigin+xctx->areah*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->zoom*= factor;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
change_linewidth(-1.);
|
||||
draw();
|
||||
}
|
||||
else {
|
||||
ui_state |=MENUSTARTZOOM;
|
||||
xctx->ui_state |=MENUSTARTZOOM;
|
||||
}
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
|
@ -312,21 +312,21 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
int ret;
|
||||
semaphore++;
|
||||
mx_double_save = mousex_snap;
|
||||
my_double_save = mousey_snap;
|
||||
xctx->mx_double_save = xctx->mousex_snap;
|
||||
xctx->my_double_save = xctx->mousey_snap;
|
||||
if(argc == 4) {
|
||||
ret = place_symbol(-1,argv[2],mousex_snap, mousey_snap, 0, 0, argv[3], 4, 1);
|
||||
ret = place_symbol(-1,argv[2],xctx->mousex_snap, xctx->mousey_snap, 0, 0, argv[3], 4, 1);
|
||||
} else if(argc == 3) {
|
||||
ret = place_symbol(-1,argv[2],mousex_snap, mousey_snap, 0, 0, NULL, 4, 1);
|
||||
ret = place_symbol(-1,argv[2],xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1);
|
||||
} else {
|
||||
ret = place_symbol(-1,NULL,mousex_snap, mousey_snap, 0, 0, NULL, 4, 1);
|
||||
ret = place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1);
|
||||
}
|
||||
|
||||
if(ret) {
|
||||
mousey_snap = my_double_save;
|
||||
mousex_snap = mx_double_save;
|
||||
xctx->mousey_snap = xctx->my_double_save;
|
||||
xctx->mousex_snap = xctx->mx_double_save;
|
||||
move_objects(START,0,0,0);
|
||||
ui_state |= PLACE_SYMBOL;
|
||||
xctx->ui_state |= PLACE_SYMBOL;
|
||||
}
|
||||
semaphore--;
|
||||
Tcl_ResetResult(interp);
|
||||
|
|
@ -334,8 +334,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
|
||||
else if(!strcmp(argv[1],"place_text"))
|
||||
{
|
||||
ui_state |= MENUSTARTTEXT;
|
||||
/* place_text(0,mousex_snap, mousey_snap); */
|
||||
xctx->ui_state |= MENUSTARTTEXT;
|
||||
/* place_text(0,xctx->mousex_snap, xctx->mousey_snap); */
|
||||
/* move_objects(START,0,0,0); */
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
|
||||
else if(!strcmp(argv[1],"exit"))
|
||||
{
|
||||
if(modified && has_x) {
|
||||
if(xctx->modified && has_x) {
|
||||
tcleval("tk_messageBox -type okcancel -message {UNSAVED data: want to exit?}");
|
||||
if(strcmp(tclresult(),"ok")==0) tcleval( "exit");
|
||||
}
|
||||
|
|
@ -398,10 +398,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_ResetResult(interp);
|
||||
}
|
||||
else if(!strcmp(argv[1], "rebuild_connectivity")) {
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
prepare_netlist_structs(0);
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
|
@ -442,10 +442,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
draw();
|
||||
set_modify(0);
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
if(has_x) {
|
||||
tcleval( "wm title . \"xschem - [file tail [xschem get schname]]\""); /* set window and icon title */
|
||||
tcleval( "wm iconname . \"xschem - [file tail [xschem get schname]]\"");
|
||||
|
|
@ -529,9 +529,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
push_undo();
|
||||
}
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
if(!strcmp(argv[3], "name")) hash_all_names(inst);
|
||||
if(argc >= 5) {
|
||||
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], argv[4]),fast, dis_uniq_names);
|
||||
|
|
@ -581,9 +581,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
push_undo();
|
||||
set_modify(1);
|
||||
if(!fast) {
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
sym_number=match_symbol(symbol);
|
||||
if(sym_number>=0)
|
||||
|
|
@ -791,13 +791,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int n, i;
|
||||
char *res = NULL;
|
||||
rebuild_selected_array();
|
||||
for(n=0; n < lastselected; n++) {
|
||||
if(selectedgroup[n].type == ELEMENT) {
|
||||
i = selectedgroup[n].n;
|
||||
for(n=0; n < xctx->lastsel; n++) {
|
||||
if(xctx->sel_array[n].type == ELEMENT) {
|
||||
i = xctx->sel_array[n].n;
|
||||
my_strcat(1191, &res, "{");
|
||||
my_strcat(1192, &res, xctx->inst[i].instname);
|
||||
my_strcat(645, &res, "}");
|
||||
if(n < lastselected-1) my_strcat(646, &res, " ");
|
||||
if(n < xctx->lastsel-1) my_strcat(646, &res, " ");
|
||||
}
|
||||
}
|
||||
Tcl_AppendResult(interp, res, NULL);
|
||||
|
|
@ -806,11 +806,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int n, i;
|
||||
char *res = NULL;
|
||||
rebuild_selected_array();
|
||||
for(n=0; n < lastselected; n++) {
|
||||
if(selectedgroup[n].type == WIRE) {
|
||||
i = selectedgroup[n].n;
|
||||
for(n=0; n < xctx->lastsel; n++) {
|
||||
if(xctx->sel_array[n].type == WIRE) {
|
||||
i = xctx->sel_array[n].n;
|
||||
my_strcat(434, &res, get_tok_value(xctx->wire[i].prop_ptr,"lab",0));
|
||||
if(n < lastselected-1) my_strcat(442, &res, " ");
|
||||
if(n < xctx->lastsel-1) my_strcat(442, &res, " ");
|
||||
}
|
||||
}
|
||||
Tcl_AppendResult(interp, res, NULL);
|
||||
|
|
@ -852,11 +852,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
place_symbol(-1, argv[2], atof(argv[3]), atof(argv[4]), atoi(argv[5]), atoi(argv[6]), argv[7], 0, x);
|
||||
}
|
||||
} else if(!strcmp(argv[1],"arc")) {
|
||||
ui_state |= MENUSTARTARC;
|
||||
xctx->ui_state |= MENUSTARTARC;
|
||||
} else if(!strcmp(argv[1],"circle")) {
|
||||
ui_state |= MENUSTARTCIRCLE;
|
||||
xctx->ui_state |= MENUSTARTCIRCLE;
|
||||
} else if(!strcmp(argv[1],"snap_wire")) {
|
||||
ui_state |= MENUSTARTSNAPWIRE;
|
||||
xctx->ui_state |= MENUSTARTSNAPWIRE;
|
||||
} else if(!strcmp(argv[1],"wire")) {
|
||||
double x1,y1,x2,y2;
|
||||
int pos, save;
|
||||
|
|
@ -873,15 +873,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else prop = NULL;
|
||||
push_undo();
|
||||
storeobject(pos, x1,y1,x2,y2,WIRE,0,0,prop);
|
||||
prepared_hilight_structs=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hash_wires=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
|
||||
save = draw_window; draw_window = 1;
|
||||
drawline(WIRELAYER,NOW, x1,y1,x2,y2, 0);
|
||||
draw_window = save;
|
||||
}
|
||||
else ui_state |= MENUSTARTWIRE;
|
||||
else xctx->ui_state |= MENUSTARTWIRE;
|
||||
} else if(!strcmp(argv[1],"line")) {
|
||||
double x1,y1,x2,y2;
|
||||
int pos, save;
|
||||
|
|
@ -898,7 +898,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
drawline(rectcolor,NOW, x1,y1,x2,y2, 0);
|
||||
draw_window = save;
|
||||
}
|
||||
else ui_state |= MENUSTARTLINE;
|
||||
else xctx->ui_state |= MENUSTARTLINE;
|
||||
} else if(!strcmp(argv[1],"rect")) {
|
||||
double x1,y1,x2,y2;
|
||||
int pos, save;
|
||||
|
|
@ -915,17 +915,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
drawrect(rectcolor,NOW, x1,y1,x2,y2, 0);
|
||||
draw_window = save;
|
||||
}
|
||||
else ui_state |= MENUSTARTRECT;
|
||||
else xctx->ui_state |= MENUSTARTRECT;
|
||||
} else if(!strcmp(argv[1],"polygon")) {
|
||||
ui_state |= MENUSTARTPOLYGON;
|
||||
xctx->ui_state |= MENUSTARTPOLYGON;
|
||||
} else if(!strcmp(argv[1],"align")) {
|
||||
push_undo();
|
||||
round_schematic_to_grid(cadsnap);
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
draw();
|
||||
} else if(!strcmp(argv[1],"saveas")) {
|
||||
if(argc == 4) {
|
||||
|
|
@ -958,12 +958,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
printf("wires=%d\n", xctx->wires);
|
||||
printf("instances=%d\n", xctx->instances);
|
||||
printf("symbols=%d\n", xctx->symbols);
|
||||
printf("lastselected=%d\n", lastselected);
|
||||
printf("xctx->lastsel=%d\n", xctx->lastsel);
|
||||
printf("texts=%d\n", xctx->texts);
|
||||
printf("maxt=%d\n", xctx->maxt);
|
||||
printf("maxw=%d\n", xctx->maxw);
|
||||
printf("maxi=%d\n", xctx->maxi);
|
||||
printf("max_selected=%d\n", max_selected);
|
||||
printf("xctx->maxsel=%d\n", xctx->maxsel);
|
||||
printf("zoom=%.16g\n", xctx->zoom);
|
||||
printf("xorigin=%.16g\n", xctx->xorigin);
|
||||
printf("yorigin=%.16g\n", xctx->yorigin);
|
||||
|
|
@ -982,16 +982,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
printf("sch_path[%d]=%s\n",i,xctx->sch_path[i]? xctx->sch_path[i]:"<NULL>");
|
||||
printf("sch[%d]=%s\n",i,xctx->sch[i]);
|
||||
}
|
||||
printf("modified=%d\n", modified);
|
||||
printf("xctx->modified=%d\n", xctx->modified);
|
||||
printf("color_ps=%d\n", color_ps);
|
||||
printf("a3page=%d\n", a3page);
|
||||
printf("hilight_nets=%d\n", hilight_nets);
|
||||
printf("need_rebuild_selected_array=%d\n", need_rebuild_selected_array);
|
||||
printf("xctx->need_reb_sel_arr=%d\n", xctx->need_reb_sel_arr);
|
||||
printf("******* end global variables:*******\n");
|
||||
} else if(!strcmp(argv[1],"help")) {
|
||||
printf("xschem : function used to communicate with the C program\n");
|
||||
printf("Usage:\n");
|
||||
printf(" xschem callback X-event_type mousex mousey Xkeysym mouse_button Xstate\n");
|
||||
printf(" xschem callback X-event_type xctx->mousex xctx->mousey Xkeysym mouse_button Xstate\n");
|
||||
printf(" can be used to send any event to the application\n");
|
||||
printf(" xschem netlist\n");
|
||||
printf(" generates a netlist in the selected format for the current schematic\n");
|
||||
|
|
@ -1165,15 +1165,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
|
||||
else if(!strcmp(argv[1],"edit_file") ) {
|
||||
rebuild_selected_array();
|
||||
if(lastselected==0 ) {
|
||||
if(xctx->lastsel==0 ) {
|
||||
save_schematic(xctx->sch[xctx->currsch]); /* sync data with disk file before editing file */
|
||||
my_snprintf(name, S(name), "edit_file {%s}",
|
||||
abs_sym_path(xctx->sch[xctx->currsch], ""));
|
||||
tcleval(name);
|
||||
}
|
||||
else if(selectedgroup[0].type==ELEMENT) {
|
||||
else if(xctx->sel_array[0].type==ELEMENT) {
|
||||
my_snprintf(name, S(name), "edit_file {%s}",
|
||||
abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""));
|
||||
abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""));
|
||||
tcleval(name);
|
||||
|
||||
}
|
||||
|
|
@ -1277,7 +1277,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
tcleval("catch { ngspice::resetdata }");
|
||||
if(argc==3) {
|
||||
if(!has_x || !modified || !save(1) ) { /* save(1)==1 --> user cancel */
|
||||
if(!has_x || !xctx->modified || !save(1) ) { /* save(1)==1 --> user cancel */
|
||||
dbg(1, "scheduler(): load: filename=%s\n", argv[2]);
|
||||
delete_hilight_net();
|
||||
xctx->currsch = 0;
|
||||
|
|
@ -1494,7 +1494,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
|
||||
else if(!strcmp(argv[1],"flip"))
|
||||
{
|
||||
if(! (ui_state & (STARTMOVE | STARTCOPY) ) ) {
|
||||
if(! (xctx->ui_state & (STARTMOVE | STARTCOPY) ) ) {
|
||||
rebuild_selected_array();
|
||||
move_objects(START,0,0,0);
|
||||
move_objects(FLIP|ROTATELOCAL,0,0,0);
|
||||
|
|
@ -1510,7 +1510,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
|
||||
|
||||
if(! (ui_state & (STARTMOVE | STARTCOPY) ) ) {
|
||||
if(! (xctx->ui_state & (STARTMOVE | STARTCOPY) ) ) {
|
||||
rebuild_selected_array();
|
||||
move_objects(START,0,0,0);
|
||||
move_objects(ROTATE|ROTATELOCAL,0,0,0);
|
||||
|
|
@ -1924,8 +1924,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[2],"cadsnap_default")) {
|
||||
Tcl_AppendResult(interp, tclgetvar("snap"),NULL);
|
||||
}
|
||||
else if(!strcmp(argv[2],"user_top_netl_name")) {
|
||||
Tcl_AppendResult(interp, user_top_netl_name);
|
||||
else if(!strcmp(argv[2],"xctx->netlist_name")) {
|
||||
Tcl_AppendResult(interp, xctx->netlist_name);
|
||||
}
|
||||
else if(!strcmp(argv[2],"cadsnap")) {
|
||||
char s[30]; /* overflow safe 20161212 */
|
||||
|
|
@ -1962,9 +1962,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
my_snprintf(s, S(s), "%d",draw_window);
|
||||
Tcl_AppendResult(interp, s,NULL);
|
||||
}
|
||||
else if(!strcmp(argv[2],"ui_state")) {
|
||||
else if(!strcmp(argv[2],"xctx->ui_state")) {
|
||||
char s[30]; /* overflow safe 20161122 */
|
||||
my_snprintf(s, S(s), "%d",ui_state);
|
||||
my_snprintf(s, S(s), "%d",xctx->ui_state);
|
||||
Tcl_AppendResult(interp, s,NULL);
|
||||
}
|
||||
else if(!strcmp(argv[2],"netlist_dir")) {
|
||||
|
|
@ -2087,8 +2087,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(!strcmp(argv[2],"cairo_font_name")) {
|
||||
if( strlen(argv[3]) < sizeof(cairo_font_name) ) {
|
||||
my_strncpy(cairo_font_name, argv[3], S(cairo_font_name));
|
||||
cairo_select_font_face (cairo_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_select_font_face (cairo_save_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_select_font_face(cairo_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_select_font_face(cairo_save_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
|
|
@ -2108,8 +2108,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int s = atoi(argv[3]);
|
||||
show_pin_net_names=s;
|
||||
}
|
||||
else if(!strcmp(argv[2],"user_top_netl_name")) {
|
||||
my_strncpy(user_top_netl_name, argv[3], S(user_top_netl_name));
|
||||
else if(!strcmp(argv[2],"xctx->netlist_name")) {
|
||||
my_strncpy(xctx->netlist_name, argv[3], S(xctx->netlist_name));
|
||||
}
|
||||
else if(!strcmp(argv[2],"dim")) {
|
||||
double s = atof(argv[3]);
|
||||
|
|
@ -2209,7 +2209,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
rectcolor=atoi(argv[3]);
|
||||
tcleval("reconfigure_layers_button");
|
||||
rebuild_selected_array();
|
||||
if(lastselected) {
|
||||
if(xctx->lastsel) {
|
||||
change_layer();
|
||||
}
|
||||
}
|
||||
|
|
@ -2219,8 +2219,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[2],"draw_window")) {
|
||||
draw_window=atoi(argv[3]);
|
||||
}
|
||||
else if(!strcmp(argv[2],"ui_state")) {
|
||||
ui_state=atoi(argv[3]);
|
||||
else if(!strcmp(argv[2],"xctx->ui_state")) {
|
||||
xctx->ui_state=atoi(argv[3]);
|
||||
}
|
||||
else {
|
||||
Tcl_AppendResult(interp, "xschem set ", argv[1], argv[3], ": invalid command.", NULL);
|
||||
|
|
|
|||
152
src/select.c
152
src/select.c
|
|
@ -215,23 +215,23 @@ void delete(void)
|
|||
j = 0;
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
rebuild_selected_array();
|
||||
if(lastselected) push_undo();
|
||||
if(xctx->lastsel) 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 */
|
||||
/* first calculate bbox, because symbol_bbox() needs translate (@#0:net_name) which
|
||||
* needs prepare_netlist_structs which needs a consistent xctx->inst[] data structure */
|
||||
|
||||
/* does not seem to be needed
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
*/
|
||||
* xctx->prep_net_structs=0;
|
||||
* xctx->prep_hi_structs=0;
|
||||
*/
|
||||
if(show_pin_net_names) {
|
||||
prepare_netlist_structs(0);
|
||||
}
|
||||
for(i = 0; i < lastselected; i++) {
|
||||
n = selectedgroup[i].n;
|
||||
if(selectedgroup[i].type == ELEMENT) {
|
||||
for(i = 0; i < xctx->lastsel; i++) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type == ELEMENT) {
|
||||
int p;
|
||||
char *type = (xctx->inst[n].ptr + xctx->sym)->type;
|
||||
symbol_bbox(n, &xctx->inst[n].x1, &xctx->inst[n].y1, &xctx->inst[n].x2, &xctx->inst[n].y2 );
|
||||
|
|
@ -244,7 +244,7 @@ void delete(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(show_pin_net_names && selectedgroup[i].type == WIRE && xctx->wire[n].node) {
|
||||
if(show_pin_net_names && xctx->sel_array[i].type == WIRE && xctx->wire[n].node) {
|
||||
find_inst_to_be_redrawn(xctx->wire[n].node);
|
||||
}
|
||||
}
|
||||
|
|
@ -322,9 +322,9 @@ void delete(void)
|
|||
xctx->instances-=j;
|
||||
|
||||
if(j) {
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
j = 0;
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
|
|
@ -357,18 +357,18 @@ void delete(void)
|
|||
}
|
||||
xctx->wires -= j;
|
||||
if(j) {
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
|
||||
del_rect_line_arc_poly();
|
||||
update_conn_cues(0, 0);
|
||||
lastselected = 0;
|
||||
xctx->lastsel = 0;
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
ui_state &= ~SELECTION;
|
||||
xctx->ui_state &= ~SELECTION;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -376,11 +376,11 @@ void delete_only_rect_line_arc_poly(void)
|
|||
{
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
del_rect_line_arc_poly();
|
||||
lastselected = 0;
|
||||
xctx->lastsel = 0;
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
ui_state &= ~SELECTION;
|
||||
xctx->ui_state &= ~SELECTION;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -403,12 +403,12 @@ void bbox(int what,double x1,double y1, double x2, double y2)
|
|||
bbx2 = 0;
|
||||
bby1 = 300000000;
|
||||
bby2 = 0;
|
||||
savex1 = areax1;
|
||||
savex2 = areax2;
|
||||
savey1 = areay1;
|
||||
savey2 = areay2;
|
||||
savew = areaw;
|
||||
saveh = areah;
|
||||
savex1 = xctx->areax1;
|
||||
savex2 = xctx->areax2;
|
||||
savey1 = xctx->areay1;
|
||||
savey2 = xctx->areay2;
|
||||
savew = xctx->areaw;
|
||||
saveh = xctx->areah;
|
||||
sem=1;
|
||||
break;
|
||||
case ADD:
|
||||
|
|
@ -432,16 +432,16 @@ void bbox(int what,double x1,double y1, double x2, double y2)
|
|||
if(y1 > bby2) bby2 = (int) y1;
|
||||
break;
|
||||
case END:
|
||||
areax1 = savex1;
|
||||
areax2 = savex2;
|
||||
areay1 = savey1;
|
||||
areay2 = savey2;
|
||||
areaw = savew;
|
||||
areah = saveh;
|
||||
xctx->areax1 = savex1;
|
||||
xctx->areax2 = savex2;
|
||||
xctx->areay1 = savey1;
|
||||
xctx->areay2 = savey2;
|
||||
xctx->areaw = savew;
|
||||
xctx->areah = saveh;
|
||||
xrect[0].x = 0;
|
||||
xrect[0].y = 0;
|
||||
xrect[0].width = areaw-4*INT_WIDTH(xctx->lw);
|
||||
xrect[0].height = areah-4*INT_WIDTH(xctx->lw);
|
||||
xrect[0].width = xctx->areaw-4*INT_WIDTH(xctx->lw);
|
||||
xrect[0].height = xctx->areah-4*INT_WIDTH(xctx->lw);
|
||||
|
||||
XSetClipMask(display, gctiled, None); /* 20171110 optimization, clipping already done in software */
|
||||
|
||||
|
|
@ -461,12 +461,12 @@ void bbox(int what,double x1,double y1, double x2, double y2)
|
|||
fprintf(errfp, "ERROR: bbox(SET) call before bbox(START)\n");
|
||||
tcleval("alert_ {ERROR: bbox(SET) call before bbox(START)} {}");
|
||||
}
|
||||
areax1 = bbx1-2*INT_WIDTH(xctx->lw);
|
||||
areax2 = bbx2+2*INT_WIDTH(xctx->lw);
|
||||
areay1 = bby1-2*INT_WIDTH(xctx->lw);
|
||||
areay2 = bby2+2*INT_WIDTH(xctx->lw);
|
||||
areaw = (areax2-areax1);
|
||||
areah = (areay2-areay1);
|
||||
xctx->areax1 = bbx1-2*INT_WIDTH(xctx->lw);
|
||||
xctx->areax2 = bbx2+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = bby1-2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = bby2+2*INT_WIDTH(xctx->lw);
|
||||
xctx->areaw = (xctx->areax2-xctx->areax1);
|
||||
xctx->areah = (xctx->areay2-xctx->areay1);
|
||||
|
||||
xrect[0].x = bbx1-INT_WIDTH(xctx->lw);
|
||||
xrect[0].y = bby1-INT_WIDTH(xctx->lw);
|
||||
|
|
@ -478,7 +478,7 @@ void bbox(int what,double x1,double y1, double x2, double y2)
|
|||
XSetClipRectangles(display, gcstipple[i], 0,0, xrect, 1, Unsorted);
|
||||
}
|
||||
XSetClipRectangles(display, gctiled, 0,0, xrect, 1, Unsorted);
|
||||
dbg(1, "bbox(): bbox= %d %d %d %d\n",areax1,areay1,areax2,areay2);
|
||||
dbg(1, "bbox(): bbox= %d %d %d %d\n",xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2);
|
||||
#ifdef HAS_CAIRO
|
||||
cairo_rectangle(cairo_ctx, xrect[0].x, xrect[0].y, xrect[0].width, xrect[0].height);
|
||||
cairo_clip(cairo_ctx);
|
||||
|
|
@ -498,8 +498,8 @@ void unselect_all(void)
|
|||
#ifdef HAS_CAIRO
|
||||
int customfont;
|
||||
#endif
|
||||
ui_state = 0;
|
||||
lastselected = 0;
|
||||
xctx->ui_state = 0;
|
||||
xctx->lastsel = 0;
|
||||
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
|
|
@ -587,7 +587,7 @@ void unselect_all(void)
|
|||
drawtemparc(gctiled, END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtemprect(gctiled, END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtempline(gctiled,END, 0.0, 0.0, 0.0, 0.0);
|
||||
ui_state &= ~SELECTION;
|
||||
xctx->ui_state &= ~SELECTION;
|
||||
/*\statusmsg("",2); */
|
||||
my_snprintf(str, S(str), "%s/%s", user_conf_dir, ".selection.sch"); /* 20161115 PWD->HOME */
|
||||
xunlink(str);
|
||||
|
|
@ -605,7 +605,8 @@ void select_wire(int i,unsigned short select_mode, int fast)
|
|||
xctx->wire[i].prop_ptr? xctx->wire[i].prop_ptr: "(null)");
|
||||
statusmsg(str,2);
|
||||
|
||||
my_snprintf(str, S(str), "n=%4d x = %.16g y = %.16g w = %.16g h = %.16g",i, xctx->wire[i].x1, xctx->wire[i].y1,
|
||||
my_snprintf(str, S(str), "n=%4d x = %.16g y = %.16g w = %.16g h = %.16g",
|
||||
i, xctx->wire[i].x1, xctx->wire[i].y1,
|
||||
xctx->wire[i].x2-xctx->wire[i].x1, xctx->wire[i].y2-xctx->wire[i].y1
|
||||
);
|
||||
statusmsg(str,1);
|
||||
|
|
@ -628,7 +629,7 @@ void select_wire(int i,unsigned short select_mode, int fast)
|
|||
else
|
||||
drawtempline(gctiled, NOW, xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2);
|
||||
}
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_element(int i,unsigned short select_mode, int fast, int override_lock)
|
||||
|
|
@ -677,7 +678,7 @@ void select_element(int i,unsigned short select_mode, int fast, int override_loc
|
|||
draw_temp_symbol(NOW, gctiled, i,c,0,0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_text(int i,unsigned short select_mode, int fast)
|
||||
|
|
@ -713,7 +714,7 @@ void select_text(int i,unsigned short select_mode, int fast)
|
|||
#ifdef HAS_CAIRO
|
||||
if(customfont) cairo_restore(cairo_ctx);
|
||||
#endif
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_box(int c, int i, unsigned short select_mode, int fast)
|
||||
|
|
@ -748,7 +749,7 @@ void select_box(int c, int i, unsigned short select_mode, int fast)
|
|||
|
||||
if( xctx->rect[c][i].sel == (SELECTED1|SELECTED2|SELECTED3|SELECTED4)) xctx->rect[c][i].sel = SELECTED;
|
||||
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -779,7 +780,7 @@ void select_arc(int c, int i, unsigned short select_mode, int fast)
|
|||
|
||||
/*if( xctx->arc[c][i].sel == (SELECTED1|SELECTED2|SELECTED3|SELECTED4)) xctx->arc[c][i].sel = SELECTED; */
|
||||
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_polygon(int c, int i, unsigned short select_mode, int fast )
|
||||
|
|
@ -801,7 +802,7 @@ void select_polygon(int c, int i, unsigned short select_mode, int fast )
|
|||
}
|
||||
else
|
||||
drawtemppolygon(gctiled, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points);
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
void select_line(int c, int i, unsigned short select_mode, int fast )
|
||||
|
|
@ -840,14 +841,14 @@ void select_line(int c, int i, unsigned short select_mode, int fast )
|
|||
else
|
||||
drawtempline(gctiled, NOW, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
||||
xctx->line[c][i].x2, xctx->line[c][i].y2);
|
||||
need_rebuild_selected_array=1;
|
||||
xctx->need_reb_sel_arr=1;
|
||||
}
|
||||
|
||||
/* 20160503 return type field */
|
||||
unsigned short select_object(double mousex,double mousey, unsigned short select_mode, int override_lock)
|
||||
unsigned short select_object(double mx,double my, unsigned short select_mode, int override_lock)
|
||||
{
|
||||
Selected sel;
|
||||
sel = find_closest_obj(mousex,mousey);
|
||||
sel = find_closest_obj(mx, my);
|
||||
|
||||
dbg(1, "select_object(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type);
|
||||
|
||||
|
|
@ -882,7 +883,7 @@ unsigned short select_object(double mousex,double mousey, unsigned short select_
|
|||
drawtemprect(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtempline(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
if(sel.type) ui_state |= SELECTION;
|
||||
if(sel.type) xctx->ui_state |= SELECTION;
|
||||
return sel.type;
|
||||
}
|
||||
|
||||
|
|
@ -899,17 +900,17 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /* 201509
|
|||
{
|
||||
if(RECTINSIDE(xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel ? select_wire(i,SELECTED, 1): select_wire(i,0, 1);
|
||||
}
|
||||
else if( sel && enable_stretch && POINTINSIDE(xctx->wire[i].x1,xctx->wire[i].y1, x1,y1,x2,y2) )
|
||||
{
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_wire(i,SELECTED1, 1);
|
||||
}
|
||||
else if( sel && enable_stretch && POINTINSIDE(xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2) )
|
||||
{
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_wire(i,SELECTED2, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -930,7 +931,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /* 201509
|
|||
#endif
|
||||
if(RECTINSIDE(xx1,yy1, xx2, yy2,x1,y1,x2,y2))
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel ? select_text(i, SELECTED, 1): select_text(i, 0, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -938,7 +939,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /* 201509
|
|||
{
|
||||
if(RECTINSIDE(xctx->inst[i].xx1, xctx->inst[i].yy1, xctx->inst[i].xx2, xctx->inst[i].yy2, x1,y1,x2,y2))
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel ? select_element(i,SELECTED,1, 0): select_element(i,0,1, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -965,10 +966,11 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /* 201509
|
|||
select_polygon(c, i, 0, 1);
|
||||
}
|
||||
if(selected_points==xctx->poly[c][i].points) {
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_polygon(c, i, SELECTED, 1);
|
||||
} else if(selected_points) {
|
||||
if(sel && enable_stretch) select_polygon(c, i, SELECTED1,1); /* for polygon, SELECTED1 means partial sel */
|
||||
/* for polygon, SELECTED1 means partial sel */
|
||||
if(sel && enable_stretch) select_polygon(c, i, SELECTED1,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -977,17 +979,17 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /* 201509
|
|||
{
|
||||
if(RECTINSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1,xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
sel? select_line(c,i,SELECTED,1): select_line(c,i,0,1);
|
||||
}
|
||||
else if( sel && enable_stretch && POINTINSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1, x1,y1,x2,y2) )
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_line(c, i,SELECTED1,1);
|
||||
}
|
||||
else if( sel && enable_stretch && POINTINSIDE(xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2) )
|
||||
{
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_line(c, i,SELECTED2,1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1003,22 +1005,22 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /* 201509
|
|||
yb = y - r * sin((a+b) * XSCH_PI/180.);
|
||||
arc_bbox(x, y, r, a, b, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
if(RECTINSIDE(tmp.x1, tmp.y1, tmp.x2, tmp.y2, x1,y1,x2,y2)) {
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel? select_arc(c, i, SELECTED,1): select_arc(c, i, 0,1);
|
||||
}
|
||||
else if( sel && enable_stretch && POINTINSIDE(x, y, x1, y1, x2, y2) )
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_arc(c, i,SELECTED1,1);
|
||||
}
|
||||
else if( sel && enable_stretch && POINTINSIDE(xb, yb, x1, y1, x2, y2) )
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_arc(c, i,SELECTED3,1);
|
||||
}
|
||||
else if( sel && enable_stretch && POINTINSIDE(xa, ya, x1, y1, x2, y2) )
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
select_arc(c, i,SELECTED2,1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1026,28 +1028,28 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /* 201509
|
|||
{
|
||||
if(RECTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y1,xctx->rect[c][i].x2,xctx->rect[c][i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
ui_state |= SELECTION; /* set ui_state to SELECTION also if unselecting by area ???? */
|
||||
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
|
||||
sel? select_box(c,i, SELECTED, 1): select_box(c,i, 0, 1);
|
||||
}
|
||||
else {
|
||||
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y1, x1,y1,x2,y2) )
|
||||
{ /*20070302 added stretch select */
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_box(c, i,SELECTED1,1);
|
||||
}
|
||||
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x2,xctx->rect[c][i].y1, x1,y1,x2,y2) )
|
||||
{
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_box(c, i,SELECTED2,1);
|
||||
}
|
||||
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y2, x1,y1,x2,y2) )
|
||||
{
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_box(c, i,SELECTED3,1);
|
||||
}
|
||||
if( sel && enable_stretch && POINTINSIDE(xctx->rect[c][i].x2,xctx->rect[c][i].y2, x1,y1,x2,y2) )
|
||||
{
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
select_box(c, i,SELECTED4,1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1063,7 +1065,7 @@ void select_all(void)
|
|||
{
|
||||
int c,i;
|
||||
|
||||
ui_state |= SELECTION;
|
||||
xctx->ui_state |= SELECTION;
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
select_wire(i,SELECTED, 1);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
|
||||
char *subckt_name;
|
||||
|
||||
if(modified) {
|
||||
if(xctx->modified) {
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
|
|
@ -64,8 +64,8 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
dbg(1, "global_spice_netlist(): opening %s for writing\n",netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
if(xctx->netlist_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
|
@ -372,9 +372,8 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
int i;
|
||||
char *type=NULL;
|
||||
|
||||
prepared_netlist_structs = 0;
|
||||
xctx->prep_net_structs = 0;
|
||||
prepare_netlist_structs(1);
|
||||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
if(!spice_stop) {
|
||||
for(i=0;i<xctx->instances;i++) /* print first ipin/opin defs ... */
|
||||
|
|
@ -399,7 +398,8 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
my_strdup(390, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
|
||||
if( type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; /* already done in global_spice_netlist */
|
||||
/* already done in global_spice_netlist */
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue;
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
if(!strcmp(type,"netlist_commands")) {
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ void check_wire_storage(void)
|
|||
|
||||
void check_selected_storage(void)
|
||||
{
|
||||
if(lastselected >= max_selected)
|
||||
if(xctx->lastsel >= xctx->maxsel)
|
||||
{
|
||||
max_selected=(1+lastselected / MAXGROUP) * MAXGROUP;
|
||||
my_realloc(393, &selectedgroup, sizeof(Selected)*max_selected);
|
||||
xctx->maxsel=(1+xctx->lastsel / MAXGROUP) * MAXGROUP;
|
||||
my_realloc(393, &xctx->sel_array, sizeof(Selected)*xctx->maxsel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static void svg_drawpolygon(int c, int what, double *x, double *y, int points, i
|
|||
y1=Y_TO_SVG(y1);
|
||||
x2=X_TO_SVG(x2);
|
||||
y2=Y_TO_SVG(y2);
|
||||
if( !rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) ) {
|
||||
if( !rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) {
|
||||
return;
|
||||
}
|
||||
fprintf(fd, "<path class=\"l%d\" ", c);
|
||||
|
|
@ -102,7 +102,7 @@ static void svg_filledrect(int gc, double rectx1,double recty1,double rectx2,dou
|
|||
y1=Y_TO_SVG(recty1);
|
||||
x2=X_TO_SVG(rectx2);
|
||||
y2=Y_TO_SVG(recty2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
svg_xfillrectangle(gc, x1,y1,x2,y2, dash);
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ static void svg_drawcircle(int gc, int fillarc, double x,double y,double r,doubl
|
|||
x2=X_TO_SVG(x2);
|
||||
y2=Y_TO_SVG(y2);
|
||||
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
fprintf(fd, "<circle class=\"l%d\" cx=\"%g\" cy=\"%g\" r=\"%g\"/>\n", gc, xx, yy, rr);
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
|||
x2=X_TO_SVG(x2);
|
||||
y2=Y_TO_SVG(y2);
|
||||
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(b == 360.) {
|
||||
fprintf(fd, "<circle class=\"l%d\" cx=\"%g\" cy=\"%g\" r=\"%g\" ", gc, xx, yy, rr);
|
||||
|
|
@ -258,7 +258,7 @@ static void svg_draw_string(int layer, const char *str, int rot, int flip, int h
|
|||
descent = size*xctx->mooz * 0.219;
|
||||
|
||||
text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x,y, &textx1,&texty1,&textx2,&texty2);
|
||||
if(!textclip(areax1,areay1,areax2,areay2,textx1,texty1,textx2,texty2)) {
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) {
|
||||
return;
|
||||
}
|
||||
if(hcenter) {
|
||||
|
|
@ -321,7 +321,7 @@ static void old_svg_draw_string(int layer, const char *str,
|
|||
#endif
|
||||
xscale*=nocairo_font_xscale;
|
||||
yscale*=nocairo_font_yscale;
|
||||
if(!textclip(areax1,areay1,areax2,areay2,rx1,ry1,rx2,ry2)) return;
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) return;
|
||||
x=rx1;y=ry1;
|
||||
if(rot&1) {y=ry2;rot=3;}
|
||||
else rot=0;
|
||||
|
|
@ -361,18 +361,18 @@ static void svg_drawgrid()
|
|||
delta=cadgrid* xctx->mooz;
|
||||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz;
|
||||
if(y>areay1 && y<areay2)
|
||||
if(y>xctx->areay1 && y<xctx->areay2)
|
||||
{
|
||||
svg_xdrawline(GRIDLAYER, 0, areax1+1,(int)y, areax2-1, (int)y, 0);
|
||||
svg_xdrawline(GRIDLAYER, 0, xctx->areax1+1,(int)y, xctx->areax2-1, (int)y, 0);
|
||||
}
|
||||
if(x>areax1 && x<areax2)
|
||||
if(x>xctx->areax1 && x<xctx->areax2)
|
||||
{
|
||||
svg_xdrawline(GRIDLAYER, 0, (int)x,areay1+1, (int)x, areay2-1, 0);
|
||||
svg_xdrawline(GRIDLAYER, 0, (int)x,xctx->areay1+1, (int)x, xctx->areay2-1, 0);
|
||||
}
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx->yorigin* xctx->mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((xctx->areay1+1)/delta)*delta-fmod(-xctx->yorigin* xctx->mooz,delta);
|
||||
for(x=floor((xctx->areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);x<xctx->areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
for(y=tmp;y<xctx->areay2;y+=delta)
|
||||
{
|
||||
svg_xdrawpoint(GRIDLAYER, (int)(x), (int)(y));
|
||||
}
|
||||
|
|
@ -404,7 +404,7 @@ static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
x2=X_TO_SVG(xctx->inst[n].x2);
|
||||
y1=Y_TO_SVG(xctx->inst[n].y1);
|
||||
y2=Y_TO_SVG(xctx->inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2))
|
||||
{
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
|
|
@ -590,12 +590,12 @@ void svg_draw(void)
|
|||
old_grid=draw_grid;
|
||||
draw_grid=0;
|
||||
|
||||
dx=areax2-areax1;
|
||||
dy=areay2-areay1;
|
||||
dx=xctx->areax2-xctx->areax1;
|
||||
dy=xctx->areay2-xctx->areay1;
|
||||
dbg(1, "svg_draw(): dx=%g dy=%g\n", dx, dy);
|
||||
|
||||
|
||||
modified_save=modified;
|
||||
modified_save=xctx->modified;
|
||||
push_undo();
|
||||
trim_wires(); /* 20161121 add connection boxes on wires but undo at end */
|
||||
|
||||
|
|
@ -702,7 +702,8 @@ void svg_draw(void)
|
|||
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
svg_drawline(WIRELAYER, xctx->wire[i].bus, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0);
|
||||
svg_drawline(WIRELAYER, xctx->wire[i].bus, xctx->wire[i].x1,
|
||||
xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0);
|
||||
}
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
|
|
@ -710,10 +711,10 @@ void svg_draw(void)
|
|||
int i;
|
||||
update_conn_cues(0, 0);
|
||||
/* draw connecting dots */
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
x2 = X_TO_XSCHEM(xctx->areax2);
|
||||
y2 = Y_TO_XSCHEM(xctx->areay2);
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
|
|
@ -732,7 +733,7 @@ void svg_draw(void)
|
|||
my_free(964, &svg_colors);
|
||||
|
||||
pop_undo(0);
|
||||
modified=modified_save;
|
||||
xctx->modified=modified_save;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
char tcl_cmd_netlist[PATH_MAX + 100]; /* 20081211 overflow safe 20161122 */
|
||||
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
|
||||
|
||||
if(modified) {
|
||||
if(xctx->modified) {
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
|
|
@ -50,8 +50,8 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
if(xctx->netlist_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.tdx", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
|
@ -194,9 +194,8 @@ void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
int i;
|
||||
char *type=NULL;
|
||||
|
||||
prepared_netlist_structs = 0;
|
||||
xctx->prep_net_structs = 0;
|
||||
prepare_netlist_structs(1);
|
||||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
if(!tedax_stop) {
|
||||
for(i=0;i<xctx->instances;i++) /* print first ipin/opin defs ... */
|
||||
|
|
@ -221,7 +220,8 @@ void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
my_strdup(423, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
|
||||
if( type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; /* already done in global_tedax_netlist */
|
||||
/* already done in global_tedax_netlist */
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue;
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
if(!strcmp(type,"netlist_commands")) {
|
||||
|
|
|
|||
11
src/token.c
11
src/token.c
|
|
@ -216,9 +216,9 @@ void check_unique_names(int rename)
|
|||
if(first) {
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
set_modify(1); push_undo();
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
xctx->prep_hash_inst=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hi_structs=0;
|
||||
first = 0;
|
||||
}
|
||||
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
|
||||
|
|
@ -278,7 +278,7 @@ int match_symbol(const char *name) /* never returns -1, if symbol not found loa
|
|||
|
||||
/* update **s modifying only the token values that are */
|
||||
/* different between *new and *old */
|
||||
/* return 1 if s modified 20081221 */
|
||||
/* return 1 if s xctx->modified 20081221 */
|
||||
int set_different_token(char **s,const char *new, const char *old, int object, int n)
|
||||
{
|
||||
register int c, state=TOK_BEGIN, space;
|
||||
|
|
@ -910,7 +910,8 @@ const char *subst_token(const char *s, const char *tok, const char *new_val)
|
|||
if(!new_val_copy[0]) new_val_copy = "\"\"";
|
||||
tmp = strlen(new_val_copy) + strlen(tok) + 2;
|
||||
STR_ALLOC(&result, tmp + result_pos, &size);
|
||||
my_snprintf(result + result_pos - 1, size, " %s=%s", tok, new_val_copy ); /* result_pos guaranteed to be > 0 */
|
||||
/* result_pos guaranteed to be > 0 */
|
||||
my_snprintf(result + result_pos - 1, size, " %s=%s", tok, new_val_copy );
|
||||
}
|
||||
}
|
||||
dbg(2, "subst_token(): returning: %s\n",result);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
struct stat buf;
|
||||
char *subckt_name;
|
||||
|
||||
if(modified) {
|
||||
if(xctx->modified) {
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
|
|
@ -53,8 +53,8 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
netlist_dir, skip_dir(xctx->sch[xctx->currsch]),getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
if(xctx->netlist_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
|
@ -365,7 +365,8 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
|
||||
|
||||
if(split_files) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
|
||||
netlist_dir, skip_dir(xctx->sym[i].name), getpid());
|
||||
dbg(1, "global_vhdl_netlist(): split_files: netl_filename=%s\n", netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx->sym[i].name) );
|
||||
|
|
@ -500,7 +501,7 @@ void verilog_netlist(FILE *fd , int verilog_stop)
|
|||
int i;
|
||||
char *type=NULL;
|
||||
|
||||
prepared_netlist_structs = 0;
|
||||
xctx->prep_net_structs = 0;
|
||||
prepare_netlist_structs(1);
|
||||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
dbg(2, "verilog_netlist(): end prepare_netlist_structs\n");
|
||||
|
|
@ -532,7 +533,7 @@ void verilog_netlist(FILE *fd , int verilog_stop)
|
|||
strcmp(type,"verilog_preprocessor")
|
||||
))
|
||||
{
|
||||
if(lastselected)
|
||||
if(xctx->lastsel)
|
||||
{
|
||||
if(xctx->inst[i].sel==SELECTED) print_verilog_element(fd, i) ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* top sch properties used for library use declarations and type definitions */
|
||||
/* to be printed before any entity declarations */
|
||||
|
||||
if(modified) {
|
||||
if(xctx->modified) {
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
|
|
@ -54,8 +54,8 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
fd=fopen(netl_filename, "w");
|
||||
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
if(xctx->netlist_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
|
@ -605,7 +605,7 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
int i,l;
|
||||
char *type=NULL;
|
||||
|
||||
prepared_netlist_structs = 0;
|
||||
xctx->prep_net_structs = 0;
|
||||
prepare_netlist_structs(1);
|
||||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
|
|
@ -671,7 +671,7 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
strcmp(type,"arch_declarations")
|
||||
))
|
||||
{
|
||||
if(lastselected)
|
||||
if(xctx->lastsel)
|
||||
{
|
||||
if(xctx->inst[i].sel==SELECTED) {
|
||||
print_vhdl_element(fd, i) ;
|
||||
|
|
|
|||
46
src/xinit.c
46
src/xinit.c
|
|
@ -387,6 +387,16 @@ void alloc_xschem_data()
|
|||
xctx->schverilogprop=NULL;/* verilog */
|
||||
xctx->version_string = NULL;
|
||||
xctx->currsch = 0;
|
||||
xctx->ui_state = 0;
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
xctx->lastsel = 0;
|
||||
xctx->maxsel = 0;
|
||||
xctx->prep_net_structs = 0;
|
||||
xctx->prep_hi_structs = 0;
|
||||
xctx->prep_hash_inst = 0;
|
||||
xctx->prep_hash_wires = 0;
|
||||
xctx->modified = 0;
|
||||
xctx->netlist_name[0] = '\0';
|
||||
for(i=0;i<CADMAXHIER;i++) xctx->sch_path[i]=NULL;
|
||||
my_strdup(1187, &xctx->sch_path[0],".");
|
||||
xctx->sch_inst_number[0] = 1;
|
||||
|
|
@ -553,9 +563,9 @@ void alloc_data()
|
|||
alloc_xschem_data();
|
||||
/* global context / graphic preferences/settings */
|
||||
|
||||
max_selected=MAXGROUP;
|
||||
selectedgroup=my_calloc(619, max_selected, sizeof(Selected));
|
||||
if(selectedgroup==NULL){
|
||||
xctx->maxsel=MAXGROUP;
|
||||
xctx->sel_array=my_calloc(619, xctx->maxsel, sizeof(Selected));
|
||||
if(xctx->sel_array==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +674,7 @@ void xwin_exit(void)
|
|||
my_free(1101, &color_array[i]);
|
||||
my_free(1102, &pixdata[i]);
|
||||
}
|
||||
my_free(1108, &selectedgroup);
|
||||
my_free(1108, &xctx->sel_array);
|
||||
my_free(1120, &fill_type);
|
||||
my_free(1121, &active_layer);
|
||||
my_free(1122, &pixdata);
|
||||
|
|
@ -846,7 +856,7 @@ void preview_window(const char *what, const char *tk_win_path, const char *filen
|
|||
/* save some relevant global context */
|
||||
save_window = window;
|
||||
save_save_pixmap = save_pixmap;
|
||||
save_mod = modified;
|
||||
save_mod = xctx->modified;
|
||||
save_show_pin = show_pin_net_names;
|
||||
show_pin_net_names = 0;
|
||||
my_strdup(117, &saveptr, tclgetvar("current_dirname"));
|
||||
|
|
@ -870,8 +880,8 @@ void preview_window(const char *what, const char *tk_win_path, const char *filen
|
|||
|
||||
show_pin_net_names = save_show_pin;
|
||||
xctx = save_xctx; /* restore schematic */
|
||||
modified = save_mod;
|
||||
set_modify(modified);
|
||||
xctx->modified = save_mod;
|
||||
set_modify(xctx->modified);
|
||||
/* free the pixmap (if a different one) used for preview */
|
||||
#ifdef __unix__
|
||||
if (save_pixmap != save_save_pixmap)
|
||||
|
|
@ -996,7 +1006,8 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
int dir_len=strlen(install_dir);
|
||||
if (dir_len>11)
|
||||
install_dir[dir_len-11] = '\0'; /* 11 = remove /xschem.exe */
|
||||
my_snprintf(tmp, S(tmp), "regexp {bin$} \"%s\"", install_dir); /* debugging in Visual Studio will not have bin */
|
||||
/* debugging in Visual Studio will not have bin */
|
||||
my_snprintf(tmp, S(tmp), "regexp {bin$} \"%s\"", install_dir);
|
||||
tcleval(tmp);
|
||||
running_in_src_dir = 0;
|
||||
if (atoi(tclresult()) == 0)
|
||||
|
|
@ -1246,14 +1257,14 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
tclsetvar("menu_tcl_debug",debug_var ? "1" : "0" );
|
||||
if(flat_netlist) tclsetvar("flat_netlist","1");
|
||||
|
||||
xschem_w = CADWIDTH;
|
||||
xschem_h = CADHEIGHT;
|
||||
areaw = CADWIDTH+4*INT_WIDTH(xctx->lw); /* clip area extends 1 pixel beyond physical window area */
|
||||
areah = CADHEIGHT+4*INT_WIDTH(xctx->lw); /* to avoid drawing clipped rectangle borders at window edges */
|
||||
areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
areax2 = areaw-2*INT_WIDTH(xctx->lw);
|
||||
areay2 = areah-2*INT_WIDTH(xctx->lw);
|
||||
xctx->xschem_w = CADWIDTH;
|
||||
xctx->xschem_h = CADHEIGHT;
|
||||
xctx->areaw = CADWIDTH+4*INT_WIDTH(xctx->lw); /* clip area extends 1 pixel beyond physical window area */
|
||||
xctx->areah = CADHEIGHT+4*INT_WIDTH(xctx->lw); /* to avoid drawing clipped rectangle borders at window edges */
|
||||
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
|
||||
xctx->areax2 = xctx->areaw-2*INT_WIDTH(xctx->lw);
|
||||
xctx->areay2 = xctx->areah-2*INT_WIDTH(xctx->lw);
|
||||
xrect[0].x = 0;
|
||||
xrect[0].y = 0;
|
||||
xrect[0].width = CADWIDTH;
|
||||
|
|
@ -1267,7 +1278,8 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
compile_font();
|
||||
/* restore current dir after loading font */
|
||||
if(tcleval("info exists env(PWD)")[0] == '1') {
|
||||
tcleval("set current_dirname $env(PWD)"); /* $env(PWD) better than pwd_dir as it does not dereference symlinks */
|
||||
/* $env(PWD) better than pwd_dir as it does not dereference symlinks */
|
||||
tcleval("set current_dirname $env(PWD)");
|
||||
} else {
|
||||
Tcl_VarEval(interp, "set current_dirname ", pwd_dir, NULL);
|
||||
}
|
||||
|
|
|
|||
21
src/xschem.h
21
src/xschem.h
|
|
@ -508,6 +508,23 @@ typedef struct {
|
|||
double zoom;
|
||||
double mooz;
|
||||
double lw;
|
||||
unsigned long ui_state ; /* this signals that we are doing a net place,panning etc.
|
||||
* used to prevent nesting of some commands */
|
||||
double mousex,mousey; /* mouse coord. */
|
||||
double mousex_snap,mousey_snap; /* mouse coord. snapped to grid */
|
||||
double mx_double_save, my_double_save;
|
||||
int areax1,areay1,areax2,areay2,areaw,areah; /* window corners / size, line width beyond screen edges */
|
||||
int xschem_h, xschem_w; /* true window size from XGetWindowAttributes */
|
||||
int need_reb_sel_arr;
|
||||
int lastsel;
|
||||
int maxsel;
|
||||
Selected *sel_array;
|
||||
int prep_net_structs;
|
||||
int prep_hi_structs;
|
||||
int prep_hash_inst;
|
||||
int prep_hash_wires;
|
||||
int modified;
|
||||
char netlist_name[PATH_MAX];
|
||||
} Xschem_ctx;
|
||||
|
||||
struct Lcc { /* used for symbols containing schematics as instances (LCC, Local Custom Cell) */
|
||||
|
|
@ -647,10 +664,6 @@ extern int split_files;
|
|||
extern char *netlist_dir;
|
||||
extern char user_top_netl_name[PATH_MAX];
|
||||
extern char bus_replacement_char[];
|
||||
|
||||
extern unsigned long ui_state ; /* this signals that we are doing a net place, */
|
||||
/* panning etc... */
|
||||
|
||||
extern char *undo_dirname;
|
||||
extern int cur_undo_ptr;
|
||||
extern int tail_undo_ptr;
|
||||
|
|
|
|||
Loading…
Reference in New Issue