diff --git a/XSchemWin/XSchemWix/Product.wxs b/XSchemWin/XSchemWix/Product.wxs index 5e3d7276..514d17fb 100644 --- a/XSchemWin/XSchemWix/Product.wxs +++ b/XSchemWin/XSchemWix/Product.wxs @@ -1,6 +1,6 @@ - + @@ -141,6 +141,9 @@ + + + @@ -318,6 +321,7 @@ + diff --git a/XSchemWin/XSchemWix/XSchemWix.wixproj b/XSchemWin/XSchemWix/XSchemWix.wixproj index e932b024..6e67e0bb 100644 --- a/XSchemWin/XSchemWix/XSchemWix.wixproj +++ b/XSchemWin/XSchemWix/XSchemWix.wixproj @@ -6,7 +6,7 @@ 3.10 91fbaa21-56d3-42e7-a3e8-df92c89cd027 2.0 - XSchemInstaller + XSchem Package diff --git a/XSchemWin/XSchemWix/heat_doc.wxs b/XSchemWin/XSchemWix/heat_doc.wxs index cdf38bd5..73dc5517 100644 --- a/XSchemWin/XSchemWix/heat_doc.wxs +++ b/XSchemWin/XSchemWix/heat_doc.wxs @@ -3,796 +3,796 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/XSchemWin/XSchemWix/heat_xschem_library.wxs b/XSchemWin/XSchemWix/heat_xschem_library.wxs index 17337d01..3c5256d7 100644 --- a/XSchemWin/XSchemWix/heat_xschem_library.wxs +++ b/XSchemWin/XSchemWix/heat_xschem_library.wxs @@ -3,5204 +3,5204 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/scconfig/src/tmpasm/tmpasm_scconfig.c b/scconfig/src/tmpasm/tmpasm_scconfig.c index 5bfb6d32..f84a4fa5 100644 --- a/scconfig/src/tmpasm/tmpasm_scconfig.c +++ b/scconfig/src/tmpasm/tmpasm_scconfig.c @@ -474,7 +474,10 @@ static void instr_include(tmpasm_t *ctx, char *iname, int argc, tmpasm_arg_t *ar tmpasm_t *child; fn = tmpasm_arg2str(ctx, argv[n], 0); - path = scc_path(ud, fn); + if (*fn != '/') + path = scc_path(ud, fn); + else + path = strclone(fn); fin = fopen(path, "r"); if (fin == NULL) { tmpasm_runtime_error(ctx, -8, path); diff --git a/src/actions.c b/src/actions.c index 699a98db..b5c34dda 100644 --- a/src/actions.c +++ b/src/actions.c @@ -730,15 +730,15 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */ } if(!strcmp(tclgetvar("use_lab_wire"),"0")) { if(indirect) - place_symbol(-1,symname_pin, pinx0, piny0, rot1, dir, prop, 2, first_call); + place_symbol(-1,symname_pin, pinx0, piny0, rot1, dir, prop, 2, first_call, 1/*to_push_undo*/); else - place_symbol(-1,symname_pin2, pinx0, piny0, rot1, dir, prop, 2, first_call); + place_symbol(-1,symname_pin2, pinx0, piny0, rot1, dir, prop, 2, first_call, 1/*to_push_undo*/); first_call=0; } else { if(indirect) - place_symbol(-1,symname_wire, pinx0, piny0, rot1, dir, prop, 2, first_call); + place_symbol(-1,symname_wire, pinx0, piny0, rot1, dir, prop, 2, first_call, 1/*to_push_undo*/); else - place_symbol(-1,symname_wire2, pinx0, piny0, rot1, dir, prop, 2, first_call); + place_symbol(-1,symname_wire2, pinx0, piny0, rot1, dir, prop, 2, first_call, 1/*to_push_undo*/); first_call=0; } } @@ -773,15 +773,15 @@ 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", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1); + place_symbol(-1, "lab_pin.sym", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); } else if(!stat(abs_sym_path("devices/lab_pin.sym", ""), &buf)) { - place_symbol(-1, "devices/lab_pin.sym", xctx->mousex_snap, xctx->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, 1/*to_push_undo*/); } } else { if(!stat(abs_sym_path("lab_wire.sym", ""), &buf)) { - place_symbol(-1, "lab_wire.sym", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1); + place_symbol(-1, "lab_wire.sym", xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); } else if(!stat(abs_sym_path("devices/lab_wire.sym", ""), &buf)) { - place_symbol(-1, "devices/lab_wire.sym", xctx->mousex_snap, xctx->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, 1/*to_push_undo*/); } } move_objects(START,0,0,0); @@ -796,7 +796,7 @@ void place_net_label(int type) /* set to 0 on next calls, this speeds up searching for unique names in prop string */ /* returns 1 if symbol successfully placed, 0 otherwise */ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot, short flip, - const char *inst_props, int draw_sym, int first_call) + const char *inst_props, int draw_sym, int first_call, int to_push_undo) /* if symbol_name is a valid string load specified cell and */ /* use the given params, otherwise query user */ { @@ -813,7 +813,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot dbg(1, "place_symbol(): load_file_dialog returns: name=%s\n",name); my_strncpy(name, rel_sym_path(name), S(name)); if(name[0]) { - if(first_call) push_undo(); + if(first_call && to_push_undo) push_undo(); } else return 0; i=match_symbol(name); diff --git a/src/callback.c b/src/callback.c index 4ea2acbf..00dc1cde 100644 --- a/src/callback.c +++ b/src/callback.c @@ -424,6 +424,10 @@ int callback(int event, int mx, int my, KeySym key, attach_labels_to_inst(); break; } + if (key == 'H' && state == (ControlMask | ShiftMask)) { /* create schematic and symbol from selected components */ + make_schematic_symbol_from_sel(); + break; + } if(key == 'v' && state==0) { /* vertically constrained drag 20171023 */ if ( constrained_move == 2 ) { @@ -570,7 +574,7 @@ int callback(int event, int mx, int my, KeySym key, { move_objects(ABORT,0,0,0); if(xctx->ui_state & START_SYMPIN) { - delete(); + delete(1/*to_push_undo*/); xctx->ui_state &= ~START_SYMPIN; } break; @@ -581,7 +585,7 @@ int callback(int event, int mx, int my, KeySym key, break; } if(xctx->ui_state & STARTMERGE) { - delete(); + delete(1/*to_push_undo*/); set_modify(0); /* aborted merge: no change, so reset modify flag set by delete() */ } @@ -649,7 +653,7 @@ int callback(int event, int mx, int my, KeySym key, if(key==XK_Delete && (xctx->ui_state & SELECTION) ) /* delete objects */ { if(xctx->semaphore >= 2) break; - delete();break; + delete(1/*to_push_undo*/);break; } if(key==XK_Right) /* left */ { @@ -797,7 +801,7 @@ int callback(int event, int mx, int my, KeySym key, rebuild_selected_array(); if(xctx->lastsel) { /* 20071203 check if something selected */ save_selection(2); - delete(); + delete(1/*to_push_undo*/); } break; } @@ -903,7 +907,7 @@ int callback(int event, int mx, int my, KeySym key, xctx->mx_save = mx; xctx->my_save = my; xctx->mx_double_save = xctx->mousex_snap; xctx->my_double_save = xctx->mousey_snap; - if(place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1) ) { + if(place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/) ) { xctx->mousey_snap = xctx->my_double_save; xctx->mousex_snap = xctx->mx_double_save; move_objects(START,0,0,0); diff --git a/src/draw.c b/src/draw.c index 2f1f0554..9b880fc5 100644 --- a/src/draw.c +++ b/src/draw.c @@ -359,7 +359,6 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, #if HAS_CAIRO==1 char *textfont; #endif - int dashprop=0, dash=0; if(xctx->inst[n].ptr == -1) return; if( (layer != PINLAYER && !enable_layer[layer]) ) return; @@ -370,7 +369,6 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, } else { hide = 0; } - dashprop = atoi(get_tok_value(xctx->inst[n].prop_ptr, "dash", 0)); type = (xctx->inst[n].ptr+ xctx->sym)->type; if(layer==0) { x1=X_TO_SCREEN(xctx->inst[n].x1+xoffset); /* 20150729 added xoffset, yoffset */ @@ -421,16 +419,13 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, for(j=0;j< symptr->lines[layer];j++) { line = (symptr->line[layer])[j]; - dash = line.dash; - if (line.dash == 0 && dashprop > 0 && layer==4) - dash = dashprop; ROTATION(rot, flip, 0.0,0.0,line.x1,line.y1,x1,y1); ROTATION(rot, flip, 0.0,0.0,line.x2,line.y2,x2,y2); ORDER(x1,y1,x2,y2); if(line.bus) - drawline(c,THICK, x0+x1, y0+y1, x0+x2, y0+y2, dash); + drawline(c,THICK, x0+x1, y0+y1, x0+x2, y0+y2, line.dash); else - drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, dash); + drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, line.dash); } for(j=0;j< symptr->polygons[layer];j++) { diff --git a/src/keys.help b/src/keys.help index dfbe30c9..3594665c 100644 --- a/src/keys.help +++ b/src/keys.help @@ -97,6 +97,7 @@ alt 'g' Hilight selected nets and send to gaw waveform viewer alt 'h' create symbol pins from schematic pins ctrl 'h' Follow http link or execute command (url, tclcommand properties) shift 'H' Attach net labels to selected instance +ctrl+shift 'H' Make schematic and symbol from selected components - 'i' Descend to symbol alt 'i' Edit selected symbol in a new window alt+shift 'J' Create labels with 'i' prefix from highlighted nets/pins diff --git a/src/make_sym_lcc.awk b/src/make_sym_lcc.awk index d06e68fb..4072ebaa 100644 --- a/src/make_sym_lcc.awk +++ b/src/make_sym_lcc.awk @@ -220,13 +220,22 @@ function process_line() # print "process_line: pin_label=" pin_label " verilog_type=" verilog_type } -function process_box_line() +function process_box_line( value) # value is also a global. Avoid clashes by declaring it local { print "process_box_line" - - if($0 ~ /^.*dash=/) - { - sub(/dash=[0-9]/,"dash=0") + # If sch has dash, sym will not have dash + if($0 ~ /^.*dash=/) { + sub(/dash=[1-9]/,"dash=0") + } + else { + value = $0 + if (value ~ /\{.*\}/) + { + sub(/^.*\{/,"",value) + sub(/\}/, "", value) # Get rid of } + if (length(value)) sub(/\{.*\}/, "{" value " dash=5}") # Put dash=5 within {} along with its original content + else sub(/\{.*\}/, "{dash=5}") + } } print "process_box_line: returning:" $0 # print "process_line: pin_label=" pin_label " verilog_type=" verilog_type diff --git a/src/psprint.c b/src/psprint.c index 1287c650..bf3b099b 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -497,7 +497,6 @@ static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xo xPoly polygon; xSymbol *symptr; char *textfont; - int dashprop=0, dash = 0; if(xctx->inst[n].ptr == -1) return; if( (layer != PINLAYER && !enable_layer[layer]) ) return; @@ -522,7 +521,6 @@ static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xo dbg(1, "draw_symbol(): skippinginst %d\n", n); return; } - dashprop = atoi(get_tok_value(xctx->inst[n].prop_ptr, "dash", 0)); flip = xctx->inst[n].flip; if(tmp_flip) flip = !flip; rot = (xctx->inst[n].rot + rot ) & 0x3; @@ -533,13 +531,10 @@ static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xo for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->lines[layer];j++) { line = ((xctx->inst[n].ptr+ xctx->sym)->line[layer])[j]; - dash = line.dash; - if (line.dash == 0 && dashprop > 0 && layer==4) - dash = dashprop; ROTATION(rot, flip, 0.0,0.0,line.x1,line.y1,x1,y1); ROTATION(rot, flip, 0.0,0.0,line.x2,line.y2,x2,y2); ORDER(x1,y1,x2,y2); - ps_drawline(layer, x0+x1, y0+y1, x0+x2, y0+y2, dash); + ps_drawline(layer, x0+x1, y0+y1, x0+x2, y0+y2, line.dash); } for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->polygons[layer];j++) { diff --git a/src/save.c b/src/save.c index 1c84710e..fb08a158 100644 --- a/src/save.c +++ b/src/save.c @@ -2146,6 +2146,36 @@ int load_sym_def(const char *name, FILE *embed_fd) return 1; } +void make_schematic_symbol_from_sel(void) +{ + char filename[PATH_MAX] = ""; + char name[1024]; + + my_snprintf(name, S(name), "save_file_dialog {Save file} .sch.sym INITIALLOADDIR"); + tcleval(name); + my_strncpy(filename, tclresult(), S(filename)); + if (!strcmp(filename, xctx->sch[xctx->currsch])) { + if (has_x) + tcleval("tk_messageBox -type ok -message {Cannot overwrite current schematic}"); + } + else if (strlen(filename)) { + if (xctx->lastsel) push_undo(); + make_schematic(filename); + delete(0/*to_push_undo*/); + place_symbol(-1, filename, 0, 0, 0, 0, NULL, 4, 1, 0/*to_push_undo*/); + if (has_x) + { + my_snprintf(name, S(name), "tk_messageBox -type okcancel -message {do you want to make symbol view for %s ?}", filename); + tcleval(name); + } + if (!has_x || !strcmp(tclresult(), "ok")) { + my_snprintf(name, S(name), "make_symbol_lcc {%s}", filename); + dbg(1, "make_symbol_lcc(): making symbol: name=%s\n", filename); + tcleval(name); + } + } +} + void create_sch_from_sym(void) { xSymbol *ptr; diff --git a/src/scheduler.c b/src/scheduler.c index f9939678..b0119570 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -311,7 +311,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg cmd_found = 1; rebuild_selected_array(); save_selection(2); - delete(); + delete(1/*to_push_undo*/); Tcl_ResetResult(interp); } } @@ -330,7 +330,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg else if(!strcmp(argv[1],"delete")) { cmd_found = 1; - if(argc==2) delete(); + if(argc==2) delete(1/*to_push_undo*/); Tcl_ResetResult(interp); } @@ -1089,12 +1089,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg cmd_found = 1; if(argc==7) /* pos sym_name x y rot flip prop draw first */ - place_symbol(-1, argv[2], atof(argv[3]), atof(argv[4]), atoi(argv[5]), atoi(argv[6]),NULL, 3, 1); + place_symbol(-1, argv[2], atof(argv[3]), atof(argv[4]), atoi(argv[5]), atoi(argv[6]),NULL, 3, 1, 1/*to_push_undo*/); else if(argc==8) - place_symbol(-1, argv[2], atof(argv[3]), atof(argv[4]), atoi(argv[5]), atoi(argv[6]), argv[7], 3, 1); + place_symbol(-1, argv[2], atof(argv[3]), atof(argv[4]), atoi(argv[5]), atoi(argv[6]), argv[7], 3, 1, 1/*to_push_undo*/); else if(argc==9) { int x = !(atoi(argv[8])); - place_symbol(-1, argv[2], atof(argv[3]), atof(argv[4]), atoi(argv[5]), atoi(argv[6]), argv[7], 0, x); + place_symbol(-1, argv[2], atof(argv[3]), atof(argv[4]), atoi(argv[5]), atoi(argv[6]), argv[7], 0, x, 1/*to_push_undo*/); } } @@ -1481,30 +1481,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg else if (!strcmp(argv[1], "make_sch_from_sel")) { - char filename[PATH_MAX]=""; cmd_found = 1; - my_snprintf(name, S(name), "save_file_dialog {Save file} .sch.sym INITIALLOADDIR"); - tcleval(name); - my_strncpy(filename, tclresult(), S(filename)); - if (!strcmp(filename, xctx->sch[xctx->currsch])) { - if (has_x) - tcleval("tk_messageBox -type ok -message {Cannot overwrite current schematic}"); - } - else if (strlen(filename)) { - make_schematic(filename); - delete(); - place_symbol(-1, filename, 0, 0, 0, 0, NULL, 4, 1); - if (has_x) - { - my_snprintf(name, S(name), "tk_messageBox -type okcancel -message {do you want to make symbol view for %s ?}", filename); - tcleval(name); - } - if (!has_x || !strcmp(tclresult(), "ok")) { - my_snprintf(name, S(name), "make_symbol_lcc {%s}", filename); - dbg(1, "make_symbol_lcc(): making symbol: name=%s\n", filename); - tcleval(name); - } - } + make_schematic_symbol_from_sel(); Tcl_ResetResult(interp); } @@ -1669,9 +1647,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg xctx->mx_double_save = xctx->mousex_snap; xctx->my_double_save = xctx->mousey_snap; if(argc == 4) { - ret = place_symbol(-1,argv[2],xctx->mousex_snap, xctx->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, 1/*to_push_undo*/); } else if(argc == 3) { - ret = place_symbol(-1,argv[2],xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1); + ret = place_symbol(-1,argv[2],xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); } else { #if 1 /* enable on request also in callback.c */ rebuild_selected_array(); @@ -1680,7 +1658,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), "}]", NULL); } #endif - ret = place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1); + ret = place_symbol(-1,NULL,xctx->mousex_snap, xctx->mousey_snap, 0, 0, NULL, 4, 1, 1/*to_push_undo*/); } if(ret) { diff --git a/src/select.c b/src/select.c index 12c366b6..5e80be1b 100644 --- a/src/select.c +++ b/src/select.c @@ -317,7 +317,7 @@ static void del_rect_line_arc_poly(void) } -void delete(void) +void delete(int to_push_undo) { int i, j, n, tmp; #if HAS_CAIRO==1 @@ -328,7 +328,7 @@ void delete(void) j = 0; bbox(START, 0.0 , 0.0 , 0.0 , 0.0); rebuild_selected_array(); - if(xctx->lastsel) push_undo(); + if(to_push_undo && xctx->lastsel) push_undo(); diff --git a/src/xschem.h b/src/xschem.h index a84db82a..47bde8b9 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -874,12 +874,13 @@ extern const char *abs_sym_path(const char *s, const char *ext); extern const char *add_ext(const char *f, const char *ext); extern void make_symbol(void); extern void make_schematic(const char *schname); +extern void make_schematic_symbol_from_sel(void); extern const char *get_sym_template(char *s, char *extra); /* bit0: invoke change_linewidth(), bit1: centered zoom */ extern void zoom_full(int draw, int sel, int flags, double shrink); extern void updatebbox(int count,xRect *boundbox,xRect *tmp); extern void draw_selection(GC g, int interruptable); -extern void delete(void); +extern void delete(int to_push_undo); extern void delete_only_rect_line_arc_poly(void); extern void polygon_bbox(double *x, double *y, int points, double *bx1, double *by1, double *bx2, double *by2); extern void arc_bbox(double x, double y, double r, double a, double b, @@ -1004,7 +1005,7 @@ extern void clear_drawing(void); extern int load_sym_def(const char name[], FILE *embed_fd); extern void descend_symbol(void); extern int place_symbol(int pos, const char *symbol_name, double x, double y, short rot, short flip, - const char *inst_props, int draw_sym, int first_call); + const char *inst_props, int draw_sym, int first_call, int to_push_undo); extern void place_net_label(int type); extern void attach_labels_to_inst(void); extern void delete_files(void); diff --git a/src/xschem.tcl b/src/xschem.tcl index e3099bcf..904d21f1 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -4097,7 +4097,7 @@ if { ( $::OS== "Windows" || [string length [lindex [array get env DISPLAY] 1] ] -command {xschem set hide_symbols $hide_symbols; xschem redraw} -accelerator Alt+B .menubar.sym.menu add command -label "Make symbol from schematic" -command "xschem make_symbol" -accelerator A .menubar.sym.menu add command -label "Make schematic from symbol" -command "xschem make_sch" -accelerator Ctrl+L - .menubar.sym.menu add command -label "Make schematic and symbol from selected components" -command "xschem make_sch_from_sel" + .menubar.sym.menu add command -label "Make schematic and symbol from selected components" -command "xschem make_sch_from_sel" -accelerator Ctrl+Shift+H .menubar.sym.menu add command -label "Attach pins to component instance" \ -command "xschem attach_pins" -accelerator Shift+H .menubar.sym.menu add command -label "Create symbol pins from selected schematic pins" \