annotate src/skins/ui_equalizer.c @ 3017:963796db51ea

Don't use deprecated gtk macros and types
author Tomasz Mon <desowin@gmail.com>
date Thu, 09 Apr 2009 14:23:42 +0200
parents 3134a0987162
children 8b97f9560dc3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Copyright (C) 2005-2007 Audacious development team.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 * Based on BMP:
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Based on XMMS:
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; under version 3 of the License.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * GNU General Public License for more details.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses>.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 * The Audacious team does not consider modular code linking to
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * Audacious or using our public API to be a derived work.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26 /*#define AUD_DEBUG*/
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #ifdef HAVE_CONFIG_H
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 # include "config.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30 #endif
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 #include "ui_equalizer.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 #include <glib.h>
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 #include <glib/gi18n.h>
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 #include <gtk/gtk.h>
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 #include <stdio.h>
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 #include <math.h>
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 #include <string.h>
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 #include "platform/smartinclude.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 #include "ui_skin.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 #include "ui_manager.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 #include "actions-equalizer.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 #include "util.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 #include "ui_main.h"
2678
Tomasz Mon <desowin@gmail.com>
parents: 2677
diff changeset
47 #include "ui_playlist.h"
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2792
diff changeset
48 #include <audlegacy/plugin.h>
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2792
diff changeset
49 #include <audlegacy/equalizer_preset.h>
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 #include "images/audacious_eq.xpm"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 #include "ui_dock.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 #include "ui_skinned_window.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 #include "ui_skinned_button.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 #include "ui_skinned_horizontal_slider.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 #include "ui_skinned_equalizer_slider.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 #include "ui_skinned_equalizer_graph.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 #include "skins_cfg.h"
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 enum PresetViewCols {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 PRESET_VIEW_COL_NAME,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 PRESET_VIEW_N_COLS
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 };
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 GtkWidget *equalizerwin;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 GtkWidget *equalizerwin_graph;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 static GtkWidget *equalizerwin_load_window = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 static GtkWidget *equalizerwin_load_auto_window = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 static GtkWidget *equalizerwin_save_window = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 static GtkWidget *equalizerwin_save_entry = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 static GtkWidget *equalizerwin_save_auto_window = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 static GtkWidget *equalizerwin_save_auto_entry = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 static GtkWidget *equalizerwin_delete_window = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 static GtkWidget *equalizerwin_delete_auto_window = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 static GtkWidget *equalizerwin_on, *equalizerwin_auto;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
80 static GtkWidget *equalizerwin_close, *equalizerwin_shade;
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
81 static GtkWidget *equalizerwin_shaded_close, *equalizerwin_shaded_shade;
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
82 static GtkWidget *equalizerwin_presets;
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 static GtkWidget *equalizerwin_preamp,*equalizerwin_bands[10];
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 static GtkWidget *equalizerwin_volume, *equalizerwin_balance;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 static GList *equalizer_presets = NULL, *equalizer_auto_presets = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 EqualizerPreset *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 equalizer_preset_new(const gchar * name)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 EqualizerPreset *preset = g_new0(EqualizerPreset, 1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 preset->name = g_strdup(name);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 return preset;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97 equalizer_preset_free(EqualizerPreset * preset)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99 if (!preset)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 g_free(preset->name);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 g_free(preset);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107 equalizerwin_set_scaled(gboolean ds)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109 gint height;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 if (config.equalizer_shaded)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 height = 14;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 else
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 height = 116;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 if (config.scaled) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 dock_window_resize(GTK_WINDOW(equalizerwin), 275 * config.scale_factor,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 height * config.scale_factor, 275 * config.scale_factor, height * config.scale_factor);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 } else {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 dock_window_resize(GTK_WINDOW(equalizerwin), 275, height, 275, height);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 GList *iter;
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
124 for (iter = GTK_FIXED (SKINNED_WINDOW(equalizerwin)->normal)->children; iter; iter = g_list_next (iter)) {
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 GtkFixedChild *child_data = (GtkFixedChild *) iter->data;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 GtkWidget *child = child_data->widget;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 g_signal_emit_by_name(child, "toggle-scaled");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + config.equalizer_shaded), 0, 0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 equalizerwin_set_shade_menu_cb(gboolean shaded)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 config.equalizer_shaded = shaded;
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
136 ui_skinned_window_set_shade(equalizerwin, shaded);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 if (shaded) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 dock_shade(get_dock_window_list(), GTK_WINDOW(equalizerwin),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 14 * EQUALIZER_SCALE_FACTOR);
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
141 } else {
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 dock_shade(get_dock_window_list(), GTK_WINDOW(equalizerwin),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143 116 * EQUALIZER_SCALE_FACTOR);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 gtk_widget_shape_combine_mask(equalizerwin, skin_get_mask(aud_active_skin, SKIN_MASK_EQ + config.equalizer_shaded), 0, 0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 equalizerwin_set_shade(gboolean shaded)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 GtkAction *action = gtk_action_group_get_action(
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 toggleaction_group_others , "roll up equalizer" );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 equalizerwin_shade_toggle(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 equalizerwin_set_shade(!config.equalizer_shaded);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 equalizerwin_eq_changed(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 gint i;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
168 aud_cfg->equalizer_preamp = equalizerwin_get_preamp();
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
169 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
170 aud_cfg->equalizer_bands[i] = equalizerwin_get_band(i);
2641
ba91ea50f214 use equalzier changed hook
Tomasz Mon <desowin@gmail.com>
parents: 2606
diff changeset
171
ba91ea50f214 use equalzier changed hook
Tomasz Mon <desowin@gmail.com>
parents: 2606
diff changeset
172 aud_hook_call("equalizer changed", NULL);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 gtk_widget_queue_draw(equalizerwin_graph);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 static void
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
177 equalizerwin_apply_preset(EqualizerPreset *preset)
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
178 {
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
179 if (preset == NULL)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
180 return;
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
181
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
182 gint i;
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
183
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
184 equalizerwin_set_preamp(preset->preamp);
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
185 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
186 equalizerwin_set_band(i, preset->bands[i]);
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
187 }
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
188
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
189 static void
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 equalizerwin_on_pushed(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 {
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
192 equalizerwin_activate(!aud_cfg->equalizer_active);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196 equalizerwin_presets_pushed(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 GdkModifierType modmask;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 gint x, y;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201 gdk_window_get_pointer(NULL, &x, &y, &modmask);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 ui_manager_popup_menu_show(GTK_MENU(equalizerwin_presets_menu), x, y, 1, GDK_CURRENT_TIME);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 equalizerwin_auto_pushed(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 aud_cfg->equalizer_autoload = UI_SKINNED_BUTTON(equalizerwin_auto)->inside;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 gboolean
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212 equalizerwin_press(GtkWidget * widget, GdkEventButton * event,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 gpointer callback_data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 && event->y < 14) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 equalizerwin_set_shade(!config.equalizer_shaded);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218 if (dock_is_moving(GTK_WINDOW(equalizerwin)))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 dock_move_release(GTK_WINDOW(equalizerwin));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 return TRUE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 if (event->button == 3) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 /*
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224 * Pop up the main menu a few pixels down to avoid
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 * anything to be selected initially.
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 event->y_root + 2, 3, event->time);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 return TRUE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 return FALSE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 static gboolean
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 equalizerwin_keypress(GtkWidget * widget,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 GdkEventKey * event,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 if (event->keyval == GDK_Tab && event->state & GDK_CONTROL_MASK) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 if (config.playlist_visible)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 gtk_window_present(GTK_WINDOW(playlistwin));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 else if (config.player_visible)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 gtk_window_present(GTK_WINDOW(mainwin));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 return TRUE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 if (!config.equalizer_shaded) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 gtk_widget_event(mainwin, (GdkEvent *) event);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 return TRUE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 switch (event->keyval) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 case GDK_Left:
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 case GDK_KP_Left:
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 mainwin_set_balance_diff(-4);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 break;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 case GDK_Right:
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 case GDK_KP_Right:
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 mainwin_set_balance_diff(4);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 break;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 default:
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262 gtk_widget_event(mainwin, (GdkEvent *) event);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 break;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 return FALSE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270 equalizerwin_close_cb(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 equalizerwin_show(FALSE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 static gboolean
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 equalizerwin_delete(GtkWidget * widget,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 equalizerwin_show(FALSE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 return TRUE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283 gint
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 equalizerwin_volume_frame_cb(gint pos)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286 if (equalizerwin_volume) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 gint x;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288 if (pos < 32)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289 x = 1;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 else if (pos < 63)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291 x = 4;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292 else
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293 x = 7;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_volume)->knob_nx = x;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_volume)->knob_px = x;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 return 1;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302 equalizerwin_volume_motion_cb(GtkWidget *widget, gint pos)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 gint v = (gint) rint(pos * 100 / 94.0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 mainwin_adjust_volume_motion(v);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 mainwin_set_volume_slider(v);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 equalizerwin_volume_release_cb(GtkWidget *widget, gint pos)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 mainwin_adjust_volume_release();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 static gint
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316 equalizerwin_balance_frame_cb(gint pos)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 if (equalizerwin_balance) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319 gint x;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320 if (pos < 13)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 x = 11;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 else if (pos < 26)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 x = 14;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324 else
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325 x = 17;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_balance)->knob_nx = x;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328 UI_SKINNED_HORIZONTAL_SLIDER(equalizerwin_balance)->knob_px = x;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 return 1;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335 equalizerwin_balance_motion_cb(GtkWidget *widget, gint pos)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 gint b;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338 pos = MIN(pos, 38); /* The skin uses a even number of pixels
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339 for the balance-slider *sigh* */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340 b = (gint) rint((pos - 19) * 100 / 19.0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341 mainwin_adjust_balance_motion(b);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
342 mainwin_set_balance_slider(b);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
343 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
344
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
346 equalizerwin_balance_release_cb(GtkWidget *widget, gint pos)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
347 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
348 mainwin_adjust_balance_release();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
350
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
351 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
352 equalizerwin_set_balance_slider(gint percent)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
354 ui_skinned_horizontal_slider_set_position(equalizerwin_balance,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
355 (gint) rint((percent * 19 / 100.0) + 19));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
356 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359 equalizerwin_set_volume_slider(gint percent)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 ui_skinned_horizontal_slider_set_position(equalizerwin_volume,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362 (gint) rint(percent * 94 / 100.0));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366 equalizerwin_create_widgets(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
368 gint i;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
369
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
370 equalizerwin_on = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
371 ui_skinned_toggle_button_setup(equalizerwin_on, SKINNED_WINDOW(equalizerwin)->normal,
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
372 14, 18, 25, 12, 10, 119, 128, 119, 69, 119, 187, 119, SKIN_EQMAIN);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
373 g_signal_connect(equalizerwin_on, "clicked", equalizerwin_on_pushed, NULL);
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
374 equalizerwin_activate(aud_cfg->equalizer_active);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
375
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376 equalizerwin_auto = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
377 ui_skinned_toggle_button_setup(equalizerwin_auto, SKINNED_WINDOW(equalizerwin)->normal,
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378 39, 18, 33, 12, 35, 119, 153, 119, 94, 119, 212, 119, SKIN_EQMAIN);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379 g_signal_connect(equalizerwin_auto, "clicked", equalizerwin_auto_pushed, NULL);
2668
a1431a900f28 introduce ui_skinned_button_set_inside
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
380 ui_skinned_button_set_inside(equalizerwin_auto, aud_cfg->equalizer_autoload);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 equalizerwin_presets = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
383 ui_skinned_push_button_setup(equalizerwin_presets, SKINNED_WINDOW(equalizerwin)->normal,
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384 217, 18, 44, 12, 224, 164, 224, 176, SKIN_EQMAIN);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385 g_signal_connect(equalizerwin_presets, "clicked", equalizerwin_presets_pushed, NULL );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387 equalizerwin_close = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
388 ui_skinned_push_button_setup(equalizerwin_close, SKINNED_WINDOW(equalizerwin)->normal,
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389 264, 3, 9, 9, 0, 116, 0, 125, SKIN_EQMAIN);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390 g_signal_connect(equalizerwin_close, "clicked", equalizerwin_close_cb, NULL );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392 equalizerwin_shade = ui_skinned_button_new();
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
393 ui_skinned_push_button_setup(equalizerwin_shade, SKINNED_WINDOW(equalizerwin)->normal,
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
394 254, 3, 9, 9, 254, 137, 1, 38, SKIN_EQMAIN);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
395 ui_skinned_button_set_skin_index2(equalizerwin_shade, SKIN_EQ_EX);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
396 g_signal_connect(equalizerwin_shade, "clicked", equalizerwin_shade_toggle, NULL );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
397
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
398 equalizerwin_shaded_close = ui_skinned_button_new();
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
399 ui_skinned_push_button_setup(equalizerwin_shaded_close, SKINNED_WINDOW(equalizerwin)->shaded,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
400 264, 3, 9, 9, 11, 38, 11, 47, SKIN_EQ_EX);
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
401 g_signal_connect(equalizerwin_shaded_close, "clicked", equalizerwin_close_cb, NULL );
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
402
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
403 equalizerwin_shaded_shade = ui_skinned_button_new();
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
404 ui_skinned_push_button_setup(equalizerwin_shaded_shade, SKINNED_WINDOW(equalizerwin)->shaded,
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
405 254, 3, 9, 9, 254, 3, 1, 47, SKIN_EQ_EX);
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
406 g_signal_connect(equalizerwin_shaded_shade, "clicked", equalizerwin_shade_toggle, NULL );
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
407
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
408 equalizerwin_graph = ui_skinned_equalizer_graph_new(SKINNED_WINDOW(equalizerwin)->normal, 86, 17);
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
409
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
410 equalizerwin_preamp = ui_skinned_equalizer_slider_new(SKINNED_WINDOW(equalizerwin)->normal, 21, 38);
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
411 equalizerwin_set_preamp(aud_cfg->equalizer_preamp);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
412
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
413 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++) {
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
414 equalizerwin_bands[i] =
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
415 ui_skinned_equalizer_slider_new(SKINNED_WINDOW(equalizerwin)->normal, 78 + (i * 18), 38);
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
416 equalizerwin_set_band(i, aud_cfg->equalizer_bands[i]);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
417 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
418
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
419 equalizerwin_volume =
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
420 ui_skinned_horizontal_slider_new(SKINNED_WINDOW(equalizerwin)->shaded,
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
421 61, 4, 97, 8, 1, 30, 1, 30, 3, 7, 4, 61, 0, 94,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
422 equalizerwin_volume_frame_cb, SKIN_EQ_EX);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
423 g_signal_connect(equalizerwin_volume, "motion", G_CALLBACK(equalizerwin_volume_motion_cb), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
424 g_signal_connect(equalizerwin_volume, "release", G_CALLBACK(equalizerwin_volume_release_cb), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
425
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
426
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
427 equalizerwin_balance =
2719
51fc44b99b58 use two GtkFixed in SkinnedWindow - normal and shaded
Tomasz Mon <desowin@gmail.com>
parents: 2678
diff changeset
428 ui_skinned_horizontal_slider_new(SKINNED_WINDOW(equalizerwin)->shaded,
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
429 164, 4, 42, 8, 11, 30, 11, 30, 3, 7, 4, 164, 0, 39,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
430 equalizerwin_balance_frame_cb, SKIN_EQ_EX);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
431 g_signal_connect(equalizerwin_balance, "motion", G_CALLBACK(equalizerwin_balance_motion_cb), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
432 g_signal_connect(equalizerwin_balance, "release", G_CALLBACK(equalizerwin_balance_release_cb), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
433 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
434
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
435
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
436 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
437 equalizerwin_create_window(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
438 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
439 GdkPixbuf *icon;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
440 gint width, height;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
441
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
442 width = 275;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
443 height = config.equalizer_shaded ? 14 : 116;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
444
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
445 equalizerwin = ui_skinned_window_new("equalizer");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
446 gtk_window_set_title(GTK_WINDOW(equalizerwin), _("Audacious Equalizer"));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
447 gtk_window_set_role(GTK_WINDOW(equalizerwin), "equalizer");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
448 gtk_window_set_resizable(GTK_WINDOW(equalizerwin), FALSE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
449
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
450 if (config.scaled && config.eq_scaled_linked) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
451 width *= config.scale_factor;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
452 height *= config.scale_factor;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
453 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
454
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
455 gtk_widget_set_size_request(equalizerwin, width, height);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
456
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
457 /* this will hide only mainwin. it's annoying! yaz */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
458 gtk_window_set_transient_for(GTK_WINDOW(equalizerwin),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
459 GTK_WINDOW(mainwin));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
460 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(equalizerwin), TRUE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
461
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
462 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_eq_icon);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
463 gtk_window_set_icon(GTK_WINDOW(equalizerwin), icon);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
464 g_object_unref(icon);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
465
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
466 gtk_widget_set_app_paintable(equalizerwin, TRUE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
467
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
468 if (config.equalizer_x != -1 && config.save_window_position)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
469 gtk_window_move(GTK_WINDOW(equalizerwin),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
470 config.equalizer_x, config.equalizer_y);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
471
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
472 g_signal_connect(equalizerwin, "delete_event",
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
473 G_CALLBACK(equalizerwin_delete), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
474 g_signal_connect(equalizerwin, "button_press_event",
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
475 G_CALLBACK(equalizerwin_press), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
476 g_signal_connect(equalizerwin, "key_press_event",
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
477 G_CALLBACK(equalizerwin_keypress), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
478 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
479
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
480 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
481 equalizerwin_create(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
482 {
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
483 equalizer_presets = aud_equalizer_read_presets("eq.preset");
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
484 equalizer_auto_presets = aud_equalizer_read_presets("eq.auto_preset");
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
485
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
486 equalizerwin_create_window();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
487
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
488 gtk_window_add_accel_group( GTK_WINDOW(equalizerwin) , ui_manager_get_accel_group() );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
489
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
490 equalizerwin_create_widgets();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
491 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
492
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
493
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
494 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
495 equalizerwin_show(gboolean show)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
496 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
497 GtkAction *action = gtk_action_group_get_action(
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
498 toggleaction_group_others , "show equalizer" );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
499 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , show );
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
500
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
501 if (show)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
502 equalizerwin_real_show();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
503 else
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
504 equalizerwin_real_hide();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
505 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
506
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
507 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
508 equalizerwin_real_show(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
509 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
510 gtk_window_move(GTK_WINDOW(equalizerwin), config.equalizer_x, config.equalizer_y);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
511 if (config.scaled && config.eq_scaled_linked)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
512 gtk_widget_set_size_request(equalizerwin, 275 * config.scale_factor,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
513 ((config.equalizer_shaded ? 14 : 116) * config.scale_factor));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
514 else
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
515 gtk_widget_set_size_request(equalizerwin, 275,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
516 (config.equalizer_shaded ? 14 : 116));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
517 config.equalizer_visible = TRUE;
2668
a1431a900f28 introduce ui_skinned_button_set_inside
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
518 ui_skinned_button_set_inside(mainwin_eq, TRUE);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
519 gtk_widget_show_all(equalizerwin);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
520
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
521 gtk_window_present(GTK_WINDOW(equalizerwin));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
522 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
523
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
524 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
525 equalizerwin_real_hide(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
526 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
527 /*
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
528 * This function should only be called from the
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
529 * main menu signal handler
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
530 */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
531 gtk_widget_hide(equalizerwin);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
532 config.equalizer_visible = FALSE;
2668
a1431a900f28 introduce ui_skinned_button_set_inside
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
533 ui_skinned_button_set_inside(mainwin_eq, FALSE);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
534 gtk_widget_queue_draw(mainwin_eq);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
535 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
536
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
537 static EqualizerPreset *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
538 equalizerwin_find_preset(GList * list, const gchar * name)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
539 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
540 GList *node = list;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
541 EqualizerPreset *preset;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
542
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
543 while (node) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
544 preset = node->data;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
545 if (!strcasecmp(preset->name, name))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
546 return preset;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
547 node = g_list_next(node);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
548 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
549 return NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
550 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
551
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
552 static gboolean
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
553 equalizerwin_load_preset(GList * list, const gchar * name)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
554 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
555 EqualizerPreset *preset;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
556 gint i;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
557
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
558 if ((preset = equalizerwin_find_preset(list, name)) != NULL) {
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
559 equalizerwin_set_preamp(preset->preamp);
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
560 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
561 equalizerwin_set_band(i, preset->bands[i]);
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
562
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
563 return TRUE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
564 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
565 return FALSE;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
566 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
567
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
568 static GList *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
569 equalizerwin_save_preset(GList * list, const gchar * name,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
570 const gchar * filename)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
571 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
572 gint i;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
573 EqualizerPreset *preset;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
574
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
575 if (!(preset = equalizerwin_find_preset(list, name))) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
576 preset = g_new0(EqualizerPreset, 1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
577 preset->name = g_strdup(name);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
578 list = g_list_append(list, preset);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
579 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
580
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
581 preset->preamp = equalizerwin_get_preamp();
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
582 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
583 preset->bands[i] = equalizerwin_get_band(i);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
584
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
585 aud_equalizer_write_preset_file(list, filename);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
586
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
587 return list;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
588 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
589
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
590 static GList *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
591 equalizerwin_delete_preset(GList * list, gchar * name, gchar * filename)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
592 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
593 EqualizerPreset *preset;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
594 GList *node;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
595
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
596 if (!(preset = equalizerwin_find_preset(list, name)))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
597 return list;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
598
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
599 if (!(node = g_list_find(list, preset)))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
600 return list;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
601
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
602 list = g_list_remove_link(list, node);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
603 equalizer_preset_free(preset);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
604 g_list_free_1(node);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
605
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
606 aud_equalizer_write_preset_file(list, filename);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
607
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
608 return list;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
609 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
610
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
611 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
612 equalizerwin_delete_selected_presets(GtkTreeView *view, gchar *filename)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
613 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
614 gchar *text;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
615
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
616 GtkTreeSelection *selection = gtk_tree_view_get_selection(view);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
617 GtkTreeModel *model = gtk_tree_view_get_model(view);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
618
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
619 /*
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
620 * first we are making a list of the selected rows, then we convert this
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
621 * list into a list of GtkTreeRowReferences, so that when you delete an
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
622 * item you can still access the other items
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
623 * finally we iterate through all GtkTreeRowReferences, convert them to
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
624 * GtkTreeIters and delete those one after the other
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
625 */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
626
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
627 GList *list = gtk_tree_selection_get_selected_rows(selection, &model);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
628 GList *rrefs = NULL;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
629 GList *litr;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
630
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
631 for (litr = list; litr; litr = litr->next)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
632 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
633 GtkTreePath *path = litr->data;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
634 rrefs = g_list_append(rrefs, gtk_tree_row_reference_new(model, path));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
635 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
636
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
637 for (litr = rrefs; litr; litr = litr->next)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
638 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
639 GtkTreeRowReference *ref = litr->data;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
640 GtkTreePath *path = gtk_tree_row_reference_get_path(ref);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
641 GtkTreeIter iter;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
642 gtk_tree_model_get_iter(model, &iter, path);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
643
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
644 gtk_tree_model_get(model, &iter, 0, &text, -1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
645
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
646 if (!strcmp(filename, "eq.preset"))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
647 equalizer_presets = equalizerwin_delete_preset(equalizer_presets, text, filename);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
648 else if (!strcmp(filename, "eq.auto_preset"))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
649 equalizer_auto_presets = equalizerwin_delete_preset(equalizer_auto_presets, text, filename);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
650
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
651 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
652 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
653 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
654
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
655 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
656 free_cb (gpointer data, gpointer user_data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
657 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
658 equalizer_preset_free((EqualizerPreset*)data);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
659 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
660
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
661 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
662 equalizerwin_read_winamp_eqf(VFSFile * file)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
663 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
664 GList *presets;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
665 gint i;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
666
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
667 if ((presets = aud_import_winamp_eqf(file)) == NULL)
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
668 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
669
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
670 /* just get the first preset --asphyx */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
671 EqualizerPreset *preset = (EqualizerPreset*)presets->data;
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
672 equalizerwin_set_preamp(preset->preamp);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
673
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
674 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
675 equalizerwin_set_band(i, preset->bands[i]);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
676
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
677 g_list_foreach(presets, free_cb, NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
678 g_list_free(presets);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
679
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
680 equalizerwin_eq_changed();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
681 }
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
682
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
683 static void
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
684 equalizerwin_read_aud_preset(const gchar * file)
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
685 {
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
686 EqualizerPreset *preset = aud_equalizer_read_aud_preset(file);
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
687 if (preset) {
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
688 equalizerwin_apply_preset(preset);
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
689 equalizer_preset_free(preset);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
690 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
691 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
692
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
693 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
694 equalizerwin_save_ok(GtkWidget * widget, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
695 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
696 const gchar *text;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
697
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
698 text = gtk_entry_get_text(GTK_ENTRY(equalizerwin_save_entry));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
699 if (strlen(text) != 0)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
700 equalizer_presets =
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
701 equalizerwin_save_preset(equalizer_presets, text, "eq.preset");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
702 gtk_widget_destroy(equalizerwin_save_window);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
703 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
704
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
705 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
706 equalizerwin_save_select(GtkTreeView *treeview, GtkTreePath *path,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
707 GtkTreeViewColumn *col, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
708 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
709 gchar *text;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
710
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
711 GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
712 GtkTreeModel *model;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
713 GtkTreeIter iter;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
714
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
715 if (selection)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
716 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
717 if (gtk_tree_selection_get_selected(selection, &model, &iter))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
718 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
719 gtk_tree_model_get(model, &iter, 0, &text, -1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
720 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_entry), text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
721 equalizerwin_save_ok(NULL, NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
722
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
723 g_free(text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
724 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
725 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
726 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
727
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
728 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
729 equalizerwin_load_ok(GtkWidget *widget, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
730 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
731 gchar *text;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
732
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
733 GtkTreeView* view = GTK_TREE_VIEW(data);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
734 GtkTreeSelection *selection = gtk_tree_view_get_selection(view);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
735 GtkTreeModel *model;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
736 GtkTreeIter iter;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
737
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
738 if (selection)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
739 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
740 if (gtk_tree_selection_get_selected(selection, &model, &iter))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
741 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
742 gtk_tree_model_get(model, &iter, 0, &text, -1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
743 equalizerwin_load_preset(equalizer_presets, text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
744
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
745 g_free(text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
746 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
747 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
748 gtk_widget_destroy(equalizerwin_load_window);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
749 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
750
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
751 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
752 equalizerwin_load_select(GtkTreeView *treeview, GtkTreePath *path,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
753 GtkTreeViewColumn *col, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
754 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
755 equalizerwin_load_ok(NULL, treeview);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
756 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
757
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
758 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
759 equalizerwin_delete_delete(GtkWidget *widget, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
760 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
761 equalizerwin_delete_selected_presets(GTK_TREE_VIEW(data), "eq.preset");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
762 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
763
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
764 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
765 equalizerwin_save_auto_ok(GtkWidget *widget, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
766 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
767 const gchar *text;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
768
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
769 text = gtk_entry_get_text(GTK_ENTRY(equalizerwin_save_auto_entry));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
770 if (strlen(text) != 0)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
771 equalizer_auto_presets =
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
772 equalizerwin_save_preset(equalizer_auto_presets, text,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
773 "eq.auto_preset");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
774 gtk_widget_destroy(equalizerwin_save_auto_window);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
775 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
776
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
777 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
778 equalizerwin_save_auto_select(GtkTreeView *treeview, GtkTreePath *path,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
779 GtkTreeViewColumn *col, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
780 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
781 gchar *text;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
782
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
783 GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
784 GtkTreeModel *model;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
785 GtkTreeIter iter;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
786
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
787 if (selection)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
788 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
789 if (gtk_tree_selection_get_selected(selection, &model, &iter))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
790 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
791 gtk_tree_model_get(model, &iter, 0, &text, -1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
792 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_auto_entry), text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
793 equalizerwin_save_auto_ok(NULL, NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
794
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
795 g_free(text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
796 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
797 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
798 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
799
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
800 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
801 equalizerwin_load_auto_ok(GtkWidget *widget, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
802 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
803 gchar *text;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
804
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
805 GtkTreeView *view = GTK_TREE_VIEW(data);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
806 GtkTreeSelection *selection = gtk_tree_view_get_selection(view);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
807 GtkTreeModel *model;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
808 GtkTreeIter iter;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
809
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
810 if (selection)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
811 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
812 if (gtk_tree_selection_get_selected(selection, &model, &iter))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
813 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
814 gtk_tree_model_get(model, &iter, 0, &text, -1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
815 equalizerwin_load_preset(equalizer_auto_presets, text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
816
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
817 g_free(text);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
818 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
819 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
820 gtk_widget_destroy(equalizerwin_load_auto_window);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
821 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
822
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
823 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
824 equalizerwin_load_auto_select(GtkTreeView *treeview, GtkTreePath *path,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
825 GtkTreeViewColumn *col, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
826 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
827 equalizerwin_load_auto_ok(NULL, treeview);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
828 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
829
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
830 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
831 equalizerwin_delete_auto_delete(GtkWidget *widget, gpointer data)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
832 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
833 equalizerwin_delete_selected_presets(GTK_TREE_VIEW(data), "eq.auto_preset");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
834 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
835
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
836 static VFSFile *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
837 open_vfs_file(const gchar *filename, const gchar *mode)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
838 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
839 VFSFile *file;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
840 GtkWidget *dialog;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
841
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
842 if (!(file = aud_vfs_fopen(filename, mode))) {
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
843 dialog = gtk_message_dialog_new (GTK_WINDOW (mainwin),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
844 GTK_DIALOG_DESTROY_WITH_PARENT,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
845 GTK_MESSAGE_ERROR,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
846 GTK_BUTTONS_CLOSE,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
847 "Error loading file '%s'",
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
848 filename);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
849 gtk_dialog_run (GTK_DIALOG (dialog));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
850 gtk_widget_destroy (dialog);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
851 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
852
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
853 return file;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
854 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
855
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
856 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
857 load_winamp_file(const gchar * filename)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
858 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
859 VFSFile *file;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
860
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
861 if (!(file = open_vfs_file(filename, "rb")))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
862 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
863
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
864 equalizerwin_read_winamp_eqf(file);
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
865 aud_vfs_fclose(file);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
866 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
867
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
868 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
869 import_winamp_file(const gchar * filename)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
870 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
871 VFSFile *file;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
872 GList *list;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
873
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
874 if (!(file = open_vfs_file(filename, "rb")) ||
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
875 !(list = aud_import_winamp_eqf(file)))
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
876 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
877
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
878 equalizer_presets = g_list_concat(equalizer_presets, list);
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
879 aud_equalizer_write_preset_file(equalizer_presets, "eq.preset");
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
880
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
881 aud_vfs_fclose(file);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
882 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
883
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
884 static void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
885 save_winamp_file(const gchar * filename)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
886 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
887 VFSFile *file;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
888
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
889 gchar name[257];
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
890 gint i;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
891 guchar bands[11];
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
892
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
893 if (!(file = open_vfs_file(filename, "wb")))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
894 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
895
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
896 aud_vfs_fwrite("Winamp EQ library file v1.1\x1a!--", 1, 31, file);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
897
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
898 memset(name, 0, 257);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
899 g_strlcpy(name, "Entry1", 257);
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
900 aud_vfs_fwrite(name, 1, 257, file);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
901
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
902 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
903 bands[i] = 63 - (((equalizerwin_get_band(i) + EQUALIZER_MAX_GAIN) * 63) / EQUALIZER_MAX_GAIN / 2);
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
904
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
905 bands[AUD_EQUALIZER_NBANDS] = 63 - (((equalizerwin_get_preamp() + EQUALIZER_MAX_GAIN) * 63) / EQUALIZER_MAX_GAIN / 2);
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
906
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
907 aud_vfs_fwrite(bands, 1, 11, file);
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
908 aud_vfs_fclose(file);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
909 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
910
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
911 static GtkWidget *
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
912 equalizerwin_create_list_window(GList *preset_list,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
913 const gchar *title,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
914 GtkWidget **window,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
915 GtkSelectionMode sel_mode,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
916 GtkWidget **entry,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
917 const gchar *action_name,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
918 GCallback action_func,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
919 GCallback select_row_func)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
920 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
921 GtkWidget *vbox, *scrolled_window, *bbox, *view;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
922 GtkWidget *button_cancel, *button_action;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
923 GList *node;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
924
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
925 GtkListStore *store;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
926 GtkTreeIter iter;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
927 GtkTreeModel *model;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
928 GtkCellRenderer *renderer;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
929 GtkTreeSelection *selection;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
930 GtkTreeSortable *sortable;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
931
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
932
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
933
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
934 *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
935 gtk_window_set_title(GTK_WINDOW(*window), title);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
936 gtk_window_set_type_hint(GTK_WINDOW(*window), GDK_WINDOW_TYPE_HINT_DIALOG);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
937 gtk_window_set_default_size(GTK_WINDOW(*window), 350, 300);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
938 gtk_window_set_position(GTK_WINDOW(*window), GTK_WIN_POS_CENTER);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
939 gtk_container_set_border_width(GTK_CONTAINER(*window), 10);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
940 gtk_window_set_transient_for(GTK_WINDOW(*window),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
941 GTK_WINDOW(equalizerwin));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
942 g_signal_connect(*window, "destroy",
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
943 G_CALLBACK(gtk_widget_destroyed), window);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
944
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
945 vbox = gtk_vbox_new(FALSE, 10);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
946 gtk_container_add(GTK_CONTAINER(*window), vbox);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
947
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
948 scrolled_window = gtk_scrolled_window_new(NULL, NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
949 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
950 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
951
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
952
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
953 /* fill the store with the names of all available presets */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
954 store = gtk_list_store_new(1, G_TYPE_STRING);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
955 for (node = preset_list; node; node = g_list_next(node))
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
956 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
957 gtk_list_store_append(store, &iter);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
958 gtk_list_store_set(store, &iter,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
959 0, ((EqualizerPreset*)node->data)->name,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
960 -1);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
961 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
962 model = GTK_TREE_MODEL(store);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
963
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
964
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
965 sortable = GTK_TREE_SORTABLE(store);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
966 gtk_tree_sortable_set_sort_column_id(sortable, 0, GTK_SORT_ASCENDING);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
967
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
968
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
969 view = gtk_tree_view_new();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
970 renderer = gtk_cell_renderer_text_new();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
971 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
972 _("Presets"), renderer,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
973 "text", 0, NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
974 gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
975 g_object_unref(model);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
976
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
977 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
978 gtk_tree_selection_set_mode(selection, sel_mode);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
979
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
980
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
981
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
982
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
983 gtk_container_add(GTK_CONTAINER(scrolled_window), view);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
984 gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
985
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
986 if (entry) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
987 *entry = gtk_entry_new();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
988 g_signal_connect(*entry, "activate", action_func, NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
989 gtk_box_pack_start(GTK_BOX(vbox), *entry, FALSE, FALSE, 0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
990 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
991
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
992 bbox = gtk_hbutton_box_new();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
993 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2971
diff changeset
994 gtk_box_set_spacing(GTK_BOX(bbox), 5);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
995 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
996
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
997 button_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
998 g_signal_connect_swapped(button_cancel, "clicked",
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
999 G_CALLBACK(gtk_widget_destroy),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1000 GTK_OBJECT(*window));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1001 gtk_box_pack_start(GTK_BOX(bbox), button_cancel, TRUE, TRUE, 0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1002
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1003 button_action = gtk_button_new_from_stock(action_name);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1004 g_signal_connect(button_action, "clicked", G_CALLBACK(action_func), view);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1005 GTK_WIDGET_SET_FLAGS(button_action, GTK_CAN_DEFAULT);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1006
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1007 if (select_row_func)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1008 g_signal_connect(view, "row-activated", G_CALLBACK(select_row_func), NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1009
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1010
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1011 gtk_box_pack_start(GTK_BOX(bbox), button_action, TRUE, TRUE, 0);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1012
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1013 gtk_widget_grab_default(button_action);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1014
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1015
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1016 gtk_widget_show_all(*window);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1017
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1018 return *window;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1019 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1020
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1021 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1022 equalizerwin_load_auto_preset(const gchar * filename)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1023 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1024 gchar *presetfilename, *directory;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1025
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1026 g_return_if_fail(filename != NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1027
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1028 if (!aud_cfg->equalizer_autoload)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1029 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1030
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1031 presetfilename = g_strconcat(filename, ".", aud_cfg->eqpreset_extension, NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1032
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1033 /* First try to find a per file preset file */
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1034 if (strlen(aud_cfg->eqpreset_extension) > 0) {
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1035 equalizerwin_read_aud_preset(presetfilename);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1036 g_free(presetfilename);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1037 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1038 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1039
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1040 g_free(presetfilename);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1041
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1042 directory = g_path_get_dirname(filename);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1043 presetfilename = g_build_filename(directory, aud_cfg->eqpreset_default_file,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1044 NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1045 g_free(directory);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1046
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1047 /* Try to find a per directory preset file */
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1048 if (strlen(aud_cfg->eqpreset_default_file) > 0) {
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1049 equalizerwin_read_aud_preset(presetfilename);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1050 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1051 else if (!equalizerwin_load_preset
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1052 (equalizer_auto_presets, g_basename(filename))) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1053 /* Fall back to the oldstyle auto presets */
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1054 equalizerwin_load_preset(equalizer_presets, "Default");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1055 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1056
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1057 g_free(presetfilename);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1058 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1059
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1060 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1061 equalizerwin_set_preamp(gfloat preamp)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1062 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1063 ui_skinned_equalizer_slider_set_position(equalizerwin_preamp, preamp);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1064 equalizerwin_eq_changed();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1065 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1066
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1067 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1068 equalizerwin_set_band(gint band, gfloat value)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1069 {
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1070 g_return_if_fail(band >= 0 && band < AUD_EQUALIZER_NBANDS);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1071 ui_skinned_equalizer_slider_set_position(equalizerwin_bands[band], value);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1072 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1073
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1074 gfloat
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1075 equalizerwin_get_preamp(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1076 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1077 return ui_skinned_equalizer_slider_get_position(equalizerwin_preamp);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1078 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1079
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1080 gfloat
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1081 equalizerwin_get_band(gint band)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1082 {
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1083 g_return_val_if_fail(band >= 0 && band < AUD_EQUALIZER_NBANDS, 0.0);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1084 return ui_skinned_equalizer_slider_get_position(equalizerwin_bands[band]);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1085 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1086
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1087 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1088 action_equ_load_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1089 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1090 if (equalizerwin_load_window) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1091 gtk_window_present(GTK_WINDOW(equalizerwin_load_window));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1092 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1093 }
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1094
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1095 equalizerwin_create_list_window(equalizer_presets,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1096 Q_("Load preset"),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1097 &equalizerwin_load_window,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1098 GTK_SELECTION_SINGLE, NULL,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1099 GTK_STOCK_OK,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1100 G_CALLBACK(equalizerwin_load_ok),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1101 G_CALLBACK(equalizerwin_load_select));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1102 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1103
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1104 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1105 action_equ_load_auto_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1106 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1107 if (equalizerwin_load_auto_window) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1108 gtk_window_present(GTK_WINDOW(equalizerwin_load_auto_window));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1109 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1110 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1111
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1112 equalizerwin_create_list_window(equalizer_auto_presets,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1113 Q_("Load auto-preset"),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1114 &equalizerwin_load_auto_window,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1115 GTK_SELECTION_SINGLE, NULL,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1116 GTK_STOCK_OK,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1117 G_CALLBACK(equalizerwin_load_auto_ok),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1118 G_CALLBACK(equalizerwin_load_auto_select));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1119 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1120
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1121 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1122 action_equ_load_default_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1123 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1124 equalizerwin_load_preset(equalizer_presets, "Default");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1125 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1126
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1127 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1128 action_equ_zero_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1129 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1130 gint i;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1131
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1132 equalizerwin_set_preamp(0);
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1133 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1134 equalizerwin_set_band(i, 0);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1135 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1136
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1137 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1138 action_equ_load_preset_file(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1139 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1140 GtkWidget *dialog;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1141 gchar *file_uri;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1142
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1143 dialog = make_filebrowser(Q_("Load equalizer preset"), FALSE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1144 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1145 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1146 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1147 EqualizerPreset *preset = aud_load_preset_file(file_uri);
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1148 equalizerwin_apply_preset(preset);
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1149 equalizer_preset_free(preset);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1150 g_free(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1151 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1152 gtk_widget_destroy(dialog);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1153 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1154
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1155 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1156 action_equ_load_preset_eqf(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1157 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1158 GtkWidget *dialog;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1159 gchar *file_uri;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1160
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1161 dialog = make_filebrowser(Q_("Load equalizer preset"), FALSE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1162 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1163 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1164 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1165 load_winamp_file(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1166 g_free(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1167 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1168 gtk_widget_destroy(dialog);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1169 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1170
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1171 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1172 action_equ_import_winamp_presets(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1173 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1174 GtkWidget *dialog;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1175 gchar *file_uri;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1176
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1177 dialog = make_filebrowser(Q_("Load equalizer preset"), FALSE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1178 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1179 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1180 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1181 import_winamp_file(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1182 g_free(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1183 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1184 gtk_widget_destroy(dialog);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1185 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1186
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1187 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1188 action_equ_save_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1189 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1190 if (equalizerwin_save_window) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1191 gtk_window_present(GTK_WINDOW(equalizerwin_save_window));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1192 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1193 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1194
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1195 equalizerwin_create_list_window(equalizer_presets,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1196 Q_("Save preset"),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1197 &equalizerwin_save_window,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1198 GTK_SELECTION_SINGLE,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1199 &equalizerwin_save_entry,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1200 GTK_STOCK_OK,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1201 G_CALLBACK(equalizerwin_save_ok),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1202 G_CALLBACK(equalizerwin_save_select));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1203 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1204
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1205 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1206 action_equ_save_auto_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1207 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1208 gchar *name;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1209 Playlist *playlist = aud_playlist_get_active();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1210
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1211 if (equalizerwin_save_auto_window)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1212 gtk_window_present(GTK_WINDOW(equalizerwin_save_auto_window));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1213 else
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1214 equalizerwin_create_list_window(equalizer_auto_presets,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1215 Q_("Save auto-preset"),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1216 &equalizerwin_save_auto_window,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1217 GTK_SELECTION_SINGLE,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1218 &equalizerwin_save_auto_entry,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1219 GTK_STOCK_OK,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1220 G_CALLBACK(equalizerwin_save_auto_ok),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1221 G_CALLBACK(equalizerwin_save_auto_select));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1222
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1223 name = aud_playlist_get_filename(playlist, aud_playlist_get_position(playlist));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1224 if (name) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1225 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_auto_entry),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1226 g_basename(name));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1227 g_free(name);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1228 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1229 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1230
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1231 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1232 action_equ_save_default_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1233 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1234 equalizer_presets =
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1235 equalizerwin_save_preset(equalizer_presets, Q_("Default"), "eq.preset");
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1236 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1237
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1238 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1239 action_equ_save_preset_file(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1240 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1241 GtkWidget *dialog;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1242 gchar *file_uri;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1243 gchar *songname;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1244 Playlist *playlist = aud_playlist_get_active();
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1245 gint i;
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1246
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1247 dialog = make_filebrowser(Q_("Save equalizer preset"), TRUE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1248 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1249 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1250 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1251 EqualizerPreset *preset = g_new0(EqualizerPreset, 1);
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1252 preset->name = g_strdup(file_uri);
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1253 preset->preamp = equalizerwin_get_preamp();
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1254 for (i = 0; i < AUD_EQUALIZER_NBANDS; i++)
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1255 preset->bands[i] = equalizerwin_get_band(i);
2786
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1256 aud_save_preset_file(preset, file_uri);
b7d8e6fd4644 make use of exported equalzier preset functions
Tomasz Mon <desowin@gmail.com>
parents: 2719
diff changeset
1257 equalizer_preset_free(preset);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1258 g_free(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1259 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1260
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1261 songname = aud_playlist_get_filename(playlist, aud_playlist_get_position(playlist));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1262 if (songname) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1263 gchar *eqname = g_strdup_printf("%s.%s", songname,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1264 aud_cfg->eqpreset_extension);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1265 g_free(songname);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1266 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1267 eqname);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1268 g_free(eqname);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1269 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1270
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1271 gtk_widget_destroy(dialog);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1272 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1273
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1274 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1275 action_equ_save_preset_eqf(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1276 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1277 GtkWidget *dialog;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1278 gchar *file_uri;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1279
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1280 dialog = make_filebrowser(Q_("Save equalizer preset"), TRUE);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1281 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1282 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1283 file_uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1284 save_winamp_file(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1285 g_free(file_uri);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1286 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1287 gtk_widget_destroy(dialog);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1288 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1289
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1290 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1291 action_equ_delete_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1292 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1293 if (equalizerwin_delete_window) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1294 gtk_window_present(GTK_WINDOW(equalizerwin_delete_window));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1295 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1296 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1297
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1298 equalizerwin_create_list_window(equalizer_presets,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1299 Q_("Delete preset"),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1300 &equalizerwin_delete_window,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1301 GTK_SELECTION_EXTENDED, NULL,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1302 GTK_STOCK_DELETE,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1303 G_CALLBACK(equalizerwin_delete_delete),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1304 NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1305 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1306
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1307 void
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1308 action_equ_delete_auto_preset(void)
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1309 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1310 if (equalizerwin_delete_auto_window) {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1311 gtk_window_present(GTK_WINDOW(equalizerwin_delete_auto_window));
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1312 return;
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1313 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1314
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1315 equalizerwin_create_list_window(equalizer_auto_presets,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1316 Q_("Delete auto-preset"),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1317 &equalizerwin_delete_auto_window,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1318 GTK_SELECTION_EXTENDED, NULL,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1319 GTK_STOCK_DELETE,
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1320 G_CALLBACK(equalizerwin_delete_auto_delete),
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1321 NULL);
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1322 }
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1323
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1324 void
2792
04c38b7a6079 sync ui_equalizer changes with skins plugin
mf0102 <0102@gmx.at>
parents: 2786
diff changeset
1325 equalizerwin_activate(gboolean active)
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1326 {
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1327 aud_cfg->equalizer_active = active;
2668
a1431a900f28 introduce ui_skinned_button_set_inside
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
1328 ui_skinned_button_set_inside(equalizerwin_on, active);
2606
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1329 equalizerwin_eq_changed();
b53841a1b5d3 add ui_equalizer
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1330 }