Mercurial > audlegacy
changeset 2901:5ed0674fabd6 trunk
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sun, 24 Jun 2007 15:55:32 +0200 |
parents | ed68f1a9923e |
children | 2b379b796c84 |
files | src/audacious/ui_playlist.c src/audacious/ui_skinned_button.c src/audacious/ui_skinned_button.h src/audacious/widgets/Makefile src/audacious/widgets/widgetcore.h |
diffstat | 5 files changed, 49 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/ui_playlist.c Sun Jun 24 05:37:50 2007 -0500 +++ b/src/audacious/ui_playlist.c Sun Jun 24 15:55:32 2007 +0200 @@ -54,6 +54,7 @@ #include "util.h" #include "ui_skinned_window.h" +#include "ui_skinned_button.h" #include "icons-stock.h" #include "images/audacious_playlist.xpm" @@ -61,7 +62,7 @@ GtkWidget *playlistwin; PlayList_List *playlistwin_list = NULL; -PButton *playlistwin_shade, *playlistwin_close; +GtkWidget *playlistwin_shade, *playlistwin_close; static GdkPixmap *playlistwin_bg; static GdkBitmap *playlistwin_mask = NULL; @@ -350,22 +351,22 @@ playlistwin_set_sinfo_font(cfg.playlist_font); playlistwin_set_sinfo_scroll(cfg.autoscroll); widget_show(WIDGET(playlistwin_sinfo)); - playlistwin_shade->pb_nx = 128; - playlistwin_shade->pb_ny = 45; - playlistwin_shade->pb_px = 150; - playlistwin_shade->pb_py = 42; - playlistwin_close->pb_nx = 138; - playlistwin_close->pb_ny = 45; + UI_SKINNED_BUTTON(playlistwin_shade)->nx = 128; + UI_SKINNED_BUTTON(playlistwin_shade)->ny = 45; + UI_SKINNED_BUTTON(playlistwin_shade)->px = 150; + UI_SKINNED_BUTTON(playlistwin_shade)->py = 42; + UI_SKINNED_BUTTON(playlistwin_close)->nx = 138; + UI_SKINNED_BUTTON(playlistwin_close)->ny = 45; } else { widget_hide(WIDGET(playlistwin_sinfo)); playlistwin_set_sinfo_scroll(FALSE); - playlistwin_shade->pb_nx = 157; - playlistwin_shade->pb_ny = 3; - playlistwin_shade->pb_px = 62; - playlistwin_shade->pb_py = 42; - playlistwin_close->pb_nx = 167; - playlistwin_close->pb_ny = 3; + UI_SKINNED_BUTTON(playlistwin_shade)->nx = 157; + UI_SKINNED_BUTTON(playlistwin_shade)->ny = 3; + UI_SKINNED_BUTTON(playlistwin_shade)->px = 62; + UI_SKINNED_BUTTON(playlistwin_shade)->py = 42; + UI_SKINNED_BUTTON(playlistwin_close)->nx = 167; + UI_SKINNED_BUTTON(playlistwin_close)->ny = 3; } dock_shade(dock_window_list, GTK_WINDOW(playlistwin), @@ -658,8 +659,8 @@ widget_resize_relative(WIDGET(playlistwin_sinfo), dx, 0); playlistwin_update_sinfo(playlist_get_active()); - widget_move_relative(WIDGET(playlistwin_shade), dx, 0); - widget_move_relative(WIDGET(playlistwin_close), dx, 0); + ui_skinned_button_move_relative(playlistwin_shade, dx, 0); + ui_skinned_button_move_relative(playlistwin_close, dx, 0); widget_move_relative(WIDGET(playlistwin_time_min), dx, dy); widget_move_relative(WIDGET(playlistwin_time_sec), dx, dy); widget_move_relative(WIDGET(playlistwin_info), dx, dy); @@ -1189,8 +1190,6 @@ static gboolean playlistwin_focus_in(GtkWidget * widget, GdkEvent * event, gpointer data) { - playlistwin_close->pb_allow_draw = TRUE; - playlistwin_shade->pb_allow_draw = TRUE; draw_playlist_window(TRUE); return FALSE; } @@ -1199,8 +1198,6 @@ playlistwin_focus_out(GtkWidget * widget, GdkEventButton * event, gpointer data) { - playlistwin_close->pb_allow_draw = FALSE; - playlistwin_shade->pb_allow_draw = FALSE; draw_playlist_window(TRUE); return FALSE; } @@ -1550,31 +1547,29 @@ if (!cfg.playlist_shaded) widget_hide(WIDGET(playlistwin_sinfo)); + playlistwin_shade = ui_skinned_button_new(); /* shade/unshade window push button */ if (cfg.playlist_shaded) - playlistwin_shade = - create_pbutton(&playlistwin_wlist, playlistwin_bg, - SKINNED_WINDOW(playlistwin)->gc, playlistwin_get_width() - 21, 3, - 9, 9, 128, 45, 150, 42, - playlistwin_shade_toggle, SKIN_PLEDIT); + ui_skinned_push_button_setup(playlistwin_shade, SKINNED_WINDOW(playlistwin)->fixed, playlistwin_bg, + SKINNED_WINDOW(playlistwin)->gc, playlistwin_get_width() - 21, 3, + 9, 9, 128, 45, 150, 42, SKIN_PLEDIT); else - playlistwin_shade = - create_pbutton(&playlistwin_wlist, playlistwin_bg, - SKINNED_WINDOW(playlistwin)->gc, playlistwin_get_width() - 21, 3, - 9, 9, 157, 3, 62, 42, playlistwin_shade_toggle, - SKIN_PLEDIT); + ui_skinned_push_button_setup(playlistwin_shade, SKINNED_WINDOW(playlistwin)->fixed, playlistwin_bg, + SKINNED_WINDOW(playlistwin)->gc, playlistwin_get_width() - 21, 3, + 9, 9, 157, 3, 62, 42, SKIN_PLEDIT); - playlistwin_shade->pb_allow_draw = FALSE; - ui_skinned_window_widgetlist_associate(playlistwin, WIDGET(playlistwin_shade)); + g_signal_connect(playlistwin_shade, "clicked", playlistwin_shade_toggle, NULL ); /* close window push button */ - playlistwin_close = - create_pbutton(&playlistwin_wlist, playlistwin_bg, SKINNED_WINDOW(playlistwin)->gc, - playlistwin_get_width() - 11, 3, 9, 9, - cfg.playlist_shaded ? 138 : 167, - cfg.playlist_shaded ? 45 : 3, 52, 42, - playlistwin_hide, SKIN_PLEDIT); - playlistwin_close->pb_allow_draw = FALSE; + playlistwin_close = ui_skinned_button_new(); + ui_skinned_push_button_setup(playlistwin_close, SKINNED_WINDOW(playlistwin)->fixed, playlistwin_bg, + SKINNED_WINDOW(playlistwin)->gc, + playlistwin_get_width() - 11, 3, 9, 9, + cfg.playlist_shaded ? 138 : 167, + cfg.playlist_shaded ? 45 : 3, 52, 42, SKIN_PLEDIT); + + g_signal_connect(playlistwin_close, "clicked", playlistwin_hide, NULL ); + ui_skinned_window_widgetlist_associate(playlistwin, WIDGET(playlistwin_close)); /* playlist list box */ @@ -1789,7 +1784,8 @@ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE ); cfg.playlist_visible = TRUE; - //FIXME: set mainwin_pl->inside as TRUE and redraw it + UI_SKINNED_BUTTON(mainwin_pl)->inside = TRUE; + g_signal_emit_by_name(mainwin_pl, "redraw"); playlistwin_set_toprow(0); playlist_check_pos_current(playlist_get_active()); @@ -1798,7 +1794,8 @@ playlistwin_infopopup_sid = g_timeout_add( 50 , (GSourceFunc)playlistwin_fileinfopopup_probe , playlistwin_infopopup ); - gtk_widget_show(playlistwin); + gtk_widget_show_all(playlistwin); + gtk_window_present(GTK_WINDOW(playlistwin)); } void @@ -1810,7 +1807,8 @@ gtk_widget_hide(playlistwin); cfg.playlist_visible = FALSE; - //FIXME: set mainwin_pl->inside as FALSE and redraw it + UI_SKINNED_BUTTON(mainwin_pl)->inside = FALSE; + g_signal_emit_by_name(mainwin_pl, "redraw"); /* no point in probing for playlistwin_infopopup trigger when the playlistwin is hidden */ if ( playlistwin_infopopup_sid != 0 )
--- a/src/audacious/ui_skinned_button.c Sun Jun 24 05:37:50 2007 -0500 +++ b/src/audacious/ui_skinned_button.c Sun Jun 24 15:55:32 2007 +0200 @@ -326,6 +326,9 @@ if (GDK_IS_WINDOW(button->event_window)) gdk_window_move_resize (button->event_window, widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height); + + button->x = widget->allocation.x; + button->y = widget->allocation.y; } static void button_pressed(UiSkinnedButton *button) { @@ -509,3 +512,9 @@ UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); priv->skin_index2 = si; } + +void ui_skinned_button_move_relative(GtkWidget *button, gint x, gint y) { + UiSkinnedButton *b = UI_SKINNED_BUTTON(button); + UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); + gtk_fixed_move(GTK_FIXED(priv->fixed), button, b->x+x, b->y+y); +}
--- a/src/audacious/ui_skinned_button.h Sun Jun 24 05:37:50 2007 -0500 +++ b/src/audacious/ui_skinned_button.h Sun Jun 24 15:55:32 2007 +0200 @@ -88,5 +88,6 @@ 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); +void ui_skinned_button_move_relative(GtkWidget *button, gint x, gint y); #endif
--- a/src/audacious/widgets/Makefile Sun Jun 24 05:37:50 2007 -0500 +++ b/src/audacious/widgets/Makefile Sun Jun 24 15:55:32 2007 +0200 @@ -21,7 +21,6 @@ SOURCES = \ widget.c \ sbutton.c \ - pbutton.c \ textbox.c \ hslider.c \ menurow.c \
--- a/src/audacious/widgets/widgetcore.h Sun Jun 24 05:37:50 2007 -0500 +++ b/src/audacious/widgets/widgetcore.h Sun Jun 24 15:55:32 2007 +0200 @@ -26,7 +26,6 @@ #include "menurow.h" #include "monostereo.h" #include "number.h" -#include "pbutton.h" #include "playlist_list.h" #include "playlist_slider.h" #include "playstatus.h"