[xiph-commits] r12263 - trunk/sushivision
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Fri Dec 29 16:40:37 PST 2006
Author: xiphmont
Date: 2006-12-29 16:40:36 -0800 (Fri, 29 Dec 2006)
New Revision: 12263
Modified:
trunk/sushivision/panel-1d.c
trunk/sushivision/panel-2d.c
Log:
Correct bug where disturbing the invisible bracketing sliders on a
non-axis dimension would clobber the Y scale on a 2d panel.
Modified: trunk/sushivision/panel-1d.c
===================================================================
--- trunk/sushivision/panel-1d.c 2006-12-29 23:45:15 UTC (rev 12262)
+++ trunk/sushivision/panel-1d.c 2006-12-30 00:40:36 UTC (rev 12263)
@@ -607,34 +607,47 @@
int dnum = dptr - p->dimension_list;
double lo = slider_get_value(p->private->dim_scales[dnum],0);
double hi = slider_get_value(p->private->dim_scales[dnum],2);
-
+ int axisp = d == p1->x_d;
+
if(buttonstate == 0){
_sushiv_panel_undo_push(p);
_sushiv_panel_undo_suspend(p);
}
if(d->bracket[0] != lo || d->bracket[1] != hi){
- scalespace s = scalespace_linear(lo,hi,p1->data_size,
- PLOT(p->private->graph)->scalespacing,
- d->name);
+
+ d->bracket[0] = lo;
+ d->bracket[1] = hi;
- if(s.m == 0){
- fprintf(stderr,"X scale underflow; cannot zoom further.\n");
- }else{
+ if(axisp){
+ scalespace s = scalespace_linear(lo,hi,p1->data_size,
+ PLOT(p->private->graph)->scalespacing,
+ d->name);
+
+ if(s.m == 0){
+ fprintf(stderr,"X scale underflow; cannot zoom further.\n");
- d->bracket[0] = lo;
- d->bracket[1] = hi;
- update_crosshair(p);
+ // abort attempt
+ if(buttonstate == 2)
+ _sushiv_panel_undo_resume(p);
+ return;
+ }
+
_mark_recompute_1d(p);
- _sushiv_panel_update_shared_bracket(d,lo,hi);
+
}
+
+ _sushiv_panel_update_shared_bracket(d,lo,hi);
+
}
-
+
if(buttonstate == 2)
_sushiv_panel_undo_resume(p);
}
+
+
static void dimchange_callback_1d(GtkWidget *button,gpointer in){
sushiv_panel_t *p = (sushiv_panel_t *)in;
@@ -974,7 +987,6 @@
GdkEventKey *event,
gpointer in){
sushiv_panel_t *p = (sushiv_panel_t *)in;
- // sushiv_panel2d_t *p2 = (sushiv_panel2d_t *)p->internal;
if(event->state&GDK_MOD1_MASK) return FALSE;
if(event->state&GDK_CONTROL_MASK)return FALSE;
Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c 2006-12-29 23:45:15 UTC (rev 12262)
+++ trunk/sushivision/panel-2d.c 2006-12-30 00:40:36 UTC (rev 12263)
@@ -601,7 +601,7 @@
sushiv_panel2d_t *p2 = p->subtype->p2;
Plot *plot = PLOT(p->private->graph);
double x=0,y=0;
- int i,xflag=0,yflag=0;
+ int i;
for(i=0;i<p->dimensions;i++){
sushiv_dimension_t *d = p->dimension_list[i].d;
@@ -612,7 +612,7 @@
}
- plot_set_crosshairs_snap(PLOT(p->private->graph),x,y);
+ plot_set_crosshairs_snap(plot,x,y);
update_legend(p);
}
@@ -659,35 +659,46 @@
int dnum = dptr - p->dimension_list;
double lo = slider_get_value(p->private->dim_scales[dnum],0);
double hi = slider_get_value(p->private->dim_scales[dnum],2);
-
+ int axisp = (d == p2->x_d || d == p2->y_d);
+
if(buttonstate == 0){
_sushiv_panel_undo_push(p);
_sushiv_panel_undo_suspend(p);
}
if(d->bracket[0] != lo || d->bracket[1] != hi){
- double xy_p = d == p2->x_d;
- scalespace s = scalespace_linear(lo,hi,(xy_p?p2->data_w:p2->data_h),
- PLOT(p->private->graph)->scalespacing,
- d->name);
+
+ d->bracket[0] = lo;
+ d->bracket[1] = hi;
- if(s.m == 0){
- if(xy_p)
- fprintf(stderr,"X scale underflow; cannot zoom further.\n");
- else
- fprintf(stderr,"Y scale underflow; cannot zoom further.\n");
- }else{
- xy_p?(p2->x=s):(p2->y=s);
+ if(axisp){
+ double xy_p = d == p2->x_d;
+ scalespace s = scalespace_linear(lo,hi,(xy_p?p2->data_w:p2->data_h),
+ PLOT(p->private->graph)->scalespacing,
+ d->name);
- d->bracket[0] = lo;
- d->bracket[1] = hi;
- update_crosshairs(p);
+ if(s.m == 0){
+ if(xy_p)
+ fprintf(stderr,"X scale underflow; cannot zoom further.\n");
+ else
+ fprintf(stderr,"Y scale underflow; cannot zoom further.\n");
+ // abort attempt
+ if(buttonstate == 2)
+ _sushiv_panel_undo_resume(p);
+ return;
+
+ }
+
+ xy_p?(p2->x=s):(p2->y=s);
_mark_recompute_2d(p);
- _sushiv_panel_update_shared_bracket(d,lo,hi);
+
}
+
+ _sushiv_panel_update_shared_bracket(d,lo,hi);
+
}
-
+
if(buttonstate == 2)
_sushiv_panel_undo_resume(p);
}
More information about the commits
mailing list