[Experimental Feature Update (orthogonal_wiring)]: Modified the last added orthogonal wiring mode to only FINALIZE either a horizontal, or a vertical component when a user-click event is detected. HOWEVER, the full orthogonal wire is drawn on the canvas anyways. A double-click using LMB causes both the horizontal and vertical components to get finalized, and the wire-drawing mode is simultaneously terminated. To get the best experience with this feature, 'persistent_commands' should also be enabled from the 'Options' menu.
This commit is contained in:
parent
be202219a0
commit
21d4abcfc0
|
|
@ -85,19 +85,17 @@ static int waves_selected(int event, KeySym key, int state, int button)
|
|||
void redraw_w_a_l_r_p_rubbers(void)
|
||||
{
|
||||
if(xctx->ui_state & STARTWIRE) {
|
||||
if(xctx->constr_mv == 1) xctx->mousey_snap = xctx->my_double_save;
|
||||
if(xctx->constr_mv == 2) xctx->mousex_snap = xctx->mx_double_save;
|
||||
if(tclgetboolvar("orthogonal_wiring")) {
|
||||
new_wire(RUBBER|CLEAR, xctx->mousex_snap, xctx->mousey_snap);
|
||||
int tmp_x2 = xctx->nl_x2 - xctx->nl_x1, tmp_y2 = xctx->nl_y2 - xctx->nl_y1;
|
||||
if(tmp_x2*tmp_x2 > tmp_y2*tmp_y2){
|
||||
tcleval("set constr_mv 1");
|
||||
xctx->constr_mv = 1;
|
||||
xctx->manhattan_lines = 1;
|
||||
} else {
|
||||
tcleval("set constr_mv 2");
|
||||
xctx->constr_mv = 2;
|
||||
xctx->manhattan_lines = 2;
|
||||
}
|
||||
}
|
||||
if(xctx->constr_mv == 1) xctx->mousey_snap = xctx->my_double_save;
|
||||
if(xctx->constr_mv == 2) xctx->mousex_snap = xctx->mx_double_save;
|
||||
new_wire(RUBBER, xctx->mousex_snap, xctx->mousey_snap);
|
||||
}
|
||||
if(xctx->ui_state & STARTARC) {
|
||||
|
|
@ -201,10 +199,14 @@ static void start_line(double mx, double my)
|
|||
|
||||
static void start_wire(double mx, double my)
|
||||
{
|
||||
dbg(1, "start_wire(): ui_state=%d, ui_state2=%d last_command=%d\n",
|
||||
xctx->ui_state, xctx->ui_state2, xctx->last_command);
|
||||
dbg(1, "start_wire(): ui_state=%d, ui_state2=%d last_command=%d\n", xctx->ui_state, xctx->ui_state2, xctx->last_command);
|
||||
xctx->last_command = STARTWIRE;
|
||||
if(xctx->ui_state & STARTWIRE) {
|
||||
if(tclgetboolvar("orthogonal_wiring") && !tclgetboolvar("constr_mv")){
|
||||
xctx->constr_mv = xctx->manhattan_lines;
|
||||
new_wire(CLEAR, mx, my);
|
||||
redraw_w_a_l_r_p_rubbers();
|
||||
}
|
||||
if(xctx->constr_mv != 2) {
|
||||
xctx->mx_double_save = mx;
|
||||
}
|
||||
|
|
@ -218,6 +220,9 @@ static void start_wire(double mx, double my)
|
|||
xctx->my_double_save=my;
|
||||
}
|
||||
new_wire(PLACE,mx, my);
|
||||
if(tclgetboolvar("orthogonal_wiring") && !tclgetboolvar("constr_mv")){
|
||||
xctx->constr_mv = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static double interpolate_yval(int idx, int p, double x, int sweep_idx, int point_not_last)
|
||||
|
|
@ -3337,8 +3342,7 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
if(key=='L' && rstate == 0) { /* toggle orthogonal routing */
|
||||
if(tclgetboolvar("orthogonal_wiring")){
|
||||
tclsetboolvar("orthogonal_wiring", 0);
|
||||
tcleval("set constr_mv 0");
|
||||
xctx->constr_mv = 0;
|
||||
xctx->manhattan_lines = 0;
|
||||
} else {
|
||||
tclsetboolvar("orthogonal_wiring", 1);
|
||||
}
|
||||
|
|
@ -4045,6 +4049,8 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
edit_property(0);
|
||||
} else {
|
||||
if(xctx->ui_state & STARTWIRE) {
|
||||
redraw_w_a_l_r_p_rubbers();
|
||||
start_wire(mx, my);
|
||||
xctx->ui_state &= ~STARTWIRE;
|
||||
}
|
||||
if(xctx->ui_state & STARTLINE) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue