annotate audacious/equalizer.c @ 2124:83c9caf0c554 trunk

[svn] - add some basic code for the manipulation of temporary playlists
author nenolod
date Fri, 15 Dec 2006 07:38:23 -0800
parents f18a5b617c34
children e0e50e151bab
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
2 * Copyright (C) 2005-2006 Audacious development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
3 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
4 * BMP - Cross-platform multimedia player
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
6 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
7 * Based on XMMS:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
9 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
2105
f18a5b617c34 [svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents: 2094
diff changeset
12 * the Free Software Foundation; under version 2 of the License.
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
13 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
17 * GNU General Public License for more details.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
18 *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
22 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
23
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
25 # include "config.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
26 #endif
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
27
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
28 #include "equalizer.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
29
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
30 #include <glib.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
31 #include <glib/gi18n.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
32 #include <gtk/gtk.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
33 #include <stdio.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
34 #include <math.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
35 #include <string.h>
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
36
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
37 #include "platform/smartinclude.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
38 #include "widgets/widgetcore.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
39 #include "dock.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
40 #include "hints.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
41 #include "input.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
42 #include "main.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
43 #include "playlist.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
44 #include "ui_playlist.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
45 #include "util.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
46 #include "output.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
47
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
48 #include "libaudacious/rcfile.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
49 #include "libaudacious/vfs.h"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
50
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
51 #include "images/audacious_eq.xpm"
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
52
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
53 enum PresetViewCols {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
54 PRESET_VIEW_COL_NAME,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
55 PRESET_VIEW_N_COLS
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
56 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
57
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
58 enum {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
59 EQUALIZER_PRESETS_LOAD_PRESET,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
60 EQUALIZER_PRESETS_LOAD_AUTOPRESET,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
61 EQUALIZER_PRESETS_LOAD_DEFAULT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
62 EQUALIZER_PRESETS_LOAD_ZERO,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
63 EQUALIZER_PRESETS_LOAD_FROM_FILE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
64 EQUALIZER_PRESETS_LOAD_FROM_WINAMPFILE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
65 EQUALIZER_PRESETS_IMPORT_WINAMPFILE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
66 EQUALIZER_PRESETS_SAVE_PRESET,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
67 EQUALIZER_PRESETS_SAVE_AUTOPRESET,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
68 EQUALIZER_PRESETS_SAVE_DEFAULT,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
69 EQUALIZER_PRESETS_SAVE_TO_FILE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
70 EQUALIZER_PRESETS_SAVE_TO_WINAMPFILE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
71 EQUALIZER_PRESETS_DELETE_PRESET,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
72 EQUALIZER_PRESETS_DELETE_AUTOPRESET
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
73 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
74
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
75
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
76 struct _EqualizerPreset {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
77 gchar *name;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
78 gfloat preamp, bands[10];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
79 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
80
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
81 typedef struct _EqualizerPreset EqualizerPreset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
82
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
83
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
84 GtkWidget *equalizerwin;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
85
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
86 static GtkWidget *equalizerwin_load_window = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
87 static GtkWidget *equalizerwin_load_auto_window = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
88 static GtkWidget *equalizerwin_save_window = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
89 static GtkWidget *equalizerwin_save_entry;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
90 static GtkWidget *equalizerwin_save_auto_window = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
91 static GtkWidget *equalizerwin_save_auto_entry;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
92 static GtkWidget *equalizerwin_delete_window = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
93 static GtkWidget *equalizerwin_delete_auto_window = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
94
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
95 static GdkPixmap *equalizerwin_bg, *equalizerwin_bg_x2;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
96 static GdkGC *equalizerwin_gc;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
97
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
98 static GList *equalizerwin_wlist = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
99
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
100 static GtkAccelGroup *equalizerwin_accel;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
101
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
102 static TButton *equalizerwin_on, *equalizerwin_auto;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
103
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
104 static PButton *equalizerwin_presets, *equalizerwin_shade;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
105 PButton *equalizerwin_close;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
106 static EqGraph *equalizerwin_graph;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
107 static EqSlider *equalizerwin_preamp, *equalizerwin_bands[10];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
108 static HSlider *equalizerwin_volume, *equalizerwin_balance;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
109
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
110 static GtkItemFactory *equalizerwin_presets_menu;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
111
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
112 static GList *equalizer_presets = NULL, *equalizer_auto_presets = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
113
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
114
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
115 static void equalizerwin_presets_menu_cb(gpointer cb_data, guint action,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
116 GtkWidget * w);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
117
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
118 static GtkItemFactoryEntry equalizerwin_presets_menu_entries[] = {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
119 {N_("/Load"), NULL, NULL, 0, "<Branch>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
120 {N_("/Load/Preset"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
121 EQUALIZER_PRESETS_LOAD_PRESET, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
122 {N_("/Load/Auto-load preset"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
123 EQUALIZER_PRESETS_LOAD_AUTOPRESET, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
124 {N_("/Load/Default"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
125 EQUALIZER_PRESETS_LOAD_DEFAULT, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
126 {"/Load/-", NULL, NULL, 0, "<Separator>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
127 {N_("/Load/Zero"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
128 EQUALIZER_PRESETS_LOAD_ZERO, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
129 {"/Load/-", NULL, NULL, 0, "<Separator>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
130 {N_("/Load/From file"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
131 EQUALIZER_PRESETS_LOAD_FROM_FILE, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
132 {N_("/Load/From WinAMP EQF file"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
133 EQUALIZER_PRESETS_LOAD_FROM_WINAMPFILE, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
134 {N_("/Import"), NULL, NULL, 0, "<Branch>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
135 {N_("/Import/WinAMP Presets"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
136 EQUALIZER_PRESETS_IMPORT_WINAMPFILE, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
137 {N_("/Save"), NULL, NULL, 0, "<Branch>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
138 {N_("/Save/Preset"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
139 EQUALIZER_PRESETS_SAVE_PRESET, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
140 {N_("/Save/Auto-load preset"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
141 EQUALIZER_PRESETS_SAVE_AUTOPRESET, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
142 {N_("/Save/Default"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
143 EQUALIZER_PRESETS_SAVE_DEFAULT, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
144 {"/Save/-", NULL, NULL, 0, "<Separator>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
145 {N_("/Save/To file"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
146 EQUALIZER_PRESETS_SAVE_TO_FILE, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
147 {N_("/Save/To WinAMP EQF file"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
148 EQUALIZER_PRESETS_SAVE_TO_WINAMPFILE, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
149 {N_("/Delete"), NULL, NULL, 0, "<Branch>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
150 {N_("/Delete/Preset"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
151 EQUALIZER_PRESETS_DELETE_PRESET, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
152 {N_("/Delete/Auto-load preset"), NULL, equalizerwin_presets_menu_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
153 EQUALIZER_PRESETS_DELETE_AUTOPRESET, "<Item>", NULL},
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
154 };
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
155
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
156 static gint equalizerwin_presets_menu_entries_num =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
157 G_N_ELEMENTS(equalizerwin_presets_menu_entries);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
158
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
159
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
160 EqualizerPreset *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
161 equalizer_preset_new(const gchar * name)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
162 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
163 EqualizerPreset *preset = g_new0(EqualizerPreset, 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
164 preset->name = g_strdup(name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
165 return preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
166 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
167
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
168 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
169 equalizer_preset_free(EqualizerPreset * preset)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
170 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
171 if (!preset)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
172 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
173
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
174 g_free(preset->name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
175 g_free(preset);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
176 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
177
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
178
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
179 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
180 equalizerwin_set_shape_mask(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
181 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
182 if (cfg.show_wm_decorations)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
183 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
184
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
185 if (cfg.doublesize == FALSE)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
186 gtk_widget_shape_combine_mask(equalizerwin,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
187 skin_get_mask(bmp_active_skin,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
188 SKIN_MASK_EQ), 0, 0);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
189 else
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
190 gtk_widget_shape_combine_mask(equalizerwin, NULL, 0, 0);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
191 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
192
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
193 void
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
194 equalizerwin_set_doublesize(gboolean ds)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
195 {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
196 gint height;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
197
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
198 if (cfg.equalizer_shaded)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
199 height = 14;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
200 else
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
201 height = 116;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
202
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
203 equalizerwin_set_shape_mask();
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
204
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
205 if (ds) {
1940
e929aec8c8ea [svn] - improve doublesize
nenolod
parents: 1938
diff changeset
206 dock_window_resize(GTK_WINDOW(equalizerwin), 550, height * 2, 550, height * 2);
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
207 gdk_window_set_back_pixmap(equalizerwin->window, equalizerwin_bg_x2,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
208 0);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
209 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
210 else {
1940
e929aec8c8ea [svn] - improve doublesize
nenolod
parents: 1938
diff changeset
211 dock_window_resize(GTK_WINDOW(equalizerwin), 275, height, 275, height);
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
212 gdk_window_set_back_pixmap(equalizerwin->window, equalizerwin_bg, 0);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
213 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
214
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
215 draw_equalizer_window(TRUE);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
216 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
217
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
218 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
219 equalizerwin_set_shade_menu_cb(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
220 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
221 cfg.equalizer_shaded = shaded;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
222
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
223 equalizerwin_set_shape_mask();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
224
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
225 if (shaded) {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
226 dock_shade(dock_window_list, GTK_WINDOW(equalizerwin),
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
227 14 * (EQUALIZER_DOUBLESIZE + 1));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
228 pbutton_set_button_data(equalizerwin_shade, -1, 3, -1, 47);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
229 pbutton_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
230 pbutton_set_button_data(equalizerwin_close, 11, 38, 11, 47);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
231 pbutton_set_skin_index(equalizerwin_close, SKIN_EQ_EX);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
232 widget_show(WIDGET(equalizerwin_volume));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
233 widget_show(WIDGET(equalizerwin_balance));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
234 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
235 else {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
236 dock_shade(dock_window_list, GTK_WINDOW(equalizerwin),
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
237 116 * (EQUALIZER_DOUBLESIZE + 1));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
238 pbutton_set_button_data(equalizerwin_shade, -1, 137, -1, 38);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
239 pbutton_set_skin_index1(equalizerwin_shade, SKIN_EQMAIN);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
240 pbutton_set_button_data(equalizerwin_close, 0, 116, 0, 125);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
241 pbutton_set_skin_index(equalizerwin_close, SKIN_EQMAIN);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
242 widget_hide(WIDGET(equalizerwin_volume));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
243 widget_hide(WIDGET(equalizerwin_balance));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
244 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
245
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
246 draw_equalizer_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
247 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
248
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
249 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
250 equalizerwin_set_shade(gboolean shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
251 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
252 GtkWidget *widget;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
253 widget = gtk_item_factory_get_widget(mainwin_view_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
254 "/Roll up Equalizer");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
255 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
256 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
257
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
258 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
259 equalizerwin_shade_toggle(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
260 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
261 equalizerwin_set_shade(!cfg.equalizer_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
262 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
263
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
264 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
265 equalizerwin_raise(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
266 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
267 if (cfg.equalizer_visible)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
268 gtk_window_present(GTK_WINDOW(equalizerwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
269 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
270
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
271 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
272 equalizerwin_eq_changed(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
273 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
274 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
275
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
276 cfg.equalizer_preamp = eqslider_get_position(equalizerwin_preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
277 for (i = 0; i < 10; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
278 cfg.equalizer_bands[i] = eqslider_get_position(equalizerwin_bands[i]);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
279 /* um .. i think we need both of these for xmms compatibility ..
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
280 not sure. -larne */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
281 input_set_eq(cfg.equalizer_active, cfg.equalizer_preamp,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
282 cfg.equalizer_bands);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
283 output_set_eq(cfg.equalizer_active, cfg.equalizer_preamp,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
284 cfg.equalizer_bands);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
285
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
286 widget_draw(WIDGET(equalizerwin_graph));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
287 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
288
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
289 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
290 equalizerwin_on_pushed(gboolean toggled)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
291 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
292 cfg.equalizer_active = toggled;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
293 equalizerwin_eq_changed();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
294 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
295
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
296 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
297 equalizerwin_presets_pushed(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
298 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
299 GdkModifierType modmask;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
300 gint x, y;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
301
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
302 gdk_window_get_pointer(NULL, &x, &y, &modmask);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
303 util_item_factory_popup(equalizerwin_presets_menu, x, y, 1,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
304 GDK_CURRENT_TIME);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
305 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
306
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
307 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
308 equalizerwin_auto_pushed(gboolean toggled)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
309 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
310 cfg.equalizer_autoload = toggled;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
311 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
312
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
313 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
314 draw_equalizer_window(gboolean force)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
315 {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
316 GdkImage *img, *img2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
317 GList *wl;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
318 Widget *w;
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
319 gboolean redraw;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
320
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
321 widget_list_lock(equalizerwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
322
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
323 if (force) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
324 skin_draw_pixmap(bmp_active_skin, equalizerwin_bg, equalizerwin_gc,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
325 SKIN_EQMAIN, 0, 0, 0, 0, 275, 116);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
326 if (gtk_window_has_toplevel_focus(GTK_WINDOW(equalizerwin)) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
327 !cfg.dim_titlebar) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
328 if (!cfg.equalizer_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
329 skin_draw_pixmap(bmp_active_skin, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
330 equalizerwin_gc, SKIN_EQMAIN, 0, 134, 0,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
331 0, 275, 14);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
332 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
333 skin_draw_pixmap(bmp_active_skin, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
334 equalizerwin_gc, SKIN_EQ_EX, 0, 0, 0, 0,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
335 275, 14);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
336 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
337 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
338 if (!cfg.equalizer_shaded)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
339 skin_draw_pixmap(bmp_active_skin, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
340 equalizerwin_gc, SKIN_EQMAIN, 0, 149, 0,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
341 0, 275, 14);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
342 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
343 skin_draw_pixmap(bmp_active_skin, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
344 equalizerwin_gc, SKIN_EQ_EX, 0, 15, 0, 0,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
345 275, 14);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
346
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
347 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
348 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
349
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
350 widget_list_draw(equalizerwin_wlist, &redraw, force);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
351
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
352 if (force || redraw) {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
353 if (cfg.doublesize && cfg.eq_doublesize_linked) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
354 if (force) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
355 img = gdk_drawable_get_image(equalizerwin_bg, 0, 0, 275, 116);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
356 img2 = create_dblsize_image(img);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
357 gdk_draw_image(equalizerwin_bg_x2, equalizerwin_gc,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
358 img2, 0, 0, 0, 0, 550, 232);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
359 gdk_image_destroy(img2);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
360 gdk_image_destroy(img);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
361 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
362 else {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
363 for (wl = equalizerwin_wlist; wl; wl = g_list_next(wl)) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
364 w = WIDGET(wl->data);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
365 if (w->redraw && w->visible) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
366 img = gdk_drawable_get_image(equalizerwin_bg,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
367 w->x, w->y,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
368 w->width, w->height);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
369 img2 = create_dblsize_image(img);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
370 gdk_draw_image(equalizerwin_bg_x2,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
371 equalizerwin_gc, img2, 0, 0,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
372 w->x << 1, w->y << 1, w->width << 1,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
373 w->height << 1);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
374 gdk_image_destroy(img2);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
375 gdk_image_destroy(img);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
376 w->redraw = FALSE;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
377 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
378 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
379 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
380 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
381 else
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
382 widget_list_clear_redraw(equalizerwin_wlist);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
383 gdk_window_clear(equalizerwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
384 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
385 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
386
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
387 widget_list_unlock(equalizerwin_wlist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
388 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
389
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
390 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
391 inside_sensitive_widgets(gint x, gint y)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
392 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
393 return (widget_contains(WIDGET(equalizerwin_on), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
394 widget_contains(WIDGET(equalizerwin_auto), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
395 widget_contains(WIDGET(equalizerwin_presets), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
396 widget_contains(WIDGET(equalizerwin_close), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
397 widget_contains(WIDGET(equalizerwin_shade), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
398 widget_contains(WIDGET(equalizerwin_preamp), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
399 widget_contains(WIDGET(equalizerwin_bands[0]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
400 widget_contains(WIDGET(equalizerwin_bands[1]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
401 widget_contains(WIDGET(equalizerwin_bands[2]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
402 widget_contains(WIDGET(equalizerwin_bands[3]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
403 widget_contains(WIDGET(equalizerwin_bands[4]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
404 widget_contains(WIDGET(equalizerwin_bands[5]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
405 widget_contains(WIDGET(equalizerwin_bands[6]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
406 widget_contains(WIDGET(equalizerwin_bands[7]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
407 widget_contains(WIDGET(equalizerwin_bands[8]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
408 widget_contains(WIDGET(equalizerwin_bands[9]), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
409 widget_contains(WIDGET(equalizerwin_volume), x, y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
410 widget_contains(WIDGET(equalizerwin_balance), x, y));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
411 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
412
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
413 gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
414 equalizerwin_press(GtkWidget * widget, GdkEventButton * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
415 gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
416 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
417 gint mx, my;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
418 gboolean grab = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
419
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
420 mx = event->x;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
421 my = event->y;
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
422 if (cfg.doublesize && cfg.eq_doublesize_linked) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
423 event->x /= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
424 event->y /= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
425 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
426
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
427 if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
428 ((cfg.easy_move || cfg.equalizer_shaded || event->y < 14) &&
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
429 !inside_sensitive_widgets(event->x, event->y))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
430 if (0 && hint_move_resize_available()) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
431 hint_move_resize(equalizerwin, event->x_root,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
432 event->y_root, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
433 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
434 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
435 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
436 equalizerwin_raise();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
437 dock_move_press(dock_window_list, GTK_WINDOW(equalizerwin), event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
438 FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
439 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
440 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
441 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
442 && event->y < 14) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
443 equalizerwin_set_shade(!cfg.equalizer_shaded);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
444 if (dock_is_moving(GTK_WINDOW(equalizerwin)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
445 dock_move_release(GTK_WINDOW(equalizerwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
446 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
447 else if (event->button == 3 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
448 !(widget_contains(WIDGET(equalizerwin_on), event->x, event->y) ||
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
449 widget_contains(WIDGET(equalizerwin_auto), event->x, event->y))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
450 /*
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
451 * Pop up the main menu a few pixels down to avoid
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
452 * anything to be selected initially.
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
453 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
454 util_item_factory_popup(mainwin_general_menu, event->x_root,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
455 event->y_root + 2, 3, event->time);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
456 grab = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
457 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
458 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
459 handle_press_cb(equalizerwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
460 draw_equalizer_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
461 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
462 if (grab)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
463 gdk_pointer_grab(GDK_WINDOW(equalizerwin->window), FALSE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
464 GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
465 NULL, NULL, GDK_CURRENT_TIME);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
466
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
467 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
468 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
469
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
470 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
471 equalizerwin_scroll(GtkWidget * widget, GdkEventScroll * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
472 {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
473 if (cfg.doublesize && cfg.eq_doublesize_linked) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
474 event->x /= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
475 event->y /= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
476 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
477
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
478 handle_scroll_cb(equalizerwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
479 draw_equalizer_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
480 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
481
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
482 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
483 equalizerwin_motion(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
484 GdkEventMotion * event, gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
485 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
486 GdkEvent *gevent;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
487
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
488 if (dock_is_moving(GTK_WINDOW(equalizerwin)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
489 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
490 dock_move_motion(GTK_WINDOW(equalizerwin), event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
491 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
492 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
493 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
494 handle_motion_cb(equalizerwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
495 draw_equalizer_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
496 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
497
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
498 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
499
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
500 while ((gevent = gdk_event_get()) != NULL) gdk_event_free(gevent);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
501
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
502 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
503 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
504
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
505 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
506 equalizerwin_release(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
507 GdkEventButton * event, gpointer callback_data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
508 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
509 gdk_pointer_ungrab(GDK_CURRENT_TIME);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
510 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
511
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
512 if (cfg.doublesize && cfg.eq_doublesize_linked) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
513 event->x /= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
514 event->y /= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
515 }
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
516 if (dock_is_moving(GTK_WINDOW(equalizerwin))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
517 dock_move_release(GTK_WINDOW(equalizerwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
518 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
519 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
520 handle_release_cb(equalizerwin_wlist, widget, event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
521 draw_equalizer_window(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
522 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
523
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
524 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
525 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
526
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
527 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
528 equalizerwin_focus_in(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
529 GdkEvent * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
530 gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
531 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
532 equalizerwin_close->pb_allow_draw = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
533 equalizerwin_shade->pb_allow_draw = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
534 draw_equalizer_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
535 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
536 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
537
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
538 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
539 equalizerwin_focus_out(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
540 GdkEventButton * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
541 gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
542 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
543 equalizerwin_close->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
544 equalizerwin_shade->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
545 draw_equalizer_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
546 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
547 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
548
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
549 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
550 equalizerwin_keypress(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
551 GdkEventKey * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
552 gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
553 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
554 if (!cfg.equalizer_shaded) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
555 gtk_widget_event(mainwin, (GdkEvent *) event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
556 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
557 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
558
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
559 switch (event->keyval) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
560 case GDK_Left:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
561 case GDK_KP_Left:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
562 mainwin_set_balance_diff(-4);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
563 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
564 case GDK_Right:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
565 case GDK_KP_Right:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
566 mainwin_set_balance_diff(4);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
567 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
568 default:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
569 gtk_widget_event(mainwin, (GdkEvent *) event);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
570 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
571 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
572
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
573 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
574 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
575
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
576 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
577 equalizerwin_configure(GtkWidget * window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
578 GdkEventConfigure * event,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
579 gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
580 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
581 if (!GTK_WIDGET_VISIBLE(window))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
582 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
583
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
584 cfg.equalizer_x = event->x;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
585 cfg.equalizer_y = event->y;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
586 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
587 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
588
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
589 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
590 equalizerwin_set_back_pixmap(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
591 {
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
592 if (cfg.doublesize && cfg.eq_doublesize_linked)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
593 gdk_window_set_back_pixmap(equalizerwin->window, equalizerwin_bg_x2,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
594 0);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
595 else
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
596 gdk_window_set_back_pixmap(equalizerwin->window, equalizerwin_bg, 0);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
597 gdk_window_clear(equalizerwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
598 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
599
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
600 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
601 equalizerwin_close_cb(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
602 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
603 equalizerwin_show(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
604 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
605
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
606 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
607 equalizerwin_delete(GtkWidget * widget,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
608 gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
609 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
610 equalizerwin_show(FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
611 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
612 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
613
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
614 static GList *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
615 equalizerwin_read_presets(const gchar * basename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
616 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
617 gchar *filename, *name;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
618 RcFile *rcfile;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
619 GList *list = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
620 gint i, p = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
621 EqualizerPreset *preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
622
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
623 filename = g_build_filename(bmp_paths[BMP_PATH_USER_DIR], basename, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
624
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
625 if ((rcfile = bmp_rcfile_open(filename)) == NULL) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
626 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
627 return NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
628 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
629
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
630 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
631
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
632 for (;;) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
633 gchar section[21];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
634
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
635 g_snprintf(section, sizeof(section), "Preset%d", p++);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
636 if (bmp_rcfile_read_string(rcfile, "Presets", section, &name)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
637 preset = g_new0(EqualizerPreset, 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
638 preset->name = name;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
639 bmp_rcfile_read_float(rcfile, name, "Preamp", &preset->preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
640 for (i = 0; i < 10; i++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
641 gchar band[7];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
642 g_snprintf(band, sizeof(band), "Band%d", i);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
643 bmp_rcfile_read_float(rcfile, name, band, &preset->bands[i]);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
644 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
645 list = g_list_prepend(list, preset);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
646 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
647 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
648 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
649 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
650 list = g_list_reverse(list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
651 bmp_rcfile_free(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
652 return list;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
653 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
654
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
655 gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
656 equalizerwin_volume_frame_cb(gint pos)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
657 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
658 if (equalizerwin_volume) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
659 if (pos < 32)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
660 equalizerwin_volume->hs_knob_nx =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
661 equalizerwin_volume->hs_knob_px = 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
662 else if (pos < 63)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
663 equalizerwin_volume->hs_knob_nx =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
664 equalizerwin_volume->hs_knob_px = 4;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
665 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
666 equalizerwin_volume->hs_knob_nx =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
667 equalizerwin_volume->hs_knob_px = 7;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
668 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
669 return 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
670 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
671
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
672 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
673 equalizerwin_volume_motion_cb(gint pos)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
674 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
675 gint v = (gint) rint(pos * 100 / 94.0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
676 mainwin_adjust_volume_motion(v);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
677 mainwin_set_volume_slider(v);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
678 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
679
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
680 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
681 equalizerwin_volume_release_cb(gint pos)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
682 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
683 mainwin_adjust_volume_release();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
684 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
685
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
686 static gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
687 equalizerwin_balance_frame_cb(gint pos)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
688 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
689 if (equalizerwin_balance) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
690 if (pos < 13)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
691 equalizerwin_balance->hs_knob_nx =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
692 equalizerwin_balance->hs_knob_px = 11;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
693 else if (pos < 26)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
694 equalizerwin_balance->hs_knob_nx =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
695 equalizerwin_balance->hs_knob_px = 14;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
696 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
697 equalizerwin_balance->hs_knob_nx =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
698 equalizerwin_balance->hs_knob_px = 17;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
699 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
700
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
701 return 1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
702 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
703
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
704 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
705 equalizerwin_balance_motion_cb(gint pos)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
706 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
707 gint b;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
708 pos = MIN(pos, 38); /* The skin uses a even number of pixels
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
709 for the balance-slider *sigh* */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
710 b = (gint) rint((pos - 19) * 100 / 19.0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
711 mainwin_adjust_balance_motion(b);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
712 mainwin_set_balance_slider(b);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
713 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
714
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
715 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
716 equalizerwin_balance_release_cb(gint pos)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
717 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
718 mainwin_adjust_balance_release();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
719 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
720
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
721 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
722 equalizerwin_set_balance_slider(gint percent)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
723 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
724 hslider_set_position(equalizerwin_balance,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
725 (gint) rint((percent * 19 / 100.0) + 19));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
726 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
727
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
728 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
729 equalizerwin_set_volume_slider(gint percent)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
730 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
731 hslider_set_position(equalizerwin_volume,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
732 (gint) rint(percent * 94 / 100.0));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
733 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
734
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
735 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
736 equalizerwin_create_widgets(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
737 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
738 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
739
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
740 equalizerwin_on =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
741 create_tbutton(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
742 equalizerwin_gc, 14, 18, 25, 12, 10, 119, 128, 119,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
743 69, 119, 187, 119, equalizerwin_on_pushed,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
744 SKIN_EQMAIN);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
745 tbutton_set_toggled(equalizerwin_on, cfg.equalizer_active);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
746 equalizerwin_auto =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
747 create_tbutton(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
748 equalizerwin_gc, 39, 18, 33, 12, 35, 119, 153, 119,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
749 94, 119, 212, 119, equalizerwin_auto_pushed,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
750 SKIN_EQMAIN);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
751 tbutton_set_toggled(equalizerwin_auto, cfg.equalizer_autoload);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
752 equalizerwin_presets =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
753 create_pbutton(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
754 equalizerwin_gc, 217, 18, 44, 12, 224, 164, 224,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
755 176, equalizerwin_presets_pushed, SKIN_EQMAIN);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
756 equalizerwin_close =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
757 create_pbutton(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
758 equalizerwin_gc, 264, 3, 9, 9, 0, 116, 0, 125,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
759 equalizerwin_close_cb, SKIN_EQMAIN);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
760 equalizerwin_close->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
761
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
762 equalizerwin_shade =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
763 create_pbutton_ex(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
764 equalizerwin_gc, 254, 3, 9, 9, 254, 137, 1, 38,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
765 equalizerwin_shade_toggle, NULL, SKIN_EQMAIN, SKIN_EQ_EX);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
766 equalizerwin_shade->pb_allow_draw = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
767
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
768 equalizerwin_graph =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
769 create_eqgraph(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
770 equalizerwin_gc, 86, 17);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
771 equalizerwin_preamp =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
772 create_eqslider(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
773 equalizerwin_gc, 21, 38);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
774 eqslider_set_position(equalizerwin_preamp, cfg.equalizer_preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
775 for (i = 0; i < 10; i++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
776 equalizerwin_bands[i] =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
777 create_eqslider(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
778 equalizerwin_gc, 78 + (i * 18), 38);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
779 eqslider_set_position(equalizerwin_bands[i], cfg.equalizer_bands[i]);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
780 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
781
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
782 equalizerwin_volume =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
783 create_hslider(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
784 equalizerwin_gc, 61, 4, 97, 8, 1, 30, 1, 30, 3, 7,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
785 4, 61, 0, 94, equalizerwin_volume_frame_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
786 equalizerwin_volume_motion_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
787 equalizerwin_volume_release_cb, SKIN_EQ_EX);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
788 equalizerwin_balance =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
789 create_hslider(&equalizerwin_wlist, equalizerwin_bg,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
790 equalizerwin_gc, 164, 4, 42, 8, 11, 30, 11, 30, 3,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
791 7, 4, 164, 0, 39, equalizerwin_balance_frame_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
792 equalizerwin_balance_motion_cb,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
793 equalizerwin_balance_release_cb, SKIN_EQ_EX);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
794
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
795 if (!cfg.equalizer_shaded) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
796 widget_hide(WIDGET(equalizerwin_volume));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
797 widget_hide(WIDGET(equalizerwin_balance));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
798 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
799 else {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
800 pbutton_set_button_data(equalizerwin_shade, -1, 3, -1, 47);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
801 pbutton_set_skin_index1(equalizerwin_shade, SKIN_EQ_EX);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
802 pbutton_set_button_data(equalizerwin_close, 11, 38, 11, 47);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
803 pbutton_set_skin_index(equalizerwin_close, SKIN_EQ_EX);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
804 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
805 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
806
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
807
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
808 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
809 equalizerwin_create_window(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
810 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
811 GdkPixbuf *icon;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
812 gint width, height;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
813
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
814 equalizerwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
815 gtk_window_set_title(GTK_WINDOW(equalizerwin), _("Audacious Equalizer"));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
816 gtk_window_set_wmclass(GTK_WINDOW(equalizerwin), "equalizer", "Audacious");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
817 gtk_window_set_role(GTK_WINDOW(equalizerwin), "equalizer");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
818
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
819 width = 275;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
820 height = cfg.equalizer_shaded ? 14 : 116;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
821
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
822 if (cfg.doublesize && cfg.eq_doublesize_linked) {
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
823 width *= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
824 height *= 2;
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
825 }
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
826
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
827 gtk_window_set_default_size(GTK_WINDOW(equalizerwin), width, height);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
828 gtk_window_set_resizable(GTK_WINDOW(equalizerwin), FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
829
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
830 dock_window_list = dock_window_set_decorated(dock_window_list,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
831 GTK_WINDOW(equalizerwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
832 cfg.show_wm_decorations);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
833
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
834 /* this will hide only mainwin. it's annoying! yaz */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
835 gtk_window_set_transient_for(GTK_WINDOW(equalizerwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
836 GTK_WINDOW(mainwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
837 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(equalizerwin), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
838
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
839 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) bmp_eq_icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
840 gtk_window_set_icon(GTK_WINDOW(equalizerwin), icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
841 g_object_unref(icon);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
842
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
843 gtk_widget_set_app_paintable(equalizerwin, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
844
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
845 if (cfg.equalizer_x != -1 && cfg.save_window_position)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
846 gtk_window_move(GTK_WINDOW(equalizerwin),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
847 cfg.equalizer_x, cfg.equalizer_y);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
848
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
849 gtk_widget_set_events(equalizerwin,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
850 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
851 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
852 GDK_VISIBILITY_NOTIFY_MASK);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
853 gtk_widget_realize(equalizerwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
854
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
855 util_set_cursor(equalizerwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
856
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
857 g_signal_connect(equalizerwin, "delete_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
858 G_CALLBACK(equalizerwin_delete), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
859 g_signal_connect(equalizerwin, "button_press_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
860 G_CALLBACK(equalizerwin_press), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
861 g_signal_connect(equalizerwin, "button_release_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
862 G_CALLBACK(equalizerwin_release), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
863 g_signal_connect(equalizerwin, "motion_notify_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
864 G_CALLBACK(equalizerwin_motion), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
865 g_signal_connect_after(equalizerwin, "focus_in_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
866 G_CALLBACK(equalizerwin_focus_in), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
867 g_signal_connect_after(equalizerwin, "focus_out_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
868 G_CALLBACK(equalizerwin_focus_out), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
869 g_signal_connect(equalizerwin, "configure_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
870 G_CALLBACK(equalizerwin_configure), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
871 g_signal_connect(equalizerwin, "style_set",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
872 G_CALLBACK(equalizerwin_set_back_pixmap), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
873 g_signal_connect(equalizerwin, "key_press_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
874 G_CALLBACK(equalizerwin_keypress), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
875 g_signal_connect(equalizerwin, "scroll_event",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
876 G_CALLBACK(equalizerwin_scroll), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
877 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
878
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
879 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
880 equalizerwin_create_popup_menus(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
881 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
882 equalizerwin_accel = gtk_accel_group_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
883 gtk_window_add_accel_group(GTK_WINDOW(equalizerwin), equalizerwin_accel);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
884
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
885 equalizerwin_presets_menu = create_menu(equalizerwin_presets_menu_entries,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
886 equalizerwin_presets_menu_entries_num,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
887 NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
888 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
889
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
890 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
891 equalizerwin_create(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
892 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
893 equalizer_presets = equalizerwin_read_presets("eq.preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
894 equalizer_auto_presets = equalizerwin_read_presets("eq.auto_preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
895
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
896 equalizerwin_create_window();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
897 equalizerwin_create_popup_menus();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
898
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
899 equalizerwin_gc = gdk_gc_new(equalizerwin->window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
900 equalizerwin_bg = gdk_pixmap_new(equalizerwin->window, 275, 116, -1);
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
901 equalizerwin_bg_x2 = gdk_pixmap_new(equalizerwin->window, 550, 232, -1);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
902
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
903 equalizerwin_create_widgets();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
904
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
905 equalizerwin_set_back_pixmap();
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
906 if (cfg.doublesize && cfg.eq_doublesize_linked)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
907 gdk_window_set_back_pixmap(equalizerwin->window,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
908 equalizerwin_bg_x2, 0);
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
909 else
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
910 gdk_window_set_back_pixmap(equalizerwin->window, equalizerwin_bg, 0);
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
911 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
912
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
913
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
914 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
915 equalizerwin_show(gboolean show)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
916 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
917 GtkWidget *item = gtk_item_factory_get_widget(mainwin_view_menu,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
918 "/Show Equalizer");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
919 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), show);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
920 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
921
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
922 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
923 equalizerwin_real_show(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
924 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
925 /*
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
926 * This function should only be called from the
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
927 * main menu signal handler
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
928 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
929
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
930 gint x, y;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
931
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
932 gtk_window_get_position(GTK_WINDOW(equalizerwin), &x, &y);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
933 gtk_window_move(GTK_WINDOW(equalizerwin), x, y);
1938
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
934 if (cfg.doublesize && cfg.eq_doublesize_linked)
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
935 gtk_widget_set_size_request(equalizerwin, 550,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
936 (cfg.equalizer_shaded ? 28 : 232));
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
937 else
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
938 gtk_widget_set_size_request(equalizerwin, 275,
1d9c1026d9f8 [svn] - DoubleSize support.
nenolod
parents: 1653
diff changeset
939 (cfg.equalizer_shaded ? 14 : 116));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
940 gdk_flush();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
941 draw_equalizer_window(TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
942 cfg.equalizer_visible = TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
943 tbutton_set_toggled(mainwin_eq, TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
944
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
945 gtk_widget_show(equalizerwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
946 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
947
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
948 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
949 equalizerwin_real_hide(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
950 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
951 /*
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
952 * This function should only be called from the
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
953 * main menu signal handler
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
954 */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
955 gtk_widget_hide(equalizerwin);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
956 cfg.equalizer_visible = FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
957 tbutton_set_toggled(mainwin_eq, FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
958 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
959
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
960 static EqualizerPreset *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
961 equalizerwin_find_preset(GList * list, const gchar * name)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
962 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
963 GList *node = list;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
964 EqualizerPreset *preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
965
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
966 while (node) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
967 preset = node->data;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
968 if (!strcasecmp(preset->name, name))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
969 return preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
970 node = g_list_next(node);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
971 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
972 return NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
973 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
974
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
975 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
976 equalizerwin_write_preset_file(GList * list, const gchar * basename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
977 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
978 gchar *filename, *tmp;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
979 gint i, p;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
980 EqualizerPreset *preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
981 RcFile *rcfile;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
982 GList *node;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
983
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
984 rcfile = bmp_rcfile_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
985 p = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
986 for (node = list; node; node = g_list_next(node)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
987 preset = node->data;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
988 tmp = g_strdup_printf("Preset%d", p++);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
989 bmp_rcfile_write_string(rcfile, "Presets", tmp, preset->name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
990 g_free(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
991 bmp_rcfile_write_float(rcfile, preset->name, "Preamp",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
992 preset->preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
993 for (i = 0; i < 10; i++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
994 tmp = g_strdup_printf("Band%d\n", i);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
995 bmp_rcfile_write_float(rcfile, preset->name, tmp,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
996 preset->bands[i]);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
997 g_free(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
998 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
999 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1000
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1001 filename = g_build_filename(bmp_paths[BMP_PATH_USER_DIR], basename, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1002 bmp_rcfile_write(rcfile, filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1003 bmp_rcfile_free(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1004 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1005 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1006
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1007 static gboolean
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1008 equalizerwin_load_preset(GList * list, const gchar * name)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1009 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1010 EqualizerPreset *preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1011 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1012
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1013 if ((preset = equalizerwin_find_preset(list, name)) != NULL) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1014 eqslider_set_position(equalizerwin_preamp, preset->preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1015 for (i = 0; i < 10; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1016 eqslider_set_position(equalizerwin_bands[i], preset->bands[i]);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1017 equalizerwin_eq_changed();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1018 return TRUE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1019 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1020 return FALSE;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1021 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1022
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1023 static GList *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1024 equalizerwin_save_preset(GList * list, const gchar * name,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1025 const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1026 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1027 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1028 EqualizerPreset *preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1029
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1030 if (!(preset = equalizerwin_find_preset(list, name))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1031 preset = g_new0(EqualizerPreset, 1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1032 preset->name = g_strdup(name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1033 list = g_list_append(list, preset);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1034 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1035
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1036 preset->preamp = eqslider_get_position(equalizerwin_preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1037 for (i = 0; i < 10; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1038 preset->bands[i] = eqslider_get_position(equalizerwin_bands[i]);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1039
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1040 equalizerwin_write_preset_file(list, filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1041
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1042 return list;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1043 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1044
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1045 static GList *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1046 equalizerwin_delete_preset(GList * list, gchar * name, gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1047 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1048 EqualizerPreset *preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1049 GList *node;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1050
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1051 if (!(preset = equalizerwin_find_preset(list, name)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1052 return list;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1053
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1054 if (!(node = g_list_find(list, preset)))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1055 return list;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1056
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1057 list = g_list_remove_link(list, node);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1058 equalizer_preset_free(preset);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1059 g_list_free_1(node);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1060
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1061 equalizerwin_write_preset_file(list, filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1062
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1063 return list;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1064 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1065
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1066
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1067 static GList *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1068 import_winamp_eqf(VFSFile * file)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1069 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1070 gchar header[31];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1071 gchar name[257];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1072 gchar bands[11];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1073 gint i = 0;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1074 GList *list = NULL;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1075 EqualizerPreset *preset;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1076
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1077 vfs_fread(header, 1, 31, file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1078 if (!strncmp(header, "Winamp EQ library file v1.1", 27)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1079 while (vfs_fread(name, 1, 257, file)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1080 preset = equalizer_preset_new(name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1081 preset->preamp = 20.0 - ((bands[10] * 40.0) / 64);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1082
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1083 vfs_fread(bands, 1, 11, file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1084
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1085 for (i = 0; i < 10; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1086 preset->bands[i] = 20.0 - ((bands[i] * 40.0) / 64);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1087
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1088 list = g_list_prepend(list, preset);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1089 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1090 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1091
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1092 list = g_list_reverse(list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1093 return list;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1094 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1095
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1096 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1097 equalizerwin_read_winamp_eqf(VFSFile * file)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1098 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1099 gchar header[31];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1100 guchar bands[11];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1101 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1102
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1103 vfs_fread(header, 1, 31, file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1104
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1105 if (!strncmp(header, "Winamp EQ library file v1.1", 27)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1106 /* Skip name */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1107 if (vfs_fseek(file, 257, SEEK_CUR) == -1)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1108 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1109
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1110 if (vfs_fread(bands, 1, 11, file) != 11)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1111 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1112
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1113 eqslider_set_position(equalizerwin_preamp,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1114 20.0 - ((bands[10] * 40.0) / 63.0));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1115
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1116 for (i = 0; i < 10; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1117 eqslider_set_position(equalizerwin_bands[i],
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1118 20.0 - ((bands[i] * 40.0) / 64.0));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1119 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1120
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1121 equalizerwin_eq_changed();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1122 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1123
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1124 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1125 equalizerwin_read_bmp_preset(RcFile * rcfile)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1126 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1127 gfloat val;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1128 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1129
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1130 if (bmp_rcfile_read_float(rcfile, "Equalizer preset", "Preamp", &val))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1131 eqslider_set_position(equalizerwin_preamp, val);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1132 for (i = 0; i < 10; i++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1133 gchar tmp[7];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1134 g_snprintf(tmp, sizeof(tmp), "Band%d", i);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1135 if (bmp_rcfile_read_float(rcfile, "Equalizer preset", tmp, &val))
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1136 eqslider_set_position(equalizerwin_bands[i], val);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1137 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1138 equalizerwin_eq_changed();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1139 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1140
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1141 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1142 equalizerwin_save_ok(GtkWidget * widget, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1143 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1144 const gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1145
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1146 text = gtk_entry_get_text(GTK_ENTRY(equalizerwin_save_entry));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1147 if (strlen(text) != 0)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1148 equalizer_presets =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1149 equalizerwin_save_preset(equalizer_presets, text, "eq.preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1150 gtk_widget_destroy(equalizerwin_save_window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1151 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1152
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1153 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1154 equalizerwin_save_select(GtkCList * clist, gint row,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1155 gint column, GdkEventButton * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1156 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1157 gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1158
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1159 gtk_clist_get_text(clist, row, 0, &text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1160
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1161 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_entry), text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1162 if (event->type == GDK_2BUTTON_PRESS)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1163 equalizerwin_save_ok(NULL, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1164
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1165 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1166
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1167 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1168 equalizerwin_load_ok(GtkWidget * widget, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1169 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1170 gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1171 GtkCList *clist = GTK_CLIST(data);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1172
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1173 if (clist && clist->selection) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1174 gtk_clist_get_text(clist, GPOINTER_TO_INT(clist->selection->data),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1175 0, &text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1176 equalizerwin_load_preset(equalizer_presets, text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1177 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1178 gtk_widget_destroy(equalizerwin_load_window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1179 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1180
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1181 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1182 equalizerwin_load_apply(GtkWidget * widget, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1183 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1184 gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1185 GtkCList *clist = GTK_CLIST(data);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1186
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1187 if (clist && clist->selection) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1188 gtk_clist_get_text(clist, GPOINTER_TO_INT(clist->selection->data),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1189 0, &text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1190 equalizerwin_load_preset(equalizer_presets, text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1191 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1192 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1193
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1194
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1195 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1196 equalizerwin_load_select(GtkCList * widget, gint row,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1197 gint column, GdkEventButton * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1198 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1199 if (event->type == GDK_2BUTTON_PRESS)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1200 equalizerwin_load_ok(NULL, widget);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1201 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1202
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1203 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1204 equalizerwin_delete_delete(GtkWidget * widget, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1205 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1206 gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1207 GList *list, *next;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1208 GtkCList *clist = GTK_CLIST(data);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1209
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1210 g_return_if_fail(clist != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1211
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1212 list = clist->selection;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1213 gtk_clist_freeze(clist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1214 while (list) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1215 next = g_list_next(list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1216 gtk_clist_get_text(clist, GPOINTER_TO_INT(list->data), 0, &text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1217 equalizer_auto_presets =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1218 equalizerwin_delete_preset(equalizer_presets, text, "eq.preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1219 gtk_clist_remove(clist, GPOINTER_TO_INT(list->data));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1220 list = next;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1221 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1222 gtk_clist_thaw(clist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1223 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1224
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1225 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1226 equalizerwin_save_auto_ok(GtkWidget * widget, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1227 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1228 const gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1229
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1230 text = gtk_entry_get_text(GTK_ENTRY(equalizerwin_save_auto_entry));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1231 if (strlen(text) != 0)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1232 equalizer_auto_presets =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1233 equalizerwin_save_preset(equalizer_auto_presets, text,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1234 "eq.auto_preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1235 gtk_widget_destroy(equalizerwin_save_auto_window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1236 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1237
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1238 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1239 equalizerwin_save_auto_select(GtkCList * clist, gint row,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1240 gint column,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1241 GdkEventButton * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1242 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1243 gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1244
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1245 gtk_clist_get_text(clist, row, 0, &text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1246
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1247 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_auto_entry), text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1248 if (event->type == GDK_2BUTTON_PRESS)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1249 equalizerwin_save_auto_ok(NULL, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1250
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1251 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1252
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1253 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1254 equalizerwin_load_auto_ok(GtkWidget * widget, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1255 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1256 gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1257 GtkCList *clist = GTK_CLIST(data);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1258
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1259 if (clist && clist->selection) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1260 gtk_clist_get_text(clist, GPOINTER_TO_INT(clist->selection->data),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1261 0, &text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1262 equalizerwin_load_preset(equalizer_auto_presets, text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1263 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1264 gtk_widget_destroy(equalizerwin_load_auto_window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1265 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1266
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1267 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1268 equalizerwin_load_auto_select(GtkWidget * widget, gint row,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1269 gint column,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1270 GdkEventButton * event, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1271 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1272 if (event->type == GDK_2BUTTON_PRESS)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1273 equalizerwin_load_auto_ok(NULL, widget);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1274 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1275
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1276 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1277 equalizerwin_delete_auto_delete(GtkWidget * widget, gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1278 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1279 gchar *text;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1280 GList *list, *next;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1281 GtkCList *clist = GTK_CLIST(data);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1282
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1283 g_return_if_fail(clist != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1284
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1285 list = clist->selection;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1286 gtk_clist_freeze(clist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1287 while (list) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1288 next = g_list_next(list);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1289 gtk_clist_get_text(clist, GPOINTER_TO_INT(list->data), 0, &text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1290 equalizer_auto_presets =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1291 equalizerwin_delete_preset(equalizer_auto_presets, text,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1292 "eq.auto_preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1293 gtk_clist_remove(clist, GPOINTER_TO_INT(list->data));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1294 list = next;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1295 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1296 gtk_clist_thaw(clist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1297 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1298
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1299
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1300 typedef void (*ResponseHandler)(const gchar *filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1301
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1302 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1303 equalizerwin_file_chooser_on_response(GtkWidget * dialog,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1304 gint response,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1305 gpointer data)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1306 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1307 GtkFileChooser *file_chooser = GTK_FILE_CHOOSER(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1308 ResponseHandler handler = (ResponseHandler) data;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1309 gchar *filename;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1310
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1311 gtk_widget_hide(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1312
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1313 switch (response)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1314 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1315 case GTK_RESPONSE_ACCEPT:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1316 filename = gtk_file_chooser_get_filename(file_chooser);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1317 handler(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1318 g_free(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1319 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1320
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1321 case GTK_RESPONSE_REJECT:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1322 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1323 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1324
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1325 gtk_widget_destroy(dialog);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1326 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1327
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1328
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1329
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1330 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1331 load_preset_file(const gchar *filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1332 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1333 RcFile *rcfile;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1334
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1335 if ((rcfile = bmp_rcfile_open(filename)) != NULL) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1336 equalizerwin_read_bmp_preset(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1337 bmp_rcfile_free(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1338 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1339 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1340
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1341 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1342 load_winamp_file(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1343 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1344 VFSFile *file;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1345 gchar *tmp;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1346
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1347 if (!(file = vfs_fopen(filename, "rb"))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1348 tmp = g_strconcat("Failed to load WinAmp file: ",filename,"\n",NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1349 report_error(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1350 g_free(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1351 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1352 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1353
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1354 equalizerwin_read_winamp_eqf(file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1355 vfs_fclose(file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1356 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1357
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1358 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1359 import_winamp_file(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1360 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1361 VFSFile *file;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1362 gchar *tmp;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1363
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1364 if (!(file = vfs_fopen(filename, "rb"))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1365 tmp = g_strconcat("Failed to import WinAmp file: ",filename,"\n",NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1366 report_error(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1367 g_free(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1368 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1369 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1370
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1371 equalizer_presets = g_list_concat(equalizer_presets,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1372 import_winamp_eqf(file));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1373 equalizerwin_write_preset_file(equalizer_presets, "eq.preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1374
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1375 vfs_fclose(file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1376 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1377
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1378 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1379 save_preset_file(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1380 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1381 RcFile *rcfile;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1382 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1383
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1384 rcfile = bmp_rcfile_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1385 bmp_rcfile_write_float(rcfile, "Equalizer preset", "Preamp",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1386 eqslider_get_position(equalizerwin_preamp));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1387
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1388 for (i = 0; i < 10; i++) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1389 gchar tmp[7];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1390 g_snprintf(tmp, sizeof(tmp), "Band%d", i);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1391 bmp_rcfile_write_float(rcfile, "Equalizer preset", tmp,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1392 eqslider_get_position(equalizerwin_bands[i]));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1393 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1394
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1395 bmp_rcfile_write(rcfile, filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1396 bmp_rcfile_free(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1397 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1398
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1399 static void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1400 save_winamp_file(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1401 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1402 VFSFile *file;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1403
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1404 gchar name[257];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1405 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1406 guchar bands[11];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1407 gchar *tmp;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1408
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1409 if (!(file = vfs_fopen(filename, "wb"))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1410 tmp = g_strconcat("Failed to save WinAmp file: ",filename,"\n",NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1411 report_error(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1412 g_free(tmp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1413 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1414 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1415
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1416 vfs_fwrite("Winamp EQ library file v1.1\x1a!--", 1, 31, file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1417
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1418 memset(name, 0, 257);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1419 strcpy(name, "Entry1");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1420 vfs_fwrite(name, 1, 257, file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1421
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1422 for (i = 0; i < 10; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1423 bands[i] = 63 - (((eqslider_get_position(equalizerwin_bands[i]) + 20) * 63) / 40);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1424 bands[10] = 63 - (((eqslider_get_position(equalizerwin_preamp) + 20) * 63) / 40);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1425 vfs_fwrite(bands, 1, 11, file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1426
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1427 vfs_fclose(file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1428 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1429
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1430 static gint
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1431 equalizerwin_list_sort_func(GtkCList * clist,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1432 gconstpointer ptr1, gconstpointer ptr2)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1433 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1434 GtkCListRow *row1 = (GtkCListRow *) ptr1;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1435 GtkCListRow *row2 = (GtkCListRow *) ptr2;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1436
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1437 return strcasecmp(GTK_CELL_TEXT(row1->cell[clist->sort_column])->text,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1438 GTK_CELL_TEXT(row2->cell[clist->sort_column])->text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1439 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1440
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1441
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1442 static GtkListStore *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1443 preset_list_store_new(GList * preset)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1444 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1445 GtkListStore *store;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1446 GtkTreeIter iter;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1447 GList *node;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1448
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1449 store = gtk_list_store_new(PRESET_VIEW_N_COLS, G_TYPE_STRING);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1450
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1451 for (node = preset; node; node = g_list_next(node)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1452 gtk_list_store_append(store, &iter);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1453 gtk_list_store_set(store, &iter,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1454 PRESET_VIEW_COL_NAME,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1455 &((EqualizerPreset *) node->data)->name, -1);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1456 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1457
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1458 return store;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1459 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1460
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1461
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1462 GtkWidget *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1463 preset_view_new(GList * preset)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1464 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1465 GtkWidget *treeview;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1466 GtkTreeModel *model;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1467 GtkTreeViewColumn *column;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1468 GtkCellRenderer *renderer;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1469 GtkListStore *store;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1470
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1471 store = preset_list_store_new(preset);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1472
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1473 model = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(store));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1474 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1475 PRESET_VIEW_COL_NAME,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1476 GTK_SORT_ASCENDING);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1477
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1478 treeview = gtk_tree_view_new_with_model(model);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1479 gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(treeview), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1480 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1481
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1482 renderer = gtk_cell_renderer_text_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1483 column = gtk_tree_view_column_new_with_attributes(_("Preset"), renderer,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1484 "text",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1485 PRESET_VIEW_COL_NAME,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1486 NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1487 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1488
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1489 return treeview;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1490 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1491
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1492
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1493 static GtkWidget *
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1494 equalizerwin_create_list_window(GList * preset_list,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1495 const gchar * title,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1496 GtkWidget ** window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1497 GtkSelectionMode sel_mode,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1498 GtkWidget ** entry,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1499 const gchar * btn2_stock_name,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1500 const gchar * btn3_stock_name,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1501 const gchar * btn1_stock_name,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1502 GCallback btn2_func,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1503 GCallback btn3_func,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1504 GCallback select_row_func)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1505 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1506 GtkWidget *vbox, *scrolled_window, *bbox, *btn1, *btn2, *btn3, *clist;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1507 gchar *preset_text[1];
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1508 GList *node;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1509
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1510 *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1511 gtk_window_set_title(GTK_WINDOW(*window), title);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1512 gtk_window_set_type_hint(GTK_WINDOW(*window), GDK_WINDOW_TYPE_HINT_DIALOG);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1513 gtk_window_set_default_size(GTK_WINDOW(*window), 350, 300);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1514 gtk_window_set_position(GTK_WINDOW(*window), GTK_WIN_POS_CENTER);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1515 gtk_container_set_border_width(GTK_CONTAINER(*window), 10);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1516 gtk_window_set_transient_for(GTK_WINDOW(*window),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1517 GTK_WINDOW(equalizerwin));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1518 g_signal_connect(*window, "destroy",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1519 G_CALLBACK(gtk_widget_destroyed), window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1520
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1521 vbox = gtk_vbox_new(FALSE, 10);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1522 gtk_container_add(GTK_CONTAINER(*window), vbox);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1523
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1524 scrolled_window = gtk_scrolled_window_new(NULL, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1525 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1526 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1527
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1528 preset_text[0] = _("Presets");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1529 clist = gtk_clist_new_with_titles(1, preset_text);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1530 if (select_row_func)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1531 g_signal_connect(clist, "select_row",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1532 G_CALLBACK(select_row_func), NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1533 gtk_clist_column_titles_passive(GTK_CLIST(clist));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1534 gtk_clist_set_selection_mode(GTK_CLIST(clist), sel_mode);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1535
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1536 for (node = preset_list; node; node = g_list_next(node)) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1537 gtk_clist_append(GTK_CLIST(clist),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1538 &((EqualizerPreset *) node->data)->name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1539 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1540 gtk_clist_set_compare_func(GTK_CLIST(clist), equalizerwin_list_sort_func);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1541 gtk_clist_sort(GTK_CLIST(clist));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1542
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1543 gtk_container_add(GTK_CONTAINER(scrolled_window), clist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1544 gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1545
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1546 if (entry) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1547 *entry = gtk_entry_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1548 g_signal_connect(*entry, "activate", btn2_func, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1549 gtk_box_pack_start(GTK_BOX(vbox), *entry, FALSE, FALSE, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1550 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1551
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1552 bbox = gtk_hbutton_box_new();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1553 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1554 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1555 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1556
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1557 btn1 = gtk_button_new_from_stock(btn1_stock_name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1558 g_signal_connect_swapped(btn1, "clicked",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1559 G_CALLBACK(gtk_widget_destroy),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1560 GTK_OBJECT(*window));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1561 gtk_box_pack_start(GTK_BOX(bbox), btn1, TRUE, TRUE, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1562
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1563 if (btn3_stock_name) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1564 btn3 = gtk_button_new_from_stock(btn3_stock_name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1565 g_signal_connect(btn3, "clicked", G_CALLBACK(btn3_func), clist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1566 gtk_box_pack_start(GTK_BOX(bbox), btn3, TRUE, TRUE, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1567 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1568
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1569 btn2 = gtk_button_new_from_stock(btn2_stock_name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1570 g_signal_connect(btn2, "clicked", G_CALLBACK(btn2_func), clist);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1571 GTK_WIDGET_SET_FLAGS(btn2, GTK_CAN_DEFAULT);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1572
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1573 gtk_box_pack_start(GTK_BOX(bbox), btn2, TRUE, TRUE, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1574
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1575 gtk_widget_grab_default(btn2);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1576
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1577
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1578 gtk_widget_show_all(*window);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1579
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1580 return *window;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1581 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1582
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1583 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1584 equalizerwin_presets_menu_cb(gpointer cb_data, guint action, GtkWidget * w)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1585 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1586 GtkWidget *dialog;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1587
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1588 switch (action) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1589 case EQUALIZER_PRESETS_LOAD_PRESET:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1590 if (!equalizerwin_load_window)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1591 equalizerwin_create_list_window(equalizer_presets,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1592 _("Load preset"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1593 &equalizerwin_load_window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1594 GTK_SELECTION_SINGLE, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1595 GTK_STOCK_OK, GTK_STOCK_APPLY, GTK_STOCK_CANCEL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1596 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1597 (equalizerwin_load_ok),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1598 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1599 (equalizerwin_load_apply),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1600 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1601 (equalizerwin_load_select));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1602 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1603 gtk_window_present(GTK_WINDOW(equalizerwin_load_window));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1604 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1605 case EQUALIZER_PRESETS_LOAD_AUTOPRESET:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1606 if (!equalizerwin_load_auto_window)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1607 equalizerwin_create_list_window(equalizer_auto_presets,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1608 _("Load auto-preset"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1609 &equalizerwin_load_auto_window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1610 GTK_SELECTION_SINGLE, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1611 GTK_STOCK_OK, NULL, GTK_STOCK_CANCEL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1612 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1613 (equalizerwin_load_auto_ok),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1614 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1615 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1616 (equalizerwin_load_auto_select));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1617 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1618 gtk_window_present(GTK_WINDOW(equalizerwin_load_auto_window));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1619 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1620 case EQUALIZER_PRESETS_LOAD_DEFAULT:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1621 equalizerwin_load_preset(equalizer_presets, "Default");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1622 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1623 case EQUALIZER_PRESETS_LOAD_ZERO:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1624 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1625 gint i;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1626
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1627 eqslider_set_position(equalizerwin_preamp, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1628 for (i = 0; i < 10; i++)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1629 eqslider_set_position(equalizerwin_bands[i], 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1630 equalizerwin_eq_changed();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1631 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1632 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1633 case EQUALIZER_PRESETS_LOAD_FROM_FILE:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1634 dialog = make_filebrowser(_("Load equalizer preset"), FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1635 g_signal_connect(dialog , "response",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1636 G_CALLBACK(equalizerwin_file_chooser_on_response),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1637 load_preset_file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1638 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1639 case EQUALIZER_PRESETS_LOAD_FROM_WINAMPFILE:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1640 dialog = make_filebrowser(_("Load equalizer preset"), FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1641 g_signal_connect(dialog, "response",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1642 G_CALLBACK(equalizerwin_file_chooser_on_response),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1643 load_winamp_file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1644 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1645
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1646 case EQUALIZER_PRESETS_IMPORT_WINAMPFILE:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1647 dialog = make_filebrowser(_("Load equalizer preset"), FALSE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1648 g_signal_connect(dialog, "response",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1649 G_CALLBACK(equalizerwin_file_chooser_on_response),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1650 import_winamp_file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1651 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1652
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1653 case EQUALIZER_PRESETS_SAVE_PRESET:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1654 if (!equalizerwin_save_window)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1655 equalizerwin_create_list_window(equalizer_presets,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1656 _("Save preset"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1657 &equalizerwin_save_window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1658 GTK_SELECTION_SINGLE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1659 &equalizerwin_save_entry,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1660 GTK_STOCK_OK, NULL, GTK_STOCK_CANCEL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1661 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1662 (equalizerwin_save_ok),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1663 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1664 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1665 (equalizerwin_save_select));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1666 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1667 gtk_window_present(GTK_WINDOW(equalizerwin_save_window));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1668 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1669
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1670 case EQUALIZER_PRESETS_SAVE_AUTOPRESET:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1671 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1672 gchar *name;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1673
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1674 if (!equalizerwin_save_auto_window)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1675 equalizerwin_create_list_window(equalizer_auto_presets,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1676 _("Save auto-preset"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1677 &equalizerwin_save_auto_window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1678 GTK_SELECTION_SINGLE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1679 &equalizerwin_save_auto_entry,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1680 GTK_STOCK_OK,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1681 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1682 GTK_STOCK_CANCEL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1683 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1684 (equalizerwin_save_auto_ok),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1685 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1686 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1687 (equalizerwin_save_auto_select));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1688 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1689 gtk_window_present(GTK_WINDOW(equalizerwin_save_auto_window));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1690
2094
7ea9a6177232 [svn] Update equalizer.c to new API
kiyoshi
parents: 1940
diff changeset
1691 name = playlist_get_filename(playlist_get_active(),
7ea9a6177232 [svn] Update equalizer.c to new API
kiyoshi
parents: 1940
diff changeset
1692 playlist_get_position(playlist_get_active()));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1693
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1694 if (name) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1695 gtk_entry_set_text(GTK_ENTRY(equalizerwin_save_auto_entry),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1696 g_basename(name));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1697 g_free(name);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1698 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1699 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1700 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1701
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1702 case EQUALIZER_PRESETS_SAVE_DEFAULT:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1703 equalizer_presets =
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1704 equalizerwin_save_preset(equalizer_presets, "Default",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1705 "eq.preset");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1706 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1707
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1708 case EQUALIZER_PRESETS_SAVE_TO_FILE:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1709 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1710 gchar *songname;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1711
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1712 dialog = make_filebrowser(_("Save equalizer preset"), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1713 g_signal_connect(dialog, "response",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1714 G_CALLBACK(equalizerwin_file_chooser_on_response),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1715 save_preset_file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1716
2094
7ea9a6177232 [svn] Update equalizer.c to new API
kiyoshi
parents: 1940
diff changeset
1717 songname = playlist_get_filename(playlist_get_active(),
7ea9a6177232 [svn] Update equalizer.c to new API
kiyoshi
parents: 1940
diff changeset
1718 playlist_get_position(playlist_get_active()));
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1719 if (songname) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1720 gchar *eqname = g_strdup_printf("%s.%s", songname,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1721 cfg.eqpreset_extension);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1722 g_free(songname);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1723 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1724 eqname);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1725 g_free(eqname);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1726 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1727
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1728 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1729 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1730
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1731 case EQUALIZER_PRESETS_SAVE_TO_WINAMPFILE:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1732 dialog = make_filebrowser(_("Save equalizer preset"), TRUE);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1733 g_signal_connect(dialog, "response",
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1734 G_CALLBACK(equalizerwin_file_chooser_on_response),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1735 save_winamp_file);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1736 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1737
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1738 case EQUALIZER_PRESETS_DELETE_PRESET:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1739 if (!equalizerwin_delete_window)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1740 equalizerwin_create_list_window(equalizer_presets,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1741 _("Delete preset"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1742 &equalizerwin_delete_window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1743 GTK_SELECTION_EXTENDED, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1744 GTK_STOCK_DELETE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1745 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1746 GTK_STOCK_CLOSE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1747 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1748 (equalizerwin_delete_delete),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1749 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1750 NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1751 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1752 gtk_window_present(GTK_WINDOW(equalizerwin_delete_window));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1753
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1754 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1755
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1756 case EQUALIZER_PRESETS_DELETE_AUTOPRESET:
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1757 if (!equalizerwin_delete_auto_window)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1758 equalizerwin_create_list_window(equalizer_auto_presets,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1759 _("Delete auto-preset"),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1760 &equalizerwin_delete_auto_window,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1761 GTK_SELECTION_EXTENDED, NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1762 GTK_STOCK_DELETE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1763 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1764 GTK_STOCK_CLOSE,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1765 G_CALLBACK
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1766 (equalizerwin_delete_auto_delete),
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1767 NULL,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1768 NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1769 else
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1770 gtk_window_present(GTK_WINDOW(equalizerwin_delete_auto_window));
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1771
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1772 break;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1773 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1774 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1775
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1776 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1777 equalizerwin_load_auto_preset(const gchar * filename)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1778 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1779 gchar *presetfilename, *directory;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1780 RcFile *rcfile;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1781
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1782 g_return_if_fail(filename != NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1783
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1784 if (!cfg.equalizer_autoload)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1785 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1786
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1787 presetfilename = g_strconcat(filename, ".", cfg.eqpreset_extension, NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1788
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1789 /* First try to find a per file preset file */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1790 if (strlen(cfg.eqpreset_extension) > 0 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1791 (rcfile = bmp_rcfile_open(presetfilename)) != NULL) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1792 g_free(presetfilename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1793 equalizerwin_read_bmp_preset(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1794 bmp_rcfile_free(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1795 return;
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1796 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1797
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1798 g_free(presetfilename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1799
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1800 directory = g_path_get_dirname(filename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1801 presetfilename = g_build_filename(directory, cfg.eqpreset_default_file,
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1802 NULL);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1803 g_free(directory);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1804
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1805 /* Try to find a per directory preset file */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1806 if (strlen(cfg.eqpreset_default_file) > 0 &&
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1807 (rcfile = bmp_rcfile_open(presetfilename)) != NULL) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1808 equalizerwin_read_bmp_preset(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1809 bmp_rcfile_free(rcfile);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1810 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1811 else if (!equalizerwin_load_preset
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1812 (equalizer_auto_presets, g_basename(filename))) {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1813 /* Fall back to the oldstyle auto presets */
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1814 equalizerwin_load_preset(equalizer_presets, "Default");
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1815 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1816
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1817 g_free(presetfilename);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1818 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1819
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1820 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1821 equalizerwin_set_preamp(gfloat preamp)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1822 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1823 eqslider_set_position(equalizerwin_preamp, preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1824 equalizerwin_eq_changed();
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1825 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1826
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1827 void
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1828 equalizerwin_set_band(gint band, gfloat value)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1829 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1830 g_return_if_fail(band >= 0 && band < 10);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1831 eqslider_set_position(equalizerwin_bands[band], value);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1832 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1833
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1834 gfloat
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1835 equalizerwin_get_preamp(void)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1836 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1837 return eqslider_get_position(equalizerwin_preamp);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1838 }
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1839
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1840 gfloat
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1841 equalizerwin_get_band(gint band)
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1842 {
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1843 g_return_val_if_fail(band >= 0 && band < 10, 0);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1844 return eqslider_get_position(equalizerwin_bands[band]);
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents:
diff changeset
1845 }