Mercurial > audlegacy-plugins
annotate src/skins/ui_main_evlisteners.c @ 2734:8a102490a8c0
compilation fix
author | Paula Stanciu <paula.stanciu@gmail.com> |
---|---|
date | Mon, 30 Jun 2008 01:04:29 +0300 |
parents | fb5375e86a03 |
children | 165ccb8de035 |
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 */ |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
20 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
21 #include "ui_playlist_evlisteners.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
22 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
23 #include <glib.h> |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
24 #include <math.h> |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
25 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
26 #include "hook.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
27 #include "playback.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
28 #include "playlist.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
29 #include "playlist_evmessages.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
30 #include "visualization.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
31 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
32 #include <audacious/plugin.h> |
2669 | 33 #include <audacious/input.h> |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
34 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
35 #include "ui_credits.h" |
2640 | 36 #endif |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
37 #include "ui_equalizer.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
38 #include "ui_main.h" |
2640 | 39 #include "ui_playlist.h" |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
40 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
41 #include "ui_preferences.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
42 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
43 #include "ui_skinned_playstatus.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
44 #include "ui_skinned_textbox.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
45 #include "ui_skinned_window.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
46 #include "skins_cfg.h" |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
47 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
48 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
|
49 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
|
50 |
2625 | 51 typedef struct { |
52 gint bitrate; | |
53 gint samplerate; | |
54 gint channels; | |
55 } PlaylistEventInfoChange; | |
56 | |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
57 /* 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
|
58 /* 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
|
59 static gboolean |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
60 update_vis_func(gpointer unused) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
61 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
62 if (!audacious_drct_get_playing()) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
63 return FALSE; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
64 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
65 input_update_vis(audacious_drct_get_time()); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
66 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
67 return TRUE; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
68 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
69 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
70 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
71 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
|
72 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
73 gchar *text = (gchar *) hook_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 ui_skinned_textbox_set_text(mainwin_info, text); |
2625 | 76 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
|
77 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
78 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
79 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
80 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
|
81 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
82 mainwin_disable_seekbar(); |
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 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
85 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
86 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
|
87 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
88 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
|
89 gint vl, vr, b, v; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
90 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
91 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
|
92 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
|
93 v = MAX(vl, vr); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
94 if (vl > vr) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
95 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
|
96 else if (vl < vr) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
97 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
|
98 else |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
99 b = 0; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
100 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
101 mainwin_set_volume_slider(v); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
102 equalizerwin_set_volume_slider(v); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
103 mainwin_set_balance_slider(b); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
104 equalizerwin_set_balance_slider(b); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
105 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
106 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
107 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
108 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
|
109 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
110 PlaylistEntry *entry = (PlaylistEntry*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
111 g_return_if_fail(entry != NULL); |
2641 | 112 |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
113 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
|
114 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
|
115 mainwin_disable_seekbar(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
116 mainwin_update_song_info(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
117 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
118 if (config.player_shaded) { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
119 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
|
120 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
|
121 gtk_widget_show(mainwin_sposition); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
122 } else { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 gtk_widget_show(mainwin_position); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
129 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
130 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
131 song_info_timeout_source = |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
132 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
|
133 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
134 update_vis_timeout_source = |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
135 g_timeout_add(10, (GSourceFunc) update_vis_func, NULL); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
136 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
137 vis_playback_start(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
138 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
139 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
|
140 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
141 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
142 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
143 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
|
144 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
145 if (song_info_timeout_source) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
146 g_source_remove(song_info_timeout_source); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
147 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
148 vis_playback_stop(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
149 free_vis_data(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
150 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
151 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
|
152 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
153 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
154 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
155 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
|
156 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
157 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
|
158 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
159 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
160 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
161 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
|
162 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
163 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
|
164 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
165 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
166 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
167 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
|
168 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
169 #if 0 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
170 free_vis_data(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
171 #endif |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
172 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
173 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
174 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
175 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
|
176 { |
2679
fb5375e86a03
make setting random skin on play working
Tomasz Mon <desowin@gmail.com>
parents:
2669
diff
changeset
|
177 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
|
178 skin_set_random_skin(); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
179 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
180 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
181 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
182 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
|
183 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
184 mainwin_clear_song_info(); |
2640 | 185 |
186 if (aud_cfg->stopaftersong) | |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
187 mainwin_set_stopaftersong(FALSE); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
188 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
189 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
190 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
191 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
|
192 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
193 PlaylistEventInfoChange *msg = (PlaylistEventInfoChange *) hook_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 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
|
196 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
197 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
198 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
199 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
|
200 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
201 gboolean *ontop = (gboolean*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
202 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
|
203 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
204 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
205 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
206 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
|
207 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
208 gboolean *show = (gboolean*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
209 mainwin_show(*show); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
210 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
211 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
212 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
213 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
|
214 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
215 gboolean *show = (gboolean*)hook_data; |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
216 equalizerwin_show(*show); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
217 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
218 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
219 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
220 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
|
221 { |
2669 | 222 if (hook_data == NULL) { |
223 if (config.player_shaded && config.player_visible) | |
224 ui_svis_timeout_func(mainwin_svis, NULL); | |
225 else | |
226 ui_vis_timeout_func(mainwin_vis, NULL); | |
227 return; | |
228 } | |
229 | |
230 VisNode *vis = (VisNode*) hook_data; | |
231 | |
232 guint8 intern_vis_data[512]; | |
233 gint16 mono_freq[2][256]; | |
234 gboolean mono_freq_calced = FALSE; | |
235 gint16 mono_pcm[2][512], stereo_pcm[2][512]; | |
236 gboolean mono_pcm_calced = FALSE, stereo_pcm_calced = FALSE; | |
237 gint i; | |
238 | |
239 if (config.vis_type == VIS_OFF) | |
240 return; | |
241 | |
242 if (config.vis_type == VIS_ANALYZER) { | |
243 /* Spectrum analyzer */ | |
244 /* 76 values */ | |
245 const gint long_xscale[] = | |
246 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | |
247 17, 18, | |
248 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, | |
249 34, | |
250 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, | |
251 50, 51, | |
252 52, 53, 54, 55, 56, 57, 58, 61, 66, 71, 76, 81, 87, 93, | |
253 100, 107, | |
254 114, 122, 131, 140, 150, 161, 172, 184, 255 | |
255 }; | |
256 /* 20 values */ | |
257 const int short_xscale[] = | |
258 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 15, 20, 27, | |
259 36, 47, 62, 82, 107, 141, 184, 255 | |
260 }; | |
261 const double y_scale = 3.60673760222; /* 20.0 / log(256) */ | |
262 const int *xscale; | |
263 gint j, y, max; | |
264 | |
265 if (!mono_freq_calced) | |
266 aud_calc_mono_freq(mono_freq, vis->data, vis->nch); | |
267 | |
268 memset(intern_vis_data, 0, 75); | |
269 | |
270 if (config.analyzer_type == ANALYZER_BARS) { | |
271 if (config.player_shaded) { | |
272 max = 13; | |
273 } | |
274 else { | |
275 max = 19; | |
276 } | |
277 xscale = short_xscale; | |
278 } | |
279 else { | |
280 if (config.player_shaded) { | |
281 max = 37; | |
282 } | |
283 else { | |
284 max = 75; | |
285 } | |
286 xscale = long_xscale; | |
287 } | |
288 | |
289 for (i = 0; i < max; i++) { | |
290 for (j = xscale[i], y = 0; j < xscale[i + 1]; j++) { | |
291 if (mono_freq[0][j] > y) | |
292 y = mono_freq[0][j]; | |
293 } | |
294 y >>= 7; | |
295 if (y != 0) { | |
296 intern_vis_data[i] = log(y) * y_scale; | |
297 if (intern_vis_data[i] > 15) | |
298 intern_vis_data[i] = 15; | |
299 } | |
300 else | |
301 intern_vis_data[i] = 0; | |
302 } | |
303 } | |
304 else if(config.vis_type == VIS_VOICEPRINT){ | |
305 if (config.player_shaded && config.player_visible) { | |
306 /* VU */ | |
307 gint vu, val; | |
308 | |
309 if (!stereo_pcm_calced) | |
310 aud_calc_stereo_pcm(stereo_pcm, vis->data, vis->nch); | |
311 vu = 0; | |
312 for (i = 0; i < 512; i++) { | |
313 val = abs(stereo_pcm[0][i]); | |
314 if (val > vu) | |
315 vu = val; | |
316 } | |
317 intern_vis_data[0] = (vu * 37) >> 15; | |
318 if (intern_vis_data[0] > 37) | |
319 intern_vis_data[0] = 37; | |
320 if (vis->nch == 2) { | |
321 vu = 0; | |
322 for (i = 0; i < 512; i++) { | |
323 val = abs(stereo_pcm[1][i]); | |
324 if (val > vu) | |
325 vu = val; | |
326 } | |
327 intern_vis_data[1] = (vu * 37) >> 15; | |
328 if (intern_vis_data[1] > 37) | |
329 intern_vis_data[1] = 37; | |
330 } | |
331 else | |
332 intern_vis_data[1] = intern_vis_data[0]; | |
333 } | |
334 else { /*Voiceprint*/ | |
335 if (!mono_freq_calced) | |
336 aud_calc_mono_freq(mono_freq, vis->data, vis->nch); | |
337 memset(intern_vis_data, 0, 256); | |
338 | |
339 /* For the values [0-16] we use the frequency that's 3/2 as much. | |
340 If we assume the 512 values calculated by calc_mono_freq to | |
341 cover 0-22kHz linearly we get a range of | |
342 [0-16] * 3/2 * 22000/512 = [0-1,031] Hz. | |
343 Most stuff above that is harmonics and we want to utilize the | |
344 16 samples we have to the max[tm] | |
345 */ | |
346 for (i = 0; i < 50 ; i+=3){ | |
347 intern_vis_data[i/3] += (mono_freq[0][i/2] >> 5); | |
348 | |
349 /*Boost frequencies above 257Hz a little*/ | |
350 //if(i > 4 * 3) | |
351 // intern_vis_data[i/3] += 8; | |
352 } | |
353 } | |
354 } | |
355 else { /* (config.vis_type == VIS_SCOPE) */ | |
356 | |
357 /* Oscilloscope */ | |
358 gint pos, step; | |
359 | |
360 if (!mono_pcm_calced) | |
361 aud_calc_mono_pcm(mono_pcm, vis->data, vis->nch); | |
362 | |
363 step = (vis->length << 8) / 74; | |
364 for (i = 0, pos = 0; i < 75; i++, pos += step) { | |
365 intern_vis_data[i] = ((mono_pcm[0][pos >> 8]) >> 12) + 7; | |
366 if (intern_vis_data[i] == 255) | |
367 intern_vis_data[i] = 0; | |
368 else if (intern_vis_data[i] > 12) | |
369 intern_vis_data[i] = 12; | |
370 /* Do not see the point of that? (comparison always false) -larne. | |
371 if (intern_vis_data[i] < 0) | |
372 intern_vis_data[i] = 0; */ | |
373 } | |
374 } | |
375 | |
2602
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
376 if (config.player_shaded && config.player_visible) |
2669 | 377 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
|
378 else |
2669 | 379 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
|
380 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
381 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
382 static void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
383 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
|
384 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
385 ConfigDb *db = (ConfigDb *) hook_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 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
|
388 SKINNED_WINDOW(mainwin)->y != -1 ) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
389 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
390 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
|
391 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
|
392 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
393 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
394 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
|
395 config.mainwin_use_bitmapfont); |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
396 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
397 |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
398 void |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
399 ui_main_evlistener_init(void) |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
400 { |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
401 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
|
402 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
|
403 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
|
404 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
|
405 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
|
406 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
|
407 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
|
408 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
|
409 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
|
410 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
|
411 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
|
412 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
418 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
|
419 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
|
420 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
421 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
|
422 } |
7cd898f08f31
work in progress - add ui_manager and ui_main_evlisteners
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
423 |
2633
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
424 void |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
425 ui_main_evlistener_dissociate(void) |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
426 { |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
427 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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 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
|
440 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
|
441 #if 0 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
442 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
|
443 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
|
444 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
|
445 #endif |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
446 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
|
447 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
|
448 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
449 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
|
450 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
|
451 |
8e4af29f7e17
dissociate hooks at plugin cleanup
Tomasz Mon <desowin@gmail.com>
parents:
2625
diff
changeset
|
452 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
|
453 } |