[Manual Upstream Merge]: Manually reintroduced the changes from commit a361505 without breaking functionalities. This fork is now effectively up-to-date with upstream.
This commit is contained in:
parent
b276fcffcb
commit
7e9132ff3b
|
|
@ -3019,7 +3019,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
if( (what & PLACE) ) {
|
||||
if( (xctx->ui_state & STARTWIRE) && (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) ) {
|
||||
xctx->push_undo();
|
||||
if(xctx->manhattan_lines==1) {
|
||||
if(xctx->manhattan_lines & 1) {
|
||||
if(xctx->nl_xx2!=xctx->nl_xx1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
|
|
@ -3038,7 +3038,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
hash_wire(XINSERT, xctx->wires-1, 1);
|
||||
drawline(WIRELAYER,NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
} else if(xctx->manhattan_lines==2) {
|
||||
} else if(xctx->manhattan_lines & 2) {
|
||||
if(xctx->nl_yy2!=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;
|
||||
|
|
@ -3076,6 +3076,8 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
draw();
|
||||
/* draw_hilight_net(1);*/ /* for updating connection bubbles on hilight nets */
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(! (what &END)) {
|
||||
xctx->nl_x1=mx_snap;
|
||||
xctx->nl_y1=my_snap;
|
||||
|
|
@ -3085,7 +3087,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->nl_yy1=xctx->nl_y1;
|
||||
xctx->nl_xx2=xctx->mousex_snap;
|
||||
xctx->nl_yy2=xctx->mousey_snap;
|
||||
if(xctx->manhattan_lines==1) {
|
||||
if(xctx->manhattan_lines & 1) {
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
|
|
@ -3095,7 +3097,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
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) {
|
||||
} else if(xctx->manhattan_lines & 2) {
|
||||
xctx->nl_x2 = mx_snap; xctx->nl_y2 = my_snap;
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
|
|
@ -3113,6 +3115,8 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
drawtempline(xctx->gc[WIRELAYER], NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
xctx->nl_x1 = xctx->nl_x2=mx_snap; xctx->nl_y1 = xctx->nl_y2=my_snap;
|
||||
xctx->ui_state |= STARTWIRE;
|
||||
if(modified) set_modify(1);
|
||||
}
|
||||
|
|
@ -3120,7 +3124,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
xctx->ui_state &= ~STARTWIRE;
|
||||
}
|
||||
if( (what & RUBBER) ) {
|
||||
if(xctx->manhattan_lines==1) {
|
||||
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);
|
||||
|
|
@ -3141,7 +3145,7 @@ void new_wire(int what, double mx_snap, double my_snap)
|
|||
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) {
|
||||
} 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);
|
||||
|
|
@ -3311,7 +3315,7 @@ void new_line(int what, double mousex_snap, double mousey_snap)
|
|||
if( (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) && (xctx->ui_state & STARTLINE) )
|
||||
{
|
||||
xctx->push_undo();
|
||||
if(xctx->manhattan_lines==1) {
|
||||
if(xctx->manhattan_lines & 1) {
|
||||
if(xctx->nl_xx2!=xctx->nl_xx1) {
|
||||
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
|
||||
xctx->nl_xx2 = xctx->nl_x2; xctx->nl_yy2 = xctx->nl_y2;
|
||||
|
|
@ -3328,7 +3332,7 @@ void new_line(int what, double mousex_snap, double mousey_snap)
|
|||
modified = 1;
|
||||
drawline(xctx->rectcolor,NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2, 0, NULL);
|
||||
}
|
||||
} else if(xctx->manhattan_lines==2) {
|
||||
} else if(xctx->manhattan_lines & 2) {
|
||||
if(xctx->nl_yy2!=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;
|
||||
|
|
@ -3365,7 +3369,7 @@ void new_line(int what, double mousex_snap, double mousey_snap)
|
|||
|
||||
if(what & RUBBER)
|
||||
{
|
||||
if(xctx->manhattan_lines==1) {
|
||||
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);
|
||||
|
|
@ -3386,7 +3390,7 @@ void new_line(int what, double mousex_snap, double mousey_snap)
|
|||
ORDER(xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
drawtempline(xctx->gc[xctx->rectcolor], NOW, xctx->nl_xx2,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
|
||||
}
|
||||
} else if(xctx->manhattan_lines==2) {
|
||||
} 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);
|
||||
|
|
|
|||
|
|
@ -1641,6 +1641,26 @@ static int end_place_move_copy_zoom()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void snapped_wire(double c_snap)
|
||||
{
|
||||
double x, y;
|
||||
if(!(xctx->ui_state & STARTWIRE)){
|
||||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
xctx->mx_double_save = my_round(x / c_snap) * c_snap;
|
||||
xctx->my_double_save = my_round(y / c_snap) * c_snap;
|
||||
new_wire(PLACE, x, y);
|
||||
new_wire(RUBBER, xctx->mousex_snap,xctx->mousey_snap);
|
||||
}
|
||||
else {
|
||||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
new_wire(RUBBER, x, y);
|
||||
new_wire(PLACE|END, x, y);
|
||||
xctx->constr_mv=0;
|
||||
tcleval("set constr_mv 0" );
|
||||
if((xctx->ui_state & MENUSTART) && !tclgetboolvar("persistent_command") ) xctx->ui_state &= ~MENUSTART;
|
||||
}
|
||||
}
|
||||
|
||||
static int check_menu_start_commands(double c_snap)
|
||||
{
|
||||
dbg(1, "check_menu_start_commands(): ui_state=%x, ui_state2=%x last_command=%d\n",
|
||||
|
|
@ -1648,12 +1668,10 @@ static int check_menu_start_commands(double c_snap)
|
|||
|
||||
if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTWIRECUT)) {
|
||||
break_wires_at_point(xctx->mousex_snap, xctx->mousey_snap, 1);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTWIRECUT2)) {
|
||||
break_wires_at_point(xctx->mousex_snap, xctx->mousey_snap, 0);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTMOVE)) {
|
||||
|
|
@ -1662,14 +1680,12 @@ static int check_menu_start_commands(double c_snap)
|
|||
/* stretch nets that land on selected instance pins if connect_by_kissing == 2 */
|
||||
/* select_attached_nets(); */
|
||||
move_objects(START,0,0,0);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTCOPY)) {
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
copy_objects(START);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTWIRE)) {
|
||||
|
|
@ -1680,8 +1696,6 @@ static int check_menu_start_commands(double c_snap)
|
|||
tcleval("set constr_mv 0" );
|
||||
xctx->constr_mv=0;
|
||||
}
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
xctx->ui_state2 = 0;
|
||||
|
||||
/*
|
||||
* xctx->mx_double_save=xctx->mousex_snap;
|
||||
|
|
@ -1692,13 +1706,7 @@ static int check_menu_start_commands(double c_snap)
|
|||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTSNAPWIRE)) {
|
||||
double x, y;
|
||||
|
||||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
xctx->mx_double_save = my_round(x / c_snap) * c_snap;
|
||||
xctx->my_double_save = my_round(y / c_snap) * c_snap;
|
||||
new_wire(PLACE, x, y);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
snapped_wire(c_snap);
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTLINE)) {
|
||||
|
|
@ -1709,8 +1717,6 @@ static int check_menu_start_commands(double c_snap)
|
|||
tcleval("set constr_mv 0" );
|
||||
xctx->constr_mv=0;
|
||||
}
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
xctx->ui_state2 = 0;
|
||||
|
||||
/*
|
||||
* xctx->mx_double_save=xctx->mousex_snap;
|
||||
|
|
@ -1724,33 +1730,28 @@ static int check_menu_start_commands(double c_snap)
|
|||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_rect(PLACE,xctx->mousex_snap, xctx->mousey_snap);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTPOLYGON)) {
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_polygon(PLACE, xctx->mousex_snap, xctx->mousey_snap);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTARC)) {
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_arc(PLACE, 180., xctx->mousex_snap, xctx->mousey_snap);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTCIRCLE)) {
|
||||
xctx->mx_double_save=xctx->mousex_snap;
|
||||
xctx->my_double_save=xctx->mousey_snap;
|
||||
new_arc(PLACE, 360., xctx->mousex_snap, xctx->mousey_snap);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
else if((xctx->ui_state & MENUSTART) && (xctx->ui_state2 & MENUSTARTZOOM)) {
|
||||
zoom_rectangle(START);
|
||||
xctx->ui_state &=~MENUSTART;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -2348,25 +2349,6 @@ static int grabscreen(const char *winpath, int event, int mx, int my, KeySym key
|
|||
}
|
||||
#endif
|
||||
|
||||
static void snapped_wire(double c_snap)
|
||||
{
|
||||
double x, y;
|
||||
if(!(xctx->ui_state & STARTWIRE)){
|
||||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
xctx->mx_double_save = my_round(x / c_snap) * c_snap;
|
||||
xctx->my_double_save = my_round(y / c_snap) * c_snap;
|
||||
new_wire(PLACE, x, y);
|
||||
new_wire(RUBBER, xctx->mousex_snap,xctx->mousey_snap);
|
||||
}
|
||||
else {
|
||||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
new_wire(RUBBER, x, y);
|
||||
new_wire(PLACE|END, x, y);
|
||||
xctx->constr_mv=0;
|
||||
tcleval("set constr_mv 0" );
|
||||
}
|
||||
}
|
||||
|
||||
/* main window callback */
|
||||
/* mx and my are set to the mouse coord. relative to window */
|
||||
/* winpath: set to .drw or sub windows .x1.drw, .x2.drw, ... */
|
||||
|
|
@ -2386,7 +2368,9 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
int draw_xhair = tclgetboolvar("draw_crosshair");
|
||||
int infix_interface = tclgetboolvar("infix_interface");
|
||||
int snap_cursor = tclgetboolvar("snap_cursor");
|
||||
int wire_draw_active = (xctx->ui_state & STARTWIRE) || (xctx->ui_state2 & MENUSTARTWIRE) || (tclgetboolvar("persistent_command") && (xctx->last_command & STARTWIRE));
|
||||
int wire_draw_active = (xctx->ui_state & STARTWIRE) ||
|
||||
((xctx->ui_state2 & MENUSTARTWIRE) && (xctx->ui_state & MENUSTART)) ||
|
||||
(tclgetboolvar("persistent_command") && (xctx->last_command & STARTWIRE));
|
||||
int rstate; /* (reduced state, without ShiftMask) */
|
||||
|
||||
/* this fix uses an alternative method for getting mouse coordinates on KeyPress/KeyRelease
|
||||
|
|
@ -2675,7 +2659,8 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
}
|
||||
/* snap crosshair to closest pin or net endpoint */
|
||||
if(draw_xhair) {
|
||||
if( ( (xctx->ui_state & STARTWIRE) || xctx->ui_state == 0 ) && (state & ShiftMask) ) {
|
||||
if( ( (xctx->ui_state & (MENUSTART | STARTWIRE)) || xctx->ui_state == 0 ) &&
|
||||
(state & ShiftMask) ) {
|
||||
double x, y, sx, sy;
|
||||
sx = xctx->mousex_snap;
|
||||
sy = xctx->mousey_snap;
|
||||
|
|
@ -2703,7 +2688,7 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
xctx->manhattan_lines %=3;
|
||||
new_wire(RUBBER, xctx->mousex_snap, xctx->mousey_snap);
|
||||
|
||||
} else if(xctx->ui_state==STARTLINE) {
|
||||
} else if(xctx->ui_state & STARTLINE) {
|
||||
new_line(RUBBER|CLEAR, xctx->mousex_snap, xctx->mousey_snap);
|
||||
xctx->manhattan_lines++;
|
||||
xctx->manhattan_lines %=3;
|
||||
|
|
@ -4239,7 +4224,6 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
/* terminate wire placement in snap mode */
|
||||
else if(button==Button1 && (state & ShiftMask) && (xctx->ui_state & STARTWIRE) ) {
|
||||
snapped_wire(c_snap);
|
||||
here(1111);
|
||||
}
|
||||
/* Alt - Button1 click to unselect */
|
||||
else if(button==Button1 && (SET_MODMASK) ) {
|
||||
|
|
@ -4418,7 +4402,8 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
}
|
||||
|
||||
/* end wire creation when dragging in intuitive interface from an inst pin ow wire endpoint */
|
||||
/*else if(state == Button1Mask && xctx->intuitive_interface && (xctx->ui_state & STARTWIRE)) {*/
|
||||
/*else if(state == Button1Mask && xctx->intuitive_interface
|
||||
* && (xctx->ui_state & STARTWIRE) && !(xctx->ui_state & MENUSTART)) {*/
|
||||
/* if(end_place_move_copy_zoom()) break;*/
|
||||
/*}*/
|
||||
|
||||
|
|
@ -4469,6 +4454,13 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
xctx->mousex_snap, xctx->mousey_snap, xctx->lastsel, xctx->sch_path[xctx->currsch] );
|
||||
statusmsg(str,1);
|
||||
}
|
||||
|
||||
/* clear start from menu flag or infix_interface=0 start commands */
|
||||
if(xctx->ui_state & MENUSTART) {
|
||||
xctx->ui_state &= ~MENUSTART;
|
||||
break;
|
||||
}
|
||||
|
||||
if(draw_xhair) draw_crosshair(0);
|
||||
if(snap_cursor && wire_draw_active) draw_snap_cursor(0);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1394,6 +1394,7 @@ extern int Tcl_AppInit(Tcl_Interp *interp);
|
|||
extern void abort_operation(void);
|
||||
extern void draw_crosshair(int what);
|
||||
extern void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr);
|
||||
/* extern void snapped_wire(double c_snap); */
|
||||
extern int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
||||
int button, int aux, int state);
|
||||
extern void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h);
|
||||
|
|
|
|||
Loading…
Reference in New Issue