applied recent additions from SuperCgayan

This commit is contained in:
stefan schippers 2025-03-16 11:35:30 +01:00
parent b415b8e889
commit 33591fa41d
6 changed files with 37 additions and 16 deletions

View File

@ -3183,11 +3183,11 @@ void new_wire(int what, double mx_snap, double my_snap)
xctx->ui_state &= ~STARTWIRE;
}
if( (what & RUBBER) ) {
drawtemp_manhattanline(xctx->gctiled, NOW, xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
drawtemp_manhattanline(xctx->gctiled, NOW, xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2, 0);
restore_selection(xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
if(!(what & CLEAR)) {
drawtemp_manhattanline(xctx->gc[WIRELAYER], NOW, xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
drawtemp_manhattanline(xctx->gc[WIRELAYER], NOW, xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2, 0);
}
}
}

View File

@ -4546,9 +4546,23 @@ int infix_interface = tclgetboolvar("infix_interface");
int rstate; /* (reduced state, without ShiftMask) */
int snap_cursor = tclgetboolvar("snap_cursor");
int cadence_compat = tclgetboolvar("cadence_compat");
int persistent_command = tclgetboolvar("persistent_command");
int wire_draw_active = (xctx->ui_state & STARTWIRE) ||
((xctx->ui_state2 & MENUSTARTWIRE) && (xctx->ui_state & MENUSTART)) ||
(tclgetboolvar("persistent_command") && (xctx->last_command & STARTWIRE));
(persistent_command && (xctx->last_command & STARTWIRE));
int line_draw_active = (xctx->ui_state & STARTLINE) ||
((xctx->ui_state2 & MENUSTARTLINE) && (xctx->ui_state & MENUSTART)) ||
(persistent_command && (xctx->last_command & STARTLINE));
int poly_draw_active = (xctx->ui_state & STARTPOLYGON) ||
((xctx->ui_state2 & MENUSTARTPOLYGON) && (xctx->ui_state & MENUSTART)) ||
(persistent_command && (xctx->last_command & STARTPOLYGON));
int arc_draw_active = (xctx->ui_state & STARTARC) ||
((xctx->ui_state2 & MENUSTARTARC) && (xctx->ui_state & MENUSTART)) ||
(persistent_command && (xctx->last_command & STARTARC));
int rect_draw_active = (xctx->ui_state & STARTRECT) ||
((xctx->ui_state2 & MENUSTARTRECT) && (xctx->ui_state & MENUSTART)) ||
(persistent_command && (xctx->last_command & STARTRECT));
/* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease
* events. Some remote connection softwares do not generate the correct coordinates
@ -4584,6 +4598,14 @@ int wire_draw_active = (xctx->ui_state & STARTWIRE) ||
if(wire_draw_active) {
tclvareval(xctx->top_path, ".statusbar.10 configure -state active -text {DRAW WIRE! }", NULL);
} else if(line_draw_active) {
tclvareval(xctx->top_path, ".statusbar.10 configure -state active -text {DRAW LINE! }", NULL);
} else if(poly_draw_active) {
tclvareval(xctx->top_path, ".statusbar.10 configure -state active -text {DRAW POLYGON! }", NULL);
} else if(arc_draw_active) {
tclvareval(xctx->top_path, ".statusbar.10 configure -state active -text {DRAW ARC! }", NULL);
} else if(rect_draw_active) {
tclvareval(xctx->top_path, ".statusbar.10 configure -state active -text {DRAW RECTANGLE! }", NULL);
} else {
tclvareval(xctx->top_path, ".statusbar.10 configure -state normal -text { }", NULL);
}

View File

@ -1375,11 +1375,11 @@ void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,dou
}
}
void drawtemp_manhattanline(GC gc, int what, double x1, double y1, double x2, double y2)
void drawtemp_manhattanline(GC gc, int what, double x1, double y1, double x2, double y2, int force_manhattan)
{
double nl_xx1, nl_yy1, nl_xx2, nl_yy2;
double origin_shifted_x2, origin_shifted_y2;
if(tclgetboolvar("orthogonal_wiring")) {
if(tclgetboolvar("orthogonal_wiring") && force_manhattan) {
/* Origin shift the cartesian coordinate p2(x2,y2) w.r.t. p1(x1,y1) */
origin_shifted_x2 = x2 - x1;
origin_shifted_y2 = y2 - y1;

View File

@ -379,24 +379,24 @@ void draw_selection(GC g, int interruptable)
{
if(xctx->wire[n].bus)
drawtemp_manhattanline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay, 1);
else
drawtemp_manhattanline(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay, 1);
}
else if(xctx->wire[n].sel==SELECTED1)
{
if(xctx->wire[n].bus)
drawtemp_manhattanline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2);
drawtemp_manhattanline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2, 1);
else
drawtemp_manhattanline(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2);
drawtemp_manhattanline(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay, xctx->rx2, xctx->ry2, 1);
}
else if(xctx->wire[n].sel==SELECTED2)
{
if(xctx->wire[n].bus)
drawtemp_manhattanline(g, THICK, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
drawtemp_manhattanline(g, THICK, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay, 1);
else
drawtemp_manhattanline(g, ADD, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
drawtemp_manhattanline(g, ADD, xctx->rx1, xctx->ry1, xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay, 1);
}
break;
case LINE:

View File

@ -1428,7 +1428,7 @@ extern void filledrect(int c, int what, double rectx1,double recty1,
extern void drawtempline(GC gc, int what, double x1,double y1,double x2,double y2);
extern void drawtemp_manhattanline(GC gc, int what, double x1,double y1,double x2,double y2);
extern void drawtemp_manhattanline(GC gc, int what, double x1,double y1,double x2,double y2, int force_manhattan);
/* instead of doing a drawtemprect(xctx->gctiled, NOW, ....) do 4
* XCopy Area operations. Used if fix_broken_tiled_fill is set */

View File

@ -8774,13 +8774,12 @@ proc build_widgets { {topwin {} } } {
-variable intuitive_interface -selectcolor $selectcolor \
-command {xschem set intuitive_interface $intuitive_interface}
$topwin.menubar.option add cascade -label "Crosshair" \
-menu $topwin.menubar.option.crosshair
menu $topwin.menubar.option.crosshair -tearoff 0
$topwin.menubar.option.crosshair add checkbutton -label "Draw snap cursor" -accelerator {Alt-Z} \
-variable snap_cursor -selectcolor $selectcolor
$topwin.menubar.option.crosshair add checkbutton -label "Draw snap cursor" \
-variable snap_cursor -selectcolor $selectcolor -accelerator {Alt-Z}
$topwin.menubar.option.crosshair add checkbutton -label "Draw crosshair" \
-variable draw_crosshair -selectcolor $selectcolor -accelerator {Alt-X}
$topwin.menubar.option.crosshair add command -label "Crosshair size" \
@ -9069,7 +9068,7 @@ proc build_widgets { {topwin {} } } {
$topwin.menubar.tools add command -label "Insert snap wire" -command "xschem snap_wire" -accelerator Shift+W
$topwin.menubar.tools add command -label "Insert line" -command "xschem line" -accelerator L
$topwin.menubar.tools add command -label "Insert rect" -command "xschem rect" -accelerator R
$topwin.menubar.tools add command -label "Insert polygon" -command "xschem polygon" -accelerator Ctrl+P
$topwin.menubar.tools add command -label "Insert polygon" -command "xschem polygon" -accelerator P
$topwin.menubar.tools add command -label "Insert arc" -command "xschem arc" -accelerator Shift+C
$topwin.menubar.tools add command -label "Insert circle" -command "xschem circle" -accelerator Ctrl+Shift+C
$topwin.menubar.tools add command -label "Insert JPG/PNG/SVG image" -command "xschem add_image"