probe nodes from xschem into its own wave viewer

This commit is contained in:
Stefan Frederik 2022-01-29 02:36:54 +01:00
parent 3724052e5a
commit c083491738
10 changed files with 559 additions and 240 deletions

View File

@ -461,10 +461,14 @@ void ask_new_file(void)
if(check_loaded(f, win_path)) { if(check_loaded(f, win_path)) {
char msg[PATH_MAX + 100]; char msg[PATH_MAX + 100];
my_snprintf(msg, S(msg), "alert_ {xschem load: %s already open: %s}", f, win_path); my_snprintf(msg, S(msg),
if(has_x) tcleval(msg); "tk_messageBox -type okcancel -icon warning -parent [xschem get topwindow] "
"-message {Warning: %s already open.}", f);
if(has_x) {
tcleval(msg);
if(strcmp(tclresult(), "ok")) skip = 1;
}
else dbg(0, "ask_new_file: %s already open: %s\n", f, win_path); else dbg(0, "ask_new_file: %s already open: %s\n", f, win_path);
skip = 1;
} }
if(!skip) { if(!skip) {
dbg(1, "ask_new_file(): load file: %s\n", f); dbg(1, "ask_new_file(): load file: %s\n", f);

View File

@ -1719,22 +1719,30 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
char *tool_name = NULL; char *tool_name = NULL;
char str[200]; char str[200];
if(xctx->semaphore >= 2) break; if(xctx->semaphore >= 2) break;
tcleval("winfo exists .graphdialog");
if(tclresult()[0] == '1') tool = XSCHEM_GRAPH;
tcleval("info exists sim"); tcleval("info exists sim");
if(tclresult()[0] == '1') exists = 1; if(tclresult()[0] == '1') exists = 1;
xctx->enable_drill = 0; xctx->enable_drill = 0;
if(exists) { if(exists) {
tool = atol(tclgetvar("sim(spicewave,default)")); if(!tool) {
my_snprintf(str, S(str), "sim(spicewave,%d,name)", tool); tool = atol(tclgetvar("sim(spicewave,default)"));
my_strdup(1271, &tool_name, tclgetvar(str)); my_snprintf(str, S(str), "sim(spicewave,%d,name)", tool);
dbg(1,"callback(): tool_name=%s\n", tool_name); my_strdup(1271, &tool_name, tclgetvar(str));
if(strstr(tool_name, "Gaw")) tool=GAW; dbg(1,"callback(): tool_name=%s\n", tool_name);
else if(strstr(tool_name, "Bespice")) tool=BESPICE; if(strstr(tool_name, "Gaw")) tool=GAW;
if(tool) { else if(strstr(tool_name, "Bespice")) tool=BESPICE;
hilight_net(tool); my_free(1272, &tool_name);
redraw_hilights(0);
} }
my_free(1272, &tool_name); }
if(tool) {
hilight_net(tool);
redraw_hilights(0);
} }
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
break; break;
@ -2156,6 +2164,16 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
xctx->my_double_save=xctx->mousey_snap; xctx->my_double_save=xctx->mousey_snap;
break; break;
} }
/*
* if(button == Button3 && tclgetvar("graph_selected")[0] && xctx->semaphore >=2 )
* {
* sel = select_object(xctx->mousex, xctx->mousey, SELECTED, 0);
* if(sel) send_net_to_graph(1);
*
* }
* else
*/
if(button == Button3 && state == ControlMask && xctx->semaphore <2) if(button == Button3 && state == ControlMask && xctx->semaphore <2)
{ {
sel = select_object(xctx->mousex, xctx->mousey, SELECTED, 0); sel = select_object(xctx->mousex, xctx->mousey, SELECTED, 0);

View File

@ -1940,9 +1940,7 @@ void setup_graph_data(int i, const int flags, int skip, Graph_ctx *gr)
/* plot single dataset */ /* plot single dataset */
val = get_tok_value(r->prop_ptr,"dataset",0); val = get_tok_value(r->prop_ptr,"dataset",0);
if(val[0]) gr->dataset = atoi(val); if(val[0]) gr->dataset = atoi(val);
gr->gh = gr->gy2 - gr->gy1; gr->gh = gr->gy2 - gr->gy1;
/* set margins */ /* set margins */
tmp = gr->rw * 0.14; tmp = gr->rw * 0.14;
gr->marginx = tmp < 30 ? 30 : tmp; gr->marginx = tmp < 30 ? 30 : tmp;
@ -1964,9 +1962,9 @@ void setup_graph_data(int i, const int flags, int skip, Graph_ctx *gr)
tmp = gr->w * 0.00044; tmp = gr->w * 0.00044;
if(tmp < gr->txtsizelab) gr->txtsizelab = tmp; if(tmp < gr->txtsizelab) gr->txtsizelab = tmp;
if(flags & 2) if(flags & 2)
gr->digtxtsizelab = 0.300 * fabs( gr->gh / gr->posh); gr->digtxtsizelab = 0.001300 * fabs( gr->h / gr->posh );
else else
gr->digtxtsizelab = 0.400 * fabs( gr->gh / gr->posh); gr->digtxtsizelab = 0.001600 * fabs( gr->h / gr->posh );
/* x axis, y axis text sizes */ /* x axis, y axis text sizes */
gr->txtsizey = gr->h / gr->divy * 0.009; gr->txtsizey = gr->h / gr->divy * 0.009;
@ -2090,28 +2088,36 @@ static void draw_graph_variables(int wcnt, int wave_color, int n_nodes, int swee
yt = s1 * (double)(n_nodes - wcnt) * gr->gh - (gr->gy1 - gr->gh * 0.1) * s2; yt = s1 * (double)(n_nodes - wcnt) * gr->gh - (gr->gy1 - gr->gh * 0.1) * s2;
if(yt <= gr->ypos2 && yt >= gr->ypos1) { if(yt <= gr->ypos2 && yt >= gr->ypos1) {
#if HAS_CAIRO == 1
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) { if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
} }
#endif
draw_string(wave_color, NOW, tmpstr, 2, 0, 0, 0, draw_string(wave_color, NOW, tmpstr, 2, 0, 0, 0,
xt, DW_Y(yt), gr->digtxtsizelab, gr->digtxtsizelab); xt, DW_Y(yt), gr->digtxtsizelab, gr->digtxtsizelab);
#if HAS_CAIRO == 1
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) { if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
} }
#endif
} }
} else { } else {
#if HAS_CAIRO == 1
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) { if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
} }
#endif
draw_string(wave_color, NOW, tmpstr, 0, 0, 0, 0, draw_string(wave_color, NOW, tmpstr, 0, 0, 0, 0,
gr->rx1 + 2 + gr->rw / n_nodes * wcnt, gr->ry1, gr->txtsizelab, gr->txtsizelab); gr->rx1 + 2 + gr->rw / n_nodes * wcnt, gr->ry1, gr->txtsizelab, gr->txtsizelab);
#if HAS_CAIRO == 1
if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) { if(gr->hilight_wave[0] == gr->i && gr->hilight_wave[1] == wcnt) {
cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_select_font_face(xctx->cairo_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_select_font_face(xctx->cairo_save_ctx, "Sans-Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
} }
#endif
} }
bbox(END, 0.0, 0.0, 0.0, 0.0); bbox(END, 0.0, 0.0, 0.0, 0.0);
} }

View File

@ -902,6 +902,35 @@ static void send_net_to_bespice(int simtype, const char *node)
} }
} }
static void send_net_to_graph(char **s, int simtype, const char *node)
{
int c, k, tok_mult;
Node_hashentry *node_entry;
const char *expanded_tok;
const char *tok;
char ss[1024];
if(!node || !node[0]) return;
tok = node;
node_entry = bus_node_hash_lookup(tok, "", XLOOKUP, 0, "", "", "", "");
if(tok[0] == '#') tok++;
if(node_entry && (node_entry->d.port == 0 || !strcmp(xctx->sch_path[xctx->currsch], ".") )) {
char *t=NULL, *p=NULL;
c = get_color(xctx->hilight_color);
expanded_tok = expandlabel(tok, &tok_mult);
for(k=1; k<=tok_mult; k++) {
my_strdup(1498, &t, find_nth(expanded_tok, ',', k));
my_strdup2(1499, &p, xctx->sch_path[xctx->currsch]+1);
if(simtype == 0 ) { /* spice */
dbg(1, "%s%s color=%d\n", strtolower(p), strtolower(t), c);
my_snprintf(ss, S(ss), "%s%s %d ", strtolower(p), strtolower(t), c);
my_strcat(1502, s, ss);
}
}
my_free(1500, &p);
my_free(1501, &t);
}
}
static void send_net_to_gaw(int simtype, const char *node) static void send_net_to_gaw(int simtype, const char *node)
{ {
int c, k, tok_mult; int c, k, tok_mult;
@ -1546,7 +1575,7 @@ void hilight_net(int viewer)
char *type; char *type;
int sim_is_xyce; int sim_is_xyce;
int incr_hi; int incr_hi;
char *s = NULL;
incr_hi = tclgetboolvar("incr_hilight"); incr_hi = tclgetboolvar("incr_hilight");
prepare_netlist_structs(0); prepare_netlist_structs(0);
dbg(1, "hilight_net(): entering\n"); dbg(1, "hilight_net(): entering\n");
@ -1559,8 +1588,10 @@ void hilight_net(int viewer)
case WIRE: case WIRE:
/* sets xctx->hilight_nets=1 */ /* sets xctx->hilight_nets=1 */
if(!bus_hilight_hash_lookup(xctx->wire[n].node, xctx->hilight_color, XINSERT_NOREPLACE)) { if(!bus_hilight_hash_lookup(xctx->wire[n].node, xctx->hilight_color, XINSERT_NOREPLACE)) {
if(viewer == GAW) send_net_to_gaw(sim_is_xyce, xctx->wire[n].node); if(viewer == XSCHEM_GRAPH) {
if(viewer == BESPICE) send_net_to_bespice(sim_is_xyce, xctx->wire[n].node); send_net_to_graph(&s, sim_is_xyce, xctx->wire[n].node);
} else if(viewer == GAW) send_net_to_gaw(sim_is_xyce, xctx->wire[n].node);
else if(viewer == BESPICE) send_net_to_bespice(sim_is_xyce, xctx->wire[n].node);
if(incr_hi) incr_hilight_color(); if(incr_hi) incr_hilight_color();
} }
break; break;
@ -1569,8 +1600,11 @@ void hilight_net(int viewer)
if( type && xctx->inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */ if( type && xctx->inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
/* sets xctx->hilight_nets=1 */ /* sets xctx->hilight_nets=1 */
if(!bus_hilight_hash_lookup(xctx->inst[n].node[0], xctx->hilight_color, XINSERT_NOREPLACE)) { if(!bus_hilight_hash_lookup(xctx->inst[n].node[0], xctx->hilight_color, XINSERT_NOREPLACE)) {
if(viewer == GAW) send_net_to_gaw(sim_is_xyce, xctx->inst[n].node[0]); if(viewer == XSCHEM_GRAPH) {
if(viewer == BESPICE) send_net_to_bespice(sim_is_xyce, xctx->inst[n].node[0]); send_net_to_graph(&s, sim_is_xyce, xctx->inst[n].node[0]);
}
else if(viewer == GAW) send_net_to_gaw(sim_is_xyce, xctx->inst[n].node[0]);
else if(viewer == BESPICE) send_net_to_bespice(sim_is_xyce, xctx->inst[n].node[0]);
if(incr_hi) incr_hilight_color(); if(incr_hi) incr_hilight_color();
} }
} else { } else {
@ -1578,8 +1612,9 @@ void hilight_net(int viewer)
xctx->hilight_nets=1; xctx->hilight_nets=1;
xctx->inst[n].color = xctx->hilight_color; xctx->inst[n].color = xctx->hilight_color;
if(type && (!strcmp(type, "current_probe") || !strcmp(type, "vsource")) ) { if(type && (!strcmp(type, "current_probe") || !strcmp(type, "vsource")) ) {
if(viewer == GAW) send_current_to_gaw(sim_is_xyce, xctx->inst[n].instname); if(viewer == XSCHEM_GRAPH) ; /* <<<<, */
if(viewer == BESPICE) send_current_to_bespice(sim_is_xyce, xctx->inst[n].instname); else if(viewer == GAW) send_current_to_gaw(sim_is_xyce, xctx->inst[n].instname);
else if(viewer == BESPICE) send_current_to_bespice(sim_is_xyce, xctx->inst[n].instname);
} }
if(incr_hi) incr_hilight_color(); if(incr_hi) incr_hilight_color();
} }
@ -1588,6 +1623,10 @@ void hilight_net(int viewer)
break; break;
} }
} }
if( viewer == XSCHEM_GRAPH && s) {
tclvareval("graph_add_nodes_from_list {", s, "}", NULL);
my_free(1504, &s);
}
if(!incr_hi) incr_hilight_color(); if(!incr_hi) incr_hilight_color();
if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE); if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE);
tcleval("if { [info exists gaw_fd] } {close $gaw_fd; unset gaw_fd}\n"); tcleval("if { [info exists gaw_fd] } {close $gaw_fd; unset gaw_fd}\n");

View File

@ -306,17 +306,18 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xRECT, GRIDLAYER, SELECTED, xRECT, GRIDLAYER, SELECTED,
"flags=graph\n" "flags=graph\n"
"y1=0\n" "y1=0\n"
"y2=5\n" "y2=2\n"
"ypos1=0\n" "ypos1=0\n"
"ypos2=5\n" "ypos2=2\n"
"divy=4\n" "divy=5\n"
"subdivy=1\n" "subdivy=1\n"
"unity=1\n"
"x1=0\n" "x1=0\n"
"x2=10e-6\n" "x2=10e-6\n"
"divx=8\n" "divx=5\n"
"subdivx=1\n" "subdivx=1\n"
"node=\"v(a) v(b) v(c)\"\n" "node=\"\"\n"
"color=\"7 8 10 11 12 13 14 15 16 17\"\n" "color=\"\"\n"
"dataset=0\n" "dataset=0\n"
"unitx=u\n" "unitx=u\n"
); );
@ -1621,10 +1622,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_strncpy(f, abs_sym_path(argv[2], ""), S(f)); my_strncpy(f, abs_sym_path(argv[2], ""), S(f));
if(f[0] && check_loaded(f, win_path)) { if(f[0] && check_loaded(f, win_path)) {
char msg[PATH_MAX + 100]; char msg[PATH_MAX + 100];
my_snprintf(msg, S(msg), "alert_ {xschem load: %s already open: %s}", f, win_path); my_snprintf(msg, S(msg),
if(has_x) tcleval(msg); "tk_messageBox -type okcancel -icon warning -parent [xschem get topwindow] "
"-message {Warning: %s already open.}", f);
if(has_x) {
tcleval(msg);
if(strcmp(tclresult(), "ok")) skip = 1;
}
else dbg(0, "xschem load: %s already open: %s\n", f, win_path); else dbg(0, "xschem load: %s already open: %s\n", f, win_path);
skip = 1;
} }
if(!skip) { if(!skip) {
clear_all_hilights(); clear_all_hilights();
@ -2590,11 +2595,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
{ {
/* 0 1 2 3 4 5 6 /* 0 1 2 3 4 5 6
* xschem setprop instance R4 value [30k] [fast] */ * xschem setprop instance R4 value [30k] [fast] */
int inst, fast=0;
cmd_found = 1; cmd_found = 1;
if(argc > 2 && !strcmp(argv[2], "instance")) { if(argc > 2 && !strcmp(argv[2], "instance")) {
int inst, fast=0;
if(argc >= 7) { if(argc >= 7) {
if(!strcmp(argv[6], "fast")) { if(!strcmp(argv[6], "fast")) {
fast = 1; fast = 1;
@ -2657,6 +2662,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} else if(argc > 5 && !strcmp(argv[2], "rect")) { } else if(argc > 5 && !strcmp(argv[2], "rect")) {
/* 0 1 2 3 4 5 6 7 /* 0 1 2 3 4 5 6 7
* xschem setprop rect c n token value [fast] */ * xschem setprop rect c n token value [fast] */
int change_done = 0;
int fast = 0;
xRect *r; xRect *r;
int c = atoi(argv[3]); int c = atoi(argv[3]);
int n = atoi(argv[4]); int n = atoi(argv[4]);
@ -2671,22 +2678,40 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
fast = 1; fast = 1;
argc = 7; argc = 7;
} }
if(!strcmp(argv[7], "fastundo")) {
fast = 3;
argc = 7;
}
} }
else if(argc >= 7) { else if(argc >= 7) {
if(!strcmp(argv[6], "fast")) { if(!strcmp(argv[6], "fast")) {
fast = 1; fast = 1;
argc = 6; argc = 6;
} }
if(!strcmp(argv[6], "fastundo")) {
fast = 3;
argc = 6;
}
} }
if(!fast) { if(!fast) {
bbox(START,0.0,0.0,0.0,0.0); bbox(START,0.0,0.0,0.0,0.0);
xctx->push_undo();
} }
set_modify(1); if(argc > 6) {
if(argc > 6) /* verify if there is some difference */
my_strdup(1486, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6])); if(strcmp(argv[6], get_tok_value(r->prop_ptr, argv[5], 0))) {
else change_done = 1;
my_strdup(1478, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */ if(fast == 3 || fast == 0) xctx->push_undo();
my_strdup2(1486, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6]));
}
} else {
get_tok_value(r->prop_ptr, argv[5], 0);
if(xctx->get_tok_size) {
change_done = 1;
if(fast == 3 || fast == 0) xctx->push_undo();
my_strdup2(1478, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */
}
}
if(change_done) set_modify(1);
set_rect_flags(r); /* set cached .flags bitmask from on attributes */ set_rect_flags(r); /* set cached .flags bitmask from on attributes */
if(!fast) { if(!fast) {
bbox(ADD, r->x1, r->y1, r->x2, r->y2); bbox(ADD, r->x1, r->y1, r->x2, r->y2);

View File

@ -960,9 +960,11 @@ int check_loaded(const char *f, char *win_path)
int found = 0; int found = 0;
for(i = 0; i < MAX_NEW_WINDOWS; i++) { for(i = 0; i < MAX_NEW_WINDOWS; i++) {
ctx = save_xctx[i]; ctx = save_xctx[i];
dbg(1, "window_count=%d i=%d\n", window_count, i);
/* if only one schematic it is not yet saved in save_xctx */ /* if only one schematic it is not yet saved in save_xctx */
if(window_count == 0 && i == 0) ctx = xctx; if(window_count == 0 && i == 0) ctx = xctx;
if(ctx) { if(ctx) {
dbg(1, "%s <--> %s\n", ctx->sch[ctx->currsch], f);
if(!strcmp(ctx->sch[ctx->currsch], f)) { if(!strcmp(ctx->sch[ctx->currsch], f)) {
dbg(1, "check_loaded(): f=%s, sch=%s\n", f, ctx->sch[ctx->currsch]); dbg(1, "check_loaded(): f=%s, sch=%s\n", f, ctx->sch[ctx->currsch]);
found = 1; found = 1;
@ -971,6 +973,7 @@ int check_loaded(const char *f, char *win_path)
} }
} }
} }
dbg(1, "check_loaded: return %d\n", found);
return found; return found;
} }
@ -1048,15 +1051,21 @@ static void create_new_window(int *window_count, const char *fname)
char toppath[WINDOW_PATH_SIZE]; char toppath[WINDOW_PATH_SIZE];
int i, n; int i, n;
dbg(1, "new_schematic() create\n"); dbg(1, "new_schematic() create: fname=%s *window_count = %d\n", fname, *window_count);
if(*window_count && fname && fname[0] && check_loaded(fname, toppath)) {
if(/* *window_count && */ fname && fname[0] && check_loaded(fname, toppath)) {
char msg[PATH_MAX+100]; char msg[PATH_MAX+100];
my_snprintf(msg, S(msg), "alert_ {create_new_window: %s already open: %s}", fname, toppath); my_snprintf(msg, S(msg),
if(has_x) "tk_messageBox -type okcancel -icon warning -parent [xschem get topwindow] "
"-message {Warning: %s already open.}", fname);
if(has_x) {
tcleval(msg); tcleval(msg);
else if(strcmp(tclresult(), "ok")) return;
}
else {
dbg(0, "create_new_window: %s already open: %s\n", fname, toppath); dbg(0, "create_new_window: %s already open: %s\n", fname, toppath);
return; return;
}
} }
if(*window_count == 0) { if(*window_count == 0) {
for(i = 0; i < MAX_NEW_WINDOWS; i++) { for(i = 0; i < MAX_NEW_WINDOWS; i++) {
@ -1124,15 +1133,23 @@ static void create_new_tab(int *window_count, const char *fname)
char win_path[WINDOW_PATH_SIZE]; char win_path[WINDOW_PATH_SIZE];
dbg(1, "new_schematic() new_tab, creating...\n"); dbg(1, "new_schematic() new_tab, creating...\n");
if(*window_count && fname && fname[0] && check_loaded(fname, open_path)) { if(/* *window_count && */ fname && fname[0] && check_loaded(fname, open_path)) {
char msg[PATH_MAX+100]; char msg[PATH_MAX+100];
my_snprintf(msg, S(msg), "alert_ {create_new_tab: %s already open: %s}", fname, open_path); my_snprintf(msg, S(msg),
if(has_x) "tk_messageBox -type okcancel -icon warning -parent [xschem get topwindow] "
"-message {Warning: %s already open.}", fname);
if(has_x) {
tcleval(msg); tcleval(msg);
else if(strcmp(tclresult(), "ok")) {
switch_tab(window_count, open_path);
return;
}
}
else {
dbg(0, "create_new_tab: %s already open: %s\n", fname, open_path); dbg(0, "create_new_tab: %s already open: %s\n", fname, open_path);
switch_tab(window_count, open_path); switch_tab(window_count, open_path);
return; return;
}
} }
if(*window_count == 0) { if(*window_count == 0) {
for(i = 0; i < MAX_NEW_WINDOWS; i++) { for(i = 0; i < MAX_NEW_WINDOWS; i++) {

View File

@ -219,6 +219,7 @@ extern char win_temp_dir[PATH_MAX];
#define NGSPICE 1 #define NGSPICE 1
#define GAW 2 #define GAW 2
#define BESPICE 3 #define BESPICE 3
#define XSCHEM_GRAPH 4
/* some useful primes */ /* some useful primes */
/* 109, 163, 251, 367, 557, 823, 1237, 1861, 2777, 4177, 6247, 9371, 14057 */ /* 109, 163, 251, 367, 557, 823, 1237, 1861, 2777, 4177, 6247, 9371, 14057 */

View File

@ -1285,9 +1285,13 @@ proc waves {} {
# ============================================================ # ============================================================
# allow change color (via graph_change_wave_color) of double clicked wave # allow change color (via graph_change_wave_color) of double clicked wave
proc graph_edit_wave {n n_wave} { proc graph_edit_wave {n n_wave} {
global graph_sel_color graph_selected colors graph_sel_wave global graph_sel_color graph_selected colors graph_sel_wave
global graph_schname
set graph_schname [xschem get schname]
set_ne graph_sel_color 4 set_ne graph_sel_color 4
set graph_selected $n set graph_selected $n
set graph_sel_wave $n_wave set graph_sel_wave $n_wave
@ -1302,48 +1306,115 @@ proc graph_edit_wave {n n_wave} {
} }
set col [lrange $col 0 [expr {$i - 1}]] set col [lrange $col 0 [expr {$i - 1}]]
set graph_sel_color [lindex $col $graph_sel_wave] set graph_sel_color [lindex $col $graph_sel_wave]
xschem setprop rect 2 $graph_selected color $col fast xschem setprop rect 2 $graph_selected color $col fastundo
xschem draw_graph $graph_selected xschem draw_graph $graph_selected
# puts "graph: $graph_selected , wave: $n_wave, n_nodes: $n_nodes" # puts "graph: $graph_selected , wave: $n_wave, n_nodes: $n_nodes"
# puts " node: $node, col: $col" # puts " node: $node, col: $col"
# puts "------" # puts "------"
toplevel .dialog toplevel .graphdialog
frame .dialog.f frame .graphdialog.f
button .dialog.ok -text OK -command {destroy .dialog} button .graphdialog.ok -text OK -command {destroy .graphdialog}
button .dialog.cancel -text Cancel -command {destroy .dialog} button .graphdialog.cancel -text Cancel -command {destroy .graphdialog}
for {set i 4} {$i < 22} {incr i} { for {set i 4} {$i < 22} {incr i} {
radiobutton .dialog.f.r$i -value $i -bg [lindex $colors $i] \ radiobutton .graphdialog.f.r$i -value $i -bg [lindex $colors $i] \
-variable graph_sel_color -command {graph_change_wave_color $graph_sel_wave } -variable graph_sel_color -command {graph_change_wave_color $graph_sel_wave }
pack .dialog.f.r$i -side left -fill both -expand yes pack .graphdialog.f.r$i -side left -fill both -expand yes
} }
grid .dialog.f - -sticky nsew grid .graphdialog.f - -sticky nsew
grid .dialog.ok .dialog.cancel -sticky ew grid .graphdialog.ok .graphdialog.cancel -sticky ew
grid rowconfig .dialog 0 -weight 1 grid rowconfig .graphdialog 0 -weight 1
grid column .dialog 0 -weight 1 grid column .graphdialog 0 -weight 1
grid column .dialog 1 -weight 1 grid column .graphdialog 1 -weight 1
tkwait window .dialog tkwait window .graphdialog
set graph_schname {}
} }
# add nodes from left listbox
proc graph_add_nodes {} { # get selected text from a text widget:
global graph_bus #
set sel_idx [.dialog.center.left.list1 curselection] # .graphdialog.center.right.text1 get \
# [.graphdialog.center.right.text1 index sel.first] \
# [.graphdialog.center.right.text1 index sel.last]
#
#
#
# add nodes from provided list of {node color} ....
proc graph_add_nodes_from_list {nodelist} {
global graph_bus graph_selected graph_schname
set sel {} set sel {}
if {$graph_bus} { if {$graph_bus} {
set sep , set sep ,
} else { } else {
set sep \n set sep \n
} }
foreach i $sel_idx { set current_node_list [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}]
if {$sel ne {}} {append sel $sep} set col [xschem getprop rect 2 $graph_selected color]
append sel [.dialog.center.left.list1 get $i] if {[string length $current_node_list] > 0 && ![regexp "\n$" $current_node_list]} {
.graphdialog.center.right.text1 insert end \n
} }
set change_done 0
set first 0
foreach {i c} $nodelist {
if {$sel ne {}} {append sel $sep}
if {!$first || !$graph_bus } {
regsub {\[.*} $i {} busname
lappend col $c
}
append sel $i
set change_done 1
set first 1
}
if {$change_done && $graph_bus} {
set sel "[string toupper $busname],${sel}\n"
} else {
set sel "${sel}\n"
}
if {$change_done} {
.graphdialog.center.right.text1 insert end $sel
if { [xschem get schname] eq $graph_schname } {
set node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
xschem setprop rect 2 $graph_selected color $col fastundo
graph_update_nodelist
xschem setprop rect 2 $graph_selected node $node fast
xschem draw_graph $graph_selected
}
}
}
# add nodes from left listbox
proc graph_add_nodes {} {
global graph_bus
set sel_idx [.graphdialog.center.left.list1 curselection]
set sel {}
if {$graph_bus} { if {$graph_bus} {
set sep ,
} else {
set sep \n
}
set current_node_list [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}]
if {[string length $current_node_list] > 0 && ![regexp "\n$" $current_node_list]} {
.graphdialog.center.right.text1 insert end \n
}
set change_done 0
foreach i $sel_idx {
set c [.graphdialog.center.left.list1 get $i]
set c [regsub -all {([][])} $c {\\\1}]
if { ![regexp "(^|\[ \t\n\])${c}($|\[ \t\n\])" $current_node_list]} {
if {$sel ne {}} {append sel $sep}
append sel [.graphdialog.center.left.list1 get $i]
set change_done 1
}
}
if {$change_done && $graph_bus} {
set sel "BUS_NAME,${sel}\n" set sel "BUS_NAME,${sel}\n"
} else { } else {
set sel "${sel}\n" set sel "${sel}\n"
} }
.dialog.center.right.text1 insert {insert lineend + 1 char} $sel if {$change_done} {
.graphdialog.center.right.text1 insert {insert lineend + 1 char} $sel
}
} }
proc graph_get_signal_list {siglist pattern } { proc graph_get_signal_list {siglist pattern } {
@ -1367,70 +1438,87 @@ proc graph_get_signal_list {siglist pattern } {
# OR # OR
# change color attribute of wave given as parameter, redraw graph # change color attribute of wave given as parameter, redraw graph
proc graph_change_wave_color {{wave {}}} { proc graph_change_wave_color {{wave {}}} {
global graph_sel_color graph_selected global graph_sel_color graph_selected graph_schname
if { [xschem get schname] ne $graph_schname } return
# get tag the cursor is on: # get tag the cursor is on:
if { $wave eq {}} { if { $wave eq {}} {
set tag [.dialog.center.right.text1 tag names insert] set tag [.graphdialog.center.right.text1 tag names insert]
if { [regexp {^t} $tag]} { if { [regexp {^t} $tag]} {
set index [string range $tag 1 end] set index [string range $tag 1 end]
set col [xschem getprop rect 2 $graph_selected color] set col [xschem getprop rect 2 $graph_selected color]
set col [lreplace $col $index $index $graph_sel_color] set col [lreplace $col $index $index $graph_sel_color]
xschem setprop rect 2 $graph_selected color $col fast xschem setprop rect 2 $graph_selected color $col fastundo
graph_update_nodelist graph_update_nodelist
xschem draw_graph $graph_selected
} }
# wave to change provided as parameter # wave to change provided as parameter
} else { } else {
set col [xschem getprop rect 2 $graph_selected color] set col [xschem getprop rect 2 $graph_selected color]
set col [lreplace $col $wave $wave $graph_sel_color] set col [lreplace $col $wave $wave $graph_sel_color]
xschem setprop rect 2 $graph_selected color $col fast xschem setprop rect 2 $graph_selected color $col fastundo
xschem draw_graph $graph_selected xschem draw_graph $graph_selected
} }
} }
# tag nodes in text widget with assigned colors # tag nodes in text widget with assigned colors
# redraw graph proc graph_update_nodelist {} {
proc graph_update_nodelist {{nosave {}}} { global graph_selected colors graph_sel_color graph_schname
global graph_selected colors graph_sel_color if { [xschem get schname] ne $graph_schname } return
set nodelist [.dialog.center.right.text1 get 1.0 end]
# delete old tags # delete old tags
eval .dialog.center.right.text1 tag delete [ .dialog.center.right.text1 tag names] eval .graphdialog.center.right.text1 tag delete [ .graphdialog.center.right.text1 tag names]
# tagging nodes in text widget: # tagging nodes in text widget:
set col [xschem getprop rect 2 $graph_selected color] set col [xschem getprop rect 2 $graph_selected color]
set col [string trim $col " \n"] set col [string trim $col " \n"]
set tt [.dialog.center.right.text1 search -all -nolinestop -regexp -count cc {[^ \n]+} 1.0] set tt [.graphdialog.center.right.text1 search -all -nolinestop -regexp -count cc {[^ \n]+} 1.0]
set n 0 set n 0
if { [info exists cc] && ($tt ne {}) } { if { [info exists cc] && ($tt ne {}) } {
foreach t $tt c $cc { foreach t $tt c $cc {
set col_idx [lindex $col $n] set col_idx [lindex $col $n]
# add missing colors
if {$col_idx eq {}} { if {$col_idx eq {}} {
set col_idx $graph_sel_color set col_idx $graph_sel_color
lappend col $graph_sel_color lappend col $graph_sel_color
} }
set b [lindex $colors $col_idx] set b [lindex $colors $col_idx]
.dialog.center.right.text1 tag add t$n $t "$t + $c chars" .graphdialog.center.right.text1 tag add t$n $t "$t + $c chars"
.dialog.center.right.text1 tag configure t$n -background $b .graphdialog.center.right.text1 tag configure t$n -background $b
if { $col_idx == 8 || $col_idx == 9 || $col_idx == 16 || $col_idx == 19} {
.dialog.center.right.text1 tag configure t$n -foreground black}
incr n incr n
} }
# remove excess colors
set col [lrange $col 0 [expr {$n - 1}]] set col [lrange $col 0 [expr {$n - 1}]]
if {$nosave ne {nosave}} {xschem setprop rect 2 $graph_selected color $col fast} if { [llength $col] != [llength [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}]] } {
puts "PROBLEMS: colors and nodes of different length"
}
} else {
set col {}
} }
xschem draw_graph $graph_selected xschem setprop rect 2 $graph_selected color $col fastundo
} }
proc fill_graph_listbox {} { proc fill_graph_listbox {} {
set retval [.dialog.top.search get] set retval [.graphdialog.top.search get]
set retval [graph_get_signal_list [xschem raw_query list] $retval] set retval [graph_get_signal_list [xschem raw_query list] $retval]
.dialog.center.left.list1 delete 0 end .graphdialog.center.left.list1 delete 0 end
eval .dialog.center.left.list1 insert 0 $retval eval .graphdialog.center.left.list1 insert 0 $retval
} }
proc graph_edit_properties {n} { proc graph_edit_properties {n} {
global graph_bus graph_sort graph_digital graph_selected colors graph_sel_color global graph_bus graph_sort graph_digital graph_selected colors graph_sel_color
global graph_unlocked global graph_unlocked graph_schname graph_unitx graph_unity
global graph_divx graph_divy graph_subdivx graph_subdivy
set geom {}
if { [winfo exists .graphdialog]} {
set geom [winfo geometry .graphdialog]
}
catch {destroy .graphdialog}
toplevel .graphdialog -width 1 -height 1
update idletasks
if {$geom ne {}} { wm geometry .graphdialog $geom}
set graph_selected $n set graph_selected $n
set graph_schname [xschem get schname]
set_ne graph_sel_color 4 set_ne graph_sel_color 4
set_ne graph_bus 0 set_ne graph_bus 0
set_ne graph_sort 0 set_ne graph_sort 0
@ -1442,157 +1530,259 @@ proc graph_edit_properties {n} {
set graph_unlocked 0 set graph_unlocked 0
} }
toplevel .dialog frame .graphdialog.top
frame .dialog.top # another row of buttons
panedwindow .dialog.center -orient horiz frame .graphdialog.top2
frame .dialog.bottom panedwindow .graphdialog.center -orient horiz
frame .dialog.center.left frame .graphdialog.bottom
frame .dialog.center.right frame .graphdialog.center.left
.dialog.center add .dialog.center.left .dialog.center.right frame .graphdialog.center.right
pack .dialog.top -side top -fill x .graphdialog.center add .graphdialog.center.left .graphdialog.center.right
pack .dialog.center -side top -fill both -expand yes pack .graphdialog.top -side top -fill x
pack .dialog.bottom -side top -fill x pack .graphdialog.top2 -side top -fill x
pack .graphdialog.center -side top -fill both -expand yes
pack .graphdialog.bottom -side top -fill x
# center-left frame # center-left frame
label .dialog.center.left.lab1 -text {Signal list} label .graphdialog.center.left.lab1 -text {Signal list}
button .dialog.center.left.add -text Add -command { button .graphdialog.center.left.add -text Add -command {
graph_add_nodes; graph_update_nodelist graph_add_nodes; graph_update_nodelist
} }
listbox .dialog.center.left.list1 -width 20 -height 10 -selectmode extended \ listbox .graphdialog.center.left.list1 -width 20 -height 10 -selectmode extended \
-yscrollcommand {.dialog.center.left.yscroll set} \ -yscrollcommand {.graphdialog.center.left.yscroll set} \
-xscrollcommand {.dialog.center.left.xscroll set} -xscrollcommand {.graphdialog.center.left.xscroll set}
scrollbar .dialog.center.left.yscroll -command {.dialog.center.left.list1 yview} scrollbar .graphdialog.center.left.yscroll -command {.graphdialog.center.left.list1 yview}
scrollbar .dialog.center.left.xscroll -orient horiz -command {.dialog.center.left.list1 xview} scrollbar .graphdialog.center.left.xscroll -orient horiz -command {.graphdialog.center.left.list1 xview}
grid .dialog.center.left.lab1 .dialog.center.left.add grid .graphdialog.center.left.lab1 .graphdialog.center.left.add
grid .dialog.center.left.list1 - .dialog.center.left.yscroll -sticky nsew grid .graphdialog.center.left.list1 - .graphdialog.center.left.yscroll -sticky nsew
grid .dialog.center.left.xscroll - -sticky nsew grid .graphdialog.center.left.xscroll - -sticky nsew
grid rowconfig .dialog.center.left 0 -weight 0 grid rowconfig .graphdialog.center.left 0 -weight 0
grid rowconfig .dialog.center.left 1 -weight 1 -minsize 100 grid rowconfig .graphdialog.center.left 1 -weight 1 -minsize 100
grid columnconfig .dialog.center.left 0 -weight 1 grid columnconfig .graphdialog.center.left 0 -weight 1
grid columnconfig .dialog.center.left 1 -weight 1 grid columnconfig .graphdialog.center.left 1 -weight 1
# center right frame # center right frame
label .dialog.center.right.lab1 -text {Signals in graph} label .graphdialog.center.right.lab1 -text {Signals in graph}
checkbutton .dialog.center.right.unlocked -text {Unlocked X axis} -variable graph_unlocked checkbutton .graphdialog.center.right.unlocked -text {Unlocked X axis} -variable graph_unlocked
text .dialog.center.right.text1 -wrap none -width 50 -height 10 -bg grey50 -fg white -insertbackground grey40 \ text .graphdialog.center.right.text1 -wrap none -width 50 -height 10 -bg grey70 -fg black \
-yscrollcommand {.dialog.center.right.yscroll set} \ -insertbackground grey40 -exportselection 0 \
-xscrollcommand {.dialog.center.right.xscroll set} -yscrollcommand {.graphdialog.center.right.yscroll set} \
scrollbar .dialog.center.right.yscroll -command {.dialog.center.right.text1 yview} -xscrollcommand {.graphdialog.center.right.xscroll set}
scrollbar .dialog.center.right.xscroll -orient horiz -command {.dialog.center.right.text1 xview} scrollbar .graphdialog.center.right.yscroll -command {.graphdialog.center.right.text1 yview}
scrollbar .graphdialog.center.right.xscroll -orient horiz -command {.graphdialog.center.right.text1 xview}
grid .dialog.center.right.lab1 .dialog.center.right.unlocked grid .graphdialog.center.right.lab1 .graphdialog.center.right.unlocked
grid .dialog.center.right.text1 - .dialog.center.right.yscroll -sticky nsew grid .graphdialog.center.right.text1 - .graphdialog.center.right.yscroll -sticky nsew
grid .dialog.center.right.xscroll - -sticky nsew grid .graphdialog.center.right.xscroll - -sticky nsew
grid rowconfig .dialog.center.right 0 -weight 0 grid rowconfig .graphdialog.center.right 0 -weight 0
grid rowconfig .dialog.center.right 1 -weight 1 -minsize 100 grid rowconfig .graphdialog.center.right 1 -weight 1 -minsize 100
grid columnconfig .dialog.center.right 0 -weight 1 grid columnconfig .graphdialog.center.right 0 -weight 1
grid columnconfig .dialog.center.right 1 -weight 1 grid columnconfig .graphdialog.center.right 1 -weight 1
# bottom frame # bottom frame
button .dialog.bottom.cancel -text Cancel -command { button .graphdialog.bottom.cancel -text Cancel -command {
destroy .dialog destroy .graphdialog
set graph_selected {}
set graph_schname {}
} }
button .dialog.bottom.ok -text OK -command { button .graphdialog.bottom.ok -text OK -command {
graph_update_nodelist if { [xschem get schname] eq $graph_schname } {
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"] graph_update_nodelist
xschem setprop rect 2 $graph_selected y1 [.dialog.top.min get] fast set node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
xschem setprop rect 2 $graph_selected y2 [.dialog.top.max get] fast xschem setprop rect 2 $graph_selected y1 [.graphdialog.top.min get] fast
xschem setprop rect 2 $graph_selected node $node fast xschem setprop rect 2 $graph_selected y2 [.graphdialog.top.max get] fast
if {$graph_unlocked} { xschem setprop rect 2 $graph_selected node $node fast
xschem setprop rect 2 $graph_selected flags {graph,unlocked} fast if {$graph_unlocked} {
xschem setprop rect 2 $graph_selected flags {graph,unlocked} fastundo
} else {
xschem setprop rect 2 $graph_selected flags {graph} fastundo
}
destroy .graphdialog
xschem draw_graph $graph_selected
set graph_selected {}
set graph_schname {}
} else { } else {
xschem setprop rect 2 $graph_selected flags {graph} fast destroy .graphdialog
set graph_selected {}
set graph_schname {}
} }
destroy .dialog
xschem draw_graph $graph_selected
} }
button .dialog.bottom.apply -text Apply -command { button .graphdialog.bottom.apply -text Apply -command {
graph_update_nodelist if { [xschem get schname] eq $graph_schname } {
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"] graph_update_nodelist
xschem setprop rect 2 $graph_selected y1 [.dialog.top.min get] fast set node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
xschem setprop rect 2 $graph_selected y2 [.dialog.top.max get] fast xschem setprop rect 2 $graph_selected y1 [.graphdialog.top.min get] fast
xschem setprop rect 2 $graph_selected node $node fast xschem setprop rect 2 $graph_selected y2 [.graphdialog.top.max get] fast
if {$graph_unlocked} { xschem setprop rect 2 $graph_selected node $node fast
xschem setprop rect 2 $graph_selected flags {graph,unlocked} fast if {$graph_unlocked} {
} else { xschem setprop rect 2 $graph_selected flags {graph,unlocked} fastundo
xschem setprop rect 2 $graph_selected flags {graph} fast } else {
xschem setprop rect 2 $graph_selected flags {graph} fastundo
}
xschem draw_graph $graph_selected
} }
xschem draw_graph $graph_selected
} }
pack .dialog.bottom.ok -side left # top packs
pack .dialog.bottom.apply -side left pack .graphdialog.bottom.ok -side left
pack .dialog.bottom.cancel -side left pack .graphdialog.bottom.apply -side left
pack .graphdialog.bottom.cancel -side left
for {set i 4} {$i < 22} {incr i} { for {set i 4} {$i < 22} {incr i} {
radiobutton .dialog.bottom.r$i -value $i -bg [lindex $colors $i] \ radiobutton .graphdialog.bottom.r$i -value $i -bg [lindex $colors $i] \
-variable graph_sel_color -command graph_change_wave_color -variable graph_sel_color -command graph_change_wave_color
pack .dialog.bottom.r$i -side left pack .graphdialog.bottom.r$i -side left
} }
# top frame # top2 frame
label .dialog.top.labsearch -text Search: label .graphdialog.top2.labunitx -text {X units}
entry .dialog.top.search -width 10 spinbox .graphdialog.top2.unitx -values {p n u m 1 k M G} -width 2 -textvar graph_unitx \
checkbutton .dialog.top.bus -text Bus -padx 2 -variable graph_bus -command {
checkbutton .dialog.top.incr -text {Incr. sort} -variable graph_sort -indicatoron 1 \ xschem setprop rect 2 $graph_selected unitx $graph_unitx
-command fill_graph_listbox xschem draw_graph $graph_selected
checkbutton .dialog.top.dig -text {Digital} -variable graph_digital -indicatoron 1 \ }
-command {
xschem setprop rect 2 $graph_selected digital $graph_digital fast
xschem draw_graph $graph_selected
}
label .dialog.top.labmin -text { Min Value:}
entry .dialog.top.min -width 5
label .dialog.top.labmax -text { Max Value:}
entry .dialog.top.max -width 5
button .dialog.top.clear -text Clear -padx 2 -command { label .graphdialog.top2.labunity -text { Y units}
.dialog.top.search delete 0 end spinbox .graphdialog.top2.unity -values {p n u m 1 k M G} -width 2 -textvar graph_unity \
-command {
xschem setprop rect 2 $graph_selected unity $graph_unity
xschem draw_graph $graph_selected
}
label .graphdialog.top2.labdivx -text { X div.}
entry .graphdialog.top2.divx -textvariable graph_divx -width 2
bind .graphdialog.top2.divx <KeyRelease> {
xschem setprop rect 2 $graph_selected divx $graph_divx
xschem draw_graph $graph_selected
}
label .graphdialog.top2.labdivy -text { Y div.}
entry .graphdialog.top2.divy -textvariable graph_divy -width 2
bind .graphdialog.top2.divy <KeyRelease> {
xschem setprop rect 2 $graph_selected divy $graph_divy
xschem draw_graph $graph_selected
}
label .graphdialog.top2.labsubdivx -text { X subdiv.}
entry .graphdialog.top2.subdivx -textvariable graph_subdivx -width 2
bind .graphdialog.top2.subdivx <KeyRelease> {
xschem setprop rect 2 $graph_selected subdivx $graph_subdivx
xschem draw_graph $graph_selected
}
label .graphdialog.top2.labsubdivy -text { Y subdiv.}
entry .graphdialog.top2.subdivy -textvariable graph_subdivy -width 2
bind .graphdialog.top2.subdivy <KeyRelease> {
xschem setprop rect 2 $graph_selected subdivy $graph_subdivy
xschem draw_graph $graph_selected
}
set graph_divx [xschem getprop rect 2 $graph_selected divx]
if {$graph_divx eq {}} { set graph_divx 5}
set graph_divy [xschem getprop rect 2 $graph_selected divy]
if {$graph_divy eq {}} { set graph_divy 5}
set graph_subdivx [xschem getprop rect 2 $graph_selected subdivx]
if {$graph_subdivx eq {}} { set graph_subdivx 1}
set graph_subdivy [xschem getprop rect 2 $graph_selected subdivy]
if {$graph_subdivy eq {}} { set graph_subdivy 1}
set graph_unitx [xschem getprop rect 2 $graph_selected unitx]
if {$graph_unitx eq {}} { set graph_unitx 1}
set graph_unity [xschem getprop rect 2 $graph_selected unity]
if {$graph_unity eq {}} { set graph_unity 1}
pack .graphdialog.top2.labunitx .graphdialog.top2.unitx \
.graphdialog.top2.labunity .graphdialog.top2.unity -side left
pack .graphdialog.top2.labdivx .graphdialog.top2.divx \
.graphdialog.top2.labdivy .graphdialog.top2.divy \
.graphdialog.top2.labsubdivx .graphdialog.top2.subdivx \
.graphdialog.top2.labsubdivy .graphdialog.top2.subdivy -side left
# top frame
label .graphdialog.top.labsearch -text Search:
entry .graphdialog.top.search -width 10
checkbutton .graphdialog.top.bus -text Bus -padx 2 -variable graph_bus
checkbutton .graphdialog.top.incr -text {Incr. sort} -variable graph_sort -indicatoron 1 \
-command fill_graph_listbox
checkbutton .graphdialog.top.dig -text {Digital} -variable graph_digital -indicatoron 1 \
-command {
if { [xschem get schname] eq $graph_schname } {
xschem setprop rect 2 $graph_selected digital $graph_digital fastundo
xschem draw_graph $graph_selected
}
}
label .graphdialog.top.labmin -text { Min Value:}
entry .graphdialog.top.min -width 5
bind .graphdialog.top.min <KeyRelease> {
xschem setprop rect 2 $graph_selected y1 [.graphdialog.top.min get]
xschem draw_graph $graph_selected
}
label .graphdialog.top.labmax -text { Max Value:}
entry .graphdialog.top.max -width 5
bind .graphdialog.top.max <KeyRelease> {
xschem setprop rect 2 $graph_selected y2 [.graphdialog.top.max get]
xschem draw_graph $graph_selected
}
button .graphdialog.top.clear -text Clear -padx 2 -command {
.graphdialog.top.search delete 0 end
fill_graph_listbox fill_graph_listbox
} }
pack .dialog.top.labsearch .dialog.top.search -side left pack .graphdialog.top.labsearch .graphdialog.top.search -side left
pack .dialog.top.clear -side left pack .graphdialog.top.clear -side left
pack .dialog.top.incr -side left pack .graphdialog.top.incr -side left
pack .dialog.top.bus -side left pack .graphdialog.top.bus -side left
pack .dialog.top.dig -side left pack .graphdialog.top.dig -side left
pack .dialog.top.labmin .dialog.top.min .dialog.top.labmax .dialog.top.max -side left pack .graphdialog.top.labmin .graphdialog.top.min .graphdialog.top.labmax .graphdialog.top.max -side left
.dialog.top.min insert 0 [xschem getprop rect 2 $graph_selected y1] .graphdialog.top.min insert 0 [xschem getprop rect 2 $graph_selected y1]
.dialog.top.max insert 0 [xschem getprop rect 2 $graph_selected y2] .graphdialog.top.max insert 0 [xschem getprop rect 2 $graph_selected y2]
# binding # binding
bind .dialog.top.search <KeyRelease> { bind .graphdialog.top.search <KeyRelease> {
fill_graph_listbox fill_graph_listbox
} }
bind .dialog.center.left.list1 <Double-Button-1> { bind .graphdialog.center.left.list1 <Double-Button-1> {
graph_add_nodes; graph_add_nodes
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"] if { [xschem get schname] eq $graph_schname } {
xschem setprop rect 2 $graph_selected node $node fast set node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
graph_update_nodelist graph_update_nodelist
xschem setprop rect 2 $graph_selected node $node fast
xschem draw_graph $graph_selected
}
} }
bind .dialog.center.right.text1 <KeyRelease> { bind .graphdialog.center.right.text1 <KeyRelease> {
set node [string trim [.dialog.center.right.text1 get 1.0 end] " \n"] if { [xschem get schname] eq $graph_schname } {
xschem setprop rect 2 $graph_selected node $node fast set node [string trim [.graphdialog.center.right.text1 get 1.0 {end - 1 chars}] " \n"]
graph_update_nodelist graph_update_nodelist
xschem setprop rect 2 $graph_selected node $node fast
xschem draw_graph $graph_selected
}
} }
bind .dialog <Control-Return> { bind .graphdialog <Control-Return> {
.dialog.bottom.ok invoke .graphdialog.bottom.ok invoke
} }
bind .dialog <Escape> { bind .graphdialog <Escape> {
.dialog.bottom.cancel invoke .graphdialog.bottom.cancel invoke
}
wm protocol .graphdialog WM_DELETE_WINDOW {
.graphdialog.bottom.cancel invoke
} }
# fill data in left listbox # fill data in left listbox
eval .dialog.center.left.list1 insert 0 [graph_get_signal_list [xschem raw_query list] {}] eval .graphdialog.center.left.list1 insert 0 [graph_get_signal_list [xschem raw_query list] {}]
# fill data in right textbox # fill data in right textbox
set plotted_nodes [xschem getprop rect 2 $n node] set plotted_nodes [xschem getprop rect 2 $n node]
if {[string index $plotted_nodes end] ne "\n"} {append plotted_nodes \n} if {[string length $plotted_nodes] > 0 && [string index $plotted_nodes end] ne "\n"} {append plotted_nodes \n}
.dialog.center.right.text1 insert 1.0 $plotted_nodes .graphdialog.center.right.text1 insert 1.0 $plotted_nodes
graph_update_nodelist nosave graph_update_nodelist
# add stuff in textbox at end of line + 1 char (after newline) # add stuff in textbox at end of line + 1 char (after newline)
# .dialog.center.right.text1 insert {insert lineend + 1 char} foo\n # .graphdialog.center.right.text1 insert {insert lineend + 1 char} foo\n
tkwait window .dialog # tkwait window .graphdialog
} }
proc graph_show_measure {{action show}} { proc graph_show_measure {{action show}} {
@ -4182,6 +4372,10 @@ proc raise_dialog {parent window_path } {
[wm stackorder .dialog isbelow $parent ]} { [wm stackorder .dialog isbelow $parent ]} {
raise .dialog $window_path raise .dialog $window_path
} }
if {[winfo exists .graphdialog] && [winfo ismapped .graphdialog] && [winfo ismapped $parent] &&
[wm stackorder .graphdialog isbelow $parent ]} {
raise .graphdialog $window_path
}
} }
proc set_old_tk_fonts {} { proc set_old_tk_fonts {} {
@ -4246,8 +4440,11 @@ set tctx::global_list {
dark_colorscheme dim_bg dim_value disable_unique_names do_all_inst draw_grid draw_window dark_colorscheme dim_bg dim_value disable_unique_names do_all_inst draw_grid draw_window
edit_prop_pos edit_prop_size editprop_sympath edit_symbol_prop_new_sel enable_dim_bg enable_stretch edit_prop_pos edit_prop_size editprop_sympath edit_symbol_prop_new_sel enable_dim_bg enable_stretch
en_hilight_conn_inst filetmp en_hilight_conn_inst filetmp
flat_netlist fullscreen gaw_fd gaw_tcp_address globfilter graph_bus graph_digital flat_netlist fullscreen gaw_fd gaw_tcp_address globfilter
graph_sel_color graph_selected graph_sel_wave graph_sort graph_unlocked graph_bus graph_digital graph_divx graph_divy
graph_sel_color graph_schname graph_selected graph_sel_wave graph_sort
graph_subdivx graph_subdivy
graph_unitx graph_unity graph_unlocked
hide_empty_graphs hide_symbols hsize hspice_netlist hide_empty_graphs hide_symbols hsize hspice_netlist
incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR incr_hilight infowindow_text INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR
input_line_cmd input_line_data launcher_default_program light_colors line_width local_netlist_dir input_line_cmd input_line_data launcher_default_program light_colors line_width local_netlist_dir
@ -5234,6 +5431,15 @@ set_ne to_png {gm convert}
## ps to pdf conversion ## ps to pdf conversion
set_ne to_pdf {ps2pdf} set_ne to_pdf {ps2pdf}
# selected graph user is editing attributes with graph GUI
set_ne graph_selected {}
set_ne graph_schname {}
set_ne graph_unitx 1
set_ne graph_unity 1
set_ne graph_divx 5
set_ne graph_divy 5
set_ne graph_subdivx 1
set_ne graph_subdivy 1
# user clicked this wave # user clicked this wave
set_ne graph_sel_wave {} set_ne graph_sel_wave {}
# flag to force simulation stop (Esc key pressed) # flag to force simulation stop (Esc key pressed)

View File

@ -18,8 +18,8 @@ B 2 1200 -330 1880 -140 {flags=graph
y1 = 0.0391523 y1 = 0.0391523
y2 = 0.0391626 y2 = 0.0391626
divy = 5 divy = 5
x1=0.0145887 x1=0.0143753
x2=0.0152398 x2=0.015137
divx=10 divx=10
node=i(v.x1.v3) node=i(v.x1.v3)
color=11 unitx=m unity=m} color=11 unitx=m unity=m}
@ -27,8 +27,8 @@ B 2 1200 -530 1880 -340 {flags=graph
y1 = 0 y1 = 0
y2 = 12 y2 = 12
divy = 6 divy = 6
x1=0.0145887 x1=0.0143753
x2=0.0152398 x2=0.015137
divx=10 divx=10
node="i(v.x1.vu) node="i(v.x1.vu)
i(v.x0.vu) i(v.x0.vu)
@ -40,8 +40,8 @@ B 2 1200 -860 1880 -550 {flags=graph
y1 = -60 y1 = -60
y2 = 60 y2 = 60
divy = 12 divy = 12
x1=0.0145887 x1=0.0143753
x2=0.0152398 x2=0.015137
divx=10 divx=10
node="outp node="outp
outm outm

View File

@ -27,13 +27,13 @@ L 8 1150 -160 1180 -160 {}
L 8 1180 -160 1180 -120 {} L 8 1180 -160 1180 -120 {}
L 8 1180 -120 1300 -120 {} L 8 1180 -120 1300 -120 {}
L 8 820 -120 950 -120 {} L 8 820 -120 950 -120 {}
B 2 1840 -540 2890 -400 {flags=graph_unlocked B 2 1840 -540 2890 -400 {flags=graph
y1 = -0.048929 y1 = -0.048929
y2 = 0.999755 y2 = 0.999755
divy = 3 divy = 3
subdivy=1 subdivy=1
x1=1.48222e-07 x1=1.09401e-07
x2=1.94606e-07 divx=10 x2=2.07622e-07 divx=10
node="ldbl[0] node="ldbl[0]
ldbl[16] ldbl[16]
ldbl[32] ldbl[32]
@ -45,32 +45,33 @@ ldbl[18]
ldbl[34]" ldbl[34]"
color="8 9 10 11 12 13 14 15 11" unitx=n color="8 9 10 11 12 13 14 15 11" unitx=n
} }
B 2 1840 -1160 2890 -1000 {flags=graph_unlocked B 2 1840 -1160 2890 -1000 {flags=graph
digital=0 digital=0
y1 = 0 y1 = 0
y2 = 1.6 y2 = 1.60
subdivy=1 subdivy=1
divy = 4 divy = 4
x1=1.48222e-07 x1=1.09401e-07
x2=1.94606e-07 x2=2.07622e-07
divx=10 divx=10
subdivx=4 subdivx=4
node="ldcp node="ldcp
ldyms[4] ldyms[4]
ldyms[5] ldyms[5]
ldyms[6] ldyms[6]
ldymsref" ldymsref
color="6 12 13 14 11" xsa[14].ldqii"
color="6 12 13 14 11 4"
unitx=n unitx=n
} }
B 2 1840 -400 2890 -240 {flags=graph_unlocked B 2 1840 -400 2890 -240 {flags=graph
y1 = -0.0072 y1 = -0.0072
y2 = 1.6 y2 = 1.60
divy = 3 divy = 3
subdivy=0 subdivy=0
subdivx = 1 subdivx = 1
x1=1.48222e-07 x1=1.09401e-07
x2=1.94606e-07 divx=10 x2=2.07622e-07 divx=10
node="ldwl[0] node="ldwl[0]
ldwl[1] ldwl[1]
ldwl[2] ldwl[2]
@ -85,15 +86,15 @@ ldwl[9]"
color="4 5 4 5 4 5 4 5 4 5 4" color="4 5 4 5 4 5 4 5 4 5 4"
unitx=n unitx=n
} }
B 2 1840 -1000 2890 -540 {flags=graph,unlocked B 2 1840 -1000 2890 -540 {flags=graph
digital=1 digital=1
y1 = 0 y1 = 0
y2 = 1.6 y2 = 1.6
ypos1=0.0694741 ypos1=0.293142
ypos2=2.61557 ypos2=2.77211
divy = 1 divy = 1
x1=1.48222e-07 x1=1.09401e-07
x2=1.94606e-07 x2=2.07622e-07
divx=12 divx=12
subdivx=4 subdivx=4
node="---In/Out--- node="---In/Out---
@ -117,31 +118,33 @@ color="18 4 15 4 15 4 15 4 18 15 4 18 4 15 4 15 11"
unitx=n unitx=n
ypos1=-2.20115 ypos2=2.79884 ypos1=-2.20115 ypos2=2.79884
} }
B 2 1840 -1300 2890 -1160 {flags=graph_unlocked B 2 1840 -1300 2890 -1160 {flags=graph
y1 = 0 y1 = 0
y2 = 1.6 y2 = 1.60
divy = 4 divy = 4
x1=1.48222e-07 x1=1.09401e-07
x2=1.94606e-07 x2=2.07622e-07
divx=8 divx=8
unitx=n unitx=n
node="xsa[0].ldqib node="xsa[0].ldqib
xsa[5].ldqib xsa[5].ldqib
xsa[0].ldsali xsa[0].ldsali
xctrl.ldq_b" xctrl.ldq_b"
color="4 12 5 10" color="4 12 7 10"
} }
B 2 1840 -240 2890 0 {flags=graph_unlocked B 2 1840 -240 2890 0 {flags=graph
y1 = -0.0559946 y1 = -0.0559946
y2 = 0.0205097 y2 = 0.0205097
divy = 5 divy = 5
x1=1.48222e-07 x1=1.09401e-07
x2=1.94606e-07 x2=2.07622e-07
unity=m unity=m
divx=10 divx=10
subdivx=1 subdivx=1
node=i(vvcc) node=i(vvcc)
color=3 unitx=n subdivy=4 color=3
unitx=n
subdivy=4
} }
B 7 950 -250 980 -80 {} B 7 950 -250 980 -80 {}
B 7 1150 -250 1180 -80 {} B 7 1150 -250 1180 -80 {}