merge Chayan Deb changes for manhattan-style move objects and handle_key_press() refactor
This commit is contained in:
parent
588ee1b8f4
commit
08397f7038
|
|
@ -3183,61 +3183,11 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->ui_state &= ~STARTWIRE;
|
||||
}
|
||||
if( (what & RUBBER) ) {
|
||||
if(xctx->manhattan_lines & 1) {
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1=xctx->nl_x1;xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->nl_x2;xctx->nl_yy2=xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
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)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(xctx->gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gc[WIRELAYER], NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
} else if(xctx->manhattan_lines & 2) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
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)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(xctx->gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
} else {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gctiled, NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
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)) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
drawtemp_manhattanline(xctx->gctiled, NOW, xctx->nl_x1, xctx->nl_y1, xctx->nl_x2, xctx->nl_y2);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3067
src/callback.c
3067
src/callback.c
File diff suppressed because it is too large
Load Diff
39
src/draw.c
39
src/draw.c
|
|
@ -1375,6 +1375,45 @@ 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)
|
||||
{
|
||||
double origin_shifted_x2, origin_shifted_y2;
|
||||
if(tclgetboolvar("orthogonal_wiring")) {
|
||||
/* Origin shift the cartesian coordinate p2(x2,y2) w.r.t. p1(x1,y1) */
|
||||
origin_shifted_x2 = x2 - x1;
|
||||
origin_shifted_y2 = y2 - y1;
|
||||
/* Draw whichever component of the resulting orthogonal-wire is bigger (either horizontal or vertical), first */
|
||||
if(origin_shifted_x2*origin_shifted_x2 > origin_shifted_y2*origin_shifted_y2)
|
||||
xctx->manhattan_lines = 1;
|
||||
else
|
||||
xctx->manhattan_lines = 2;
|
||||
}
|
||||
if(xctx->manhattan_lines & 1) {
|
||||
xctx->nl_xx1 = x1; xctx->nl_yy1 = y1;
|
||||
xctx->nl_xx2 = x2; xctx->nl_yy2 = y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
drawtempline(gc, what, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy1);
|
||||
xctx->nl_xx1 = x1; xctx->nl_yy1 = y1;
|
||||
xctx->nl_xx2 = x2; xctx->nl_yy2 = y2;
|
||||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc, what, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
} else if(xctx->manhattan_lines & 2) {
|
||||
xctx->nl_xx1 = x1; xctx->nl_yy1 = y1;
|
||||
xctx->nl_xx2 = x2; xctx->nl_yy2 = y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
drawtempline(gc, what, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx1,xctx->nl_yy2);
|
||||
xctx->nl_xx1 = x1; xctx->nl_yy1 = y1;
|
||||
xctx->nl_xx2 = x2; xctx->nl_yy2 = y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc, what, xctx->nl_xx1,xctx->nl_yy2,xctx->nl_xx2,xctx->nl_yy2);
|
||||
} else {
|
||||
xctx->nl_xx1 = x1; xctx->nl_yy1 = y1;
|
||||
xctx->nl_xx2 = x2; xctx->nl_yy2 = y2;
|
||||
ORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(gc, what, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
}
|
||||
|
||||
void drawtemparc(GC gc, int what, double x, double y, double r, double a, double b)
|
||||
{
|
||||
static int i=0;
|
||||
|
|
|
|||
48
src/move.c
48
src/move.c
|
|
@ -378,25 +378,25 @@ void draw_selection(GC g, int interruptable)
|
|||
if(xctx->wire[n].sel==SELECTED)
|
||||
{
|
||||
if(xctx->wire[n].bus)
|
||||
drawtempline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
|
||||
drawtemp_manhattanline(g, THICK, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
|
||||
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
||||
else
|
||||
drawtempline(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
|
||||
drawtemp_manhattanline(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
|
||||
xctx->rx2+xctx->deltax, xctx->ry2+xctx->deltay);
|
||||
}
|
||||
else if(xctx->wire[n].sel==SELECTED1)
|
||||
{
|
||||
if(xctx->wire[n].bus)
|
||||
drawtempline(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);
|
||||
else
|
||||
drawtempline(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);
|
||||
}
|
||||
else if(xctx->wire[n].sel==SELECTED2)
|
||||
{
|
||||
if(xctx->wire[n].bus)
|
||||
drawtempline(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);
|
||||
else
|
||||
drawtempline(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);
|
||||
}
|
||||
break;
|
||||
case LINE:
|
||||
|
|
@ -1135,10 +1135,38 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
if(wire[n].sel == SELECTED1) wire[n].sel = SELECTED2;
|
||||
else if(wire[n].sel == SELECTED2) wire[n].sel = SELECTED1;
|
||||
}
|
||||
wire[n].x1=xctx->rx1;
|
||||
wire[n].y1=xctx->ry1;
|
||||
wire[n].x2=xctx->rx2;
|
||||
wire[n].y2=xctx->ry2;
|
||||
|
||||
#if 0
|
||||
if(wire[n].sel & (SELECTED|SELECTED1))
|
||||
{
|
||||
if(xctx->manhattan_lines & 1) xctx->manhattan_lines=2;
|
||||
else if(xctx->manhattan_lines & 2) xctx->manhattan_lines=1;
|
||||
}
|
||||
#endif
|
||||
wire[n].x1 = xctx->rx1;
|
||||
wire[n].y1 = xctx->ry1;
|
||||
if(xctx->manhattan_lines&1)
|
||||
{
|
||||
wire[n].x2 = xctx->rx2;
|
||||
wire[n].y2 = xctx->ry1;
|
||||
storeobject(-1, xctx->rx2,xctx->ry1,xctx->rx2,xctx->ry2,WIRE,0,0,NULL);
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,ADD, xctx->rx2,xctx->ry1,xctx->rx2,xctx->ry2, 0, NULL);
|
||||
}
|
||||
else if(xctx->manhattan_lines&2)
|
||||
{
|
||||
wire[n].x2 = xctx->rx1;
|
||||
wire[n].y2 = xctx->ry2;
|
||||
storeobject(-1, xctx->rx1,xctx->ry2,xctx->rx2,xctx->ry2,WIRE,0,0,NULL);
|
||||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,ADD, xctx->rx1,xctx->ry2,xctx->rx2,xctx->ry2, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
wire[n].x2 = xctx->rx2;
|
||||
wire[n].y2 = xctx->ry2;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1428,6 +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);
|
||||
|
||||
/* instead of doing a drawtemprect(xctx->gctiled, NOW, ....) do 4
|
||||
* XCopy Area operations. Used if fix_broken_tiled_fill is set */
|
||||
|
|
|
|||
|
|
@ -8587,9 +8587,9 @@ proc build_widgets { {topwin {} } } {
|
|||
global dark_gui_colorscheme draw_crosshair grid_point_size
|
||||
global recentfile color_ps transparent_svg menu_debug_var enable_stretch
|
||||
global netlist_show flat_netlist split_files compare_sch intuitive_interface
|
||||
global draw_grid big_grid_points sym_txt change_lw incr_hilight symbol_width
|
||||
global cadsnap cadgrid draw_window toolbar_visible hide_symbols undo_type
|
||||
global disable_unique_names persistent_command autotrim_wires en_hilight_conn_inst
|
||||
global draw_grid big_grid_points sym_txt change_lw incr_hilight symbol_width cadence_compat
|
||||
global cadsnap cadgrid draw_window toolbar_visible hide_symbols undo_type snap_cursor
|
||||
global disable_unique_names persistent_command autotrim_wires infix_interface orthogonal_wiring en_hilight_conn_inst
|
||||
global local_netlist_dir editor netlist_type netlist_dir spiceprefix initial_geometry
|
||||
if { $dark_gui_colorscheme} {
|
||||
set selectcolor white
|
||||
|
|
@ -8716,6 +8716,10 @@ proc build_widgets { {topwin {} } } {
|
|||
-onvalue disk -offvalue memory -command {switch_undo}
|
||||
$topwin.menubar.option add checkbutton -label "Enable stretch" -variable enable_stretch \
|
||||
-selectcolor $selectcolor -accelerator Y
|
||||
$topwin.menubar.option add checkbutton -label "Enable infix-interface" -variable infix_interface \
|
||||
-selectcolor $selectcolor
|
||||
$topwin.menubar.option add checkbutton -label "Enable orthogonal wiring" -variable orthogonal_wiring \
|
||||
-selectcolor $selectcolor -accelerator Shift-L
|
||||
$topwin.menubar.option add checkbutton -label "Unsel. partial sel. wires after stretch move" \
|
||||
-selectcolor $selectcolor -variable unselect_partial_sel_wires
|
||||
|
||||
|
|
@ -8737,7 +8741,7 @@ proc build_widgets { {topwin {} } } {
|
|||
-menu $topwin.menubar.option.crosshair
|
||||
menu $topwin.menubar.option.crosshair -tearoff 0
|
||||
|
||||
$topwin.menubar.option.crosshair add checkbutton -label "Draw snap cursor" \
|
||||
$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 crosshair" \
|
||||
-variable draw_crosshair -selectcolor $selectcolor -accelerator {Alt-X}
|
||||
|
|
@ -9661,6 +9665,7 @@ set_ne ps_page_title 1 ;# add a title in the top left page corner
|
|||
set_ne draw_crosshair 0
|
||||
set_ne crosshair_layer 8 ;# Yellow
|
||||
set_ne crosshair_size 0
|
||||
set_ne snap_cursor_size 6
|
||||
set_ne ps_paper_size {a4 842 595}
|
||||
set_ne transparent_svg 0
|
||||
set_ne only_probes 0 ; # 20110112
|
||||
|
|
@ -9692,13 +9697,12 @@ set_ne grid_point_size -1 ;# grid point size (>=0) or unspecified (-1)
|
|||
set_ne draw_grid_axes 1
|
||||
set_ne persistent_command 0
|
||||
set_ne intuitive_interface 1
|
||||
set_ne infix_interface 1
|
||||
set_ne orthogonal_wiring 0
|
||||
set_ne snap_cursor 0
|
||||
set_ne snap_cursor_size 6
|
||||
set_ne cadence_compat 0
|
||||
set_ne use_cursor_for_selection 0
|
||||
set_ne autotrim_wires 0
|
||||
set_ne cadence_compat 0
|
||||
set_ne infix_interface 1
|
||||
set_ne snap_cursor 0
|
||||
set_ne orthogonal_wiring 0
|
||||
set_ne compare_sch 0
|
||||
set_ne disable_unique_names 0
|
||||
set_ne sym_txt 1
|
||||
|
|
|
|||
|
|
@ -226,6 +226,12 @@
|
|||
#### if not set show selected items at end of drag. Default: enabled (1)
|
||||
# set incremental_select 0
|
||||
|
||||
#### wires are drawn in free-form mode with this mode disabled (default).
|
||||
#### if set to 1, wires drawn on the schematic will strictly follow
|
||||
#### orthogonal routes to connect two distinct points together.
|
||||
#### default: 0
|
||||
# set orthogonal_wiring 1
|
||||
|
||||
#### if set to 1 automatically join/trim wires while editing
|
||||
#### this may slow down on rally big designs. Can be disabled via menu
|
||||
#### default: 0
|
||||
|
|
@ -271,7 +277,7 @@
|
|||
# set crosshair_layer 8
|
||||
|
||||
#### set crosshair size; Default: 0 (full screen spanning crosshair)
|
||||
# set crosshair_size 5
|
||||
# set crosshair_size 2
|
||||
|
||||
#### enable drawing a diamond-shaped cursor at the closest circuit endpoint. Default: disabled (0)
|
||||
# set snap_cursor 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue