show red dot when cuting a wire with new alt-right button click on a wire. Added also menu command in Tools

This commit is contained in:
stefan schippers 2023-06-14 10:08:50 +02:00
parent 330c447f86
commit c3d03cd6d2
6 changed files with 35 additions and 3 deletions

View File

@ -493,6 +493,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> abort_operation</kbd></li><pre>
Resets UI state, unselect all and abort any pending operation </pre>
<li><kbd> add_symbol_pin</kbd></li><pre>
@ -1195,6 +1197,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> wire [x1 y1 x2 y2] [pos] [prop] [sel]</kbd></li><pre>
Place a new wire
if no coordinates are given start a GUI wire placement </pre>
<li><kbd> wire_cut</kbd></li><pre>
start a wire cut operation. Point the mouse in the middle of a wire and
click left button. </pre>
<li><kbd> xcb_info</kbd></li><pre>
For debug </pre>
<li><kbd> zoom_box [x1 y1 x2 y2] [factor]</kbd></li><pre>
@ -1227,6 +1232,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>
<!-- TCL global variables -->

View File

@ -2638,6 +2638,11 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(xctx->last_command == STARTWIRE) start_wire(mx, my);
break;
}
if(xctx->ui_state & MENUSTARTWIRECUT) {
break_wires_at_point(xctx->mousex_snap, xctx->mousey_snap);
xctx->ui_state &=~MENUSTARTWIRECUT;
break;
}
if(xctx->ui_state & MENUSTARTMOVE) {
xctx->mx_double_save=xctx->mousex_snap;
xctx->my_double_save=xctx->mousey_snap;

View File

@ -421,7 +421,7 @@ void break_wires_at_point(double x0, double y0)
xctx->wire[xctx->wires].end2 = 1;
xctx->wire[xctx->wires].x2=x0;
xctx->wire[xctx->wires].y2=y0;
xctx->wire[xctx->wires].sel=SELECTED;
xctx->wire[xctx->wires].sel=0;
xctx->wire[xctx->wires].prop_ptr=NULL;
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr);
if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
@ -438,15 +438,23 @@ void break_wires_at_point(double x0, double y0)
xctx->wires++;
xctx->wire[i].x1 = x0;
xctx->wire[i].y1 = y0;
xctx->wire[i].sel = SELECTED;
xctx->wire[i].sel = 0;
xctx->wire[i].end1 = 1;
} /* if( (x0!=xctx->wire[i].x1 && x0!=xctx->wire[i].x2) || ... ) */
} /* if( touch(xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, x0,y0) ) */
} /* for(wptr=xctx->wire_spatial_table[sqx][sqy]; wptr; wptr=wptr->next) */
if(changed) {
int w = xctx->draw_window;
int p = xctx->draw_pixmap;
xctx->need_reb_sel_arr = 1;
rebuild_selected_array();
draw();
xctx->draw_window = 1;
xctx->draw_pixmap = 0;
filledarc(PINLAYER, NOW, x0, y0, cadhalfdotsize, 0, 360);
xctx->draw_window = w;
xctx->draw_pixmap = p;
}
}

View File

@ -4045,6 +4045,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
else xctx->ui_state |= MENUSTARTWIRE;
}
/* wire_cut
* start a wire cut operation. Point the mouse in the middle of a wire and
* click left button. */
else if(!strcmp(argv[1], "wire_cut"))
{
xctx->ui_state |= MENUSTARTWIRECUT;
Tcl_ResetResult(interp);
}
else { cmd_found = 0;}
break;
case 'x': /*----------------------------------------------*/

View File

@ -227,8 +227,9 @@ extern char win_temp_dir[PATH_MAX];
#define MENUSTARTCIRCLE 2097152U
#define PLACE_SYMBOL 4194304U /* used in move_objects after place_symbol to avoid storing intermediate undo state */
#define START_SYMPIN 8388608U
#define GRAPHPAN 16777216U
#define GRAPHPAN 16777216U /* bit 24 */
#define MENUSTARTMOVE 33554432U
#define MENUSTARTWIRECUT 67108864U /* bit 26 */
#define SELECTED 1U /* used in the .sel field for selected objs. */
#define SELECTED1 2U /* first point selected... */
#define SELECTED2 4U /* second point selected... */

View File

@ -6105,6 +6105,8 @@ proc build_widgets { {topwin {} } } {
-command "xschem break_wires" -accelerator {!}
$topwin.menubar.tools.menu add command -label "Remove wires running through selected inst. pins" \
-command "xschem break_wires 1" -accelerator {Ctrl-!}
$topwin.menubar.tools.menu add command -label "Break wires at mouse position" \
-command "xschem wire_cut" -accelerator {Alt-Right Butt.}
toolbar_add ToolBreak "xschem break_wires" "Break wires at selected\ninstance pin intersections" $topwin
$topwin.menubar.tools.menu add checkbutton -label "Auto Join/Trim Wires" -variable autotrim_wires \
-command {