[xiph-commits] r18290 - trunk/spectrum
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Thu May 17 04:17:50 PDT 2012
Author: xiphmont
Date: 2012-05-17 04:17:50 -0700 (Thu, 17 May 2012)
New Revision: 18290
Modified:
trunk/spectrum/spec_panel.c
trunk/spectrum/spec_plot.c
trunk/spectrum/spectrum-gtkrc
trunk/spectrum/spectrum.c
trunk/spectrum/version.h
trunk/spectrum/wave_panel.c
trunk/spectrum/wave_plot.c
trunk/spectrum/wave_plot.h
trunk/spectrum/waveform-gtkrc
trunk/spectrum/waveform.c
Log:
Update waveform viewer UI for buttons above the plot
add trace separation functionality
Modified: trunk/spectrum/spec_panel.c
===================================================================
--- trunk/spectrum/spec_panel.c 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/spec_panel.c 2012-05-17 11:17:50 UTC (rev 18290)
@@ -522,8 +522,6 @@
gtk_box_pack_start(GTK_BOX(topbox),lefttable,1,1,0);
gtk_box_pack_start(GTK_BOX(topbox),righttopbox,0,0,0);
- panel->plot=plot_new(blocksize/2+1,inputs,channels,rate);
-
/* plot control checkboxes */
{
GtkWidget *al=plot_control_al=gtk_alignment_new(0,0,0,0);
@@ -578,8 +576,8 @@
}
/* add the spectrum plot box */
+ panel->plot=plot_new(blocksize/2+1,inputs,channels,rate);
gtk_table_attach_defaults (GTK_TABLE (lefttable), panel->plot,0,1,2,3);
- //gtk_table_set_row_spacing (GTK_TABLE (lefttable), 0, 4);
gtk_table_set_row_spacing (GTK_TABLE (lefttable), 2, 4);
gtk_table_set_col_spacing (GTK_TABLE (lefttable), 0, 2);
Modified: trunk/spectrum/spec_plot.c
===================================================================
--- trunk/spectrum/spec_plot.c 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/spec_plot.c 2012-05-17 11:17:50 UTC (rev 18290)
@@ -225,22 +225,6 @@
int phax = phase ? p->phax : 0;
int pwidth = width - padx - phax;
- if(phase){
- /* are any of the phase channels actually active? */
- int gi;
- int ch=0;
-
- phase = 0;
- for(gi=0;gi<p->groups && !phase;gi++){
- if(p->ch_active[ch+1]){
- phase=1;
- break;
- }
-
- ch+=p->ch[gi];
- }
- }
-
if(!p->drawgc){
p->drawgc=gdk_gc_new(p->backing);
gdk_gc_copy(p->drawgc,widget->style->black_gc);
Modified: trunk/spectrum/spectrum-gtkrc
===================================================================
--- trunk/spectrum/spectrum-gtkrc 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/spectrum-gtkrc 2012-05-17 11:17:50 UTC (rev 18290)
@@ -41,7 +41,6 @@
}
-
style "controlpanel" {
bg[NORMAL]="#8ea0be"
@@ -62,9 +61,11 @@
base[ACTIVE]="#c0e0ff"
bg[NORMAL]="#b0c0d8"
bg[ACTIVE]="#c0e0ff"
+ bg[PRELIGHT]="#d0e6ff"
+ bg[SELECTED]="#d0e6ff"
base[PRELIGHT]="#d0e6ff"
base[SELECTED]="#d0e6ff"
- base[INSENSITIVE]="#b0c0d8"
+ base[INSENSITIVE]="#c0c0c0"
text[NORMAL]="#000000"
}
@@ -82,8 +83,6 @@
font_name = "sans 8"
}
-
-
style "scale-text" {
font_name = "sans 7"
}
Modified: trunk/spectrum/spectrum.c
===================================================================
--- trunk/spectrum/spectrum.c 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/spectrum.c 2012-05-17 11:17:50 UTC (rev 18290)
@@ -85,7 +85,6 @@
" PCM. Default bit depth is normally read from\n"
" the file/stream header or set to 16 bits\n"
" for raw input.\n"
-" -T --bold : plot spectrum with thicker/bolder lines.\n"
" -B -E --big-endian : Force input to be read as big endian.\n"
" Default endianness is normally read from the\n"
" file/stream header or set to host"
@@ -107,6 +106,7 @@
" Signedness is normally read from the \n"
" file/stream header or set to signed for raw\n"
" input.\n"
+" -T --bold : plot spectrum with thicker/bolder lines.\n"
" -u --unsigned : Force input to be read as unsigned PCM.\n"
" Signedness is normally read from the \n"
" file/stream header or set to signed for raw\n"
Modified: trunk/spectrum/version.h
===================================================================
--- trunk/spectrum/version.h 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/version.h 2012-05-17 11:17:50 UTC (rev 18290)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Wed May 16 17:38:13 EDT 2012] */
+/* DO NOT EDIT: Automated versioning hack [Thu May 17 07:11:05 EDT 2012] */
Modified: trunk/spectrum/wave_panel.c
===================================================================
--- trunk/spectrum/wave_panel.c 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/wave_panel.c 2012-05-17 11:17:50 UTC (rev 18290)
@@ -58,12 +58,19 @@
int plot_interval=0;
int plot_trigger=0;
int plot_hold=0;
+int plot_bold=0;
+int plot_sep=0;
+
int plot_type=0;
int plot_last_update=0;
int *active;
int overslice[MAX_FILES]= {-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1};
+static void override_base(GtkWidget *w, int active){
+ gtk_widget_modify_base (w, GTK_STATE_NORMAL, &w->style->bg[active?GTK_STATE_ACTIVE:GTK_STATE_NORMAL]);
+}
+
static void set_slices(int interval, int span){
/* update interval limited to < 25fps */
@@ -180,21 +187,33 @@
plot_rchoice=choice;
switch(choice){
case 0:
+ plot_range=16;
+ break;
+ case 1:
+ plot_range=8;
+ break;
+ case 2:
+ plot_range=4;
+ break;
+ case 3:
+ plot_range=2;
+ break;
+ case 4:
plot_range=1;
break;
- case 1:
+ case 5:
plot_range=.5;
break;
- case 2:
+ case 6:
plot_range=.2;
break;
- case 3:
+ case 7:
plot_range=.1;
break;
- case 4:
+ case 8:
plot_range=.01;
break;
- case 5:
+ case 9:
plot_range=.001;
break;
}
@@ -226,25 +245,35 @@
rangechange_ign=1;
if(choice==0){
- char *entries[]={"1.0",
- "0.5",
- "0.2",
- "0.1",
- "0.01",
- "0.001"};
- for(i=0;i<6;i++){
+ char *entries[]={
+ "16.0",
+ "8.0",
+ "4.0",
+ "2.0",
+ "1.0",
+ "0.5",
+ "0.2",
+ "0.1",
+ "0.01",
+ "0.001"};
+ for(i=0;i<10;i++){
gtk_combo_box_remove_text (GTK_COMBO_BOX (p->rangemenu), i);
gtk_combo_box_insert_text (GTK_COMBO_BOX (p->rangemenu), i, entries[i]);
}
}else{
- char *entries[]={"0dB",
- "-6dB",
- "-14dB",
- "-20dB",
- "-40dB",
- "-60dB"};
- for(i=0;i<6;i++){
+ char *entries[]={
+ "24dB",
+ "18dB",
+ "12dB",
+ "6dB",
+ "0dB",
+ "-6dB",
+ "-14dB",
+ "-20dB",
+ "-40dB",
+ "-60dB"};
+ for(i=0;i<10;i++){
gtk_combo_box_remove_text (GTK_COMBO_BOX (p->rangemenu), i);
gtk_combo_box_insert_text (GTK_COMBO_BOX (p->rangemenu), i, entries[i]);
}
@@ -377,10 +406,23 @@
static void holdchange(GtkWidget *widget,struct panel *p){
plot_hold=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ override_base(widget,plot_bold);
replot(p);
plot_draw(PLOT(p->plot));
}
+static void boldchange(GtkWidget *widget,struct panel *p){
+ plot_bold=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ override_base(widget,plot_bold);
+ plot_set_bold(PLOT(p->plot),plot_bold);
+}
+
+static void sepchange(GtkWidget *widget,struct panel *p){
+ plot_sep=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ override_base(widget,plot_sep);
+ plot_set_sep(PLOT(p->plot),plot_sep);
+}
+
static void plotchange(GtkWidget *widget,struct panel *p){
plot_type=gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
plot_setting(PLOT(p->plot),plot_range,plot_scale,plot_interval,plot_span,plot_rchoice,plot_schoice,plot_spanchoice,plot_type,blockslice,overslice);
@@ -424,31 +466,80 @@
void panel_create(struct panel *panel){
int i;
+ GdkWindow *root=gdk_get_default_root_window();
GtkWidget *topbox=gtk_hbox_new(0,0);
- GtkWidget *toplabel=gtk_label_new (NULL);
GtkWidget *rightframe=gtk_frame_new (NULL);
- GtkWidget *leftlabel=gtk_label_new (NULL);
- GdkWindow *root=gdk_get_default_root_window();
GtkWidget *righttopbox=gtk_vbox_new(0,0);
GtkWidget *rightframebox=gtk_event_box_new();
GtkWidget *rightbox=gtk_vbox_new(0,0);
- GtkWidget *lefttable=gtk_table_new(3,2,0);
+ GtkWidget *lefttable=gtk_table_new(4,2,0);
+ GtkWidget *plot_control_al;
+ GtkWidget *wbold;
- gtk_container_set_border_width (GTK_CONTAINER (righttopbox), 6);
- gtk_container_set_border_width (GTK_CONTAINER (rightbox), 6);
- gtk_widget_set_name(rightframebox,"controlpanel");
- gtk_widget_set_name(topbox,"panel");
+ active = calloc(total_ch,sizeof(*active));
panel->toplevel=gtk_window_new (GTK_WINDOW_TOPLEVEL);
panel->group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW(panel->toplevel), panel->group);
-
gtk_window_set_title(GTK_WINDOW(panel->toplevel),(const gchar *)"Waveform Viewer");
gtk_window_set_default_size(GTK_WINDOW(panel->toplevel),1024,400);
//gtk_widget_set_size_request(GTK_WIDGET(panel->toplevel),1024,400);
+ gtk_container_add (GTK_CONTAINER (panel->toplevel), topbox);
+ g_signal_connect (G_OBJECT (panel->toplevel), "delete_event",
+ G_CALLBACK (shutdown), NULL);
+ gtk_widget_set_name(topbox,"panel");
+ /* underlying boxes/frames */
+ gtk_box_pack_start(GTK_BOX(topbox),lefttable,1,1,0);
+ gtk_box_pack_start(GTK_BOX(topbox),righttopbox,0,0,0);
+
+ /* plot control checkboxes */
+ {
+ GtkWidget *al=plot_control_al=gtk_alignment_new(0,0,0,0);
+ GtkWidget *box=gtk_hbox_new(0,6);
+ GtkWidget *hold_display=gtk_check_button_new_with_mnemonic("_hold display");
+ GtkWidget *trace_sep=gtk_check_button_new_with_mnemonic("trace _separation");
+ wbold=gtk_check_button_new_with_mnemonic("_bold");
+ gtk_table_attach(GTK_TABLE (lefttable), al,0,1,1,2,GTK_FILL,GTK_FILL,0,0);
+ gtk_container_add(GTK_CONTAINER (al),box);
+ gtk_box_pack_start(GTK_BOX(box),hold_display,0,0,0);
+ gtk_box_pack_start(GTK_BOX(box),wbold,0,0,0);
+ gtk_box_pack_start(GTK_BOX(box),trace_sep,0,0,0);
+
+ gtk_widget_set_name(hold_display,"top-control");
+ gtk_widget_set_name(wbold,"top-control");
+ gtk_widget_set_name(trace_sep,"top-control");
+ g_signal_connect (G_OBJECT (hold_display), "clicked", G_CALLBACK (holdchange), panel);
+ gtk_widget_add_accelerator (hold_display, "activate", panel->group, GDK_h, 0, 0);
+ g_signal_connect (G_OBJECT (wbold), "clicked", G_CALLBACK (boldchange), panel);
+ gtk_widget_add_accelerator (wbold, "activate", panel->group, GDK_b, 0, 0);
+ g_signal_connect (G_OBJECT (trace_sep), "clicked", G_CALLBACK (sepchange), panel);
+ gtk_widget_add_accelerator (trace_sep, "activate", panel->group, GDK_s, 0, 0);
+
+ }
+
+ /* add the waveform plot box */
+ panel->plot=plot_new(blocksize,inputs,channels,rate);
+ gtk_table_attach_defaults (GTK_TABLE (lefttable), panel->plot,0,1,2,3);
+ gtk_table_set_row_spacing (GTK_TABLE (lefttable), 2, 4);
+ gtk_table_set_col_spacing (GTK_TABLE (lefttable), 0, 2);
+
+ /* right control frame */
+ gtk_container_set_border_width (GTK_CONTAINER (righttopbox), 6);
+ gtk_container_set_border_width (GTK_CONTAINER (rightbox), 6);
+ gtk_frame_set_shadow_type(GTK_FRAME(rightframe),GTK_SHADOW_ETCHED_IN);
+ gtk_widget_set_name(rightframebox,"controlpanel");
+ gtk_box_pack_end(GTK_BOX (righttopbox),rightframebox,1,1,0);
+ gtk_container_add (GTK_CONTAINER (rightframebox),rightframe);
+ gtk_container_add (GTK_CONTAINER (rightframe), rightbox);
+
+
/* the Fucking Fish */
{
+ GtkWidget *toptable = gtk_table_new(2,1,0);
+ GtkWidget *fishbox=gtk_alignment_new(.5,.5,0,0);
+ GtkWidget *sepbox=gtk_alignment_new(.5,.85,.7,0);
+ GtkWidget *topsep=gtk_hseparator_new();
GdkPixmap *tb;
GdkPixmap *tp=gdk_pixmap_create_from_xpm_d(root,&tb,NULL,fisharray_xpm);
GdkGC *cgc=gdk_gc_new(tp);
@@ -469,48 +560,16 @@
g_object_unref(bgc);
g_object_unref(tp);
g_object_unref(tb);
- }
- panel->twirlimage=gtk_image_new_from_pixmap(panel->ff[0],panel->fb[0]);
+ panel->twirlimage=gtk_image_new_from_pixmap(panel->ff[0],panel->fb[0]);
- active = calloc(total_ch,sizeof(*active));
-
- gtk_container_add (GTK_CONTAINER (panel->toplevel), topbox);
- gtk_frame_set_shadow_type(GTK_FRAME(rightframe),GTK_SHADOW_ETCHED_IN);
-
- g_signal_connect (G_OBJECT (panel->toplevel), "delete_event",
- G_CALLBACK (shutdown), NULL);
-
- /* underlying boxes/frames */
- gtk_box_pack_start(GTK_BOX(topbox),lefttable,1,1,0);
- gtk_box_pack_start(GTK_BOX(topbox),righttopbox,0,0,0);
-
- gtk_box_pack_end(GTK_BOX (righttopbox),rightframebox,1,1,0);
- gtk_container_add (GTK_CONTAINER (rightframebox),rightframe);
- gtk_container_add (GTK_CONTAINER (rightframe), rightbox);
-
- /* add the waveform plot box */
- panel->plot=plot_new(blocksize,inputs,channels,rate);
- gtk_table_attach_defaults (GTK_TABLE (lefttable), panel->plot,0,1,1,2);
- gtk_table_set_row_spacing (GTK_TABLE (lefttable), 0, 6);
- gtk_table_set_row_spacing (GTK_TABLE (lefttable), 1, 4);
- gtk_table_set_col_spacing (GTK_TABLE (lefttable), 0, 2);
-
- /* fish */
- {
- GtkWidget *toptable = gtk_table_new(1,1,0);
- GtkWidget *fishbox=gtk_alignment_new(.5,.5,0,0);
- GtkWidget *sepbox=gtk_alignment_new(.5,.85,.7,0);
- GtkWidget *topsep=gtk_hseparator_new();
-
-
gtk_container_set_border_width (GTK_CONTAINER (toptable), 1);
gtk_box_pack_start(GTK_BOX(righttopbox),toptable,0,0,0);
gtk_container_add (GTK_CONTAINER (sepbox), topsep);
gtk_container_add(GTK_CONTAINER(fishbox),panel->twirlimage);
gtk_table_attach_defaults (GTK_TABLE (toptable), fishbox,0,1,0,1);
gtk_table_attach_defaults (GTK_TABLE (toptable), sepbox,0,1,0,1);
-
+ gtk_table_set_row_spacing (GTK_TABLE (toptable), 0, 6);
}
/* rate */
@@ -568,8 +627,8 @@
GtkWidget *box=gtk_hbox_new(1,1);
GtkWidget *menu=gtk_combo_box_new_text();
- char *entries[]={"","","","","",""};
- for(i=0;i<6;i++)
+ char *entries[]={"","","","","","","","","",""};
+ for(i=0;i<10;i++)
gtk_combo_box_append_text (GTK_COMBO_BOX (menu), entries[i]);
g_signal_connect (G_OBJECT (menu), "changed",
G_CALLBACK (rangechange), panel);
@@ -585,7 +644,7 @@
gtk_box_pack_start(GTK_BOX(box),menu2,1,1,0);
gtk_box_pack_start(GTK_BOX(box),menu,1,1,0);
gtk_box_pack_start(GTK_BOX(bbox),box,0,0,0);
- gtk_combo_box_set_active(GTK_COMBO_BOX(menu),0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(menu),4);
gtk_combo_box_set_active(GTK_COMBO_BOX(menu2),0);
}
@@ -676,38 +735,32 @@
panel->run=button;
}
- /* hold */
/* loop */
+ /* rewind */
{
GtkWidget *box=gtk_hbox_new(1,1);
- GtkWidget *button=gtk_toggle_button_new_with_mnemonic("_hold");
- gtk_widget_add_accelerator (button, "activate", panel->group, GDK_h, 0, 0);
- g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (holdchange), panel);
- gtk_box_pack_start(GTK_BOX(box),button,1,1,0);
-
- button=gtk_toggle_button_new_with_mnemonic("_loop");
+ GtkWidget *button=gtk_toggle_button_new_with_mnemonic("_loop");
gtk_widget_add_accelerator (button, "activate", panel->group, GDK_l, 0, 0);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (loopchange), panel);
gtk_widget_set_sensitive(button,global_seekable);
-
gtk_box_pack_start(GTK_BOX(box),button,1,1,0);
- gtk_box_pack_start(GTK_BOX(bbox),box,0,0,0);
- }
- /* clear */
- /* rewind */
- {
- GtkWidget *button=gtk_button_new_with_mnemonic("re_wind");
+ button=gtk_button_new_with_mnemonic("re_wind");
gtk_widget_add_accelerator (button, "activate", panel->group, GDK_w, 0, 0);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (rewindchange), panel);
gtk_widget_set_sensitive(button,global_seekable);
- gtk_box_pack_start(GTK_BOX(bbox),button,1,1,0);
+ gtk_box_pack_start(GTK_BOX(box),button,1,1,0);
+ gtk_box_pack_start(GTK_BOX(bbox),box,0,0,0);
}
gtk_box_pack_end(GTK_BOX(rightbox),bbox,0,0,0);
gtk_widget_show_all(panel->toplevel);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wbold),plot_bold);
+
gtk_key_snooper_install(watch_keyboard,panel);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(plot_control_al),0,0,plot_get_left_pad(PLOT(panel->plot)),0);
+
}
static gboolean async_event_handle(GIOChannel *channel,
Modified: trunk/spectrum/wave_plot.c
===================================================================
--- trunk/spectrum/wave_plot.c 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/wave_plot.c 2012-05-17 11:17:50 UTC (rev 18290)
@@ -99,16 +99,28 @@
int width=widget->allocation.width;
GtkWidget *parent=gtk_widget_get_parent(widget);
int padx = p->padx;
+ int num_active=0;
+ /* how many channels actually active right now? Need to know if
+ trace sep is enabled */
+ if(p->trace_sep){
+ int fi,ch=0;
+ for(fi=0;fi<p->groups;fi++){
+ for(i=ch;i<ch+p->ch[fi];i++)
+ if(p->ch_active[i])
+ num_active++;
+ ch+=p->ch[fi];
+ }
+ }
+
if(!p->drawgc){
GdkGCValues values;
p->drawgc=gdk_gc_new(p->backing);
p->twogc=gdk_gc_new(p->backing);
gdk_gc_copy(p->drawgc,widget->style->black_gc);
gdk_gc_copy(p->twogc,widget->style->black_gc);
-
- gdk_gc_set_line_attributes(p->twogc,2,GDK_LINE_SOLID,GDK_CAP_BUTT,
- GDK_JOIN_MITER);
+ gdk_gc_set_line_attributes(p->twogc,p->bold+1,GDK_LINE_SOLID,
+ GDK_CAP_PROJECTING,GDK_JOIN_MITER);
}
/* clear the old rectangle out */
@@ -238,10 +250,18 @@
const GdkRectangle clip = {p->padx,0,width-p->padx,height-p->pady};
const GdkRectangle noclip = {0,0,width,height};
GdkColor rgb;
+ int y_sep=0;
+ int cp;
gdk_gc_set_clip_rectangle (p->twogc, &clip);
- //gdk_gc_set_clip_rectangle (p->drawgc, &clip);
+ if(p->trace_sep && num_active>1){
+ y_sep = (height-p->pady)/18*16/num_active;
+ cp = y_sep/2+(height-p->pady)/18;
+ }else{
+ cp = (height-p->pady)/2;
+ }
+
for(fi=0;fi<p->groups;fi++){
int copies = (int)ceil(p->blockslice[fi]/p->overslice[fi]);
int spann = ceil(p->rate[fi]/1000000.*p->span)+1;
@@ -251,14 +271,12 @@
int offset=0;
rgb = chcolor(i);
gdk_gc_set_rgb_fg_color(p->twogc,&rgb);
- //gdk_gc_set_rgb_fg_color(p->drawgc,&rgb);
for(j=0;j<copies;j++){
float *data=p->ydata[i]+offset;
int wp=width-p->padx;
float spani = 1000000./p->span/p->rate[fi]*wp;
int hp=height-p->pady;
- int cp=hp/2;
float ym=hp*-8./18;
switch(p->type){
@@ -280,7 +298,7 @@
}
if(!isnan(y0)){
gdk_draw_line(p->backing,p->twogc,
- x0+padx-1,rint(y0)+cp,x1+padx+1,rint(y0)+cp);
+ x0+padx,rint(y0)+cp,x1+padx,rint(y0)+cp);
if(!isnan(y1))
gdk_draw_line(p->backing,p->twogc,
@@ -415,6 +433,7 @@
offset+=spann;
}
+ cp+=y_sep;
}
}
ch+=p->ch[fi];
@@ -593,20 +612,20 @@
/* phase Y scale */
{
- char *label1[6] = {"1.0","0.5","0.2","0.1",".01",".001"};
- char *label1a[6] = {"0.5","0.25","0.1","0.05",".005",".0005"};
+ char *label1[10] = {"16.0","8.0","4.0","2.0","1.0","0.5","0.2","0.1",".01",".001"};
+ char *label1a[10] = {"8.0","4.0","2.0","1.0","0.5","0.25","0.1","0.05",".005",".0005"};
- char *labeln1[6] = {"-1.0","-0.5","-0.2","-0.1","-.01","-.001"};
- char *labeln1a[6] = {"-0.5","-0.25","-0.1","-0.05","-.005","-.0005"};
+ char *labeln1[10] = {"-16.0","-8.0","-4.0","-2.0","-1.0","-0.5","-0.2","-0.1","-.01","-.001"};
+ char *labeln1a[10] = {"-8.0","-4.0","-2.0","-1.0","-0.5","-0.25","-0.1","-0.05","-.005","-.0005"};
- char *label2[6] = {"0dB","-6dB","-14dB","-20dB","-40dB","-60dB"};
+ char *label2[10] = {"24dB","18dB","12dB","6dB","0dB","-6dB","-14dB","-20dB","-40dB","-60dB"};
char *label3[5] = {"0","-65dB","-96dB","-120dB","-160dB"};
- int val2[6] = {0,-6,-14,-20,-40,-60};
+ int val2[10] = {24,18,12,6,0,-6,-14,-20,-40,-60};
int val3[5] = {0,-65,-96,-120,-160};
- p->y_layout=calloc(6,sizeof(*p->y_layout));
- for(i=0;i<6;i++){
+ p->y_layout=calloc(10,sizeof(*p->y_layout));
+ for(i=0;i<10;i++){
p->y_layout[i]=calloc(5,sizeof(**p->y_layout));
p->y_layout[i][0]=calloc(6,sizeof(***p->y_layout));
@@ -630,7 +649,9 @@
}
p->ch_active=calloc(ch,sizeof(*p->ch_active));
-
+
+ p->autoscale=1;
+
plot_clear(p);
return ret;
}
@@ -704,3 +725,27 @@
draw_and_expose(widget);
}
+void plot_set_autoscale(Plot *p, int a){
+ GtkWidget *widget=GTK_WIDGET(p);
+ p->autoscale=a;
+ plot_refresh(p);
+ draw_and_expose(widget);
+}
+
+void plot_set_bold(Plot *p, int b){
+ GtkWidget *widget=GTK_WIDGET(p);
+ p->bold=b;
+ gdk_gc_set_line_attributes(p->twogc,p->bold+1,GDK_LINE_SOLID,
+ GDK_CAP_PROJECTING,GDK_JOIN_MITER);
+ draw_and_expose(widget);
+}
+
+void plot_set_sep(Plot *p, int b){
+ GtkWidget *widget=GTK_WIDGET(p);
+ p->trace_sep=b;
+ draw_and_expose(widget);
+}
+
+int plot_get_left_pad (Plot *m){
+ return m->padx;
+}
Modified: trunk/spectrum/wave_plot.h
===================================================================
--- trunk/spectrum/wave_plot.h 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/wave_plot.h 2012-05-17 11:17:50 UTC (rev 18290)
@@ -89,6 +89,9 @@
float phax;
float pady;
+ int bold;
+ int autoscale;
+ int trace_sep;
};
struct _PlotClass{
@@ -108,6 +111,10 @@
int plot_width (Plot *m);
float** plot_get (Plot *m);
void plot_set_active (Plot *m, int *);
+void plot_set_autoscale (Plot *m, int);
+void plot_set_bold (Plot *m, int);
+void plot_set_sep (Plot *m, int);
+int plot_get_left_pad (Plot *m);
GdkColor chcolor(int ch);
Modified: trunk/spectrum/waveform-gtkrc
===================================================================
--- trunk/spectrum/waveform-gtkrc 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/waveform-gtkrc 2012-05-17 11:17:50 UTC (rev 18290)
@@ -41,7 +41,6 @@
}
-
style "controlpanel" {
bg[NORMAL]="#b0a494"
@@ -55,6 +54,35 @@
}
+style "top-control" {
+ font_name = "sans 8"
+
+ base[NORMAL]="#c8c0b0"
+ base[ACTIVE]="#f0d8b4"
+ bg[NORMAL]="#c8c0b0"
+ bg[ACTIVE]="#f0d8b4"
+ bg[PRELIGHT]="#f0e0d0"
+ bg[SELECTED]="#f0e0d0"
+ base[PRELIGHT]="#f0e0d0"
+ base[SELECTED]="#f0e0d0"
+ base[INSENSITIVE]="#c0c0c0"
+
+ text[NORMAL]="#000000"
+}
+
+style "top-label" {
+ font_name = "sans 8"
+ fg[NORMAL]="#405080"
+ fg[PRELIGHT]="#405080"
+ fg[ACTIVE]="#405080"
+ fg[SELECTED]="#405080"
+ fg[INSENSITIVE]="#405080"
+}
+
+style "top-readout" {
+ font_name = "sans 8"
+}
+
style "panel-text" {
font_name = "sans 8"
fg[NORMAL]="#805050"
@@ -70,7 +98,11 @@
class "*" style "panel"
-widget "*.GtkLabel" style "panel-text"
+widget "*.top-control*" style "top-control"
+widget "*.top-label*" style "top-label"
+widget "*.top-readout*" style "top-readout"
+
+widget "*.controlpanel.GtkLabel" style "panel-text"
widget "*.Plot" style "scale-text"
widget "*.GtkEntry" style "readout"
Modified: trunk/spectrum/waveform.c
===================================================================
--- trunk/spectrum/waveform.c 2012-05-16 23:36:21 UTC (rev 18289)
+++ trunk/spectrum/waveform.c 2012-05-17 11:17:50 UTC (rev 18290)
@@ -34,6 +34,7 @@
char *inputname[MAX_FILES];
int inputs=0;
int blocksize = 131072; /* starting default */
+extern int plot_bold;
void handler(int sig){
signal(sig,SIG_IGN);
@@ -53,9 +54,10 @@
gtk_main_quit();
}
-const char *optstring = "-r:c:EeBlb:suh";
+const char *optstring = "-r:c:EeBlb:suhT";
struct option options [] = {
+ {"bold",no_argument,NULL,'T'},
{"rate",required_argument,NULL,'r'},
{"channels",required_argument,NULL,'c'},
{"big-endian",no_argument,NULL,'E'},
@@ -99,6 +101,7 @@
" Signedness is normally read from the \n"
" file/stream header or set to signed for raw\n"
" input.\n"
+" -T --bold : plot spectrum with thicker/bolder lines.\n"
" -u --unsigned : Force input to be read as unsigned PCM.\n"
" Signedness is normally read from the \n"
" file/stream header or set to signed for raw\n"
@@ -124,6 +127,9 @@
}
inputname[inputs++]=strdup(optarg);
break;
+ case 'T':
+ plot_bold = 1;
+ break;
case 'b':
/* force bit width */
{
More information about the commits
mailing list