Commit d997451b authored by Monty Montgomery's avatar Monty Montgomery

Large chunk of the compander panel implemented; not yet active at all


git-svn-id: https://svn.xiph.org/trunk/postfish@5851 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent ca66dc34
......@@ -63,7 +63,7 @@ static void trigger_slider_change(GtkWidget *w,gpointer in){
sprintf(buffer,"%1.2f",linear);
readout_set(READOUT(p->readout),buffer);
sprintf(buffer,"%3.0f dB",todB(linear));
sprintf(buffer,"%3.0fdB",todB(linear));
readout_set(READOUT(p->readoutdB),buffer);
declip_settrigger(linear,p->number);
......@@ -75,13 +75,13 @@ static void blocksize_slider_change(GtkWidget *w,gpointer in){
int choice=rint(gtk_range_get_value(GTK_RANGE(w)));
int blocksize=64<<choice;
sprintf(buffer,"%5d ",blocksize);
sprintf(buffer,"%5d ",blocksize);
readout_set(READOUT(samplereadout),buffer);
sprintf(buffer,"%3.1f ms",blocksize*1000./input_rate);
sprintf(buffer,"%3.1fms",blocksize*1000./input_rate);
readout_set(READOUT(msreadout),buffer);
sprintf(buffer,"%5d Hz",(int)rint(input_rate*2./blocksize));
sprintf(buffer,"%5dHz",(int)rint(input_rate*2./blocksize));
readout_set(READOUT(hzreadout),buffer);
declip_setblock(blocksize);
......@@ -150,9 +150,9 @@ void clippanel_create(postfish_mainpanel *mp,
GtkWidget *samplelabel=gtk_label_new("window sample width");
GtkWidget *mslabel=gtk_label_new("window time width");
GtkWidget *hzlabel=gtk_label_new("approximate lowest response");
samplereadout=readout_new("00000 ");
msreadout=readout_new("00000 ms");
hzreadout=readout_new("00000 Hz");
samplereadout=readout_new("00000 ");
msreadout=readout_new("00000ms");
hzreadout=readout_new("00000Hz");
gtk_scale_set_draw_value(GTK_SCALE(slider),FALSE);
gtk_misc_set_alignment(GTK_MISC(samplelabel),1,.5);
......@@ -255,7 +255,7 @@ void clippanel_create(postfish_mainpanel *mp,
GtkWidget *slider=multibar_new(8,slabels,slevels,1,
HI_DECAY|ZERO_DAMP);
GtkWidget *readout=readout_new("0.00");
GtkWidget *readoutdB=readout_new("-40 dB");
GtkWidget *readoutdB=readout_new("-40dB");
GtkWidget *bar=multibar_new(2,labels,levels,0,
HI_DECAY|ZERO_DAMP);
......
This diff is collapsed.
......@@ -51,7 +51,7 @@ static void slider_change(GtkWidget *w,gpointer in){
bar *b=(bar *)in;
gdouble val=multibar_get_value(MULTIBAR(b->slider),0);
sprintf(buffer,"%+3.0f dB",val);
sprintf(buffer,"%+3.0fdB",val);
readout_set(READOUT(b->readout),buffer);
eq_set(b->number,val);
......@@ -80,7 +80,7 @@ void eqpanel_create(postfish_mainpanel *mp,
GtkWidget *label=gtk_label_new(labeltext);
gtk_widget_set_name(label,"smallmarker");
bars[i].readout=readout_new("+00 dB");
bars[i].readout=readout_new("+00dB");
bars[i].slider=multibar_new(15,labels,levels,1,
LO_DECAY|HI_DECAY|LO_ATTACK|HI_ATTACK);
bars[i].number=i;
......
......@@ -262,7 +262,7 @@ static void masterdB_change(GtkWidget *dummy, gpointer in){
postfish_mainpanel *p=in;
char buf[80];
gdouble val=multibar_get_value(MULTIBAR(p->masterdB_s),0);
sprintf(buf,"%.1f dB",val);
sprintf(buf,"%.1fdB",val);
readout_set(READOUT(p->masterdB_r),buf);
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p->masterdB_a)))
......@@ -518,7 +518,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
}else{
version="";
}
snprintf(versionmarkup,240,"<span size=\"large\" weight=\"bold\" "
snprintf(versionmarkup,240," <span size=\"large\" weight=\"bold\" "
"style=\"italic\" foreground=\"dark blue\">"
"Postfish</span> <span size=\"small\" foreground=\"#606060\">"
"version %s</span> ",
......@@ -662,7 +662,7 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
GtkWidget *masterlabel=gtk_label_new("master:");
panel->masterdB_a=gtk_toggle_button_new_with_label("[m] active");
panel->masterdB_r=readout_new(" 0.0 dB");
panel->masterdB_r=readout_new(" 0.0dB");
panel->masterdB_s=multibar_slider_new(10,sliderlabels,sliderlevels,1);
multibar_thumb_set(MULTIBAR(panel->masterdB_s),0.,0);
......
......@@ -69,7 +69,7 @@ static void compute(Multibar *m,double *lowvals, double *highvals, int n){
xpad=2;
}else{
if(m->thumbs>1)
xpad=height+(height/2-1)/2-1;
xpad=height*3/4+6;
else
xpad=height/2+1;
}
......@@ -360,7 +360,7 @@ static void draw(GtkWidget *widget,int n){
int px,py;
int gc=0;
if(m->levels[i]>=0)gc=1;
if(m->levels[i]>0.)gc=1;
gdk_draw_line (m->backing,
widget->style->text_gc[gc],
......@@ -381,8 +381,9 @@ static void draw(GtkWidget *widget,int n){
/* draw frame */
{
int width=widget->allocation.width-xpad;
int width=widget->allocation.width;
int height=widget->allocation.height;
int apad=(m->thumbs<2?-height/2+2:3-xpad);
GdkGC *gc=parent->style->bg_gc[0];
GdkGC *light_gc=parent->style->light_gc[0];
GdkGC *dark_gc=parent->style->dark_gc[0];
......@@ -390,28 +391,28 @@ static void draw(GtkWidget *widget,int n){
/* blank side padding to bg of parent */
gdk_draw_rectangle(m->backing,gc,1,0,0,xpad,height);
gdk_draw_rectangle(m->backing,gc,1,width+1,0,xpad-1,height);
gdk_draw_rectangle(m->backing,gc,1,width-xpad+1,0,xpad-1,height);
/* blank sides of trough */
gdk_draw_rectangle(m->backing,gc,1,
0,height-lpad,
m->thumblo_x+xpad-1,lpad);
m->thumblo_x+xpad+apad-1,lpad);
gdk_draw_rectangle(m->backing,gc,1,
m->thumbhi_x+xpad,height-lpad,
width-m->thumbhi_x,lpad);
m->thumbhi_x+xpad-apad,height-lpad,
width-xpad+apad-m->thumbhi_x,lpad);
/* frame */
if(m->readout){
gdk_draw_line(m->backing,dark_gc,xpad-1,0,width,0);
gdk_draw_line(m->backing,dark_gc,xpad-1,0,width-xpad,0);
gdk_draw_line(m->backing,dark_gc,xpad-1,0,xpad-1,height-lpad);
gdk_draw_line(m->backing,dark_gc,xpad,height-lpad,width,height-lpad);
gdk_draw_line(m->backing,dark_gc,width,height-lpad,width,1);
gdk_draw_line(m->backing,dark_gc,xpad,height-lpad,width-xpad,height-lpad);
gdk_draw_line(m->backing,dark_gc,width-xpad,height-lpad,width-xpad,1);
gdk_draw_line(m->backing,light_gc,xpad-1,height-lpad+1,
width+1,height-lpad+1);
gdk_draw_line(m->backing,light_gc,width+1,0,width+1,height-lpad+1);
gdk_draw_line(m->backing,light_gc,xpad,1,width-1,1);
width-xpad+1,height-lpad+1);
gdk_draw_line(m->backing,light_gc,width-xpad+1,0,width-xpad+1,height-lpad+1);
gdk_draw_line(m->backing,light_gc,xpad,1,width-xpad-1,1);
gdk_draw_line(m->backing,light_gc,xpad,1,xpad,height-lpad-1);
}
......@@ -420,29 +421,29 @@ static void draw(GtkWidget *widget,int n){
if(lpad>2 || m->readout==0){
if(lpad>2){
gdk_draw_rectangle(m->backing,mid_gc,1,
xpad+m->thumblo_x,height-lpad+1,
m->thumbhi_x-m->thumblo_x+1,lpad-1);
xpad+m->thumblo_x+apad,height-lpad+1,
m->thumbhi_x-m->thumblo_x-apad*2+1,lpad-1);
gdk_draw_line(m->backing,dark_gc,
m->thumblo_x+xpad-1,height-lpad,
m->thumblo_x+xpad-1,height-1);
m->thumblo_x+xpad+apad-1,height-lpad,
m->thumblo_x+xpad+apad-1,height-1);
}
gdk_draw_line(m->backing,light_gc,
m->thumblo_x+xpad-1,height-1,
m->thumbhi_x+xpad+1,height-1);
m->thumblo_x+xpad+apad-1,height-1,
m->thumbhi_x+xpad-apad+1,height-1);
dark_gc=widget->style->dark_gc[GTK_STATE_ACTIVE];
gdk_draw_line(m->backing,dark_gc,
m->thumblo_x+xpad-1,height-lpad,
m->thumbhi_x+xpad+1,height-lpad);
m->thumblo_x+xpad+apad-1,height-lpad,
m->thumbhi_x+xpad-apad+1,height-lpad);
if(lpad>2)
gdk_draw_line(m->backing,light_gc,
m->thumbhi_x+xpad+1,height-1,
m->thumbhi_x+xpad+1,height-lpad);
m->thumbhi_x+xpad-apad+1,height-1,
m->thumbhi_x+xpad-apad+1,height-lpad);
}
......@@ -644,6 +645,7 @@ static void size_request (GtkWidget *widget,GtkRequisition *requisition){
}
static int transition_thumbfocus=0;
static gboolean multibar_focus (GtkWidget *widget,
GtkDirectionType direction){
Multibar *m=MULTIBAR(widget);
......@@ -652,7 +654,6 @@ static gboolean multibar_focus (GtkWidget *widget,
if(m->thumbs==0)return FALSE;
switch(direction){
case GTK_DIR_DOWN:
case GTK_DIR_TAB_FORWARD:
case GTK_DIR_RIGHT:
if(m->thumbfocus+1>=m->thumbs){
......@@ -662,7 +663,6 @@ static gboolean multibar_focus (GtkWidget *widget,
m->thumbfocus++;
break;
case GTK_DIR_UP:
case GTK_DIR_TAB_BACKWARD:
case GTK_DIR_LEFT:
if(m->thumbfocus==-1)
......@@ -675,6 +675,21 @@ static gboolean multibar_focus (GtkWidget *widget,
m->thumbfocus--;
}
break;
case GTK_DIR_UP:
case GTK_DIR_DOWN:
if(m->thumbfocus==-1){
if(transition_thumbfocus>=0 && transition_thumbfocus<m->thumbs)
m->thumbfocus=transition_thumbfocus;
else
m->thumbfocus=0;
ret=TRUE;
}else{
transition_thumbfocus=m->thumbfocus;
ret=FALSE;
}
break;
default:
ret=FALSE;
}
......@@ -916,18 +931,15 @@ static gint button_press (GtkWidget *widget,
Multibar *m=MULTIBAR(widget);
if(m->thumbstate[0]){
gtk_widget_grab_focus(widget);
m->thumbgrab=0;
m->thumbfocus=0;
transition_thumbfocus=m->thumbgrab=m->thumbfocus=0;
m->thumbx=m->thumbpixel[0]-event->x;
}else if(m->thumbstate[1]){
gtk_widget_grab_focus(widget);
m->thumbgrab=1;
m->thumbfocus=1;
transition_thumbfocus=m->thumbgrab=m->thumbfocus=1;
m->thumbx=m->thumbpixel[1]-event->x;
}else if(m->thumbstate[2]){
gtk_widget_grab_focus(widget);
m->thumbgrab=2;
m->thumbfocus=2;
transition_thumbfocus=m->thumbgrab=m->thumbfocus=2;
m->thumbx=m->thumbpixel[2]-event->x;
}
draw_and_expose(widget);
......@@ -951,7 +963,7 @@ static gboolean unfocus(GtkWidget *widget,
static gboolean refocus(GtkWidget *widget,
GdkEventFocus *event){
Multibar *m=MULTIBAR(widget);
m->thumbfocus=m->prev_thumbfocus;
transition_thumbfocus=m->thumbfocus=m->prev_thumbfocus;
m->thumbgrab=-1;
draw_and_expose(widget);
}
......@@ -1013,9 +1025,6 @@ gboolean key_press(GtkWidget *w,GdkEventKey *event){
}
if(m->callback)m->callback(GTK_WIDGET(m),m->callbackp);
draw_and_expose(w);
......
......@@ -138,7 +138,7 @@ style "side" {
}
widget "*.GtkLabel" style "panel-text"
widget "*.smallmarker" style "small-marker"
widget "*.smallmarker*" style "small-marker"
widget "*.color0" style "left"
widget "*.color1" style "right"
......
#define VERSION "$Id: version.h,v 1.35 2004/02/20 02:09:39 xiphmont Exp $ "
/* DO NOT EDIT: Automated versioning hack [Thu Feb 19 21:08:12 EST 2004] */
#define VERSION "$Id: version.h,v 1.36 2004/02/20 06:06:00 xiphmont Exp $ "
/* DO NOT EDIT: Automated versioning hack [Fri Feb 20 01:04:55 EST 2004] */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment