[xiph-commits] r12798 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Mar 22 07:14:05 PDT 2007


Author: xiphmont
Date: 2007-03-22 07:14:03 -0700 (Thu, 22 Mar 2007)
New Revision: 12798

Modified:
   trunk/sushivision/Makefile
   trunk/sushivision/dimension.c
   trunk/sushivision/dimension.h
   trunk/sushivision/example_discrete.c
   trunk/sushivision/sushivision.h
Log:
Add the dim change callback I need for today's demo.



Modified: trunk/sushivision/Makefile
===================================================================
--- trunk/sushivision/Makefile	2007-03-22 12:56:32 UTC (rev 12797)
+++ trunk/sushivision/Makefile	2007-03-22 14:14:03 UTC (rev 12798)
@@ -98,7 +98,7 @@
 	$(LD) $(OBJ) example_chirp.o $(CFLAGS) -o sushivision_chirp $(LIBS) $(LDF)
 	$(LD) $(OBJ) example_spirograph.o $(CFLAGS) -o sushivision_spirograph $(LIBS) $(LDF)
 
-install: target
+install: $(TARGET)
 	$(INSTALL) -d -m 0755 $(INCDIR)
 	$(INSTALL) -m 0644 $(INC) $(INCDIR)
 #	$(INSTALL) -d -m 0755 $(MANDIR)
@@ -110,3 +110,4 @@
 	$(INSTALL) -m 0755 $(TARGET) $(LIBDIR)
 	$(INSTALL) -m 0755 sushivision.pc $(LIBDIR)/pkgconfig
 	$(LDCONFIG)
+	ln -fs $(LIBDIR)/$(TARGET) $(LIBDIR)/lib$(NAME).so

Modified: trunk/sushivision/dimension.c
===================================================================
--- trunk/sushivision/dimension.c	2007-03-22 12:56:32 UTC (rev 12797)
+++ trunk/sushivision/dimension.c	2007-03-22 14:14:03 UTC (rev 12798)
@@ -253,6 +253,9 @@
       _sv_dim_widget_t *w = d->private->widget_list[i];
       w->center_callback(dw->dl);
     }
+
+    if(d->private->value_callback) 
+      d->private->value_callback(d,d->private->value_callback_data);
   }
   
   if(buttonstate == 2)
@@ -354,6 +357,10 @@
       _sv_dim_widget_t *w = d->private->widget_list[i];
       w->center_callback(dw->dl);
     }
+
+    if(d->private->value_callback) 
+      d->private->value_callback(d,d->private->value_callback_data);
+
   }
   _sv_undo_resume(p->sushi);
   
@@ -425,6 +432,10 @@
       errno = -EINVAL;
       return -EINVAL;
     }
+
+    if(d->private->value_callback) 
+      d->private->value_callback(d,d->private->value_callback_data);
+
   }else
     return _sv_dim_set_value(d->private->widget_list[0],thumb,val);
   return 0;
@@ -694,6 +705,7 @@
   
   d->scale = (sv_scale_t *)sv_scale_copy(scale);
 
+  // in the runtime version, don't just blindly reset values!
   d->bracket[0]=scale->val_list[0];
   d->val = 0;
   d->bracket[1]=scale->val_list[d->scale->vals-1];
@@ -795,3 +807,7 @@
   return ret;
 }
 
+int sv_dim_callback_value (sv_dim_t *d, int (*callback)(sv_dim_t *, void *), void *data){
+  d->private->value_callback = callback;
+  d->private->value_callback_data = data;
+}

Modified: trunk/sushivision/dimension.h
===================================================================
--- trunk/sushivision/dimension.h	2007-03-22 12:56:32 UTC (rev 12797)
+++ trunk/sushivision/dimension.h	2007-03-22 14:14:03 UTC (rev 12798)
@@ -45,6 +45,9 @@
   
   int widgets;
   _sv_dim_widget_t **widget_list;
+
+  int (*value_callback)(sv_dim_t *d, void *data);
+  void *value_callback_data;
 };
 
 extern int _sv_dim_scales(sv_dim_t *d,

Modified: trunk/sushivision/example_discrete.c
===================================================================
--- trunk/sushivision/example_discrete.c	2007-03-22 12:56:32 UTC (rev 12797)
+++ trunk/sushivision/example_discrete.c	2007-03-22 14:14:03 UTC (rev 12798)
@@ -57,6 +57,7 @@
   //		    "Y",0);
   //sv_obj_make_scale(o0, 2, (double []){0, 1.0}, NULL, 0);
   
+  svm_scale_vals(0,1);
   svm_obj_simple(0,"test pattern",f,"Y");
 
   //sv_panel_t *p2 = sv_panel_new_2d(s,0,"Discrete data example",

Modified: trunk/sushivision/sushivision.h
===================================================================
--- trunk/sushivision/sushivision.h	2007-03-22 12:56:32 UTC (rev 12797)
+++ trunk/sushivision/sushivision.h	2007-03-22 14:14:03 UTC (rev 12798)
@@ -142,7 +142,8 @@
 				 double val);
 
 int       sv_dim_callback_value (sv_dim_t *d,
-				 int (*callback)(sv_dim_t *));
+				 int (*callback)(sv_dim_t *, void*),
+				 void *callback_data);
 
 /* functions *****************************************************/
 



More information about the commits mailing list