Commit b7f2bb6d authored by Monty Montgomery's avatar Monty Montgomery

More channel/master panell functionality in place; clippanel reenabled

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



git-svn-id: https://svn.xiph.org/trunk/postfish@6518 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 6641c7a3
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "subpanel.h" #include "subpanel.h"
#include "declip.h" #include "declip.h"
extern sig_atomic_t declip_active; extern sig_atomic_t *declip_active;
extern sig_atomic_t declip_visible; extern sig_atomic_t declip_visible;
extern int input_ch; extern int input_ch;
extern int input_size; extern int input_size;
...@@ -108,16 +108,17 @@ static void limit_slider_change(GtkWidget *w,gpointer in){ ...@@ -108,16 +108,17 @@ static void limit_slider_change(GtkWidget *w,gpointer in){
} }
void clippanel_create(postfish_mainpanel *mp, void clippanel_create(postfish_mainpanel *mp,
GtkWidget *windowbutton, GtkWidget **windowbutton,
GtkWidget *activebutton){ GtkWidget **activebutton){
int i; int i;
char *labels[2]={"10%","100%"}; char *labels[2]={"10%","100%"};
float levels[3]={0.,10.,100.}; float levels[3]={0.,10.,100.};
int block_choices=0; int block_choices=0;
subpanel_generic *panel=subpanel_create(mp,windowbutton,activebutton, subpanel_generic *panel=subpanel_create(mp,windowbutton[0],activebutton,
&declip_active,&declip_visible, declip_active,&declip_visible,
"_Declipping filter setup"," [d] "); "_Declipping filter setup",NULL,
0,input_ch);
GtkWidget *framebox=gtk_hbox_new(1,0); GtkWidget *framebox=gtk_hbox_new(1,0);
GtkWidget *framebox_right=gtk_vbox_new(0,0); GtkWidget *framebox_right=gtk_vbox_new(0,0);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "postfish.h" #include "postfish.h"
extern void clippanel_create(postfish_mainpanel *mp, extern void clippanel_create(postfish_mainpanel *mp,
GtkWidget *windowbutton, GtkWidget **windowbutton,
GtkWidget *activebutton); GtkWidget **activebutton);
extern void clippanel_feedback(int workp); extern void clippanel_feedback(int workp);
extern void clippanel_reset(void); extern void clippanel_reset(void);
...@@ -510,11 +510,13 @@ void compandpanel_create(postfish_mainpanel *mp, ...@@ -510,11 +510,13 @@ void compandpanel_create(postfish_mainpanel *mp,
float per_levels[9]={0,12.5,25,37.5,50,62.5,75,87.5,100}; 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 *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_active,
&compand_visible, &compand_visible,
"_Multiband Compand"," [m] "); "_Multiband Compand",shortcut,
0,1);
GtkWidget *hbox=gtk_hbox_new(0,0); GtkWidget *hbox=gtk_hbox_new(0,0);
GtkWidget *sliderbox=gtk_vbox_new(0,0); GtkWidget *sliderbox=gtk_vbox_new(0,0);
......
...@@ -52,7 +52,7 @@ static int fillstate=0; /* 0: uninitialized ...@@ -52,7 +52,7 @@ static int fillstate=0; /* 0: uninitialized
static time_linkage out; static time_linkage out;
/* accessed across threads */ /* accessed across threads */
sig_atomic_t declip_active=0; sig_atomic_t *declip_active;
sig_atomic_t declip_visible=0; sig_atomic_t declip_visible=0;
sig_atomic_t declip_converge=2; /* 0=over, 1=full, 2=half, 3=partial, 4=approx */ sig_atomic_t declip_converge=2; /* 0=over, 1=full, 2=half, 3=partial, 4=approx */
...@@ -105,6 +105,7 @@ int pull_declip_feedback(int *clip,float *peak,int *total){ ...@@ -105,6 +105,7 @@ int pull_declip_feedback(int *clip,float *peak,int *total){
/* called only by initial setup */ /* called only by initial setup */
int declip_load(void){ int declip_load(void){
int i; int i;
declip_active=calloc(input_ch,sizeof(*declip_active));
chtrigger=malloc(input_ch*sizeof(*chtrigger)); chtrigger=malloc(input_ch*sizeof(*chtrigger));
for(i=0;i<input_ch;i++) for(i=0;i<input_ch;i++)
chtrigger[i]=1.; chtrigger[i]=1.;
...@@ -205,7 +206,8 @@ static void sliding_bark_average(float *f,int n,float width){ ...@@ -205,7 +206,8 @@ static void sliding_bark_average(float *f,int n,float width){
static void declip(float *lap,float *out, static void declip(float *lap,float *out,
int blocksize,float trigger, int blocksize,float trigger,
float epsilon, float iteration, float epsilon, float iteration,
int *runningtotal, int *runningcount,float *peak){ int *runningtotal, int *runningcount,float *peak,
int active){
float flag[blocksize*2]; float flag[blocksize*2];
int iterbound,i,j,count=0; int iterbound,i,j,count=0;
...@@ -221,7 +223,7 @@ static void declip(float *lap,float *out, ...@@ -221,7 +223,7 @@ static void declip(float *lap,float *out,
*runningtotal+=blocksize; *runningtotal+=blocksize;
*runningcount+=count; *runningcount+=count;
if(declip_active){ if(active){
for(i=0;i<blocksize/2;i++)flag[i]=0.; for(i=0;i<blocksize/2;i++)flag[i]=0.;
for(i=blocksize*3/2;i<blocksize*2;i++)flag[i]=0.; for(i=blocksize*3/2;i<blocksize*2;i++)flag[i]=0.;
...@@ -323,7 +325,7 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -323,7 +325,7 @@ time_linkage *declip_read(time_linkage *in){
memcpy(work+blocksize,temp,sizeof(*work)*blocksize/2); memcpy(work+blocksize,temp,sizeof(*work)*blocksize/2);
declip(lap[i],0,blocksize, declip(lap[i],0,blocksize,
local_trigger[i],local_convergence,local_iterations, 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); memset(cache[i],0,sizeof(**cache)*input_size);
in->data[i]=cache[i]; in->data[i]=cache[i];
...@@ -347,14 +349,14 @@ time_linkage *declip_read(time_linkage *in){ ...@@ -347,14 +349,14 @@ time_linkage *declip_read(time_linkage *in){
memcpy(work+blocksize/2,temp+j,sizeof(*work)*blocksize); memcpy(work+blocksize/2,temp+j,sizeof(*work)*blocksize);
declip(lap[i],out.data[i]+j,blocksize, declip(lap[i],out.data[i]+j,blocksize,
local_trigger[i],local_convergence,local_iterations, 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/2,temp+j,sizeof(*work)*blocksize/2);
memcpy(work+blocksize,in->data[i],sizeof(*work)*blocksize/2); memcpy(work+blocksize,in->data[i],sizeof(*work)*blocksize/2);
declip(lap[i],out.data[i]+j,blocksize, declip(lap[i],out.data[i]+j,blocksize,
local_trigger[i],local_convergence,local_iterations, 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]; cache[i]=in->data[i];
in->data[i]=temp; in->data[i]=temp;
......
...@@ -66,11 +66,13 @@ void eqpanel_create(postfish_mainpanel *mp, ...@@ -66,11 +66,13 @@ void eqpanel_create(postfish_mainpanel *mp,
"30","20","10","0","+10","+20","+30"}; "30","20","10","0","+10","+20","+30"};
float levels[16]={-120,-110,-100,-90,-80,-70,-60,-50,-40, float levels[16]={-120,-110,-100,-90,-80,-70,-60,-50,-40,
-30,-20,-10,0,10,20,30}; -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_active,
&eq_visible, &eq_visible,
"_Equalization filter"," [e] "); "_Equalization filter",shortcut,
0,1);
GtkWidget *slidertable=gtk_table_new(eq_freqs,3,0); GtkWidget *slidertable=gtk_table_new(eq_freqs,3,0);
......
...@@ -105,10 +105,13 @@ void limitpanel_create(postfish_mainpanel *mp, ...@@ -105,10 +105,13 @@ void limitpanel_create(postfish_mainpanel *mp,
float timing_levels[6]={.1,1,10,100,1000,10000}; float timing_levels[6]={.1,1,10,100,1000,10000};
char *timing_labels[5]={"1ms","10ms","100ms","1s","10s"}; 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_active,
&limit_visible, &limit_visible,
"Hard _Limiter"," [l] "); "Hard _Limiter",shortcut,
0,1);
GtkWidget *slidertable=gtk_table_new(4,4,0); GtkWidget *slidertable=gtk_table_new(4,4,0);
......
...@@ -469,7 +469,7 @@ static void mainpanel_chentry(postfish_mainpanel *p, ...@@ -469,7 +469,7 @@ static void mainpanel_chentry(postfish_mainpanel *p,
int channelwinp, int channelwinp,
void (*panel_create) void (*panel_create)
(postfish_mainpanel *, (postfish_mainpanel *,
GtkWidget *, GtkWidget *)){ GtkWidget **, GtkWidget **)){
int j; int j;
GtkWidget *wm[input_ch]; GtkWidget *wm[input_ch];
...@@ -528,8 +528,7 @@ static void mainpanel_chentry(postfish_mainpanel *p, ...@@ -528,8 +528,7 @@ static void mainpanel_chentry(postfish_mainpanel *p,
} }
//p->buttonactive[i]=wa; if(panel_create)(*panel_create)(p,wm,wa);
//if(panel_create)(*panel_create)(p,ww,wa);
} }
static void mainpanel_masterentry(postfish_mainpanel *p, static void mainpanel_masterentry(postfish_mainpanel *p,
...@@ -977,7 +976,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){ ...@@ -977,7 +976,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
} }
mainpanel_chentry(panel,channeltable,"Mute ",0,0,0,0); 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,"_Multicomp ",2,0,1,0);
mainpanel_chentry(panel,channeltable,"_Onecomp ",3,0,1,0); mainpanel_chentry(panel,channeltable,"_Onecomp ",3,0,1,0);
mainpanel_chentry(panel,channeltable,"De_verb ",4,1,0,0); mainpanel_chentry(panel,channeltable,"De_verb ",4,1,0,0);
......
...@@ -454,178 +454,112 @@ static void draw(GtkWidget *widget,int n){ ...@@ -454,178 +454,112 @@ static void draw(GtkWidget *widget,int n){
/* draw slider thumbs */ /* draw slider thumbs */
if(m->thumbs){ if(m->thumbs){
int height=widget->allocation.height; int height=widget->allocation.height,i,j;
GdkGC *black_gc=widget->style->black_gc; GdkGC *black_gc=widget->style->black_gc;
int y=height/2-3; int y=height/2-3;
int y0=height/3-1; int y0=height/3-1;
int y1=height-3; 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}; GdkColor yellow={0,0xff00,0xd000,0};
if(m->thumbs==1){ if(m->thumbs==2){
/* single thumb: wide center */ /* adjustment required for overlapping thumbs? */
GdkGC *gc=widget->style->bg_gc[m->thumbstate[0]]; int mid=m->thumbpixel[1]-m->thumbpixel[0]-1;
GdkGC *light_gc=widget->style->light_gc[m->thumbstate[0]]; int midA=(mid<0?0:mid)/2;
GdkGC *dark_gc=widget->style->dark_gc[m->thumbstate[0]]; 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); if(m->thumbs==3){
gdk_draw_line(m->backing,dark_gc,x-1,y1,x-1,y0+1); /* 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(midA<D[0])D[0]=midA;
if(x&1) if(D[0]<C[0]+2)D[0]=C[0]+2;
gdk_gc_set_stipple(black_gc,stipple); if(midB<A[1])A[1]=midB;
else if(A[1]<B[1]+2)A[1]=B[1]+2;
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);
gdk_draw_line(m->backing,black_gc,x2,y1+1,x,y1+1); /* adjust for 1,2 overlap if any */
gdk_draw_line(m->backing,black_gc,x,y1+1,x,y0);
mid=m->thumbpixel[2]-m->thumbpixel[1]-1;
gdk_gc_set_rgb_fg_color(m->boxcolor,&yellow); midA=(mid<0?0:mid)/2;
gdk_draw_line(m->backing,m->boxcolor,x,y1-1,x,0); midB=(mid<0?0:mid)-midA;
} if(midA<D[1])D[1]=midA;
/* two thumbs: right */ 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); int x=m->thumbpixel[j]+xpad;
GdkGC *gc=widget->style->bg_gc[m->thumbstate[num]]; GdkPoint p[8]={ {x+D[j],y0+C[j]},
GdkGC *light_gc=widget->style->light_gc[m->thumbstate[num]]; {x+C[j],y0+C[j]},
GdkGC *dark_gc=widget->style->dark_gc[m->thumbstate[num]]; {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; GdkPoint d[3]={ {x-A[j]+1,y1},
int x1=x+(y1-y-2); {x+D[j]-1,y1},
int x3=x1+y*3/2; {x+D[j]-1,y0+C[j]+1}};
GdkPoint tp[5]={ {x,y0},{x+yM,y0+yM},{x3,y0+yM},{x3,y1+1}, GdkGC *gc=widget->style->bg_gc[m->thumbstate[j]];
{x,y1+1}}; 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,tp,5);
gdk_draw_polygon(m->backing,gc,TRUE,p,7);
gdk_draw_line(m->backing,dark_gc,x+1,y1,x3-1,y1); gdk_draw_lines(m->backing,dark_gc,d,3);
gdk_draw_line(m->backing,dark_gc,x3-1,y1,x3-1,y0+yM+1);
if(m->thumbfocus==j){
if(m->thumbfocus==num){
if(x&1) if(x&1)
gdk_gc_set_stipple(black_gc,stipple); gdk_gc_set_stipple(black_gc,stipple);
else else
gdk_gc_set_stipple(black_gc,stippleB); gdk_gc_set_stipple(black_gc,stippleB);
gdk_gc_set_fill(black_gc,GDK_STIPPLED); 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_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; gdk_draw_lines(m->backing,light_gc,p,6);
int x0=x-(y1-y0-3); gdk_draw_lines(m->backing,black_gc,p+5,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_gc_set_rgb_fg_color(m->boxcolor,&yellow); gdk_gc_set_rgb_fg_color(m->boxcolor,&yellow);
gdk_draw_line(m->backing,m->boxcolor,x,y1-1,x,0); gdk_draw_line(m->backing,m->boxcolor,x,y1-1,x,0);
} }
} }
} }
......
...@@ -232,7 +232,7 @@ void *playback_thread(void *dummy){ ...@@ -232,7 +232,7 @@ void *playback_thread(void *dummy){
/* get data */ /* get data */
link=input_read(); link=input_read();
result=link->samples; result=link->samples;
//link=declip_read(link); link=declip_read(link);
result|=link->samples; result|=link->samples;
link=multicompand_read(link); link=multicompand_read(link);
result|=link->samples; result|=link->samples;
......
...@@ -217,11 +217,13 @@ void singlepanel_create(postfish_mainpanel *mp, ...@@ -217,11 +217,13 @@ void singlepanel_create(postfish_mainpanel *mp,
float per_levels[9]={0,12.5,25,37.5,50,62.5,75,87.5,100}; 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 *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_active,
&singlecomp_visible, &singlecomp_visible,
"_Oneband Compand"," o "); "_Oneband Compand",shortcut,
0,1);
GtkWidget *sliderframe=gtk_frame_new(NULL); GtkWidget *sliderframe=gtk_frame_new(NULL);
GtkWidget *allbox=gtk_vbox_new(0,0); GtkWidget *allbox=gtk_vbox_new(0,0);
......
...@@ -63,17 +63,23 @@ static int windowbutton_action(GtkWidget *widget, ...@@ -63,17 +63,23 @@ static int windowbutton_action(GtkWidget *widget,
static int activebutton_action(GtkWidget *widget, static int activebutton_action(GtkWidget *widget,
gpointer in){ gpointer in){
subpanel_generic *p=in; subpanel_generic *p=in;
int active; int active,i;
if(widget==p->subpanel_activebutton){ for(i=0;i<p->active_button_count;i++){
active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->subpanel_activebutton)); if(widget==p->subpanel_activebutton[i]){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->mainpanel_activebutton),active); active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->subpanel_activebutton[i]));
}else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->mainpanel_activebutton[i]),active);
active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->mainpanel_activebutton)); p->activevar[i]=active;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->subpanel_activebutton),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; return FALSE;
} }
...@@ -97,6 +103,14 @@ static gboolean rebind_space(GtkWidget *widget, ...@@ -97,6 +103,14 @@ static gboolean rebind_space(GtkWidget *widget,
static gboolean forward_events(GtkWidget *widget, static gboolean forward_events(GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
gpointer in){ 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; subpanel_generic *p=in;
GdkEvent copy=*(GdkEvent *)event; GdkEvent copy=*(GdkEvent *)event;
copy.any.window=p->mainpanel->toplevel->window; copy.any.window=p->mainpanel->toplevel->window;
...@@ -110,10 +124,11 @@ void subpanel_show_all_but_toplevel(subpanel_generic *s){ ...@@ -110,10 +124,11 @@ void subpanel_show_all_but_toplevel(subpanel_generic *s){
subpanel_generic *subpanel_create(postfish_mainpanel *mp, subpanel_generic *subpanel_create(postfish_mainpanel *mp,
GtkWidget *windowbutton, GtkWidget *windowbutton,
GtkWidget *activebutton, GtkWidget **activebutton,
sig_atomic_t *activevar, sig_atomic_t *activevar,
sig_atomic_t *mappedvar, sig_atomic_t *mappedvar,
char *prompt,char *shortcut){ char *prompt,char **shortcut,
int start,int num){
subpanel_generic *panel=calloc(1,sizeof(*panel)); subpanel_generic *panel=calloc(1,sizeof(*panel));
...@@ -121,22 +136,36 @@ subpanel_generic *subpanel_create(postfish_mainpanel *mp, ...@@ -121,22 +136,36 @@ subpanel_generic *subpanel_create(postfish_mainpanel *mp,
GtkWidget *toplabelframe=gtk_frame_new(NULL); GtkWidget *toplabelframe=gtk_frame_new(NULL);
GtkWidget *toplabel=gtk_hbox_new(0,0); GtkWidget *toplabel=gtk_hbox_new(0,0);
GtkWidget *toplabelwb=windowbutton_new(prompt); 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_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_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->activevar=activevar;
panel->mappedvar=mappedvar; panel->mappedvar=mappedvar;
gtk_box_pack_start(GTK_BOX(toplabel),toplabelwb,0,0,5); 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);