Mercurial > audlegacy
annotate src/audacious/ui_equalizer.c @ 4696:851b12bf90d2
Properly escape all appropriate entities.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sat, 05 Jul 2008 20:46:02 -0500 |
parents | 31a4cc265f31 |
children |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious development team. | |
3 * | |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3102
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2313 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3102
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
2313 | 24 */ |
25 | |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
26 /*#define AUD_DEBUG*/ |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
27 |
2313 | 28 #ifdef HAVE_CONFIG_H |
29 # include "config.h" | |
30 #endif | |
31 | |
32 #include "ui_equalizer.h" | |
33 | |
34 #include <glib.h> | |
35 #include <glib/gi18n.h> | |
36 #include <gtk/gtk.h> | |
37 #include <stdio.h> | |
38 #include <math.h> | |
39 #include <string.h> | |
40 | |
41 #include "platform/smartinclude.h" | |
4508
246244ead30e
renamed skin.* to ui_skin.* and moved ui_skinned_widget_draw() to it
mf0102 <0102@gmx.at>
parents:
4504
diff
changeset
|
42 #include "ui_skin.h" |
2313 | 43 #include "input.h" |
44 #include "main.h" | |
45 #include "ui_manager.h" | |
46 #include "actions-equalizer.h" | |
47 #include "playlist.h" | |
48 #include "ui_playlist.h" | |
49 #include "util.h" | |
50 #include "output.h" | |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
51 #include "equalizer_flow.h" |
2313 | 52 |
2537 | 53 #include "rcfile.h" |
2313 | 54 #include "vfs.h" |
55 | |
56 #include "images/audacious_eq.xpm" | |
57 | |
4546 | 58 #include "ui_dock.h" |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2331
diff
changeset
|
59 #include "ui_skinned_window.h" |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
60 #include "ui_skinned_button.h" |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
61 #include "ui_skinned_horizontal_slider.h" |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
62 #include "ui_skinned_equalizer_slider.h" |
3101
b25db04ee2a1
replace EqGraph with UiSkinnedEqualizerGraph
Tomasz Mon <desowin@gmail.com>
parents:
3098
diff
changeset
|
63 #include "ui_skinned_equalizer_graph.h" |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2331
diff
changeset
|
64 |
2313 | 65 enum PresetViewCols { |
66 PRESET_VIEW_COL_NAME, | |
67 PRESET_VIEW_N_COLS | |
68 }; | |
69 | |
70 struct _EqualizerPreset { | |
71 gchar *name; | |
4604
51d82bf6ba63
Use a define (AUD_EQUALIZER_NBANDS) instead of magic value 10 everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
4554
diff
changeset
|
72 gfloat preamp, bands[AUD_EQUALIZER_NBANDS]; |
2313 | 73 }; |
74 | |
75 typedef struct _EqualizerPreset EqualizerPreset; | |
76 | |
77 | |
78 GtkWidget *equalizerwin; | |
3918
a318d4b479d2
hide equalizer graph in special skins (needed for a certain skin)
mf0102 <0102@gmx.at>
parents:
3917
diff
changeset
|
79 GtkWidget *equalizerwin_graph; |
2313 | 80 |
81 static GtkWidget *equalizerwin_load_window = NULL; | |
82 static GtkWidget *equalizerwin_load_auto_window = NULL; | |
83 static GtkWidget *equalizerwin_save_window = NULL; | |
84 static GtkWidget *equalizerwin_save_entry = NULL; | |
85 static GtkWidget *equalizerwin_save_auto_window = NULL; | |
86 static GtkWidget *equalizerwin_save_auto_entry = NULL; | |
87 static GtkWidget *equalizerwin_delete_window = NULL; | |
88 static GtkWidget *equalizerwin_delete_auto_window = NULL; | |
89 | |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
90 static GtkWidget *equalizerwin_on, *equalizerwin_auto; |
2313 | 91 |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
92 static GtkWidget *equalizerwin_close, *equalizerwin_presets, *equalizerwin_shade; |
4604
51d82bf6ba63
Use a define (AUD_EQUALIZER_NBANDS) instead of magic value 10 everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
4554
diff
changeset
|
93 static GtkWidget *equalizerwin_preamp,*equalizerwin_bands[AUD_EQUALIZER_NBANDS]; |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
94 static GtkWidget *equalizerwin_volume, *equalizerwin_balance; |
2313 | 95 |
96 static GList *equalizer_presets = NULL, *equalizer_auto_presets = NULL; | |
97 | |
98 EqualizerPreset * | |
99 equalizer_preset_new(const gchar * name) | |
100 { | |
101 EqualizerPreset *preset = g_new0(EqualizerPreset, 1); | |
102 preset->name = g_strdup(name); | |
103 return preset; | |
104 } | |
105 | |
106 void | |
107 equalizer_preset_free(EqualizerPreset * preset) | |
108 { | |
109 if (!preset) | |
110 return; | |
111 | |
112 g_free(preset->name); | |
113 g_free(preset); | |
114 } | |
115 | |
116 void | |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
117 equalizerwin_set_scaled(gboolean ds) |
2313 | 118 { |
119 gint height; | |
120 | |
121 if (cfg.equalizer_shaded) | |
122 height = 14; | |
123 else | |
124 height = 116; | |
125 | |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
126 if (cfg.scaled) { |
4219
8a848179e244
fixed the eqalizer window
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
127 dock_window_resize(GTK_WINDOW(equalizerwin), 275 * cfg.scale_factor, |
8a848179e244
fixed the eqalizer window
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
128 height * cfg.scale_factor, 275 * cfg.scale_factor, height * cfg.scale_factor); |
3243 | 129 } else { |
2313 | 130 dock_window_resize(GTK_WINDOW(equalizerwin), 275, height, 275, height); |
131 } | |
132 | |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
133 GList *iter; |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
134 for (iter = GTK_FIXED (SKINNED_WINDOW(equalizerwin)->fixed)->children; iter; iter = g_list_next (iter)) { |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
135 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
136 GtkWidget *child = child_data->widget; |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
137 g_signal_emit_by_name(child, "toggle-scaled"); |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
138 } |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
139 gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + cfg.equalizer_shaded), 0, 0); |
2313 | 140 } |
141 | |
142 void | |
143 equalizerwin_set_shade_menu_cb(gboolean shaded) | |
144 { | |
145 cfg.equalizer_shaded = shaded; | |
146 | |
147 if (shaded) { | |
4517 | 148 dock_shade(get_dock_window_list(), GTK_WINDOW(equalizerwin), |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
149 14 * EQUALIZER_SCALE_FACTOR); |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
150 ui_skinned_set_push_button_data(equalizerwin_shade, -1, 3, -1, 47); |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
151 ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
152 ui_skinned_set_push_button_data(equalizerwin_close, 11, 38, 11, 47); |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
153 ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQ_EX); |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
154 gtk_widget_show(equalizerwin_volume); |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
155 gtk_widget_show(equalizerwin_balance); |
2313 | 156 } |
157 else { | |
4517 | 158 dock_shade(get_dock_window_list(), GTK_WINDOW(equalizerwin), |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
159 116 * EQUALIZER_SCALE_FACTOR); |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
160 ui_skinned_set_push_button_data(equalizerwin_shade, -1, 137, -1, 38); |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
161 ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQMAIN); |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
162 ui_skinned_set_push_button_data(equalizerwin_close, 0, 116, 0, 125); |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
163 ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQMAIN); |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
164 gtk_widget_hide(equalizerwin_volume); |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
165 gtk_widget_hide(equalizerwin_balance); |
2313 | 166 } |
4131 | 167 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
168 gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + cfg.equalizer_shaded), 0, 0); |
2313 | 169 } |
170 | |
171 static void | |
172 equalizerwin_set_shade(gboolean shaded) | |
173 { | |
174 GtkAction *action = gtk_action_group_get_action( | |
175 toggleaction_group_others , "roll up equalizer" ); | |
176 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); | |
177 } | |
178 | |
179 static void | |
180 equalizerwin_shade_toggle(void) | |
181 { | |
182 equalizerwin_set_shade(!cfg.equalizer_shaded); | |
183 } | |
184 | |
185 void | |
186 equalizerwin_eq_changed(void) | |
187 { | |
188 gint i; | |
189 | |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
190 cfg.equalizer_preamp = ui_skinned_equalizer_slider_get_position(equalizerwin_preamp); |
4604
51d82bf6ba63
Use a define (AUD_EQUALIZER_NBANDS) instead of magic value 10 everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
4554
diff
changeset
|
191 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++) |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
192 cfg.equalizer_bands[i] = ui_skinned_equalizer_slider_get_position(equalizerwin_bands[i]); |
4650
31a4cc265f31
Removed the deprecated set_eq() function from InputPlugin and other places.
Matti Hamalainen <ccr@tnsp.org>
parents:
4604
diff
changeset
|
193 |
2313 | 194 output_set_eq(cfg.equalizer_active, cfg.equalizer_preamp, |
195 cfg.equalizer_bands); | |
196 | |
3101
b25db04ee2a1
replace EqGraph with UiSkinnedEqualizerGraph
Tomasz Mon <desowin@gmail.com>
parents:
3098
diff
changeset
|
197 gtk_widget_queue_draw(equalizerwin_graph); |
2313 | 198 } |
199 | |
200 static void | |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
201 equalizerwin_on_pushed(void) |
2313 | 202 { |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
203 cfg.equalizer_active = UI_SKINNED_BUTTON(equalizerwin_on)->inside; |
2313 | 204 equalizerwin_eq_changed(); |
205 } | |
206 | |
207 static void | |
208 equalizerwin_presets_pushed(void) | |
209 { | |
210 GdkModifierType modmask; | |
211 gint x, y; | |
212 | |
213 gdk_window_get_pointer(NULL, &x, &y, &modmask); | |
214 ui_manager_popup_menu_show(GTK_MENU(equalizerwin_presets_menu), x, y, 1, GDK_CURRENT_TIME); | |
215 } | |
216 | |
217 static void | |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
218 equalizerwin_auto_pushed(void) |
2313 | 219 { |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
220 cfg.equalizer_autoload = UI_SKINNED_BUTTON(equalizerwin_auto)->inside; |
2313 | 221 } |
222 | |
223 gboolean | |
224 equalizerwin_press(GtkWidget * widget, GdkEventButton * event, | |
225 gpointer callback_data) | |
226 { | |
4554
961906c766e4
introduce ui_skinned_window_button_press and ui_skinned_window_button_release
Tomasz Mon <desowin@gmail.com>
parents:
4546
diff
changeset
|
227 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS |
2313 | 228 && event->y < 14) { |
229 equalizerwin_set_shade(!cfg.equalizer_shaded); | |
230 if (dock_is_moving(GTK_WINDOW(equalizerwin))) | |
231 dock_move_release(GTK_WINDOW(equalizerwin)); | |
4554
961906c766e4
introduce ui_skinned_window_button_press and ui_skinned_window_button_release
Tomasz Mon <desowin@gmail.com>
parents:
4546
diff
changeset
|
232 return TRUE; |
2313 | 233 } |
4554
961906c766e4
introduce ui_skinned_window_button_press and ui_skinned_window_button_release
Tomasz Mon <desowin@gmail.com>
parents:
4546
diff
changeset
|
234 if (event->button == 3) { |
2313 | 235 /* |
236 * Pop up the main menu a few pixels down to avoid | |
237 * anything to be selected initially. | |
238 */ | |
239 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root, | |
240 event->y_root + 2, 3, event->time); | |
4554
961906c766e4
introduce ui_skinned_window_button_press and ui_skinned_window_button_release
Tomasz Mon <desowin@gmail.com>
parents:
4546
diff
changeset
|
241 return TRUE; |
2313 | 242 } |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
243 |
2313 | 244 return FALSE; |
245 } | |
246 | |
247 static gboolean | |
248 equalizerwin_keypress(GtkWidget * widget, | |
249 GdkEventKey * event, | |
250 gpointer data) | |
251 { | |
3350
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3311
diff
changeset
|
252 if (event->keyval == GDK_Tab && event->state & GDK_CONTROL_MASK) { |
4117
a5779105e6d2
on ctrl-tab switch only between visible windows (Bugzilla #14)
Tomasz Mon <desowin@gmail.com>
parents:
4103
diff
changeset
|
253 if (cfg.playlist_visible) |
a5779105e6d2
on ctrl-tab switch only between visible windows (Bugzilla #14)
Tomasz Mon <desowin@gmail.com>
parents:
4103
diff
changeset
|
254 gtk_window_present(GTK_WINDOW(playlistwin)); |
a5779105e6d2
on ctrl-tab switch only between visible windows (Bugzilla #14)
Tomasz Mon <desowin@gmail.com>
parents:
4103
diff
changeset
|
255 else if (cfg.player_visible) |
a5779105e6d2
on ctrl-tab switch only between visible windows (Bugzilla #14)
Tomasz Mon <desowin@gmail.com>
parents:
4103
diff
changeset
|
256 gtk_window_present(GTK_WINDOW(mainwin)); |
3350
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3311
diff
changeset
|
257 return TRUE; |
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3311
diff
changeset
|
258 } |
1292e4ca0f08
press ctrl+tab to switch between windows
Tomasz Mon <desowin@gmail.com>
parents:
3311
diff
changeset
|
259 |
2313 | 260 if (!cfg.equalizer_shaded) { |
261 gtk_widget_event(mainwin, (GdkEvent *) event); | |
262 return TRUE; | |
263 } | |
264 | |
265 switch (event->keyval) { | |
266 case GDK_Left: | |
267 case GDK_KP_Left: | |
268 mainwin_set_balance_diff(-4); | |
269 break; | |
270 case GDK_Right: | |
271 case GDK_KP_Right: | |
272 mainwin_set_balance_diff(4); | |
273 break; | |
274 default: | |
275 gtk_widget_event(mainwin, (GdkEvent *) event); | |
276 break; | |
277 } | |
278 | |
279 return FALSE; | |
280 } | |
281 | |
282 static void | |
283 equalizerwin_close_cb(void) | |
284 { | |
285 equalizerwin_show(FALSE); | |
286 } | |
287 | |
288 static gboolean | |
289 equalizerwin_delete(GtkWidget * widget, | |
290 gpointer data) | |
291 { | |
292 equalizerwin_show(FALSE); | |
293 return TRUE; | |
294 } | |
295 | |
296 static GList * | |
297 equalizerwin_read_presets(const gchar * basename) | |
298 { | |
299 gchar *filename, *name; | |
300 RcFile *rcfile; | |
301 GList *list = NULL; | |
302 gint i, p = 0; | |
303 EqualizerPreset *preset; | |
304 | |
3238
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
305 /* START mod: add check for the default presets locate in system path ({prefix}/share/audacious) |
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
306 by Massimo Cavalleri (submax) */ |
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
307 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
308 filename = g_build_filename(aud_paths[BMP_PATH_USER_DIR], basename, NULL); |
2313 | 309 |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
310 if ((rcfile = aud_rcfile_open(filename)) == NULL) { |
2313 | 311 g_free(filename); |
3238
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
312 // DATA_DIR = "{prefix}/share/audacious" ; example is "/usr/share/audacious" |
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
313 filename = g_build_filename(DATA_DIR, basename, NULL); |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
314 if ((rcfile = aud_rcfile_open(filename)) == NULL) { |
3238
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
315 g_free(filename); |
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
316 return NULL; |
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
317 } |
2313 | 318 } |
319 | |
3238
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
320 // END mod |
ceaaadccfa00
Add a system path for default presets.
William Pitcock <nenolod@atheme-project.org>
parents:
3221
diff
changeset
|
321 |
2313 | 322 g_free(filename); |
323 | |
324 for (;;) { | |
4604
51d82bf6ba63
Use a define (AUD_EQUALIZER_NBANDS) instead of magic value 10 everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
4554
diff
changeset
|
325 gchar section[32]; |
2313 | 326 |
327 g_snprintf(section, sizeof(section), "Preset%d", p++); | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
328 if (aud_rcfile_read_string(rcfile, "Presets", section, &name)) { |
2313 | 329 preset = g_new0(EqualizerPreset, 1); |
330 preset->name = name; | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
331 aud_rcfile_read_float(rcfile, name, "Preamp", &preset->preamp); |
4604
51d82bf6ba63
Use a define (AUD_EQUALIZER_NBANDS) instead of magic value 10 everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
4554
diff
changeset
|
332 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++) { |
51d82bf6ba63
Use a define (AUD_EQUALIZER_NBANDS) instead of magic value 10 everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
4554
diff
changeset
|
333 gchar band[16]; |
2313 | 334 g_snprintf(band, sizeof(band), "Band%d", i); |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
335 aud_rcfile_read_float(rcfile, name, band, &preset->bands[i]); |
2313 | 336 } |
337 list = g_list_prepend(list, preset); | |
338 } | |
339 else | |
340 break; | |
341 } | |
342 list = g_list_reverse(list); | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
343 aud_rcfile_free(rcfile); |
2313 | 344 return list; |
345 } | |
346 | |
347 gint | |
348 equalizerwin_volume_frame_cb(gint pos) | |
349 { | |
350 if (equalizerwin_volume) { | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
351 gint x; |
2313 | 352 if (pos < 32) |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
353 x = 1; |
2313 | 354 else if (pos < 63) |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
355 x = 4; |
2313 | 356 else |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
357 x = 7; |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
358 |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
359 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_volume)->knob_nx = x; |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
360 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_volume)->knob_px = x; |
2313 | 361 } |
362 return 1; | |
363 } | |
364 | |
365 static void | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
366 equalizerwin_volume_motion_cb(GtkWidget *widget, gint pos) |
2313 | 367 { |
368 gint v = (gint) rint(pos * 100 / 94.0); | |
369 mainwin_adjust_volume_motion(v); | |
370 mainwin_set_volume_slider(v); | |
371 } | |
372 | |
373 static void | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
374 equalizerwin_volume_release_cb(GtkWidget *widget, gint pos) |
2313 | 375 { |
376 mainwin_adjust_volume_release(); | |
377 } | |
378 | |
379 static gint | |
380 equalizerwin_balance_frame_cb(gint pos) | |
381 { | |
382 if (equalizerwin_balance) { | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
383 gint x; |
2313 | 384 if (pos < 13) |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
385 x = 11; |
2313 | 386 else if (pos < 26) |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
387 x = 14; |
2313 | 388 else |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
389 x = 17; |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
390 |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
391 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_balance)->knob_nx = x; |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
392 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_balance)->knob_px = x; |
2313 | 393 } |
394 | |
395 return 1; | |
396 } | |
397 | |
398 static void | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
399 equalizerwin_balance_motion_cb(GtkWidget *widget, gint pos) |
2313 | 400 { |
401 gint b; | |
402 pos = MIN(pos, 38); /* The skin uses a even number of pixels | |
403 for the balance-slider *sigh* */ | |
404 b = (gint) rint((pos - 19) * 100 / 19.0); | |
405 mainwin_adjust_balance_motion(b); | |
406 mainwin_set_balance_slider(b); | |
407 } | |
408 | |
409 static void | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
410 equalizerwin_balance_release_cb(GtkWidget *widget, gint pos) |
2313 | 411 { |
412 mainwin_adjust_balance_release(); | |
413 } | |
414 | |
415 void | |
416 equalizerwin_set_balance_slider(gint percent) | |
417 { | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
418 ui_skinned_horizontal_slider_set_position(equalizerwin_balance, |
2313 | 419 (gint) rint((percent * 19 / 100.0) + 19)); |
420 } | |
421 | |
422 void | |
423 equalizerwin_set_volume_slider(gint percent) | |
424 { | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
425 ui_skinned_horizontal_slider_set_position(equalizerwin_volume, |
2313 | 426 (gint) rint(percent * 94 / 100.0)); |
427 } | |
428 | |
429 static void | |
430 equalizerwin_create_widgets(void) | |
431 { | |
432 gint i; | |
433 | |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
434 equalizerwin_on = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
435 ui_skinned_toggle_button_setup(equalizerwin_on, SKINNED_WINDOW(equalizerwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
436 14, 18, 25, 12, 10, 119, 128, 119, 69, 119, 187, 119, SKIN_EQMAIN); |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
437 g_signal_connect(equalizerwin_on, "clicked", equalizerwin_on_pushed, NULL); |
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
438 UI_SKINNED_BUTTON(equalizerwin_on)->inside = cfg.equalizer_active; |
2524 | 439 |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
440 equalizerwin_auto = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
441 ui_skinned_toggle_button_setup(equalizerwin_auto, SKINNED_WINDOW(equalizerwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
442 39, 18, 33, 12, 35, 119, 153, 119, 94, 119, 212, 119, SKIN_EQMAIN); |
2857
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
443 g_signal_connect(equalizerwin_auto, "clicked", equalizerwin_auto_pushed, NULL); |
c35703c9dd9e
fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2853
diff
changeset
|
444 UI_SKINNED_BUTTON(equalizerwin_auto)->inside = cfg.equalizer_autoload; |
2524 | 445 |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
446 equalizerwin_presets = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
447 ui_skinned_push_button_setup(equalizerwin_presets, SKINNED_WINDOW(equalizerwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
448 217, 18, 44, 12, 224, 164, 224, 176, SKIN_EQMAIN); |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
449 g_signal_connect(equalizerwin_presets, "clicked", equalizerwin_presets_pushed, NULL ); |
2524 | 450 |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
451 equalizerwin_close = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
452 ui_skinned_push_button_setup(equalizerwin_close, SKINNED_WINDOW(equalizerwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
453 264, 3, 9, 9, 0, 116, 0, 125, SKIN_EQMAIN); |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
454 g_signal_connect(equalizerwin_close, "clicked", equalizerwin_close_cb, NULL ); |
2313 | 455 |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
456 equalizerwin_shade = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
457 ui_skinned_push_button_setup(equalizerwin_shade, SKINNED_WINDOW(equalizerwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
458 254, 3, 9, 9, 254, 137, 1, 38, SKIN_EQMAIN); |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
459 ui_skinned_button_set_skin_index2(equalizerwin_shade, SKIN_EQ_EX); |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
460 g_signal_connect(equalizerwin_shade, "clicked", equalizerwin_shade_toggle, NULL ); |
2313 | 461 |
3101
b25db04ee2a1
replace EqGraph with UiSkinnedEqualizerGraph
Tomasz Mon <desowin@gmail.com>
parents:
3098
diff
changeset
|
462 equalizerwin_graph = ui_skinned_equalizer_graph_new(SKINNED_WINDOW(equalizerwin)->fixed, 86, 17); |
2524 | 463 |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
464 equalizerwin_preamp = ui_skinned_equalizer_slider_new(SKINNED_WINDOW(equalizerwin)->fixed, 21, 38); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
465 ui_skinned_equalizer_slider_set_position(equalizerwin_preamp, cfg.equalizer_preamp); |
2524 | 466 |
4604
51d82bf6ba63
Use a define (AUD_EQUALIZER_NBANDS) instead of magic value 10 everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents:
4554
diff
changeset
|
467 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++) { |
2313 | 468 equalizerwin_bands[i] = |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
469 ui_skinned_equalizer_slider_new(SKINNED_WINDOW(equalizerwin)->fixed, 78 + (i * 18), 38); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
470 ui_skinned_equalizer_slider_set_position(equalizerwin_bands[i], cfg.equalizer_bands[i]); |
2313 | 471 } |
472 | |
473 equalizerwin_volume = | |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
474 ui_skinned_horizontal_slider_new(SKINNED_WINDOW(equalizerwin)->fixed, |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
475 61, 4, 97, 8, 1, 30, 1, 30, 3, 7, 4, 61, 0, 94, |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
476 equalizerwin_volume_frame_cb, SKIN_EQ_EX); |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
477 g_signal_connect(equalizerwin_volume, "motion", G_CALLBACK(equalizerwin_volume_motion_cb), NULL); |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
478 g_signal_connect(equalizerwin_volume, "release", G_CALLBACK(equalizerwin_volume_release_cb), NULL); |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
479 |
2524 | 480 |
2313 | 481 equalizerwin_balance = |
3049
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
482 ui_skinned_horizontal_slider_new(SKINNED_WINDOW(equalizerwin)->fixed, |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
483 164, 4, 42, 8, 11, 30, 11, 30, 3, 7, 4, 164, 0, 39, |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
484 equalizerwin_balance_frame_cb, SKIN_EQ_EX); |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
485 g_signal_connect(equalizerwin_balance, "motion", G_CALLBACK(equalizerwin_balance_motion_cb), NULL); |
1a1116e50ad6
equalizerwin_volume and equalzerwin_balance are now UiSkinnedHorizontalSliders; hslider.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
486 g_signal_connect(equalizerwin_balance, "release", G_CALLBACK(equalizerwin_balance_release_cb), NULL); |
2313 | 487 } |
488 | |
489 | |
490 static void | |
491 equalizerwin_create_window(void) | |
492 { | |
493 GdkPixbuf *icon; | |
494 gint width, height; | |
495 | |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
496 width = 275; |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
497 height = cfg.equalizer_shaded ? 14 : 116; |
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
498 |
3068
c5189bc4100b
Refactor skinned window code.
William Pitcock <nenolod@atheme-project.org>
parents:
3065
diff
changeset
|
499 equalizerwin = ui_skinned_window_new("equalizer"); |
2313 | 500 gtk_window_set_title(GTK_WINDOW(equalizerwin), _("Audacious Equalizer")); |
501 gtk_window_set_role(GTK_WINDOW(equalizerwin), "equalizer"); | |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
502 gtk_window_set_resizable(GTK_WINDOW(equalizerwin), FALSE); |
2313 | 503 |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
504 if (cfg.scaled && cfg.eq_scaled_linked) { |
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
505 width *= cfg.scale_factor; |
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
506 height *= cfg.scale_factor; |
2313 | 507 } |
508 | |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
509 gtk_widget_set_size_request(equalizerwin, width, height); |
2313 | 510 |
511 /* this will hide only mainwin. it's annoying! yaz */ | |
512 gtk_window_set_transient_for(GTK_WINDOW(equalizerwin), | |
513 GTK_WINDOW(mainwin)); | |
514 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(equalizerwin), TRUE); | |
515 | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
516 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_eq_icon); |
2313 | 517 gtk_window_set_icon(GTK_WINDOW(equalizerwin), icon); |
518 g_object_unref(icon); | |
519 | |
520 gtk_widget_set_app_paintable(equalizerwin, TRUE); | |
521 | |
522 if (cfg.equalizer_x != -1 && cfg.save_window_position) | |
523 gtk_window_move(GTK_WINDOW(equalizerwin), | |
524 cfg.equalizer_x, cfg.equalizer_y); | |
525 | |
526 g_signal_connect(equalizerwin, "delete_event", | |
527 G_CALLBACK(equalizerwin_delete), NULL); | |
528 g_signal_connect(equalizerwin, "button_press_event", | |
529 G_CALLBACK(equalizerwin_press), NULL); | |
530 g_signal_connect(equalizerwin, "key_press_event", | |
531 G_CALLBACK(equalizerwin_keypress), NULL); | |
532 } | |
533 | |
534 void | |
535 equalizerwin_create(void) | |
536 { | |
537 equalizer_presets = equalizerwin_read_presets("eq.preset"); | |
538 equalizer_auto_presets = equalizerwin_read_presets("eq.auto_preset"); | |
539 | |
540 equalizerwin_create_window(); | |
541 | |
542 gtk_window_add_accel_group( GTK_WINDOW(equalizerwin) , ui_manager_get_accel_group() ); | |
543 | |
544 equalizerwin_create_widgets(); | |
545 } | |
546 | |
547 | |
548 void | |
549 equalizerwin_show(gboolean show) | |
550 { | |
551 GtkAction *action = gtk_action_group_get_action( | |
552 toggleaction_group_others , "show equalizer" ); | |
553 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , show ); | |
554 | |
555 if (show) | |
556 equalizerwin_real_show(); | |
557 else | |
558 equalizerwin_real_hide(); | |
559 } | |
560 | |
561 void | |
562 equalizerwin_real_show(void) | |
563 { | |
2596
9903326fddf2
[svn] - reset the position of the equalizer window properly.
nenolod
parents:
2595
diff
changeset
|
564 gtk_window_move(GTK_WINDOW(equalizerwin), cfg.equalizer_x, cfg.equalizer_y); |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4204
diff
changeset
|
565 if (cfg.scaled && cfg.eq_scaled_linked) |
4219
8a848179e244
fixed the eqalizer window
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
566 gtk_widget_set_size_request(equalizerwin, 275 * cfg.scale_factor, |
8a848179e244
fixed the eqalizer window
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
567 ((cfg.equalizer_shaded ? 14 : 116) * cfg.scale_factor)); |
2313 | 568 else |
569 gtk_widget_set_size_request(equalizerwin, 275, | |
570 (cfg.equalizer_shaded ? 14 : 116)); | |
571 cfg.equalizer_visible = TRUE; | |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
572 UI_SKINNED_BUTTON(mainwin_eq)->inside = TRUE; |
3050
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
573 gtk_widget_show_all(equalizerwin); |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
574 |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
575 if (!cfg.equalizer_shaded) { |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
576 gtk_widget_hide(equalizerwin_volume); |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
577 gtk_widget_hide(equalizerwin_balance); |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
578 } |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
579 else { |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
580 ui_skinned_set_push_button_data(equalizerwin_shade, -1, 3, -1, 47); |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
581 ui_skinned_button_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX); |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
582 ui_skinned_set_push_button_data(equalizerwin_close, 11, 38, 11, 47); |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
583 ui_skinned_button_set_skin_index(equalizerwin_close, SKIN_EQ_EX); |
a4288aa638b8
correct showing equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
3049
diff
changeset
|
584 } |
2313 | 585 |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
586 gtk_window_present(GTK_WINDOW(equalizerwin)); |
2313 | 587 } |
588 | |
589 void | |
590 equalizerwin_real_hide(void) | |
591 { | |
592 /* | |
593 * This function should only be called from the | |
594 * main menu signal handler | |
595 */ | |
596 gtk_widget_hide(equalizerwin); | |
597 cfg.equalizer_visible = FALSE; | |
2853
bec320cfcc12
use UiSkinnedButton instead of PButton in equalizerwin
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
598 UI_SKINNED_BUTTON(mainwin_eq)->inside = FALSE; |
2999
e6340ab753a1
replace calling redraw signals with gtk_widget_queue_draw()
Tomasz Mon <desowin@gmail.com>
parents:
2857
diff
changeset
|
599 gtk_widget_queue_draw(mainwin_eq); |
2313 | 600 } |
601 | |
602 static EqualizerPreset * | |
603 equalizerwin_find_preset(GList * list, const gchar * name) | |
604 { | |
605 GList *node = list; | |
606 EqualizerPreset *preset; | |
607 | |
608 while (node) { | |
609 preset = node->data; | |
610 if (!strcasecmp(preset->name, name)) | |
611 return preset; | |
612 node = g_list_next(node); | |
613 } | |
614 return NULL; | |
615 } | |
616 | |
617 static void | |
618 equalizerwin_write_preset_file(GList * list, const gchar * basename) | |
619 { | |
620 gchar *filename, *tmp; | |
621 gint i, p; | |
622 EqualizerPreset *preset; | |
623 RcFile *rcfile; | |
624 GList *node; | |
625 | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
626 rcfile = aud_rcfile_new(); |
2313 | 627 p = 0; |
628 for (node = list; node; node = g_list_next(node)) { | |
629 preset = node->data; | |
630 tmp = g_strdup_printf("Preset%d", p++); | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
631 aud_rcfile_write_string(rcfile, "Presets", tmp, preset->name); |
2313 | 632 g_free(tmp); |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
633 aud_rcfile_write_float(rcfile, preset->name, "Preamp", |
2313 | 634 preset->preamp); |
635 for (i = 0; i < 10; i++) { | |
636 tmp = g_strdup_printf("Band%d\n", i); | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
637 aud_rcfile_write_float(rcfile, preset->name, tmp, |
2313 | 638 preset->bands[i]); |
639 g_free(tmp); | |
640 } | |
641 } | |
642 | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
643 filename = g_build_filename(aud_paths[BMP_PATH_USER_DIR], basename, NULL); |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
644 aud_rcfile_write(rcfile, filename); |
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
645 aud_rcfile_free(rcfile); |
2313 | 646 g_free(filename); |
647 } | |
648 | |
649 static gboolean | |
650 equalizerwin_load_preset(GList * list, const gchar * name) | |
651 { | |
652 EqualizerPreset *preset; | |
653 gint i; | |
654 | |
655 if ((preset = equalizerwin_find_preset(list, name)) != NULL) { | |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
656 ui_skinned_equalizer_slider_set_position(equalizerwin_preamp, preset->preamp); |
2313 | 657 for (i = 0; i < 10; i++) |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
658 ui_skinned_equalizer_slider_set_position(equalizerwin_bands[i], preset->bands[i]); |
2313 | 659 equalizerwin_eq_changed(); |
660 return TRUE; | |
661 } | |
662 return FALSE; | |
663 } | |
664 | |
665 static GList * | |
666 equalizerwin_save_preset(GList * list, const gchar * name, | |
667 const gchar * filename) | |
668 { | |
669 gint i; | |
670 EqualizerPreset *preset; | |
671 | |
672 if (!(preset = equalizerwin_find_preset(list, name))) { | |
673 preset = g_new0(EqualizerPreset, 1); | |
674 preset->name = g_strdup(name); | |
675 list = g_list_append(list, preset); | |
676 } | |
677 | |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
678 preset->preamp = ui_skinned_equalizer_slider_get_position(equalizerwin_preamp); |
2313 | 679 for (i = 0; i < 10; i++) |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
680 preset->bands[i] = ui_skinned_equalizer_slider_get_position(equalizerwin_bands[i]); |
2313 | 681 |
682 equalizerwin_write_preset_file(list, filename); | |
683 | |
684 return list; | |
685 } | |
686 | |
687 static GList * | |
688 equalizerwin_delete_preset(GList * list, gchar * name, gchar * filename) | |
689 { | |
690 EqualizerPreset *preset; | |
691 GList *node; | |
692 | |
693 if (!(preset = equalizerwin_find_preset(list, name))) | |
694 return list; | |
695 | |
696 if (!(node = g_list_find(list, preset))) | |
697 return list; | |
698 | |
699 list = g_list_remove_link(list, node); | |
700 equalizer_preset_free(preset); | |
701 g_list_free_1(node); | |
702 | |
703 equalizerwin_write_preset_file(list, filename); | |
704 | |
705 return list; | |
706 } | |
707 | |
708 static void | |
709 equalizerwin_delete_selected_presets(GtkTreeView *view, gchar *filename) | |
710 { | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
711 gchar *text; |
2313 | 712 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
713 GtkTreeSelection *selection = gtk_tree_view_get_selection(view); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
714 GtkTreeModel *model = gtk_tree_view_get_model(view); |
2313 | 715 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
716 /* |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
717 * first we are making a list of the selected rows, then we convert this |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
718 * list into a list of GtkTreeRowReferences, so that when you delete an |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
719 * item you can still access the other items |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
720 * finally we iterate through all GtkTreeRowReferences, convert them to |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
721 * GtkTreeIters and delete those one after the other |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
722 */ |
2313 | 723 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
724 GList *list = gtk_tree_selection_get_selected_rows(selection, &model); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
725 GList *rrefs = NULL; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
726 GList *litr; |
2313 | 727 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
728 for (litr = list; litr; litr = litr->next) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
729 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
730 GtkTreePath *path = litr->data; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
731 rrefs = g_list_append(rrefs, gtk_tree_row_reference_new(model, path)); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
732 } |
2313 | 733 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
734 for (litr = rrefs; litr; litr = litr->next) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
735 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
736 GtkTreeRowReference *ref = litr->data; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
737 GtkTreePath *path = gtk_tree_row_reference_get_path(ref); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
738 GtkTreeIter iter; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
739 gtk_tree_model_get_iter(model, &iter, path); |
2313 | 740 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
741 gtk_tree_model_get(model, &iter, 0, &text, -1); |
2313 | 742 |
2785 | 743 if (!strcmp(filename, "eq.preset")) |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
744 equalizer_presets = equalizerwin_delete_preset(equalizer_presets, text, filename); |
2785 | 745 else if (!strcmp(filename, "eq.auto_preset")) |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
746 equalizer_auto_presets = equalizerwin_delete_preset(equalizer_auto_presets, text, filename); |
2313 | 747 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
748 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
749 } |
2313 | 750 } |
751 | |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
752 static GList * |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
753 import_winamp_eqf(VFSFile * file) |
2313 | 754 { |
755 gchar header[31]; | |
756 gchar bands[11]; | |
757 gint i = 0; | |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
758 EqualizerPreset *preset = NULL; |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
759 GList *list = NULL; |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
760 GtkWidget *dialog; |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
761 gchar *realfn; |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
762 gchar preset_name[0xb4]; |
2313 | 763 |
764 vfs_fread(header, 1, 31, file); | |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
765 if (strncmp(header, "Winamp EQ library file v1.1", 27)) goto error; |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
766 |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
767 AUDDBG("The EQF header is OK\n"); |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
768 |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
769 if (vfs_fseek(file, 0x1f, SEEK_SET) == -1) goto error; |
2313 | 770 |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
771 while (vfs_fread(preset_name, 1, 0xb4, file) == 0xb4) { |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
772 AUDDBG("The preset name is '%s'\n", preset_name); |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
773 vfs_fseek(file, 0x4d, SEEK_CUR); /* unknown crap --asphyx */ |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
774 if (vfs_fread(bands, 1, 11, file) != 11) break; |
2313 | 775 |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
776 preset = equalizer_preset_new(preset_name); |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
777 /*this was divided by 63, but shouldn't it be 64? --majeru*/ |
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
778 preset->preamp = EQUALIZER_MAX_GAIN - ((bands[10] * EQUALIZER_MAX_GAIN * 2) / 64.0); |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
779 |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
780 for (i = 0; i < 10; i++) |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
781 preset->bands[i] = EQUALIZER_MAX_GAIN - ((bands[i] * EQUALIZER_MAX_GAIN * 2) / 64.0); |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
782 |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
783 list = g_list_prepend(list, preset); |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
784 } |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
785 |
4308 | 786 list = g_list_reverse(list); |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
787 if (list == NULL) goto error; |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
788 |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
789 return list; |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
790 |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
791 error: |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
792 realfn = g_filename_from_uri(file->uri, NULL, NULL); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
793 dialog = gtk_message_dialog_new (GTK_WINDOW(mainwin), |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
794 GTK_DIALOG_DESTROY_WITH_PARENT, |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
795 GTK_MESSAGE_ERROR, |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
796 GTK_BUTTONS_CLOSE, |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
797 _("Error importing Winamp EQF file '%s'"), |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
798 realfn); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
799 gtk_dialog_run (GTK_DIALOG (dialog)); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
800 gtk_widget_destroy (dialog); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
801 g_free(realfn); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
802 return NULL; |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
803 } |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
804 |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
805 static void |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
806 free_cb (gpointer data, gpointer user_data) |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
807 { |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
808 equalizer_preset_free((EqualizerPreset*)data); |
2313 | 809 } |
810 | |
811 static void | |
812 equalizerwin_read_winamp_eqf(VFSFile * file) | |
813 { | |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
814 GList *presets; |
2313 | 815 gint i; |
816 | |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
817 if ((presets = import_winamp_eqf(file)) == NULL) |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
818 return; |
2313 | 819 |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
820 /* just get the first preset --asphyx */ |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
821 EqualizerPreset *preset = (EqualizerPreset*)presets->data; |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
822 ui_skinned_equalizer_slider_set_position(equalizerwin_preamp, |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
823 preset->preamp); |
2313 | 824 |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
825 for (i = 0; i < 10; i++) |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
826 ui_skinned_equalizer_slider_set_position(equalizerwin_bands[i], |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
827 preset->bands[i]); |
2313 | 828 |
4307
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
829 g_list_foreach(presets, free_cb, NULL); |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
830 g_list_free(presets); |
cfaecedace4e
importing of winamp EQ presets library
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4306
diff
changeset
|
831 |
2313 | 832 equalizerwin_eq_changed(); |
833 } | |
834 | |
835 static void | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
836 equalizerwin_read_aud_preset(RcFile * rcfile) |
2313 | 837 { |
838 gfloat val; | |
839 gint i; | |
840 | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
841 if (aud_rcfile_read_float(rcfile, "Equalizer preset", "Preamp", &val)) |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
842 ui_skinned_equalizer_slider_set_position(equalizerwin_preamp, val); |
2313 | 843 for (i = 0; i < 10; i++) { |
844 gchar tmp[7]; | |
845 g_snprintf(tmp, sizeof(tmp), "Band%d", i); | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
846 if (aud_rcfile_read_float(rcfile, "Equalizer preset", tmp, &val)) |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
847 ui_skinned_equalizer_slider_set_position(equalizerwin_bands[i], val); |
2313 | 848 } |
849 equalizerwin_eq_changed(); | |
850 } | |
851 | |
852 static void | |
853 equalizerwin_save_ok(GtkWidget * widget, gpointer data) | |
854 { | |
855 const gchar *text; | |
856 | |
857 text = gtk_entry_get_text(GTK_ENTRY(equalizerwin_save_entry)); | |
858 if (strlen(text) != 0) | |
859 equalizer_presets = | |
860 equalizerwin_save_preset(equalizer_presets, text, "eq.preset"); | |
861 gtk_widget_destroy(equalizerwin_save_window); | |
862 } | |
863 | |
864 static void | |
865 equalizerwin_save_select(GtkTreeView *treeview, GtkTreePath *path, | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
866 GtkTreeViewColumn *col, gpointer data) |
2313 | 867 { |
868 gchar *text; | |
869 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
870 GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
871 GtkTreeModel *model; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
872 GtkTreeIter iter; |
2313 | 873 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
874 if (selection) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
875 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
876 if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
877 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
878 gtk_tree_model_get(model, &iter, 0, &text, -1); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
879 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_entry), text); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
880 equalizerwin_save_ok(NULL, NULL); |
2313 | 881 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
882 g_free(text); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
883 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
884 } |
2313 | 885 } |
886 | |
887 static void | |
888 equalizerwin_load_ok(GtkWidget *widget, gpointer data) | |
889 { | |
890 gchar *text; | |
891 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
892 GtkTreeView* view = GTK_TREE_VIEW(data); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
893 GtkTreeSelection *selection = gtk_tree_view_get_selection(view); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
894 GtkTreeModel *model; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
895 GtkTreeIter iter; |
2313 | 896 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
897 if (selection) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
898 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
899 if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
900 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
901 gtk_tree_model_get(model, &iter, 0, &text, -1); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
902 equalizerwin_load_preset(equalizer_presets, text); |
2313 | 903 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
904 g_free(text); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
905 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
906 } |
2313 | 907 gtk_widget_destroy(equalizerwin_load_window); |
908 } | |
909 | |
910 static void | |
911 equalizerwin_load_select(GtkTreeView *treeview, GtkTreePath *path, | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
912 GtkTreeViewColumn *col, gpointer data) |
2313 | 913 { |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
914 equalizerwin_load_ok(NULL, treeview); |
2313 | 915 } |
916 | |
917 static void | |
918 equalizerwin_delete_delete(GtkWidget *widget, gpointer data) | |
919 { | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
920 equalizerwin_delete_selected_presets(GTK_TREE_VIEW(data), "eq.preset"); |
2313 | 921 } |
922 | |
923 static void | |
924 equalizerwin_save_auto_ok(GtkWidget *widget, gpointer data) | |
925 { | |
926 const gchar *text; | |
927 | |
928 text = gtk_entry_get_text(GTK_ENTRY(equalizerwin_save_auto_entry)); | |
929 if (strlen(text) != 0) | |
930 equalizer_auto_presets = | |
931 equalizerwin_save_preset(equalizer_auto_presets, text, | |
932 "eq.auto_preset"); | |
933 gtk_widget_destroy(equalizerwin_save_auto_window); | |
934 } | |
935 | |
936 static void | |
937 equalizerwin_save_auto_select(GtkTreeView *treeview, GtkTreePath *path, | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
938 GtkTreeViewColumn *col, gpointer data) |
2313 | 939 { |
940 gchar *text; | |
941 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
942 GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
943 GtkTreeModel *model; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
944 GtkTreeIter iter; |
2313 | 945 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
946 if (selection) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
947 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
948 if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
949 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
950 gtk_tree_model_get(model, &iter, 0, &text, -1); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
951 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_auto_entry), text); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
952 equalizerwin_save_auto_ok(NULL, NULL); |
2313 | 953 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
954 g_free(text); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
955 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
956 } |
2313 | 957 } |
958 | |
959 static void | |
960 equalizerwin_load_auto_ok(GtkWidget *widget, gpointer data) | |
961 { | |
962 gchar *text; | |
963 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
964 GtkTreeView *view = GTK_TREE_VIEW(data); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
965 GtkTreeSelection *selection = gtk_tree_view_get_selection(view); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
966 GtkTreeModel *model; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
967 GtkTreeIter iter; |
2313 | 968 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
969 if (selection) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
970 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
971 if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
972 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
973 gtk_tree_model_get(model, &iter, 0, &text, -1); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
974 equalizerwin_load_preset(equalizer_auto_presets, text); |
2313 | 975 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
976 g_free(text); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
977 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
978 } |
2313 | 979 gtk_widget_destroy(equalizerwin_load_auto_window); |
980 } | |
981 | |
982 static void | |
983 equalizerwin_load_auto_select(GtkTreeView *treeview, GtkTreePath *path, | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
984 GtkTreeViewColumn *col, gpointer data) |
2313 | 985 { |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
986 equalizerwin_load_auto_ok(NULL, treeview); |
2313 | 987 } |
988 | |
989 static void | |
990 equalizerwin_delete_auto_delete(GtkWidget *widget, gpointer data) | |
991 { | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
992 equalizerwin_delete_selected_presets(GTK_TREE_VIEW(data), "eq.auto_preset"); |
2313 | 993 } |
994 | |
995 | |
996 static void | |
997 load_preset_file(const gchar *filename) | |
998 { | |
999 RcFile *rcfile; | |
1000 | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1001 if ((rcfile = aud_rcfile_open(filename)) != NULL) { |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
1002 equalizerwin_read_aud_preset(rcfile); |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1003 aud_rcfile_free(rcfile); |
2313 | 1004 } |
1005 } | |
1006 | |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1007 static VFSFile * |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1008 open_vfs_file(const gchar *filename, const gchar *mode) |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1009 { |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1010 VFSFile *file; |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1011 GtkWidget *dialog; |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1012 |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1013 if (!(file = vfs_fopen(filename, mode))) { |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1014 dialog = gtk_message_dialog_new (GTK_WINDOW (mainwin), |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1015 GTK_DIALOG_DESTROY_WITH_PARENT, |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1016 GTK_MESSAGE_ERROR, |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1017 GTK_BUTTONS_CLOSE, |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1018 "Error loading file '%s'", |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1019 filename); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1020 gtk_dialog_run (GTK_DIALOG (dialog)); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1021 gtk_widget_destroy (dialog); |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1022 } |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1023 |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1024 return file; |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1025 } |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1026 |
2313 | 1027 static void |
1028 load_winamp_file(const gchar * filename) | |
1029 { | |
1030 VFSFile *file; | |
1031 | |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1032 if (!(file = open_vfs_file(filename, "rb"))) |
2313 | 1033 return; |
1034 | |
1035 equalizerwin_read_winamp_eqf(file); | |
1036 vfs_fclose(file); | |
1037 } | |
1038 | |
1039 static void | |
1040 import_winamp_file(const gchar * filename) | |
1041 { | |
1042 VFSFile *file; | |
4309 | 1043 GList *list; |
2313 | 1044 |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1045 if (!(file = open_vfs_file(filename, "rb")) || |
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1046 !(list = import_winamp_eqf(file))) |
2313 | 1047 return; |
1048 | |
4309 | 1049 equalizer_presets = g_list_concat(equalizer_presets, list); |
2313 | 1050 equalizerwin_write_preset_file(equalizer_presets, "eq.preset"); |
1051 | |
1052 vfs_fclose(file); | |
1053 } | |
1054 | |
1055 static void | |
1056 save_preset_file(const gchar * filename) | |
1057 { | |
1058 RcFile *rcfile; | |
1059 gint i; | |
1060 | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1061 rcfile = aud_rcfile_new(); |
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1062 aud_rcfile_write_float(rcfile, "Equalizer preset", "Preamp", |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1063 ui_skinned_equalizer_slider_get_position(equalizerwin_preamp)); |
2313 | 1064 |
1065 for (i = 0; i < 10; i++) { | |
1066 gchar tmp[7]; | |
1067 g_snprintf(tmp, sizeof(tmp), "Band%d", i); | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1068 aud_rcfile_write_float(rcfile, "Equalizer preset", tmp, |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1069 ui_skinned_equalizer_slider_get_position(equalizerwin_bands[i])); |
2313 | 1070 } |
1071 | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1072 aud_rcfile_write(rcfile, filename); |
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1073 aud_rcfile_free(rcfile); |
2313 | 1074 } |
1075 | |
1076 static void | |
1077 save_winamp_file(const gchar * filename) | |
1078 { | |
1079 VFSFile *file; | |
1080 | |
1081 gchar name[257]; | |
1082 gint i; | |
1083 guchar bands[11]; | |
1084 | |
4325
309e8f970517
removed report_error() and reimplemented some error routines
mf0102 <0102@gmx.at>
parents:
4309
diff
changeset
|
1085 if (!(file = open_vfs_file(filename, "wb"))) |
2313 | 1086 return; |
1087 | |
1088 vfs_fwrite("Winamp EQ library file v1.1\x1a!--", 1, 31, file); | |
1089 | |
1090 memset(name, 0, 257); | |
4103
7b9d5718a6dc
strncpy() -> g_strlcpy()
Jonathan Schleifer <js-audacious@webkeks.org>
parents:
4102
diff
changeset
|
1091 g_strlcpy(name, "Entry1", 257); |
2313 | 1092 vfs_fwrite(name, 1, 257, file); |
1093 | |
1094 for (i = 0; i < 10; i++) | |
4306
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
1095 bands[i] = 63 - (((ui_skinned_equalizer_slider_get_position(equalizerwin_bands[i]) + EQUALIZER_MAX_GAIN) * 63) / EQUALIZER_MAX_GAIN / 2); |
172d49b1200b
- equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4219
diff
changeset
|
1096 bands[10] = 63 - (((ui_skinned_equalizer_slider_get_position(equalizerwin_preamp) + EQUALIZER_MAX_GAIN) * 63) / EQUALIZER_MAX_GAIN / 2); |
2313 | 1097 vfs_fwrite(bands, 1, 11, file); |
1098 | |
1099 vfs_fclose(file); | |
1100 } | |
1101 | |
1102 static GtkWidget * | |
1103 equalizerwin_create_list_window(GList *preset_list, | |
1104 const gchar *title, | |
1105 GtkWidget **window, | |
1106 GtkSelectionMode sel_mode, | |
1107 GtkWidget **entry, | |
1108 const gchar *action_name, | |
1109 GCallback action_func, | |
1110 GCallback select_row_func) | |
1111 { | |
1112 GtkWidget *vbox, *scrolled_window, *bbox, *view; | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1113 GtkWidget *button_cancel, *button_action; |
2313 | 1114 GList *node; |
1115 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1116 GtkListStore *store; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1117 GtkTreeIter iter; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1118 GtkTreeModel *model; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1119 GtkCellRenderer *renderer; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1120 GtkTreeSelection *selection; |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1121 GtkTreeSortable *sortable; |
2313 | 1122 |
1123 | |
1124 | |
1125 *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1126 gtk_window_set_title(GTK_WINDOW(*window), title); | |
1127 gtk_window_set_type_hint(GTK_WINDOW(*window), GDK_WINDOW_TYPE_HINT_DIALOG); | |
1128 gtk_window_set_default_size(GTK_WINDOW(*window), 350, 300); | |
1129 gtk_window_set_position(GTK_WINDOW(*window), GTK_WIN_POS_CENTER); | |
1130 gtk_container_set_border_width(GTK_CONTAINER(*window), 10); | |
1131 gtk_window_set_transient_for(GTK_WINDOW(*window), | |
1132 GTK_WINDOW(equalizerwin)); | |
1133 g_signal_connect(*window, "destroy", | |
1134 G_CALLBACK(gtk_widget_destroyed), window); | |
1135 | |
1136 vbox = gtk_vbox_new(FALSE, 10); | |
1137 gtk_container_add(GTK_CONTAINER(*window), vbox); | |
1138 | |
1139 scrolled_window = gtk_scrolled_window_new(NULL, NULL); | |
1140 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), | |
1141 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
1142 | |
1143 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1144 /* fill the store with the names of all available presets */ |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1145 store = gtk_list_store_new(1, G_TYPE_STRING); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1146 for (node = preset_list; node; node = g_list_next(node)) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1147 { |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1148 gtk_list_store_append(store, &iter); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1149 gtk_list_store_set(store, &iter, |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1150 0, ((EqualizerPreset*)node->data)->name, |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1151 -1); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1152 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1153 model = GTK_TREE_MODEL(store); |
2313 | 1154 |
1155 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1156 sortable = GTK_TREE_SORTABLE(store); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1157 gtk_tree_sortable_set_sort_column_id(sortable, 0, GTK_SORT_ASCENDING); |
2313 | 1158 |
1159 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1160 view = gtk_tree_view_new(); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1161 renderer = gtk_cell_renderer_text_new(); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1162 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1163 _("Presets"), renderer, |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1164 "text", 0, NULL); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1165 gtk_tree_view_set_model(GTK_TREE_VIEW(view), model); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1166 g_object_unref(model); |
2313 | 1167 |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1168 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1169 gtk_tree_selection_set_mode(selection, sel_mode); |
2313 | 1170 |
1171 | |
1172 | |
1173 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1174 gtk_container_add(GTK_CONTAINER(scrolled_window), view); |
2313 | 1175 gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); |
1176 | |
1177 if (entry) { | |
1178 *entry = gtk_entry_new(); | |
1179 g_signal_connect(*entry, "activate", action_func, NULL); | |
1180 gtk_box_pack_start(GTK_BOX(vbox), *entry, FALSE, FALSE, 0); | |
1181 } | |
1182 | |
1183 bbox = gtk_hbutton_box_new(); | |
1184 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
1185 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
1186 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
1187 | |
1188 button_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
1189 g_signal_connect_swapped(button_cancel, "clicked", | |
1190 G_CALLBACK(gtk_widget_destroy), | |
1191 GTK_OBJECT(*window)); | |
1192 gtk_box_pack_start(GTK_BOX(bbox), button_cancel, TRUE, TRUE, 0); | |
1193 | |
1194 button_action = gtk_button_new_from_stock(action_name); | |
1195 g_signal_connect(button_action, "clicked", G_CALLBACK(action_func), view); | |
1196 GTK_WIDGET_SET_FLAGS(button_action, GTK_CAN_DEFAULT); | |
1197 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1198 if (select_row_func) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1199 g_signal_connect(view, "row-activated", G_CALLBACK(select_row_func), NULL); |
2313 | 1200 |
1201 | |
1202 gtk_box_pack_start(GTK_BOX(bbox), button_action, TRUE, TRUE, 0); | |
1203 | |
1204 gtk_widget_grab_default(button_action); | |
1205 | |
1206 | |
1207 gtk_widget_show_all(*window); | |
1208 | |
1209 return *window; | |
1210 } | |
1211 | |
1212 void | |
1213 equalizerwin_load_auto_preset(const gchar * filename) | |
1214 { | |
1215 gchar *presetfilename, *directory; | |
1216 RcFile *rcfile; | |
1217 | |
1218 g_return_if_fail(filename != NULL); | |
1219 | |
1220 if (!cfg.equalizer_autoload) | |
1221 return; | |
1222 | |
1223 presetfilename = g_strconcat(filename, ".", cfg.eqpreset_extension, NULL); | |
1224 | |
1225 /* First try to find a per file preset file */ | |
1226 if (strlen(cfg.eqpreset_extension) > 0 && | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1227 (rcfile = aud_rcfile_open(presetfilename)) != NULL) { |
2313 | 1228 g_free(presetfilename); |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
1229 equalizerwin_read_aud_preset(rcfile); |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1230 aud_rcfile_free(rcfile); |
2313 | 1231 return; |
1232 } | |
1233 | |
1234 g_free(presetfilename); | |
1235 | |
1236 directory = g_path_get_dirname(filename); | |
1237 presetfilename = g_build_filename(directory, cfg.eqpreset_default_file, | |
1238 NULL); | |
1239 g_free(directory); | |
1240 | |
1241 /* Try to find a per directory preset file */ | |
1242 if (strlen(cfg.eqpreset_default_file) > 0 && | |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1243 (rcfile = aud_rcfile_open(presetfilename)) != NULL) { |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4405
diff
changeset
|
1244 equalizerwin_read_aud_preset(rcfile); |
4405
15c491f342eb
Rename bmp_rcfile* -> aud_rcfile*
Matti Hamalainen <ccr@tnsp.org>
parents:
4325
diff
changeset
|
1245 aud_rcfile_free(rcfile); |
2313 | 1246 } |
1247 else if (!equalizerwin_load_preset | |
1248 (equalizer_auto_presets, g_basename(filename))) { | |
1249 /* Fall back to the oldstyle auto presets */ | |
1250 equalizerwin_load_preset(equalizer_presets, "Default"); | |
1251 } | |
1252 | |
1253 g_free(presetfilename); | |
1254 } | |
1255 | |
1256 void | |
1257 equalizerwin_set_preamp(gfloat preamp) | |
1258 { | |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1259 ui_skinned_equalizer_slider_set_position(equalizerwin_preamp, preamp); |
2313 | 1260 equalizerwin_eq_changed(); |
1261 } | |
1262 | |
1263 void | |
1264 equalizerwin_set_band(gint band, gfloat value) | |
1265 { | |
1266 g_return_if_fail(band >= 0 && band < 10); | |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1267 ui_skinned_equalizer_slider_set_position(equalizerwin_bands[band], value); |
2313 | 1268 } |
1269 | |
1270 gfloat | |
1271 equalizerwin_get_preamp(void) | |
1272 { | |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1273 return ui_skinned_equalizer_slider_get_position(equalizerwin_preamp); |
2313 | 1274 } |
1275 | |
1276 gfloat | |
1277 equalizerwin_get_band(gint band) | |
1278 { | |
3915
86c9abc83fbd
audacious remote functions:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3534
diff
changeset
|
1279 g_return_val_if_fail(band >= 0 && band < 10, 0.0); |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1280 return ui_skinned_equalizer_slider_get_position(equalizerwin_bands[band]); |
2313 | 1281 } |
1282 | |
1283 void | |
1284 action_equ_load_preset(void) | |
1285 { | |
1286 if (equalizerwin_load_window) { | |
1287 gtk_window_present(GTK_WINDOW(equalizerwin_load_window)); | |
1288 return; | |
1289 } | |
1290 | |
1291 equalizerwin_create_list_window(equalizer_presets, | |
1292 Q_("Load preset"), | |
1293 &equalizerwin_load_window, | |
1294 GTK_SELECTION_SINGLE, NULL, | |
1295 GTK_STOCK_OK, | |
1296 G_CALLBACK(equalizerwin_load_ok), | |
1297 G_CALLBACK(equalizerwin_load_select)); | |
1298 } | |
1299 | |
1300 void | |
1301 action_equ_load_auto_preset(void) | |
1302 { | |
1303 if (equalizerwin_load_auto_window) { | |
1304 gtk_window_present(GTK_WINDOW(equalizerwin_load_auto_window)); | |
1305 return; | |
1306 } | |
1307 | |
1308 equalizerwin_create_list_window(equalizer_auto_presets, | |
1309 Q_("Load auto-preset"), | |
1310 &equalizerwin_load_auto_window, | |
1311 GTK_SELECTION_SINGLE, NULL, | |
1312 GTK_STOCK_OK, | |
1313 G_CALLBACK(equalizerwin_load_auto_ok), | |
1314 G_CALLBACK(equalizerwin_load_auto_select)); | |
1315 } | |
1316 | |
1317 void | |
1318 action_equ_load_default_preset(void) | |
1319 { | |
1320 equalizerwin_load_preset(equalizer_presets, "Default"); | |
1321 } | |
1322 | |
1323 void | |
1324 action_equ_zero_preset(void) | |
1325 { | |
1326 gint i; | |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1327 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1328 ui_skinned_equalizer_slider_set_position(equalizerwin_preamp, 0); |
2313 | 1329 for (i = 0; i < 10; i++) |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
3077
diff
changeset
|
1330 ui_skinned_equalizer_slider_set_position(equalizerwin_bands[i], 0); |
2313 | 1331 |
1332 equalizerwin_eq_changed(); | |
1333 } | |
1334 | |
1335 void | |
1336 action_equ_load_preset_file(void) | |
1337 { | |
1338 GtkWidget *dialog; | |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1339 gchar *file_uri; |
2313 | 1340 |
1341 dialog = make_filebrowser(Q_("Load equalizer preset"), FALSE); | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1342 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1343 { |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1344 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1345 load_preset_file(file_uri); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1346 g_free(file_uri); |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1347 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1348 gtk_widget_destroy(dialog); |
2313 | 1349 } |
1350 | |
1351 void | |
1352 action_equ_load_preset_eqf(void) | |
1353 { | |
1354 GtkWidget *dialog; | |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1355 gchar *file_uri; |
2313 | 1356 |
1357 dialog = make_filebrowser(Q_("Load equalizer preset"), FALSE); | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1358 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1359 { |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1360 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1361 load_winamp_file(file_uri); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1362 g_free(file_uri); |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1363 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1364 gtk_widget_destroy(dialog); |
2313 | 1365 } |
1366 | |
1367 void | |
1368 action_equ_import_winamp_presets(void) | |
1369 { | |
1370 GtkWidget *dialog; | |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1371 gchar *file_uri; |
2313 | 1372 |
1373 dialog = make_filebrowser(Q_("Load equalizer preset"), FALSE); | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1374 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1375 { |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1376 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1377 import_winamp_file(file_uri); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1378 g_free(file_uri); |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1379 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1380 gtk_widget_destroy(dialog); |
2313 | 1381 } |
1382 | |
1383 void | |
1384 action_equ_save_preset(void) | |
1385 { | |
1386 if (equalizerwin_save_window) { | |
1387 gtk_window_present(GTK_WINDOW(equalizerwin_save_window)); | |
1388 return; | |
1389 } | |
1390 | |
1391 equalizerwin_create_list_window(equalizer_presets, | |
1392 Q_("Save preset"), | |
1393 &equalizerwin_save_window, | |
1394 GTK_SELECTION_SINGLE, | |
1395 &equalizerwin_save_entry, | |
1396 GTK_STOCK_OK, | |
1397 G_CALLBACK(equalizerwin_save_ok), | |
1398 G_CALLBACK(equalizerwin_save_select)); | |
1399 } | |
1400 | |
1401 void | |
1402 action_equ_save_auto_preset(void) | |
1403 { | |
1404 gchar *name; | |
1405 Playlist *playlist = playlist_get_active(); | |
1406 | |
1407 if (equalizerwin_save_auto_window) | |
1408 gtk_window_present(GTK_WINDOW(equalizerwin_save_auto_window)); | |
1409 else | |
1410 equalizerwin_create_list_window(equalizer_auto_presets, | |
1411 Q_("Save auto-preset"), | |
1412 &equalizerwin_save_auto_window, | |
1413 GTK_SELECTION_SINGLE, | |
1414 &equalizerwin_save_auto_entry, | |
1415 GTK_STOCK_OK, | |
1416 G_CALLBACK(equalizerwin_save_auto_ok), | |
1417 G_CALLBACK(equalizerwin_save_auto_select)); | |
1418 | |
1419 name = playlist_get_filename(playlist, playlist_get_position(playlist)); | |
1420 if (name) { | |
1421 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_auto_entry), | |
1422 g_basename(name)); | |
1423 g_free(name); | |
1424 } | |
1425 } | |
1426 | |
1427 void | |
1428 action_equ_save_default_preset(void) | |
1429 { | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1430 equalizer_presets = |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1431 equalizerwin_save_preset(equalizer_presets, Q_("Default"), "eq.preset"); |
2313 | 1432 } |
1433 | |
1434 void | |
1435 action_equ_save_preset_file(void) | |
1436 { | |
1437 GtkWidget *dialog; | |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1438 gchar *file_uri; |
2313 | 1439 gchar *songname; |
1440 Playlist *playlist = playlist_get_active(); | |
1441 | |
1442 dialog = make_filebrowser(Q_("Save equalizer preset"), TRUE); | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1443 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1444 { |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1445 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1446 save_preset_file(file_uri); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1447 g_free(file_uri); |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1448 } |
2313 | 1449 |
1450 songname = playlist_get_filename(playlist, playlist_get_position(playlist)); | |
1451 if (songname) { | |
1452 gchar *eqname = g_strdup_printf("%s.%s", songname, | |
1453 cfg.eqpreset_extension); | |
1454 g_free(songname); | |
1455 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), | |
1456 eqname); | |
1457 g_free(eqname); | |
1458 } | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1459 |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1460 gtk_widget_destroy(dialog); |
2313 | 1461 } |
1462 | |
1463 void | |
1464 action_equ_save_preset_eqf(void) | |
1465 { | |
1466 GtkWidget *dialog; | |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1467 gchar *file_uri; |
2313 | 1468 |
1469 dialog = make_filebrowser(Q_("Save equalizer preset"), TRUE); | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1470 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1471 { |
4203
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1472 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1473 save_winamp_file(file_uri); |
d9db67e2fef6
fixed WinAMP EQF file handling, did some more URI-fications
Cristi Magherusan <majeru@atheme.org>
parents:
4198
diff
changeset
|
1474 g_free(file_uri); |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1475 } |
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2497
diff
changeset
|
1476 gtk_widget_destroy(dialog); |
2313 | 1477 } |
1478 | |
1479 void | |
1480 action_equ_delete_preset(void) | |
1481 { | |
1482 if (equalizerwin_delete_window) { | |
1483 gtk_window_present(GTK_WINDOW(equalizerwin_delete_window)); | |
1484 return; | |
1485 } | |
1486 | |
1487 equalizerwin_create_list_window(equalizer_presets, | |
1488 Q_("Delete preset"), | |
1489 &equalizerwin_delete_window, | |
1490 GTK_SELECTION_EXTENDED, NULL, | |
1491 GTK_STOCK_DELETE, | |
1492 G_CALLBACK(equalizerwin_delete_delete), | |
1493 NULL); | |
1494 } | |
1495 | |
1496 void | |
1497 action_equ_delete_auto_preset(void) | |
1498 { | |
1499 if (equalizerwin_delete_auto_window) { | |
1500 gtk_window_present(GTK_WINDOW(equalizerwin_delete_auto_window)); | |
1501 return; | |
1502 } | |
1503 | |
1504 equalizerwin_create_list_window(equalizer_auto_presets, | |
1505 Q_("Delete auto-preset"), | |
1506 &equalizerwin_delete_auto_window, | |
1507 GTK_SELECTION_EXTENDED, NULL, | |
1508 GTK_STOCK_DELETE, | |
1509 G_CALLBACK(equalizerwin_delete_auto_delete), | |
1510 NULL); | |
1511 } | |
3917 | 1512 |
1513 void | |
1514 equalizer_activate(gboolean active) | |
1515 { | |
1516 cfg.equalizer_active = active; | |
1517 UI_SKINNED_BUTTON(equalizerwin_on)->inside = active; | |
1518 gtk_widget_queue_draw(equalizerwin_on); | |
1519 | |
1520 equalizerwin_eq_changed(); | |
1521 } |