Commit dac04b7d authored by Monty Montgomery's avatar Monty Montgomery

Some quick UI additions; extend multibar to offer sliders.


git-svn-id: https://svn.xiph.org/trunk/postfish@5826 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 481958ad
......@@ -56,7 +56,7 @@ typedef struct {
static void trigger_slider_change(GtkWidget *w,gpointer in){
char buffer[80];
clipslider *p=(clipslider *)in;
gdouble linear=gtk_range_get_value(GTK_RANGE(p->slider))*.01;
gdouble linear=multibar_get_value(MULTIBAR(p->slider),0);
sprintf(buffer,"%1.2f",linear);
readout_set(READOUT(p->readout),buffer);
......@@ -125,7 +125,7 @@ void clippanel_create(postfish_mainpanel *mp,
GtkWidget *limit_frame=gtk_frame_new (" filter CPU throttle ");
GtkWidget *converge_box=gtk_vbox_new(0,0);
GtkWidget *limit_box=gtk_vbox_new(0,0);
GtkWidget *channel_table=gtk_table_new(input_ch,4,0);
GtkWidget *channel_table=gtk_table_new(input_ch,5,0);
gtk_widget_set_name(blocksize_box,"choiceframe");
gtk_widget_set_name(converge_box,"choiceframe");
......@@ -240,28 +240,19 @@ void clippanel_create(postfish_mainpanel *mp,
gtk_range_set_value(GTK_RANGE(slider),100.);
}
gtk_container_add(GTK_CONTAINER(converge_frame),converge_box);
gtk_container_add(GTK_CONTAINER(limit_frame),limit_box);
gtk_box_pack_start(GTK_BOX(framebox),blocksize_frame,1,1,4);
gtk_box_pack_start(GTK_BOX(framebox),framebox_right,1,1,4);
gtk_box_pack_start(GTK_BOX(framebox_right),converge_frame,1,1,0);
gtk_box_pack_start(GTK_BOX(framebox_right),limit_frame,1,1,0);
gtk_box_pack_start(GTK_BOX(panel->subpanel_box),framebox,0,1,4);
gtk_box_pack_start(GTK_BOX(panel->subpanel_box),channel_table,0,1,4);
for(i=0;i<input_ch;i++){
char *slabels[8]={".05",".1",".2",".3",".4",
".6",".8","1."};
double slevels[9]={.01,.05,.1,.2,.3,.4,.6,
.8,1.};
char buffer[80];
clipslider *cs=calloc(1,sizeof(*cs));
GtkWidget *label;
GtkWidget *slider=gtk_hscale_new_with_range(1,100,1);
GtkWidget *slider=multibar_new(8,slabels,slevels,HI_DECAY|ZERO_DAMP|PEAK_FOLLOW);
GtkWidget *readout=readout_new("0.00");
GtkWidget *readoutdB=readout_new("-40 dB");
GtkWidget *barframe=gtk_frame_new(NULL);
GtkWidget *bar=multibar_new(2,labels,levels,HI_DECAY|ZERO_DAMP);
GtkWidget *bar=multibar_new(2,labels,levels,HI_DECAY|ZERO_DAMP|PEAK_FOLLOW);
cs->slider=slider;
cs->readout=readout;
......@@ -269,11 +260,9 @@ void clippanel_create(postfish_mainpanel *mp,
cs->number=i;
feedback_bars[i]=bar;
gtk_widget_set_size_request (slider,200,-1);
gtk_widget_set_name(bar,"clipbar");
gtk_scale_set_draw_value(GTK_SCALE(slider),FALSE);
gtk_range_set_value(GTK_RANGE(slider),100.);
gtk_frame_set_shadow_type(GTK_FRAME(barframe),GTK_SHADOW_ETCHED_IN);
multibar_thumb_set(MULTIBAR(slider),1.,0);
multibar_thumb_bounds(MULTIBAR(slider),.01,1.);
switch(input_ch){
case 1:
......@@ -298,19 +287,27 @@ void clippanel_create(postfish_mainpanel *mp,
gtk_table_attach(GTK_TABLE(channel_table),label,0,1,i,i+1,GTK_FILL,GTK_FILL,2,0);
gtk_table_attach(GTK_TABLE(channel_table),readout,1,2,i,i+1,GTK_FILL,GTK_FILL,0,0);
gtk_table_attach(GTK_TABLE(channel_table),readoutdB,2,3,i,i+1,GTK_FILL,GTK_FILL,0,0);
gtk_table_attach_defaults(GTK_TABLE(channel_table),slider,3,4,i,i+1);
gtk_table_attach(GTK_TABLE(channel_table),barframe,4,5,i,i+1,GTK_FILL,GTK_FILL,0,0);
gtk_container_add(GTK_CONTAINER(barframe),bar);
gtk_table_attach(GTK_TABLE(channel_table),slider,3,4,i,i+1,GTK_FILL|GTK_EXPAND,GTK_FILL,0,0);
gtk_table_attach(GTK_TABLE(channel_table),bar,4,5,i,i+1,GTK_FILL,GTK_FILL,0,0);
multibar_callback(MULTIBAR(slider),trigger_slider_change,(gpointer)cs);
g_signal_connect_after (G_OBJECT(slider), "value-changed",
G_CALLBACK(trigger_slider_change), (gpointer)cs);
g_signal_connect (G_OBJECT (slider), "key-press-event",
G_CALLBACK (slider_keymodify), NULL);
trigger_slider_change(NULL,cs);
}
gtk_container_add(GTK_CONTAINER(converge_frame),converge_box);
gtk_container_add(GTK_CONTAINER(limit_frame),limit_box);
gtk_box_pack_start(GTK_BOX(framebox),blocksize_frame,1,1,4);
gtk_box_pack_start(GTK_BOX(framebox),framebox_right,1,1,4);
gtk_box_pack_start(GTK_BOX(framebox_right),converge_frame,1,1,0);
gtk_box_pack_start(GTK_BOX(framebox_right),limit_frame,1,1,0);
gtk_box_pack_start(GTK_BOX(panel->subpanel_box),framebox,1,1,4);
gtk_box_pack_start(GTK_BOX(panel->subpanel_box),channel_table,1,1,4);
mainpanel_inbar=mp->inbar;
}
......
......@@ -592,11 +592,9 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
GtkWidget *in=gtk_label_new("in:");
GtkWidget *out=gtk_label_new("out:");
GtkWidget *show=gtk_label_new("show:");
GtkWidget *inframe=gtk_frame_new(NULL);
GtkWidget *outframe=gtk_frame_new(NULL);
panel->inbar=multibar_new(12,labels,levels, LO_ATTACK|LO_DECAY|HI_DECAY );
panel->outbar=multibar_new(12,labels,levels, LO_ATTACK|LO_DECAY|HI_DECAY );
panel->inbar=multibar_new(12,labels,levels, LO_ATTACK|LO_DECAY|HI_DECAY|PEAK_FOLLOW );
panel->outbar=multibar_new(12,labels,levels, LO_ATTACK|LO_DECAY|HI_DECAY|PEAK_FOLLOW );
gtk_container_set_border_width(GTK_CONTAINER (ttable), 3);
gtk_table_set_col_spacings(GTK_TABLE(ttable),5);
......@@ -619,17 +617,12 @@ void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
panel->channelshow[i]=button;
}
gtk_frame_set_shadow_type(GTK_FRAME(inframe),GTK_SHADOW_ETCHED_IN);
gtk_frame_set_shadow_type(GTK_FRAME(outframe),GTK_SHADOW_ETCHED_IN);
gtk_container_add(GTK_CONTAINER(inframe),panel->inbar);
gtk_container_add(GTK_CONTAINER(outframe),panel->outbar);
gtk_table_attach_defaults(GTK_TABLE(ttable),togglebox,1,3,0,1);
gtk_table_attach(GTK_TABLE(ttable),show,0,1,0,1,GTK_FILL|GTK_SHRINK,GTK_FILL|GTK_SHRINK,0,0);
gtk_table_attach(GTK_TABLE(ttable),in,0,1,1,2,GTK_FILL|GTK_SHRINK,GTK_FILL|GTK_SHRINK,0,0);
gtk_table_attach(GTK_TABLE(ttable),out,0,1,2,3,GTK_FILL|GTK_SHRINK,GTK_FILL|GTK_SHRINK,0,0);
gtk_table_attach_defaults(GTK_TABLE(ttable),inframe,1,3,1,2);
gtk_table_attach_defaults(GTK_TABLE(ttable),outframe,1,3,2,3);
gtk_table_attach_defaults(GTK_TABLE(ttable),panel->inbar,1,3,1,2);
gtk_table_attach_defaults(GTK_TABLE(ttable),panel->outbar,1,3,2,3);
/* master dB slider */
......
This diff is collapsed.
......@@ -27,11 +27,13 @@ typedef struct bartack {
double pixeldeltalo;
} bartrack;
#define HI_ATTACK (1<<0)
#define LO_ATTACK (1<<1)
#define HI_DECAY (1<<2)
#define LO_DECAY (1<<3)
#define ZERO_DAMP (1<<4)
#define HI_ATTACK (1<<0)
#define LO_ATTACK (1<<1)
#define HI_DECAY (1<<2)
#define LO_DECAY (1<<3)
#define ZERO_DAMP (1<<4)
#define PEAK_FOLLOW (1<<5)
struct _Multibar{
......@@ -52,13 +54,28 @@ struct _Multibar{
bartrack *bartrackers;
int bars;
int dampen_flags;
int thumbs;
double thumbval[3];
int thumbpixel[3];
GtkStateType thumbstate[3];
int thumbfocus;
int prev_thumbfocus;
int thumbgrab;
int thumbx;
double thumblo;
double thumbhi;
int xpad;
void (*callback)(GtkWidget *,gpointer);
gpointer callbackp;
};
struct _MultibarClass{
GtkDrawingAreaClass parent_class;
void (* multibar) (Multibar *m);
};
GType multibar_get_type (void);
......@@ -66,10 +83,18 @@ GtkWidget* multibar_new (int n, char **labels, double *levels,
int flags);
void multibar_clear (Multibar *m);
void multibar_set (Multibar *m,double *lo,double *hi, int n);
void multibar_thumb_set (Multibar *m,double v, int n);
void multibar_setwarn (Multibar *m);
void multibar_reset (Multibar *m);
void multibar_callback (Multibar *m,
void (*callback)
(GtkWidget *,gpointer),
gpointer);
double multibar_get_value(Multibar *m,int n);
void multibar_thumb_bounds(Multibar *m,double lo, double hi);
G_END_DECLS
#endif
......@@ -33,17 +33,24 @@ style "check-poppy" {
style "slider" {
bg[NORMAL]="#80a0ff"
bg[PRELIGHT]="#c0f0ff"
GtkWidget::focus-padding = 0
GtkWidget::focus-line-width = 1
GtkWidget::interior-focus = 0
}
style "multibar" {
fg[NORMAL]="#404040"
fg[ACTIVE]="#ff8080"
text[NORMAL]="#c0c0d0"
text[ACTIVE]="#ffb0b0"
font_name = "sans 8"
bg[NORMAL]="#80a0ff"
bg[ACTIVE]="#c0f0ff"
bg[PRELIGHT]="#c0f0ff"
fg[NORMAL]="#000000"
fg[ACTIVE]="#ff8080"
fg[PRELIGHT]="#f0f080"
text[NORMAL]="#c0c0d0"
text[ACTIVE]="#ffb0b0"
font_name = "sans 8"
}
style "clipbar" {
......
......@@ -36,7 +36,6 @@ static void readout_init (Readout *r){
gtk_widget_show(box);
gtk_widget_show(r->label);
gtk_widget_show(r->sizelabel);
}
GType readout_get_type (void){
......
#define VERSION "$Id: version.h,v 1.26 2004/02/13 18:35:27 xiphmont Exp $ "
/* DO NOT EDIT: Automated versioning hack [Fri Feb 13 13:34:00 EST 2004] */
#define VERSION "$Id: version.h,v 1.27 2004/02/15 15:14:15 xiphmont Exp $ "
/* DO NOT EDIT: Automated versioning hack [Sun Feb 15 09:50:39 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