Mercurial > audlegacy-plugins
annotate src/skins/ui_main_evlisteners.c @ 3047:4434b4c4a715
ported EsounD plugin
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Fri, 17 Apr 2009 16:17:10 +0300 |
parents | 3134a0987162 |
children | 1ffcad5f406c |
rev | line source |
---|---|
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
1 /* |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
2 * Audacious |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
3 * Copyright (c) 2006-2007 Audacious development team. |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
4 * |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
7 * the Free Software Foundation; under version 3 of the License. |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
8 * |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
13 * |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses>. |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
16 * |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
17 * The Audacious team does not consider modular code linking to |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
18 * Audacious or using our public API to be a derived work. |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
19 */ |
2967
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
20 #define UPDATEVIS 1 |
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
21 |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
22 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
23 #include "ui_playlist_evlisteners.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
24 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
25 #include <glib.h> |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
26 #include <math.h> |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
27 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
28 #include "hook.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
29 #include "playback.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
30 #include "playlist.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
31 #include "playlist_evmessages.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
32 #include "visualization.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
33 #endif |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2967
diff
changeset
|
34 #include <audlegacy/plugin.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2967
diff
changeset
|
35 #include <audlegacy/input.h> |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
36 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
37 #include "ui_credits.h" |
2640 | 38 #endif |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
39 #include "ui_equalizer.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
40 #include "ui_main.h" |
2640 | 41 #include "ui_playlist.h" |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
42 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
43 #include "ui_preferences.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
44 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
45 #include "ui_skinned_playstatus.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
46 #include "ui_skinned_textbox.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
47 #include "ui_skinned_window.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
48 #include "skins_cfg.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
49 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
50 static gint song_info_timeout_source = 0; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
51 static gint update_vis_timeout_source = 0; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
52 |
2625 | 53 typedef struct { |
54 gint bitrate; | |
55 gint samplerate; | |
56 gint channels; | |
57 } PlaylistEventInfoChange; | |
58 | |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
59 /* XXX: there has to be a better way than polling here! */ |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
60 /* also: where should this function go? should it stay here? --mf0102 */ |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
61 static gboolean |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
62 update_vis_func(gpointer unused) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
63 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
64 if (!audacious_drct_get_playing()) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
65 return FALSE; |
2967
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
66 #if UPDATEVIS |
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
67 aud_input_update_vis(audacious_drct_get_time()); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
68 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
69 return TRUE; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
70 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
71 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
72 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
73 ui_main_evlistener_title_change(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
74 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
75 gchar *text = (gchar *) hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
76 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
77 ui_skinned_textbox_set_text(mainwin_info, text); |
2625 | 78 playlistwin_update_list(aud_playlist_get_active()); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
79 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
80 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
81 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
82 ui_main_evlistener_hide_seekbar(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
83 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
84 mainwin_disable_seekbar(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
85 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
86 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
87 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
88 ui_main_evlistener_volume_change(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
89 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
90 gint *h_vol = (gint *) hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
91 gint vl, vr, b, v; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
92 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
93 vl = CLAMP(h_vol[0], 0, 100); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
94 vr = CLAMP(h_vol[1], 0, 100); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
95 v = MAX(vl, vr); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
96 if (vl > vr) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
97 b = (gint) rint(((gdouble) vr / vl) * 100) - 100; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
98 else if (vl < vr) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
99 b = 100 - (gint) rint(((gdouble) vl / vr) * 100); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
100 else |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
101 b = 0; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
102 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
103 mainwin_set_volume_slider(v); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
104 equalizerwin_set_volume_slider(v); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
105 mainwin_set_balance_slider(b); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
106 equalizerwin_set_balance_slider(b); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
107 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
108 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
109 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
110 ui_main_evlistener_playback_begin(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
111 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
112 PlaylistEntry *entry = (PlaylistEntry*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
113 g_return_if_fail(entry != NULL); |
2641 | 114 |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
115 ui_vis_clear_data(mainwin_vis); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
116 ui_svis_clear_data(mainwin_svis); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
117 mainwin_disable_seekbar(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
118 mainwin_update_song_info(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
119 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
120 if (config.player_shaded) { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
121 gtk_widget_show(mainwin_stime_min); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
122 gtk_widget_show(mainwin_stime_sec); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
123 gtk_widget_show(mainwin_sposition); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
124 } else { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
125 gtk_widget_show(mainwin_minus_num); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
126 gtk_widget_show(mainwin_10min_num); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
127 gtk_widget_show(mainwin_min_num); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
128 gtk_widget_show(mainwin_10sec_num); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
129 gtk_widget_show(mainwin_sec_num); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
130 gtk_widget_show(mainwin_position); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
131 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
132 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
133 song_info_timeout_source = |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
134 g_timeout_add_seconds(1, (GSourceFunc) mainwin_update_song_info, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
135 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
136 update_vis_timeout_source = |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
137 g_timeout_add(10, (GSourceFunc) update_vis_func, NULL); |
2967
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
138 #if UPDATEVIS |
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
139 aud_vis_playback_start(); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
140 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
141 ui_skinned_playstatus_set_status(mainwin_playstatus, STATUS_PLAY); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
142 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
143 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
144 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
145 ui_main_evlistener_playback_stop(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
146 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
147 if (song_info_timeout_source) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
148 g_source_remove(song_info_timeout_source); |
2967
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
149 #if UPDATEVIS |
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
150 aud_vis_playback_stop(); |
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
151 aud_free_vis_data(); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
152 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
153 ui_skinned_playstatus_set_buffering(mainwin_playstatus, FALSE); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
154 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
155 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
156 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
157 ui_main_evlistener_playback_pause(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
158 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
159 ui_skinned_playstatus_set_status(mainwin_playstatus, STATUS_PAUSE); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
160 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
161 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
162 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
163 ui_main_evlistener_playback_unpause(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
164 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
165 ui_skinned_playstatus_set_status(mainwin_playstatus, STATUS_PLAY); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
166 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
167 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
168 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
169 ui_main_evlistener_playback_seek(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
170 { |
2967
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
171 #if UPDATEVIS |
165ccb8de035
audlegacy-plugins begins.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2679
diff
changeset
|
172 aud_free_vis_data(); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
173 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
174 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
175 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
176 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
177 ui_main_evlistener_playback_play_file(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
178 { |
2679
fb5375e86a03
make setting random skin on play working
Tomasz Mon <desowin@gmail.com>
parents:
2669
diff
changeset
|
179 if (config.random_skin_on_play) |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
180 skin_set_random_skin(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
181 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
182 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
183 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
184 ui_main_evlistener_playlist_end_reached(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
185 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
186 mainwin_clear_song_info(); |
2640 | 187 |
188 if (aud_cfg->stopaftersong) | |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
189 mainwin_set_stopaftersong(FALSE); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
190 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
191 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
192 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
193 ui_main_evlistener_playlist_info_change(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
194 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
195 PlaylistEventInfoChange *msg = (PlaylistEventInfoChange *) hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
196 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
197 mainwin_set_song_info(msg->bitrate, msg->samplerate, msg->channels); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
198 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
199 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
200 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
201 ui_main_evlistener_mainwin_set_always_on_top(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
202 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
203 gboolean *ontop = (gboolean*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
204 mainwin_set_always_on_top(*ontop); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
205 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
206 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
207 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
208 ui_main_evlistener_mainwin_show(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
209 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
210 gboolean *show = (gboolean*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
211 mainwin_show(*show); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
212 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
213 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
214 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
215 ui_main_evlistener_equalizerwin_show(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
216 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
217 gboolean *show = (gboolean*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
218 equalizerwin_show(*show); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
219 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
220 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
221 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
222 ui_main_evlistener_visualization_timeout(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
223 { |
2669 | 224 if (hook_data == NULL) { |
225 if (config.player_shaded && config.player_visible) | |
226 ui_svis_timeout_func(mainwin_svis, NULL); | |
227 else | |
228 ui_vis_timeout_func(mainwin_vis, NULL); | |
229 return; | |
230 } | |
231 | |
232 VisNode *vis = (VisNode*) hook_data; | |
233 | |
234 guint8 intern_vis_data[512]; | |
235 gint16 mono_freq[2][256]; | |
236 gboolean mono_freq_calced = FALSE; | |
237 gint16 mono_pcm[2][512], stereo_pcm[2][512]; | |
238 gboolean mono_pcm_calced = FALSE, stereo_pcm_calced = FALSE; | |
239 gint i; | |
240 | |
241 if (config.vis_type == VIS_OFF) | |
242 return; | |
243 | |
244 if (config.vis_type == VIS_ANALYZER) { | |
245 /* Spectrum analyzer */ | |
246 /* 76 values */ | |
247 const gint long_xscale[] = | |
248 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | |
249 17, 18, | |
250 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, | |
251 34, | |
252 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, | |
253 50, 51, | |
254 52, 53, 54, 55, 56, 57, 58, 61, 66, 71, 76, 81, 87, 93, | |
255 100, 107, | |
256 114, 122, 131, 140, 150, 161, 172, 184, 255 | |
257 }; | |
258 /* 20 values */ | |
259 const int short_xscale[] = | |
260 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 15, 20, 27, | |
261 36, 47, 62, 82, 107, 141, 184, 255 | |
262 }; | |
263 const double y_scale = 3.60673760222; /* 20.0 / log(256) */ | |
264 const int *xscale; | |
265 gint j, y, max; | |
266 | |
267 if (!mono_freq_calced) | |
268 aud_calc_mono_freq(mono_freq, vis->data, vis->nch); | |
269 | |
270 memset(intern_vis_data, 0, 75); | |
271 | |
272 if (config.analyzer_type == ANALYZER_BARS) { | |
273 if (config.player_shaded) { | |
274 max = 13; | |
275 } | |
276 else { | |
277 max = 19; | |
278 } | |
279 xscale = short_xscale; | |
280 } | |
281 else { | |
282 if (config.player_shaded) { | |
283 max = 37; | |
284 } | |
285 else { | |
286 max = 75; | |
287 } | |
288 xscale = long_xscale; | |
289 } | |
290 | |
291 for (i = 0; i < max; i++) { | |
292 for (j = xscale[i], y = 0; j < xscale[i + 1]; j++) { | |
293 if (mono_freq[0][j] > y) | |
294 y = mono_freq[0][j]; | |
295 } | |
296 y >>= 7; | |
297 if (y != 0) { | |
298 intern_vis_data[i] = log(y) * y_scale; | |
299 if (intern_vis_data[i] > 15) | |
300 intern_vis_data[i] = 15; | |
301 } | |
302 else | |
303 intern_vis_data[i] = 0; | |
304 } | |
305 } | |
306 else if(config.vis_type == VIS_VOICEPRINT){ | |
307 if (config.player_shaded && config.player_visible) { | |
308 /* VU */ | |
309 gint vu, val; | |
310 | |
311 if (!stereo_pcm_calced) | |
312 aud_calc_stereo_pcm(stereo_pcm, vis->data, vis->nch); | |
313 vu = 0; | |
314 for (i = 0; i < 512; i++) { | |
315 val = abs(stereo_pcm[0][i]); | |
316 if (val > vu) | |
317 vu = val; | |
318 } | |
319 intern_vis_data[0] = (vu * 37) >> 15; | |
320 if (intern_vis_data[0] > 37) | |
321 intern_vis_data[0] = 37; | |
322 if (vis->nch == 2) { | |
323 vu = 0; | |
324 for (i = 0; i < 512; i++) { | |
325 val = abs(stereo_pcm[1][i]); | |
326 if (val > vu) | |
327 vu = val; | |
328 } | |
329 intern_vis_data[1] = (vu * 37) >> 15; | |
330 if (intern_vis_data[1] > 37) | |
331 intern_vis_data[1] = 37; | |
332 } | |
333 else | |
334 intern_vis_data[1] = intern_vis_data[0]; | |
335 } | |
336 else { /*Voiceprint*/ | |
337 if (!mono_freq_calced) | |
338 aud_calc_mono_freq(mono_freq, vis->data, vis->nch); | |
339 memset(intern_vis_data, 0, 256); | |
340 | |
341 /* For the values [0-16] we use the frequency that's 3/2 as much. | |
342 If we assume the 512 values calculated by calc_mono_freq to | |
343 cover 0-22kHz linearly we get a range of | |
344 [0-16] * 3/2 * 22000/512 = [0-1,031] Hz. | |
345 Most stuff above that is harmonics and we want to utilize the | |
346 16 samples we have to the max[tm] | |
347 */ | |
348 for (i = 0; i < 50 ; i+=3){ | |
349 intern_vis_data[i/3] += (mono_freq[0][i/2] >> 5); | |
350 | |
351 /*Boost frequencies above 257Hz a little*/ | |
352 //if(i > 4 * 3) | |
353 // intern_vis_data[i/3] += 8; | |
354 } | |
355 } | |
356 } | |
357 else { /* (config.vis_type == VIS_SCOPE) */ | |
358 | |
359 /* Oscilloscope */ | |
360 gint pos, step; | |
361 | |
362 if (!mono_pcm_calced) | |
363 aud_calc_mono_pcm(mono_pcm, vis->data, vis->nch); | |
364 | |
365 step = (vis->length << 8) / 74; | |
366 for (i = 0, pos = 0; i < 75; i++, pos += step) { | |
367 intern_vis_data[i] = ((mono_pcm[0][pos >> 8]) >> 12) + 7; | |
368 if (intern_vis_data[i] == 255) | |
369 intern_vis_data[i] = 0; | |
370 else if (intern_vis_data[i] > 12) | |
371 intern_vis_data[i] = 12; | |
372 /* Do not see the point of that? (comparison always false) -larne. | |
373 if (intern_vis_data[i] < 0) | |
374 intern_vis_data[i] = 0; */ | |
375 } | |
376 } | |
377 | |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
378 if (config.player_shaded && config.player_visible) |
2669 | 379 ui_svis_timeout_func(mainwin_svis, intern_vis_data); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
380 else |
2669 | 381 ui_vis_timeout_func(mainwin_vis, intern_vis_data); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
382 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
383 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
384 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
385 ui_main_evlistener_config_save(gpointer hook_data, gpointer user_data) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
386 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
387 ConfigDb *db = (ConfigDb *) hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
388 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
389 if (SKINNED_WINDOW(mainwin)->x != -1 && |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
390 SKINNED_WINDOW(mainwin)->y != -1 ) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
391 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
392 aud_cfg_db_set_int(db, "skins", "player_x", SKINNED_WINDOW(mainwin)->x); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
393 aud_cfg_db_set_int(db, "skins", "player_y", SKINNED_WINDOW(mainwin)->y); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
394 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
395 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
396 aud_cfg_db_set_bool(db, "skins", "mainwin_use_bitmapfont", |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
397 config.mainwin_use_bitmapfont); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
398 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
399 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
400 void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
401 ui_main_evlistener_init(void) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
402 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
403 aud_hook_associate("title change", ui_main_evlistener_title_change, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
404 aud_hook_associate("hide seekbar", ui_main_evlistener_hide_seekbar, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
405 aud_hook_associate("volume set", ui_main_evlistener_volume_change, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
406 aud_hook_associate("playback begin", ui_main_evlistener_playback_begin, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
407 aud_hook_associate("playback stop", ui_main_evlistener_playback_stop, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
408 aud_hook_associate("playback pause", ui_main_evlistener_playback_pause, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
409 aud_hook_associate("playback unpause", ui_main_evlistener_playback_unpause, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
410 aud_hook_associate("playback seek", ui_main_evlistener_playback_seek, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
411 aud_hook_associate("playback play file", ui_main_evlistener_playback_play_file, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
412 aud_hook_associate("playlist end reached", ui_main_evlistener_playlist_end_reached, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
413 aud_hook_associate("playlist info change", ui_main_evlistener_playlist_info_change, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
414 aud_hook_associate("mainwin set always on top", ui_main_evlistener_mainwin_set_always_on_top, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
415 aud_hook_associate("mainwin show", ui_main_evlistener_mainwin_show, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
416 aud_hook_associate("equalizerwin show", ui_main_evlistener_equalizerwin_show, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
417 aud_hook_associate("visualization timeout", ui_main_evlistener_visualization_timeout, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
418 aud_hook_associate("config save", ui_main_evlistener_config_save, NULL); |
2633
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
419 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
420 aud_hook_associate("playback audio error", (void *) mainwin_stop_pushed, NULL); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
421 aud_hook_associate("playback audio error", (void *) run_no_output_device_dialog, NULL); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
422 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
423 aud_hook_associate("playback seek", (HookFunction) mainwin_update_song_info, NULL); |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
424 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
425 |
2633
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
426 void |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
427 ui_main_evlistener_dissociate(void) |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
428 { |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
429 aud_hook_dissociate("title change", ui_main_evlistener_title_change); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
430 aud_hook_dissociate("hide seekbar", ui_main_evlistener_hide_seekbar); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
431 aud_hook_dissociate("volume set", ui_main_evlistener_volume_change); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
432 aud_hook_dissociate("playback begin", ui_main_evlistener_playback_begin); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
433 aud_hook_dissociate("playback stop", ui_main_evlistener_playback_stop); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
434 aud_hook_dissociate("playback pause", ui_main_evlistener_playback_pause); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
435 aud_hook_dissociate("playback unpause", ui_main_evlistener_playback_unpause); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
436 aud_hook_dissociate("playback seek", ui_main_evlistener_playback_seek); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
437 aud_hook_dissociate("playback play file", ui_main_evlistener_playback_play_file); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
438 aud_hook_dissociate("playlist end reached", ui_main_evlistener_playlist_end_reached); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
439 aud_hook_dissociate("playlist info change", ui_main_evlistener_playlist_info_change); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
440 aud_hook_dissociate("mainwin set always on top", ui_main_evlistener_mainwin_set_always_on_top); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
441 aud_hook_dissociate("mainwin show", ui_main_evlistener_mainwin_show); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
442 aud_hook_dissociate("equalizerwin show", ui_main_evlistener_equalizerwin_show); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
443 #if 0 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
444 aud_hook_dissociate("prefswin show", ui_main_evlistener_prefswin_show); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
445 aud_hook_dissociate("aboutwin show", ui_main_evlistener_aboutwin_show); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
446 aud_hook_dissociate("ui jump to track show", ui_main_evlistener_ui_jump_to_track_show); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
447 #endif |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
448 aud_hook_dissociate("visualization timeout", ui_main_evlistener_visualization_timeout); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
449 aud_hook_dissociate("config save", ui_main_evlistener_config_save); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
450 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
451 aud_hook_dissociate("playback audio error", (void *) mainwin_stop_pushed); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
452 aud_hook_dissociate("playback audio error", (void *) run_no_output_device_dialog); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
453 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
454 aud_hook_dissociate("playback seek", (HookFunction) mainwin_update_song_info); |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
455 } |