diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 5aeac421..f079f211 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -1002,7 +1002,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" open file or opening a new(not existing) file. 'noundoreset': do not reset the undo history 'symbol': do not load symbols (used if loading a symbol instead of a schematic) - 'nofullzoom': do not do a full zoom on new schematic. + 'nofullzoom': do not do a full zoom on new schematic. + 'nodraw': do not draw.
Load schematic in a new tab/window. If 'f' not given prompt user
if 'f' is given as empty '{}' then open untitled.sch
@@ -1575,7 +1576,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Remove leading and trailing chars matching any character in 'sep' from str
Remove operlapping wires, join lines, trim wires at intersections
- +
Undo last action. Optional integers redo and set_modify are passed to pop_undo()
Use disk file ('disk') or RAM ('memory') for undo bufer
diff --git a/src/callback.c b/src/callback.c
index 9a1f64d5..6c1a6f5a 100644
--- a/src/callback.c
+++ b/src/callback.c
@@ -190,6 +190,8 @@ static void start_line(double mx, double my)
static void start_wire(double mx, double my)
{
+ dbg(1, "start_wire(): ui_state=%d, ui_state2=%d last_command=%d\n",
+ xctx->ui_state, xctx->ui_state2, xctx->last_command);
xctx->last_command = STARTWIRE;
if(xctx->ui_state & STARTWIRE) {
if(xctx->constr_mv != 2) {
@@ -1340,6 +1342,9 @@ static int end_place_move_copy_zoom()
static int check_menu_start_commands(double c_snap)
{
+ dbg(1, "check_menu_start_commands(): ui_state=%d, ui_state2=%d last_command=%d\n",
+ xctx->ui_state, xctx->ui_state2, xctx->last_command);
+
if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTWIRECUT)) {
break_wires_at_point(xctx->mousex_snap, xctx->mousey_snap, 1);
xctx->ui_state &=~MENUSTART;
@@ -1360,10 +1365,22 @@ static int check_menu_start_commands(double c_snap)
return 1;
}
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTWIRE)) {
- xctx->mx_double_save=xctx->mousex_snap;
- xctx->my_double_save=xctx->mousey_snap;
- new_wire(PLACE, xctx->mousex_snap, xctx->mousey_snap);
+ int prev_state = xctx->ui_state;
+ if(xctx->semaphore >= 2) return 0;
+ start_wire(xctx->mousex_snap, xctx->mousey_snap);
+ if(prev_state == STARTWIRE) {
+ tcleval("set constr_mv 0" );
+ xctx->constr_mv=0;
+ }
xctx->ui_state &=~MENUSTART;
+ xctx->ui_state2 = 0;
+
+ /*
+ * xctx->mx_double_save=xctx->mousex_snap;
+ * xctx->my_double_save=xctx->mousey_snap;
+ * new_wire(PLACE, xctx->mousex_snap, xctx->mousey_snap);
+ * xctx->ui_state &=~MENUSTART;
+ */
return 1;
}
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTSNAPWIRE)) {
@@ -1377,10 +1394,22 @@ static int check_menu_start_commands(double c_snap)
return 1;
}
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTLINE)) {
- xctx->mx_double_save=xctx->mousex_snap;
- xctx->my_double_save=xctx->mousey_snap;
- new_line(PLACE, xctx->mousex_snap, xctx->mousey_snap);
+ int prev_state = xctx->ui_state;
+ if(xctx->semaphore >= 2) return 0;
+ start_line(xctx->mousex_snap, xctx->mousey_snap);
+ if(prev_state == STARTLINE) {
+ tcleval("set constr_mv 0" );
+ xctx->constr_mv=0;
+ }
xctx->ui_state &=~MENUSTART;
+ xctx->ui_state2 = 0;
+
+ /*
+ * xctx->mx_double_save=xctx->mousex_snap;
+ * xctx->my_double_save=xctx->mousey_snap;
+ * new_line(PLACE, xctx->mousex_snap, xctx->mousey_snap);
+ * xctx->ui_state &=~MENUSTART;
+ */
return 1;
}
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTRECT)) {
@@ -2794,7 +2823,7 @@ int rstate; /* (reduced state, without ShiftMask) */
tcleval("tk_messageBox -type okcancel -parent [xschem get topwindow] "
"-message {Run circuit simulation?}");
if(strcmp(tclresult(),"ok")==0) {
- tcleval("[xschem get top_path].menubar.simulate invoke");
+ tcleval("[xschem get top_path].menubar invoke Simulate");
}
break;
}
diff --git a/src/save.c b/src/save.c
index c0210aa0..145fa283 100644
--- a/src/save.c
+++ b/src/save.c
@@ -3493,7 +3493,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
/* xctx->time_last_modify = time(NULL); */ /* file does not exist, set mtime to current time */
xctx->time_last_modify = 0; /* file does not exist, set mtime to 0 (undefined)*/
}
- }
+ } else {xctx->time_last_modify = 0;} /* undefined */
if(generator) {
char *cmd;
cmd = get_generator_command(fname);
diff --git a/src/scheduler.c b/src/scheduler.c
index 7a46ccbc..51af0134 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -1797,7 +1797,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
return TCL_ERROR;
}
if((i = get_instance(argv[3])) < 0 ) {
- Tcl_SetResult(interp, "xschem getprop: instance not found", TCL_STATIC);
+ Tcl_AppendResult(interp, "xschem getprop: instance not found:", argv[3], NULL);
return TCL_ERROR;
}
if(!strcmp(argv[2], "instance_notcl")) with_quotes = 2;
@@ -2035,6 +2035,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(res, S(res), "hilight_nets=%d\n", xctx->hilight_nets); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "semaphore=%d\n", xctx->semaphore); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "ui_state=%d\n", xctx->ui_state); Tcl_AppendResult(interp, res, NULL);
+ my_snprintf(res, S(res), "ui_state2=%d\n", xctx->ui_state2); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "last_command=%d\n", xctx->last_command); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "prep_net_structs=%d\n", xctx->prep_net_structs); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "prep_hi_structs=%d\n", xctx->prep_hi_structs); Tcl_AppendResult(interp, res, NULL);
@@ -2697,6 +2698,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
set_modify(1);
}
else {
+ xctx->last_command = 0;
xctx->ui_state |= MENUSTART;
xctx->ui_state2 = MENUSTARTLINE;
}
@@ -2784,10 +2786,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* 'noundoreset': do not reset the undo history
* 'symbol': do not load symbols (used if loading a symbol instead of a schematic)
* 'nofullzoom': do not do a full zoom on new schematic.
+ * 'nodraw': do not draw.
*/
else if(!strcmp(argv[1], "load") )
{
- int load_symbols = 1, force = 1, undo_reset = 1, nofullzoom = 0;
+ int load_symbols = 1, force = 1, undo_reset = 1, nofullzoom = 0, nodraw = 0;
size_t i;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 3) {
@@ -2796,6 +2799,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(!strcmp(argv[i], "gui")) force = 0;
if(!strcmp(argv[i], "noundoreset")) undo_reset = 0;
if(!strcmp(argv[i], "nofullzoom")) nofullzoom = 1;
+ if(!strcmp(argv[i], "nodraw")) {nofullzoom = 1; nodraw = 1;}
}
}
if(argc>2) {
@@ -2820,9 +2824,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else dbg(0, "xschem load: %s already open: %s\n", f, win_path);
}
if(!skip) {
+ int ret;
clear_all_hilights();
unselect_all(1);
- if(!undo_reset) xctx->push_undo();
+ /* no implicit undo: if needed do it before loading */
+ /* if(!undo_reset) xctx->push_undo(); */
xctx->currsch = 0;
remove_symbols();
if(!nofullzoom) {
@@ -2832,15 +2838,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->yorigin=CADINITIALY;
}
dbg(1, "scheduler: undo_reset=%d\n", undo_reset);
- load_schematic(load_symbols, f, undo_reset, !force);
+ ret = load_schematic(load_symbols, f, undo_reset, !force);
+ dbg(1, "xschem load: ret=%d\n", ret);
tclvareval("update_recent_file {", f, "}", NULL);
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], ".");
if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]);
str_hash_init(&xctx->portmap[xctx->currsch], HASHSIZE);
xctx->sch_path_hash[xctx->currsch] = 0;
xctx->sch_inst_number[xctx->currsch] = 1;
- if(nofullzoom) draw();
- else zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
+ if(nofullzoom) {
+ if(!nodraw) draw();
+ } else zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
}
}
}
@@ -6110,6 +6118,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
set_modify(1);
}
else {
+ xctx->last_command = 0;
xctx->ui_state |= MENUSTART;
xctx->ui_state2 = MENUSTARTWIRE;
}
diff --git a/src/token.c b/src/token.c
index 584724f4..18c8454e 100644
--- a/src/token.c
+++ b/src/token.c
@@ -1868,7 +1868,6 @@ static int has_included_subcircuit(int inst, int symbol, char **result)
tclvareval("has_included_subcircuit {", get_cell(symname, 0), "} {",
translated_sym_def, "}", NULL);
my_free(_ALLOC_ID_, &templ);
- my_free(_ALLOC_ID_, &symname);
my_free(_ALLOC_ID_, &symname_attr);
if(tclresult()[0]) {
char *subckt_pin, *pin_save;
@@ -1935,14 +1934,16 @@ static int has_included_subcircuit(int inst, int symbol, char **result)
ret = 1;
my_mstrcat(_ALLOC_ID_, result, tmp_result, NULL);
} else {
- dbg(0, "has_included_subcircuit(): symbol and .subckt pins do not match. Discard .subckt port order\n");
+ dbg(0, "has_included_subcircuit(): %s symbol and .subckt pins do not match. Discard port order\n",
+ symname);
if(has_x)
- tcleval("alert_ {has_included_subcircuit(): "
- "symbol and .subckt pins do not match. Discard .subckt port order}");
+ tclvareval("alert_ {has_included_subcircuit(): ", symname,
+ " symbol and .subckt pins do not match. Discard .subckt port order}", NULL);
}
if(tmp_result) my_free(_ALLOC_ID_, &tmp_result);
my_free(_ALLOC_ID_, &subckt_pinlist);
}
+ my_free(_ALLOC_ID_, &symname);
}
my_free(_ALLOC_ID_, &spice_sym_def);
return ret;
diff --git a/src/xschem.tcl b/src/xschem.tcl
index e9df503f..f4adc72c 100644
--- a/src/xschem.tcl
+++ b/src/xschem.tcl
@@ -1797,14 +1797,14 @@ proc cellview {} {
frame $sf.f$i
pack $sf.f$i -side top -fill x
label $sf.f$i.l -text $sym -width 20 -anchor w -padx 4 -borderwidth 1 \
- -relief sunken -pady 1 -bg grey80 -font $font
+ -relief sunken -pady 1 -font $font
# puts $sf.f$i.s
entry $sf.f$i.s -width 50 -borderwidth 1 -relief sunken -font $font
if { $spice_sym_def eq {}} {
if {![file exists $abs_sch]} {
$sf.f$i.s configure -bg red
} elseif {$default_sch ne $sch} {
- $sf.f$i.s configure -bg cyan
+ $sf.f$i.s configure -bg green
}
}
balloon $sf.f$i.s $abs_sch
@@ -1823,14 +1823,14 @@ proc cellview {} {
bind $sf.f$i.s