Mercurial > audlegacy
changeset 1542:66ad5920cee4 trunk
[svn] - these might be nice huh?
author | nenolod |
---|---|
date | Wed, 09 Aug 2006 03:58:43 -0700 |
parents | 06329cbf186a |
children | 65b85145be84 |
files | ChangeLog audacious/widgets/menurow.c audacious/widgets/menurow.h |
diffstat | 3 files changed, 306 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Aug 09 02:47:22 2006 -0700 +++ b/ChangeLog Wed Aug 09 03:58:43 2006 -0700 @@ -1,3 +1,67 @@ +2006-08-09 09:47:22 +0000 William Pitcock <nenolod@nenolod.net> + revision [1996] + this massive commit does the following: + - seriously cleans up dependencies on the WA2-like gui code + - moves all of the WA2 stuff into a seperate library (libwidgets.a) + - makes things less icky in the player tree + + + Changes: Modified: + +3 -19 trunk/audacious/Makefile + +0 -1 trunk/audacious/controlsocket.c + +0 -149 trunk/audacious/eq_graph.c + +0 -40 trunk/audacious/eq_graph.h + +0 -235 trunk/audacious/eq_slider.c + +0 -44 trunk/audacious/eq_slider.h + +6 -6 trunk/audacious/equalizer.c + +1 -1 trunk/audacious/equalizer.h + +0 -1 trunk/audacious/genevent.c + +0 -2 trunk/audacious/genevent.h + +0 -203 trunk/audacious/hslider.c + +0 -54 trunk/audacious/hslider.h + +1 -1 trunk/audacious/input.c + +0 -1 trunk/audacious/main.c + +2 -2 trunk/audacious/main.h + +11 -11 trunk/audacious/mainwin.c + +8 -8 trunk/audacious/mainwin.h + +0 -186 trunk/audacious/menurow.c + +0 -56 trunk/audacious/menurow.h + +0 -93 trunk/audacious/monostereo.c + +0 -43 trunk/audacious/monostereo.h + +0 -75 trunk/audacious/number.c + +0 -43 trunk/audacious/number.h + +0 -194 trunk/audacious/pbutton.c + +0 -59 trunk/audacious/pbutton.h + +0 -2 trunk/audacious/playback.c + +0 -2 trunk/audacious/playlist.c + +0 -954 trunk/audacious/playlist_list.c + +0 -56 trunk/audacious/playlist_list.h + +0 -168 trunk/audacious/playlist_slider.c + +0 -47 trunk/audacious/playlist_slider.h + +0 -102 trunk/audacious/playstatus.c + +0 -41 trunk/audacious/playstatus.h + +1 -2 trunk/audacious/prefswin.c + +0 -99 trunk/audacious/sbutton.c + +0 -43 trunk/audacious/sbutton.h + +0 -1260 trunk/audacious/skin.c + +0 -145 trunk/audacious/skin.h + +1 -1 trunk/audacious/skinwin.c + +0 -204 trunk/audacious/svis.c + +0 -47 trunk/audacious/svis.h + +0 -176 trunk/audacious/tbutton.c + +0 -48 trunk/audacious/tbutton.h + +0 -579 trunk/audacious/textbox.c + +0 -64 trunk/audacious/textbox.h + +0 -2 trunk/audacious/ui_fileinfo.c + +6 -6 trunk/audacious/ui_playlist.c + +2 -2 trunk/audacious/ui_playlist.h + +0 -291 trunk/audacious/vis.c + +0 -77 trunk/audacious/vis.h + +3 -3 trunk/audacious/visualization.c + +0 -263 trunk/audacious/widget.c + +6035 -102 trunk/audacious/widget.h + + 2006-08-09 09:11:01 +0000 William Pitcock <nenolod@nenolod.net> revision [1994] - use posix_memalign() instead of memalign().
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/audacious/widgets/menurow.c Wed Aug 09 03:58:43 2006 -0700 @@ -0,0 +1,186 @@ +/* BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * + * Based on XMMS: + * Copyright (C) 1998-2003 XMMS development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "menurow.h" + +#include <glib.h> +#include <gdk/gdk.h> + +#include "main.h" +#include "menurow.h" +#include "widget.h" + +void +menurow_draw(Widget * widget) +{ + MenuRow *mr = MENU_ROW(widget); + + GdkPixmap *obj = mr->mr_widget.parent; + + if (mr->mr_selected == MENUROW_NONE) { + if (cfg.always_show_cb || mr->mr_bpushed) + skin_draw_pixmap(bmp_active_skin, obj, + mr->mr_widget.gc, + mr->mr_skin_index, + mr->mr_nx, mr->mr_ny, + mr->mr_widget.x, mr->mr_widget.y, 8, 43); + else + skin_draw_pixmap(bmp_active_skin, obj, + mr->mr_widget.gc, + mr->mr_skin_index, + mr->mr_nx + 8, mr->mr_ny, + mr->mr_widget.x, mr->mr_widget.y, 8, 43); + } + else { + skin_draw_pixmap(bmp_active_skin, obj, + mr->mr_widget.gc, + mr->mr_skin_index, + mr->mr_sx + ((mr->mr_selected - 1) * 8), + mr->mr_sy, mr->mr_widget.x, mr->mr_widget.y, 8, 43); + } + if (cfg.always_show_cb || mr->mr_bpushed) { + if (mr->mr_always_selected) + skin_draw_pixmap(bmp_active_skin, obj, + mr->mr_widget.gc, + mr->mr_skin_index, + mr->mr_sx + 8, mr->mr_sy + 10, + mr->mr_widget.x, mr->mr_widget.y + 10, 8, 8); + if (mr->mr_doublesize_selected) + skin_draw_pixmap(bmp_active_skin, obj, + mr->mr_widget.gc, + mr->mr_skin_index, + mr->mr_sx + 24, mr->mr_sy + 26, + mr->mr_widget.x, mr->mr_widget.y + 26, 8, 8); + } + +} + +MenuRowItem +menurow_find_selected(MenuRow * mr, gint x, gint y) +{ + MenuRowItem ret = MENUROW_NONE; + + x -= mr->mr_widget.x; + y -= mr->mr_widget.y; + if (x > 0 && x < 8) { + if (y >= 0 && y <= 10) + ret = MENUROW_OPTIONS; + if (y >= 10 && y <= 17) + ret = MENUROW_ALWAYS; + if (y >= 18 && y <= 25) + ret = MENUROW_FILEINFOBOX; + if (y >= 26 && y <= 33) + ret = MENUROW_DOUBLESIZE; + if (y >= 34 && y <= 42) + ret = MENUROW_VISUALIZATION; + } + return ret; +} + +void +menurow_button_press(GtkWidget * widget, + GdkEventButton * event, + gpointer data) +{ + MenuRow *mr = MENU_ROW(data); + + if (event->button != 1) + return; + + if (widget_contains(&mr->mr_widget, event->x, event->y)) { + mr->mr_bpushed = TRUE; + mr->mr_selected = menurow_find_selected(mr, event->x, event->y); + + widget_draw(WIDGET(mr)); + + if (mr->mr_change_callback) + mr->mr_change_callback(mr->mr_selected); + } +} + +void +menurow_motion(GtkWidget * widget, + GdkEventMotion * event, + gpointer data) +{ + MenuRow *mr = MENU_ROW(data); + + if (mr->mr_bpushed) { + mr->mr_selected = menurow_find_selected(mr, event->x, event->y); + + widget_draw(WIDGET(mr)); + + if (mr->mr_change_callback) + mr->mr_change_callback(mr->mr_selected); + } +} + +void +menurow_button_release(GtkWidget * widget, + GdkEventButton * event, + gpointer data) +{ + MenuRow *mr = MENU_ROW(data); + + if (mr->mr_bpushed) { + mr->mr_bpushed = FALSE; + + if (mr->mr_selected == MENUROW_ALWAYS) + mr->mr_always_selected = !mr->mr_always_selected; + + if (mr->mr_selected == MENUROW_DOUBLESIZE) + mr->mr_doublesize_selected = !mr->mr_doublesize_selected; + + if ((int)(mr->mr_selected) != -1 && mr->mr_release_callback) + mr->mr_release_callback(mr->mr_selected); + + mr->mr_selected = MENUROW_NONE; + + widget_draw(WIDGET(mr)); + } +} + +MenuRow * +create_menurow(GList ** wlist, GdkPixmap * parent, GdkGC * gc, + gint x, gint y, gint nx, gint ny, gint sx, gint sy, + void (*ccb) (MenuRowItem), + void (*rcb) (MenuRowItem), SkinPixmapId si) +{ + MenuRow *mr; + + mr = g_new0(MenuRow, 1); + widget_init(&mr->mr_widget, parent, gc, x, y, 8, 43, 1); + mr->mr_widget.draw = menurow_draw; + mr->mr_widget.button_press_cb = menurow_button_press; + mr->mr_widget.motion_cb = menurow_motion; + mr->mr_widget.button_release_cb = menurow_button_release; + mr->mr_nx = nx; + mr->mr_ny = ny; + mr->mr_sx = sx; + mr->mr_sy = sy; + mr->mr_selected = MENUROW_NONE; + mr->mr_change_callback = ccb; + mr->mr_release_callback = rcb; + mr->mr_skin_index = si; + + widget_list_add(wlist, WIDGET(mr)); + return mr; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/audacious/widgets/menurow.h Wed Aug 09 03:58:43 2006 -0700 @@ -0,0 +1,56 @@ +/* BMP - Cross-platform multimedia player + * Copyright (C) 2003-2004 BMP development team. + * + * Based on XMMS: + * Copyright (C) 1998-2003 XMMS development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +#ifndef MENUROW_H +#define MENUROW_H + +#include <glib.h> +#include <gdk/gdk.h> + +#include "skin.h" +#include "widget.h" + +typedef enum { + MENUROW_NONE, MENUROW_OPTIONS, MENUROW_ALWAYS, MENUROW_FILEINFOBOX, + MENUROW_DOUBLESIZE, MENUROW_VISUALIZATION +} MenuRowItem; + +#define MENU_ROW(x) ((MenuRow *)(x)) +struct _MenuRow { + Widget mr_widget; + gint mr_nx, mr_ny; + gint mr_sx, mr_sy; + MenuRowItem mr_selected; + gboolean mr_bpushed; + gboolean mr_always_selected; + gboolean mr_doublesize_selected; + void (*mr_change_callback) (MenuRowItem); + void (*mr_release_callback) (MenuRowItem); + SkinPixmapId mr_skin_index; +}; + +typedef struct _MenuRow MenuRow; + +MenuRow *create_menurow(GList ** wlist, GdkPixmap * parent, GdkGC * gc, + gint x, gint y, gint nx, gint ny, gint sx, gint sy, + void (*ccb) (MenuRowItem), + void (*rcb) (MenuRowItem), SkinPixmapId si); + +#endif