Mercurial > audlegacy
changeset 686:a1806a3cf3d2 trunk
[svn] Remove libvisual-proxy. It is broken and hard to repair. A written-from-scratch replacement is planned but will be a while.
author | chainsaw |
---|---|
date | Sat, 25 Feb 2006 09:35:27 -0800 |
parents | 147e844e16cb |
children | 0a220c3183b8 |
files | Plugins/Visualization/libvisual-proxy/Makefile.in Plugins/Visualization/libvisual-proxy/about.c Plugins/Visualization/libvisual-proxy/about.h Plugins/Visualization/libvisual-proxy/config_gui.c Plugins/Visualization/libvisual-proxy/config_gui.h Plugins/Visualization/libvisual-proxy/lv_bmp_config.c Plugins/Visualization/libvisual-proxy/lv_bmp_config.h Plugins/Visualization/libvisual-proxy/main.c audacious/pluginenum.c configure.ac |
diffstat | 10 files changed, 6 insertions(+), 2372 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Visualization/libvisual-proxy/Makefile.in Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -include ../../../mk/rules.mk -include ../../../mk/objective.mk - -OBJECTIVE_LIBS = libvisual_proxy.so - -LIBDIR = $(plugindir)/$(VISUALIZATION_PLUGIN_DIR) - -CFLAGS += -fPIC -DPIC $(GTK_CFLAGS) $(LIBVISUAL_CFLAGS) $(SDL_CFLAGS) -I../../.. -I../../../intl - -LDFLAGS = $(GTK_LDFLAGS) $(LIBVISUAL_LDFLAGS) $(SDL_LDFLAGS) -LIBADD = $(GTK_LIBS) $(LIBVISUAL_LIBS) $(SDL_LIBS) -lGL - -SOURCES = main.c lv_bmp_config.c config_gui.c about.c - -OBJECTS = ${SOURCES:.c=.o}
--- a/Plugins/Visualization/libvisual-proxy/about.c Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -#include <gtk/gtk.h> - -#include "config.h" - -#include "about.h" - -#if 0 -static GtkWidget *about_window = NULL; - -static void on_button_close_clicked (GtkButton *button, gpointer user_data); -static GtkWidget* create_window_about (void); - - -void lv_xmms_about_show () -{ - if (about_window != NULL) { - gtk_widget_show (about_window); - return; - } - - about_window = create_window_about (); - gtk_widget_show (about_window); -} - - -/* - * - * Private methods - * - */ - -static void on_button_close_clicked (GtkButton *button, gpointer user_data) -{ - gtk_widget_hide (about_window); -} - -GtkWidget* create_window_about (void) -{ - GtkWidget *window_about; - GtkWidget *vbox1; - GtkWidget *notebook_about; - GtkWidget *scrolledwindow1; - GtkWidget *text_about; - GtkWidget *label_credits; - GtkWidget *scrolledwindow2; - GtkWidget *text_about_translators; - GtkWidget *label_about_translators; - GtkWidget *hseparator1; - GtkWidget *hbox_buttons; - GtkWidget *button_close; - - window_about = gtk_window_new (GTK_WINDOW_DIALOG); - gtk_object_set_data (GTK_OBJECT (window_about), "window_about", window_about); - gtk_window_set_title (GTK_WINDOW (window_about), _("About Libvisual Audacious Plugin")); - gtk_window_set_position (GTK_WINDOW (window_about), GTK_WIN_POS_CENTER); - gtk_window_set_default_size (GTK_WINDOW (window_about), 457, 230); - - vbox1 = gtk_vbox_new (FALSE, 0); - gtk_widget_ref (vbox1); - gtk_object_set_data_full (GTK_OBJECT (window_about), "vbox1", vbox1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (window_about), vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), 6); - - notebook_about = gtk_notebook_new (); - gtk_widget_ref (notebook_about); - gtk_object_set_data_full (GTK_OBJECT (window_about), "notebook_about", notebook_about, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (notebook_about); - gtk_box_pack_start (GTK_BOX (vbox1), notebook_about, TRUE, TRUE, 0); - - scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow1); - gtk_object_set_data_full (GTK_OBJECT (window_about), "scrolledwindow1", scrolledwindow1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow1); - gtk_container_add (GTK_CONTAINER (notebook_about), scrolledwindow1); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - - text_about = gtk_text_new (NULL, NULL); - gtk_widget_ref (text_about); - gtk_object_set_data_full (GTK_OBJECT (window_about), "text_about", text_about, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (text_about); - gtk_container_add (GTK_CONTAINER (scrolledwindow1), text_about); - gtk_text_insert (GTK_TEXT (text_about), NULL, NULL, NULL, - _("Libvisual Audacious Plugin\n\nCopyright (C) 2004, Duilio Protti <dprotti@users.sourceforge.net>\nDennis Smit <ds@nerds-incorporated.org>\n\nThe Libvisual Audacious Plugin, more information about Libvisual can be found at\nhttp://libvisual.sf.net\n"), -1); - - label_credits = gtk_label_new (_("Credits")); - gtk_widget_ref (label_credits); - gtk_object_set_data_full (GTK_OBJECT (window_about), "label_credits", label_credits, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_credits); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_about), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_about), 0), label_credits); - - scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow2); - gtk_object_set_data_full (GTK_OBJECT (window_about), "scrolledwindow2", scrolledwindow2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow2); - gtk_container_add (GTK_CONTAINER (notebook_about), scrolledwindow2); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - - text_about_translators = gtk_text_new (NULL, NULL); - gtk_widget_ref (text_about_translators); - gtk_object_set_data_full (GTK_OBJECT (window_about), "text_about_translators", text_about_translators, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (text_about_translators); - gtk_container_add (GTK_CONTAINER (scrolledwindow2), text_about_translators); - gtk_text_insert (GTK_TEXT (text_about_translators), NULL, NULL, NULL, - _("Brazilian Portuguese: Gustavo Sverzut Barbieri\nDutch: Dennis Smit\nFrench: Jean-Christophe Hoelt\nSpanish: Duilio Protti\n"), -1); - - label_about_translators = gtk_label_new (_("Translators")); - gtk_widget_ref (label_about_translators); - gtk_object_set_data_full (GTK_OBJECT (window_about), "label_about_translators", label_about_translators, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_about_translators); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_about), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_about), 1), label_about_translators); - - hseparator1 = gtk_hseparator_new (); - gtk_widget_ref (hseparator1); - gtk_object_set_data_full (GTK_OBJECT (window_about), "hseparator1", hseparator1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hseparator1); - gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, FALSE, FALSE, 6); - - hbox_buttons = gtk_hbox_new (FALSE, 0); - gtk_widget_ref (hbox_buttons); - gtk_object_set_data_full (GTK_OBJECT (window_about), "hbox_buttons", hbox_buttons, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox_buttons); - gtk_box_pack_start (GTK_BOX (vbox1), hbox_buttons, FALSE, FALSE, 0); - - button_close = gtk_button_new_with_label (_("Close")); - gtk_widget_ref (button_close); - gtk_object_set_data_full (GTK_OBJECT (window_about), "button_close", button_close, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_close); - gtk_box_pack_start (GTK_BOX (hbox_buttons), button_close, FALSE, FALSE, 0); - GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT); - - gtk_signal_connect (GTK_OBJECT (button_close), "clicked", - GTK_SIGNAL_FUNC (on_button_close_clicked), - NULL); - - gtk_widget_grab_default (button_close); - return window_about; -} -#endif
--- a/Plugins/Visualization/libvisual-proxy/about.h Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef __LV_BMP_ABOUT__ -#define __LV_BMP_ABOUT__ - - -void lv_bmp_about_show (void); - -#endif /* __LV_BMP_ABOUT__ */ -
--- a/Plugins/Visualization/libvisual-proxy/config_gui.c Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> - -#include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> -#include <glib/gi18n.h> - -#include "config.h" - -#include "config_gui.h" - -ConfigWin *lv_bmp_config_gui_new (void) -{ - ConfigWin *config_gui; - - GtkWidget *window_main; - GtkWidget *vbox_main; - GtkWidget *frame_vis_plugin; - GtkWidget *vbox3; - GtkWidget *scrolledwindow_vis_plugins; - GtkWidget *viewport1; - GtkWidget *list_vis_plugins; - GtkWidget *hbox_vis_plugin_controls; - GtkWidget *hbox_vis_plugin_buttons; - GtkWidget *button_vis_plugin_conf; - GtkWidget *button_vis_plugin_about; - GtkWidget *checkbutton_vis_plugin; - GtkWidget *checkbutton_fullscreen; - GSList *buttongroup_plugins_group = NULL; - GtkWidget *radiobutton_all_plugins; - GtkWidget *radiobutton_onlynongl; - GtkWidget *radiobutton_onlygl; - GtkWidget *hbox_fps; - GtkWidget *label_fps; - GtkObject *spinbutton_fps_adj; - GtkWidget *spinbutton_fps; - GtkWidget *frame_morph_plugin; - GtkWidget *vbox_morph_plugin; - GtkWidget *optionmenu_morph_plugin; - GtkWidget *optionmenu_morph_plugin_menu; - GtkWidget *hbox_morph_plugin_controls; - GtkWidget *hbox_morph_plugin_buttons; - GtkWidget *button_morph_plugin_conf; - GtkWidget *button_morph_plugin_about; - GtkWidget *checkbutton_morph_random; - GtkWidget *hbox_main_buttons; - GtkWidget *button_ok; - GtkWidget *button_apply; - GtkWidget *button_cancel; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - window_main = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_object_set_data (GTK_OBJECT (window_main), "window_main", window_main); - gtk_window_set_title (GTK_WINDOW (window_main), _("LibVisual Audacious Plugin")); - gtk_window_set_position (GTK_WINDOW (window_main), GTK_WIN_POS_CENTER); - gtk_window_set_default_size (GTK_WINDOW (window_main), -1, 450); - - vbox_main = gtk_vbox_new (FALSE, 0); - gtk_widget_ref (vbox_main); - gtk_object_set_data_full (GTK_OBJECT (window_main), "vbox_main", vbox_main, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vbox_main); - gtk_container_add (GTK_CONTAINER (window_main), vbox_main); - gtk_container_set_border_width (GTK_CONTAINER (vbox_main), 6); - - frame_vis_plugin = gtk_frame_new (_("Visualization Plugins")); - gtk_widget_ref (frame_vis_plugin); - gtk_object_set_data_full (GTK_OBJECT (window_main), "frame_vis_plugin", frame_vis_plugin, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (frame_vis_plugin); - gtk_box_pack_start (GTK_BOX (vbox_main), frame_vis_plugin, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (frame_vis_plugin), 2); - - vbox3 = gtk_vbox_new (FALSE, 0); - gtk_widget_ref (vbox3); - gtk_object_set_data_full (GTK_OBJECT (window_main), "vbox3", vbox3, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vbox3); - gtk_container_add (GTK_CONTAINER (frame_vis_plugin), vbox3); - - scrolledwindow_vis_plugins = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_ref (scrolledwindow_vis_plugins); - gtk_object_set_data_full (GTK_OBJECT (window_main), "scrolledwindow_vis_plugins", scrolledwindow_vis_plugins, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (scrolledwindow_vis_plugins); - gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow_vis_plugins, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow_vis_plugins), 2); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_vis_plugins), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - - viewport1 = gtk_viewport_new (NULL, NULL); - gtk_widget_ref (viewport1); - gtk_object_set_data_full (GTK_OBJECT (window_main), "viewport1", viewport1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (viewport1); - gtk_container_add (GTK_CONTAINER (scrolledwindow_vis_plugins), viewport1); - - list_vis_plugins = gtk_list_new (); - gtk_widget_ref (list_vis_plugins); - gtk_object_set_data_full (GTK_OBJECT (window_main), "list_vis_plugins", list_vis_plugins, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (list_vis_plugins); - gtk_container_add (GTK_CONTAINER (viewport1), list_vis_plugins); - gtk_list_set_selection_mode (GTK_LIST (list_vis_plugins), GTK_SELECTION_SINGLE); - - hbox_vis_plugin_controls = gtk_hbox_new (FALSE, 0); - gtk_widget_ref (hbox_vis_plugin_controls); - gtk_object_set_data_full (GTK_OBJECT (window_main), "hbox_vis_plugin_controls", hbox_vis_plugin_controls, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox_vis_plugin_controls); - gtk_box_pack_start (GTK_BOX (vbox3), hbox_vis_plugin_controls, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (hbox_vis_plugin_controls), 2); - - hbox_vis_plugin_buttons = gtk_hbox_new (TRUE, 0); - gtk_widget_ref (hbox_vis_plugin_buttons); - gtk_object_set_data_full (GTK_OBJECT (window_main), "hbox_vis_plugin_buttons", hbox_vis_plugin_buttons, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox_vis_plugin_buttons); - gtk_box_pack_start (GTK_BOX (hbox_vis_plugin_controls), hbox_vis_plugin_buttons, FALSE, TRUE, 0); - - button_vis_plugin_conf = gtk_button_new_with_label (_("Configure")); - gtk_widget_ref (button_vis_plugin_conf); - gtk_object_set_data_full (GTK_OBJECT (window_main), "button_vis_plugin_conf", button_vis_plugin_conf, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_vis_plugin_conf); - gtk_box_pack_start (GTK_BOX (hbox_vis_plugin_buttons), button_vis_plugin_conf, FALSE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (button_vis_plugin_conf), 2); - - button_vis_plugin_about = gtk_button_new_with_label (_("About")); - gtk_widget_ref (button_vis_plugin_about); - gtk_object_set_data_full (GTK_OBJECT (window_main), "button_vis_plugin_about", button_vis_plugin_about, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_vis_plugin_about); - gtk_box_pack_start (GTK_BOX (hbox_vis_plugin_buttons), button_vis_plugin_about, FALSE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (button_vis_plugin_about), 2); - - checkbutton_vis_plugin = gtk_check_button_new_with_label (_("Enable/Disable")); - gtk_widget_ref (checkbutton_vis_plugin); - gtk_object_set_data_full (GTK_OBJECT (window_main), "checkbutton_vis_plugin", checkbutton_vis_plugin, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (checkbutton_vis_plugin); - gtk_box_pack_end (GTK_BOX (hbox_vis_plugin_controls), checkbutton_vis_plugin, FALSE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (checkbutton_vis_plugin), 2); - - checkbutton_fullscreen = gtk_check_button_new_with_label (_("Fullscreen")); - gtk_widget_ref (checkbutton_fullscreen); - gtk_object_set_data_full (GTK_OBJECT (window_main), "checkbutton_fullscreen", checkbutton_fullscreen, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (checkbutton_fullscreen); - gtk_box_pack_start (GTK_BOX (vbox3), checkbutton_fullscreen, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, checkbutton_fullscreen, _("You can toggle between normal and fullscreen mode pressing key TAB or F11"), NULL); - - radiobutton_all_plugins = gtk_radio_button_new_with_label (buttongroup_plugins_group, _("All plugins")); - buttongroup_plugins_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_all_plugins)); - gtk_widget_ref (radiobutton_all_plugins); - gtk_object_set_data_full (GTK_OBJECT (window_main), "radiobutton_all_plugins", radiobutton_all_plugins, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (radiobutton_all_plugins); - gtk_box_pack_start (GTK_BOX (vbox3), radiobutton_all_plugins, FALSE, FALSE, 0); - - radiobutton_onlynongl = gtk_radio_button_new_with_label (buttongroup_plugins_group, _("Only non GL plugins")); - buttongroup_plugins_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_onlynongl)); - gtk_widget_ref (radiobutton_onlynongl); - gtk_object_set_data_full (GTK_OBJECT (window_main), "radiobutton_onlynongl", radiobutton_onlynongl, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (radiobutton_onlynongl); - gtk_box_pack_start (GTK_BOX (vbox3), radiobutton_onlynongl, FALSE, FALSE, 0); - - radiobutton_onlygl = gtk_radio_button_new_with_label (buttongroup_plugins_group, _("Only GL plugins")); - buttongroup_plugins_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_onlygl)); - gtk_widget_ref (radiobutton_onlygl); - gtk_object_set_data_full (GTK_OBJECT (window_main), "radiobutton_onlygl", radiobutton_onlygl, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (radiobutton_onlygl); - gtk_box_pack_start (GTK_BOX (vbox3), radiobutton_onlygl, FALSE, FALSE, 0); - - hbox_fps = gtk_hbox_new (FALSE, 0); - gtk_widget_ref (hbox_fps); - gtk_object_set_data_full (GTK_OBJECT (window_main), "hbox_fps", hbox_fps, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox_fps); - gtk_box_pack_start (GTK_BOX (vbox3), hbox_fps, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (hbox_fps), 2); - - label_fps = gtk_label_new (_("Maximum Frames Per Second:")); - gtk_widget_ref (label_fps); - gtk_object_set_data_full (GTK_OBJECT (window_main), "label_fps", label_fps, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label_fps); - gtk_box_pack_start (GTK_BOX (hbox_fps), label_fps, FALSE, FALSE, 6); - gtk_label_set_justify (GTK_LABEL (label_fps), GTK_JUSTIFY_LEFT); - - spinbutton_fps_adj = gtk_adjustment_new (30, 10, 100, 1, 10, 10); - spinbutton_fps = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_fps_adj), 1, 0); - gtk_widget_ref (spinbutton_fps); - gtk_object_set_data_full (GTK_OBJECT (window_main), "spinbutton_fps", spinbutton_fps, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (spinbutton_fps); - gtk_box_pack_start (GTK_BOX (hbox_fps), spinbutton_fps, FALSE, FALSE, 0); - - frame_morph_plugin = gtk_frame_new (_("Morph Plugin")); - gtk_widget_ref (frame_morph_plugin); - gtk_object_set_data_full (GTK_OBJECT (window_main), "frame_morph_plugin", frame_morph_plugin, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (frame_morph_plugin); - gtk_box_pack_start (GTK_BOX (vbox_main), frame_morph_plugin, FALSE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (frame_morph_plugin), 2); - - vbox_morph_plugin = gtk_vbox_new (FALSE, 0); - gtk_widget_ref (vbox_morph_plugin); - gtk_object_set_data_full (GTK_OBJECT (window_main), "vbox_morph_plugin", vbox_morph_plugin, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (vbox_morph_plugin); - gtk_container_add (GTK_CONTAINER (frame_morph_plugin), vbox_morph_plugin); - - optionmenu_morph_plugin = gtk_option_menu_new (); - gtk_widget_ref (optionmenu_morph_plugin); - gtk_object_set_data_full (GTK_OBJECT (window_main), "optionmenu_morph_plugin", optionmenu_morph_plugin, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (optionmenu_morph_plugin); - gtk_box_pack_start (GTK_BOX (vbox_morph_plugin), optionmenu_morph_plugin, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, optionmenu_morph_plugin, _("Select the kind of morph that will be applied when switching from one visualization plugin to another "), NULL); - optionmenu_morph_plugin_menu = gtk_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_morph_plugin), optionmenu_morph_plugin_menu); - - hbox_morph_plugin_controls = gtk_hbox_new (FALSE, 0); - gtk_widget_ref (hbox_morph_plugin_controls); - gtk_object_set_data_full (GTK_OBJECT (window_main), "hbox_morph_plugin_controls", hbox_morph_plugin_controls, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox_morph_plugin_controls); - gtk_box_pack_start (GTK_BOX (vbox_morph_plugin), hbox_morph_plugin_controls, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (hbox_morph_plugin_controls), 2); - - hbox_morph_plugin_buttons = gtk_hbox_new (TRUE, 0); - gtk_widget_ref (hbox_morph_plugin_buttons); - gtk_object_set_data_full (GTK_OBJECT (window_main), "hbox_morph_plugin_buttons", hbox_morph_plugin_buttons, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox_morph_plugin_buttons); - gtk_box_pack_start (GTK_BOX (hbox_morph_plugin_controls), hbox_morph_plugin_buttons, FALSE, FALSE, 0); - - button_morph_plugin_conf = gtk_button_new_with_label (_("Configure")); - gtk_widget_ref (button_morph_plugin_conf); - gtk_object_set_data_full (GTK_OBJECT (window_main), "button_morph_plugin_conf", button_morph_plugin_conf, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_morph_plugin_conf); - gtk_box_pack_start (GTK_BOX (hbox_morph_plugin_buttons), button_morph_plugin_conf, FALSE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (button_morph_plugin_conf), 2); - - button_morph_plugin_about = gtk_button_new_with_label (_("About")); - gtk_widget_ref (button_morph_plugin_about); - gtk_object_set_data_full (GTK_OBJECT (window_main), "button_morph_plugin_about", button_morph_plugin_about, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_morph_plugin_about); - gtk_box_pack_start (GTK_BOX (hbox_morph_plugin_buttons), button_morph_plugin_about, FALSE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (button_morph_plugin_about), 2); - - checkbutton_morph_random = gtk_check_button_new_with_label (_("Select one morph plugin randomly")); - gtk_widget_ref (checkbutton_morph_random); - gtk_object_set_data_full (GTK_OBJECT (window_main), "checkbutton_morph_random", checkbutton_morph_random, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (checkbutton_morph_random); - gtk_box_pack_start (GTK_BOX (vbox_morph_plugin), checkbutton_morph_random, FALSE, FALSE, 0); - - hbox_main_buttons = gtk_hbox_new (TRUE, 0); - gtk_widget_ref (hbox_main_buttons); - gtk_object_set_data_full (GTK_OBJECT (window_main), "hbox_main_buttons", hbox_main_buttons, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (hbox_main_buttons); - gtk_box_pack_start (GTK_BOX (vbox_main), hbox_main_buttons, FALSE, FALSE, 6); - - button_ok = gtk_button_new_with_label (_("Accept")); - gtk_widget_ref (button_ok); - gtk_object_set_data_full (GTK_OBJECT (window_main), "button_ok", button_ok, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_ok); - gtk_box_pack_start (GTK_BOX (hbox_main_buttons), button_ok, FALSE, TRUE, 0); - GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT); - - button_apply = gtk_button_new_with_label (_("Apply")); - gtk_widget_ref (button_apply); - gtk_object_set_data_full (GTK_OBJECT (window_main), "button_apply", button_apply, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_apply); - gtk_box_pack_start (GTK_BOX (hbox_main_buttons), button_apply, FALSE, TRUE, 6); - GTK_WIDGET_SET_FLAGS (button_apply, GTK_CAN_DEFAULT); - - button_cancel = gtk_button_new_with_label (_("Cancel")); - gtk_widget_ref (button_cancel); - gtk_object_set_data_full (GTK_OBJECT (window_main), "button_cancel", button_cancel, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button_cancel); - gtk_box_pack_start (GTK_BOX (hbox_main_buttons), button_cancel, FALSE, TRUE, 6); - GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT); - - gtk_object_set_data (GTK_OBJECT (window_main), "tooltips", tooltips); - - config_gui = g_new0 (ConfigWin, 1); - - config_gui->window_main = window_main; - - config_gui->list_vis_plugins = list_vis_plugins; - config_gui->button_vis_plugin_conf = button_vis_plugin_conf; - config_gui->button_vis_plugin_about = button_vis_plugin_about; - config_gui->checkbutton_vis_plugin = checkbutton_vis_plugin; - - config_gui->checkbutton_fullscreen = checkbutton_fullscreen; - config_gui->radiobutton_onlygl = radiobutton_onlygl; - config_gui->radiobutton_onlynongl = radiobutton_onlynongl; - config_gui->radiobutton_all_plugins = radiobutton_all_plugins; - config_gui->spinbutton_fps = spinbutton_fps; - - config_gui->optionmenu_morph_plugin = optionmenu_morph_plugin; - config_gui->optionmenu_morph_plugin_group = NULL; - config_gui->button_morph_plugin_conf = button_morph_plugin_conf; - config_gui->button_morph_plugin_about = button_morph_plugin_about; - config_gui->checkbutton_morph_random = checkbutton_morph_random; - - config_gui->button_ok = button_ok; - config_gui->button_apply = button_apply; - config_gui->button_cancel = button_cancel; - - return config_gui; -}
--- a/Plugins/Visualization/libvisual-proxy/config_gui.h Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#ifndef __LV_CONFIG_GUI_H__ -#define __LV_CONFIG_GUI_H__ - -#include <gtk/gtk.h> - -typedef struct { - GtkWidget *window_main; - - GtkWidget *list_vis_plugins; - GtkWidget *button_vis_plugin_conf; - GtkWidget *button_vis_plugin_about; - - GtkWidget *checkbutton_vis_plugin; - GtkWidget *checkbutton_fullscreen; - GtkWidget *radiobutton_onlygl; - GtkWidget *radiobutton_onlynongl; - GtkWidget *radiobutton_all_plugins; - GtkWidget *spinbutton_fps; - - GtkWidget *optionmenu_morph_plugin; - GSList *optionmenu_morph_plugin_group; - GtkWidget *button_morph_plugin_conf; - GtkWidget *button_morph_plugin_about; - GtkWidget *checkbutton_morph_random; - - GtkWidget *button_ok; - GtkWidget *button_apply; - GtkWidget *button_cancel; -} ConfigWin; - -ConfigWin *lv_bmp_config_gui_new (void); - -#endif /* __LV_CONFIG_GUI_H__ */
--- a/Plugins/Visualization/libvisual-proxy/lv_bmp_config.c Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1091 +0,0 @@ -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> -#include <libaudacious/configdb.h> -#include <libaudacious/util.h> -#include <libvisual/libvisual.h> -#include <glib/gi18n.h> - -#include "config.h" - -#include "lv_bmp_config.h" -#include "config_gui.h" - -#define CONFIG_DEFAULT_ACTOR_PLUGIN "infinite" -#define CONFIG_DEFAULT_INPUT_PLUGIN "alsa" -#define CONFIG_DEFAULT_MORPH_PLUGIN "alphablend" - -static Options default_options = { NULL, NULL, NULL, 320, 200, 30, 24, FALSE, FALSE, FALSE, TRUE, FALSE }; -static Options options = { NULL, NULL, NULL, -1, -1, -1, -1, FALSE, FALSE, FALSE, TRUE, FALSE }; -static ConfigWin *config_win = NULL; - -static gboolean options_loaded = FALSE; -static gboolean fullscreen; -static gboolean gl_plugins_only; -static gboolean non_gl_plugins_only; -static gboolean all_plugins_enabled; -static gboolean random_morph; -static int fps; - -static gchar *actor_plugin_buffer = NULL; - -/* Table of GtkListItem's */ -static GHashTable *actor_plugin_table = NULL; - -/* List of gboolean's */ -static GHashTable *actor_plugin_enable_table = NULL; - -/* Lists of VisPluginRef's */ -static GSList *actor_plugins_gl = NULL; -static GSList *actor_plugins_nongl = NULL; - -static VisPluginRef *current_actor = NULL; - -static char *morph_plugin = NULL; -static char *morph_plugin_buffer = NULL; -static GSList *morph_plugins_list = NULL; - -static void sync_options (void); - -static void config_win_load_actor_plugin_gl_list (void); -static void config_win_load_actor_plugin_nongl_list (void); - -static int config_win_load_morph_plugin_list (void); - -static int load_actor_plugin_list (void); -static int load_morph_plugin_list (void); - -static void load_actor_plugin_enable_table (ConfigDb *db); - -static void remove_boolean (gpointer key, gpointer value, gpointer data); - -static void config_win_set_defaults (void); -static void config_win_connect_callbacks (void); -static void config_visual_initialize (void); - -static gboolean read_config_db (ConfigDb *db); - -static void dummy (GtkWidget *widget, gpointer data); - -Options *lv_bmp_config_open () -{ - actor_plugin_buffer = g_malloc0 (OPTIONS_MAX_NAME_LEN); - options.last_plugin = actor_plugin_buffer; - morph_plugin_buffer = g_malloc0 (OPTIONS_MAX_NAME_LEN); - - config_visual_initialize (); - - srand (time(NULL)); - - load_actor_plugin_list (); - - load_morph_plugin_list (); - - return &options; -} - -int lv_bmp_config_close () -{ - if (actor_plugin_buffer != NULL) - g_free (actor_plugin_buffer); - if (morph_plugin_buffer != NULL) - g_free (morph_plugin_buffer); - - if (actor_plugin_table) { - g_hash_table_destroy (actor_plugin_table); - actor_plugin_table = NULL; - } - if (actor_plugin_enable_table) { - g_hash_table_foreach (actor_plugin_enable_table, remove_boolean, NULL); - g_hash_table_destroy (actor_plugin_enable_table); - actor_plugin_enable_table = NULL; - } - - if (actor_plugins_gl) { - g_slist_free (actor_plugins_gl); - actor_plugins_gl = NULL; - } - if (actor_plugins_nongl) { - g_slist_free (actor_plugins_nongl); - actor_plugins_nongl = NULL; - } - if (morph_plugins_list) { - g_slist_free (morph_plugins_list); - morph_plugins_list = NULL; - } - - options_loaded = FALSE; - - return 0; -} - -int lv_bmp_config_load_prefs () -{ - ConfigDb *db; - gboolean errors; - GtkWidget *msg; - - db = bmp_cfg_db_open(); - - errors = FALSE; - errors = read_config_db (db); - if (errors) - printf("Error reported in config read\n"); - - load_actor_plugin_enable_table (db); - - bmp_cfg_db_close(db); - - /* - * Set our local copies - */ - if (!visual_morph_valid_by_name (morph_plugin_buffer)) { - msg = xmms_show_message (PACKAGE_NAME, - _("The morph plugin specified on the config\n" - "file is not a valid morph plugin.\n" - "We will use "CONFIG_DEFAULT_MORPH_PLUGIN - " morph plugin instead.\n" - "If you want another one, please choose it\n" - "on the configure dialog."), - _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - gtk_widget_show (msg); - strcpy (morph_plugin_buffer, CONFIG_DEFAULT_MORPH_PLUGIN); - } - options.morph_plugin = morph_plugin_buffer; - morph_plugin = morph_plugin_buffer; - random_morph = options.random_morph; - - fullscreen = options.fullscreen; - fps = options.fps; - gl_plugins_only = options.gl_plugins_only; - non_gl_plugins_only = options.non_gl_plugins_only; - all_plugins_enabled = options.all_plugins_enabled; - - if (gl_plugins_only) - visual_log (VISUAL_LOG_INFO, _("GL plugins only")); - else if (non_gl_plugins_only) - visual_log (VISUAL_LOG_INFO, _("non GL plugins only")); - else if (all_plugins_enabled) - visual_log (VISUAL_LOG_INFO, _("All plugins enabled")); - else - visual_log (VISUAL_LOG_WARNING, "Cannot determine which kind of plugin to show"); - - if (errors) { - visual_log (VISUAL_LOG_INFO, _("LibVisual: configuration is missing or corrupt, saving defaults")); - lv_bmp_config_save_prefs (); - } - - options_loaded = TRUE; - - return 0; -} - -static void save_actor_enable_state (gpointer data, gpointer user_data) -{ - VisPluginRef *actor; - ConfigDb *db; - gboolean *enable; - - actor = data; - db = user_data; - - visual_log_return_if_fail (actor != NULL); - visual_log_return_if_fail (actor->info != NULL); - visual_log_return_if_fail (db != NULL); - - enable = g_hash_table_lookup (actor_plugin_enable_table, actor->info->plugname); - if (!enable) { - visual_log (VISUAL_LOG_DEBUG, "enable == NULL for %s", actor->info->plugname); - return; - } - bmp_cfg_db_set_bool (db, "libvisual", actor->info->plugname, *enable); -} - -int lv_bmp_config_save_prefs () -{ - ConfigDb *db; - - db = bmp_cfg_db_open(); - - bmp_cfg_db_set_string (db, "libvisual", "version", VERSION); - - if (options.last_plugin != NULL && (strlen(options.last_plugin) > 0)) - bmp_cfg_db_set_string (db, "libvisual", "last_plugin", options.last_plugin); - else - bmp_cfg_db_set_string (db, "libvisual", "last_plugin", CONFIG_DEFAULT_ACTOR_PLUGIN); - - if (options.morph_plugin != NULL && (strlen(options.morph_plugin) > 0)) - bmp_cfg_db_set_string (db, "libvisual", "morph_plugin", options.morph_plugin); - else - bmp_cfg_db_set_string (db, "libvisual", "morph_plugin", CONFIG_DEFAULT_MORPH_PLUGIN); - bmp_cfg_db_set_bool (db, "libvisual", "random_morph", options.random_morph); - - bmp_cfg_db_set_int (db, "libvisual", "width", options.width); - bmp_cfg_db_set_int (db, "libvisual", "height", options.height); - bmp_cfg_db_set_int (db, "libvisual", "color_depth", options.depth); - bmp_cfg_db_set_int (db, "libvisual", "fps", options.fps); - bmp_cfg_db_set_bool (db, "libvisual", "fullscreen", options.fullscreen); - if (options.gl_plugins_only) - bmp_cfg_db_set_string (db, "libvisual", "enabled_plugins", "gl_only"); - else if (options.non_gl_plugins_only) - bmp_cfg_db_set_string (db, "libvisual", "enabled_plugins", "non_gl_only"); - else if (options.all_plugins_enabled) - bmp_cfg_db_set_string (db, "libvisual", "enabled_plugins", "all"); - else - g_warning ("Inconsistency on config module"); - - visual_log_return_val_if_fail (actor_plugins_gl != NULL, -1); - - g_slist_foreach (actor_plugins_gl, save_actor_enable_state, db); - g_slist_foreach (actor_plugins_nongl, save_actor_enable_state, db); - - bmp_cfg_db_close(db); - - return 0; -} - -void lv_bmp_config_toggle_fullscreen (void) -{ - fullscreen = !fullscreen; - options.fullscreen = !options.fullscreen; - if (config_win != NULL) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_fullscreen), - fullscreen); -} - -char *lv_bmp_config_get_prev_actor (void) -{ - const gchar *prev_plugin; - gboolean *plugin_enabled; - int round; - - round = 0; - prev_plugin = options.last_plugin; - do { - prev_plugin = visual_actor_get_prev_by_name (prev_plugin); - if (!prev_plugin) { - round++; - continue; - } - plugin_enabled = g_hash_table_lookup (actor_plugin_enable_table, prev_plugin); - if (!plugin_enabled) - continue; - if (*plugin_enabled) - return prev_plugin; - } while (round < 2); - - return NULL; -} - -char *lv_bmp_config_get_next_actor (void) -{ - const gchar *next_plugin; - gboolean *plugin_enabled; - int round; - - round = 0; - next_plugin = options.last_plugin; - do { - next_plugin = visual_actor_get_next_by_name (next_plugin); - if (!next_plugin) { - round++; - continue; - } - plugin_enabled = g_hash_table_lookup (actor_plugin_enable_table, next_plugin); - if (!plugin_enabled) - continue; - if (*plugin_enabled) - return next_plugin; - } while (round < 2); - - return NULL; -} - -void lv_bmp_config_set_current_actor (char *name) -{ - visual_log_return_if_fail (name != NULL); - - options.last_plugin = name; -} - -char *lv_bmp_config_morph_plugin (void) -{ - GSList *l; - int i, pos; - - visual_log_return_val_if_fail (g_slist_length (morph_plugins_list) > 0, NULL); - - if (random_morph) { - pos = (rand () % (g_slist_length (morph_plugins_list))); - l = morph_plugins_list; - for (i = 0; i < pos; i++) - l = g_slist_next(l); - return ((char*)l->data); - } else { - return options.morph_plugin; - } -} - -void lv_bmp_config_window () -{ - if (config_win != NULL) { - gtk_widget_grab_default (config_win->button_cancel); - gtk_widget_show (config_win->window_main); - return; - } - - config_visual_initialize (); - - if (!options_loaded) { - lv_bmp_config_open (); - lv_bmp_config_load_prefs (); - } - - config_win = lv_bmp_config_gui_new (); - - if (options_loaded) { - gtk_spin_button_set_value (GTK_SPIN_BUTTON(config_win->spinbutton_fps), options.fps); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_fullscreen), - options.fullscreen); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_onlygl), - options.gl_plugins_only); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_onlynongl), - options.non_gl_plugins_only); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_all_plugins), - options.all_plugins_enabled); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_morph_random), - options.random_morph); - - } else { - config_win_set_defaults (); - } - - config_win_connect_callbacks (); - - gtk_widget_grab_default (config_win->button_cancel); - - if (options.all_plugins_enabled || options.non_gl_plugins_only) - config_win_load_actor_plugin_nongl_list (); - if (options.all_plugins_enabled || options.gl_plugins_only) - config_win_load_actor_plugin_gl_list (); - - config_win_load_morph_plugin_list (); - - gtk_widget_show (config_win->window_main); -} - -static void on_checkbutton_fullscreen_toggled (GtkToggleButton *togglebutton, gpointer user_data) -{ - fullscreen = !fullscreen; -} - -static void on_radiobutton_opengl_toggled (GtkToggleButton *togglebutton, gpointer user_data) -{ - gl_plugins_only = !gl_plugins_only; - - gtk_list_clear_items (GTK_LIST(config_win->list_vis_plugins), 0, -1); - config_win_load_actor_plugin_gl_list (); -} - -static void on_radiobutton_non_opengl_toggled (GtkToggleButton *togglebutton, gpointer user_data) -{ - non_gl_plugins_only = !non_gl_plugins_only; - - gtk_list_clear_items (GTK_LIST(config_win->list_vis_plugins), 0, -1); - config_win_load_actor_plugin_nongl_list (); -} - -static void on_radiobutton_all_plugins_toggled (GtkToggleButton *togglebutton, gpointer user_data) -{ - all_plugins_enabled = !all_plugins_enabled; - - gtk_list_clear_items (GTK_LIST(config_win->list_vis_plugins), 0, -1); - config_win_load_actor_plugin_gl_list (); - config_win_load_actor_plugin_nongl_list (); -} - -static void on_spinbutton_fps_changed (GtkEditable *editable, gpointer user_data) -{ - gchar *buffer; - - buffer = gtk_editable_get_chars (editable, (gint) 0, (gint) -1); - fps = atoi (buffer); - g_free (buffer); -} - -static void on_button_ok_clicked (GtkButton *button, gpointer user_data) -{ - sync_options (); - lv_bmp_config_save_prefs (); - gtk_widget_hide (gtk_widget_get_toplevel (GTK_WIDGET(button))); -} - -static void on_button_apply_clicked (GtkButton *button, gpointer user_data) -{ - sync_options (); - lv_bmp_config_save_prefs (); -} - - -static void on_button_cancel_clicked (GtkButton *button, gpointer user_data) -{ - /* - * Restore original values - */ - if (options_loaded) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_fullscreen), - options.fullscreen); - gtk_spin_button_set_value (GTK_SPIN_BUTTON(config_win->spinbutton_fps), options.fps); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_onlygl), - options.gl_plugins_only); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_onlynongl), - options.non_gl_plugins_only); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_all_plugins), - options.all_plugins_enabled); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_morph_random), - options.random_morph); - - } else { - config_win_set_defaults (); - } - - gtk_widget_hide (gtk_widget_get_toplevel (GTK_WIDGET(button))); -} - -static void sync_options () -{ - options.fullscreen = fullscreen; - options.fps = fps; - options.gl_plugins_only = gl_plugins_only; - options.non_gl_plugins_only = non_gl_plugins_only; - options.all_plugins_enabled = all_plugins_enabled; - options.morph_plugin = morph_plugin; - options.random_morph = random_morph; -} - -static void on_checkbutton_vis_plugin_toggled (GtkToggleButton *togglebutton, gpointer user_data); - -static void on_actor_plugin_selected (GtkListItem *item, VisPluginRef *actor) -{ - gboolean *enabled; - - visual_log_return_if_fail (actor != NULL); - visual_log_return_if_fail (actor->info != NULL); - - current_actor = actor; - enabled = g_hash_table_lookup (actor_plugin_enable_table, actor->info->plugname); - visual_log_return_if_fail (enabled != NULL); - - gtk_signal_disconnect_by_func (GTK_OBJECT (config_win->checkbutton_vis_plugin), - GTK_SIGNAL_FUNC(on_checkbutton_vis_plugin_toggled), NULL); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_vis_plugin), *enabled); - - gtk_signal_connect (GTK_OBJECT (config_win->checkbutton_vis_plugin), "toggled", - GTK_SIGNAL_FUNC (on_checkbutton_vis_plugin_toggled), - NULL); -} - -static void on_checkbutton_vis_plugin_toggled (GtkToggleButton *togglebutton, gpointer user_data) -{ - GtkWidget *item; - GList *items = NULL; - gint pos; - gchar *name; - gchar *plugname; - gboolean *enable; - - if (!current_actor) - return; - - plugname = current_actor->info->plugname; - if (gtk_toggle_button_get_active (togglebutton)) { - /* We are enabling the selected actor */ - item = g_hash_table_lookup (actor_plugin_table, plugname); - g_hash_table_remove (actor_plugin_table, plugname); - - /* Drop the item from the list, after save his position */ - pos = gtk_list_child_position (GTK_LIST(config_win->list_vis_plugins), item); - items = g_list_append (items, item); - gtk_list_remove_items (GTK_LIST(config_win->list_vis_plugins), items); - g_list_free (items); - - /* Create a new item marked as enabled */ - name = g_strconcat (current_actor->info->name, _(" (enabled)"), NULL); - item = gtk_list_item_new_with_label (name); - g_free (name); - /*gtk_list_select_item (GTK_LIST(config_win->list_vis_plugins), pos);*/ - gtk_widget_show (item); - gtk_signal_connect (GTK_OBJECT(item), "select", - GTK_SIGNAL_FUNC(on_actor_plugin_selected), - (gpointer) current_actor); - - /* Insert the new item */ - items = NULL; - items = g_list_append (items, item); - gtk_list_insert_items (GTK_LIST(config_win->list_vis_plugins), items, pos); - - g_hash_table_insert (actor_plugin_table, plugname, item); - - /* Mark it as enabled */ - enable = g_hash_table_lookup (actor_plugin_enable_table, plugname); - visual_log_return_if_fail (enable != NULL); - *enable = TRUE; - } else { - item = g_hash_table_lookup (actor_plugin_table, plugname); - g_hash_table_remove (actor_plugin_table, plugname); - - /* Drop the item from the list, after save his position */ - pos = gtk_list_child_position (GTK_LIST(config_win->list_vis_plugins), item); - items = g_list_append (items, item); - gtk_list_remove_items (GTK_LIST(config_win->list_vis_plugins), items); - g_list_free (items); - - /* Create a new item marked as enabled */ - item = gtk_list_item_new_with_label (current_actor->info->name); - /*gtk_list_select_item (GTK_LIST(config_win->list_vis_plugins), pos);*/ - gtk_widget_show (item); - gtk_signal_connect (GTK_OBJECT(item), "select", - GTK_SIGNAL_FUNC(on_actor_plugin_selected), - (gpointer) current_actor); - - /* Insert the new item */ - items = NULL; - items = g_list_append (items, item); - gtk_list_insert_items (GTK_LIST(config_win->list_vis_plugins), items, pos); - - g_hash_table_insert (actor_plugin_table, plugname, item); - - /* Mark it as disabled */ - enable = g_hash_table_lookup (actor_plugin_enable_table, plugname); - visual_log_return_if_fail (enable != NULL); - *enable = FALSE; - } -} - -static void on_button_vis_plugin_about_clicked (GtkButton *button, gpointer data) -{ - GtkWidget *msgwin; - gchar *msg; - - if (!current_actor) - return; - - visual_log_return_if_fail (current_actor->info != NULL); - - msg = g_strconcat (current_actor->info->name, "\n", - _("Version: "), current_actor->info->version, "\n", - current_actor->info->about, "\n", - _("Author: "), current_actor->info->author, "\n\n", - current_actor->info->help, NULL); - msgwin = xmms_show_message (PACKAGE_NAME, msg, _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - gtk_widget_show (msgwin); - g_free (msg); -} - -/* FIXME Libvisual API must have something for doing this! */ -static int is_gl_actor (VisPluginRef *actor) -{ - VisPluginData *plugin; - VisActorPlugin *actplugin; - - visual_log_return_val_if_fail (actor != NULL, -1); - visual_log_return_val_if_fail (actor->info->plugin != NULL, -1); - - plugin = visual_plugin_load (actor); - actplugin = plugin->info->plugin; - if (actplugin->depth & VISUAL_VIDEO_DEPTH_GL) { - visual_plugin_unload (plugin); - return TRUE; - } else { - visual_plugin_unload (plugin); - return FALSE; - } -} - -static void actor_plugin_add (VisPluginRef *actor) -{ - visual_log_return_if_fail (actor != NULL); - - if (is_gl_actor (actor)) - actor_plugins_gl = g_slist_append (actor_plugins_gl, actor); - else - actor_plugins_nongl = g_slist_append (actor_plugins_nongl, actor); -} - -/* - * This function initializes the actor_plugin_(gl/nongl)_items lists. - */ -static int load_actor_plugin_list () -{ - VisList *list; - VisListEntry *item; - VisPluginRef *actor; - GtkWidget *msg; - - /* We want to load the lists just once */ - visual_log_return_val_if_fail (actor_plugins_gl == NULL, -1); - visual_log_return_val_if_fail (actor_plugins_nongl == NULL, -1); - - list = visual_actor_get_list (); - if (!list) { - visual_log (VISUAL_LOG_WARNING, _("The list of actor plugins is empty.")); - return -1; - } - - item = NULL; - /* FIXME update to visual_list_is_empty() when ready */ - if (!(actor = (VisPluginRef*) visual_list_next (list, &item))) { - msg = xmms_show_message (_(PACKAGE_NAME " error"), - _("There are no actor plugins installed.\n" - PACKAGE_NAME " cannot be initialized.\n" - "Please visit http://libvisual.sf.net to\n" - "to get some nice plugins."), - _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - return -1; - } - - item = NULL; - while ((actor = (VisPluginRef*) visual_list_next (list, &item))) - actor_plugin_add (actor); - - return 0; -} - -static guint hash_function (gconstpointer key) -{ - const char *skey; - guint hash_value = 0; - int i; - - if (!key) - return 0; - - skey = key; - for (i = 0; i < strlen (skey); i++) - hash_value = (hash_value << 4) + (hash_value ^ (guint) skey[i]); - - return hash_value; -} - -static gint hash_compare (gconstpointer s1, gconstpointer s2) -{ - return (!strcmp ((char*) s1, (char*) s2)); -} - -static void load_actor_enable_state (gpointer data, gpointer user_data) -{ - ConfigDb *db; - VisPluginRef *actor; - gboolean enabled, *b; - - actor = data; - db = user_data; - - visual_log_return_if_fail (actor != NULL); - visual_log_return_if_fail (actor->info != NULL); - visual_log_return_if_fail (db != NULL); - - if (!bmp_cfg_db_get_bool (db, "libvisual", actor->info->plugname, &enabled)) - enabled = TRUE; - - b = g_malloc (sizeof(gboolean)); - *b = enabled; - g_hash_table_insert (actor_plugin_enable_table, actor->info->plugname, b); -} - -static void load_actor_plugin_enable_table (ConfigDb *db) -{ - visual_log_return_if_fail (actor_plugins_nongl != NULL); - visual_log_return_if_fail (actor_plugins_gl != NULL); - visual_log_return_if_fail (db != NULL); - - if (!actor_plugin_enable_table) - actor_plugin_enable_table = g_hash_table_new (hash_function, hash_compare); - - g_slist_foreach (actor_plugins_nongl, load_actor_enable_state, db); - g_slist_foreach (actor_plugins_gl, load_actor_enable_state, db); -} - -static void remove_boolean (gpointer key, gpointer value, gpointer data) -{ - g_free (value); -} - -static void new_actor_item (gpointer data, gpointer user_data) -{ - GList *items; - GtkWidget *item/*, *olditem*/; - VisPluginRef *actor; - gchar *name; - gchar *plugname; - gboolean *enabled; - - actor = data; - items = *(GList**)user_data; - - visual_log_return_if_fail (actor != NULL); - visual_log_return_if_fail (actor->info != NULL); - - plugname = actor->info->plugname; - enabled = g_hash_table_lookup (actor_plugin_enable_table, plugname); - visual_log_return_if_fail (enabled != NULL); - - /* Create the new item */ - if (*enabled) { - name = g_strconcat (actor->info->name, _(" (enabled)"), NULL); - item = gtk_list_item_new_with_label (name); - g_free (name); - } else { - item = gtk_list_item_new_with_label (actor->info->name); - } - - gtk_widget_show (item); - gtk_signal_connect (GTK_OBJECT(item), "select", - GTK_SIGNAL_FUNC(on_actor_plugin_selected), - (gpointer) actor); - items = g_list_append (items, item); - - /*olditem = g_hash_table_lookup (actor_plugin_table, plugname); - if (olditem) - gtk_widget_destroy (olditem);*/ - - g_hash_table_remove (actor_plugin_table, plugname); - g_hash_table_insert (actor_plugin_table, plugname, item); - - *(GList**)user_data = items; -} - -static void config_win_load_actor_plugin_gl_list () -{ - GList *items; - - if (!actor_plugin_table) - actor_plugin_table = g_hash_table_new (hash_function, hash_compare); - - items = NULL; - g_slist_foreach (actor_plugins_gl, new_actor_item, &items); - gtk_list_append_items (GTK_LIST(config_win->list_vis_plugins), items); -} - -static void config_win_load_actor_plugin_nongl_list () -{ - GList *items; - - if (!actor_plugin_table) - actor_plugin_table = g_hash_table_new (hash_function, hash_compare); - - items = NULL; - g_slist_foreach (actor_plugins_nongl, new_actor_item, &items); - gtk_list_append_items (GTK_LIST(config_win->list_vis_plugins), items); -} - -static void on_morph_plugin_activate (GtkMenuItem *menuitem, char *name) -{ - visual_log_return_if_fail (name != NULL); - - morph_plugin = name; -} - -static int config_win_load_morph_plugin_list () -{ - VisList *list; - VisListEntry *item; - VisPluginRef *morph; - GtkWidget *msg; - GtkWidget *menu; - GtkWidget *menuitem; - GSList *group; - gint index; - - /* FIXME use load_morph_plugin_list() */ - list = visual_morph_get_list (); - if (!list) { - visual_log (VISUAL_LOG_WARNING, _("The list of morph plugins is empty.")); - return -1; - } - - item = NULL; - /* FIXME update to visual_list_is_empty() when ready */ - if (!(morph = (VisPluginRef*) visual_list_next (list, &item))) { - msg = xmms_show_message (PACKAGE_NAME, - _("There are no morph plugins, so switching\n" - "between visualization plugins will be do it\n" - "without any morphing."), - _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - return -1; - } - index = 0; - item = NULL; - while ((morph = (VisPluginRef*) visual_list_next (list, &item))) { - if (!(morph->info)) { - visual_log (VISUAL_LOG_WARNING, _("There is no info for this plugin")); - continue; - } - group = config_win->optionmenu_morph_plugin_group; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(config_win->optionmenu_morph_plugin)); - menuitem = gtk_radio_menu_item_new_with_label (group, morph->info->plugname); - group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM(menuitem)); - gtk_menu_append (GTK_MENU(menu), menuitem); - config_win->optionmenu_morph_plugin_group = group; - - gtk_signal_connect (GTK_OBJECT(menuitem), "activate", - GTK_SIGNAL_FUNC(on_morph_plugin_activate), - (gpointer) morph->info->plugname); - - gtk_widget_show (menuitem); - - if (!strcmp (morph->info->plugname, options.morph_plugin)) { - gtk_menu_item_activate (GTK_MENU_ITEM(menuitem)); - gtk_menu_set_active (GTK_MENU(menu), index); - gtk_option_menu_set_history (GTK_OPTION_MENU(config_win->optionmenu_morph_plugin), index); - } - index++; - } - - return 0; -} - -static int load_morph_plugin_list () -{ - VisList *list; - VisListEntry *item; - VisPluginRef *morph; - GtkWidget *msg; - - list = visual_morph_get_list (); - if (!list) { - visual_log (VISUAL_LOG_WARNING, _("The list of morph plugins is empty.")); - return -1; - } - - item = NULL; - /* FIXME update to visual_list_is_empty() when ready */ - if (!(morph = (VisPluginRef*) visual_list_next (list, &item))) { - msg = xmms_show_message (PACKAGE_NAME, - _("There are no morph plugins, so switching\n" - "between visualization plugins will be do it\n" - "without any morphing."), - _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - return -1; - } - item = NULL; - while ((morph = (VisPluginRef*) visual_list_next (list, &item))) { - if (!(morph->info)) { - visual_log (VISUAL_LOG_WARNING, _("There is no info for this plugin")); - continue; - } - morph_plugins_list = g_slist_append (morph_plugins_list, morph->info->plugname); - } - - return 0; -} - -static void on_button_morph_plugin_about_clicked (GtkButton *button, gpointer data) -{ - VisList *list; - VisListEntry *item; - VisPluginRef *morph; - gchar *msg; - GtkWidget *msgwin; - - list = visual_morph_get_list (); - if (!list) { - visual_log (VISUAL_LOG_WARNING, _("The list of input plugins is empty.")); - return; - } - - item = NULL; - while ((morph = (VisPluginRef*) visual_list_next (list, &item))) { - if (!(morph->info)) { - visual_log (VISUAL_LOG_WARNING, _("There is no info for this plugin")); - continue; - } - if (strcmp (morph->info->plugname, options.morph_plugin) == 0) { - msg = g_strconcat (morph->info->name, "\n", - _("Version: "), morph->info->version, "\n", - morph->info->about, "\n", - _("Author: "), morph->info->author, "\n\n", - morph->info->help, NULL); - msgwin = xmms_show_message (PACKAGE_NAME, msg, - _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - gtk_widget_show (msgwin); - g_free (msg); - break; - } - } -} - -static void on_checkbutton_morph_random_toggled (GtkToggleButton *togglebutton, gpointer user_data) -{ - random_morph = !random_morph; -} - -/* - * This function set the default values on configure dialog for all options, - * except the selected vis and morph plugins. - */ -static void config_win_set_defaults (void) -{ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_fullscreen), - default_options.fullscreen); - gtk_spin_button_set_value (GTK_SPIN_BUTTON(config_win->spinbutton_fps), default_options.fps); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_onlygl), - default_options.gl_plugins_only); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_onlynongl), - default_options.non_gl_plugins_only); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->radiobutton_all_plugins), - default_options.all_plugins_enabled); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config_win->checkbutton_morph_random), - default_options.random_morph); -} - -static void config_win_connect_callbacks (void) -{ - gtk_signal_connect (GTK_OBJECT (config_win->checkbutton_vis_plugin), "toggled", - GTK_SIGNAL_FUNC (on_checkbutton_vis_plugin_toggled), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->checkbutton_fullscreen), "toggled", - GTK_SIGNAL_FUNC (on_checkbutton_fullscreen_toggled), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->radiobutton_onlygl), "toggled", - GTK_SIGNAL_FUNC (on_radiobutton_opengl_toggled), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->radiobutton_onlynongl), "toggled", - GTK_SIGNAL_FUNC (on_radiobutton_non_opengl_toggled), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->radiobutton_all_plugins), "toggled", - GTK_SIGNAL_FUNC (on_radiobutton_all_plugins_toggled), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->spinbutton_fps), "changed", - GTK_SIGNAL_FUNC (on_spinbutton_fps_changed), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->button_ok), "clicked", - GTK_SIGNAL_FUNC (on_button_ok_clicked), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->button_apply), "clicked", - GTK_SIGNAL_FUNC (on_button_apply_clicked), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->button_cancel), "clicked", - GTK_SIGNAL_FUNC (on_button_cancel_clicked), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->button_vis_plugin_about), "clicked", - GTK_SIGNAL_FUNC (on_button_vis_plugin_about_clicked), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->button_morph_plugin_about), "clicked", - GTK_SIGNAL_FUNC (on_button_morph_plugin_about_clicked), - NULL); - gtk_signal_connect (GTK_OBJECT (config_win->checkbutton_morph_random), "toggled", - GTK_SIGNAL_FUNC (on_checkbutton_morph_random_toggled), - NULL); -} - -static void config_visual_initialize () -{ - int argc; - char **argv; - GtkWidget *msg; - - if (!visual_is_initialized ()) { - argv = g_malloc (sizeof(char*)); - argv[0] = g_strdup ("Libvisual"); - argc = 1; - if (visual_init (&argc, &argv) < 0) { - msg = xmms_show_message (PACKAGE_NAME, - _("We cannot initialize Libvisual library.\n" - "Libvisual is necessary for this plugin to work."), - _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - gtk_widget_show (msg); - g_free (argv[0]); - g_free (argv); - return; - } - g_free (argv[0]); - g_free (argv); - } -} - -static void dummy (GtkWidget *widget, gpointer data) -{ -} - -static gboolean read_config_db (ConfigDb *db) -{ - gchar *enabled_plugins; - gboolean errors = FALSE; - - if (!bmp_cfg_db_get_string (db, "libvisual", "last_plugin", &actor_plugin_buffer) - || (strlen (actor_plugin_buffer) <= 0)) { - visual_log (VISUAL_LOG_DEBUG, "Error on last_plugin option"); - strcpy (actor_plugin_buffer, CONFIG_DEFAULT_ACTOR_PLUGIN); - errors = TRUE; - } - options.last_plugin = actor_plugin_buffer; - if (!bmp_cfg_db_get_string (db, "libvisual", "morph_plugin", &morph_plugin_buffer) - || (strlen (morph_plugin_buffer) <= 0)) { - visual_log (VISUAL_LOG_DEBUG, "Error on morph_plugin option"); - strcpy (morph_plugin_buffer, CONFIG_DEFAULT_MORPH_PLUGIN); - errors = TRUE; - } - morph_plugin = morph_plugin_buffer; - options.morph_plugin = morph_plugin; - if (!bmp_cfg_db_get_bool (db, "libvisual", "random_morph", &options.random_morph)) { - visual_log (VISUAL_LOG_DEBUG, "Error on random_morph option"); - options.random_morph = default_options.random_morph; - errors = TRUE; - } - if (!bmp_cfg_db_get_int (db, "libvisual", "width", &options.width) || options.width <= 0) { - visual_log (VISUAL_LOG_DEBUG, "Error on width option"); - options.width = default_options.width; - errors = TRUE; - } - if (!bmp_cfg_db_get_int (db, "libvisual", "height", &options.height) || options.height <= 0) { - visual_log (VISUAL_LOG_DEBUG, "Error on height option"); - options.height = default_options.height; - errors = TRUE; - } - if (!bmp_cfg_db_get_int (db, "libvisual", "fps", &options.fps) || options.fps <= 0) { - visual_log (VISUAL_LOG_DEBUG, "Error on fps option"); - options.fps = default_options.fps; - errors = TRUE; - } - if (!bmp_cfg_db_get_int (db, "libvisual", "color_depth", &options.depth) || options.depth <= 0) { - visual_log (VISUAL_LOG_DEBUG, "Error on color_depth option"); - options.depth = default_options.depth; - errors = TRUE; - } - if (!bmp_cfg_db_get_bool (db, "libvisual", "fullscreen", &options.fullscreen)) { - visual_log (VISUAL_LOG_DEBUG, "Error on fullscreen option"); - options.fullscreen = default_options.fullscreen; - errors = TRUE; - } - enabled_plugins = g_malloc0 (OPTIONS_MAX_NAME_LEN); - if (!bmp_cfg_db_get_string (db, "libvisual", "enabled_plugins", &enabled_plugins) - || (strlen (enabled_plugins) <= 0)) { - visual_log (VISUAL_LOG_DEBUG, "Error on enabled_plugins option: %s", enabled_plugins); - options.gl_plugins_only = default_options.gl_plugins_only; - options.non_gl_plugins_only = default_options.non_gl_plugins_only; - options.all_plugins_enabled = default_options.all_plugins_enabled; - errors = TRUE; - } else { - options.gl_plugins_only = FALSE; - options.non_gl_plugins_only = FALSE; - options.all_plugins_enabled = FALSE; - if (strcmp (enabled_plugins, "gl_only") == 0) - options.gl_plugins_only = TRUE; - else if (strcmp (enabled_plugins, "non_gl_only") == 0) - options.non_gl_plugins_only = TRUE; - else if (strcmp (enabled_plugins, "all") == 0) - options.all_plugins_enabled = TRUE; - else { - visual_log (VISUAL_LOG_WARNING, _("Invalid value for 'enabled_plugins' option")); - options.gl_plugins_only = default_options.gl_plugins_only; - options.non_gl_plugins_only = default_options.non_gl_plugins_only; - options.all_plugins_enabled = default_options.all_plugins_enabled; - errors = TRUE; - } - } - g_free (enabled_plugins); - - return errors; -}
--- a/Plugins/Visualization/libvisual-proxy/lv_bmp_config.h Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -#ifndef __LV_BMP_CONFIG__ -#define __LV_BMP_CONFIG__ - -#include <glib.h> - -#define OPTIONS_MAX_NAME_LEN 256 -#define OPTIONS_MAX_ICON_PATH_LEN 256 - -/** - * User options information. - * - * Just one of all_plugins_enabled, gl_plugins_only or non_gl_plugins_only - * is enabled at a given time. - */ -typedef struct { - - char *last_plugin; /**< Name of the last plugin runned, - with length < OPTIONS_MAX_NAME_LEN. */ - - gchar *morph_plugin; /**< */ - - gchar *icon_file; /**< Absolute path of the icon file, - with length < OPTIONS_MAX_ICON_PATH_LEN. */ - int width; /**< Width in pixels. */ - int height; /**< Height in pixels. */ - int fps; /**< Maximum frames per second. */ - int depth; /**< Color depth. */ - gboolean fullscreen; /**< Say if we are in fullscreen or not. */ - - gboolean gl_plugins_only; /**< Only Gl plugins must be showed */ - gboolean non_gl_plugins_only; /**< Only non GL plugins must be showed */ - gboolean all_plugins_enabled; /**< All plugins must be showed */ - gboolean random_morph; /**< Morph plugin will be selected randomly on - every switch. */ - -} Options; - -void lv_bmp_config_window (void); - -Options *lv_bmp_config_open (void); -int lv_bmp_config_close (void); - -int lv_bmp_config_load_prefs (void); -int lv_bmp_config_save_prefs (void); - -void lv_bmp_config_toggle_fullscreen (void); - -char *lv_bmp_config_get_next_actor (void); -char *lv_bmp_config_get_prev_actor (void); -void lv_bmp_config_set_current_actor (char *name); - -char *lv_bmp_config_morph_plugin (void); - -#endif /* __LV_BMP_CONFIG__ */ -
--- a/Plugins/Visualization/libvisual-proxy/main.c Sat Feb 25 01:30:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,669 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> - -#include <audacious/plugin.h> -#include <libaudacious/util.h> -#include <libaudacious/beepctrl.h> - -#include <SDL.h> -#include <SDL_thread.h> - -#include <gtk/gtk.h> -#include <glib/gi18n.h> - -#include <libvisual/libvisual.h> - -#include "config.h" - -#include "lv_bmp_config.h" -#include "about.h" - -#define LV_XMMS_DEFAULT_INPUT_PLUGIN "alsa" -#undef LV_XMMS_ENABLE_DEBUG - -/* SDL variables */ -static SDL_Surface *screen = NULL; -static SDL_Color sdlpal[256]; -static SDL_Thread *render_thread; -static SDL_mutex *pcm_mutex; - -/* Libvisual and visualisation variables */ -static VisVideo *video; -static VisPalette *pal; - -static char song_name[1024]; -static char *cur_lv_plugin = NULL; - -static VisBin *bin = NULL; - -static VisSongInfo *songinfo; - -static Options *options; - -static int gl_plug = 0; - -static gint16 xmmspcm[2][512]; - -/* Thread state variables */ -static int visual_running = 0; -static int visual_stopped = 1; - -static void lv_bmp_init (void); -static void lv_bmp_cleanup (void); -static void lv_bmp_disable (VisPlugin *); -static void lv_bmp_playback_start (void); -static void lv_bmp_playback_stop (void); -static void lv_bmp_render_pcm (gint16 data[2][512]); - -static int sdl_quit (void); -static void sdl_set_pal (void); -static void sdl_draw (SDL_Surface *screen); -static int sdl_create (int width, int height); -static int sdl_event_handle (void); - -static int visual_upload_callback (VisInput *input, VisAudio *audio, void *private); -static int visual_resize (int width, int height); -static int visual_initialize (int width, int height); -static int visual_render (void*); - -static gint disable_func (gpointer data); -static void dummy (GtkWidget *widget, gpointer data); - -VisPlugin *get_vplugin_info (void); - -VisPlugin lv_bmp_vp = -{ - NULL, /* (void*) handle, filled in by xmms */ - NULL, /* (char*) Filename, filled in by xmms */ - 0, /* The session ID for attaching to the control socket */ - "libvisual proxy plugin", /* description */ - 2, /* Numbers of PCM channels wanted in the call to render_pcm */ - 0, /* Numbers of freq channels wanted in the call to render_freq */ - lv_bmp_init, /* init */ - lv_bmp_cleanup, /* cleanup */ - NULL, /* about */ - NULL, /* configure */ - lv_bmp_disable, /* disable plugin */ - lv_bmp_playback_start, /* playback start */ - lv_bmp_playback_stop, /* playback stop */ - lv_bmp_render_pcm, /* render pcm */ - NULL, /* render freq */ -}; - -VisPlugin *get_vplugin_info () -{ - return &lv_bmp_vp; -} - -static char *lv_bmp_get_songname () -{ - return xmms_remote_get_playlist_title (lv_bmp_vp.xmms_session, - xmms_remote_get_playlist_pos (lv_bmp_vp.xmms_session)); -} - -static void lv_bmp_init () -{ - char **argv; - int argc; - gchar *msg; - GtkWidget *msgwin; - - if (!visual_is_initialized ()) { - argv = g_malloc (sizeof(char*)); - argv[0] = g_strdup (_("Audacious plugin")); - argc = 1; - - visual_init (&argc, &argv); - - g_free (argv[0]); - g_free (argv); - } - -#ifdef LV_XMMS_ENABLE_DEBUG - visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_HIGH); -#else - visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_NONE); -#endif - - options = lv_bmp_config_open (); - if (!options) { - visual_log (VISUAL_LOG_CRITICAL, _("Cannot get options")); - return; - } - - lv_bmp_config_load_prefs (); - - if (SDL_Init (SDL_INIT_VIDEO) < 0) { - msg = g_strconcat (_("Cannot initialize SDL!\n"), - SDL_GetError(), - "\n\n", PACKAGE_NAME, - _(" will not be loaded."), NULL); - msgwin = xmms_show_message ("libvisual-proxy", msg, _("Accept"), TRUE, GTK_SIGNAL_FUNC(dummy), NULL); - gtk_widget_show (msgwin); - g_free (msg); - return; - } - - pcm_mutex = SDL_CreateMutex (); - - if (strlen (options->last_plugin) <= 0 ) { - visual_log (VISUAL_LOG_INFO, _("Last plugin: (none)")); - } else { - visual_log (VISUAL_LOG_INFO, _("Last plugin: %s"), options->last_plugin); - } - - cur_lv_plugin = options->last_plugin; - if (!(visual_actor_valid_by_name (cur_lv_plugin))) { - visual_log (VISUAL_LOG_INFO, _("%s is not a valid actor plugin"), cur_lv_plugin); - cur_lv_plugin = lv_bmp_config_get_next_actor (); - } - - SDL_WM_SetCaption (cur_lv_plugin, cur_lv_plugin); - - if (!cur_lv_plugin) { - visual_log (VISUAL_LOG_CRITICAL, _("Could not get actor plugin")); - lv_bmp_config_close (); - return; - } else { - lv_bmp_config_set_current_actor (cur_lv_plugin); - } - - visual_log (VISUAL_LOG_DEBUG, "calling SDL_CreateThread()"); - - render_thread = SDL_CreateThread ((void *) visual_render, NULL); -} - -static void lv_bmp_cleanup () -{ - visual_log (VISUAL_LOG_DEBUG, "entering cleanup..."); - visual_running = 0; - - SDL_WaitThread (render_thread, NULL); - - render_thread = NULL; - visual_stopped = 1; - - visual_log (VISUAL_LOG_DEBUG, "calling SDL_DestroyMutex()"); - SDL_DestroyMutex (pcm_mutex); - - pcm_mutex = NULL; - - /* - * WARNING This must be synchronized with config module. - */ - - options->last_plugin = cur_lv_plugin; - - visual_log (VISUAL_LOG_DEBUG, "calling lv_bmp_config_save_prefs()"); - lv_bmp_config_save_prefs (); - - visual_log (VISUAL_LOG_DEBUG, "closing config file"); - lv_bmp_config_close (); - - visual_log (VISUAL_LOG_DEBUG, "destroying VisBin..."); - visual_object_unref (VISUAL_OBJECT (bin)); - - visual_log (VISUAL_LOG_DEBUG, "calling sdl_quit()"); - sdl_quit (); - - visual_log (VISUAL_LOG_DEBUG, "calling visual_quit()"); - visual_quit (); -} - -static void lv_bmp_disable (VisPlugin* plugin) -{ - -} - -static void lv_bmp_playback_start () -{ - -} -static void lv_bmp_playback_stop () -{ - -} - -static void lv_bmp_render_pcm (gint16 data[2][512]) -{ - if (visual_running == 1) { - SDL_mutexP (pcm_mutex); - memcpy (xmmspcm, data, sizeof(gint16)*2*512); - strncpy (song_name, lv_bmp_get_songname (), 1023); - SDL_mutexV (pcm_mutex); - } -} - -static int sdl_quit () -{ - visual_log (VISUAL_LOG_DEBUG, "Calling SDL_FreeSurface()"); - if (screen != NULL) - SDL_FreeSurface (screen); - - screen = NULL; - - visual_log (VISUAL_LOG_DEBUG, "sdl_quit: calling SDL_Quit()"); - /* - * FIXME this doesn't work! - */ - SDL_Quit (); - - visual_log (VISUAL_LOG_DEBUG, "Leaving..."); - return 0; -} - -static void sdl_set_pal () -{ - int i; - - visual_log_return_if_fail (screen != NULL); - - if (pal != NULL) { - for (i = 0; i < 256; i ++) { - sdlpal[i].r = pal->colors[i].r; - sdlpal[i].g = pal->colors[i].g; - sdlpal[i].b = pal->colors[i].b; - } - SDL_SetColors (screen, sdlpal, 0, 256); - } -} - -static void sdl_draw (SDL_Surface *screen) -{ - visual_log_return_if_fail (screen != NULL); - SDL_Flip (screen); -} - -static int sdl_create (int width, int height) -{ - const SDL_VideoInfo *videoinfo; - int videoflags; - - if (screen != NULL) - SDL_FreeSurface (screen); - - visual_log (VISUAL_LOG_DEBUG, "sdl_create video->bpp %d", video->bpp); - visual_log (VISUAL_LOG_DEBUG, gl_plug ? "OpenGl plugin at create: yes" : "OpenGl plugin at create: no"); - - if (gl_plug == 1) { - videoinfo = SDL_GetVideoInfo (); - - if (videoinfo == 0) { - visual_log (VISUAL_LOG_CRITICAL, _("Could not get video info")); - return -1; - } - - videoflags = SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_HWPALETTE | SDL_RESIZABLE; - - if (videoinfo->hw_available) - videoflags |= SDL_HWSURFACE; - else - videoflags |= SDL_SWSURFACE; - - if (videoinfo->blit_hw) - videoflags |= SDL_HWACCEL; - - SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); - - visual_log (VISUAL_LOG_DEBUG, "Setting video mode %dx%d", width, height); - screen = SDL_SetVideoMode (width, height, 16, videoflags); - } else { - visual_log (VISUAL_LOG_DEBUG, "Setting video mode %dx%d", width, height); - screen = SDL_SetVideoMode (width, height, video->bpp * 8, SDL_RESIZABLE); - } - - SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY / 4, SDL_DEFAULT_REPEAT_INTERVAL / 4); - - visual_video_set_buffer (video, screen->pixels); - visual_log (VISUAL_LOG_DEBUG, "pointer to the pixels: %p", screen->pixels); - - visual_video_set_pitch (video, screen->pitch); - visual_log (VISUAL_LOG_DEBUG, "pitch: %d", video->pitch); - - return 0; -} - -static int visual_initialize (int width, int height) -{ - VisInput *input; - VisVideoDepth depth; - int ret; - - bin = visual_bin_new (); - visual_bin_set_supported_depth (bin, VISUAL_VIDEO_DEPTH_ALL); -// visual_bin_set_preferred_depth (bin, VISUAL_BIN_DEPTH_LOWEST); - - depth = visual_video_depth_enum_from_value (options->depth); - if (depth == VISUAL_VIDEO_DEPTH_ERROR) - depth = VISUAL_VIDEO_DEPTH_24BIT; - options->depth = depth; - - video = visual_video_new (); - - ret = visual_video_set_depth (video, depth); - if (ret < 0) { - visual_log (VISUAL_LOG_CRITICAL, _("Cannot set video depth")); - return -1; - } - visual_video_set_dimension (video, width, height); - - ret = visual_bin_set_video (bin, video); - if (ret < 0) { - visual_log (VISUAL_LOG_CRITICAL, _("Cannot set video")); - return -1; - } - /*visual_bin_connect_by_names (bin, cur_lv_plugin, NULL);*/ - visual_bin_connect_by_names (bin, cur_lv_plugin, LV_XMMS_DEFAULT_INPUT_PLUGIN); - - if (visual_bin_get_depth (bin) == VISUAL_VIDEO_DEPTH_GL) { - visual_video_set_depth (video, VISUAL_VIDEO_DEPTH_GL); - gl_plug = 1; - } else { - gl_plug = 0; - } - - visual_log (VISUAL_LOG_DEBUG, gl_plug ? "OpenGl plugin: yes" : "OpenGl plugin: no"); - ret = sdl_create (width, height); - if (ret < 0) { - return -1; - } - - /* Called so the flag is set to FALSE, seen we create the initial environment here */ - visual_bin_depth_changed (bin); - - input = visual_bin_get_input (bin); - ret = visual_input_set_callback (input, visual_upload_callback, NULL); - if (ret < 0) { - visual_log (VISUAL_LOG_CRITICAL, _("Cannot set input plugin callback")); - return -1; - } - - visual_bin_switch_set_style (bin, VISUAL_SWITCH_STYLE_MORPH); - visual_bin_switch_set_automatic (bin, TRUE); - visual_bin_switch_set_mode (bin, VISUAL_MORPH_MODE_TIME); - visual_bin_switch_set_time (bin, 4, 0); - - visual_bin_realize (bin); - visual_bin_sync (bin, FALSE); - - return 0; -} - -static int visual_upload_callback (VisInput *input, VisAudio *audio, void *private_data) -{ - int i; - - visual_log_return_val_if_fail (audio != NULL, -1); - - for (i = 0; i < 512; i++) { - audio->plugpcm[0][i] = xmmspcm[0][i]; - audio->plugpcm[1][i] = xmmspcm[1][i]; - } - - return 0; -} - -static int visual_resize (int width, int height) -{ - visual_video_set_dimension (video, width, height); - - sdl_create (width, height); - - options->width = width; - options->height = height; - - visual_bin_sync (bin, FALSE); - - return 0; -} - -static int visual_render (void *arg) -{ - visual_running = 1; - visual_stopped = 0; - static long render_time, now; - long frame_length; - long idle_time; - long frames; - int ret; - - ret = visual_initialize (options->width, options->height); - if (ret < 0) { - visual_log (VISUAL_LOG_CRITICAL, _("Cannot initialize plugin's visual stuff")); - return -1; - } - - frame_length = (1.0 / options->fps) * 1000; - frames = 0; - while (visual_running == 1) { - /* Update songinfo */ - songinfo = visual_actor_get_songinfo (visual_bin_get_actor (bin)); - visual_songinfo_set_type (songinfo, VISUAL_SONGINFO_TYPE_SIMPLE); - - visual_songinfo_set_simple_name (songinfo, song_name); - - /* On depth change */ - if (visual_bin_depth_changed (bin) == TRUE) { - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_LockSurface (screen); - - visual_video_set_buffer (video, screen->pixels); - if (visual_bin_get_depth (bin) == VISUAL_VIDEO_DEPTH_GL) - gl_plug = 1; - else - gl_plug = 0; - - sdl_create (options->width, options->height); - visual_bin_sync (bin, TRUE); - - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_UnlockSurface (screen); - } - - render_time = SDL_GetTicks(); - - if (gl_plug == 1) { - visual_bin_run (bin); - - SDL_GL_SwapBuffers (); - } else { - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_LockSurface (screen); - - visual_bin_run (bin); - - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_UnlockSurface (screen); - - pal = visual_bin_get_palette (bin); - sdl_set_pal (); - - sdl_draw (screen); - } - - now = SDL_GetTicks(); - idle_time = now - render_time; - - if (idle_time < frame_length) - usleep(idle_time * 900); - - sdl_event_handle (); - - if (options->fullscreen && !(screen->flags & SDL_FULLSCREEN)) - SDL_WM_ToggleFullScreen (screen); - frames++; - /* - * Sometime we actualize the frame_length, because we let user - * choose maximum FPS dinamically. - */ - if (frames > options->fps) { - frames = 0; - frame_length = (1.0 / options->fps) * 1000; - } - } - - visual_stopped = 1; - return 0; -} - -static int sdl_event_handle () -{ - SDL_Event event; - VisEventQueue *vevent; - char *next_plugin; - - while (SDL_PollEvent (&event)) { - vevent = visual_plugin_get_eventqueue (visual_actor_get_plugin (visual_bin_get_actor (bin))); - - switch (event.type) { - case SDL_KEYUP: - visual_event_queue_add_keyboard (vevent, event.key.keysym.sym, event.key.keysym.mod, VISUAL_KEY_UP); - break; - - case SDL_KEYDOWN: - visual_event_queue_add_keyboard (vevent, event.key.keysym.sym, event.key.keysym.mod, VISUAL_KEY_DOWN); - - switch (event.key.keysym.sym) { - /* XMMS CONTROLS */ - case SDLK_UP: - xmms_remote_set_main_volume (lv_bmp_vp.xmms_session, - xmms_remote_get_main_volume (lv_bmp_vp.xmms_session) + 1); - break; - case SDLK_DOWN: - xmms_remote_set_main_volume (lv_bmp_vp.xmms_session, - xmms_remote_get_main_volume (lv_bmp_vp.xmms_session) - 1); - break; - case SDLK_LEFT: - if (xmms_remote_is_playing (lv_bmp_vp.xmms_session)) - xmms_remote_jump_to_time (lv_bmp_vp.xmms_session, - xmms_remote_get_output_time (lv_bmp_vp.xmms_session) - 5000); - break; - case SDLK_RIGHT: - if (xmms_remote_is_playing (lv_bmp_vp.xmms_session)) - xmms_remote_jump_to_time (lv_bmp_vp.xmms_session, - xmms_remote_get_output_time (lv_bmp_vp.xmms_session) + 5000); - break; - case SDLK_z: - xmms_remote_playlist_prev (lv_bmp_vp.xmms_session); - break; - - case SDLK_x: - xmms_remote_play (lv_bmp_vp.xmms_session); - break; - - case SDLK_c: - xmms_remote_pause (lv_bmp_vp.xmms_session); - break; - - case SDLK_v: - xmms_remote_stop (lv_bmp_vp.xmms_session); - break; - - case SDLK_b: - xmms_remote_playlist_next (lv_bmp_vp.xmms_session); - break; - - /* PLUGIN CONTROLS */ - case SDLK_F11: - case SDLK_TAB: - SDL_WM_ToggleFullScreen (screen); - lv_bmp_config_toggle_fullscreen(); - - if ((screen->flags & SDL_FULLSCREEN) > 0) - SDL_ShowCursor (SDL_DISABLE); - else - SDL_ShowCursor (SDL_ENABLE); - - break; - - case SDLK_a: - next_plugin = lv_bmp_config_get_prev_actor (); - - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_LockSurface (screen); - - if (next_plugin != NULL && (strcmp (next_plugin, cur_lv_plugin) != 0)) { - lv_bmp_config_set_current_actor (next_plugin); - cur_lv_plugin = next_plugin; - visual_bin_set_morph_by_name (bin, lv_bmp_config_morph_plugin()); - visual_bin_switch_actor_by_name (bin, cur_lv_plugin); - } - - SDL_WM_SetCaption (cur_lv_plugin, cur_lv_plugin); - - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_UnlockSurface (screen); - - break; - - case SDLK_s: - next_plugin = lv_bmp_config_get_next_actor (); - - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_LockSurface (screen); - - if (next_plugin != NULL && (strcmp (next_plugin, cur_lv_plugin) != 0)) { - lv_bmp_config_set_current_actor (next_plugin); - cur_lv_plugin = next_plugin; - visual_bin_set_morph_by_name (bin, lv_bmp_config_morph_plugin()); - visual_bin_switch_actor_by_name (bin, cur_lv_plugin); - } - - SDL_WM_SetCaption (cur_lv_plugin, cur_lv_plugin); - - if (SDL_MUSTLOCK (screen) == SDL_TRUE) - SDL_UnlockSurface (screen); - - break; - - default: /* to avoid warnings */ - break; - } - break; - - case SDL_VIDEORESIZE: - visual_resize (event.resize.w, event.resize.h); - break; - - case SDL_MOUSEMOTION: - visual_event_queue_add_mousemotion (vevent, event.motion.x, event.motion.y); - break; - - case SDL_MOUSEBUTTONDOWN: - visual_event_queue_add_mousebutton (vevent, event.button.button, VISUAL_MOUSE_DOWN, - event.button.x, event.button.y); - break; - - case SDL_MOUSEBUTTONUP: - visual_event_queue_add_mousebutton (vevent, event.button.button, VISUAL_MOUSE_UP, - event.button.x, event.button.y); - break; - - case SDL_QUIT: - GDK_THREADS_ENTER (); - gtk_idle_add (disable_func, NULL); - GDK_THREADS_LEAVE (); - break; - - default: /* to avoid warnings */ - break; - } - } - - return 0; -} - -static gint disable_func (gpointer data) -{ - lv_bmp_vp.disable_plugin (&lv_bmp_vp); - - return FALSE; -} - - -static void dummy (GtkWidget *widget, gpointer data) -{ -} -
--- a/audacious/pluginenum.c Sat Feb 25 01:30:30 2006 -0800 +++ b/audacious/pluginenum.c Sat Feb 25 09:35:27 2006 -0800 @@ -29,6 +29,7 @@ #include <gmodule.h> #include <glib/gprintf.h> #include <string.h> +#include <stdio.h> #include "controlsocket.h" #include "main.h" @@ -364,6 +365,7 @@ for (node = get_input_list(); node; node = g_list_next(node)) { ip = INPUT_PLUGIN(node->data); if (ip && ip->cleanup) { + printf("Cleaning up input plugin %s\n", ip->filename); ip->cleanup(); GDK_THREADS_LEAVE(); while (g_main_iteration(FALSE)); @@ -378,6 +380,7 @@ for (node = get_output_list(); node; node = g_list_next(node)) { op = OUTPUT_PLUGIN(node->data); if (op && op->cleanup) { + printf("Cleaning up output plugin %s\n", op->filename); op->cleanup(); GDK_THREADS_LEAVE(); while (g_main_iteration(FALSE)); @@ -392,6 +395,7 @@ for (node = get_effect_list(); node; node = g_list_next(node)) { ep = EFFECT_PLUGIN(node->data); if (ep && ep->cleanup) { + printf("Cleaning up effect plugin %s\n", ep->filename); ep->cleanup(); GDK_THREADS_LEAVE(); while (g_main_iteration(FALSE)); @@ -418,6 +422,7 @@ for (node = get_general_list(); node; node = g_list_next(node)) { gp = GENERAL_PLUGIN(node->data); if (gp && gp->cleanup) { + printf("Cleaning up general plugin %s\n", gp->filename); gp->cleanup(); GDK_THREADS_LEAVE(); while (g_main_iteration(FALSE)); @@ -444,6 +449,7 @@ for (node = get_vis_list(); node; node = g_list_next(node)) { vp = VIS_PLUGIN(node->data); if (vp && vp->cleanup) { + printf("Cleaning up visualisation plugin %s\n", vp->filename); vp->cleanup(); GDK_THREADS_LEAVE(); while (g_main_iteration(FALSE));
--- a/configure.ac Sat Feb 25 01:30:30 2006 -0800 +++ b/configure.ac Sat Feb 25 09:35:27 2006 -0800 @@ -779,29 +779,6 @@ AC_SUBST(beepdir) AC_SUBST(plugindir) -have_libvisual="yes" - -AC_CHECK_HEADERS([GL/gl.h GL/glx.h GL/glu.h],opengl="yes",opengl="no") -if test x"$opengl" = xno; then - AC_WARN([OpenGL and Glu headers not found, libvisual support cannot be built]) - have_libvisual="no" -fi - -AC_PATH_PROG(SDL_CONFIG, [sdl-config], [no]) -AM_PATH_SDL(1.2.5, , [AC_WARN([*** SDL >= 1.2.5 not installed - please install first ***]) - have_libvisual="no"]) - -PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.2.0, [libvis="yes"], [libvis="no"]) -if test x"$libvis" = xno; then - have_libvisual="no" -fi -AC_SUBST(LIBVISUAL_LIBS) -AC_SUBST(LIBVISUAL_CFLAGS) - -if test "x$have_libvisual" = xyes; then - VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS libvisual-proxy"; -fi - AC_SUBST(EFFECT_PLUGINS) AC_SUBST(GENERAL_PLUGINS) AC_SUBST(INPUT_PLUGINS) @@ -854,7 +831,6 @@ Plugins/Input/amidi-plug/Makefile Plugins/Visualization/Makefile Plugins/Visualization/blur_scope/Makefile - Plugins/Visualization/libvisual-proxy/Makefile Plugins/General/Makefile Plugins/General/song_change/Makefile Plugins/General/lirc/Makefile @@ -935,7 +911,6 @@ echo " Visualization" echo " -------------" echo " Blur Scope: yes" -echo " libvisual-proxy: $have_libvisual" echo if test "$beep_cv_lib_xlibs_threadsafe" = "no"; then