[xiph-cvs] cvs commit: postfish clippanel.c clippanel.h Makefile mainpanel.c mainpanel.h postfish.h version.h

Monty xiphmont at xiph.org
Sat Oct 18 02:53:22 PDT 2003



xiphmont    03/10/18 05:53:22

  Modified:    .        Makefile mainpanel.c mainpanel.h postfish.h
                        version.h
  Added:       .        clippanel.c clippanel.h
  Log:
  Beginnings of declipping filter control panel

Revision  Changes    Path
1.8       +2 -2      postfish/Makefile

Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/postfish/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile	15 Oct 2003 03:25:19 -0000	1.7
+++ Makefile	18 Oct 2003 09:53:22 -0000	1.8
@@ -5,8 +5,8 @@
 CC=gcc
 LD=gcc
 
-SRC = main.c mainpanel.c multibar.c readout.c input.c output.c
-OBJ = main.o mainpanel.o multibar.o readout.o input.o output.o
+SRC = main.c mainpanel.c multibar.c readout.c input.c output.c clippanel.c
+OBJ = main.o mainpanel.o multibar.o readout.o input.o output.o clippanel.o
 GCF = `pkg-config --cflags gtk+-2.0` -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
 
 all:	

<p><p>1.21      +63 -26    postfish/mainpanel.c

Index: mainpanel.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/mainpanel.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- mainpanel.c	18 Oct 2003 08:10:49 -0000	1.20
+++ mainpanel.c	18 Oct 2003 09:53:22 -0000	1.21
@@ -9,8 +9,11 @@
 #include "version.h"
 #include "input.h"
 #include "output.h"
+#include "mainpanel.h"
 
-typedef struct {
+#include "clippanel.h"
+
+struct postfish_mainpanel{
   GtkWidget *topframe;
   GtkWidget *toplabel;
 
@@ -25,7 +28,6 @@
   GdkPixmap *ff[19];
   GdkBitmap *fb[19];
 
-  GtkWidget *buttonpanel[7];
   GtkWidget *quitbutton;
   
   GtkWidget *playimage;
@@ -54,12 +56,22 @@
   GtkWidget *entry_a;
   GtkWidget *entry_b;
 
+  postfish_clippanel clippanel;
+
   /* ui state */
   int fishframe;
   int fishframe_init;
   guint fishframe_timer;
  
-} postfish_mainpanel;
+};
+
+static void action_clippanel_window(GtkWidget *widget,postfish_mainpanel *p){
+  if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))){
+    clippanel_show(&p->clippanel);
+  }else{
+    clippanel_hide(&p->clippanel);
+  }
+}
 
 static void action_zero(GtkWidget *widget,postfish_mainpanel *p){
   const char *time=gtk_entry_get_text(GTK_ENTRY(p->entry_a));
@@ -336,9 +348,9 @@
   }
 }
 
-static gboolean keybinding(GtkWidget *widget,
-			   GdkEventKey *event,
-			   gpointer in){
+gboolean mainpanel_keybinding(GtkWidget *widget,
+			      GdkEventKey *event,
+			      gpointer in){
   postfish_mainpanel *p=in;
 
 #if 0
@@ -463,12 +475,23 @@
 static void mainpanel_panelentry(postfish_mainpanel *p,
                                  char *label,
                                  char *shortcut,
-				 int i){
-  p->buttonpanel[i]=gtk_check_button_new_with_mnemonic(label);
-  p->buttonactive[i]=gtk_toggle_button_new_with_label(shortcut);
+				 int i,
+				 GCallback cw,
+				 GCallback ca){
+  GtkWidget *ww=gtk_check_button_new_with_mnemonic(label);
+  GtkWidget *wa=gtk_toggle_button_new_with_label(shortcut);
+
+  p->buttonactive[i]=wa;
   
-  gtk_table_attach_defaults(GTK_TABLE(p->wintable),p->buttonpanel[i],0,1,i+1,i+2);
-  gtk_table_attach_defaults(GTK_TABLE(p->wintable),p->buttonactive[i],1,2,i+1,i+2);
+  gtk_table_attach_defaults(GTK_TABLE(p->wintable),ww,0,1,i+1,i+2);
+  gtk_table_attach_defaults(GTK_TABLE(p->wintable),wa,1,2,i+1,i+2);
+
+  if(cw)
+    g_signal_connect (G_OBJECT (ww), "clicked",
+		      G_CALLBACK (cw), p);
+  if(ca)
+    g_signal_connect (G_OBJECT (wa), "clicked",
+		      G_CALLBACK (ca), p);
 }
 
 void mainpanel_create(postfish_mainpanel *panel,char **chlabels){
@@ -482,17 +505,26 @@
   char *text_bar[7]={"[bksp]","[<]","[,]","[space]","[.]","[>]","[end]"};
   GdkWindow *root=gdk_get_default_root_window();
 
-  char versionnum[20];
-  char versiondate[20];
-  char versiontime[20];
   char versionmarkup[240];
-  sscanf(VERSION,"$Id: mainpanel.c,v 1.20 2003/10/18 08:10:49 xiphmont Exp $",
-	 versionnum,versiondate,versiontime);
+  char *version=strstr(VERSION,"version.h,v");
+  if(version){
+    char *versionend=strchr(version,' ');
+    if(versionend)versionend=strchr(versionend+1,' ');
+    if(versionend)versionend=strchr(versionend+1,' ');
+    if(versionend)versionend=strchr(versionend+1,' ');
+    if(versionend){
+      int len=versionend-version-11;
+      version=strdup(version+12);
+      version[len-1]=0;
+    }
+  }else{
+    version="";
+  }
   snprintf(versionmarkup,240,"<span size=\"large\" weight=\"bold\" "
            "style=\"italic\" foreground=\"dark blue\">"
            "Postfish</span>  <span size=\"small\" foreground=\"#606060\">"
-	   "version %s %s %s</span> ",
-	   versionnum,versiondate,versiontime);
+	   "version %s</span> ",
+	   version);
 
   panel->toplevel=gtk_window_new (GTK_WINDOW_TOPLEVEL);
   panel->topframe=gtk_frame_new (NULL);
@@ -520,7 +552,7 @@
   
 
   g_signal_connect (G_OBJECT (panel->toplevel), "key-press-event",
-		    G_CALLBACK (keybinding), panel);
+		    G_CALLBACK (mainpanel_keybinding), panel);
   
 
   for(i=0;i<19;i++)
@@ -597,13 +629,14 @@
     gtk_table_attach_defaults(GTK_TABLE(panel->wintable),temp,1,2,0,1);
   }
 
-  mainpanel_panelentry(panel,"_Declip ","[d]",0);
-  mainpanel_panelentry(panel,"Cross_Talk ","[t]",1);
-  mainpanel_panelentry(panel,"_Noise Filter ","[n]",2);
-  mainpanel_panelentry(panel,"_Equalizer ","[e]",3);
-  mainpanel_panelentry(panel,"_Compander ","[c]",4);
-  mainpanel_panelentry(panel,"_Limiter ","[l]",5);
-  mainpanel_panelentry(panel,"_Output Cal. ","[o]",6);
+  mainpanel_panelentry(panel,"_Declip ","[d]",0,
+		       (GCallback)action_clippanel_window,0);
+  mainpanel_panelentry(panel,"Cross_Talk ","[t]",1,0,0);
+  mainpanel_panelentry(panel,"_Noise Filter ","[n]",2,0,0);
+  mainpanel_panelentry(panel,"_Equalizer ","[e]",3,0,0);
+  mainpanel_panelentry(panel,"_Compander ","[c]",4,0,0);
+  mainpanel_panelentry(panel,"_Limiter ","[l]",5,0,0);
+  mainpanel_panelentry(panel,"_Output Cal. ","[o]",6,0,0);
 
 
   g_signal_connect (G_OBJECT (panel->toplevel), "delete_event",
@@ -611,6 +644,7 @@
     
   g_signal_connect (G_OBJECT (panel->toplevel), "delete_event",
                     G_CALLBACK (shutdown), NULL);
+
     
   /* right side of main panel */
   {
@@ -839,6 +873,8 @@
   gtk_widget_show_all(panel->toplevel);
   gtk_window_set_resizable(GTK_WINDOW(panel->toplevel),0);
 
+  clippanel_create(&panel->clippanel,panel);
+
 }
 
 static gboolean feedback_process(postfish_mainpanel *panel){
@@ -960,6 +996,7 @@
   mainpanel_create(&p,labels);
   animate_fish(&p);
 
+  /* set up watching the event pipe */
   {
     GIOChannel *channel = g_io_channel_unix_new (eventpipe[0]);
     GSource *source;

<p><p>1.3       +5 -0      postfish/mainpanel.h

Index: mainpanel.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/mainpanel.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mainpanel.h	13 Oct 2003 06:01:22 -0000	1.2
+++ mainpanel.h	18 Oct 2003 09:53:22 -0000	1.3
@@ -1 +1,6 @@
+#include "postfish.h"
+
+struct postfish_mainpanel;
+typedef struct postfish_mainpanel postfish_mainpanel;
+
 extern void mainpanel_go(int n,char *list[],int ch);

<p><p>1.7       +4 -0      postfish/postfish.h

Index: postfish.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/postfish.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- postfish.h	17 Oct 2003 06:28:15 -0000	1.6
+++ postfish.h	18 Oct 2003 09:53:22 -0000	1.7
@@ -26,6 +26,9 @@
    reusable code.  It's monolithic, inflexible, and designed that way
    on purpose. */
 
+#ifndef _POSTFISH_H_
+#define _POSTFISH_H_
+
 #define _GNU_SOURCE
 #define _LARGEFILE_SOURCE 
 #define _LARGEFILE64_SOURCE
@@ -72,3 +75,4 @@
 extern int eventpipe[2];
 extern int input_ch;
 
+#endif

<p><p>1.18      +2 -2      postfish/version.h

Index: version.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/version.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- version.h	18 Oct 2003 08:10:49 -0000	1.17
+++ version.h	18 Oct 2003 09:53:22 -0000	1.18
@@ -1,2 +1,2 @@
-#define VERSION "$Id: version.h,v 1.17 2003/10/18 08:10:49 xiphmont Exp $ "
-/* DO NOT EDIT: Automated versioning hack [Sat Oct 18 04:09:51 EDT 2003] */
+#define VERSION "$Id: version.h,v 1.18 2003/10/18 09:53:22 xiphmont Exp $ "
+/* DO NOT EDIT: Automated versioning hack [Sat Oct 18 05:49:45 EDT 2003] */

<p><p>1.1                  postfish/clippanel.c

Index: clippanel.c
===================================================================

#include "postfish.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "readout.h"
#include "mainpanel.h"
#include "clippanel.h"

void clippanel_show(postfish_clippanel *p){
  gtk_widget_show_all(p->toplevel);
}
void clippanel_hide(postfish_clippanel *p){
  gtk_widget_hide_all(p->toplevel);
}

extern gboolean mainpanel_keybinding(GtkWidget *widget,
                                     GdkEventKey *event,
                                     gpointer in);

void clippanel_create(postfish_clippanel *panel,postfish_mainpanel *mp){
  GdkWindow *root=gdk_get_default_root_window();
  GtkWidget *topframe=gtk_frame_new (NULL);
  GtkWidget *toplabel=gtk_label_new (" declipping filter ");
  GtkWidget *topplace=gtk_table_new(1,1,0);
  GtkWidget *topal=gtk_alignment_new(1,0,0,0);
  GtkWidget *closebutton=gtk_button_new_with_mnemonic("_X");
  gtk_widget_set_name(closebutton,"quitbutton");

  panel->toplevel=gtk_window_new (GTK_WINDOW_TOPLEVEL);
  panel->mainpanel=mp;
  gtk_container_add (GTK_CONTAINER(topal), closebutton);
  
  gtk_table_attach_defaults(GTK_TABLE(topplace),
                            topal,0,1,0,1);
  gtk_table_attach_defaults(GTK_TABLE(topplace),
                            topframe,0,1,0,1);
    
  gtk_container_add (GTK_CONTAINER (panel->toplevel), topplace);
  gtk_container_set_border_width (GTK_CONTAINER (closebutton), 3);

  gtk_container_set_border_width (GTK_CONTAINER (topframe), 3);
  gtk_frame_set_shadow_type(GTK_FRAME(topframe),GTK_SHADOW_ETCHED_IN);
  gtk_frame_set_label_widget(GTK_FRAME(topframe),toplabel);

<p><p>#if 0
  g_signal_connect (G_OBJECT (panel->quitbutton), "clicked",
                    G_CALLBACK (shutdown), NULL);
#endif
  

  /* no, no; forward events, don't call the keyhandler directly; that
     way accellerators go too */
  g_signal_connect_after (G_OBJECT (panel->toplevel), "key-press-event",
                          G_CALLBACK (mainpanel_keybinding), 
                          panel->mainpanel);

<p>  gtk_window_set_resizable(GTK_WINDOW(panel->toplevel),0);
  
}

<p><p>1.1                  postfish/clippanel.h

Index: clippanel.h
===================================================================
#include "postfish.h"

typedef struct postfish_clippanel {
  GtkWidget *toplevel;

  postfish_mainpanel *mainpanel;
} postfish_clippanel;

<p>extern void clippanel_create(postfish_clippanel *panel,
                             postfish_mainpanel *mp);
extern void clippanel_show(postfish_clippanel *p);
extern void clippanel_hide(postfish_clippanel *p);

<p><p>--- >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