diff --git a/src/actions.c b/src/actions.c index 3e4c95ae..f726c945 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1965,9 +1965,17 @@ void get_additional_symbols(int what) my_strdup(_ALLOC_ID_, &spice_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"spice_sym_def",6)); my_strdup(_ALLOC_ID_, &verilog_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"verilog_sym_def",4)); my_strdup(_ALLOC_ID_, &vhdl_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"vhdl_sym_def",4)); + + dbg(1, "schematic=%s\n", get_tok_value(xctx->inst[i].prop_ptr,"schematic",2)); + /* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */ + my_strdup2(_ALLOC_ID_, &sch, + translate3(get_tok_value(xctx->inst[i].prop_ptr,"schematic",2), 1, + xctx->inst[i].prop_ptr, NULL, NULL)); + dbg(1, "sch=%s\n", sch); + my_strdup2(_ALLOC_ID_, &sch, tcl_hook2( - str_replace( get_tok_value(xctx->inst[i].prop_ptr,"schematic",2), "@symname", - get_cell(xctx->inst[i].name, 0), '\\', -1))); + str_replace(sch, "@symname", get_cell(xctx->inst[i].name, 0), '\\', -1))); + dbg(1, "get_additional_symbols(): inst=%d sch=%s\n",i, sch); /* schematic does not exist */ if(sch[0] && stat(abs_sym_path(sch, ""), &buf)) { @@ -1982,6 +1990,7 @@ void get_additional_symbols(int what) char *symname_attr = NULL; int ignore_schematic = 0; xSymbol *symptr = xctx->inst[i].ptr + xctx->sym; + my_strdup2(_ALLOC_ID_, &default_schematic, get_tok_value(symptr->prop_ptr,"default_schematic",0)); ignore_schematic = !strcmp(default_schematic, "ignore"); @@ -2081,7 +2090,12 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) } dbg(1, "get_sch_from_sym(): current_dirname= %s\n", xctx->current_dirname); dbg(1, "get_sch_from_sym(): symbol %s inst=%d web_url=%d\n", sym->name, inst, web_url); - if(inst >= 0) my_strdup(_ALLOC_ID_, &str_tmp, get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 2)); + if(inst >= 0) { + /* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */ + my_strdup2(_ALLOC_ID_, &str_tmp, + translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic",2), 1, + xctx->inst[inst].prop_ptr, NULL, NULL)); + } if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 2)); if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */ /* @symname in schematic attribute will be replaced with symbol name */ diff --git a/src/callback.c b/src/callback.c index 1e6b835f..757b1963 100644 --- a/src/callback.c +++ b/src/callback.c @@ -481,41 +481,12 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int need_redraw_master = 1; } - /* move cursor1 */ - /* set cursor position from master graph x-axis */ - else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 16 )) { - double c; - c = G_X(xctx->mousex); - if(gr->logx) c = pow(10, c); - if(r->flags & 4) { /* private_cursor */ - my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); - } else { - xctx->graph_cursor1_x = c; - } - need_all_redraw = 1; - } - /* move cursor2 */ - /* set cursor position from master graph x-axis */ - else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 32 )) { - double c; - int floaters = there_are_floaters(); - c = G_X(xctx->mousex); - if(gr->logx) c = pow(10, c); - if(r->flags & 4) { /* private_cursor */ - my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); - } else { - xctx->graph_cursor2_x = c; - } - if(tclgetboolvar("live_cursor2_backannotate")) { - backannotate_at_cursor_b_pos(r, gr); - if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */ - need_fullredraw = 1; - } else { - need_all_redraw = 1; - } - } + + + + if(xctx->ui_state & GRAPHPAN) goto finish; /* After GRAPHPAN only need to check Motion events for cursors */ if(xctx->mousey_snap < W_Y(gr->gy2)) { xctx->graph_top = 1; @@ -930,6 +901,54 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int } } } + + + + /* move cursor1 */ + /* set cursor position from master graph x-axis */ + else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 16 )) { + double c; + + /* selected or locked or master */ + if( r->sel || !(r->flags & 2) || i == xctx->graph_master) { + c = G_X(xctx->mousex); + if(gr->logx) c = pow(10, c); + if(r->flags & 4) { /* private_cursor */ + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); + } else { + xctx->graph_cursor1_x = c; + } + need_all_redraw = 1; + } + } + /* move cursor2 */ + /* set cursor position from master graph x-axis */ + else if(event == MotionNotify && (state & Button1Mask) && (xctx->graph_flags & 32 )) { + double c; + int floaters = there_are_floaters(); + + /* selected or locked or master */ + if( r->sel || !(r->flags & 2) || i == xctx->graph_master) { + c = G_X(xctx->mousex); + if(gr->logx) c = pow(10, c); + if(r->flags & 4) { /* private_cursor */ + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); + } else { + xctx->graph_cursor2_x = c; + } + if(tclgetboolvar("live_cursor2_backannotate")) { + backannotate_at_cursor_b_pos(r, gr); + if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */ + need_fullredraw = 1; + } else { + need_all_redraw = 1; + } + } + } + + + + else if(event == ButtonPress && button == Button5 && !(state & ShiftMask)) { double delta; /* vertical move of waveforms with mouse wheel */