[xiph-commits] r12261 - trunk/sushivision
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Fri Dec 29 15:24:30 PST 2006
Author: xiphmont
Date: 2006-12-29 15:24:28 -0800 (Fri, 29 Dec 2006)
New Revision: 12261
Modified:
trunk/sushivision/internal.h
trunk/sushivision/panel-1d.c
trunk/sushivision/panel-2d.c
trunk/sushivision/plot.c
trunk/sushivision/plot.h
Log:
Fix a few crosshair snap-to bug, don't rerender linked panels when the
dependent crosshair for that panel didn't move.
Modified: trunk/sushivision/internal.h
===================================================================
--- trunk/sushivision/internal.h 2006-12-29 19:40:34 UTC (rev 12260)
+++ trunk/sushivision/internal.h 2006-12-29 23:24:28 UTC (rev 12261)
@@ -112,6 +112,6 @@
double val);
extern void _sushiv_panel1d_mark_recompute_linked(sushiv_panel_t *p);
-extern void _sushiv_panel1d_update_linked_crosshairs(sushiv_panel_t *p);
+extern void _sushiv_panel1d_update_linked_crosshairs(sushiv_panel_t *p, int xflag, int yflag);
extern sig_atomic_t _sushiv_exiting;
Modified: trunk/sushivision/panel-1d.c
===================================================================
--- trunk/sushivision/panel-1d.c 2006-12-29 19:40:34 UTC (rev 12260)
+++ trunk/sushivision/panel-1d.c 2006-12-29 23:24:28 UTC (rev 12261)
@@ -540,7 +540,7 @@
_sushiv_panel_dirty_legend(p);
}
-void _sushiv_panel1d_update_linked_crosshairs(sushiv_panel_t *p){
+void _sushiv_panel1d_update_linked_crosshairs(sushiv_panel_t *p, int xflag, int yflag){
int i;
/* look to see if any 1d panels link to passed in panel */
@@ -550,12 +550,16 @@
if(q != p && q->type == SUSHIV_PANEL_1D){
sushiv_panel1d_t *q1 = q->subtype->p1;
if(q1->link_x == p){
- update_crosshair(q);
- q->private->request_compute(q);
+ if(xflag)
+ update_crosshair(q);
+ if(yflag)
+ q->private->request_compute(q);
}else{
if(q1->link_y == p){
- update_crosshair(q);
- q->private->request_compute(q);
+ if(yflag)
+ update_crosshair(q);
+ if(xflag)
+ q->private->request_compute(q);
}
}
}
@@ -662,13 +666,13 @@
if(p1->link_x){
// make it the master panel's problem.
- plot_set_crosshairs(PLOT(link->private->graph),
+ plot_set_crosshairs_snap(PLOT(link->private->graph),
x,
PLOT(link->private->graph)->sely);
link->private->crosshair_action(link);
}else if (p1->link_y){
// make it the master panel's problem.
- plot_set_crosshairs(PLOT(link->private->graph),
+ plot_set_crosshairs_snap(PLOT(link->private->graph),
PLOT(link->private->graph)->selx,
x);
link->private->crosshair_action(link);
Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c 2006-12-29 19:40:34 UTC (rev 12260)
+++ trunk/sushivision/panel-2d.c 2006-12-29 23:24:28 UTC (rev 12261)
@@ -601,7 +601,7 @@
sushiv_panel2d_t *p2 = p->subtype->p2;
Plot *plot = PLOT(p->private->graph);
double x=0,y=0;
- int i;
+ int i,xflag=0,yflag=0;
for(i=0;i<p->dimensions;i++){
sushiv_dimension_t *d = p->dimension_list[i].d;
@@ -612,20 +612,7 @@
}
- plot_set_crosshairs(PLOT(p->private->graph),x,y);
-
- // crosshairs snap to a pixel position; the cached dimension value
- // should be accurate with respect to the crosshairs
- for(i=0;i<p->dimensions;i++){
- sushiv_dimension_t *d = p->dimension_list[i].d;
- if(d == p2->x_d)
- d->val = scalespace_value(&plot->x,plot_get_crosshair_xpixel(plot));
- if(d == p2->y_d)
- d->val = scalespace_value(&plot->y,p2->data_h - plot_get_crosshair_ypixel(plot));
- }
-
- _sushiv_panel1d_update_linked_crosshairs(p);
-
+ plot_set_crosshairs_snap(PLOT(p->private->graph),x,y);
update_legend(p);
}
@@ -653,12 +640,12 @@
}else{
// mid slider of an axis dimension changed, move crosshairs
update_crosshairs(p);
+ _sushiv_panel1d_update_linked_crosshairs(p,d==p2->x_d,d==p2->y_d);
}
/* dims can be shared amongst multiple panels; all must be updated */
if(recursep)
_sushiv_panel_update_shared_dimension(d,val);
-
if(buttonstate == 2)
_sushiv_panel_undo_resume(p);
@@ -734,23 +721,28 @@
for(i=0;i<p->dimensions;i++){
sushiv_dimension_t *d = p->dimension_list[i].d;
if(d == p2->x_d){
- slider_set_value(p->private->dim_scales[i],1,x);
+ if(p2->x_d->val != x){
+ slider_set_value(p->private->dim_scales[i],1,x);
- // key bindings could move crosshairs out of the window; we
- // stretch in that case, which requires a recompute.
- bracket_callback_2d(p->dimension_list+i,1);
+ // key bindings could move crosshairs out of the window; we
+ // stretch in that case, which requires a recompute.
+ bracket_callback_2d(p->dimension_list+i,1);
+ }
}
if(d == p2->y_d){
- slider_set_value(p->private->dim_scales[i],1,y);
-
- // key bindings could move crosshairs out of the window; we
- // stretch in that case, which requires a recompute.
- bracket_callback_2d(p->dimension_list+i,1);
+ if(p2->y_d->val != y){
+ slider_set_value(p->private->dim_scales[i],1,y);
+
+ // key bindings could move crosshairs out of the window; we
+ // stretch in that case, which requires a recompute.
+ bracket_callback_2d(p->dimension_list+i,1);
+ }
}
p2->oldbox_active = 0;
}
+
_sushiv_panel_undo_resume(p);
}
Modified: trunk/sushivision/plot.c
===================================================================
--- trunk/sushivision/plot.c 2006-12-29 19:40:34 UTC (rev 12260)
+++ trunk/sushivision/plot.c 2006-12-29 23:24:28 UTC (rev 12261)
@@ -964,6 +964,7 @@
void plot_set_crosshairs(Plot *p, double x, double y){
gdk_threads_enter();
+
p->selx = x;
p->sely = y;
p->cross_active=1;
@@ -972,6 +973,19 @@
gdk_threads_leave();
}
+void plot_set_crosshairs_snap(Plot *p, double x, double y){
+ gdk_threads_enter();
+ double xpixel = rint(scalespace_pixel(&p->x,x));
+ double ypixel = rint(scalespace_pixel(&p->y,y));
+
+ p->selx = scalespace_value(&p->x,xpixel);
+ p->sely = scalespace_value(&p->y,ypixel);
+ p->cross_active=1;
+
+ plot_expose_request(p);
+ gdk_threads_leave();
+}
+
int plot_get_crosshair_xpixel(Plot *p){
scalespace x;
double v;
Modified: trunk/sushivision/plot.h
===================================================================
--- trunk/sushivision/plot.h 2006-12-29 19:40:34 UTC (rev 12260)
+++ trunk/sushivision/plot.h 2006-12-29 23:24:28 UTC (rev 12261)
@@ -107,6 +107,7 @@
u_int32_t * plot_get_background_line(Plot *p, int num);
cairo_t *plot_get_background_cairo(Plot *p);
void plot_set_crosshairs(Plot *p, double x, double y);
+void plot_set_crosshairs_snap(Plot *p, double x, double y);
void plot_draw_scales(Plot *p);
void plot_unset_box(Plot *p);
void plot_box_vals(Plot *p, double ret[4]);
More information about the commits
mailing list