[xiph-cvs] r6518 - trunk/postfish

xiphmont at xiph.org xiphmont at xiph.org
Fri Apr 16 16:44:07 PDT 2004



Author: xiphmont
Date: 2004-04-16 19:44:06 -0400 (Fri, 16 Apr 2004)
New Revision: 6518

Modified:
   trunk/postfish/clippanel.c
   trunk/postfish/clippanel.h
   trunk/postfish/compandpanel.c
   trunk/postfish/declip.c
   trunk/postfish/eqpanel.c
   trunk/postfish/limitpanel.c
   trunk/postfish/mainpanel.c
   trunk/postfish/multibar.c
   trunk/postfish/output.c
   trunk/postfish/singlepanel.c
   trunk/postfish/subpanel.c
   trunk/postfish/subpanel.h
   trunk/postfish/suppresspanel.c
   trunk/postfish/version.h
Log:
More channel/master panell functionality in place; clippanel reenabled

altered multibar >1 thumb cosmetics (full thumbs that shrink on 'overlap')

<p><p>Modified: trunk/postfish/clippanel.c
===================================================================
--- trunk/postfish/clippanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/clippanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -30,7 +30,7 @@
 #include "subpanel.h"
 #include "declip.h"
 
-extern sig_atomic_t declip_active;
+extern sig_atomic_t *declip_active;
 extern sig_atomic_t declip_visible;
 extern int input_ch;
 extern int input_size;
@@ -108,16 +108,17 @@
 }
 
 void clippanel_create(postfish_mainpanel *mp,
-		      GtkWidget *windowbutton,
-		      GtkWidget *activebutton){
+		      GtkWidget **windowbutton,
+		      GtkWidget **activebutton){
   int i;
   char *labels[2]={"10%","100%"};
   float levels[3]={0.,10.,100.};
   int block_choices=0;
 
-  subpanel_generic *panel=subpanel_create(mp,windowbutton,activebutton,
-					  &declip_active,&declip_visible,
-					  "_Declipping filter setup"," [d] ");
+  subpanel_generic *panel=subpanel_create(mp,windowbutton[0],activebutton,
+					  declip_active,&declip_visible,
+					  "_Declipping filter setup",NULL,
+					  0,input_ch);
   
   GtkWidget *framebox=gtk_hbox_new(1,0);
   GtkWidget *framebox_right=gtk_vbox_new(0,0);

Modified: trunk/postfish/clippanel.h
===================================================================
--- trunk/postfish/clippanel.h	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/clippanel.h	2004-04-16 23:44:06 UTC (rev 6518)
@@ -24,7 +24,7 @@
 #include "postfish.h"
 
 extern void clippanel_create(postfish_mainpanel *mp,
-			     GtkWidget *windowbutton,
-			     GtkWidget *activebutton);
+			     GtkWidget **windowbutton,
+			     GtkWidget **activebutton);
 extern void clippanel_feedback(int workp);
 extern void clippanel_reset(void);

Modified: trunk/postfish/compandpanel.c
===================================================================
--- trunk/postfish/compandpanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/compandpanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -510,11 +510,13 @@
   float per_levels[9]={0,12.5,25,37.5,50,62.5,75,87.5,100};
   char  *per_labels[8]={"","25%","","50%","","75%","","100%"};
 
+  char *shortcut[]={" m "};
 
-  subpanel_generic *panel=subpanel_create(mp,windowbutton,activebutton,
+  subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
                                           &compand_active,
                                           &compand_visible,
-					  "_Multiband Compand"," [m] ");
+					  "_Multiband Compand",shortcut,
+					  0,1);
   
   GtkWidget *hbox=gtk_hbox_new(0,0);
   GtkWidget *sliderbox=gtk_vbox_new(0,0);

Modified: trunk/postfish/declip.c
===================================================================
--- trunk/postfish/declip.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/declip.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -52,7 +52,7 @@
 static time_linkage out;
 
 /* accessed across threads */
-sig_atomic_t declip_active=0;
+sig_atomic_t *declip_active;
 sig_atomic_t declip_visible=0;
 sig_atomic_t declip_converge=2; /* 0=over, 1=full, 2=half, 3=partial, 4=approx */
 
@@ -105,6 +105,7 @@
 /* called only by initial setup */
 int declip_load(void){
   int i;
+  declip_active=calloc(input_ch,sizeof(*declip_active));
   chtrigger=malloc(input_ch*sizeof(*chtrigger));
   for(i=0;i<input_ch;i++)
     chtrigger[i]=1.;
@@ -205,7 +206,8 @@
 static void declip(float *lap,float *out,
                    int blocksize,float trigger,
                    float epsilon, float iteration,
-		   int *runningtotal, int *runningcount,float *peak){
+		   int *runningtotal, int *runningcount,float *peak,
+		   int active){
   float flag[blocksize*2];
   int    iterbound,i,j,count=0;
   
@@ -221,7 +223,7 @@
   *runningtotal+=blocksize;
   *runningcount+=count;
 
-  if(declip_active){
+  if(active){
 
     for(i=0;i<blocksize/2;i++)flag[i]=0.;
     for(i=blocksize*3/2;i<blocksize*2;i++)flag[i]=0.;
@@ -323,7 +325,7 @@
       memcpy(work+blocksize,temp,sizeof(*work)*blocksize/2);
       declip(lap[i],0,blocksize,
              local_trigger[i],local_convergence,local_iterations,
-	     &total,count+i,peak+i);
+	     &total,count+i,peak+i,declip_active[i]);
       
       memset(cache[i],0,sizeof(**cache)*input_size);
       in->data[i]=cache[i];
@@ -347,14 +349,14 @@
         memcpy(work+blocksize/2,temp+j,sizeof(*work)*blocksize);
         declip(lap[i],out.data[i]+j,blocksize,
                local_trigger[i],local_convergence,local_iterations,
-	       &total,count+i,peak+i);
+	       &total,count+i,peak+i,declip_active[i]);
       }
       memcpy(work+blocksize/2,temp+j,sizeof(*work)*blocksize/2);
       memcpy(work+blocksize,in->data[i],sizeof(*work)*blocksize/2);
       
       declip(lap[i],out.data[i]+j,blocksize,
              local_trigger[i],local_convergence,local_iterations,
-	     &total,count+i,peak+i);
+	     &total,count+i,peak+i,declip_active[i]);
       
       cache[i]=in->data[i];
       in->data[i]=temp;

Modified: trunk/postfish/eqpanel.c
===================================================================
--- trunk/postfish/eqpanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/eqpanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -66,11 +66,13 @@
                     "30","20","10","0","+10","+20","+30"};
   float levels[16]={-120,-110,-100,-90,-80,-70,-60,-50,-40,
                      -30,-20,-10,0,10,20,30};
+  char *shortcut[]={" e "};
 
-  subpanel_generic *panel=subpanel_create(mp,windowbutton,activebutton,
+  subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
                                           &eq_active,
                                           &eq_visible,
-					  "_Equalization filter"," [e] ");
+					  "_Equalization filter",shortcut,
+					  0,1);
   
   GtkWidget *slidertable=gtk_table_new(eq_freqs,3,0);
 

Modified: trunk/postfish/limitpanel.c
===================================================================
--- trunk/postfish/limitpanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/limitpanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -105,10 +105,13 @@
   float timing_levels[6]={.1,1,10,100,1000,10000};
   char  *timing_labels[5]={"1ms","10ms","100ms","1s","10s"};
 
-  subpanel_generic *panel=subpanel_create(mp,windowbutton,activebutton,
+  char *shortcut[]={" l "};
+
+  subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
                                           &limit_active,
                                           &limit_visible,
-					  "Hard _Limiter"," [l] ");
+					  "Hard _Limiter",shortcut,
+					  0,1);
   
   GtkWidget *slidertable=gtk_table_new(4,4,0);
 

Modified: trunk/postfish/mainpanel.c
===================================================================
--- trunk/postfish/mainpanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/mainpanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -469,7 +469,7 @@
                               int channelwinp,
                               void (*panel_create)
                               (postfish_mainpanel *,
-			       GtkWidget *, GtkWidget *)){  
+			       GtkWidget **, GtkWidget **)){  
   
   int j;
   GtkWidget *wm[input_ch];
@@ -528,8 +528,7 @@
 
   }
 
-  //p->buttonactive[i]=wa;
-  //if(panel_create)(*panel_create)(p,ww,wa);
+  if(panel_create)(*panel_create)(p,wm,wa);
 }
 
 static void mainpanel_masterentry(postfish_mainpanel *p,
@@ -977,7 +976,7 @@
   }
 
   mainpanel_chentry(panel,channeltable,"Mute ",0,0,0,0);
-  mainpanel_chentry(panel,channeltable,"_Declip ",1,1,0,0);
+  mainpanel_chentry(panel,channeltable,"_Declip ",1,1,0,clippanel_create);
   mainpanel_chentry(panel,channeltable,"_Multicomp ",2,0,1,0);
   mainpanel_chentry(panel,channeltable,"_Onecomp ",3,0,1,0);
   mainpanel_chentry(panel,channeltable,"De_verb ",4,1,0,0);

Modified: trunk/postfish/multibar.c
===================================================================
--- trunk/postfish/multibar.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/multibar.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -454,178 +454,112 @@
 
   /* draw slider thumbs */
   if(m->thumbs){
-    int height=widget->allocation.height;
+    int height=widget->allocation.height,i,j;
     GdkGC *black_gc=widget->style->black_gc;
     int y=height/2-3;
     int y0=height/3-1;
     int y1=height-3;
-    int yM=(y1+y0)/2-y0;
 
+    int outer=(y1-y-2)+y*3/2;
+    int inner=(y1+y0)/2-y0;
+
+    int A[3]={outer,outer,outer};
+    int B[3]={inner,inner,inner};
+    int C[3]={inner,inner,inner};
+    int D[3]={outer,outer,outer};
+
     GdkColor yellow={0,0xff00,0xd000,0};
-    
-    if(m->thumbs==1){
-      /* single thumb: wide center */
-      GdkGC *gc=widget->style->bg_gc[m->thumbstate[0]];
-      GdkGC *light_gc=widget->style->light_gc[m->thumbstate[0]];
-      GdkGC *dark_gc=widget->style->dark_gc[m->thumbstate[0]];
+
+    if(m->thumbs==2){
+      /* adjustment required for overlapping thumbs? */
+      int mid=m->thumbpixel[1]-m->thumbpixel[0]-1;
+      int midA=(mid<0?0:mid)/2;
+      int midB=(mid<0?0:mid)-midA;
       
-      int x=m->thumbpixel[0]+xpad;
-      int x0=x-(y1-y-2);
-      int x1=x+(y1-y-2);
-      int x2=x0-y*3/2;
-      int x3=x1+y*3/2;
-      
-      GdkPoint tp[7]={ {x,y0},{x-yM,y0+yM},{x2,y0+yM},{x2,y1+1},{x3,y1+1},{x3,y0+yM},{x+yM,y0+yM} };
-      
-      gdk_draw_polygon(m->backing,gc,TRUE,tp,7);
-      
-      gdk_draw_line(m->backing,dark_gc,x2+1,y1,x3-1,y1);
-      gdk_draw_line(m->backing,dark_gc,x3-1,y1,x3-1,y0+yM+1);
-      
-      if(m->thumbfocus==0){
-	if(x&1)
-	  gdk_gc_set_stipple(black_gc,stipple);
-	else
-	  gdk_gc_set_stipple(black_gc,stippleB);
-	gdk_gc_set_fill(black_gc,GDK_STIPPLED);
-	gdk_draw_polygon(m->backing,black_gc,TRUE,tp,7);
-	gdk_gc_set_fill(black_gc,GDK_SOLID);
-      }
-      
-      gdk_draw_line(m->backing,light_gc,x3-1,y0+yM,x+yM,y0+yM);
-      gdk_draw_line(m->backing,light_gc,x+yM,y0+yM,x,y0);
-      gdk_draw_line(m->backing,light_gc,x,y0,x-yM,y0+yM);
-      gdk_draw_line(m->backing,light_gc,x-yM,y0+yM,x2,y0+yM);
-      gdk_draw_line(m->backing,light_gc,x2,y0+yM,x2,y1);
-      
-      gdk_draw_line(m->backing,black_gc,x2,y1+1,x3,y1+1);
-      gdk_draw_line(m->backing,black_gc,x3,y1+1,x3,y0+yM);
-      
-      gdk_gc_set_rgb_fg_color(m->boxcolor,&yellow);
-      gdk_draw_line(m->backing,m->boxcolor,x,y1-1,x,0);
-      
+      if(midA<D[0])D[0]=midA;
+      if(midA<C[0])C[0]=midA;
+      if(midB<A[1])A[1]=midB;
+      if(midB<B[1])B[1]=midB;
     }
-  
-    if(m->thumbs>1){
-      
-      /* two thumbs: left */
-      {
-	GdkGC *gc=widget->style->bg_gc[m->thumbstate[0]];
-	GdkGC *light_gc=widget->style->light_gc[m->thumbstate[0]];
-	GdkGC *dark_gc=widget->style->dark_gc[m->thumbstate[0]];
-	
-	int x=m->thumbpixel[0]+xpad;
-	int x0=x-(y1-y-2);
-	int x2=x0-y*3/2;
-	
-	GdkPoint tp[5]={ {x,y0},{x-yM,y0+yM},{x2,y0+yM},{x2,y1+1},
-			 {x,y1+1}};
-	
-	gdk_draw_polygon(m->backing,gc,TRUE,tp,5);
 
-	gdk_draw_line(m->backing,dark_gc,x2+1,y1,x-1,y1);
-	gdk_draw_line(m->backing,dark_gc,x-1,y1,x-1,y0+1);
+    if(m->thumbs==3){
+      /* adjust for 0,1 overlap if any; different from the 2 case */
+      int mid=m->thumbpixel[1]-m->thumbpixel[0]-1;
+      int midA=(mid<0?0:mid)/2;
+      int midB=(mid<0?0:mid)-midA;
 
-	if(m->thumbfocus==0){
-	  if(x&1)
-	    gdk_gc_set_stipple(black_gc,stipple);
-	  else
-	    gdk_gc_set_stipple(black_gc,stippleB);
-	  gdk_gc_set_fill(black_gc,GDK_STIPPLED);
-	  gdk_draw_polygon(m->backing,black_gc,TRUE,tp,5);
-	  gdk_gc_set_fill(black_gc,GDK_SOLID);
-	}
-	
-	gdk_draw_line(m->backing,light_gc,x,y0,x-yM,y0+yM);
-	gdk_draw_line(m->backing,light_gc,x-yM-1,y0+yM,x2,y0+yM);
-	gdk_draw_line(m->backing,light_gc,x2,y0+yM,x2,y1+1);
+      if(midA<D[0])D[0]=midA;
+      if(D[0]<C[0]+2)D[0]=C[0]+2;
+      if(midB<A[1])A[1]=midB;
+      if(A[1]<B[1]+2)A[1]=B[1]+2;
 
-	gdk_draw_line(m->backing,black_gc,x2,y1+1,x,y1+1);
-	gdk_draw_line(m->backing,black_gc,x,y1+1,x,y0);
-	
-	gdk_gc_set_rgb_fg_color(m->boxcolor,&yellow);
-	gdk_draw_line(m->backing,m->boxcolor,x,y1-1,x,0);
-	
-      }
-      /* two thumbs: right */
+      /* adjust for 1,2 overlap if any */
+
+      mid=m->thumbpixel[2]-m->thumbpixel[1]-1;
+      midA=(mid<0?0:mid)/2;
+      midB=(mid<0?0:mid)-midA;
+
+      if(midA<D[1])D[1]=midA;
+      if(D[1]<C[1]+2)D[1]=C[1]+2;
+      if(midB<A[2])A[2]=midB;
+      if(A[2]<B[2]+2)A[2]=B[2]+2;
+    }
+    
+    for(i=0;i<m->thumbs;i++){
+      if(m->thumbs==3){
+	/* in the three-thumb case, the middle thumb is drawn last */
+	switch(i){
+	case 0:
+	  j=0;
+	  break;
+	case 1:
+	  j=2;
+	  break;
+	case 2:
+	  j=1;
+	  break;
+	}
+      }else
+	j=i;
+      
       {
-	int num=(m->thumbs>2?2:1);
-	GdkGC *gc=widget->style->bg_gc[m->thumbstate[num]];
-	GdkGC *light_gc=widget->style->light_gc[m->thumbstate[num]];
-	GdkGC *dark_gc=widget->style->dark_gc[m->thumbstate[num]];
+	int x=m->thumbpixel[j]+xpad;
+	GdkPoint p[8]={ {x+D[j],y0+C[j]},
+			{x+C[j],y0+C[j]}, 
+			{x     ,y0     },
+			{x-B[j],y0+B[j]},
+			{x-A[j],y0+B[j]},
+			{x-A[j],y1+1   },
+			{x+D[j],y1+1   },
+			{x+D[j],y0+C[j]}};
         
-	int x=m->thumbpixel[num]+xpad;
-	int x1=x+(y1-y-2);
-	int x3=x1+y*3/2;
+	GdkPoint d[3]={ {x-A[j]+1,y1},
+			{x+D[j]-1,y1},
+			{x+D[j]-1,y0+C[j]+1}};
         
-	GdkPoint tp[5]={ {x,y0},{x+yM,y0+yM},{x3,y0+yM},{x3,y1+1},
-			 {x,y1+1}};
-
-	gdk_draw_polygon(m->backing,gc,TRUE,tp,5);
-
-	gdk_draw_line(m->backing,dark_gc,x+1,y1,x3-1,y1);
-	gdk_draw_line(m->backing,dark_gc,x3-1,y1,x3-1,y0+yM+1);
-
-	if(m->thumbfocus==num){
+	GdkGC *gc=widget->style->bg_gc[m->thumbstate[j]];
+	GdkGC *light_gc=widget->style->light_gc[m->thumbstate[j]];
+	GdkGC *dark_gc=widget->style->dark_gc[m->thumbstate[j]];
+      
+	gdk_draw_polygon(m->backing,gc,TRUE,p,7);
+	gdk_draw_lines(m->backing,dark_gc,d,3);
+      
+	if(m->thumbfocus==j){
           if(x&1)
             gdk_gc_set_stipple(black_gc,stipple);
           else
             gdk_gc_set_stipple(black_gc,stippleB);
+
           gdk_gc_set_fill(black_gc,GDK_STIPPLED);
-	  gdk_draw_polygon(m->backing,black_gc,TRUE,tp,5);
+	  gdk_draw_polygon(m->backing,black_gc,TRUE,p,7);
           gdk_gc_set_fill(black_gc,GDK_SOLID);
         }
-
-	gdk_draw_line(m->backing,light_gc,x3-1,y0+yM,x+yM,y0+yM);
-	gdk_draw_line(m->backing,light_gc,x+yM,y0+yM,x,y0);
-	gdk_draw_line(m->backing,light_gc,x,y0,x,y1);
-	
-	gdk_draw_line(m->backing,black_gc,x,y1+1,x3,y1+1);
-	gdk_draw_line(m->backing,black_gc,x3,y1+1,x3,y0+yM);
-	
-	gdk_gc_set_rgb_fg_color(m->boxcolor,&yellow);
-	gdk_draw_line(m->backing,m->boxcolor,x,y1-1,x,0);
-	
-      }
-
-      if(m->thumbs==3){
-	/* three thumbs: minimal center */
-	GdkGC *gc=widget->style->bg_gc[m->thumbstate[1]];
-	GdkGC *light_gc=widget->style->light_gc[m->thumbstate[1]];
-	GdkGC *dark_gc=widget->style->dark_gc[m->thumbstate[1]];
       
-	int x=m->thumbpixel[1]+xpad;
-	int x0=x-(y1-y0-3);
-	int x1=x+(y1-y0-3);
-	
-	GdkPoint tp[5]={ {x,y0},{x0,y1-3},{x0,y1+1},{x1,y1+1},{x1,y1-3} };
-	
-	gdk_draw_polygon(m->backing,gc,TRUE,tp,5);
-	
-	
-	gdk_draw_line(m->backing,dark_gc,x0+1,y1,x1-1,y1);
-	gdk_draw_line(m->backing,dark_gc,x1-1,y1,x1-1,y1-3);
-	
-	if(m->thumbfocus==1){
-	  for(i=0;i<(height-1)/2;i++)
-	    for(j=0;j<=i*2;j++)
-	      if(!(j&1))
-		gdk_draw_point(m->backing,black_gc,x-i+j,y0+i+2);
-	  for(j=0;j<=(i-1)*2;j++)
-	    if((j&1))
-	      gdk_draw_point(m->backing,black_gc,x-(i-1)+j,y0+i+2);
-	}
-
-	gdk_draw_line(m->backing,light_gc,x,y0,x1,y1-3);
-	gdk_draw_line(m->backing,light_gc,x,y0,x0,y1-3);
-	gdk_draw_line(m->backing,light_gc,x0,y1-3,x0,y1+1);
-
-	gdk_draw_line(m->backing,black_gc,x0,y1+1,x1,y1+1);
-	gdk_draw_line(m->backing,black_gc,x1,y1+1,x1,y1-2);
-	
+	gdk_draw_lines(m->backing,light_gc,p,6);
+	gdk_draw_lines(m->backing,black_gc,p+5,3);
+      
         gdk_gc_set_rgb_fg_color(m->boxcolor,&yellow);
         gdk_draw_line(m->backing,m->boxcolor,x,y1-1,x,0);
-	
       }
     }
   }

Modified: trunk/postfish/output.c
===================================================================
--- trunk/postfish/output.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/output.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -232,7 +232,7 @@
     /* get data */
     link=input_read();
     result=link->samples;
-    //link=declip_read(link);
+    link=declip_read(link);
     result|=link->samples;
     link=multicompand_read(link);
     result|=link->samples;

Modified: trunk/postfish/singlepanel.c
===================================================================
--- trunk/postfish/singlepanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/singlepanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -217,11 +217,13 @@
   float per_levels[9]={0,12.5,25,37.5,50,62.5,75,87.5,100};
   char  *per_labels[8]={"","25%","","50%","","75%","","100%"};
 
+  char *shortcut[]={" o "};
 
-  subpanel_generic *panel=subpanel_create(mp,windowbutton,activebutton,
+  subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
                                           &singlecomp_active,
                                           &singlecomp_visible,
-					  "_Oneband Compand"," o ");
+					  "_Oneband Compand",shortcut,
+					  0,1);
   
   GtkWidget *sliderframe=gtk_frame_new(NULL);
   GtkWidget *allbox=gtk_vbox_new(0,0);

Modified: trunk/postfish/subpanel.c
===================================================================
--- trunk/postfish/subpanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/subpanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -63,17 +63,23 @@
 static int activebutton_action(GtkWidget *widget,
                         gpointer in){
   subpanel_generic *p=in;
-  int active;
+  int active,i;
 
-  if(widget==p->subpanel_activebutton){
-    active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->subpanel_activebutton));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->mainpanel_activebutton),active);
-  }else{
-    active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->mainpanel_activebutton));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->subpanel_activebutton),active);
+  for(i=0;i<p->active_button_count;i++){
+    if(widget==p->subpanel_activebutton[i]){
+      active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->subpanel_activebutton[i]));
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->mainpanel_activebutton[i]),active);
+      p->activevar[i]=active;
+      break;
+    }
+    if(widget==p->mainpanel_activebutton[i]){
+      active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->mainpanel_activebutton[i]));
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->subpanel_activebutton[i]),active);
+      p->activevar[i]=active;
+      break;
+    }
   }
   
-  *p->activevar=active;
   return FALSE;
 }
 
@@ -97,6 +103,14 @@
 static gboolean forward_events(GtkWidget *widget,
                                GdkEvent *event,
                                gpointer in){
+
+  /* if this is a shortcutless panel, check first for a numeral
+     keypress; the intent of this mechanism is to handle focus
+     rotation on the activation buttons on a panel handling > 10
+     channels with multiple activation buttons. */
+
+
+
   subpanel_generic *p=in;
   GdkEvent copy=*(GdkEvent *)event;
   copy.any.window=p->mainpanel->toplevel->window;
@@ -110,10 +124,11 @@
 
 subpanel_generic *subpanel_create(postfish_mainpanel *mp,
                                   GtkWidget *windowbutton,
-				  GtkWidget *activebutton,
+				  GtkWidget **activebutton,
                                   sig_atomic_t *activevar,
                                   sig_atomic_t *mappedvar,
-				  char *prompt,char *shortcut){
+				  char *prompt,char **shortcut,
+				  int start,int num){
 
   subpanel_generic *panel=calloc(1,sizeof(*panel));
 
@@ -121,22 +136,36 @@
   GtkWidget *toplabelframe=gtk_frame_new(NULL);
   GtkWidget *toplabel=gtk_hbox_new(0,0);
   GtkWidget *toplabelwb=windowbutton_new(prompt);
-  GtkWidget *toplabelab=0;
+  GtkWidget *toplabelab[num];
+  int i;
   
-  if(activebutton && activevar)
-    toplabelab=gtk_toggle_button_new_with_label(shortcut);
-  
-  panel->subpanel_topframe=gtk_frame_new (NULL);
+  for(i=0;i<num;i++){
+    if(shortcut && shortcut[i]){
+      toplabelab[i]=gtk_toggle_button_new_with_label(shortcut[i]);
+    }else{
+      char buf[80];
+      sprintf(buf," %d ",i+start+1);
+	toplabelab[i]=gtk_toggle_button_new_with_label(buf);
+    }
+  }
+
+  panel->active_button_count=num;
+  panel->active_button_start=start;
+
+  panel->subpanel_topframe=gtk_frame_new(NULL);
   panel->subpanel_windowbutton=toplabelwb;
-  panel->subpanel_activebutton=toplabelab;
+  panel->subpanel_activebutton=malloc(num*sizeof(*panel->subpanel_activebutton));
+  memcpy(panel->subpanel_activebutton,toplabelab,num*sizeof(*toplabelab));
 
   panel->mainpanel_windowbutton=windowbutton;
-  panel->mainpanel_activebutton=activebutton;
+  panel->mainpanel_activebutton=calloc(num,sizeof(*activebutton));
+  memcpy(panel->mainpanel_activebutton,activebutton,num*sizeof(*activebutton));
   panel->activevar=activevar;
   panel->mappedvar=mappedvar;
   
   gtk_box_pack_start(GTK_BOX(toplabel),toplabelwb,0,0,5);
-  gtk_box_pack_end(GTK_BOX(toplabel),toplabelab,0,0,5);
+  for(i=num-1;i>=0;i--)
+    gtk_box_pack_end(GTK_BOX(toplabel),toplabelab[i],0,0,5);
 
   gtk_widget_set_name(toplabelwb,"panelbutton");
   gtk_widget_set_name(toplabelbox,"panelbox");
@@ -176,10 +205,11 @@
                           G_CALLBACK (windowbutton_action), panel);
   g_signal_connect_after (G_OBJECT (panel->subpanel_windowbutton), "clicked",
                           G_CALLBACK (windowbutton_action), panel);
-  if(activebutton && activevar){
-    g_signal_connect_after (G_OBJECT (panel->mainpanel_activebutton), "clicked",
+
+  for(i=0;i<num;i++){
+    g_signal_connect_after (G_OBJECT (panel->mainpanel_activebutton[i]), "clicked",
                             G_CALLBACK (activebutton_action), panel);
-    g_signal_connect_after (G_OBJECT (panel->subpanel_activebutton), "clicked",
+    g_signal_connect_after (G_OBJECT (panel->subpanel_activebutton[i]), "clicked",
                             G_CALLBACK (activebutton_action), panel);
   }
 

Modified: trunk/postfish/subpanel.h
===================================================================
--- trunk/postfish/subpanel.h	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/subpanel.h	2004-04-16 23:44:06 UTC (rev 6518)
@@ -23,13 +23,17 @@
 
 typedef struct{
   GtkWidget *mainpanel_windowbutton;
-  GtkWidget *mainpanel_activebutton;
+  GtkWidget **mainpanel_activebutton;
   GtkWidget *subpanel_windowbutton;
-  GtkWidget *subpanel_activebutton;
+  GtkWidget **subpanel_activebutton;
   GtkWidget *subpanel_toplevel;
   GtkWidget *subpanel_topframe;
   GtkWidget *subpanel_box;
   sig_atomic_t *activevar;
+
+  int active_button_count; /* silliness around the rotating non-alt-shortcut */
+  int active_button_start; /* silliness around the rotating non-alt-shortcut */
+
   sig_atomic_t *mappedvar;
 
   postfish_mainpanel *mainpanel;
@@ -37,8 +41,10 @@
 
 extern subpanel_generic *subpanel_create(postfish_mainpanel *mp,
                                          GtkWidget *windowbutton,
-					 GtkWidget *activebutton,
+					 GtkWidget **activebutton,
                                          sig_atomic_t *activevar,
                                          sig_atomic_t *mappedvar,
-					 char *prompt,char *shortcut);
+					 char *prompt,char **shortcut,
+					 int start,int num);
+
 extern void subpanel_show_all_but_toplevel(subpanel_generic *s);

Modified: trunk/postfish/suppresspanel.c
===================================================================
--- trunk/postfish/suppresspanel.c	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/suppresspanel.c	2004-04-16 23:44:06 UTC (rev 6518)
@@ -126,11 +126,14 @@
 
   float timing_levels[5]={1, 10, 100, 1000, 10000};
   char  *timing_labels[4]={"10ms","     100ms","1s","10s"};
+
+  char *shortcut[]={" v "};
   
-  subpanel_generic *panel=subpanel_create(mp,windowbutton,activebutton,
+  subpanel_generic *panel=subpanel_create(mp,windowbutton,&activebutton,
                                           &suppress_active,
                                           &suppress_visible,
-					  "De_verberation filter"," [v] ");
+					  "De_verberation filter",shortcut,
+					  0,1);
   
 
   GtkWidget *table=gtk_table_new(suppress_freqs+4,5,0);

Modified: trunk/postfish/version.h
===================================================================
--- trunk/postfish/version.h	2004-04-15 06:17:15 UTC (rev 6517)
+++ trunk/postfish/version.h	2004-04-16 23:44:06 UTC (rev 6518)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Thu Apr 15 02:15:37 EDT 2004] */
+/* DO NOT EDIT: Automated versioning hack [Fri Apr 16 19:43:08 EDT 2004] */

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list