From: Guenter B. <gu...@us...> - 2002-10-25 04:29:49
|
Update of /cvsroot/xine/gnome-xine/src In directory usw-pr-cvs1:/tmp/cvs-serv22497/src Modified Files: Makefile.am main.c Added Files: settings.c settings.h Log Message: beginning of settings dialog --- NEW FILE: settings.c --- /* * Copyright (C) 2002 the xine-project * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * $Id: settings.c,v 1.1 2002/10/24 19:41:53 guenter Exp $ * * settings implementation */ #include <config.h> #include <X11/Xlib.h> #include <gnome.h> #include <gtk/gtk.h> #include <gdk/gdk.h> #include <glib.h> #include <stdio.h> #include "globals.h" #include "gtkxine.h" #include "settings.h" static int is_visible; static GtkWidget *win; static void close_cb (GtkWidget* widget, gpointer data) { is_visible = FALSE; gtk_widget_unmap (win); } void settings_show (void) { if (is_visible) { is_visible = FALSE; gtk_widget_hide (win); } else { is_visible = TRUE; gtk_widget_show_all (win); } } static void volume_cb (GtkWidget* widget, gpointer data) { int value = (gint) GTK_ADJUSTMENT (data)->value; gtk_xine_set_param (GTK_XINE(gtx), XINE_PARAM_AUDIO_VOLUME, value); } static void compressor_cb (GtkWidget* widget, gpointer data) { int value = (gint) GTK_ADJUSTMENT (data)->value; gtk_xine_set_param (GTK_XINE(gtx), XINE_PARAM_AUDIO_COMPR_LEVEL, value); } void settings_init (void) { GtkWidget *vbox, *hbox, *button, *label, *table, *scale; GtkObject *adj; is_visible = 0; /* * window */ win = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (win), _("settings")); gtk_window_set_default_size (GTK_WINDOW (win), 500, 150); gtk_signal_connect( GTK_OBJECT (win), "delete_event", GTK_SIGNAL_FUNC (close_cb), NULL ); vbox = gtk_vbox_new (0,0); /* * sliders */ table = gtk_table_new (3, 2, FALSE); /* volume */ label = gtk_label_new (_("Volume")); gtk_table_attach (GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); adj = gtk_adjustment_new (gtk_xine_get_param (GTK_XINE(gtx), XINE_PARAM_AUDIO_VOLUME), 0.0, 100.0, 1.0, 10.0, 1.0); scale = gtk_hscale_new (GTK_ADJUSTMENT(adj)); gtk_signal_connect( GTK_OBJECT (adj), "value-changed", GTK_SIGNAL_FUNC (volume_cb), adj ); gtk_table_attach (GTK_TABLE(table), scale, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); /* compressor */ label = gtk_label_new (_("Compressor")); gtk_table_attach (GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); adj = gtk_adjustment_new (100.0, 100.0, 1000.0, 10.0, 100.0, 1.0); scale = gtk_hscale_new (GTK_ADJUSTMENT(adj)); gtk_signal_connect( GTK_OBJECT (adj), "value-changed", GTK_SIGNAL_FUNC (compressor_cb), adj ); gtk_table_attach (GTK_TABLE(table), scale, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_box_pack_start (GTK_BOX(vbox), table, TRUE, TRUE, 2); /* * button bar */ hbox = gtk_hbox_new (0,2); button = gtk_button_new_with_label (_("close")); gtk_signal_connect (GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(close_cb), NULL); gtk_box_pack_end (GTK_BOX(hbox), button, TRUE, TRUE, 2); gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 2); gtk_container_add (GTK_CONTAINER (win), vbox); } --- NEW FILE: settings.h --- /* * Copyright (C) 2002 the xine-project * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * $Id: settings.h,v 1.1 2002/10/24 19:41:53 guenter Exp $ * * settings window for gnome-xine */ #ifndef HAVE_SETTINGS_H #define HAVE_SETTINGS_H void settings_init (void); void settings_show (void); #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/Makefile.am,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Makefile.am 20 Oct 2002 14:06:35 -0000 1.14 +++ Makefile.am 24 Oct 2002 19:41:53 -0000 1.15 @@ -17,11 +17,12 @@ preferences.c \ playlist.c \ stream_info.c \ - infobar.c + infobar.c \ + settings.c gnome_xine_LDADD = @XINE_LIBS@ $(GNOMEUI_LIBS) $(GNOME_LIBDIR) $(INTLLIBS) -noinst_HEADERS = gtkxine.h globals.h mediamarks.h preferences.h \ +noinst_HEADERS = gtkxine.h globals.h mediamarks.h preferences.h settings.h \ log_window.h actions.h stream_info.h playlist.h infobar.h Index: main.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/main.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- main.c 20 Oct 2002 14:06:35 -0000 1.34 +++ main.c 24 Oct 2002 19:41:53 -0000 1.35 @@ -42,12 +42,14 @@ #include "log_window.h" #include "playlist.h" #include "infobar.h" +#include "settings.h" #include "playlist.xpm" #include "play.xpm" #include "pause.xpm" #include "stop.xpm" #include "speaker.xpm" +#include "sliders.xpm" static void nothing_cb (GtkWidget* widget, gpointer data); static void fullscreen_cb (GtkWidget* widget, gpointer data); @@ -198,6 +200,7 @@ #define CTRL_PAUSE 1 #define CTRL_STOP 2 #define CTRL_PLAYLIST 3 +#define CTRL_SETTINGS 4 static void control_cb (GtkWidget* widget, gpointer data) { @@ -216,6 +219,9 @@ case CTRL_PLAYLIST: playlist_show(); break; + case CTRL_SETTINGS: + settings_show(); + break; } /* take focus away from this button @@ -726,6 +732,7 @@ add_pix_button (ctrl, pause_xpm, CTRL_PAUSE, _("pause")); add_pix_button (ctrl, stop_xpm, CTRL_STOP, _("stop")); add_pix_button (ctrl, playlist_xpm, CTRL_PLAYLIST, _("playlist")); + add_pix_button (ctrl, sliders_xpm, CTRL_SETTINGS, _("settings")); /* audio channel selection */ @@ -783,6 +790,7 @@ gtk_container_check_resize (GTK_CONTAINER (app)); playlist_init(); + settings_init(); /* * argument parsing |