redraw wire/line/rect/arc/poly rubbers after changing zoom/panning; do not wait for Motion events

This commit is contained in:
Stefan Frederik 2020-12-29 03:45:12 +01:00
parent 921885d654
commit ebaa2d932b
5 changed files with 61 additions and 33 deletions

View File

@ -63,6 +63,7 @@
<li><a href="https://xschem.sourceforge.io/stefan/xschem_man/video_tutorials/launcher.mp4">[Video] Link documentation to components/symbols</a></li>
<li><a href="https://xschem.sourceforge.io/stefan/xschem_man/video_tutorials/rawtovcd.mp4">[Video] Use rawtovcd to show ngspice waveforms in gtkwave</a></li>
<li><a href="https://xschem.sourceforge.io/stefan/xschem_man/video_tutorials/verilog.mp4">[Video] Run a Verilog simulation with XSCHEM and icarus Verilog</a></li>
<li><a href="https://xschem.sourceforge.io/stefan/xschem_man/video_tutorials/xschem_embedded_simulation.mp4">[Video] See logic propagation of nets live in xschem without using a backend simulator</a></li>
<li><a href="https://xschem.sourceforge.io/stefan/xschem_man/video_tutorials/probe_to_gaw.mp4">[Video] Probe xschem nets into the GAW waveform viewer</a></li>
<li><a href="https://xschem.sourceforge.io/stefan/xschem_man/video_tutorials/create_symbol.mp4">[Video] Creating a symbol</a></li>
<li><a href="https://xschem.sourceforge.io/stefan/xschem_man/video_tutorials/LCC.mp4">[Video] Instantiating schematics instead of symbols (LCC, Local Custom Cell)</a></li>

View File

@ -1371,21 +1371,25 @@ void zoom_full(int dr, int sel, int flags, double shrink)
}
dbg(1, "zoom_full(): dr=%d sel=%d flags=%d areaw=%d, areah=%d\n", sel, dr, flags, xctx->areaw, xctx->areah);
if(flags & 1) change_linewidth(-1.);
if(dr && has_x) draw();
if(dr && has_x) {
draw();
redraw_w_a_l_r_p_rubbers();
}
}
void view_zoom(double z)
{
double factor;
/* int i; */
factor = z!=0.0 ? z : CADZOOMSTEP;
if(xctx->zoom<CADMINZOOM) return;
xctx->zoom/= factor;
xctx->mooz=1/xctx->zoom;
xctx->xorigin=-xctx->mousex_snap+(xctx->mousex_snap+xctx->xorigin)/factor;
xctx->yorigin=-xctx->mousey_snap+(xctx->mousey_snap+xctx->yorigin)/factor;
change_linewidth(-1.);
draw();
double factor;
/* int i; */
factor = z!=0.0 ? z : CADZOOMSTEP;
if(xctx->zoom<CADMINZOOM) return;
xctx->zoom/= factor;
xctx->mooz=1/xctx->zoom;
xctx->xorigin=-xctx->mousex_snap+(xctx->mousex_snap+xctx->xorigin)/factor;
xctx->yorigin=-xctx->mousey_snap+(xctx->mousey_snap+xctx->yorigin)/factor;
change_linewidth(-1.);
draw();
redraw_w_a_l_r_p_rubbers();
}
void view_unzoom(double z)
@ -1407,6 +1411,7 @@ void view_unzoom(double z)
}
change_linewidth(-1.);
draw();
redraw_w_a_l_r_p_rubbers();
}
void set_viewport_size(int w, int h, double lw)
@ -1489,6 +1494,7 @@ void zoom_rectangle(int what)
xctx->mooz=1/xctx->zoom;
change_linewidth(-1.);
draw();
redraw_w_a_l_r_p_rubbers();
dbg(1, "zoom_rectangle(): coord: %.16g %.16g %.16g %.16g zoom=%.16g\n",
xctx->nl_x1,xctx->nl_y1,xctx->mousex_snap, xctx->mousey_snap,xctx->zoom);
}

View File

@ -22,6 +22,31 @@
#include "xschem.h"
void redraw_w_a_l_r_p_rubbers(void)
{
if(xctx->ui_state & STARTWIRE) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_wire(RUBBER, xctx->mousex_snap, xctx->mousey_snap);
}
if(xctx->ui_state & STARTARC) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_arc(RUBBER, 0);
}
if(xctx->ui_state & STARTLINE) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_line(RUBBER);
}
if(xctx->ui_state & STARTRECT) new_rect(RUBBER);
if(xctx->ui_state & STARTPOLYGON) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_polygon(RUBBER);
}
}
void start_line(double mx, double my)
{
xctx->last_command = STARTLINE;
@ -220,21 +245,7 @@ int callback(int event, int mx, int my, KeySym key,
select_rect(RUBBER,1);
}
}
if(xctx->ui_state & STARTWIRE) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_wire(RUBBER, xctx->mousex_snap, xctx->mousey_snap);
}
if(xctx->ui_state & STARTARC) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_arc(RUBBER, 0);
}
if(xctx->ui_state & STARTLINE) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_line(RUBBER);
}
if(xctx->ui_state & STARTMOVE) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
@ -245,12 +256,8 @@ int callback(int event, int mx, int my, KeySym key,
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
copy_objects(RUBBER);
}
if(xctx->ui_state & STARTRECT) new_rect(RUBBER);
if(xctx->ui_state & STARTPOLYGON) {
if(horizontal_move) xctx->mousey_snap = xctx->my_double_save;
if(vertical_move) xctx->mousex_snap = xctx->mx_double_save;
new_polygon(RUBBER);
}
redraw_w_a_l_r_p_rubbers();
/* start of a mouse area select */
if(!(xctx->ui_state & STARTPOLYGON) && (state&Button1Mask) && !(xctx->ui_state & STARTWIRE) &&
!(xctx->ui_state & STARTPAN2) && !(state & Mod1Mask) &&
@ -615,6 +622,7 @@ int callback(int event, int mx, int my, KeySym key,
xctx->xorigin=-xctx->mousex_snap+xctx->areaw*xctx->zoom/2.0;
xctx->yorigin=-xctx->mousey_snap+xctx->areah*xctx->zoom/2.0;
draw();
redraw_w_a_l_r_p_rubbers();
break;
}
if(key=='5' && state == 0) { /* 20110112 display only probes */
@ -639,24 +647,28 @@ int callback(int event, int mx, int my, KeySym key,
{
xctx->xorigin+=-CADMOVESTEP*xctx->zoom;
draw();
redraw_w_a_l_r_p_rubbers();
break;
}
if(key==XK_Left) /* right */
{
xctx->xorigin-=-CADMOVESTEP*xctx->zoom;
draw();
redraw_w_a_l_r_p_rubbers();
break;
}
if(key==XK_Down) /* down */
{
xctx->yorigin+=-CADMOVESTEP*xctx->zoom;
draw();
redraw_w_a_l_r_p_rubbers();
break;
}
if(key==XK_Up) /* up */
{
xctx->yorigin-=-CADMOVESTEP*xctx->zoom;
draw();
redraw_w_a_l_r_p_rubbers();
break;
}
if(key=='q' && state == ControlMask) /* exit */
@ -1402,14 +1414,17 @@ int callback(int event, int mx, int my, KeySym key,
else if(button==Button4 && (state & ShiftMask) && !(state & Button2Mask)) {
xctx->xorigin+=-CADMOVESTEP*xctx->zoom/2.;
draw();
redraw_w_a_l_r_p_rubbers();
}
else if(button==Button5 && (state & ShiftMask) && !(state & Button2Mask)) {
xctx->xorigin-=-CADMOVESTEP*xctx->zoom/2.;
draw();
redraw_w_a_l_r_p_rubbers();
}
else if(button==Button4 && (state & ControlMask) && !(state & Button2Mask)) {
xctx->yorigin+=-CADMOVESTEP*xctx->zoom/2.;
draw();
redraw_w_a_l_r_p_rubbers();
}
else if(button==Button5 && (state & ControlMask) && !(state & Button2Mask)) {
xctx->yorigin-=-CADMOVESTEP*xctx->zoom/2.;
@ -1654,7 +1669,7 @@ int callback(int event, int mx, int my, KeySym key,
xctx->mx_save = mx; xctx->my_save = my;
xctx->mx_double_save=xctx->mousex_snap;
xctx->my_double_save=xctx->mousey_snap;
redraw_w_a_l_r_p_rubbers();
break;
}
dbg(1, "callback(): ButtonRelease ui_state=%ld state=%d\n",xctx->ui_state,state);

View File

@ -996,6 +996,7 @@ extern void new_arc(int what, double sweep);
extern void arc_3_points(double x1, double y1, double x2, double y2, double x3, double y3,
double *x, double *y, double *r, double *a, double *b);
extern void move_objects(int what,int merge, double dx, double dy);
extern void redraw_w_a_l_r_p_rubbers(void); /* redraw wire, arcs, line, polygon rubbers */
extern void copy_objects(int what);
extern void find_inst_to_be_redrawn(const char *node);
extern void find_inst_hash_clear(void);

View File

@ -35,6 +35,8 @@ function replace_pattern(old, new)
replace_pattern("created dir.*$", "created dir ***Removed***")
replace_pattern("undo_dirname.*$", "undo_dirname ***Removed***")
replace_pattern("framewinID.*$", "framewinID ***Removed***")
replace_pattern("framewin parentID.*$", "framewin parentID ***Removed***")
replace_pattern("framewin child.*$", "framewin child ***Removed***")
replace_pattern("resetwin.*$", "resetwin ***Removed***")
replace_pattern("read_xschem_file.*$", "read_xschem_file ***Removed***")
replace_pattern("EMERGENCY SAVE DIR dir.*$", "EMERGENCY SAVE DIR dir ***Removed***")
@ -46,6 +48,9 @@ function replace_pattern(old, new)
replace_pattern("l_s_d[:(:][:):]: fopen.*$", "load_sym_def(): fopen ***Removed***")
replace_pattern("l_s_d[:(:][:):]: fclose.*$", "load_sym_def(): fclose ***Removed***")
replace_pattern("drawing string: str=.*$", "drawing string: str=***Removed***")
replace_pattern("zoom_full[:(:][:):]:.*$", "zoom_full(): ***Removed***")
replace_pattern("bbox[:(:][:):]: bbox=.*$", "bbox(): bbox=***Removed***")
replace_pattern("draw_string()[:(:][:):]:.*$", "draw_string(): ***Removed***")
__a[__lines++] = $0
}