Mercurial > audlegacy
changeset 1649:f3934d790a2e trunk
[svn] - abstractionalize a lot of stuff, build still broken, live with it
author | nenolod |
---|---|
date | Thu, 07 Sep 2006 21:44:05 -0700 |
parents | d878473e6e3e |
children | cb226180eabb |
files | ChangeLog audacious/controlsocket.c audacious/genevent.c audacious/input.c audacious/interface.h audacious/main.c audacious/main.h audacious/playback.c audacious/playlist.c audacious/pluginenum.c audacious/util.c audacious/util.h audacious/visualization.c |
diffstat | 13 files changed, 167 insertions(+), 146 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Sep 07 20:53:57 2006 -0700 +++ b/ChangeLog Thu Sep 07 21:44:05 2006 -0700 @@ -1,3 +1,12 @@ +2006-09-08 03:53:57 +0000 William Pitcock <nenolod@nenolod.net> + revision [2227] + - remove orphaned dependencies + + + Changes: Modified: + +2 -6 trunk/audacious/Makefile + + 2006-09-08 03:52:55 +0000 William Pitcock <nenolod@nenolod.net> revision [2225] - remove WA2gui code
--- a/audacious/controlsocket.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/controlsocket.c Thu Sep 07 21:44:05 2006 -0700 @@ -44,14 +44,12 @@ #include <arpa/inet.h> #include "main.h" -#include "equalizer.h" -#include "mainwin.h" #include "input.h" #include "playback.h" #include "playlist.h" -#include "ui_playlist.h" #include "prefswin.h" #include "libaudacious/beepctrl.h" +#include "interface.h" #define CTRLSOCKET_BACKLOG 100 #define CTRLSOCKET_TIMEOUT 100000 @@ -434,10 +432,6 @@ ctrl_write_gint(pkt->fd, b); ctrl_ack_packet(pkt); break; - case CMD_GET_SKIN: - ctrl_write_string(pkt->fd, bmp_active_skin->path); - ctrl_ack_packet(pkt); - break; case CMD_GET_PLAYLIST_FILE: if (pkt->data) { gchar *filename; @@ -756,7 +750,7 @@ mainwin_quit_cb(); break; case CMD_ACTIVATE: - gtk_window_present(GTK_WINDOW(mainwin)); + current_interface->present(); break; default: g_message("Unknown socket command received");
--- a/audacious/genevent.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/genevent.c Thu Sep 07 21:44:05 2006 -0700 @@ -52,16 +52,13 @@ #include "controlsocket.h" #include "dnd.h" #include "effect.h" -#include "equalizer.h" #include "general.h" #include "hints.h" #include "input.h" #include "logger.h" -#include "mainwin.h" #include "output.h" #include "playback.h" #include "playlist.h" -#include "ui_playlist.h" #include "pluginenum.h" #include "prefswin.h" #include "skinwin.h" @@ -70,6 +67,8 @@ gboolean ev_waiting = FALSE; +#if 0 +/* *** TO WA2GUI *** */ static gboolean idle_func_change_song(gboolean waiting) { @@ -121,6 +120,7 @@ return waiting; } +#endif gint audcore_generic_events(void) @@ -135,7 +135,9 @@ switch (time) { case -1: /* no song playing */ +#if 0 ev_waiting = idle_func_change_song(ev_waiting); +#endif break; default:
--- a/audacious/input.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/input.c Thu Sep 07 21:44:05 2006 -0700 @@ -31,13 +31,12 @@ #include "fft.h" #include "input.h" #include "main.h" -#include "mainwin.h" #include "output.h" #include "util.h" #include "visualization.h" #include "playback.h" -#include "widgets/widgetcore.h" #include "pluginenum.h" +#include "interface.h" #include "libaudacious/titlestring.h" #include "libaudacious/util.h" @@ -315,7 +314,7 @@ GtkCellRenderer *renderer; dialog = - gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin), + gtk_message_dialog_new_with_markup(GTK_WINDOW(current_interface->parentwin), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, @@ -738,15 +737,13 @@ gchar * input_get_info_text(void) { - return g_strdup(input_info_text); + return current_interface->get_status_text(); } void input_set_info_text(const gchar * text) { - g_free(input_info_text); - input_info_text = g_strdup(text); - mainwin_set_info_text(); + current_interface->set_status_text(text); } void @@ -758,11 +755,15 @@ if (!get_current_input_plugin()) return; + current_interface->buffering_notify(ip_data.buffering); + +#if 0 ip_data.buffering = status; if (ip_data.buffering == TRUE && mainwin_playstatus->ps_status == STATUS_STOP) mainwin_playstatus->ps_status = STATUS_PLAY; playstatus_set_status_buffering(mainwin_playstatus, ip_data.buffering); +#endif } void
--- a/audacious/interface.h Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/interface.h Thu Sep 07 21:44:05 2006 -0700 @@ -23,6 +23,8 @@ struct _InterfacePlugin { gchar *name; + GtkWidget *parentwin; + void (*init) (void); void (*cleanup) (void); void (*about) (void); @@ -30,9 +32,16 @@ void (*disable_plugin) (struct _VisPlugin *); void (*playback_start) (void); void (*playback_stop) (void); - void (*dump_pcm_data) (gint16 pcm_data[2][512]); - void (*dump_freq_data) (gint16 freq_data[2][256]); + void (*clear_pcm_data) (void); + void (*send_pcm_data) (gint16 pcm_data[2][512], gint nch, gint length); void (*redraw) (void); + gboolean (*idle_callback) (gboolean waiting); + void (*playstatus_notify) (gint status); + void (*buffering_notify) (gint status); + void (*set_status_text) (gchar *text); + gchar *(*get_status_text) (void); + void (*set_song_info) (gint, gint, gint); + void (*present) (void); }; typedef struct _InterfacePlugin InterfacePlugin; @@ -40,4 +49,6 @@ extern void register_interface_plugin(InterfacePlugin *); extern void start_interface_plugin(InterfacePlugin *); +extern InterfacePlugin *current_interface; + #endif
--- a/audacious/main.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/main.c Thu Sep 07 21:44:05 2006 -0700 @@ -54,17 +54,14 @@ #include "controlsocket.h" #include "dnd.h" #include "effect.h" -#include "equalizer.h" #include "general.h" #include "genevent.h" #include "hints.h" #include "input.h" #include "logger.h" -#include "mainwin.h" #include "output.h" #include "playback.h" #include "playlist.h" -#include "ui_playlist.h" #include "pluginenum.h" #include "prefswin.h" #include "skinwin.h" @@ -84,6 +81,11 @@ const gchar *application_name = N_("Audacious"); +/* XXX */ +#include "Plugins/UserInterface/wa2gui/mainwin.h" +#include "Plugins/UserInterface/wa2gui/equalizer.h" +#include "Plugins/UserInterface/wa2gui/playlist.h" + struct _BmpCmdLineOpt { GList *filenames; gint session;
--- a/audacious/main.h Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/main.h Thu Sep 07 21:44:05 2006 -0700 @@ -22,8 +22,8 @@ #ifndef MAIN_H #define MAIN_H -#include "widgets/widgetcore.h" -#include "mainwin.h" +#include <glib.h> +#include <glib/gi18n.h> #include <sys/types.h> #include <sys/stat.h>
--- a/audacious/playback.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/playback.c Thu Sep 07 21:44:05 2006 -0700 @@ -40,31 +40,15 @@ #include "input.h" #include "main.h" -#include "mainwin.h" -#include "equalizer.h" #include "output.h" #include "playlist.h" -#include "ui_playlist.h" #include "skinwin.h" #include "urldecode.h" #include "util.h" #include "playback.h" - - -/* FIXME: yuck!! this shouldn't be here... */ -void -bmp_playback_set_random_skin(void) -{ - SkinNode *node; - guint32 randval; - - /* Get a random value to select the skin to use */ - randval = g_random_int_range(0, g_list_length(skinlist)); - node = g_list_nth(skinlist, randval)->data; - bmp_active_skin_load(node->path); -} +#include "interface.h" gint bmp_playback_get_time(void) @@ -89,9 +73,11 @@ if (bmp_playback_get_playing()) bmp_playback_stop(); +#if 0 vis_clear_data(mainwin_vis); svis_clear_data(mainwin_svis); mainwin_disable_seekbar(); +#endif entry = playlist_get_entry_to_play(); @@ -102,7 +88,9 @@ return; if (bmp_playback_get_time() != -1) { +#if 0 equalizerwin_load_auto_preset(entry->filename); +#endif input_set_eq(cfg.equalizer_active, cfg.equalizer_preamp, cfg.equalizer_bands); output_set_eq(cfg.equalizer_active, cfg.equalizer_preamp, @@ -124,10 +112,12 @@ ip_data.paused = !ip_data.paused; +#if 0 if (ip_data.paused) playstatus_set_status(mainwin_playstatus, STATUS_PAUSE); else playstatus_set_status(mainwin_playstatus, STATUS_PLAY); +#endif if (get_current_input_plugin()->pause) get_current_input_plugin()->pause(ip_data.paused); @@ -156,7 +146,7 @@ } ip_data.buffering = FALSE; - playstatus_set_status_buffering(mainwin_playstatus, FALSE); + current_interface->buffering_notify(FALSE); ip_data.playing = FALSE; } @@ -191,7 +181,7 @@ "You have not selected an output plugin."); GtkWidget *dialog = - gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin), + gtk_message_dialog_new_with_markup(GTK_WINDOW(current_interface->parentwin), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
--- a/audacious/playlist.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/playlist.c Thu Sep 07 21:44:05 2006 -0700 @@ -42,18 +42,16 @@ #include "input.h" #include "main.h" -#include "mainwin.h" #include "libaudacious/util.h" #include "libaudacious/configdb.h" #include "libaudacious/vfs.h" -#include "equalizer.h" #include "playback.h" #include "playlist.h" #include "playlist_container.h" -#include "ui_playlist.h" #include "urldecode.h" #include "util.h" #include "ui_fileinfo.h" +#include "interface.h" #include "debug.h" @@ -837,9 +835,11 @@ playlist_recalc_total_time(); - mainwin_set_song_info(rate, freq, nch); + current_interface->set_song_info(rate, freq, nch); } +/* *** TO WA2GUI *** */ +#if 0 void playlist_check_pos_current(void) { @@ -864,6 +864,7 @@ PLAYLIST_UNLOCK(); playlistwin_set_toprow(row); } +#endif void playlist_next(void)
--- a/audacious/pluginenum.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/pluginenum.c Thu Sep 07 21:44:05 2006 -0700 @@ -36,7 +36,6 @@ #include "controlsocket.h" #include "main.h" -#include "mainwin.h" #include "playback.h" #include "playlist.h" #include "util.h"
--- a/audacious/util.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/util.c Thu Sep 07 21:44:05 2006 -0700 @@ -53,7 +53,6 @@ #include "main.h" #include "playback.h" #include "playlist.h" -#include "ui_playlist.h" #ifdef USE_CHARDET #include "../libguess/libguess.h" @@ -764,6 +763,57 @@ return win; } +/* *** TO WA2GUI *** */ + +#if 0 +/* text_get_extents() taken from The GIMP (C) Spencer Kimball, Peter + * Mattis et al */ +gboolean +text_get_extents(const gchar * fontname, + const gchar * text, + gint * width, gint * height, gint * ascent, gint * descent) +{ + PangoFontDescription *font_desc; + PangoLayout *layout; + PangoRectangle rect; + + g_return_val_if_fail(fontname != NULL, FALSE); + g_return_val_if_fail(text != NULL, FALSE); + + /* FIXME: resolution */ + layout = gtk_widget_create_pango_layout(GTK_WIDGET(mainwin), text); + + font_desc = pango_font_description_from_string(fontname); + pango_layout_set_font_description(layout, font_desc); + pango_font_description_free(font_desc); + pango_layout_get_pixel_extents(layout, NULL, &rect); + + if (width) + *width = rect.width; + if (height) + *height = rect.height; + + if (ascent || descent) { + PangoLayoutIter *iter; + PangoLayoutLine *line; + + iter = pango_layout_get_iter(layout); + line = pango_layout_iter_get_line(iter); + pango_layout_iter_free(iter); + + pango_layout_line_get_pixel_extents(line, NULL, &rect); + + if (ascent) + *ascent = PANGO_ASCENT(rect); + if (descent) + *descent = -PANGO_DESCENT(rect); + } + + g_object_unref(layout); + + return TRUE; +} + static void filebrowser_add_files(GtkFileChooser * browser, GSList * files) @@ -1045,6 +1095,56 @@ gtk_window_present(GTK_WINDOW(dialog)); } +#endif + +/******************************************************************** keep in util.c */ + +GtkWidget * +make_filebrowser(const gchar * title, + GtkWidget *parent, + gboolean save) +{ + GtkWidget *dialog; + GtkWidget *button; + GtkWidget *button_close; + + g_return_val_if_fail(title != NULL, NULL); + + dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(parent), + GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL); + if (save) + gtk_file_chooser_set_action(GTK_FILE_CHOOSER(dialog), + GTK_FILE_CHOOSER_ACTION_SAVE); + + if (!save) + gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); + + g_signal_connect(dialog, "destroy", + G_CALLBACK(gtk_widget_destroyed), &dialog); + +#ifdef HAVE_GNOME_VFS + gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE); +#endif + + button_close = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, + GTK_RESPONSE_REJECT); + gtk_button_set_use_stock(GTK_BUTTON(button_close), TRUE); + GTK_WIDGET_SET_FLAGS(button_close, GTK_CAN_DEFAULT); + g_signal_connect_swapped(button_close, "clicked", + G_CALLBACK(gtk_widget_destroy), dialog); + + button = gtk_dialog_add_button(GTK_DIALOG(dialog), save ? + GTK_STOCK_SAVE : GTK_STOCK_OPEN, + GTK_RESPONSE_ACCEPT); + gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_window_set_default(GTK_WINDOW(dialog), button); + + gtk_widget_show(dialog); + + return dialog; +} + GdkFont * util_font_load(const gchar * name) { @@ -1092,54 +1192,6 @@ gdk_window_set_cursor(window->window, cursor); } -/* text_get_extents() taken from The GIMP (C) Spencer Kimball, Peter - * Mattis et al */ -gboolean -text_get_extents(const gchar * fontname, - const gchar * text, - gint * width, gint * height, gint * ascent, gint * descent) -{ - PangoFontDescription *font_desc; - PangoLayout *layout; - PangoRectangle rect; - - g_return_val_if_fail(fontname != NULL, FALSE); - g_return_val_if_fail(text != NULL, FALSE); - - /* FIXME: resolution */ - layout = gtk_widget_create_pango_layout(GTK_WIDGET(mainwin), text); - - font_desc = pango_font_description_from_string(fontname); - pango_layout_set_font_description(layout, font_desc); - pango_font_description_free(font_desc); - pango_layout_get_pixel_extents(layout, NULL, &rect); - - if (width) - *width = rect.width; - if (height) - *height = rect.height; - - if (ascent || descent) { - PangoLayoutIter *iter; - PangoLayoutLine *line; - - iter = pango_layout_get_iter(layout); - line = pango_layout_iter_get_line(iter); - pango_layout_iter_free(iter); - - pango_layout_line_get_pixel_extents(line, NULL, &rect); - - if (ascent) - *ascent = PANGO_ASCENT(rect); - if (descent) - *descent = -PANGO_DESCENT(rect); - } - - g_object_unref(layout); - - return TRUE; -} - /* counts number of digits in a gint */ guint gint_count_digits(gint n) @@ -1358,52 +1410,6 @@ return TRUE; } -GtkWidget * -make_filebrowser(const gchar * title, - gboolean save) -{ - GtkWidget *dialog; - GtkWidget *button; - GtkWidget *button_close; - - g_return_val_if_fail(title != NULL, NULL); - - dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin), - GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL); - if (save) - gtk_file_chooser_set_action(GTK_FILE_CHOOSER(dialog), - GTK_FILE_CHOOSER_ACTION_SAVE); - - if (!save) - gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); - - g_signal_connect(dialog, "destroy", - G_CALLBACK(gtk_widget_destroyed), &dialog); - -#ifdef HAVE_GNOME_VFS - gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE); -#endif - - button_close = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, - GTK_RESPONSE_REJECT); - gtk_button_set_use_stock(GTK_BUTTON(button_close), TRUE); - GTK_WIDGET_SET_FLAGS(button_close, GTK_CAN_DEFAULT); - g_signal_connect_swapped(button_close, "clicked", - G_CALLBACK(gtk_widget_destroy), dialog); - - button = gtk_dialog_add_button(GTK_DIALOG(dialog), save ? - GTK_STOCK_SAVE : GTK_STOCK_OPEN, - GTK_RESPONSE_ACCEPT); - gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); - gtk_window_set_default(GTK_WINDOW(dialog), button); - - gtk_widget_show(dialog); - - return dialog; -} - - GtkItemFactory * create_menu(GtkItemFactoryEntry *entries, guint n_entries,
--- a/audacious/util.h Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/util.h Thu Sep 07 21:44:05 2006 -0700 @@ -114,7 +114,7 @@ const gchar *item_path, GtkItemFactory *submenu); -GtkWidget *make_filebrowser(const gchar * title, +GtkWidget *make_filebrowser(const gchar * title, GtkWidget *parent, gboolean save); /* Not sure this should be here? */
--- a/audacious/visualization.c Thu Sep 07 20:53:57 2006 -0700 +++ b/audacious/visualization.c Thu Sep 07 21:44:05 2006 -0700 @@ -32,7 +32,7 @@ #include "playback.h" #include "plugin.h" #include "prefswin.h" -#include "widgets/widgetcore.h" +#include "interface.h" VisPluginData vp_data = { NULL, @@ -280,12 +280,15 @@ gint i; if (!pcm_data || nch < 1) { + current_interface->send_pcm_data(pcm_data, nch, length); +#if 0 if (cfg.vis_type != VIS_OFF) { if (cfg.player_shaded && cfg.player_visible) svis_timeout_func(mainwin_svis, NULL); else vis_timeout_func(active_vis, NULL); } +#endif return; } @@ -326,6 +329,8 @@ node = g_list_next(node); } + current_interface->send_pcm_data(pcm_data, nch, length); +#if 0 if (cfg.vis_type == VIS_OFF) return; @@ -434,4 +439,5 @@ svis_timeout_func(mainwin_svis, intern_vis_data); else vis_timeout_func(active_vis, intern_vis_data); +#endif }