annotate Plugins/UserInterface/wa2gui/equalizer.c @ 1652:62c5bff8a05b trunk

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