Mercurial > audlegacy
changeset 2859:174280672291 trunk
Automated merge from ssh://hg.atheme.org//hg/audacious.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sat, 23 Jun 2007 22:22:25 -0500 |
parents | 548a1db694e6 (current diff) c35703c9dd9e (diff) |
children | 0c3727219ea1 |
files | |
diffstat | 10 files changed, 139 insertions(+), 112 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/main.c Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/main.c Sat Jun 23 22:22:25 2007 -0500 @@ -1189,7 +1189,7 @@ #ifdef USE_DBUS init_dbus(); #endif - + mowgli_init(); plugin_system_init(); /* Initialize the playlist system. */
--- a/src/audacious/ui_equalizer.c Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/ui_equalizer.c Sat Jun 23 22:22:25 2007 -0500 @@ -53,6 +53,7 @@ #include "images/audacious_eq.xpm" #include "ui_skinned_window.h" +#include "ui_skinned_button.h" enum PresetViewCols { PRESET_VIEW_COL_NAME, @@ -82,17 +83,15 @@ static GList *equalizerwin_wlist = NULL; -static TButton *equalizerwin_on, *equalizerwin_auto; +static GtkWidget *equalizerwin_on, *equalizerwin_auto; -static PButton *equalizerwin_presets, *equalizerwin_shade; -PButton *equalizerwin_close; +static GtkWidget *equalizerwin_close, *equalizerwin_presets, *equalizerwin_shade; static EqGraph *equalizerwin_graph; static EqSlider *equalizerwin_preamp, *equalizerwin_bands[10]; static HSlider *equalizerwin_volume, *equalizerwin_balance; static GList *equalizer_presets = NULL, *equalizer_auto_presets = NULL; - EqualizerPreset * equalizer_preset_new(const gchar * name) { @@ -148,6 +147,13 @@ gdk_window_set_back_pixmap(equalizerwin->window, equalizerwin_bg, 0); } + GList *iter; + for (iter = GTK_FIXED (SKINNED_WINDOW(equalizerwin)->fixed)->children; iter; iter = g_list_next (iter)) { + GtkFixedChild *child_data = (GtkFixedChild *) iter->data; + GtkWidget *child = child_data->widget; + g_signal_emit_by_name(child, "toggle-double-size"); + } + draw_equalizer_window(TRUE); } @@ -161,20 +167,20 @@ if (shaded) { dock_shade(dock_window_list, GTK_WINDOW(equalizerwin), 14 * (EQUALIZER_DOUBLESIZE + 1)); - pbutton_set_button_data(equalizerwin_shade, -1, 3, -1, 47); - pbutton_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); - pbutton_set_button_data(equalizerwin_close, 11, 38, 11, 47); - pbutton_set_skin_index(equalizerwin_close, SKIN_EQ_EX); + ui_skinned_set_push_button_data(equalizerwin_shade, -1, 3, -1, 47); + ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); + ui_skinned_set_push_button_data(equalizerwin_close, 11, 38, 11, 47); + ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQ_EX); widget_show(WIDGET(equalizerwin_volume)); widget_show(WIDGET(equalizerwin_balance)); } else { dock_shade(dock_window_list, GTK_WINDOW(equalizerwin), 116 * (EQUALIZER_DOUBLESIZE + 1)); - pbutton_set_button_data(equalizerwin_shade, -1, 137, -1, 38); - pbutton_set_skin_index1(equalizerwin_shade, SKIN_EQMAIN); - pbutton_set_button_data(equalizerwin_close, 0, 116, 0, 125); - pbutton_set_skin_index(equalizerwin_close, SKIN_EQMAIN); + ui_skinned_set_push_button_data(equalizerwin_shade, -1, 137, -1, 38); + ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQMAIN); + ui_skinned_set_push_button_data(equalizerwin_close, 0, 116, 0, 125); + ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQMAIN); widget_hide(WIDGET(equalizerwin_volume)); widget_hide(WIDGET(equalizerwin_balance)); } @@ -222,9 +228,9 @@ } static void -equalizerwin_on_pushed(gboolean toggled) +equalizerwin_on_pushed(void) { - cfg.equalizer_active = toggled; + cfg.equalizer_active = UI_SKINNED_BUTTON(equalizerwin_on)->inside; equalizerwin_eq_changed(); } @@ -239,24 +245,12 @@ } static void -equalizerwin_auto_pushed(gboolean toggled) +equalizerwin_auto_pushed(void) { - cfg.equalizer_autoload = toggled; + cfg.equalizer_autoload = UI_SKINNED_BUTTON(equalizerwin_auto)->inside; } -void -draw_equalizer_window(gboolean force) -{ - GdkImage *img, *img2; - GList *wl; - Widget *w; - gboolean redraw; - - widget_list_lock(equalizerwin_wlist); - - if (force) { - skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, SKINNED_WINDOW(equalizerwin)->gc, - SKIN_EQMAIN, 0, 0, 0, 0, 275, 116); +static void equalizerwin_draw_titlebar() { if (gtk_window_has_toplevel_focus(GTK_WINDOW(equalizerwin)) || !cfg.dim_titlebar) { if (!cfg.equalizer_shaded) @@ -277,8 +271,27 @@ skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, SKINNED_WINDOW(equalizerwin)->gc, SKIN_EQ_EX, 0, 15, 0, 0, 275, 14); + } +} - } +void +draw_equalizer_window(gboolean force) +{ + GdkImage *img, *img2x; + GList *wl; + Widget *w; + gboolean redraw; + + if (!cfg.equalizer_visible) + return; + + widget_list_lock(equalizerwin_wlist); + + if (force) { + if (!cfg.equalizer_shaded) + skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, SKINNED_WINDOW(equalizerwin)->gc, + SKIN_EQMAIN, 0, 0, 0, 0, 275, 116); + equalizerwin_draw_titlebar(); } widget_list_draw(equalizerwin_wlist, &redraw, force); @@ -287,10 +300,10 @@ if (cfg.doublesize && cfg.eq_doublesize_linked) { if (force) { img = gdk_drawable_get_image(equalizerwin_bg, 0, 0, 275, 116); - img2 = create_dblsize_image(img); + img2x = create_dblsize_image(img); gdk_draw_image(equalizerwin_bg_x2, SKINNED_WINDOW(equalizerwin)->gc, - img2, 0, 0, 0, 0, 550, 232); - g_object_unref(img2); + img2x, 0, 0, 0, 0, 550, 232); + g_object_unref(img2x); g_object_unref(img); } else { @@ -300,12 +313,12 @@ img = gdk_drawable_get_image(equalizerwin_bg, w->x, w->y, w->width, w->height); - img2 = create_dblsize_image(img); + img2x = create_dblsize_image(img); gdk_draw_image(equalizerwin_bg_x2, - SKINNED_WINDOW(equalizerwin)->gc, img2, 0, 0, + SKINNED_WINDOW(equalizerwin)->gc, img2x, 0, 0, w->x << 1, w->y << 1, w->width << 1, w->height << 1); - g_object_unref(img2); + g_object_unref(img2x); g_object_unref(img); w->redraw = FALSE; } @@ -314,7 +327,14 @@ } else widget_list_clear_redraw(equalizerwin_wlist); + gdk_window_clear(equalizerwin->window); + GList *iter; + for (iter = GTK_FIXED (SKINNED_WINDOW(equalizerwin)->fixed)->children; iter; iter = g_list_next (iter)) { + GtkFixedChild *child_data = (GtkFixedChild *) iter->data; + GtkWidget *child = child_data->widget; + g_signal_emit_by_name(child, "redraw"); + } gdk_flush(); } @@ -348,9 +368,7 @@ if (dock_is_moving(GTK_WINDOW(equalizerwin))) dock_move_release(GTK_WINDOW(equalizerwin)); } - else if (event->button == 3 && - !(widget_contains(WIDGET(equalizerwin_on), event->x, event->y) || - widget_contains(WIDGET(equalizerwin_auto), event->x, event->y))) { + else if (event->button == 3) { /* * Pop up the main menu a few pixels down to avoid * anything to be selected initially. @@ -418,10 +436,9 @@ if (dock_is_moving(GTK_WINDOW(equalizerwin))) { dock_move_release(GTK_WINDOW(equalizerwin)); } - else { - handle_release_cb(equalizerwin_wlist, widget, event); - draw_equalizer_window(FALSE); - } + + handle_release_cb(equalizerwin_wlist, widget, event); + draw_equalizer_window(FALSE); return FALSE; } @@ -431,8 +448,6 @@ GdkEvent * event, gpointer data) { - equalizerwin_close->pb_allow_draw = TRUE; - equalizerwin_shade->pb_allow_draw = TRUE; draw_equalizer_window(TRUE); return TRUE; } @@ -442,8 +457,6 @@ GdkEventButton * event, gpointer data) { - equalizerwin_close->pb_allow_draw = FALSE; - equalizerwin_shade->pb_allow_draw = FALSE; draw_equalizer_window(TRUE); return TRUE; } @@ -639,46 +652,35 @@ { gint i; - equalizerwin_on = - create_tbutton(&equalizerwin_wlist, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, 14, 18, 25, 12, 10, 119, 128, 119, - 69, 119, 187, 119, equalizerwin_on_pushed, - SKIN_EQMAIN); - tbutton_set_toggled(equalizerwin_on, cfg.equalizer_active); - ui_skinned_window_widgetlist_associate(equalizerwin, - WIDGET(equalizerwin_on)); + equalizerwin_on = ui_skinned_button_new(); + ui_skinned_toggle_button_setup(equalizerwin_on, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg, + SKINNED_WINDOW(equalizerwin)->gc, 14, 18, 25, 12, 10, 119, 128, 119, + 69, 119, 187, 119, SKIN_EQMAIN); + g_signal_connect(equalizerwin_on, "clicked", equalizerwin_on_pushed, NULL); + UI_SKINNED_BUTTON(equalizerwin_on)->inside = cfg.equalizer_active; - equalizerwin_auto = - create_tbutton(&equalizerwin_wlist, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, 39, 18, 33, 12, 35, 119, 153, 119, - 94, 119, 212, 119, equalizerwin_auto_pushed, - SKIN_EQMAIN); - tbutton_set_toggled(equalizerwin_auto, cfg.equalizer_autoload); - ui_skinned_window_widgetlist_associate(equalizerwin, - WIDGET(equalizerwin_auto)); + equalizerwin_auto = ui_skinned_button_new(); + ui_skinned_toggle_button_setup(equalizerwin_auto, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg, + SKINNED_WINDOW(equalizerwin)->gc,39, 18, 33, 12, 35, 119, 153, 119, + 94, 119, 212, 119, SKIN_EQMAIN); + g_signal_connect(equalizerwin_auto, "clicked", equalizerwin_auto_pushed, NULL); + UI_SKINNED_BUTTON(equalizerwin_auto)->inside = cfg.equalizer_autoload; - equalizerwin_presets = - create_pbutton(&equalizerwin_wlist, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, 217, 18, 44, 12, 224, 164, 224, - 176, equalizerwin_presets_pushed, SKIN_EQMAIN); - ui_skinned_window_widgetlist_associate(equalizerwin, - WIDGET(equalizerwin_presets)); + equalizerwin_presets = ui_skinned_button_new(); + ui_skinned_push_button_setup(equalizerwin_presets, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg, + SKINNED_WINDOW(equalizerwin)->gc, 217, 18, 44, 12, 224, 164, 224, 176, SKIN_EQMAIN); + g_signal_connect(equalizerwin_presets, "clicked", equalizerwin_presets_pushed, NULL ); - equalizerwin_close = - create_pbutton(&equalizerwin_wlist, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, 264, 3, 9, 9, 0, 116, 0, 125, - equalizerwin_close_cb, SKIN_EQMAIN); - equalizerwin_close->pb_allow_draw = FALSE; - ui_skinned_window_widgetlist_associate(equalizerwin, - WIDGET(equalizerwin_close)); + equalizerwin_close = ui_skinned_button_new(); + ui_skinned_push_button_setup(equalizerwin_close, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg, + SKINNED_WINDOW(equalizerwin)->gc, 264, 3, 9, 9, 0, 116, 0, 125, SKIN_EQMAIN); + g_signal_connect(equalizerwin_close, "clicked", equalizerwin_close_cb, NULL ); - equalizerwin_shade = - create_pbutton_ex(&equalizerwin_wlist, equalizerwin_bg, - SKINNED_WINDOW(equalizerwin)->gc, 254, 3, 9, 9, 254, 137, 1, 38, - equalizerwin_shade_toggle, NULL, SKIN_EQMAIN, SKIN_EQ_EX); - equalizerwin_shade->pb_allow_draw = FALSE; - ui_skinned_window_widgetlist_associate(equalizerwin, - WIDGET(equalizerwin_shade)); + equalizerwin_shade = ui_skinned_button_new(); + ui_skinned_push_button_setup(equalizerwin_shade, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg, + SKINNED_WINDOW(equalizerwin)->gc, 254, 3, 9, 9, 254, 137, 1, 38, SKIN_EQMAIN); + ui_skinned_button_set_skin_index2(equalizerwin_shade, SKIN_EQ_EX); + g_signal_connect(equalizerwin_shade, "clicked", equalizerwin_shade_toggle, NULL ); equalizerwin_graph = create_eqgraph(&equalizerwin_wlist, equalizerwin_bg, @@ -725,10 +727,10 @@ widget_hide(WIDGET(equalizerwin_balance)); } else { - pbutton_set_button_data(equalizerwin_shade, -1, 3, -1, 47); - pbutton_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); - pbutton_set_button_data(equalizerwin_close, 11, 38, 11, 47); - pbutton_set_skin_index(equalizerwin_close, SKIN_EQ_EX); + ui_skinned_set_push_button_data(equalizerwin_shade, -1, 3, -1, 47); + ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); + ui_skinned_set_push_button_data(equalizerwin_close, 11, 38, 11, 47); + ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQ_EX); } } @@ -739,20 +741,20 @@ GdkPixbuf *icon; gint width, height; + width = 275; + height = cfg.equalizer_shaded ? 14 : 116; + equalizerwin = ui_skinned_window_new(GTK_WINDOW_TOPLEVEL, "equalizer"); gtk_window_set_title(GTK_WINDOW(equalizerwin), _("Audacious Equalizer")); gtk_window_set_role(GTK_WINDOW(equalizerwin), "equalizer"); - - width = 275; - height = cfg.equalizer_shaded ? 14 : 116; + gtk_window_set_resizable(GTK_WINDOW(equalizerwin), FALSE); if (cfg.doublesize && cfg.eq_doublesize_linked) { width *= 2; height *= 2; } - gtk_window_set_default_size(GTK_WINDOW(equalizerwin), width, height); - gtk_window_set_resizable(GTK_WINDOW(equalizerwin), FALSE); + gtk_widget_set_size_request(equalizerwin, width, height); /* this will hide only mainwin. it's annoying! yaz */ gtk_window_set_transient_for(GTK_WINDOW(equalizerwin), @@ -804,14 +806,8 @@ equalizerwin_bg = gdk_pixmap_new(equalizerwin->window, 275, 116, -1); equalizerwin_bg_x2 = gdk_pixmap_new(equalizerwin->window, 550, 232, -1); + equalizerwin_set_back_pixmap(); equalizerwin_create_widgets(); - - equalizerwin_set_back_pixmap(); - if (cfg.doublesize && cfg.eq_doublesize_linked) - gdk_window_set_back_pixmap(equalizerwin->window, - equalizerwin_bg_x2, 0); - else - gdk_window_set_back_pixmap(equalizerwin->window, equalizerwin_bg, 0); } @@ -841,9 +837,11 @@ gdk_flush(); draw_equalizer_window(TRUE); cfg.equalizer_visible = TRUE; - //FIXME: set mainwin_eq->inside as TRUE and redraw it + UI_SKINNED_BUTTON(mainwin_eq)->inside = TRUE; + g_signal_emit_by_name(mainwin_eq, "redraw"); - gtk_widget_show(equalizerwin); + gtk_widget_show_all(equalizerwin); + gtk_window_present(GTK_WINDOW(equalizerwin)); } void @@ -855,7 +853,8 @@ */ gtk_widget_hide(equalizerwin); cfg.equalizer_visible = FALSE; - //FIXME: set mainwin_eq->inside as FALSE and redraw it + UI_SKINNED_BUTTON(mainwin_eq)->inside = FALSE; + g_signal_emit_by_name(mainwin_eq, "redraw"); } static EqualizerPreset *
--- a/src/audacious/ui_equalizer.h Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/ui_equalizer.h Sat Jun 23 22:22:25 2007 -0500 @@ -58,7 +58,6 @@ gboolean equalizerwin_has_focus(void); extern GtkWidget *equalizerwin; -extern PButton *equalizerwin_close; extern gboolean equalizerwin_focus; #endif
--- a/src/audacious/ui_main.c Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/ui_main.c Sat Jun 23 22:22:25 2007 -0500 @@ -133,7 +133,8 @@ static GtkWidget *mainwin_eject; static GtkWidget *mainwin_play, *mainwin_pause, *mainwin_stop; -static GtkWidget *mainwin_shuffle, *mainwin_repeat, *mainwin_eq, *mainwin_pl; +static GtkWidget *mainwin_shuffle, *mainwin_repeat; +GtkWidget *mainwin_eq, *mainwin_pl; TextBox *mainwin_info; TextBox *mainwin_stime_min, *mainwin_stime_sec;
--- a/src/audacious/ui_main.h Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/ui_main.h Sat Jun 23 22:22:25 2007 -0500 @@ -98,6 +98,7 @@ extern gboolean mainwin_focus; extern GtkWidget *mainwin_jtf; +extern GtkWidget *mainwin_eq, *mainwin_pl; extern TextBox *mainwin_stime_min, *mainwin_stime_sec; extern TextBox *mainwin_info;
--- a/src/audacious/ui_playlist.h Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/ui_playlist.h Sat Jun 23 22:22:25 2007 -0500 @@ -75,8 +75,6 @@ extern GtkWidget *playlistwin; extern PlayList_List *playlistwin_list; -extern PButton *playlistwin_shade, *playlistwin_close; - extern gboolean playlistwin_focus; #endif
--- a/src/audacious/ui_skinned_button.c Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/ui_skinned_button.c Sat Jun 23 22:22:25 2007 -0500 @@ -442,19 +442,22 @@ obj = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); switch (button->type) { case TYPE_PUSH: - skin_draw_pixmap(bmp_active_skin, obj, priv->gc, priv->skin_index2, + skin_draw_pixmap(bmp_active_skin, obj, priv->gc, + button->pressed ? priv->skin_index2 : priv->skin_index1, button->pressed ? button->px : button->nx, button->pressed ? button->py : button->ny, 0, 0, priv->w, priv->h); break; case TYPE_TOGGLE: if (button->inside) - skin_draw_pixmap(bmp_active_skin, obj, priv->gc, priv->skin_index2, + skin_draw_pixmap(bmp_active_skin, obj, priv->gc, + button->pressed ? priv->skin_index2 : priv->skin_index1, button->pressed ? button->ppx : button->pnx, button->pressed ? button->ppy : button->pny, 0, 0, priv->w, priv->h); else - skin_draw_pixmap(bmp_active_skin, obj, priv->gc, priv->skin_index2, + skin_draw_pixmap(bmp_active_skin, obj, priv->gc, + button->pressed ? priv->skin_index2 : priv->skin_index1, button->pressed ? button->px : button->nx, button->pressed ? button->py : button->ny, 0, 0, priv->w, priv->h); @@ -482,3 +485,27 @@ button->redraw = TRUE; ui_skinned_button_paint(button); } + + +void ui_skinned_set_push_button_data(GtkWidget *button, gint nx, gint ny, gint px, gint py) { + UiSkinnedButton *b = UI_SKINNED_BUTTON(button); + if (nx > -1) b->nx = nx; + if (ny > -1) b->ny = ny; + if (px > -1) b->px = px; + if (py > -1) b->py = py; +} + +void ui_skinned_button_set_skin_index(GtkWidget *button, SkinPixmapId si) { + UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); + priv->skin_index1 = priv->skin_index2 = si; +} + +void ui_skinned_button_set_skin_index1(GtkWidget *button, SkinPixmapId si) { + UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); + priv->skin_index1 = si; +} + +void ui_skinned_button_set_skin_index2(GtkWidget *button, SkinPixmapId si) { + UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); + priv->skin_index2 = si; +}
--- a/src/audacious/ui_skinned_button.h Sat Jun 23 22:21:42 2007 -0500 +++ b/src/audacious/ui_skinned_button.h Sat Jun 23 22:22:25 2007 -0500 @@ -82,7 +82,11 @@ GType ui_skinned_button_get_type(void) G_GNUC_CONST; GtkWidget* ui_skinned_button_new(); void ui_skinned_push_button_setup(GtkWidget *button, GtkWidget *fixed, GdkPixmap * parent, GdkGC * gc, gint x, gint y, gint w, gint h, gint nx, gint ny, gint px, gint py, SkinPixmapId si); +void ui_skinned_set_push_button_data(GtkWidget *button, gint nx, gint ny, gint px, gint py); void ui_skinned_toggle_button_setup(GtkWidget *button, GtkWidget *fixed, GdkPixmap *parent, GdkGC *gc, gint x, gint y, gint w, gint h, gint nx, gint ny, gint px, gint py, gint pnx, gint pny, gint ppx, gint ppy, SkinPixmapId si); void ui_skinned_small_button_setup(GtkWidget *button, GtkWidget *fixed, GdkPixmap *parent, GdkGC *gc, gint x, gint y, gint w, gint h); +void ui_skinned_button_set_skin_index(GtkWidget *button, SkinPixmapId si); +void ui_skinned_button_set_skin_index1(GtkWidget *button, SkinPixmapId si); +void ui_skinned_button_set_skin_index2(GtkWidget *button, SkinPixmapId si); #endif