annotate audacious/playstatus.c @ 1526:98a9c54459f0 trunk

[svn] - a minor tweak to the save function
author nenolod
date Mon, 07 Aug 2006 23:08:59 -0700
parents 705d4c089fce
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* XMMS - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 #include "playstatus.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #include <gdk/gdk.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #include "skin.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 #include "widget.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 playstatus_draw(Widget * w)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 PlayStatus *ps = PLAY_STATUS(w);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 GdkPixmap *obj;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32
192
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
33 if (!w)
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
34 return;
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
35
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 obj = ps->ps_widget.parent;
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
37 if (ps->ps_status == STATUS_STOP && ps->ps_status_buffering == TRUE)
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
38 ps->ps_status_buffering = FALSE;
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
39 if (ps->ps_status == STATUS_PLAY && ps->ps_status_buffering == TRUE)
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
40 skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc,
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
41 SKIN_PLAYPAUSE, 39, 0, ps->ps_widget.x,
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
42 ps->ps_widget.y, 3, 9);
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
43 else if (ps->ps_status == STATUS_PLAY)
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 SKIN_PLAYPAUSE, 36, 0, ps->ps_widget.x,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 ps->ps_widget.y, 3, 9);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 SKIN_PLAYPAUSE, 27, 0, ps->ps_widget.x,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 ps->ps_widget.y, 2, 9);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 switch (ps->ps_status) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 case STATUS_STOP:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 SKIN_PLAYPAUSE, 18, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 ps->ps_widget.x + 2, ps->ps_widget.y, 9, 9);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 case STATUS_PAUSE:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 SKIN_PLAYPAUSE, 9, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 ps->ps_widget.x + 2, ps->ps_widget.y, 9, 9);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 case STATUS_PLAY:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 skin_draw_pixmap(bmp_active_skin, obj, ps->ps_widget.gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 SKIN_PLAYPAUSE, 1, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 ps->ps_widget.x + 3, ps->ps_widget.y, 8, 9);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 playstatus_set_status(PlayStatus * ps, PStatus status)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 {
192
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
73 if (!ps)
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
74 return;
0ee0b9b6db7e [svn] headless now working, use --headless if you wish to experiment.
nenolod
parents: 0
diff changeset
75
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 ps->ps_status = status;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 widget_draw(WIDGET(ps));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
80 void
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
81 playstatus_set_status_buffering(PlayStatus * ps, gboolean status)
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
82 {
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
83 if (!ps)
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
84 return;
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
85
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
86 ps->ps_status_buffering = status;
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
87 widget_draw(WIDGET(ps));
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
88 }
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 192
diff changeset
89
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 PlayStatus *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 create_playstatus(GList ** wlist, GdkPixmap * parent,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 GdkGC * gc, gint x, gint y)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 PlayStatus *ps;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 ps = g_new0(PlayStatus, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 widget_init(&ps->ps_widget, parent, gc, x, y, 11, 9, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 ps->ps_widget.draw = playstatus_draw;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 widget_list_add(wlist, WIDGET(ps));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 return ps;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 }