annotate src/xs_config.c @ 712:f82e0adf19f0

Disable optimization button when distortion patched libSIDPlay2 is in use, it's not supported there.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Feb 2009 11:14:18 +0200
parents d18884383ca3
children 06db79680afe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 Configuration dialog
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
324
dd201740a720 Changed copyright text.
Matti Hamalainen <ccr@tnsp.org>
parents: 308
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
422
d2e6682d3ef8 Copyright year update
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
412
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
19 You should have received a copy of the GNU General Public License along
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
7f694e5a1493 Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 402
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
23 #include "xs_config.h"
533
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
24
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
25 #ifdef AUDACIOUS_PLUGIN
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
26 #include <audacious/plugin.h>
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
27 #define XS_CONFIG_FILE ConfigDb
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
28 #define XS_CONFIG_OPEN aud_cfg_db_open
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
29 #define XS_CONFIG_FREE aud_cfg_db_close
533
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
30
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
31 #define XS_CFG_SET_STRING aud_cfg_db_set_string
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
32 #define XS_CFG_SET_FLOAT aud_cfg_db_set_float
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
33 #define XS_CFG_SET_INT aud_cfg_db_set_int
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
34 #define XS_CFG_SET_BOOL aud_cfg_db_set_bool
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
35 #define XS_CFG_GET_STRING aud_cfg_db_get_string
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
36 #define XS_CFG_GET_FLOAT aud_cfg_db_get_float
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
37 #define XS_CFG_GET_INT aud_cfg_db_get_int
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
38 #define XS_CFG_GET_BOOL aud_cfg_db_get_bool
533
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
39 #else
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
40 #include <xmms/configfile.h>
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
41 #define XS_CONFIG_FILE ConfigFile
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
42 #define XS_CONFIG_OPEN xmms_cfg_open_default_file
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
43 #define XS_CONFIG_FREE xmms_cfg_free
533
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
44
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
45 #define XS_CFG_SET_STRING xmms_cfg_write_string
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
46 #define XS_CFG_SET_FLOAT xmms_cfg_write_float
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
47 #define XS_CFG_SET_INT xmms_cfg_write_int
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
48 #define XS_CFG_SET_BOOL xmms_cfg_write_boolean
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
49 #define XS_CFG_GET_STRING xmms_cfg_read_string
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
50 #define XS_CFG_GET_FLOAT xmms_cfg_read_float
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
51 #define XS_CFG_GET_INT xmms_cfg_read_int
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
52 #define XS_CFG_GET_BOOL xmms_cfg_read_boolean
533
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
53 #endif
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
54 #include <stdio.h>
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
55 #include <ctype.h>
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
56 #include "xs_glade.h"
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
57 #include "xs_interface.h"
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
58 #include "xs_support.h"
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
59
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 /*
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
62 * Global widgets
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
64 static GtkWidget *xs_configwin = NULL,
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
65 *xs_sldb_fileselector = NULL,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
66 *xs_stil_fileselector = NULL,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
67 *xs_hvsc_selector = NULL,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
68 *xs_filt_importselector = NULL,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
69 *xs_filt_exportselector = NULL;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
70
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
71 #define LUW(x) lookup_widget(xs_configwin, x)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
73 /* Samplerates
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
74 */
643
51f994f06ac4 Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
75 static const gchar *xs_samplerates_table[] = {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
76 "8000", "11025", "22050",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
77 "44100", "48000", "64000",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
78 "96000"
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
79 };
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
80
643
51f994f06ac4 Constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 624
diff changeset
81 static const gint xs_nsamplerates_table = (sizeof(xs_samplerates_table) / sizeof(xs_samplerates_table[0]));
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 * Configuration specific stuff
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 */
228
a9a5924eb10c Have and use a mutex for xs_cfg configuration structure.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
86 XS_MUTEX(xs_cfg);
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
87 struct xs_cfg_t xs_cfg;
228
a9a5924eb10c Have and use a mutex for xs_cfg configuration structure.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
88
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
89 static xs_cfg_item_t xs_cfgtable[] = {
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
90 { CTYPE_INT, &xs_cfg.audioBitsPerSample, "audioBitsPerSample" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
91 { CTYPE_INT, &xs_cfg.audioChannels, "audioChannels" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
92 { CTYPE_INT, &xs_cfg.audioFrequency, "audioFrequency" },
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
93
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
94 { CTYPE_BOOL, &xs_cfg.mos8580, "mos8580" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
95 { CTYPE_BOOL, &xs_cfg.forceModel, "forceModel" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
96 { CTYPE_BOOL, &xs_cfg.emulateFilters, "emulateFilters" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
97 { CTYPE_FLOAT, &xs_cfg.sid1FilterFs, "filterFs" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
98 { CTYPE_FLOAT, &xs_cfg.sid1FilterFm, "filterFm" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
99 { CTYPE_FLOAT, &xs_cfg.sid1FilterFt, "filterFt" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
100 { CTYPE_INT, &xs_cfg.memoryMode, "memoryMode" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
101 { CTYPE_INT, &xs_cfg.clockSpeed, "clockSpeed" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
102 { CTYPE_BOOL, &xs_cfg.forceSpeed, "forceSpeed" },
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
103
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
104 { CTYPE_INT, &xs_cfg.playerEngine, "playerEngine" },
190
e036ad3350d6 Cleanup
Matti Hamalainen <ccr@tnsp.org>
parents: 177
diff changeset
105
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
106 { CTYPE_INT, &xs_cfg.sid2Builder, "sid2Builder" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
107 { CTYPE_INT, &xs_cfg.sid2OptLevel, "sid2OptLevel" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
108 { CTYPE_INT, &xs_cfg.sid2NFilterPresets, "sid2NFilterPresets" },
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
109
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
110 { CTYPE_BOOL, &xs_cfg.oversampleEnable, "oversampleEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
111 { CTYPE_INT, &xs_cfg.oversampleFactor, "oversampleFactor" },
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
112
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
113 { CTYPE_BOOL, &xs_cfg.playMaxTimeEnable, "playMaxTimeEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
114 { CTYPE_BOOL, &xs_cfg.playMaxTimeUnknown, "playMaxTimeUnknown" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
115 { CTYPE_INT, &xs_cfg.playMaxTime, "playMaxTime" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
116 { CTYPE_BOOL, &xs_cfg.playMinTimeEnable, "playMinTimeEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
117 { CTYPE_INT, &xs_cfg.playMinTime, "playMinTime" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
118 { CTYPE_BOOL, &xs_cfg.songlenDBEnable, "songlenDBEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
119 { CTYPE_STR, &xs_cfg.songlenDBPath, "songlenDBPath" },
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
120
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
121 { CTYPE_BOOL, &xs_cfg.stilDBEnable, "stilDBEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
122 { CTYPE_STR, &xs_cfg.stilDBPath, "stilDBPath" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
123 { CTYPE_STR, &xs_cfg.hvscPath, "hvscPath" },
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
124
624
0bf32fa002bf Merge in some Aud-SID #ifs etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
125 #ifndef AUDACIOUS_PLUGIN
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
126 { CTYPE_INT, &xs_cfg.subsongControl, "subsongControl" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
127 { CTYPE_BOOL, &xs_cfg.detectMagic, "detectMagic" },
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
128 #endif
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
129
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
130 { CTYPE_BOOL, &xs_cfg.titleOverride, "titleOverride" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
131 { CTYPE_STR, &xs_cfg.titleFormat, "titleFormat" },
258
e255f23abf33 Automatic subtune changing options added to config.
Matti Hamalainen <ccr@tnsp.org>
parents: 245
diff changeset
132
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
133 { CTYPE_BOOL, &xs_cfg.subAutoEnable, "subAutoEnable" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
134 { CTYPE_BOOL, &xs_cfg.subAutoMinOnly, "subAutoMinOnly" },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
135 { CTYPE_INT, &xs_cfg.subAutoMinTime, "subAutoMinTime" },
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
136 };
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
137
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
138 static const gint xs_cfgtable_max = (sizeof(xs_cfgtable) / sizeof(xs_cfgtable[0]));
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
139
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
140
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
141 static xs_wid_item_t xs_widtable[] = {
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
142 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_16bit", &xs_cfg.audioBitsPerSample, XS_RES_16BIT },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
143 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_8bit", &xs_cfg.audioBitsPerSample, XS_RES_8BIT },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
144 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_mono", &xs_cfg.audioChannels, XS_CHN_MONO },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
145 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_stereo", &xs_cfg.audioChannels, XS_CHN_STEREO },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
146 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_autopan", &xs_cfg.audioChannels, XS_CHN_AUTOPAN },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
147 { WTYPE_COMBO, CTYPE_INT, "cfg_samplerate", &xs_cfg.audioFrequency, XS_AUDIO_FREQ },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
148 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_oversample", &xs_cfg.oversampleEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
149 { WTYPE_SPIN, CTYPE_INT, "cfg_oversample_factor",&xs_cfg.oversampleFactor, 0 },
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
150
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
151 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay1", &xs_cfg.playerEngine, XS_ENG_SIDPLAY1 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
152 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay2", &xs_cfg.playerEngine, XS_ENG_SIDPLAY2 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
153 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_real", &xs_cfg.memoryMode, XS_MPU_REAL },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
154 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_banksw", &xs_cfg.memoryMode, XS_MPU_BANK_SWITCHING },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
155 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_transrom", &xs_cfg.memoryMode, XS_MPU_TRANSPARENT_ROM },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
156 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_playsid", &xs_cfg.memoryMode, XS_MPU_PLAYSID_ENVIRONMENT },
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
157
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
158 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_mos8580", &xs_cfg.mos8580, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
159 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sid_force", &xs_cfg.forceModel, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
160 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_ntsc", &xs_cfg.clockSpeed, XS_CLOCK_NTSC },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
161 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_pal", &xs_cfg.clockSpeed, XS_CLOCK_PAL },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
162 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_clock_force", &xs_cfg.forceSpeed, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
163 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sp2_opt", &xs_cfg.sid2OptLevel, 0 },
87
94497283affa Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
164
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
165 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sp2_resid", &xs_cfg.sid2Builder, XS_BLD_RESID },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
166 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sp2_hardsid", &xs_cfg.sid2Builder, XS_BLD_HARDSID },
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
167
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
168 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_filters", &xs_cfg.emulateFilters, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
169 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_fs", &xs_cfg.sid1FilterFs, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
170 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_fm", &xs_cfg.sid1FilterFm, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
171 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_ft", &xs_cfg.sid1FilterFt, 0 },
64
d3bb914e3af3 Fixes for sidplay2 stuff
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
172
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
173 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_enable", &xs_cfg.playMaxTimeEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
174 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_unknown", &xs_cfg.playMaxTimeUnknown, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
175 { WTYPE_SPIN, CTYPE_INT, "cfg_maxtime", &xs_cfg.playMaxTime, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
176 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_mintime_enable", &xs_cfg.playMinTimeEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
177 { WTYPE_SPIN, CTYPE_INT, "cfg_mintime", &xs_cfg.playMinTime, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
178 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_sld_enable", &xs_cfg.songlenDBEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
179 { WTYPE_TEXT, CTYPE_STR, "cfg_sld_dbpath", &xs_cfg.songlenDBPath, 0 },
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
180
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
181 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_stil_enable", &xs_cfg.stilDBEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
182 { WTYPE_TEXT, CTYPE_STR, "cfg_stil_dbpath", &xs_cfg.stilDBPath, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
183 { WTYPE_TEXT, CTYPE_STR, "cfg_hvsc_path", &xs_cfg.hvscPath, 0 },
360
3bea6584259f Indentation fixes and SID model forcing
Matti Hamalainen <ccr@tnsp.org>
parents: 359
diff changeset
184
624
0bf32fa002bf Merge in some Aud-SID #ifs etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
185 #ifndef AUDACIOUS_PLUGIN
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
186 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_none", &xs_cfg.subsongControl, XS_SSC_NONE },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
187 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_seek", &xs_cfg.subsongControl, XS_SSC_SEEK },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
188 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_popup", &xs_cfg.subsongControl, XS_SSC_POPUP },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
189 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_patch", &xs_cfg.subsongControl, XS_SSC_PATCH },
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
190
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
191 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_detectmagic", &xs_cfg.detectMagic, 0 },
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
192 #endif
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
193
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
194 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_ftitle_override", &xs_cfg.titleOverride, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
195 { WTYPE_TEXT, CTYPE_STR, "cfg_ftitle_format", &xs_cfg.titleFormat, 0 },
72
e3b205a6bc7e Lots re-arranging and new code for upcoming modularization.
Matti Hamalainen <ccr@tnsp.org>
parents: 69
diff changeset
196
684
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
197 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_enable", &xs_cfg.subAutoEnable, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
198 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_min_only", &xs_cfg.subAutoMinOnly, 0 },
4bf845090a25 Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 666
diff changeset
199 { WTYPE_SPIN, CTYPE_INT, "cfg_subauto_mintime", &xs_cfg.subAutoMinTime, 0 },
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
200 };
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
201
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
202 static const gint xs_widtable_max = (sizeof(xs_widtable) / sizeof(xs_widtable[0]));
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
205 /* Reset/initialize the configuration
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 */
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
207 void xs_init_configuration(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
209 /* Lock configuration mutex */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
210 XSDEBUG("initializing configuration ...\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
211 XS_MUTEX_LOCK(xs_cfg);
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
212
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
213 memset(&xs_cfg, 0, sizeof(xs_cfg));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
214
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
215 /* Initialize values with sensible defaults */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
216 xs_cfg.audioBitsPerSample = XS_RES_16BIT;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
217 xs_cfg.audioChannels = XS_CHN_MONO;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
218 xs_cfg.audioFrequency = XS_AUDIO_FREQ;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
219
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
220 xs_cfg.mos8580 = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
221 xs_cfg.forceModel = FALSE;
230
608f31f6c095 Raw cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 228
diff changeset
222
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
223 /* Filter values */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
224 xs_cfg.emulateFilters = TRUE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
225 xs_cfg.sid1FilterFs = XS_SIDPLAY1_FS;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
226 xs_cfg.sid1FilterFm = XS_SIDPLAY1_FM;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
227 xs_cfg.sid1FilterFt = XS_SIDPLAY1_FT;
44
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
228
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
229 #ifdef HAVE_SIDPLAY2
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
230 xs_cfg.playerEngine = XS_ENG_SIDPLAY2;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
231 xs_cfg.memoryMode = XS_MPU_REAL;
44
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
232 #else
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
233 #ifdef HAVE_SIDPLAY1
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
234 xs_cfg.playerEngine = XS_ENG_SIDPLAY1;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
235 xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING;
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
236 #else
141
7327a985aee8 Typofixes
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
237 #error This should not happen! No emulator engines configured in!
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
238 #endif
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
239 #endif
44
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
240
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
241 xs_cfg.clockSpeed = XS_CLOCK_PAL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
242 xs_cfg.forceSpeed = FALSE;
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
243
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
244 xs_cfg.sid2OptLevel = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
245 xs_cfg.sid2NFilterPresets = 0;
621
11e24183ff23 Properly initialize xs_cfg struct; Check for 0 in sid2NFilterPresets.
Matti Hamalainen <ccr@tnsp.org>
parents: 620
diff changeset
246
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
247 #ifdef HAVE_RESID_BUILDER
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
248 xs_cfg.sid2Builder = XS_BLD_RESID;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
249 #else
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
250 #ifdef HAVE_HARDSID_BUILDER
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
251 xs_cfg.sid2Builder = XS_BLD_HARDSID;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
252 #else
89
b3f5b731a3fe Fixed a problem with only libsidplay1 installed
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
253 #ifdef HAVE_SIDPLAY2
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
254 #error This should not happen! No supported SIDPlay2 builders configured in!
89
b3f5b731a3fe Fixed a problem with only libsidplay1 installed
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
255 #endif
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
256 #endif
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
257 #endif
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
258
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
259 xs_cfg.oversampleEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
260 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
262 xs_cfg.playMaxTimeEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
263 xs_cfg.playMaxTimeUnknown = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
264 xs_cfg.playMaxTime = 150;
169
676ec1a1ab93 Minimum playtime option
Matti Hamalainen <ccr@tnsp.org>
parents: 161
diff changeset
265
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
266 xs_cfg.playMinTimeEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
267 xs_cfg.playMinTime = 15;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
268
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
269 xs_cfg.songlenDBEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
270 xs_pstrcpy(&xs_cfg.songlenDBPath, "~/C64Music/Songlengths.txt");
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
271
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
272 xs_cfg.stilDBEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
273 xs_pstrcpy(&xs_cfg.stilDBPath, "~/C64Music/DOCUMENTS/STIL.txt");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
274 xs_pstrcpy(&xs_cfg.hvscPath, "~/C64Music");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
275
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
276 #if defined(HAVE_SONG_POSITION) && !defined(AUDACIOUS_PLUGIN)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
277 xs_cfg.subsongControl = XS_SSC_PATCH;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
278 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
279 xs_cfg.subsongControl = XS_SSC_POPUP;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
280 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
281 xs_cfg.detectMagic = FALSE;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
283 #ifndef HAVE_XMMSEXTRA
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
284 xs_cfg.titleOverride = TRUE;
45
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
285 #endif
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
286
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
287 #ifdef AUDACIOUS_PLUGIN
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
288 xs_pstrcpy(&xs_cfg.titleFormat, "${artist} - ${title} (${copyright}) <${subsong-id}/${subsong-num}> [${sid-model}/${sid-speed}]");
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
289 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
290 xs_pstrcpy(&xs_cfg.titleFormat, "%p - %t (%c) <%n/%N> [%m/%C]");
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
291 #endif
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
292
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
293 xs_cfg.subAutoEnable = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
294 xs_cfg.subAutoMinOnly = TRUE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
295 xs_cfg.subAutoMinTime = 15;
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
296
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
297
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
298 /* Unlock the configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
299 XS_MUTEX_UNLOCK(xs_cfg);
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
300 }
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
301
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
302
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
303 /* Filter configuration handling
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
304 */
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
305 #define XS_FITEM (4 * 2)
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
306
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
307 static gboolean xs_filter_load_into(XS_CONFIG_FILE *cfg, gint nFilter, xs_sid2_filter_t *pResult)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
308 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
309 gchar tmpKey[64], *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
310 gint i, j;
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
311
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
312 /* Get fields from config */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
313 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
314 if (!XS_CFG_GET_INT(cfg, XS_CONFIG_IDENT, tmpKey, &(pResult->npoints)))
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
315 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
316
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
317 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dName", nFilter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
318 if (!XS_CFG_GET_STRING(cfg, XS_CONFIG_IDENT, tmpKey, &tmpStr))
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
319 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
320
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
321 pResult->name = g_strdup(tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
322 if (pResult->name == NULL) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
323 g_free(pResult);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
324 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
325 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
326
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
327 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dPoints", nFilter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
328 if (!XS_CFG_GET_STRING(cfg, XS_CONFIG_IDENT, tmpKey, &tmpStr))
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
329 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
330
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
331 for (i = 0, j = 0; i < pResult->npoints; i++, j += XS_FITEM) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
332 if (sscanf(&tmpStr[j], "%4x%4x",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
333 &(pResult->points[i].x),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
334 &(pResult->points[i].y)) != 2)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
335 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
336 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
337
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
338 return TRUE;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
339 }
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
340
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
341
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
342 static xs_sid2_filter_t * xs_filter_load(XS_CONFIG_FILE *cfg, gint nFilter)
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
343 {
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
344 xs_sid2_filter_t *pResult;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
345
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
346 /* Allocate filter struct */
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
347 if ((pResult = g_malloc0(sizeof(xs_sid2_filter_t))) == NULL)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
348 return NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
349
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
350 if (!xs_filter_load_into(cfg, nFilter, pResult)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
351 g_free(pResult);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
352 return NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
353 } else
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
354 return pResult;
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
355 }
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
356
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
357 #if 0
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
358 static gboolean xs_filter_save(XS_CONFIG_FILE *cfg, xs_sid2_filter_t *pFilter, gint nFilter)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
359 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
360 gchar *tmpValue, tmpKey[64];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
361 gint i, j;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
362
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
363 /* Allocate memory for value string */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
364 tmpValue = g_malloc(sizeof(gchar) * XS_FITEM * (pFilter->npoints + 1));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
365 if (tmpValue == NULL)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
366 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
367
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
368 /* Make value string */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
369 for (i = 0, j = 0; i < pFilter->npoints; i++, j += XS_FITEM) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
370 g_snprintf(&tmpValue[j], XS_FITEM+1, "%04x%04x",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
371 pFilter->points[i].x,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
372 pFilter->points[i].y);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
373 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
374
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
375 /* Write into the configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
376 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dName", nFilter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
377 XS_CFG_SET_STRING(cfg, XS_CONFIG_IDENT, tmpKey, pFilter->name);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
378
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
379 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
380 XS_CFG_SET_INT(cfg, XS_CONFIG_IDENT, tmpKey, pFilter->npoints);
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
381
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
382 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dPoints", nFilter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
383 XS_CFG_SET_STRING(cfg, XS_CONFIG_IDENT, tmpKey, tmpValue);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
384
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
385 g_free(tmpValue);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
386 return TRUE;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
387 }
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
388 #endif
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
389
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
390 /* Filter exporting and importing. These functions export/import
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
391 * filter settings to/from SIDPlay2 INI-type files.
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
392 */
600
7fcaf6b59b20 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 593
diff changeset
393 static gboolean xs_fgetitem(gchar *inLine, size_t *linePos, gchar sep, gchar *tmpStr, size_t tmpMax)
7fcaf6b59b20 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 593
diff changeset
394 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
395 size_t i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
396 for (i = 0; i < tmpMax && inLine[*linePos] &&
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
397 !isspace(inLine[*linePos]) &&
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
398 inLine[*linePos] != sep; i++, (*linePos)++)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
399 tmpStr[i] = inLine[*linePos];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
400 tmpStr[i] = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
401 xs_findnext(inLine, linePos);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
402 return (inLine[*linePos] == sep);
600
7fcaf6b59b20 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 593
diff changeset
403 }
7fcaf6b59b20 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 593
diff changeset
404
711
d18884383ca3 Fix off by one.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
405
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
406 static gboolean xs_filters_import(const gchar *pcFilename, xs_sid2_filter_t **pFilters, gint *nFilters)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
407 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
408 FILE *inFile;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
409 gchar inLine[XS_BUF_SIZE], tmpStr[XS_BUF_SIZE];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
410 gchar *sectName = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
411 gboolean sectBegin;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
412 size_t lineNum, i;
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
413 xs_sid2_filter_t *tmpFilter;
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
414
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
415 fprintf(stderr, "xs_filters_import(%s)\n", pcFilename);
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
416
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
417 if ((inFile = fopen(pcFilename, "ra")) == NULL)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
418 return FALSE;
593
91ca76e6c23f More work towards filter configuration.
Matti Hamalainen <ccr@tnsp.org>
parents: 592
diff changeset
419
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
420 fprintf(stderr, "importing...\n");
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
421
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
422 sectBegin = FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
423 lineNum = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
424 while (fgets(inLine, XS_BUF_SIZE, inFile) != NULL) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
425 size_t linePos = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
426 lineNum++;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
427
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
428 xs_findnext(inLine, &linePos);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
429 if (isalpha(inLine[linePos]) && sectBegin) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
430 /* A new key/value pair */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
431 if (!xs_fgetitem(inLine, &linePos, '=', tmpStr, XS_BUF_SIZE)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
432 fprintf(stderr, "invalid line: %s [expect =']'", inLine);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
433 } else {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
434 linePos++;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
435 xs_findnext(inLine, &linePos);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
436 if (!strncmp(tmpStr, "points", 6)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
437 fprintf(stderr, "points=%s\n", &inLine[linePos]);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
438 } else if (!strncmp(tmpStr, "point", 5)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
439 } else if (!strncmp(tmpStr, "type", 4)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
440 } else {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
441 fprintf(stderr, "warning: ukn def: %s @ %s\n",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
442 tmpStr, sectName);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
443 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
444 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
445 } else if (inLine[linePos] == '[') {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
446 /* Check for existing section */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
447 if (sectBegin) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
448 /* Submit definition */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
449 fprintf(stderr, "filter ends: %s\n", sectName);
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
450 if ((tmpFilter = g_malloc0(sizeof(xs_sid2_filter_t))) == NULL) {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
451 fprintf(stderr, "could not allocate ..\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
452 } else {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
453
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
454 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
455 g_free(sectName);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
456 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
457
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
458 /* New filter(?) section starts */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
459 linePos++;
711
d18884383ca3 Fix off by one.
Matti Hamalainen <ccr@tnsp.org>
parents: 702
diff changeset
460 for (i = 0; i < XS_BUF_SIZE-1 && inLine[linePos] && inLine[linePos] != ']'; i++, linePos++)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
461 tmpStr[i] = inLine[linePos];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
462 tmpStr[i] = 0;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
463
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
464 if (inLine[linePos] != ']') {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
465 fprintf(stderr, "invalid! expected ']': %s\n", inLine);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
466 } else {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
467 sectName = strdup(tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
468 fprintf(stderr, "filter: %s\n", sectName);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
469 sectBegin = TRUE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
470 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
471 } else if ((inLine[linePos] != ';') && (inLine[linePos] != 0)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
472 /* Syntax error */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
473 fprintf(stderr, "syntax error: %s\n", inLine);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
474 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
475 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
476
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
477 fclose(inFile);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
478 return TRUE;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
479 }
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
480
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
481
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
482 static gboolean xs_filters_export(const gchar *pcFilename, xs_sid2_filter_t **pFilters, gint nFilters)
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
483 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
484 FILE *outFile;
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
485 xs_sid2_filter_t *f;
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
486 gint n;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
487
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
488 /* Open/create the file */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
489 if ((outFile = fopen(pcFilename, "wa")) == NULL)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
490 return FALSE;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
491
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
492 /* Header */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
493 fprintf(outFile,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
494 "; SIDPlay2 compatible filter definition file\n"
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
495 "; Exported by " PACKAGE_STRING "\n\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
496
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
497 /* Write each filter spec in "INI"-style format */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
498 for (n = 0; n < nFilters; n++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
499 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
500 f = pFilters[n];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
501
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
502 fprintf(outFile,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
503 "[%s]\n"
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
504 "type=1\n"
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
505 "points=%d\n",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
506 f->name, f->npoints);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
507
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
508 for (i = 0; i < f->npoints; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
509 fprintf(outFile,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
510 "point%d=%d,%d\n",
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
511 i + 1,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
512 f->points[i].x,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
513 f->points[i].y);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
514 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
515
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
516 fprintf(outFile, "\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
517 f++;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
518 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
519
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
520 fclose(outFile);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
521 return TRUE;
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
522 }
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
523
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
524 /* Get the configuration (from file or default)
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
525 */
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
526 void xs_read_configuration(void)
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
527 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
528 XS_CONFIG_FILE *cfg;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
529 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
530 gchar *tmpStr;
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
531
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
532 /* Try to open the XMMS configuration file */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
533 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
534 XSDEBUG("loading from config-file ...\n");
271
eebb38debe35 Separate xs_init_configuration() from xs_read_configuration()
Matti Hamalainen <ccr@tnsp.org>
parents: 260
diff changeset
535
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
536 cfg = XS_CONFIG_OPEN();
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
537
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
538 if (cfg == NULL) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
539 XSDEBUG("Could not open configuration, trying to write defaults...\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
540 xs_write_configuration();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
541 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
542 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
544 /* Read the new settings from XMMS configuration file */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
545 for (i = 0; i < xs_cfgtable_max; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
546 switch (xs_cfgtable[i].itemType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
547 case CTYPE_INT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
548 XS_CFG_GET_INT(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
549 xs_cfgtable[i].itemName,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
550 (gint *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
551 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
552
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
553 case CTYPE_BOOL:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
554 XS_CFG_GET_BOOL(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
555 xs_cfgtable[i].itemName,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
556 (gboolean *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
557 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
558
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
559 case CTYPE_FLOAT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
560 XS_CFG_GET_FLOAT(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
561 xs_cfgtable[i].itemName,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
562 (gfloat *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
563 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
564
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
565 case CTYPE_STR:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
566 if (XS_CFG_GET_STRING(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
567 xs_cfgtable[i].itemName, (gchar **) &tmpStr)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
568 xs_pstrcpy((gchar **) xs_cfgtable[i].itemData, tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
569 g_free(tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
570 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
571 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
572 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
573 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
574
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
575 /* Filters and presets are a special case */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
576 xs_filter_load_into(cfg, 0, &xs_cfg.sid2Filter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
577
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
578 if (xs_cfg.sid2NFilterPresets > 0) {
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
579 xs_cfg.sid2FilterPresets = g_malloc0(xs_cfg.sid2NFilterPresets * sizeof(xs_sid2_filter_t *));
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
580 if (!xs_cfg.sid2FilterPresets) {
666
50e036a32db8 De-gettextize.
Matti Hamalainen <ccr@tnsp.org>
parents: 665
diff changeset
581 xs_error("Allocation of sid2FilterPresets structure failed!\n");
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
582 } else {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
583 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
584 xs_cfg.sid2FilterPresets[i] = xs_filter_load(cfg, i);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
585 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
586 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
587 }
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
588
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
589 XS_CONFIG_FREE(cfg);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
590
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
591 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
592 XSDEBUG("OK\n");
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
595
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
596 /* Write the current configuration
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
597 */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
598 gint xs_write_configuration(void)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
599 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
600 XS_CONFIG_FILE *cfg;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
601 gint i;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
602
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
603 XSDEBUG("writing configuration ...\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
604 XS_MUTEX_LOCK(xs_cfg);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
605
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
606 /* Try to open the XMMS configuration file */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
607 cfg = XS_CONFIG_OPEN();
533
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
608
9ca430524698 Audacious-related cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 524
diff changeset
609 #ifndef AUDACIOUS_PLUGIN
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
610 if (!cfg) cfg = xmms_cfg_new();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
611 if (!cfg) return -1;
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
612 #endif
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
613
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
614 /* Write the new settings to XMMS configuration file */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
615 for (i = 0; i < xs_cfgtable_max; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
616 switch (xs_cfgtable[i].itemType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
617 case CTYPE_INT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
618 XS_CFG_SET_INT(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
619 xs_cfgtable[i].itemName,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
620 *(gint *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
621 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
622
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
623 case CTYPE_BOOL:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
624 XS_CFG_SET_BOOL(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
625 xs_cfgtable[i].itemName,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
626 *(gboolean *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
627 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
628
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
629 case CTYPE_FLOAT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
630 XS_CFG_SET_FLOAT(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
631 xs_cfgtable[i].itemName,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
632 *(gfloat *) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
633 break;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
634
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
635 case CTYPE_STR:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
636 XS_CFG_SET_STRING(cfg, XS_CONFIG_IDENT,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
637 xs_cfgtable[i].itemName,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
638 *(gchar **) xs_cfgtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
639 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
640 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
641 }
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
642
552
9494fee305fa Config item changes; Unfinished filter preset handling functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 548
diff changeset
643
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
644 #ifndef AUDACIOUS_PLUGIN
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
645 xmms_cfg_write_default_file(cfg);
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
646 #endif
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
647 XS_CONFIG_FREE(cfg);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
648
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
649 XS_MUTEX_UNLOCK(xs_cfg);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
650
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
651 return 0;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
652 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
653
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
654
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
655 /* Configuration panel was canceled
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
656 */
612
32fc27395220 About window wasn't handling delete_event properly, fixed; Cleaned up event handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
657 XS_DEF_WINDOW_CLOSE(cfg_cancel, configwin)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
658
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
659
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
660 /* Configuration was accepted, save the settings
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
661 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
662 void xs_cfg_ok(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
664 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
665 gfloat tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
666 gint tmpInt;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
667 const gchar *tmpStr;
487
6357b7fe5b0d Added new WTYPE_COMBO, the audio frequency selection now uses a combobox.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
668
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
669 /* Get lock on configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
670 XS_MUTEX_LOCK(xs_cfg);
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
671
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
672 XSDEBUG("get data from widgets to config...\n");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
673
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
674 for (i = 0; i < xs_widtable_max; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
675 switch (xs_widtable[i].widType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
676 case WTYPE_BGROUP:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
677 /* Check if toggle-button is active */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
678 if (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
679 /* Yes, set the constant value */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
680 *((gint *) xs_widtable[i].itemData) = xs_widtable[i].itemSet;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
681 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
682 break;
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
683
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
684 case WTYPE_COMBO:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
685 /* Get text from text-widget */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
686 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW(xs_widtable[i].widName)));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
687 if (sscanf(tmpStr, "%d", &tmpInt) != 1)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
688 tmpInt = xs_widtable[i].itemSet;
487
6357b7fe5b0d Added new WTYPE_COMBO, the audio frequency selection now uses a combobox.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
689
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
690 *((gint *) xs_widtable[i].itemData) = tmpInt;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
691 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
692
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
693 case WTYPE_SPIN:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
694 case WTYPE_SCALE:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
695 /* Get the value */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
696 switch (xs_widtable[i].widType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
697 case WTYPE_SPIN:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
698 tmpValue = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName)))->value;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
699 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
700
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
701 case WTYPE_SCALE:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
702 tmpValue = gtk_range_get_adjustment(GTK_RANGE(LUW(xs_widtable[i].widName)))->value;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
703 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
704
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
705 default:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
706 tmpValue = -1;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
707 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
708 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
709
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
710 /* Set the value */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
711 switch (xs_widtable[i].itemType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
712 case CTYPE_INT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
713 *((gint *) xs_widtable[i].itemData) = (gint) tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
714 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
715
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
716 case CTYPE_FLOAT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
717 *((gfloat *) xs_widtable[i].itemData) = tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
718 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
719 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
720 break;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
721
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
722 case WTYPE_BUTTON:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
723 /* Check if toggle-button is active */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
724 *((gboolean *) xs_widtable[i].itemData) =
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
725 (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
726 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
727
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
728 case WTYPE_TEXT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
729 /* Get text from text-widget */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
730 xs_pstrcpy((gchar **) xs_widtable[i].itemData,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
731 gtk_entry_get_text(GTK_ENTRY(LUW(xs_widtable[i].widName))));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
732 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
733 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
734 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
735
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
736 /* Get filter settings */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
737 /*
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
738 if (!xs_curve_get_points(XS_CURVE(LUW("")), &xs_cfg.sid2Filter.points, &xs_cfg.sid2Filter.npoints)) {
666
50e036a32db8 De-gettextize.
Matti Hamalainen <ccr@tnsp.org>
parents: 665
diff changeset
739 xs_error("Warning: Could not get filter curve widget points!\n");
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
740 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
741 */
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
742
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
743 /* Release lock */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
744 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
745
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
746 /* Close window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
747 gtk_widget_destroy(xs_configwin);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
748 xs_configwin = NULL;
147
a7abcda7a86c SLDB, STIL and emulation engine settings are now updated
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
749
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
750 /* Write settings */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
751 xs_write_configuration();
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
752
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
753 /* Re-initialize */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
754 xs_reinit();
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
755 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
756
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
758 /* Confirmation window
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
759 */
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
760 gboolean xs_confirmwin_delete(GtkWidget *widget, GdkEvent *event, gpointer user_data)
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
761 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
762 (void) widget;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
763 (void) event;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
764 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
765
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
766 return FALSE;
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
767 }
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
768
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
769
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
770
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
771 /* HVSC songlength-database file selector response-functions
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
772 */
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
773 void xs_cfg_sldb_browse(GtkButton * button, gpointer user_data)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
774 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
775 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
776 (void) user_data;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
777
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
778 if (xs_sldb_fileselector != NULL) {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
779 XS_WINDOW_PRESENT(xs_sldb_fileselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
780 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
781 }
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
782
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
783 xs_sldb_fileselector = create_xs_sldb_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
784 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
785 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_sldb_fileselector), xs_cfg.songlenDBPath);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
786 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
787 gtk_widget_show(xs_sldb_fileselector);
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
788 }
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
789
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
790
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
791 void xs_sldb_fs_ok(GtkButton *button, gpointer user_data)
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
792 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
793 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
794 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
795
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
796 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
797 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_sld_dbpath")),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
798 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_sldb_fileselector)));
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
799
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
800 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
801 gtk_widget_destroy(xs_sldb_fileselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
802 xs_sldb_fileselector = NULL;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
803 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
804
612
32fc27395220 About window wasn't handling delete_event properly, fixed; Cleaned up event handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
805 XS_DEF_WINDOW_CLOSE(sldb_fs_cancel, sldb_fileselector)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
806 XS_DEF_WINDOW_DELETE(sldb_fs, sldb_fileselector)
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
807
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
808
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
809 /* STIL-database file selector response-functions
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
810 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
811 void xs_cfg_stil_browse(GtkButton * button, gpointer user_data)
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
812 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
813 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
814 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
815
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
816 if (xs_stil_fileselector != NULL) {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
817 XS_WINDOW_PRESENT(xs_stil_fileselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
818 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
819 }
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
820
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
821 xs_stil_fileselector = create_xs_stil_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
822 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
823 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_stil_fileselector), xs_cfg.stilDBPath);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
824 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
825 gtk_widget_show(xs_stil_fileselector);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
826 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
827
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
828
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
829 void xs_stil_fs_ok(GtkButton *button, gpointer user_data)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
830 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
831 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
832 (void) user_data;
579
6b2c682cc0a8 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 578
diff changeset
833
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
834 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
835 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_stil_dbpath")),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
836 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_stil_fileselector)));
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
837
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
838 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
839 gtk_widget_destroy(xs_stil_fileselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
840 xs_stil_fileselector = NULL;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
841 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
842
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
843
612
32fc27395220 About window wasn't handling delete_event properly, fixed; Cleaned up event handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
844 XS_DEF_WINDOW_CLOSE(stil_fs_cancel, stil_fileselector)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
845 XS_DEF_WINDOW_DELETE(stil_fs, stil_fileselector)
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
846
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
847
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
848 /* HVSC location selector response-functions
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
849 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
850 void xs_cfg_hvsc_browse(GtkButton * button, gpointer user_data)
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
851 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
852 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
853 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
854
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
855 if (xs_hvsc_selector != NULL) {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
856 XS_WINDOW_PRESENT(xs_hvsc_selector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
857 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
858 }
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
859
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
860 xs_hvsc_selector = create_xs_hvsc_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
861 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
862 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_hvsc_selector), xs_cfg.hvscPath);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
863 XS_MUTEX_UNLOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
864 gtk_widget_show(xs_hvsc_selector);
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
865 }
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
866
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
867
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
868 void xs_hvsc_fs_ok(GtkButton *button, gpointer user_data)
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
869 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
870 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
871 (void) user_data;
579
6b2c682cc0a8 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 578
diff changeset
872
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
873 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
874 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
875 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_selector)));
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
876
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
877 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
878 gtk_widget_destroy(xs_hvsc_selector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
879 xs_hvsc_selector = NULL;
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
880 }
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
881
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
882
612
32fc27395220 About window wasn't handling delete_event properly, fixed; Cleaned up event handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
883 XS_DEF_WINDOW_CLOSE(hvsc_fs_cancel, hvsc_selector)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
884 XS_DEF_WINDOW_DELETE(hvsc_fs, hvsc_selector)
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
885
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
886
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
887 /* Filter handling
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
888 */
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
889 void xs_cfg_sp1_filter_reset(GtkButton * button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
890 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
891 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
892 (void) user_data;
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
893
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
894 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_sp1_filter_fs"))), XS_SIDPLAY1_FS);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
895 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_sp1_filter_fm"))), XS_SIDPLAY1_FM);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
896 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_sp1_filter_ft"))), XS_SIDPLAY1_FT);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
897 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
898
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
899
702
b5b6b13a6d85 Renamed some types.
Matti Hamalainen <ccr@tnsp.org>
parents: 684
diff changeset
900 void xs_cfg_sp2_filter_update(XSCurve *curve, xs_sid2_filter_t *f)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
901 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
902 assert(curve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
903 assert(f);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
904
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
905 xs_curve_reset(curve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
906 xs_curve_set_range(curve, 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
907 if (!xs_curve_set_points(curve, f->points, f->npoints)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
908 // FIXME
666
50e036a32db8 De-gettextize.
Matti Hamalainen <ccr@tnsp.org>
parents: 665
diff changeset
909 xs_error("Warning: Could not set filter curve widget points!\n");
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
910 }
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
911 }
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
912
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
913
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
914 void xs_cfg_sp2_presets_update(void)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
915 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
916 GList *tmpList = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
917 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
918
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
919 for (i = 0; i < xs_cfg.sid2NFilterPresets; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
920 tmpList = g_list_append(tmpList,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
921 (gpointer) xs_cfg.sid2FilterPresets[i]->name);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
922 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
923
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
924 gtk_combo_set_popdown_strings(GTK_COMBO(LUW("cfg_sp2_filter_combo")), tmpList);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
925 g_list_free(tmpList);
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
926 }
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
927
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
928
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
929 void xs_cfg_sp2_filter_load(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
930 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
931 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
932 gint i, j;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
933
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
934 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
935 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
936
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
937 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
938
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
939 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry")));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
940 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
941 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
942 j = i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
943 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
944 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
945 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
946
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
947 if (j != -1) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
948 fprintf(stderr, "Updating from '%s'\n", tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
949 xs_cfg_sp2_filter_update(
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
950 XS_CURVE(LUW("cfg_sp2_filter_curve")),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
951 xs_cfg.sid2FilterPresets[i]);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
952 } else {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
953 /* error/warning: no such filter preset */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
954 fprintf(stderr, "No such filter preset '%s'!\n", tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
955 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
956
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
957 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
958 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
959
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
960
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
961 void xs_cfg_sp2_filter_save(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
962 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
963 /*
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
964 1) check if textentry matches any current filter name
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
965 yes) ask if saving over ok?
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
966 no) ...
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
967
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
968 2) save current filter to the name
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
969 */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
970 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
971 gint i, j;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
972
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
973 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
974 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
975
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
976 XS_MUTEX_LOCK(xs_cfg);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
977
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
978 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry")));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
979 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
980 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name)) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
981 j = i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
982 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
983 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
984 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
985
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
986 if (j != -1) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
987 fprintf(stderr, "Found, confirm overwrite?\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
988 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
989
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
990 fprintf(stderr, "saving!\n");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
991
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
992 xs_cfg_sp2_presets_update();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
993
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
994 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
995 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
996
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
997
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
998 void xs_cfg_sp2_filter_delete(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
999 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1000 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1001 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1002 /*
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1003 1) confirm
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1004 2) delete
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1005 */
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1006 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1007
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1008
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1009 void xs_cfg_sp2_filter_import(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1010 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1011 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1012 (void) user_data;
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1013
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1014 if (xs_filt_importselector != NULL) {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1015 XS_WINDOW_PRESENT(xs_filt_importselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1016 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1017 }
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1018
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1019 xs_filt_importselector = create_xs_filter_import_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1020 gtk_widget_show(xs_filt_importselector);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1021 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1022
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1023
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1024 void xs_filter_import_fs_ok(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1025 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1026 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1027 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1028 (void) user_data;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1029
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1030 XS_MUTEX_LOCK(xs_cfg);
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
1031
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1032 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1033 tmpStr = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_filt_importselector));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1034 xs_filters_import(tmpStr, xs_cfg.sid2FilterPresets, &xs_cfg.sid2NFilterPresets);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1035 xs_cfg_sp2_presets_update();
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1036
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1037 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1038 gtk_widget_destroy(xs_filt_importselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1039 xs_filt_importselector = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1040 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1041 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1042
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1043
612
32fc27395220 About window wasn't handling delete_event properly, fixed; Cleaned up event handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
1044 XS_DEF_WINDOW_CLOSE(filter_import_fs_cancel, filt_importselector)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1045 XS_DEF_WINDOW_DELETE(filter_import_fs, filt_importselector)
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1046
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1047
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1048 void xs_cfg_sp2_filter_export(GtkButton *button, gpointer user_data)
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1049 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1050 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1051 (void) user_data;
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1052
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1053 if (xs_filt_exportselector != NULL) {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1054 XS_WINDOW_PRESENT(xs_filt_exportselector);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1055 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1056 }
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1057
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1058 xs_filt_exportselector = create_xs_filter_export_fs();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1059 gtk_widget_show(xs_filt_exportselector);
590
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1060 }
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1061
7d94e9e5dfb7 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 589
diff changeset
1062
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1063 void xs_filter_export_fs_ok(GtkButton *button, gpointer user_data)
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1064 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1065 const gchar *tmpStr;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1066 (void) button;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1067 (void) user_data;
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1068
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1069 XS_MUTEX_LOCK(xs_cfg);
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
1070
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1071 /* Selection was accepted! */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1072 tmpStr = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_filt_exportselector));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1073 xs_filters_export(tmpStr, xs_cfg.sid2FilterPresets, xs_cfg.sid2NFilterPresets);
592
7ae251af5f83 Some macro magic for simplifying the repetitive code.
Matti Hamalainen <ccr@tnsp.org>
parents: 590
diff changeset
1074
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1075 /* Close file selector window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1076 gtk_widget_destroy(xs_filt_exportselector);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1077 xs_filt_exportselector = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1078 XS_MUTEX_UNLOCK(xs_cfg);
578
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1079 }
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1080
d9290bd40037 Moved functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 577
diff changeset
1081
612
32fc27395220 About window wasn't handling delete_event properly, fixed; Cleaned up event handling a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 608
diff changeset
1082 XS_DEF_WINDOW_CLOSE(filter_export_fs_cancel, filt_exportselector)
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1083 XS_DEF_WINDOW_DELETE(filter_export_fs, filt_exportselector)
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1084
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1085
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1086 /* Selection toggle handlers
127
ddb513bd2610 Improved audio format support, now supported formats are "queried" from
Matti Hamalainen <ccr@tnsp.org>
parents: 116
diff changeset
1087 */
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1088 void xs_cfg_emu_filters_toggled(GtkToggleButton * togglebutton, gpointer user_data)
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1089 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1090 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1091
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1092 (void) user_data;
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1093
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1094 gtk_widget_set_sensitive(LUW("cfg_filters_notebook"), isActive);
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1095 }
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1096
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1097
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1098 void xs_cfg_ftitle_override_toggled(GtkToggleButton * togglebutton, gpointer user_data)
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1099 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1100 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1101
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1102 (void) user_data;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1103
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1104 gtk_widget_set_sensitive(LUW("cfg_ftitle_box"), isActive);
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1105 }
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1106
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1107
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1108 void xs_cfg_emu_sidplay1_toggled(GtkToggleButton * togglebutton, gpointer user_data)
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1109 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1110 (void) togglebutton;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1111 (void) user_data;
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1112 }
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1113
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1114
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1115 void xs_cfg_emu_sidplay2_toggled(GtkToggleButton * togglebutton, gpointer user_data)
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1116 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1117 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1118
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1119 (void) user_data;
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1120
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1121 gtk_widget_set_sensitive(LUW("cfg_emu_mem_real"), isActive);
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1122
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1123 gtk_widget_set_sensitive(LUW("cfg_sidplay2_frame"), isActive);
712
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1124
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1125 #ifdef HAVE_SIDPLAY2_DISTORTION
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1126 /* Optimization mode removed from distortion patch */
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1127 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_opt"), FALSE);
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1128 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1129 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_opt"), isActive);
712
f82e0adf19f0 Disable optimization button when distortion patched libSIDPlay2 is in use,
Matti Hamalainen <ccr@tnsp.org>
parents: 711
diff changeset
1130 #endif
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1131
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1132 gtk_widget_set_sensitive(LUW("cfg_chn_autopan"), !isActive);
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1133
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1134 #ifdef HAVE_RESID_BUILDER
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1135 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid"), isActive);
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1136 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1137 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid"), FALSE);
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1138 #endif
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1139
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1140 #ifdef HAVE_HARDSID_BUILDER
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1141 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_hardsid"), isActive);
78
ab522ab65c85 Various fixes and improvements
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
1142 #else
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1143 gtk_widget_set_sensitive(LUW("cfg_emu_sp2_hardsid"), FALSE);
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1144 #endif
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1145 }
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1146
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1147
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1148 void xs_cfg_oversample_toggled(GtkToggleButton * togglebutton, gpointer user_data)
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1149 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1150 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1151
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1152 (void) user_data;
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1153
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1154 gtk_widget_set_sensitive(LUW("cfg_oversample_box"), isActive);
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1155 }
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1156
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1157
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1158 void xs_cfg_mintime_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data)
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1159 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1160 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1161
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1162 (void) user_data;
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1163
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1164 gtk_widget_set_sensitive(LUW("cfg_mintime_box"), isActive);
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1165 }
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1166
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1167
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1168 void xs_cfg_maxtime_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data)
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1169 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1170 gboolean isActive = GTK_TOGGLE_BUTTON(LUW("cfg_maxtime_enable"))->active;
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1171
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1172 (void) togglebutton;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1173 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1174
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1175 gtk_widget_set_sensitive(LUW("cfg_maxtime_unknown"), isActive);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1176 gtk_widget_set_sensitive(LUW("cfg_maxtime_box"), isActive);
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1177 }
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1178
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1179
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1180 void xs_cfg_sldb_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data)
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1181 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1182 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1183
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1184 (void) user_data;
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1185
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1186 gtk_widget_set_sensitive(LUW("cfg_sld_box"), isActive);
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1187 }
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1188
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1189
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1190 void xs_cfg_stil_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data)
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1191 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1192 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1193
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1194 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1195
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1196 gtk_widget_set_sensitive(LUW("cfg_stil_box1"), isActive);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1197 gtk_widget_set_sensitive(LUW("cfg_stil_box2"), isActive);
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1198 }
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1199
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1200
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1201 void xs_cfg_subauto_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data)
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1202 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1203 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1204
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1205 (void) user_data;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1206
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1207 gtk_widget_set_sensitive(LUW("cfg_subauto_min_only"), isActive);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1208 gtk_widget_set_sensitive(LUW("cfg_subauto_box"), isActive);
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1209 }
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1210
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1211
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1212 void xs_cfg_subauto_min_only_toggled(GtkToggleButton * togglebutton, gpointer user_data)
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1213 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1214 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active &&
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1215 GTK_TOGGLE_BUTTON(LUW("cfg_subauto_enable"))->active;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1216
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1217 (void) user_data;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1218
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1219 gtk_widget_set_sensitive(LUW("cfg_subauto_box"), isActive);
260
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1220 }
7a23dfef023d More subauto poking.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
1221
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1222
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1223 void xs_cfg_mintime_changed(GtkEditable * editable, gpointer user_data)
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1224 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1225 gint tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1226 GtkAdjustment *tmpAdj;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1227
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1228 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1229
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1230 tmpAdj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW("cfg_maxtime")));
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1231
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1232 tmpValue = (gint) gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(editable))->value;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1233
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1234 if (tmpValue > tmpAdj->value)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1235 gtk_adjustment_set_value(tmpAdj, tmpValue);
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1236 }
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1237
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1238
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1239 void xs_cfg_maxtime_changed(GtkEditable * editable, gpointer user_data)
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1240 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1241 gint tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1242 GtkAdjustment *tmpAdj;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1243
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1244 (void) user_data;
341
e065deeb086f Removed 'unused argument' warnings, some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 324
diff changeset
1245
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1246 tmpAdj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW("cfg_mintime")));
177
6e350784aa57 Various cleanups. Min-playtime option now works. Configuration has more
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1247
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1248 tmpValue = (gint) gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(editable))->value;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1249
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1250 if (tmpValue < tmpAdj->value)
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1251 gtk_adjustment_set_value(tmpAdj, tmpValue);
172
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1252 }
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1253
505da1389e5c Twiddling
Matti Hamalainen <ccr@tnsp.org>
parents: 169
diff changeset
1254
589
a437571d0fc5 Work on GUI and filter config code.
Matti Hamalainen <ccr@tnsp.org>
parents: 583
diff changeset
1255 XS_DEF_WINDOW_DELETE(configwin, configwin)
577
fdddab8f0c1b Scrubbing through the filter configuration code; Configuration dialog
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
1256
fdddab8f0c1b Scrubbing through the filter configuration code; Configuration dialog
Matti Hamalainen <ccr@tnsp.org>
parents: 553
diff changeset
1257
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1258 /* Execute the configuration panel
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1259 */
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1260 void xs_configure(void)
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1261 {
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1262 gint i;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1263 gfloat tmpValue;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1264 gchar tmpStr[64];
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1265 GList *tmpList = NULL;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1266 GtkWidget *tmpCurve;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1267
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1268 /* Check if the window already exists */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1269 if (xs_configwin) {
665
94186706beed Use macro wrapping for Gtk+ v1 vs v2 differences, yet again.
Matti Hamalainen <ccr@tnsp.org>
parents: 660
diff changeset
1270 XS_WINDOW_PRESENT(xs_configwin);
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1271 return;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1272 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1273
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1274 /* Create the window */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1275 xs_configwin = create_xs_configwin();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1276
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1277 /* Get lock on configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1278 XS_MUTEX_LOCK(xs_cfg);
487
6357b7fe5b0d Added new WTYPE_COMBO, the audio frequency selection now uses a combobox.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
1279
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1280 /* Add samplerates */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1281 for (i = 0; i < xs_nsamplerates_table; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1282 tmpList = g_list_append (tmpList,
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1283 (gpointer) xs_samplerates_table[i]);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1284 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1285 gtk_combo_set_popdown_strings(GTK_COMBO(LUW("cfg_samplerate_combo")), tmpList);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1286 g_list_free(tmpList);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1287
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1288 /* Create the custom filter curve widget for libSIDPlay2 */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1289 xs_cfg_sp2_presets_update();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1290 tmpCurve = xs_curve_new();
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1291 xs_cfg_sp2_filter_update(XS_CURVE(tmpCurve), &xs_cfg.sid2Filter);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1292 gtk_widget_set_name(tmpCurve, "cfg_sp2_filter_curve");
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1293 gtk_widget_ref(tmpCurve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1294 gtk_object_set_data_full(GTK_OBJECT(xs_configwin),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1295 "cfg_sp2_filter_curve", tmpCurve, (GtkDestroyNotify) gtk_widget_unref);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1296 gtk_widget_show(tmpCurve);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1297 gtk_container_add(GTK_CONTAINER(LUW("cfg_sp2_filter_frame")), tmpCurve);
548
ba80c052e425 Configuration widget naming cleanups and GUI-related improvements;
Matti Hamalainen <ccr@tnsp.org>
parents: 542
diff changeset
1298
349
b5e54614b35a More unused argument warning removal, bit of code for filter editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 346
diff changeset
1299
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1300 /* Based on available optional parts, gray out options */
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
1301 #ifndef HAVE_SIDPLAY1
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1302 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay1"), FALSE);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1303 gtk_widget_set_sensitive(LUW("cfg_box_filter_sidplay1"), FALSE);
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
1304 #endif
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
1305
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1306 #ifndef HAVE_SIDPLAY2
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1307 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2"), FALSE);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1308 gtk_widget_set_sensitive(LUW("cfg_box_filter_sidplay2"), FALSE);
75
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
1309 #endif
653c9b0d1320 SIDPlay2 support "works" now. Borked problems with threads.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
1310
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1311 gtk_widget_set_sensitive(LUW("cfg_resid_frame"), FALSE);
624
0bf32fa002bf Merge in some Aud-SID #ifs etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 621
diff changeset
1312
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1313 #if !defined(HAVE_XMMSEXTRA) && !defined(AUDACIOUS_PLUGIN)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1314 gtk_widget_set_sensitive(LUW("cfg_ftitle_override"), FALSE);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1315 xs_cfg.titleOverride = TRUE;
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1316 #endif
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1317
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1318 #if !defined(HAVE_SONG_POSITION) && !defined(AUDACIOUS_PLUGIN)
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1319 gtk_widget_set_sensitive(LUW("cfg_subctrl_patch"), FALSE);
652
7a2d62a249a4 Synchronize with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1320 #endif
647
3833592748eb Fixed configuration dialog, thanks to Joker for pointing out the flaws.
Matti Hamalainen <ccr@tnsp.org>
parents: 643
diff changeset
1321
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1322 xs_cfg_ftitle_override_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_ftitle_override")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1323 xs_cfg_emu_filters_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_emu_filters")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1324 xs_cfg_emu_sidplay1_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplay1")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1325 xs_cfg_emu_sidplay2_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplay2")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1326 xs_cfg_oversample_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_oversample")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1327 xs_cfg_mintime_enable_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_mintime_enable")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1328 xs_cfg_maxtime_enable_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_maxtime_enable")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1329 xs_cfg_sldb_enable_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_sld_enable")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1330 xs_cfg_stil_enable_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_stil_enable")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1331 xs_cfg_subauto_enable_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_subauto_enable")), NULL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1332 xs_cfg_subauto_min_only_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_subauto_min_only")), NULL);
77
3fca0b13a80a Configuration panel tweaking
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
1333
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1334
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1335 /* Set current data to widgets */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1336 for (i = 0; i < xs_widtable_max; i++) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1337 switch (xs_widtable[i].widType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1338 case WTYPE_BGROUP:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1339 assert(xs_widtable[i].itemType == CTYPE_INT);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1340 /* Check if current value matches the given one */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1341 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1342 (*((gint *) xs_widtable[i].itemData) == xs_widtable[i].itemSet));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1343 break;
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
1344
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1345 case WTYPE_COMBO:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1346 assert(xs_widtable[i].itemType == CTYPE_INT);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1347 g_snprintf(tmpStr, sizeof(tmpStr), "%d", *(gint *) xs_widtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1348 gtk_entry_set_text(GTK_ENTRY(LUW(xs_widtable[i].widName)), tmpStr);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1349 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1350
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1351 case WTYPE_SPIN:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1352 case WTYPE_SCALE:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1353 /* Get the value */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1354 switch (xs_widtable[i].itemType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1355 case CTYPE_INT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1356 tmpValue = (gfloat) * ((gint *) xs_widtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1357 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1358
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1359 case CTYPE_FLOAT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1360 tmpValue = *((gfloat *) xs_widtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1361 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1362
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1363 default:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1364 tmpValue = -1;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1365 assert(0);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1366 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1367 }
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1368
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1369 /* Set the value */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1370 switch (xs_widtable[i].widType) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1371 case WTYPE_SPIN:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1372 gtk_adjustment_set_value(gtk_spin_button_get_adjustment
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1373 (GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName))), tmpValue);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1374 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1375
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1376 case WTYPE_SCALE:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1377 gtk_adjustment_set_value(gtk_range_get_adjustment
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1378 (GTK_RANGE(LUW(xs_widtable[i].widName))), tmpValue);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1379 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1380 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1381 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1382
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1383 case WTYPE_BUTTON:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1384 assert(xs_widtable[i].itemType == CTYPE_BOOL);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1385 /* Set toggle-button */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1386 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1387 *((gboolean *) xs_widtable[i].itemData));
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1388 break;
359
b1a858b8cb1a Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents: 349
diff changeset
1389
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1390 case WTYPE_TEXT:
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1391 assert(xs_widtable[i].itemType == CTYPE_STR);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1392 /* Set text to text-widget */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1393 if (*(gchar **) xs_widtable[i].itemData != NULL) {
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1394 gtk_entry_set_text(GTK_ENTRY(LUW(xs_widtable[i].widName)),
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1395 *(gchar **) xs_widtable[i].itemData);
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1396 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1397 break;
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1398 }
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1399 }
228
a9a5924eb10c Have and use a mutex for xs_cfg configuration structure.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
1400
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1401 /* Release the configuration */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1402 XS_MUTEX_UNLOCK(xs_cfg);
228
a9a5924eb10c Have and use a mutex for xs_cfg configuration structure.
Matti Hamalainen <ccr@tnsp.org>
parents: 224
diff changeset
1403
660
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1404 /* Show the widget */
b0743dc9165d Change tabs to 4 spaces, everywhere.
Matti Hamalainen <ccr@tnsp.org>
parents: 657
diff changeset
1405 gtk_widget_show(xs_configwin);
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1406 }